setupapi: Make sure machine name is non-empty before failing.

This commit is contained in:
Juan Lang 2011-06-09 11:35:11 -07:00 committed by Alexandre Julliard
parent ad4c995c3f
commit 4fe8cc6164
2 changed files with 12 additions and 3 deletions

View File

@ -1163,7 +1163,7 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid,
TRACE("%s %p %s %p\n", debugstr_guid(ClassGuid), hwndParent,
debugstr_w(MachineName), Reserved);
if (MachineName != NULL)
if (MachineName && *MachineName)
{
FIXME("remote support is not implemented\n");
SetLastError(ERROR_INVALID_MACHINENAME);
@ -2371,7 +2371,7 @@ HDEVINFO WINAPI SetupDiGetClassDevsExW(
set = SetupDiCreateDeviceInfoListExW(class, parent, machine, reserved);
if (set)
{
if (machine)
if (machine && *machine)
FIXME("%s: unimplemented for remote machines\n",
debugstr_w(machine));
else if (flags & DIGCF_DEVICEINTERFACE)
@ -3562,7 +3562,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
LPCWSTR lpKeyName;
LONG l;
if (MachineName != NULL)
if (MachineName && *MachineName)
{
FIXME("Remote access not supported yet!\n");
return INVALID_HANDLE_VALUE;

View File

@ -261,6 +261,7 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
DWORD error;
static CHAR notnull[] = "NotNull";
static const WCHAR machine[] = { 'd','u','m','m','y',0 };
static const WCHAR empty[] = { 0 };
SetLastError(0xdeadbeef);
/* create empty DeviceInfoList, but set Reserved to a value, which is not NULL */
@ -290,6 +291,14 @@ static void test_SetupDiCreateDeviceInfoListEx(void)
/* destroy DeviceInfoList */
ret = pSetupDiDestroyDeviceInfoList(devlist);
ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error);
/* create empty DeviceInfoList with empty machine name */
devlist = pSetupDiCreateDeviceInfoListExW(NULL, NULL, empty, NULL);
ok(devlist && devlist != INVALID_HANDLE_VALUE, "SetupDiCreateDeviceInfoListExW failed : %p %d (expected != %p)\n", devlist, error, INVALID_HANDLE_VALUE);
/* destroy DeviceInfoList */
ret = pSetupDiDestroyDeviceInfoList(devlist);
ok(ret, "SetupDiDestroyDeviceInfoList failed : %d\n", error);
}
static void test_SetupDiOpenClassRegKeyExA(void)