https://bugs.winehq.org/show_bug.cgi?id=51871
Bug ID: 51871 Summary: PSScript fails with 0x80041002 (WBEM_E_NOT_FOUND) ( system property L"__Derivation" not implemented) Product: Wine Version: 6.19 Hardware: x86-64 URL: https://www.powershellgallery.com/packages/Traverse/0. 6/Content/Private%5CGet-WMICustom.ps1 OS: Linux Status: NEW Keywords: download, source Severity: normal Priority: P2 Component: wmi&wbemprox Assignee: wine-bugs@winehq.org Reporter: xerox.xerox2000x@gmail.com Distribution: ---
Hi, I`d like to make powershell script from the URL to work in wine in Powershell 7. (Background: Powershell 7 doesn`t have Get-WMIObject and GetCIMInstance doesn`t work; if the above script works it`s simple to just write an own simple Get-WMIObject which is for example used by chocolatey to retrieve some properties from win32_operatingsystem)
Output from running script in psconsole: Out-Default: The following exception occurred while retrieving the type name hierarchy: "Error code: 0x80041002".
In the console: 07f0:fixme:wbemprox:get_system_propval system property L"__Derivation" not implemented
Actually it turns out that returning complete stub for "__Derivation" is enough to make the script enough work for my purpose
I now use hack below, and that`s enough to fix this bug for me, but I guess it`s not ok enough for inclusion in wine. So if someone could write proper stub or advise howto improve patch that would be great
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index 77ed27e105d..b253f19a6ed 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -1006,6 +1006,13 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI if (type) *type = CIM_STRING; return S_OK; } + if (!wcsicmp( name, L"__DERIVATION" )) + { + if (ret) + V_VT( ret ) = VT_BSTR | VT_ARRAY; + if (type) *type = CIM_STRING | VT_ARRAY; + return S_OK; + } FIXME("system property %s not implemented\n", debugstr_w(name)); return WBEM_E_NOT_FOUND; } diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 69bb8e7977e..9bb8d559b06 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -1642,6 +1642,7 @@ static void test_Win32_VideoController( IWbemServices *services ) if (hr != S_OK) break;
check_property( obj, L"__CLASS", VT_BSTR, CIM_STRING ); + check_property( obj, L"__DERIVATION", VT_BSTR | VT_ARRAY, CIM_STRING | CIM_FLAG_ARRAY); check_property( obj, L"__GENUS", VT_I4, CIM_SINT32 ); check_property( obj, L"__NAMESPACE", VT_BSTR, CIM_STRING ); check_property( obj, L"__PATH", VT_BSTR, CIM_STRING );