Blackcow

Hi,

I tried to use OpenProcess function on some protected process at Vista.

Following to other posts and articles in msdn, I wrote the code

hProcess = OpenProcess(
PROCESS_QUERY_LIMITED_INFORMATION |

PROCESS_CREATE_THREAD | // For CreateRemoteThread

PROCESS_VM_OPERATION | // For VirtualAllocEx/VirtualFreeEx

PROCESS_VM_WRITE | // For WriteProcessMemory

PROCESS_VM_READ,

FALSE, dwPID);

and got a error message :

error C2065: 'PROCESS_QUERY_LIMITED_INFORMATION' : undeclared identifier

I use VisualStudio 2005 with

- Visual Studio ServicePack1 (VS80sp1-KB926601-X86-ENU.exe)

- Visual Studio ServicePack1 for Vista (VS80sp1-KB932232-X86-ENU.exe)

But, I can't find any include file for define PROCESS_QUERY_LIMITED_INFORMATION.

And when I defined PROCESS_QUERY_LIMITED_INFORMATION as 0x1000 into the code, the program seems to compiled successfully, but OpenProcess function does not worked.

Could someone point me out how can I solve this problem



Re: Visual C++ General include file for PROCESS_QUERY_LIMITED_INFORMATION ?

Ramkrishna Pawar

You need latest (Vista) platform SDK for that defination.

Do your program have rights to do that Try calling GetLastError() to see exact error.






Re: Visual C++ General include file for PROCESS_QUERY_LIMITED_INFORMATION ?

Blackcow

Yes, I downloaded and installed Platform SDK, and now, I can compile the code without error.

But the OpenProcess still does not works ( with GetLastError() return code 5 ), though I run the binary as administrator.

Still I missed something





Re: Visual C++ General include file for PROCESS_QUERY_LIMITED_INFORMATION ?

Bite Qiu - MSFT

But the OpenProcess still does not works ( with GetLastError() return code 5 ), though I run the binary as administrator.

Error code 5 is ERROR_ACCESS_DENIED, I think you don't have enough access right for some access types. MSDN have more description of access rights and OpenProcess:

http://msdn2.microsoft.com/en-us/library/ms684320.aspx

http://msdn2.microsoft.com/en-us/library/ms684880.aspx

Also, you may want to ask in "Security for Application in Windows Vista" forum:http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=116&SiteID=1

good luck

rico