Created
October 1, 2016 19:39
-
-
Save theopolis/580bcc94084831f331a0b83c5fef40ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/osquery/core/windows/wmi.cpp b/osquery/core/windows/wmi.cpp | |
index 43e8d1f..d336118 100644 | |
--- a/osquery/core/windows/wmi.cpp | |
+++ b/osquery/core/windows/wmi.cpp | |
@@ -197,8 +197,6 @@ WmiRequest::WmiRequest(const std::string& query, BSTR nspace) { | |
std::wstring wql = stringToWstring(query); | |
HRESULT hr = E_FAIL; | |
- | |
- hr = ::CoInitializeEx(0, COINIT_MULTITHREADED); | |
hr = ::CoInitializeSecurity(nullptr, | |
-1, | |
nullptr, | |
diff --git a/osquery/main/shell.cpp b/osquery/main/shell.cpp | |
index 8f5f0bf..0274d85 100644 | |
--- a/osquery/main/shell.cpp | |
+++ b/osquery/main/shell.cpp | |
@@ -149,6 +149,10 @@ char **table_completion_function(const char *text, int start, int end) { | |
#endif | |
int main(int argc, char *argv[]) { | |
+#ifdef WIN32 | |
+ ::CoInitializeEx(0, COINIT_MULTITHREADED); | |
+#endif | |
+ | |
// Parse/apply flags, start registry, load logger/config plugins. | |
osquery::Initializer runner(argc, argv, osquery::ToolType::SHELL); | |
@@ -188,5 +192,9 @@ int main(int argc, char *argv[]) { | |
retcode = profile(argc, argv); | |
} | |
+#ifdef WIN32 | |
+ ::CoUninitialize(); | |
+#endif | |
+ | |
return retcode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment