Keep remote machine name in device info set. Use it when needed

svn path=/trunk/; revision=19701
This commit is contained in:
Hervé Poussineau 2005-11-27 22:13:00 +00:00
parent 7e1e9ef483
commit a4e94fa84b
2 changed files with 21 additions and 4 deletions

View file

@ -632,6 +632,7 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
{
struct DeviceInfoSet *list;
LPWSTR UNCServerName = NULL;
DWORD size;
DWORD rc;
//CONFIGRET cr;
HDEVINFO ret = (HDEVINFO)INVALID_HANDLE_VALUE;;
@ -639,7 +640,10 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
debugstr_w(MachineName), Reserved);
list = HeapAlloc(GetProcessHeap(), 0, sizeof(struct DeviceInfoSet));
size = sizeof(struct DeviceInfoSet);
if (MachineName)
size += (wcslen(MachineName) + 3) * sizeof(WCHAR);
list = HeapAlloc(GetProcessHeap(), 0, size);
if (!list)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -671,6 +675,9 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
}
strcpyW(UNCServerName + 2, MachineName);
list->szData[0] = list->szData[1] = '\\';
strcpyW(list->szData + 2, MachineName);
list->MachineName = list->szData;
}
else
{
@ -684,6 +691,7 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
}
if (!GetComputerNameW(UNCServerName + 2, &Size))
goto cleanup;
list->MachineName = NULL;
}
#if 0
UNCServerName[0] = UNCServerName[1] = '\\';
@ -3336,7 +3344,10 @@ BOOL WINAPI SetupDiGetDeviceInfoListDetailW(
&list->ClassGuid,
sizeof(GUID));
DeviceInfoListDetailData->RemoteMachineHandle = list->hMachine;
DeviceInfoListDetailData->RemoteMachineName[0] = 0; /* FIXME */
if (list->MachineName)
strcpyW(DeviceInfoListDetailData->RemoteMachineName, list->MachineName + 2);
else
DeviceInfoListDetailData->RemoteMachineName[0] = 0;
ret = TRUE;
}
@ -3639,8 +3650,8 @@ BOOL WINAPI SetupDiGetClassDevPropertySheetsW(
hKey = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_QUERY_VALUE);
else
{
/* FIXME: what if DeviceInfoSet is a remote device info set? */
hKey = SetupDiOpenClassRegKey(&list->ClassGuid, KEY_QUERY_VALUE);
hKey = SetupDiOpenClassRegKeyExW(&list->ClassGuid, KEY_QUERY_VALUE,
DIOCR_INSTALLER, list->MachineName + 2, NULL);
}
if (hKey == INVALID_HANDLE_VALUE)
goto cleanup;

View file

@ -144,6 +144,12 @@ struct DeviceInfoSet /* HDEVINFO */
LIST_ENTRY DriverListHead; /* List of struct DriverInfoElement */
LIST_ENTRY ListHead; /* List of struct DeviceInfoElement */
/* Contains the name of the remote computer ('\\COMPUTERNAME' for example),
* or NULL if related to local machine. Points into szData field at the
* end of the structure */
PCWSTR MachineName;
WCHAR szData[0];
};
extern HINSTANCE hInstance;