mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 06:12:59 +00:00
Open remote registry if needed in SetupDiCreateDeviceInfoListExW and SetupDiOpenClassRegKeyExW
Set last error in more places Add my name to copyright due to my recent changes svn path=/trunk/; revision=16474
This commit is contained in:
parent
8322ac0d33
commit
23c534f821
1 changed files with 33 additions and 13 deletions
|
@ -2,6 +2,7 @@
|
||||||
* SetupAPI device installer
|
* SetupAPI device installer
|
||||||
*
|
*
|
||||||
* Copyright 2000 Andreas Mohr for CodeWeavers
|
* Copyright 2000 Andreas Mohr for CodeWeavers
|
||||||
|
* 2005 Hervé Poussineau (hpoussin@reactos.com)
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -645,6 +646,7 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
|
||||||
PVOID Reserved)
|
PVOID Reserved)
|
||||||
{
|
{
|
||||||
DeviceInfoList* list;
|
DeviceInfoList* list;
|
||||||
|
DWORD rc;
|
||||||
|
|
||||||
TRACE("%p %p %p %p\n", ClassGuid, hwndParent, MachineName, Reserved);
|
TRACE("%p %p %p %p\n", ClassGuid, hwndParent, MachineName, Reserved);
|
||||||
|
|
||||||
|
@ -658,10 +660,13 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
|
||||||
list->magic = SETUP_DEV_INFO_LIST_MAGIC;
|
list->magic = SETUP_DEV_INFO_LIST_MAGIC;
|
||||||
list->hWnd = hwndParent;
|
list->hWnd = hwndParent;
|
||||||
list->numberOfEntries = 0;
|
list->numberOfEntries = 0;
|
||||||
/* FIXME: open distant registry */
|
if (MachineName)
|
||||||
//if (RegConnectRegistryW(MachineName, HKEY_LOCAL_MACHINE, &list->HKLM) != ERROR_SUCCESS)
|
rc = RegConnectRegistryW(MachineName, HKEY_LOCAL_MACHINE, &list->HKLM);
|
||||||
if (RegOpenKey(HKEY_LOCAL_MACHINE, NULL, &list->HKLM) != ERROR_SUCCESS)
|
else
|
||||||
|
rc = RegOpenKey(HKEY_LOCAL_MACHINE, NULL, &list->HKLM);
|
||||||
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
SetLastError(rc);
|
||||||
HeapFree(GetProcessHeap(), 0, list);
|
HeapFree(GetProcessHeap(), 0, list);
|
||||||
return (HDEVINFO)INVALID_HANDLE_VALUE;
|
return (HDEVINFO)INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -2042,16 +2047,12 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
|
||||||
LPWSTR lpGuidString;
|
LPWSTR lpGuidString;
|
||||||
LPWSTR lpFullGuidString;
|
LPWSTR lpFullGuidString;
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
|
HKEY HKLM;
|
||||||
HKEY hClassesKey;
|
HKEY hClassesKey;
|
||||||
HKEY hClassKey;
|
HKEY hClassKey;
|
||||||
|
DWORD rc;
|
||||||
LPCWSTR lpKeyName;
|
LPCWSTR lpKeyName;
|
||||||
|
|
||||||
if (MachineName != NULL)
|
|
||||||
{
|
|
||||||
FIXME("Remote access not supported yet!\n");
|
|
||||||
return INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Flags == DIOCR_INSTALLER)
|
if (Flags == DIOCR_INSTALLER)
|
||||||
{
|
{
|
||||||
lpKeyName = ControlClass;
|
lpKeyName = ControlClass;
|
||||||
|
@ -2067,12 +2068,27 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (MachineName != NULL)
|
||||||
|
{
|
||||||
|
rc = RegConnectRegistryW(MachineName, HKEY_LOCAL_MACHINE, &HKLM);
|
||||||
|
if (rc != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
SetLastError(rc);
|
||||||
|
return INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
HKLM = HKEY_LOCAL_MACHINE;
|
||||||
|
|
||||||
|
rc = RegOpenKeyExW(HKLM,
|
||||||
lpKeyName,
|
lpKeyName,
|
||||||
0,
|
0,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&hClassesKey))
|
&hClassesKey);
|
||||||
|
if (MachineName != NULL) RegCloseKey(HKLM);
|
||||||
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
SetLastError(rc);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2081,6 +2097,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
|
||||||
|
|
||||||
if (UuidToStringW((UUID*)ClassGuid, &lpGuidString) != RPC_S_OK)
|
if (UuidToStringW((UUID*)ClassGuid, &lpGuidString) != RPC_S_OK)
|
||||||
{
|
{
|
||||||
|
SetLastError(ERROR_GEN_FAILURE);
|
||||||
RegCloseKey(hClassesKey);
|
RegCloseKey(hClassesKey);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -2089,6 +2106,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
|
||||||
lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR));
|
lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR));
|
||||||
if (!lpFullGuidString)
|
if (!lpFullGuidString)
|
||||||
{
|
{
|
||||||
|
SetLastError(ERROR_NO_SYSTEM_RESOURCES);
|
||||||
RpcStringFreeW(&lpGuidString);
|
RpcStringFreeW(&lpGuidString);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
@ -2098,12 +2116,14 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
|
||||||
lpFullGuidString[dwLength + 2] = UNICODE_NULL;
|
lpFullGuidString[dwLength + 2] = UNICODE_NULL;
|
||||||
RpcStringFreeW(&lpGuidString);
|
RpcStringFreeW(&lpGuidString);
|
||||||
|
|
||||||
if (RegOpenKeyExW(hClassesKey,
|
rc = RegOpenKeyExW(hClassesKey,
|
||||||
lpFullGuidString,
|
lpFullGuidString,
|
||||||
0,
|
0,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&hClassKey))
|
&hClassKey);
|
||||||
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
SetLastError(rc);
|
||||||
HeapFree(GetProcessHeap(), 0, lpFullGuidString);
|
HeapFree(GetProcessHeap(), 0, lpFullGuidString);
|
||||||
RegCloseKey(hClassesKey);
|
RegCloseKey(hClassesKey);
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue