I'm currently trying to create a process that will have the PROCESS_QUERY_INFORMATION access right. I'm trying to create a new security descriptor to be used with CreateProcess(). However, MSDN is very confusing on this, and I am getting completely bogged down on DACL's and ACE's.
I also can't seem to find any examples relating to process'.
I need this access right because the process being created needs to call OpenProcessToken(). If I run the program as seen above, the newly created process just crashes upon hitting OpenProcessToken(). Is this expected behaviour assuming the PROCESS_QUERY_INFORMATION permission isn't set? I don't even know if this is the reason for the crash (I would of thought that it would give me an error message, but I can't think of any other reasons)...
I'm currently trying to create a process that will have the PROCESS_QUERY_INFORMATION access right.
And what makes you believe it has not?
I need this access right because the process being created needs to call OpenProcessToken(). If I run the program as seen above, the newly created process just crashes upon hitting OpenProcessToken(). Is this expected behaviour assuming the PROCESS_QUERY_INFORMATION permission isn't set? I don't even know if this is the reason for the crash (I would of thought that it would give me an error message, but I can't think of any other reasons)...
Sorry, but I think, before making questionable assumptions, it'd be more efficient to show your code that doesn't work. BTW, are you aware of GetLastError function?
Yes I am, but the program crashes before I even have a chance to call GetLastError().
If you would like to see the code that is broken, here it is:
Code:
HANDLE hToken = NULL;
OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &hToken);
MessageBox(NULL, "This does not get run", "", MB_OK);
The reason I believe that the process doesn't have the permission is because it is getting created with CreateProcess() and the default DACL. Maybe GetCurrentProcess() is causing the crash, I don't know.
Edit just to clarify... there are two processes I am working with here. The code in my first post creates the process that runs the code in this post.
Bookmarks