ntoskrnl.exe: Use the registered interface class in IoSetDeviceInterfaceState().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Zebediah Figura 2019-07-02 17:44:35 -05:00 committed by Alexandre Julliard
parent 4c2afc8ad9
commit 2698249362
1 changed files with 1 additions and 76 deletions

View File

@ -71,77 +71,6 @@ static int interface_rb_compare( const void *key, const struct wine_rb_entry *en
static struct wine_rb_tree device_interfaces = { interface_rb_compare };
static inline BOOL is_valid_hex(WCHAR c)
{
if (!(((c >= '0') && (c <= '9')) ||
((c >= 'a') && (c <= 'f')) ||
((c >= 'A') && (c <= 'F'))))
return FALSE;
return TRUE;
}
static const BYTE guid_conv_table[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, /* 0x30 */
0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */
0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* 0x60 */
};
static BOOL guid_from_string(const WCHAR *s, GUID *id)
{
int i;
if (!s || s[0] != '{')
{
memset( id, 0, sizeof (CLSID) );
return FALSE;
}
id->Data1 = 0;
for (i = 1; i < 9; i++)
{
if (!is_valid_hex(s[i])) return FALSE;
id->Data1 = (id->Data1 << 4) | guid_conv_table[s[i]];
}
if (s[9] != '-') return FALSE;
id->Data2 = 0;
for (i = 10; i < 14; i++)
{
if (!is_valid_hex(s[i])) return FALSE;
id->Data2 = (id->Data2 << 4) | guid_conv_table[s[i]];
}
if (s[14] != '-') return FALSE;
id->Data3 = 0;
for (i = 15; i < 19; i++)
{
if (!is_valid_hex(s[i])) return FALSE;
id->Data3 = (id->Data3 << 4) | guid_conv_table[s[i]];
}
if (s[19] != '-') return FALSE;
for (i = 20; i < 37; i += 2)
{
if (i == 24)
{
if (s[i] != '-') return FALSE;
i++;
}
if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return FALSE;
id->Data4[(i-20)/2] = guid_conv_table[s[i]] << 4 | guid_conv_table[s[i+1]];
}
if (s[37] == '}')
return TRUE;
return FALSE;
}
static NTSTATUS WINAPI internal_complete( DEVICE_OBJECT *device, IRP *irp, void *context )
{
HANDLE event = context;
@ -594,7 +523,6 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable
UNICODE_STRING string;
DWORD data = enable;
NTSTATUS ret;
GUID class;
ULONG len;
TRACE("device %s, enable %u.\n", debugstr_us(name), enable);
@ -615,9 +543,6 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable
if (*p == '\\') refstr = p;
if (!refstr) refstr = p;
if (!guid_from_string( refstr - 38, &class ))
return STATUS_INVALID_PARAMETER;
len = lstrlenW(DeviceClassesW) + 38 + 1 + namelen + 2 + 1;
if (!(path = heap_alloc( len * sizeof(WCHAR) )))
@ -676,7 +601,7 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable
{
broadcast->dbcc_size = len;
broadcast->dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
broadcast->dbcc_classguid = class;
broadcast->dbcc_classguid = iface->interface_class;
lstrcpynW( broadcast->dbcc_name, name->Buffer, namelen + 1 );
BroadcastSystemMessageW( BSF_FORCEIFHUNG | BSF_QUERY, NULL, WM_DEVICECHANGE,
enable ? DBT_DEVICEARRIVAL : DBT_DEVICEREMOVECOMPLETE, (LPARAM)broadcast );