Board index » cppbuilder » Re: What is this code good for?
Remy Lebeau (TeamB)
![]() CBuilder Developer |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
Re: What is this code good for?2005-04-04 04:33:51 AM cppbuilder114 "Grety" < XXXX@XXXXX.COM >wrote in message QuoteMy Question ius what is this code for? Gambit |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2005-04-04 01:54:39 PM
Re:Re: What is this code good for?
"Grety" < XXXX@XXXXX.COM >wrote in message
QuoteThen it seems that I have to add a line (maybe more) to ExitWindows/Ex(). QuoteIs it different in WinXP? I guess there is some difference posted earlier has no effect on Win98. Gambit |
Grety
![]() CBuilder Developer |
2005-04-05 02:30:36 AM
Re:Re: What is this code good for?
HANDLE hToken;
TOKEN_PRIVILEGES tkp; OSVERSIONINFO info; info.dwOSVersionInfoSize = sizeof(info); GetVersionEx(&info); if( info.dwPlatformId == VER_PLATFORM_WIN32_NT ) { if( ! OpenProcessToken( GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) ) LookupPrivilegeValue( NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid ); tkp.PrivilegeCount = 1; tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges( hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0 ); if( GetLastError() != ERROR_SUCCESS ); } My Question ius what is this code for? Restarting windows? {smallsort} |
Grety
![]() CBuilder Developer |
2005-04-05 01:46:41 PM
Re:Re: What is this code good for?
Then it seems that I have to add a line (maybe more) to the last line to
make it shutdown. Is it different in WinXP? I guess there is some difference between Win98 and WinXP codes to shutdown the OS. "Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message Quote
|
Matt Jacobs
![]() CBuilder Developer |
2005-04-05 04:56:43 PM
Re:Re: What is this code good for?
"Grety" < XXXX@XXXXX.COM >wrote:
QuoteHANDLE hToken; |
Grety
![]() CBuilder Developer |
2005-04-06 09:42:27 PM
Re:Re: What is this code good for?
thanks to everyone, I'm well understand :-)
"Matt Jacobs" < XXXX@XXXXX.COM >wrote in message Quote"Grety" < XXXX@XXXXX.COM >wrote: Quote |