Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !include LogicLib.nsh
  2.  
  3.  
  4. !define TOKEN_ADJUST_PRIVILEGES 0x0020
  5. !define SE_PRIVILEGE_ENABLED    0x00000002
  6. !define SE_DEBUG_NAME         SeDebugPrivilege
  7.  
  8.  
  9. Function AdjustProcessTokenPrivileges
  10. System::Store "S r2"
  11. System::Call 'kernel32::GetCurrentProcess()i.s'
  12. System::Call 'advapi32::OpenProcessToken(is, i ${TOKEN_ADJUST_PRIVILEGES},*i.r1)i.r0?e'
  13. ${If} $0 <> 0
  14.     pop $0 ;throw away GLE
  15.     System::Call 'advapi32::LookupPrivilegeValue(tn,tr2,*l.r2)i.r0?e'
  16.     ${If} $0 <> 0
  17.         System::Call "*(i 1,l r2,i ${SE_PRIVILEGE_ENABLED},is)i.r2" ;last member=throw away GLE
  18.         System::Call 'advapi32::AdjustTokenPrivileges(ir1,i0,ir2,i0,i0,i0)i?e'
  19.         System::Free $2
  20.     ${EndIf}
  21.     System::Call 'kernel32::CloseHandle(ir1)'
  22. ${EndIf}
  23. System::Store L
  24. FunctionEnd
  25.  
  26. section
  27. Push SeDebugPrivilege
  28. call AdjustProcessTokenPrivileges
  29. pop $0
  30. DetailPrint error=$0
  31. sectionend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement