🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #6843

Re: What is this code good for?

#6843
From: Grety
Date: Wed, 06 Apr 2005 13:42
35 lines
1966 bytes
thanks to everyone, I'm well understand :-)

"Matt Jacobs" <noyb@noyb.com> wrote in message
news:hlk451t3qd8ouc3gd5967q5m3i1l25kglt@4ax.com...
> "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/bas
e/how_to_shut_down_the_system.asp
>
>
Technical Details
Message-ID: <42530574@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <425037b0@newsgroups.borland.com> <hlk451t3qd8ouc3gd5967q5m3i1l25kglt@4ax.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: "Grety" <valid@emailaddress.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <425037b0@newsgroups.borland.com> <hlk451t3qd8ouc3gd5967q5m3i1l25kglt@4ax.com>
Subject: Re: What is  this code good for?
Date: Wed, 6 Apr 2005 18:12:27 +0430
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2479.0006
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2479.0006
NNTP-Posting-Host: 217.219.105.193
Message-ID: <42530574@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1112737140 217.219.105.193 (5 Apr 2005 14:39:00 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail