Article View: borland.public.cppbuilder.nativeapi
Article #6838Re: What is this code good for?
From: Matt Jacobs
Date: Tue, 05 Apr 2005 08:56
Date: Tue, 05 Apr 2005 08:56
26 lines
1737 bytes
1737 bytes
"Grety" <valid@emailaddress.com> wrote:
> 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?
Part of an MSDN sample.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/how_to_shut_down_the_system.asp
Technical Details
Message-ID:
<hlk451t3qd8ouc3gd5967q5m3i1l25kglt@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<425037b0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,fdf971a7398016b1 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Matt Jacobs <noyb@noyb.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: What is this code good for? Date: Tue, 05 Apr 2005 01:56:43 -0700 Reply-To: __noyb@noyb.com Message-ID: <hlk451t3qd8ouc3gd5967q5m3i1l25kglt@4ax.com> References: <425037b0@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.23.153.114 X-Trace: newsgroups.borland.com 1112691399 24.23.153.114 (5 Apr 2005 01:56:39 -0800) Lines: 28 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail