[Bug 52852] New: Retrieving all properties from wmi class with "Select-object *" fails (in powershell core)
WineHQ Bugzilla
wine-bugs at winehq.org
Fri Apr 22 03:14:56 CDT 2022
https://bugs.winehq.org/show_bug.cgi?id=52852
Bug ID: 52852
Summary: Retrieving all properties from wmi class with
"Select-object *" fails (in powershell core)
Product: Wine
Version: 7.6
Hardware: x86-64
URL: https://github.com/PowerShell/PowerShell/releases/down
load/v7.0.3/PowerShell-7.0.3-win-x64.msi
OS: Linux
Status: NEW
Keywords: dotnet, download
Severity: normal
Priority: P2
Component: wmi&wbemprox
Assignee: wine-bugs at winehq.org
Reporter: xerox.xerox2000x at gmail.com
Distribution: Debian
(prerequisite: winetricks -q dotnet48)
The following code retrieves all properties from a class in PS Core on Windows
(tested with a few common classes):
([wmiclass]'\\.\root\cimv2:win32_logicaldisk').GetInstances() |Select-Object *
In all classes in wine I get:
"format-default: Error code: 0x80041002"
With the hack at the end of this post it works in wine too for most classes, so
maybe it might be easy to fix (?). Returning anything else then an error that
starts with 0x8* works really I found by trial and error.
However the hack also doesn`t work (breaks) cases like win32_process where the
count is more then one, so I guess the fix might be more complicated after all:
([wmiclass]'\\.\root\cimv2:win32_process').GetInstances() |Select-Object *
Output (with hack):
Select-Object: Z:\home\louis\ramdisk\a.ps1:1
Line |
1 | … class]'\\.\root\cimv2:win32_process').GetInstances() |Select-Object *
| ~~~~~~
| The following exception occurred while retrieving members:
| "Object reference not set to an instance of an object."
Steps to reproduce:
- winetricks -q dotnet48
- Install PS Core from downloadlink.
- Save the following line in a file called for example a.ps1:
([wmiclass]'\\.\root\cimv2:win32_logicaldisk').GetInstances() |Select-Object *
- Then: 'wine pwsh -file a.ps1'
Hack:
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 8233d35878d..ee0bc3ec14e 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -1181,7 +1181,7 @@ HRESULT get_propval( const struct view *view, UINT index,
const WCHAR *name, VAR
if ((hr = map_view_index( view, index, &table_index, &result_index )) !=
S_OK) return hr;
if (is_system_prop( name )) return get_system_propval( view, table_index,
result_index, name, ret, type, flavor );
- if (!view->result_count || !is_result_prop( view, name )) return
WBEM_E_NOT_FOUND;
+ if (!view->result_count || !is_result_prop( view, name )) return 0x40005;
table = view->table[table_index];
hr = get_column_index( table, name, &column );
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list