I used DllImport() to load the function OpenProcessToken
() in advapi32.dll, and then called it in my button click
event. But the function always returns false. I got the
error code it left through GetLastError() function and
the result is "998" which means, in the system error code
in MSDN, "Invalid access to memory location." I don't
know what's wrong with it.
The calling code is as below:
--------------------------------
OpenProcessToken(hCurrentProcess,
TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,
phProcessToken))
--------------------------------
When I debugged this code, the variable
phProcessToken is always shows "<undefined value>".
Please help me, and thanks a lot :)