INVALID_HANDLE on DuplicateHandle of current Process
Hello:
I've googled about this and I'm still struggling, I need a Handle of the actual process, not the pseudo Handle returned by GetCurrentThread(), but the actual one.
I've learned that I need to get the pseudo handle, and then use the DuplicateHandle to get the real one. So I did this but unfortunately I keep getting the error 16 - INVALID_HANDLE:
HANDLE _handle = GetCurrentThread();
HANDLE _handle2;
bool x = DuplicateHandle(_handle,_handle,_handle,
&_handle2,
GENERIC_WRITE|GENERIC_READ,
TRUE,DUPLICATE_SAME_ACCESS);
if(!x)
{
cout << "Last Error: " << GetLastError() << endl;
}
I think the error might be around the _handle,_handle_handle, but I'm still stuck, any ideas?
Greetings
Alejandro
Re: INVALID_HANDLE on DuplicateHandle of current Process