From: Robert Gerigk <Robert-Gerigk@online.de> SetupDiSetDevicePropertyW stores device properties as registry subkey hierarchies (Properties\{GUID}\XXXX with the value in the default entry). query_property attempted to read them as flat value names using RegQueryValueExW, which always failed with ERROR_FILE_NOT_FOUND. Open the property subkey and read its default value to match setupapi's storage format. Signed-off-by: Jan Robert Gerigk <Robert-Gerigk@online.de> --- dlls/cfgmgr32/cfgmgr32.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/dlls/cfgmgr32/cfgmgr32.c b/dlls/cfgmgr32/cfgmgr32.c index 280f10dd4db..2aae2d9fa44 100644 --- a/dlls/cfgmgr32/cfgmgr32.c +++ b/dlls/cfgmgr32/cfgmgr32.c @@ -158,11 +158,23 @@ static LSTATUS init_registry_property( struct property *prop, const DEVPROPKEY * static LSTATUS query_property( HKEY root, const WCHAR *prefix, DEVPROPTYPE type, struct property *prop ) { WCHAR path[MAX_PATH]; - ULONG reg_type; + ULONG reg_type = 0; LSTATUS err; + HKEY subkey; + + /* Device properties are stored by setupapi as registry subkey hierarchies + * (Properties\{GUID}\XXXX with the value in the default entry), not as + * flat value names. Open the property subkey and read its default value. */ + if ((err = RegOpenKeyExW( root, propkey_string( &prop->key, prefix, path, ARRAY_SIZE(path) ), + 0, KEY_READ, &subkey ))) + { + if (prop->type) *prop->type = DEVPROP_TYPE_EMPTY; + return err == ERROR_FILE_NOT_FOUND ? ERROR_NOT_FOUND : err; + } + + err = RegQueryValueExW( subkey, NULL, NULL, ®_type, prop->buffer, prop->size ); + RegCloseKey( subkey ); - err = RegQueryValueExW( root, propkey_string( &prop->key, prefix, path, ARRAY_SIZE(path) ), - NULL, ®_type, prop->buffer, prop->size ); if (type == DEVPROP_TYPE_EMPTY) type = reg_type & 0xffff; if (!err && !prop->buffer) err = ERROR_MORE_DATA; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10604