- Pre-implement InitiateSystemShutdownExW.
- Cosmetic formatting code (by me).
Patch by Lee Schroeder. See CORE-6613 for more details.
CORE-6613 #comment Committed shutdown.c.
svn path=/trunk/; revision=57546
#include <advapi32.h>
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
#include <advapi32.h>
WINE_DEFAULT_DEBUG_CHANNEL(advapi);
/**********************************************************************
* AbortSystemShutdownW
*
/**********************************************************************
* AbortSystemShutdownW
*
/**********************************************************************
* AbortSystemShutdownA
*
/**********************************************************************
* AbortSystemShutdownA
*
+ * see AbortSystemShutdownW
*/
BOOL WINAPI
AbortSystemShutdownA(LPCSTR lpMachineName)
*/
BOOL WINAPI
AbortSystemShutdownA(LPCSTR lpMachineName)
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
if (STATUS_SUCCESS != Status)
{
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
if (STATUS_SUCCESS != Status)
{
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
}
rv = AbortSystemShutdownW(MachineNameW.Buffer);
}
rv = AbortSystemShutdownW(MachineNameW.Buffer);
bRebootAfterShutdown,
SHTDN_REASON_MAJOR_OTHER |
SHTDN_REASON_MINOR_OTHER |
bRebootAfterShutdown,
SHTDN_REASON_MAJOR_OTHER |
SHTDN_REASON_MINOR_OTHER |
- SHTDN_REASON_FLAG_PLANNED);
+ SHTDN_REASON_FLAG_PLANNED
+ /* SHTDN_REASON_MAJOR_LEGACY_API */);
}
/**********************************************************************
}
/**********************************************************************
bRebootAfterShutdown,
SHTDN_REASON_MAJOR_OTHER |
SHTDN_REASON_MINOR_OTHER |
bRebootAfterShutdown,
SHTDN_REASON_MAJOR_OTHER |
SHTDN_REASON_MINOR_OTHER |
- SHTDN_REASON_FLAG_PLANNED);
+ SHTDN_REASON_FLAG_PLANNED
+ /* SHTDN_REASON_MAJOR_LEGACY_API */);
}
/******************************************************************************
}
/******************************************************************************
BOOL bRebootAfterShutdown,
DWORD dwReason)
{
BOOL bRebootAfterShutdown,
DWORD dwReason)
{
- SHUTDOWN_ACTION Action = ShutdownNoReboot;
+ SHUTDOWN_ACTION action;
+ /* Convert to milliseconds so we can use the value later on */
+ Timeout_ms = dwTimeout * 1000;
+
+ if (lpMachineName != NULL)
- /* FIXME: remote machine shutdown not supported yet */
+ /* FIXME: Remote system shutdown not supported yet */
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
+ else /* The local system is being used */
+ /* FIXME: Right now, only basic shutting down and rebooting
+ is supported */
+ if(bRebootAfterShutdown == TRUE)
+ {
+ action = ShutdownReboot;
+ }
+ else
+ {
+ action = ShutdownNoReboot;
+ }
+
+ Status = NtShutdownSystem(action);
- Status = NtShutdownSystem(Action);
SetLastError(RtlNtStatusToDosError(Status));
SetLastError(RtlNtStatusToDosError(Status));
+ return (Status == STATUS_SUCCESS);
}
/******************************************************************************
}
/******************************************************************************
bRebootAfterShutdown,
dwReason);
LastError = GetLastError();
bRebootAfterShutdown,
dwReason);
LastError = GetLastError();
+
+ /* Clear the values of both strings */
if (lpMachineName)
RtlFreeUnicodeString(&MachineNameW);
if (lpMachineName)
RtlFreeUnicodeString(&MachineNameW);
/******************************************************************************
* InitiateShutdownA [ADVAPI32.@]
*
/******************************************************************************
* InitiateShutdownA [ADVAPI32.@]
*
+ * see InitiateShutdownW
*/
DWORD WINAPI
InitiateShutdownA(LPSTR lpMachineName,
*/
DWORD WINAPI
InitiateShutdownA(LPSTR lpMachineName,
dwShutdownFlags,
dwReason);
LastError = GetLastError();
dwShutdownFlags,
dwReason);
LastError = GetLastError();
+
+ /* Clear the values of both strings */
if (lpMachineName)
RtlFreeUnicodeString(&MachineNameW);
if (lpMachineName)
RtlFreeUnicodeString(&MachineNameW);