Article View: borland.public.cppbuilder.nativeapi
Article #4889Problem with shutdown
From: Tomislav
Date: Thu, 10 Nov 2005 10:49
Date: Thu, 10 Nov 2005 10:49
16 lines
1563 bytes
1563 bytes
I use the following code to shutdown my computer HANDLE hToken; TOKEN_PRIVILEGES tkp; 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); ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0); the problem is that this works fine on my PC, but on my laptop it closes everything and freezes leaving only the wallpaper and mouse cursor. Am I doing something wrong, can someone suggest me how to fix this. Thanx in advance.
Technical Details
Message-ID:
<4373259e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d179e7e20c307d12,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 10 Nov 2005 11:49:35 +0100 From: Tomislav <rif@net.hr> User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Problem with shutdown Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.131.105.19 Message-ID: <4373259e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1131619742 83.131.105.19 (10 Nov 2005 02:49:02 -0700) Lines: 16 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail