Skip to content

Do not intermix BSTR and wchar_t as they are not compatible #1512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ int _tmain(int argc, _TCHAR* argv[])
// Connect to WMI through the IWbemLocator::ConnectServer method
// Connect to the local ROOT\CIMV2 namespace
// and obtain pointer pSvc to make IWbemServices calls.
IWbemServices *pSvc = NULL;
hres = pLoc->ConnectServer(L"ROOT\\CimV2", NULL,NULL, 0, NULL, 0, 0, &pSvc);
IWbemServices *pSvc = NULL;
BSTR namespace = SysAllocString(L"ROOT\\CimV2");
hres = pLoc->ConnectServer(namespace, NULL, NULL, 0, NULL, 0, 0, &pSvc);
SysFreeString(namespace);

if (FAILED(hres))
{
Expand Down Expand Up @@ -222,4 +224,4 @@ int _tmain(int argc, _TCHAR* argv[])



<a href="/windows/win32/api/wbemcli/ne-wbemcli-wbem_connect_options">WBEM_CONNECT_OPTIONS</a>
<a href="/windows/win32/api/wbemcli/ne-wbemcli-wbem_connect_options">WBEM_CONNECT_OPTIONS</a>