ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

shutdown.c
Go to the documentation of this file.
00001 /* $Id: shutdown.c 53225 2011-08-14 11:31:23Z akhaldi $
00002  *
00003  * COPYRIGHT:       See COPYING in the top level directory
00004  * PROJECT:     ReactOS system libraries
00005  * FILE:        lib/advapi32/misc/shutdown.c
00006  * PURPOSE:     System shutdown functions
00007  * PROGRAMMER:      Emanuele Aliberti
00008  * UPDATE HISTORY:
00009  *      19990413 EA     created
00010  *      19990515 EA
00011  */
00012 
00013 #include <advapi32.h>
00014 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
00015 
00016 #define USZ {0,0,0}
00017 
00018 /**********************************************************************
00019  *      AbortSystemShutdownW
00020  *
00021  * @unimplemented
00022  */
00023 BOOL WINAPI
00024 AbortSystemShutdownW(LPCWSTR lpMachineName)
00025 {
00026     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
00027     return FALSE;
00028 }
00029 
00030 
00031 /**********************************************************************
00032  *      AbortSystemShutdownA
00033  *
00034  * @unimplemented
00035  */
00036 BOOL WINAPI
00037 AbortSystemShutdownA(LPCSTR lpMachineName)
00038 {
00039     ANSI_STRING MachineNameA;
00040     UNICODE_STRING MachineNameW;
00041     NTSTATUS Status;
00042     BOOL rv;
00043 
00044     RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
00045     Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
00046     if (STATUS_SUCCESS != Status)
00047     {
00048             SetLastError(RtlNtStatusToDosError(Status));
00049             return FALSE;
00050     }
00051 
00052     rv = AbortSystemShutdownW(MachineNameW.Buffer);
00053     RtlFreeUnicodeString(&MachineNameW);
00054     SetLastError(ERROR_SUCCESS);
00055     return rv;
00056 }
00057 
00058 
00059 /**********************************************************************
00060  *      InitiateSystemShutdownW
00061  *
00062  * @unimplemented
00063  */
00064 BOOL WINAPI
00065 InitiateSystemShutdownW(LPWSTR lpMachineName,
00066                         LPWSTR lpMessage,
00067                         DWORD dwTimeout,
00068                         BOOL bForceAppsClosed,
00069                         BOOL bRebootAfterShutdown)
00070 {
00071     SHUTDOWN_ACTION Action = ShutdownNoReboot;
00072     NTSTATUS Status;
00073 
00074     if (lpMachineName)
00075     {
00076         /* FIXME: remote machine shutdown not supported yet */
00077         SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
00078         return FALSE;
00079     }
00080 
00081     if (dwTimeout)
00082     {
00083     }
00084 
00085     Status = NtShutdownSystem(Action);
00086     SetLastError(RtlNtStatusToDosError(Status));
00087     return FALSE;
00088 }
00089 
00090 
00091 /**********************************************************************
00092  *      InitiateSystemShutdownA
00093  *
00094  * @unimplemented
00095  */
00096 BOOL
00097 WINAPI
00098 InitiateSystemShutdownA(LPSTR lpMachineName,
00099                         LPSTR lpMessage,
00100                         DWORD dwTimeout,
00101                         BOOL bForceAppsClosed,
00102                         BOOL bRebootAfterShutdown)
00103 {
00104     ANSI_STRING     MachineNameA;
00105     ANSI_STRING     MessageA;
00106     UNICODE_STRING  MachineNameW;
00107     UNICODE_STRING  MessageW;
00108     NTSTATUS        Status;
00109     INT         LastError;
00110     BOOL        rv;
00111 
00112     MachineNameW.Buffer = NULL;
00113     MessageW.Buffer = NULL;
00114 
00115     if (lpMachineName)
00116     {
00117         RtlInitAnsiString(&MachineNameA, lpMachineName);
00118         Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
00119         if (STATUS_SUCCESS != Status)
00120         {
00121             SetLastError(RtlNtStatusToDosError(Status));
00122             return FALSE;
00123         }
00124     }
00125 
00126     if (lpMessage)
00127     {
00128         RtlInitAnsiString(&MessageA, lpMessage);
00129         Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
00130         if (STATUS_SUCCESS != Status)
00131         {
00132             if (MachineNameW.Buffer)
00133             {
00134                 RtlFreeUnicodeString(&MachineNameW);
00135             }
00136 
00137             SetLastError(RtlNtStatusToDosError(Status));
00138             return FALSE;
00139         }
00140     }
00141 
00142     rv = InitiateSystemShutdownW(MachineNameW.Buffer,
00143                                  MessageW.Buffer,
00144                                  dwTimeout,
00145                                  bForceAppsClosed,
00146                                  bRebootAfterShutdown);
00147     LastError = GetLastError();
00148     if (lpMachineName)
00149     {
00150         RtlFreeUnicodeString(&MachineNameW);
00151     }
00152 
00153     if (lpMessage)
00154     {
00155         RtlFreeUnicodeString(&MessageW);
00156     }
00157 
00158     SetLastError(LastError);
00159     return rv;
00160 }
00161 
00162 /******************************************************************************
00163  * InitiateSystemShutdownExW [ADVAPI32.@]
00164  *
00165  * see InitiateSystemShutdownExA
00166  */
00167 BOOL WINAPI
00168 InitiateSystemShutdownExW(LPWSTR lpMachineName,
00169                           LPWSTR lpMessage,
00170                           DWORD dwTimeout,
00171                           BOOL bForceAppsClosed,
00172                           BOOL bRebootAfterShutdown,
00173                           DWORD dwReason)
00174 {
00175      UNIMPLEMENTED;
00176      return TRUE;
00177 }
00178 
00179 BOOL WINAPI
00180 InitiateSystemShutdownExA(LPSTR lpMachineName,
00181                           LPSTR lpMessage,
00182                           DWORD dwTimeout,
00183                           BOOL bForceAppsClosed,
00184                           BOOL bRebootAfterShutdown,
00185                           DWORD dwReason)
00186 {
00187      UNIMPLEMENTED;
00188      return TRUE;
00189 }
00190 
00191 /* EOF */

Generated on Sun May 27 2012 04:17:43 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.