windows核心编程-session

#include
#include
int _tmain()
{
	HANDLE hProcess = GetCurrentProcess();
	_tprintf(L"hProcess=%d\n", hProcess);

	DWORD sessionid = 0;
	DWORD processid = 0;
	processid = GetProcessId((HANDLE)-1);


	HANDLE hProcess1 = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetProcessId((HANDLE)-1));
	HANDLE hProcess2;

	DuplicateHandle((HANDLE)-1, (HANDLE)-1, (HANDLE)-1, &hProcess2, NULL, FALSE, 0);
	_tprintf(L"hProcess1=%0x\n,hprocess2=%0x\n", hProcess1, hProcess);

	CloseHandle(hProcess1);
	CloseHandle(hProcess2);

	_gettchar();
	return 0;
}

你可能感兴趣的:(windows核心编程-session)