View Single Post

Old 09-26-2008, 05:59 AM   #7 (permalink)
Dyndrilliac

Enlightened
 
Dyndrilliac's Avatar
 
Join Date: Jun 2005
Location: Jacksonville, FL, USA
Posts: 2,660
Dyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant futureDyndrilliac has a brilliant future
Send a message via AIM to Dyndrilliac Send a message via MSN to Dyndrilliac Send a message via Yahoo to Dyndrilliac
Default

Don't mean to necro-post, but I was cleaning out my documents folders and found something relevant to this thread, and I wanted to add a thread pointer to the guide's index for this topic.
Code:
bool SetDebugPrivileges() {

	LUID Luid;
	TOKEN_PRIVILEGES tpToken;
	HANDLE hToken;

	if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken)) {
		return false;
	}

	if (!LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &Luid)) {
		CloseHandle (hToken);
		return false;
	}

	tpToken.PrivilegeCount = 1;
	tpToken.Privileges[0].Luid = Luid;
	tpToken.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

	if (!AdjustTokenPrivileges(hToken, false, &tpToken, NULL, NULL, NULL)) {
		CloseHandle(hToken);
		return false;
	}

	CloseHandle(hToken);
	return true;

}
__________________
Ultimate Guide/Resource/Tutorial/Book Thread
Technobabble! - My Blog About All Things Technological
Quote:
Originally Posted by Edsger W. Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

Last edited by Dyndrilliac : 09-28-2008 at 12:00 AM.
Dyndrilliac 15 0FF11|\|3   Reply With Quote