Commit c4073d5a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

win32u: Set DEVPKEY_Device_RemovalPolicy for GPUs.

parent bee387dc
......@@ -33,6 +33,7 @@
#include "setupapi.h"
#include "ntddvdeo.h"
#include "devpkey.h"
#include "cfgmgr32.h"
#include "wine/test.h"
......@@ -1042,6 +1043,13 @@ static void test_gpu_device_properties_guid(const GUID *devinterface_guid)
ok(ret, "Got unexpected ret %d, GetLastError() %lu, %s.\n", ret, GetLastError(), debugstr_w(device_id));
ok(type == DEVPROP_TYPE_UINT32, "Got type %ld.\n", type);
}
ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_RemovalPolicy, &type,
(BYTE *)&value, sizeof(value), NULL, 0);
ok(ret, "Got unexpected ret %d, GetLastError() %lu, %s.\n", ret, GetLastError(), debugstr_w(device_id));
ok(value == CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL || value == CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL
|| value == CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL, "Got value %d.\n", value);
ok(type == DEVPROP_TYPE_UINT32, "Got type %ld.\n", type);
++i;
}
SetupDiDestroyDeviceInfoList(set);
......
......@@ -32,6 +32,7 @@
#include "ntgdi_private.h"
#include "ntuser_private.h"
#include "devpropdef.h"
#include "cfgmgr32.h"
#include "wine/wingdi16.h"
#include "wine/server.h"
......@@ -109,6 +110,14 @@ static const WCHAR devpkey_device_bus_number[] =
'\\','0','0','1','7'
};
static const WCHAR devpkey_device_removal_policy[] =
{
'P','r','o','p','e','r','t','i','e','s',
'\\','{','A','4','5','C','2','5','4','E','-','D','F','1','C','-','4','E','F','D',
'-','8','0','2','0','-','6','7','D','1','4','6','A','8','5','0','E','0','}',
'\\','0','0','2','1'
};
static const WCHAR devpropkey_device_ispresentW[] =
{
'P','r','o','p','e','r','t','i','e','s',
......@@ -1256,6 +1265,16 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param )
}
}
if ((subkey = reg_create_key( hkey, devpkey_device_removal_policy,
sizeof(devpkey_device_removal_policy), 0, NULL )))
{
unsigned int removal_policy = CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL;
set_reg_value( subkey, NULL, 0xffff0000 | DEVPROP_TYPE_UINT32,
&removal_policy, sizeof(removal_policy) );
NtClose( subkey );
}
desc = gpu->name;
if (!desc[0]) desc = wine_adapterW;
set_reg_value( hkey, device_descW, REG_SZ, desc, (lstrlenW( desc ) + 1) * sizeof(WCHAR) );
......
......@@ -180,6 +180,10 @@ typedef DWORD CONFIGRET;
#define CM_REGISTRY_USER 0x0100
#define CM_REGISTRY_CONFIG 0x0200
#define CM_REMOVAL_POLICY_EXPECT_NO_REMOVAL 1
#define CM_REMOVAL_POLICY_EXPECT_ORDERLY_REMOVAL 2
#define CM_REMOVAL_POLICY_EXPECT_SURPRISE_REMOVAL 3
typedef DWORD DEVINST, *PDEVINST;
typedef DWORD DEVNODE, *PDEVNODE;
typedef HANDLE HMACHINE, *PHMACHINE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment