mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[FORMATTING] No code changes!
svn path=/trunk/; revision=36357
This commit is contained in:
parent
8c33fab48b
commit
aa46f44e50
3 changed files with 635 additions and 614 deletions
|
@ -30,53 +30,53 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
GetCurrentHwProfileA(LPHW_PROFILE_INFOA lpHwProfileInfo)
|
GetCurrentHwProfileA(LPHW_PROFILE_INFOA lpHwProfileInfo)
|
||||||
{
|
{
|
||||||
HW_PROFILE_INFOW ProfileInfo;
|
HW_PROFILE_INFOW ProfileInfo;
|
||||||
UNICODE_STRING StringU;
|
UNICODE_STRING StringU;
|
||||||
ANSI_STRING StringA;
|
ANSI_STRING StringA;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
TRACE("GetCurrentHwProfileA() called\n");
|
TRACE("GetCurrentHwProfileA() called\n");
|
||||||
|
|
||||||
bResult = GetCurrentHwProfileW(&ProfileInfo);
|
bResult = GetCurrentHwProfileW(&ProfileInfo);
|
||||||
if (bResult == FALSE)
|
if (bResult == FALSE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
lpHwProfileInfo->dwDockInfo = ProfileInfo.dwDockInfo;
|
lpHwProfileInfo->dwDockInfo = ProfileInfo.dwDockInfo;
|
||||||
|
|
||||||
/* Convert the profile GUID to ANSI */
|
/* Convert the profile GUID to ANSI */
|
||||||
StringU.Buffer = (PWCHAR)ProfileInfo.szHwProfileGuid;
|
StringU.Buffer = (PWCHAR)ProfileInfo.szHwProfileGuid;
|
||||||
StringU.Length = wcslen(ProfileInfo.szHwProfileGuid) * sizeof(WCHAR);
|
StringU.Length = wcslen(ProfileInfo.szHwProfileGuid) * sizeof(WCHAR);
|
||||||
StringU.MaximumLength = HW_PROFILE_GUIDLEN * sizeof(WCHAR);
|
StringU.MaximumLength = HW_PROFILE_GUIDLEN * sizeof(WCHAR);
|
||||||
StringA.Buffer = (PCHAR)&lpHwProfileInfo->szHwProfileGuid;
|
StringA.Buffer = (PCHAR)&lpHwProfileInfo->szHwProfileGuid;
|
||||||
StringA.Length = 0;
|
StringA.Length = 0;
|
||||||
StringA.MaximumLength = HW_PROFILE_GUIDLEN;
|
StringA.MaximumLength = HW_PROFILE_GUIDLEN;
|
||||||
Status = RtlUnicodeStringToAnsiString(&StringA,
|
Status = RtlUnicodeStringToAnsiString(&StringA,
|
||||||
&StringU,
|
&StringU,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the profile name to ANSI */
|
/* Convert the profile name to ANSI */
|
||||||
StringU.Buffer = (PWCHAR)ProfileInfo.szHwProfileName;
|
StringU.Buffer = (PWCHAR)ProfileInfo.szHwProfileName;
|
||||||
StringU.Length = wcslen(ProfileInfo.szHwProfileName) * sizeof(WCHAR);
|
StringU.Length = wcslen(ProfileInfo.szHwProfileName) * sizeof(WCHAR);
|
||||||
StringU.MaximumLength = MAX_PROFILE_LEN * sizeof(WCHAR);
|
StringU.MaximumLength = MAX_PROFILE_LEN * sizeof(WCHAR);
|
||||||
StringA.Buffer = (PCHAR)&lpHwProfileInfo->szHwProfileName;
|
StringA.Buffer = (PCHAR)&lpHwProfileInfo->szHwProfileName;
|
||||||
StringA.Length = 0;
|
StringA.Length = 0;
|
||||||
StringA.MaximumLength = MAX_PROFILE_LEN;
|
StringA.MaximumLength = MAX_PROFILE_LEN;
|
||||||
Status = RtlUnicodeStringToAnsiString(&StringA,
|
Status = RtlUnicodeStringToAnsiString(&StringA,
|
||||||
&StringU,
|
&StringU,
|
||||||
FALSE);
|
FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,114 +86,114 @@ GetCurrentHwProfileA(LPHW_PROFILE_INFOA lpHwProfileInfo)
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
GetCurrentHwProfileW(LPHW_PROFILE_INFOW lpHwProfileInfo)
|
GetCurrentHwProfileW(LPHW_PROFILE_INFOW lpHwProfileInfo)
|
||||||
{
|
{
|
||||||
WCHAR szKeyName[256];
|
WCHAR szKeyName[256];
|
||||||
HKEY hDbKey;
|
HKEY hDbKey;
|
||||||
HKEY hProfileKey;
|
HKEY hProfileKey;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
DWORD dwConfigId;
|
DWORD dwConfigId;
|
||||||
|
|
||||||
TRACE("GetCurrentHwProfileW() called\n");
|
TRACE("GetCurrentHwProfileW() called\n");
|
||||||
|
|
||||||
if (lpHwProfileInfo == NULL)
|
if (lpHwProfileInfo == NULL)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||||
L"System\\CurrentControlSet\\Control\\IDConfigDB",
|
L"System\\CurrentControlSet\\Control\\IDConfigDB",
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hDbKey))
|
&hDbKey))
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_REGISTRY_CORRUPT);
|
SetLastError(ERROR_REGISTRY_CORRUPT);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = sizeof(DWORD);
|
dwLength = sizeof(DWORD);
|
||||||
if (RegQueryValueExW(hDbKey,
|
if (RegQueryValueExW(hDbKey,
|
||||||
L"CurrentConfig",
|
L"CurrentConfig",
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)&dwConfigId,
|
(LPBYTE)&dwConfigId,
|
||||||
&dwLength))
|
&dwLength))
|
||||||
{
|
{
|
||||||
RegCloseKey(hDbKey);
|
RegCloseKey(hDbKey);
|
||||||
SetLastError(ERROR_REGISTRY_CORRUPT);
|
SetLastError(ERROR_REGISTRY_CORRUPT);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
swprintf(szKeyName,
|
swprintf(szKeyName,
|
||||||
L"Hardware Profile\\%04lu",
|
L"Hardware Profile\\%04lu",
|
||||||
dwConfigId);
|
dwConfigId);
|
||||||
|
|
||||||
if (RegOpenKeyExW(hDbKey,
|
if (RegOpenKeyExW(hDbKey,
|
||||||
szKeyName,
|
szKeyName,
|
||||||
0,
|
0,
|
||||||
KEY_QUERY_VALUE | KEY_SET_VALUE,
|
KEY_QUERY_VALUE | KEY_SET_VALUE,
|
||||||
&hProfileKey))
|
&hProfileKey))
|
||||||
{
|
{
|
||||||
RegCloseKey(hDbKey);
|
RegCloseKey(hDbKey);
|
||||||
SetLastError(ERROR_REGISTRY_CORRUPT);
|
SetLastError(ERROR_REGISTRY_CORRUPT);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = sizeof(DWORD);
|
dwLength = sizeof(DWORD);
|
||||||
if (RegQueryValueExW(hProfileKey,
|
if (RegQueryValueExW(hProfileKey,
|
||||||
L"DockState",
|
L"DockState",
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)&lpHwProfileInfo->dwDockInfo,
|
(LPBYTE)&lpHwProfileInfo->dwDockInfo,
|
||||||
&dwLength))
|
&dwLength))
|
||||||
{
|
{
|
||||||
lpHwProfileInfo->dwDockInfo =
|
lpHwProfileInfo->dwDockInfo =
|
||||||
DOCKINFO_DOCKED | DOCKINFO_UNDOCKED | DOCKINFO_USER_SUPPLIED;
|
DOCKINFO_DOCKED | DOCKINFO_UNDOCKED | DOCKINFO_USER_SUPPLIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = HW_PROFILE_GUIDLEN * sizeof(WCHAR);
|
dwLength = HW_PROFILE_GUIDLEN * sizeof(WCHAR);
|
||||||
if (RegQueryValueExW(hProfileKey,
|
if (RegQueryValueExW(hProfileKey,
|
||||||
L"HwProfileGuid",
|
L"HwProfileGuid",
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)&lpHwProfileInfo->szHwProfileGuid,
|
(LPBYTE)&lpHwProfileInfo->szHwProfileGuid,
|
||||||
&dwLength))
|
&dwLength))
|
||||||
{
|
{
|
||||||
/* FIXME: Create a new GUID */
|
/* FIXME: Create a new GUID */
|
||||||
wcscpy(lpHwProfileInfo->szHwProfileGuid,
|
wcscpy(lpHwProfileInfo->szHwProfileGuid,
|
||||||
L"{00000000-0000-0000-0000-000000000000}");
|
L"{00000000-0000-0000-0000-000000000000}");
|
||||||
|
|
||||||
dwLength = (wcslen(lpHwProfileInfo->szHwProfileGuid) + 1) * sizeof(WCHAR);
|
dwLength = (wcslen(lpHwProfileInfo->szHwProfileGuid) + 1) * sizeof(WCHAR);
|
||||||
RegSetValueExW(hProfileKey,
|
RegSetValueExW(hProfileKey,
|
||||||
L"HwProfileGuid",
|
L"HwProfileGuid",
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
(LPBYTE)lpHwProfileInfo->szHwProfileGuid,
|
(LPBYTE)lpHwProfileInfo->szHwProfileGuid,
|
||||||
dwLength);
|
dwLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = MAX_PROFILE_LEN * sizeof(WCHAR);
|
dwLength = MAX_PROFILE_LEN * sizeof(WCHAR);
|
||||||
if (RegQueryValueExW(hProfileKey,
|
if (RegQueryValueExW(hProfileKey,
|
||||||
L"FriendlyName",
|
L"FriendlyName",
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)&lpHwProfileInfo->szHwProfileName,
|
(LPBYTE)&lpHwProfileInfo->szHwProfileName,
|
||||||
&dwLength))
|
&dwLength))
|
||||||
{
|
{
|
||||||
wcscpy(lpHwProfileInfo->szHwProfileName,
|
wcscpy(lpHwProfileInfo->szHwProfileName,
|
||||||
L"Noname Hardware Profile");
|
L"Noname Hardware Profile");
|
||||||
dwLength = (wcslen(lpHwProfileInfo->szHwProfileName) + 1) * sizeof(WCHAR);
|
dwLength = (wcslen(lpHwProfileInfo->szHwProfileName) + 1) * sizeof(WCHAR);
|
||||||
RegSetValueExW(hProfileKey,
|
RegSetValueExW(hProfileKey,
|
||||||
L"FriendlyName",
|
L"FriendlyName",
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
(LPBYTE)lpHwProfileInfo->szHwProfileName,
|
(LPBYTE)lpHwProfileInfo->szHwProfileName,
|
||||||
dwLength);
|
dwLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hProfileKey);
|
RegCloseKey(hProfileKey);
|
||||||
RegCloseKey(hDbKey);
|
RegCloseKey(hDbKey);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -43,10 +43,12 @@ AbortSystemShutdownA(LPCSTR lpMachineName)
|
||||||
|
|
||||||
RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
|
RtlInitAnsiString(&MachineNameA, (LPSTR)lpMachineName);
|
||||||
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
|
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
|
||||||
if (STATUS_SUCCESS != Status) {
|
if (STATUS_SUCCESS != Status)
|
||||||
|
{
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = AbortSystemShutdownW(MachineNameW.Buffer);
|
rv = AbortSystemShutdownW(MachineNameW.Buffer);
|
||||||
RtlFreeUnicodeString(&MachineNameW);
|
RtlFreeUnicodeString(&MachineNameW);
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
@ -60,23 +62,26 @@ AbortSystemShutdownA(LPCSTR lpMachineName)
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
InitiateSystemShutdownW(
|
InitiateSystemShutdownW(LPWSTR lpMachineName,
|
||||||
LPWSTR lpMachineName,
|
LPWSTR lpMessage,
|
||||||
LPWSTR lpMessage,
|
DWORD dwTimeout,
|
||||||
DWORD dwTimeout,
|
BOOL bForceAppsClosed,
|
||||||
BOOL bForceAppsClosed,
|
BOOL bRebootAfterShutdown)
|
||||||
BOOL bRebootAfterShutdown)
|
|
||||||
{
|
{
|
||||||
SHUTDOWN_ACTION Action = ShutdownNoReboot;
|
SHUTDOWN_ACTION Action = ShutdownNoReboot;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (lpMachineName) {
|
if (lpMachineName)
|
||||||
/* FIXME: remote machine shutdown not supported yet */
|
{
|
||||||
|
/* FIXME: remote machine shutdown not supported yet */
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (dwTimeout) {
|
|
||||||
|
if (dwTimeout)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtShutdownSystem(Action);
|
Status = NtShutdownSystem(Action);
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -90,12 +95,11 @@ InitiateSystemShutdownW(
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
STDCALL
|
STDCALL
|
||||||
InitiateSystemShutdownA(
|
InitiateSystemShutdownA(LPSTR lpMachineName,
|
||||||
LPSTR lpMachineName,
|
LPSTR lpMessage,
|
||||||
LPSTR lpMessage,
|
DWORD dwTimeout,
|
||||||
DWORD dwTimeout,
|
BOOL bForceAppsClosed,
|
||||||
BOOL bForceAppsClosed,
|
BOOL bRebootAfterShutdown)
|
||||||
BOOL bRebootAfterShutdown)
|
|
||||||
{
|
{
|
||||||
ANSI_STRING MachineNameA;
|
ANSI_STRING MachineNameA;
|
||||||
ANSI_STRING MessageA;
|
ANSI_STRING MessageA;
|
||||||
|
@ -105,38 +109,49 @@ InitiateSystemShutdownA(
|
||||||
INT LastError;
|
INT LastError;
|
||||||
BOOL rv;
|
BOOL rv;
|
||||||
|
|
||||||
if (lpMachineName) {
|
if (lpMachineName)
|
||||||
|
{
|
||||||
RtlInitAnsiString(&MachineNameA, lpMachineName);
|
RtlInitAnsiString(&MachineNameA, lpMachineName);
|
||||||
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
|
Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE);
|
||||||
if (STATUS_SUCCESS != Status) {
|
if (STATUS_SUCCESS != Status)
|
||||||
|
{
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lpMessage) {
|
|
||||||
|
if (lpMessage)
|
||||||
|
{
|
||||||
RtlInitAnsiString(&MessageA, lpMessage);
|
RtlInitAnsiString(&MessageA, lpMessage);
|
||||||
Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
|
Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE);
|
||||||
if (STATUS_SUCCESS != Status) {
|
if (STATUS_SUCCESS != Status)
|
||||||
if (MachineNameW.Length) {
|
{
|
||||||
|
if (MachineNameW.Length)
|
||||||
|
{
|
||||||
RtlFreeUnicodeString(&MachineNameW);
|
RtlFreeUnicodeString(&MachineNameW);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLastError(RtlNtStatusToDosError(Status));
|
SetLastError(RtlNtStatusToDosError(Status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rv = InitiateSystemShutdownW(
|
|
||||||
MachineNameW.Buffer,
|
rv = InitiateSystemShutdownW(MachineNameW.Buffer,
|
||||||
MessageW.Buffer,
|
MessageW.Buffer,
|
||||||
dwTimeout,
|
dwTimeout,
|
||||||
bForceAppsClosed,
|
bForceAppsClosed,
|
||||||
bRebootAfterShutdown);
|
bRebootAfterShutdown);
|
||||||
LastError = GetLastError();
|
LastError = GetLastError();
|
||||||
if (lpMachineName) {
|
if (lpMachineName)
|
||||||
|
{
|
||||||
RtlFreeUnicodeString(&MachineNameW);
|
RtlFreeUnicodeString(&MachineNameW);
|
||||||
}
|
}
|
||||||
if (lpMessage) {
|
|
||||||
|
if (lpMessage)
|
||||||
|
{
|
||||||
RtlFreeUnicodeString(&MessageW);
|
RtlFreeUnicodeString(&MessageW);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLastError(LastError);
|
SetLastError(LastError);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -146,9 +161,13 @@ InitiateSystemShutdownA(
|
||||||
*
|
*
|
||||||
* see InitiateSystemShutdownExA
|
* see InitiateSystemShutdownExA
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI InitiateSystemShutdownExW( LPWSTR lpMachineName, LPWSTR lpMessage,
|
BOOL WINAPI
|
||||||
DWORD dwTimeout, BOOL bForceAppsClosed, BOOL bRebootAfterShutdown,
|
InitiateSystemShutdownExW(LPWSTR lpMachineName,
|
||||||
DWORD dwReason)
|
LPWSTR lpMessage,
|
||||||
|
DWORD dwTimeout,
|
||||||
|
BOOL bForceAppsClosed,
|
||||||
|
BOOL bRebootAfterShutdown,
|
||||||
|
DWORD dwReason)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue