Article View: borland.public.cppbuilder.nativeapi
Article #5214Re: Reset and restarting
From: Nerio
Date: Mon, 29 Aug 2005 10:52
Date: Mon, 29 Aug 2005 10:52
31 lines
2164 bytes
2164 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> ha scritto nel messaggio
news:431212ad$1@newsgroups.borland.com...
>
> "Nerio" <ne_serzanti@tin.it> wrote in message
> news:4310fd3c@newsgroups.borland.com...
>
>> Sorry for trouble, but why ExitWindowsEx(EWX_FORCE or EWX_LOGOFF
>> or EWX_SHUTDOWN, 0) go fine and ....(EWX_REBOOT or EWX_POWEROFF,
>> 0) seem do nothing?
>
> Did you read the documentation for ExitWindows() yet? Did you adjust your
> program's privileges to allow rebooting in the first place?
>
>
> Gambit
>
Really I am not able to change priviliges!
My listing is :
HANDLE Ht;
TOKEN_PRIVILEGES newTp, oldTp; // to restore original values in due time
LUID *myLuid; // used in LookupPrivilegeValue
if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY, &Ht))
{ ShowMessage("Error opening Process Token"); return; }
if(!LookupPrivilegeValue(0, SE_SHUTDOWN_NAME, myLuid)) // is useful ?
{ ShowMessage("Error reading Privilege Value"); return; }
== now I should change to SE_PRIVILEGE_ENABLED the relative value in newTp
but how?
Probably I have to redo a more in-depth study of structures.
Thank you very much
Nerio
Technical Details
Message-ID:
<4312e8e4@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4310fd3c@newsgroups.borland.com> <431212ad$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1b699533025a4e6b X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Nerio" <ne_serzanti@tin.it> Newsgroups: borland.public.cppbuilder.nativeapi References: <4310fd3c@newsgroups.borland.com> <431212ad$1@newsgroups.borland.com> Subject: Re: Reset and restarting Date: Mon, 29 Aug 2005 12:52:57 +0200 Lines: 33 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 82.55.234.230 Message-ID: <4312e8e4@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1125312740 82.55.234.230 (29 Aug 2005 03:52:20 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail