Skip to content
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

Initializing COM before using CComPtr to resolve runtime application crash when running WMI query checks #168

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

icnocop
Copy link
Collaborator

@icnocop icnocop commented Sep 6, 2024

No description provided.

@dblock
Copy link
Collaborator

dblock commented Sep 7, 2024

Did you attempt to write a test for this and it didn't work because of previous CoInitialize? Looks good otherwise.

@icnocop
Copy link
Collaborator Author

icnocop commented Sep 8, 2024

I expected the existing tests to be able to detect/catch/reproduce the issue.

In my case, the issue occurred only on Windows Server 2012 R2, and not on Windows Server 2019 or 2022 for example.

The last entry in the log was written by LOG(L"Checking whether WMI query '" << query << L"' returns any results");.

The application crashed with exception code C0000005, a memory error indicating an access violation.

I'm guessing that it was the release of CComPtr<IWbemClassObject> pclsObj which would have been called after CoUninitialize that caused the error.

Maybe running the tests on Windows Server 2012 R2 would reproduce the issue, but I never tried.

@dblock dblock merged commit 01d7f51 into dotnetinstaller:master Sep 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants