Click here to Skip to main content
16,016,140 members
Home / Discussions / System Admin
   

System Admin

 
GeneralConnection to the database from Windows95 Pin
5-Jun-02 3:22
suss5-Jun-02 3:22 
GeneralRe: Connection to the database from Windows95 Pin
Mike Nordell5-Jun-02 6:00
Mike Nordell5-Jun-02 6:00 
GeneralWin2000 address bar. Pin
4-Jun-02 20:23
suss4-Jun-02 20:23 
GeneralRe: Win2000 address bar. Pin
5-Jun-02 13:04
suss5-Jun-02 13:04 
GeneralRe: Win2000 address bar. Pin
Nick Parker7-Jun-02 6:03
protectorNick Parker7-Jun-02 6:03 
Questionhow to create service under a network domain? Pin
4-Jun-02 11:16
suss4-Jun-02 11:16 
AnswerI have find the probelm. it my fault in the code. thanks all.Re: how to create service under a network domain? Pin
Tida5-Jun-02 2:40
Tida5-Jun-02 2:40 
Generalsystem reboot Pin
Member 390934-Jun-02 11:05
Member 390934-Jun-02 11:05 
Hi!

I have written an NT Service to monitor an application execution.

The NT Service detect properly when the application crashes (deadlock).

In order to reboot the system I am using the API function ExitWindowsEx to reboot the system, but it doesn’t work very well. As a matter of fact, when I call this API function the system shows a blue screen and stay in this situation timelessly.

The code that I am using (the shut down example from MSDN) is show below (I guess I have got the right privilege).

Does anybody know how can I make the system reboot properly?

Thank you very much for your attention.

Sergio



HANDLE hToken;
TOKEN_PRIVILEGES tkp;

// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
error("OpenProcessToken");

// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);

tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

// Get the shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);

// Cannot test the return value of AdjustTokenPrivileges.
if (GetLastError() != ERROR_SUCCESS)
error("AdjustTokenPrivileges");

// Shut down the system and force all applications to close.
if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0))
error("ExitWindowsEx");



General2 IPs on one Computer w/ 1 Nic Pin
Matt Newman4-Jun-02 7:46
Matt Newman4-Jun-02 7:46 
GeneralRe: 2 IPs on one Computer w/ 1 Nic Pin
Mike Nordell5-Jun-02 5:55
Mike Nordell5-Jun-02 5:55 
GeneralRe: 2 IPs on one Computer w/ 1 Nic Pin
Matt Newman5-Jun-02 6:06
Matt Newman5-Jun-02 6:06 
GeneralRe: 2 IPs on one Computer w/ 1 Nic Pin
Mike Nordell14-Jun-02 14:04
Mike Nordell14-Jun-02 14:04 
GeneralRe: 2 IPs on one Computer w/ 1 Nic Pin
Matt Newman14-Jun-02 14:36
Matt Newman14-Jun-02 14:36 
Generalcannt connect to socket Pin
ash250931-May-02 22:18
ash250931-May-02 22:18 
Generalsolaris v aix Pin
Jesse_ie31-May-02 0:01
Jesse_ie31-May-02 0:01 
GeneralRe: solaris v aix Pin
markkuk31-May-02 2:06
markkuk31-May-02 2:06 
GeneralRe: solaris v aix Pin
Jesse_ie31-May-02 4:52
Jesse_ie31-May-02 4:52 
GeneralRe: solaris v aix Pin
Jesse_ie31-May-02 5:03
Jesse_ie31-May-02 5:03 
GeneralRe: solaris v aix Pin
markkuk31-May-02 7:29
markkuk31-May-02 7:29 
GeneralRe: solaris v aix Pin
Jesse_ie5-Jun-02 5:08
Jesse_ie5-Jun-02 5:08 
GeneralWindows 2GB User Memory Limit Pin
29-May-02 22:26
suss29-May-02 22:26 
GeneralRe: Windows 2GB User Memory Limit Pin
30-May-02 11:15
suss30-May-02 11:15 
GeneralRe: Windows 2GB User Memory Limit Pin
Michael Dunn31-May-02 16:12
sitebuilderMichael Dunn31-May-02 16:12 
GeneralLDAP Question Pin
Nick Parker28-May-02 17:30
protectorNick Parker28-May-02 17:30 
GeneralXP Home vs XP Pro Pin
Matt Newman28-May-02 9:09
Matt Newman28-May-02 9:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.