Page 1 of 1

Requesting debug privileges

Posted: Sat Feb 16, 2008 9:19 pm
by Mistrel
source: http://www.experts-exchange.com/Program ... 03461.html

Code: Select all

#SE_DEBUG_NAME="SeDebugPrivilege" ; missing constant

Procedure EnableDebugPrivNT()
	DebugValue.LUID;
	tkp.TOKEN_PRIVILEGES
	
	; Retrieve a handle of the access token
	If Not OpenProcessToken_(GetCurrentProcess_(),#TOKEN_ADJUST_PRIVILEGES|#TOKEN_QUERY,@hToken)
		ProcedureReturn #False;
	EndIf
	
	; Enable the SE_DEBUG_NAME privilege
	If Not LookupPrivilegeValue_("",#SE_DEBUG_NAME,@DebugValue)
		ProcedureReturn #False;
	EndIf
	
	NewState.TOKEN_PRIVILEGES
	NewState\PrivilegeCount=1
	NewState\Privileges[0]\Luid\HighPart=DebugValue\HighPart
	NewState\Privileges[0]\Luid\LowPart=DebugValue\LowPart
	NewState\Privileges[0]\Attributes=#SE_PRIVILEGE_ENABLED
	AdjustTokenPrivileges_(hToken,#False,@NewState,SizeOf(TOKEN_PRIVILEGES),@PreviousState.TOKEN_PRIVILEGES,@ReturnLength)
	
	If GetLastError_()<>#ERROR_SUCCESS
		ProcedureReturn #False
	EndIf

	ProcedureReturn #True
EndProcedure

Posted: Sat Feb 16, 2008 11:00 pm
by blueznl
Hey, would this allow shadowcopying as well?

Posted: Sun Feb 17, 2008 1:09 am
by Mistrel
blueznl wrote:Hey, would this allow shadowcopying as well?
I'm not familiar with shadow copying. You'll have to try it yourself.

Posted: Sun Feb 17, 2008 1:23 am
by SFSxOI
Shadow copying is a point-in-time snapshot of a shared folder that is exposed to Windows uers by use of the "Previous Versions" tab on a shared file. Its present in Windows 2003 and Windows XP SP1 and greater. Also, if i'm not mistaken you can add it to Windows 2000 but i'm not sure.