|
Is there any reason I can't take a Snapshot of a suspended process?
It gives me error 299, "Only part of a ReadProcessMemory or WriteProcessMemory request was completed."
Arrgg!
|
|
|
|
|
Independent123 wrote: Is there any reason I can't take a Snapshot of a suspended process?
It gives me error 299...
CreateToolhelp32Snapshot() is producing error 299?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: CreateToolhelp32Snapshot() is producing error 299?
Yes, that's correct. I try to use it to create a snapshot of all the modules in a suspended process, and it gives that error.
However, when I resume the process, there is no error.
EDIT:
I just found the answer: It works by injecting code into the process, so if the process is suspended, it can't function.
|
|
|
|
|
Hello
(It maybe not related to this board, but I'm sure there is many intelligent person they can help me)
I need to know how to use a HTTP proxy server to mack a socket like connection for example for contact a whois server.
thanks you very much
Iman Ghasrfakhri
|
|
|
|
|
You can't. For general purpose socket communication for non-HTTP protocols, you need a SOCKS[^] proxy.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Hello everyone,
I am developing C++ COM native code (unmanaged C++) using Visual Studio 2005. I do not take any new features of 64-bit platform, and currently my code runs fine on 32-bit platform (e.g. Windows XP SP2).
Now I am researching how to build my code for 64-bit platform (e.g. Windows 2003 Server 64-bit R2)? Any options I need to specify in Visual Studio 2005? The best solution to me is to make a single build for both 32-bit and 64-bit platforms, is that possible?
thanks in advance,
George
|
|
|
|
|
32-bit code will run on 64-bit platforms. However, 32-bit DLLs can only load into 32-bit processes and 64-bit code into 64-bit processes, you cannot mix them. A single build is impossible if you want your code to load into a 64-bit process.
Firstly you have to pick the sort of 64-bit platform you're supporting. Windows runs on two, x64 and Itanium. Itanium is very expensive and rare - commodity 64-bit platforms are x64. (If you can boot the 32-bit OS on it, it's x64.)
In Visual Studio 2005, go to Build/Configuration Manager. In the Active Solution Platform drop-list, select New. Then select 'x64' from the 'Type or select the new platform' drop-list. If it's not present you may need to re-run Visual Studio setup and install the x64 compiler toolchain. When you click OK, Visual Studio changes the active configuration to x64 and will use the x64 compiler to build your solution. To swap between the compilers, select the appropriate configuration from this dialog or use the equivalent drop-down list in the standard toolbar.
You may need to refine your build settings slightly. If you change them in future you will need to change them for both platforms, they are not copied between the two. You can do this manually or you can select All Platforms from the Platform drop-list in Project Properties.
If you're dealing with old code, you may have to change some datatypes, whenever dealing with a variable that can hold an integer or a pointer, or that is of a type that is supposed to be able to hold the complete range of pointer values, e.g. you may have used an int for the return value of strlen , whereas it should really be a size_t , which is 64 bits on 64-bit Windows. Other places to be aware of are in handling window messages - LPARAM and WPARAM extend to 64 bits (WPARAM remains unsigned while LPARAM remains signed) - and in the use of context parameters, which commonly change to DWORD_PTR to reflect that either a numeric value or a pointer is acceptable.
The 32-bit compiler generates 64-bit portability warnings if the /Wp64 switch is enabled, but reportedly this is not as extensive as actually using the 64-bit compiler itself. As always it's best practice to compile with a high warning level (level 4 if you can) and ensure that the code compiles with no warnings.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Thanks Mike,
Your reply is so great and deserves the highest rating!
Two more comments,
1. I am developing plug-in for other application (process), and if the process itself is 64-bit on 64-bit platform, I need to re-build my DLL to 64-bit, right? Since 64-bit process can not load 32-bit DLL?
2. I have tried to create new configuration for 64-bit platform in Visual Studio 2005. I have tried that I could copy settings from existing configurations, so I copy 32-bit debug configuration to a new 64-bit debug configuration. Is it the correct operation?
In my environment, the choices are,
Mixed platforms
Any CPU
x86
x64
Win32
I want to confirm with you that I should select x64, right? What means Mixed platforms and Any CPU?
regards,
George
|
|
|
|
|
1. Yes, that's correct.
2. It sounds like you have a mix of native C++ and .NET projects in your solution. For this you'll probably have to define each of the projects manually (use the Platform drop-list next to each project in Configuration Manager).
Off-topic for this forum but relevant to your project: .NET code is inherently processor-independent - it's compiled for the specific processor architecture at runtime - but you may need to mark your code for x86 or x64 as appropriate. By default it's 'Any CPU', that is, it can run in either a 32-bit or a 64-bit process. If this is a class library (a DLL) it will be compiled to the right architecture for the process it's being loaded in. An EXE will be compiled to 32-bit code on a 32-bit OS, and run as a 32-bit process, and as 64-bit code on a 64-bit OS (and run as a 64-bit process).
You should check your .NET code for anywhere it invokes native code or makes use of the size of a pointer - perhaps casting an IntPtr to a specific-sized integer? - to ensure that you've defined the arguments correctly. Always use IntPtr when it's a pointer parameter.
If required to do things differently on the different platforms, you can mark the code explicitly as x86 or x64. You might do this if there's a function that you need that's only implemented on one or the other.
I'm guessing 'Mixed Platforms' is when you have some projects in the solution set for one platform and some for another.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Thanks Mike,
Yes, you are correct. I have a .Net (C#) project in my solution, but at current time, I can ignore it. For my native (unmanaged C++ code), I need to select x64 from configuration right?
I am also wondering if I select copy settings from Win32 (Debug/Release) to x64 configuration (Debug/Release), will the copy configuration function always work? Do I need to manually set some special items in x64 configuration?
regards,
George
|
|
|
|
|
I need to send a PCL5 command string to the printer from my code. I've never done any PCL programming. It needs to send esc characters in the string. What is the quivalent of esc character (just like "\n" is for new line cgaracter). Please let me know.
|
|
|
|
|
'\x1B'
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the reply!!! I really appreciate it!
|
|
|
|
|
After I uninstalled VC2005, I lost the file associations with VC6.
I've found a reg file on Internet, but it's not complete, so I ask for a hand here. Thanks.
Here is the reg file:
<br />
Windows Registry Editor Version 5.00<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile]<br />
@="C Source file"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20210"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile]<br />
@="C++ Source file"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20209"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile]<br />
@="Resource Template"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20212"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile]<br />
@="C Header file"<br />
"AlwaysShowExt"=""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\DefaultIcon]<br />
@="C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20211"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell]<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev]<br />
@="&Open with MSDEV"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\command]<br />
@="\"C:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec]<br />
@="Open(\"%1\")"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec\application]<br />
@="msdev"<br />
<br />
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec\topic]<br />
@="system"<br />
The candidates are .dsw .dsp .pcb .clw .opt .ncb .dsm.
|
|
|
|
|
Why not uninstalling and installing it again? surely they have a "repair" option there...
|
|
|
|
|
I have tried both methods, they didn't take effect.
|
|
|
|
|
Is there a way to determine the address of an executable's entry point using the ImageHlp library?
|
|
|
|
|
Maybe MapAndLoad() - In the LOADED_IMAGE struct, see
FileHeader.OptionalHeader.AddressOfEntryPoint
For a code sample showing how to parse an EXE yourself, see this article:
HOWTO: How To Determine Whether an Application is Console or GUI[^]
and look for IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks, that does the trick!
|
|
|
|
|
|
Armond Sarkisian wrote: Anyone out there know what the code is for C++ to check services and stop/start/restart them as needed?
That's a job for the Service Control Manager[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I'm using the code from msdn to add ACE for a folder :
http://support.microsoft.com/?scid=kb%3Ben-us%3B102102&x=9&y=10
But i've got a problem : The user I add with "GENERIC_ALL" is added but only with the special right , no with read/write/modify right. I've try this code under vista and windows 2003, and got the same result.
Can someone help me ? Thanks
PS : That work with file but not directory...
-- modified at 17:05 Saturday 13th October, 2007
|
|
|
|
|
Windows has a MapGenericMask API, but that's more for implementing your own access control, you may not know what the right GENERIC_MASK structure is. The masks should be FILE_GENERIC_READ, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE and FILE_ALL_ACCESS, but I don't think there's an actual requirement for this.
The SetEntriesInAcl API (added in Windows 2000) is a lot friendlier than that sample code! It might already do what you need.
I don't think there's any problem setting the generic bits in an ACE. It's more likely that you've not set the inheritance bits correctly. I don't have the space nor understand it well enough to give a good treatment of it here - read Keith Brown's "Programming Windows Security".
SetNamedSecurityInfo does propogate the settings down the tree, applying the correct inheritance, so that shouldn't be the problem, unless the files have been created with protected DACLs (by using SE_DACL_PROTECTED or unchecking the 'Allow inheritable permissions from parent to propogate...' checkbox on the Security tab of the file's Properties page).
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Im doing a simple file programming in C++(im using turbo C version 3.0 editor)
Iam using the Fstream class..
I can create & write datas into file successfully .. .
But after some set of operations when I list the contents of the file. I get some ascii characters (like @ etc) or some irrelevant numbers. . .
Can any one plz tell me what is happening. . .
The same piece of code gives the correct output when I try it using VS 6.0 . . Plz help me. . ( VS6.0 is not recognizing clrscr() & gotoxy() – I had used conio.h)
I want the program to work correctly from my Turbo C compiler .. .(its being used in my College)
Thanks in Advance . .
Proud To Be an Indian
|
|
|
|
|
vivekphlp wrote: I want the program to work correctly from my Turbo C compiler .. .(its being used in my College)
Wow....Turbo C 3.0 came out 16 years ago...
Still, I would expect it to work (I guess). Depends on the runtime library.
Without seeing any code it's impossible to guess what's wrong.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|