|
blue i wrote: How can a dialog be centred?
By using CenterWindow() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hello im trying to print memory dump to console output stream.
<br />
for (UINT z = 0; z < 32; z++)<br />
printf("0x%0.2x ", (BYTE)(((PDWORD)((PVOID)exp->ContextRecord->Eip))[z]));<br />
Warning I get:
<br />
warning C4312: 'type cast' : conversion from 'DWORD' to 'PVOID' of greater size
exp->ContextRecord->Eip is DWORD type. Any ideas how to cast this wihout CL warning?
Thanks in advance!
|
|
|
|
|
For one, you aren't taking the address of exp->ContextRecord->Eip.
Beyond that, your code makes no sense. On the one hand, it looks like you are attempting to pull one bit at a time from the value, yet it also looks like you are trying to display each byte that makes up the DWORD value.
I'm thinking you want something more like this:
DWORD val = exp->ContextRecord->Eip;
for (int z = 0; z < 4; z++)
{
printf("0x%0.2x ", (BYTE)(val & 0xff));
val >>= 8;
}
Or just unroll the loop for a small optimization:
DWORD val = exp->ContextRecord->Eip;
printf("0x%0.2x ", (BYTE)(val & 0xff));
val >>= 8;
printf("0x%0.2x ", (BYTE)(val & 0xff));
val >>= 8;
printf("0x%0.2x ", (BYTE)(val & 0xff));
val >>= 8;
printf("0x%0.2x ", (BYTE)(val & 0xff));
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
To output a pointer value using the printf family of functions, use %p in the format string. To print a DWORD, use %lx. To get a zero-filled DWORD, use %08lx.
|
|
|
|
|
This doesnt solved my problem.
Best regards
|
|
|
|
|
I can only guess at what you were trying to do. Were you trying to dump the code at the location of an exception?
The warning itself is telling you that, if you were to recompile this code with one of the 64-bit compilers, that this line would potentially behave differently. The compiler doesn't really know that the CONTEXT type would be different on a 64-bit processor anyway and that this line therefore wouldn't compile. If you want to turn off the warning, use #pragma warning( disable: 4312 ) , or disable the /Wp64 compiler switch.
I recently saw a recommendation from someone at Microsoft that you should now just use the 64-bit compiler to check compatibility and not rely on /Wp64 anyway.
|
|
|
|
|
thanks you, disabling /Wp64 switch worked for me
|
|
|
|
|
I have a very simple question.I speficy the source files for a program in makefile as follows
PROGRAM = sq.exe
all: $(PROGRAM)
########### list of C++ source files
CPPSRCS = \
main.cpp
.......
........
########### build a list of all .obj files
OBJS = $(CPPSRCS:.cpp=.obj) $(CSRCS:.c=.obj)
########### how to link .obj files to create an executable
$(PROGRAM): $(OBJS)
$(link32) -out:$@ $(OBJS) $(LIBS) $(linkflags)
Now in case i have a large number of source files - how can i specify at directory level - viz. all cpp files under directory 'source'?
|
|
|
|
|
I want to be able to automatically install some driver files for use by my application. I have looked high and low and cant find any API documentation to help me out. Does anyone know of a way?
|
|
|
|
|
You can use ShellExecute() or CreateProcess() with devmgmt.msc.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Sorry to be such a pain. Can you eleborate a little? I have used both these functions in the past but how on earth would I use them to prompt the device manager to install some drivers from a particular location?
|
|
|
|
|
My reply was simply in response to the "Launching Device Manager" subject. It obviously could not be used to install devices/drivers.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks David.
|
|
|
|
|
I want to be able to prompt the Device Manager to install some driver files from a specific location from C++.
|
|
|
|
|
Do those driver files have a setup/install program?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
No.
They are custom drivers that have been written for our specific hardware. I have looked high and low for information on it. Im sure its possible but MSDN doesn't have all that much information.
The Linux world makes it so much easier
|
|
|
|
|
Maybe devmgr.dll has some exported functions (e.g., DeviceCreateHardwarePage() ) that can be used.
http://www.experts-exchange.com/Programming/Q_20617785.html[^]
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi,
I have a program that has a commandline option to pass a user and a password. If I start this program from within another windows program using CreateProcess, can dodgy types get hold of this commandline?
|
|
|
|
|
If it's a string literal, yes.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Someone could fairly easily view all the string literals in your .exe file. Alternatively they could replace the EXE that you are launching via CreateProcess and they could display the command line from their EXE.
|
|
|
|
|
The Process Explorer[^] utility can show the command line that any process (to which you have access) was launched with. I think it does this by using the ReadProcessMemory API. By default, processes have ACLs (security settings) set so that only the creator of the process can use this API, but this behaviour can be overridden with use of the Debug privilege, which Administrators have by default - and as we all know, most people log in to Windows as a member of the Administrators group.
|
|
|
|
|
sadly I'm talking not about advanced compiling options but fonts, background colours and the like. I realise that this is something that probably comes over time as a personal preference, but wondered if anyone had any good links on a good start. I used to have one set up when I worked in programming with black background code windows and certain keywords all coloured in to make it easier to spot types and stuff.
I'm sure someone has good info, links or advice. gratefully received
cheers
Lee
|
|
|
|
|
I use the default with a few minor changes. Red/white for numbers; Blue/white for keywords; Green/white for comments; White/blue for string literals. Black/white for all else.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|