hi

does anyone know how to shutdown and powerff pc with XP onit. i've tried to do invoke ExitWindowsEx, EWX_POWEROFF, 0 but its aint working....
pleas help, i've know its possilbe 'cous when i noemal shutdown my pc its geting poweroff...

thanx for any replys
Posted on 2002-01-29 15:45:06 by NEMO
In Windows NT you must use the AdjustTokenPrivileges function. Maybe you also need it in WinXP, have you tried?
Posted on 2002-01-29 15:51:38 by CodeLover
yes i tried that, i've write something like this:
	.ElseIf Eax == WM_COMMAND

Mov Eax, wParam
Mov Edx, Eax
Shr Edx, 16
And Eax, 0FFFFh
.If Edx == BN_CLICKED
.If Eax == IDC_BTN
Mov ovi.dwOSVersionInfoSize, SIZEOF ovi
Invoke GetVersionEx, ADDR ovi

.If ovi.dwPlatformId == VER_PLATFORM_WIN32_NT
Invoke MessageBeep, MB_ICONASTERISK
Invoke GetCurrentProcess
Invoke OpenProcessToken, Eax, TOKEN_ADJUST_PRIVILEGES+TOKEN_QUERY, ADDR hToken
Invoke LookupPrivilegeValue, 0, ADDR SeShutdownPrivilege, ADDR tp.Privileges[0].Luid
Mov tp.PrivilegeCount, 1
Mov tp.Privileges[0].Attributes, SE_PRIVILEGE_ENABLED
Invoke AdjustTokenPrivileges, hToken, FALSE, ADDR tp, 0, 0, 0
Invoke GetErrDescription, 0

.EndiF

Invoke ExitWindowsEx, EWX_SHUTDOWN, 0

.If ovi.dwPlatformId == VER_PLATFORM_WIN32_NT
Mov tp.Privileges[0].Attributes, 0
Invoke AdjustTokenPrivileges, hToken, FALSE, ADDR tp, 0, 0, 0
Invoke CloseHandle, hToken

.Endif

.EndIf

.EndIf
and nothing....
Posted on 2002-01-29 16:41:07 by NEMO