diff -Nur PyMI-1.0.6.orig/MI/MI++.cpp PyMI-1.0.6/MI/MI++.cpp --- PyMI-1.0.6.orig/MI/MI++.cpp 2020-05-20 11:59:25.000000000 +0000 +++ PyMI-1.0.6/MI/MI++.cpp 2023-04-03 17:35:16.838667100 +0000 @@ -38,7 +38,7 @@ Instance instance((MI_Instance*)extError, false); if(IsInstanceOf(instance, L"MSFT_WmiError")) { - MI_Char* message = instance[L"Message"]->m_value.string; + const MI_Char* message = instance[L"Message"]->m_value.string; message = message ? message : L""; auto errorCode = instance[L"error_code"]->m_value.uint32; diff -Nur PyMI-1.0.6.orig/MI/targetver.h PyMI-1.0.6/MI/targetver.h --- PyMI-1.0.6.orig/MI/targetver.h 2020-05-20 11:59:25.000000000 +0000 +++ PyMI-1.0.6/MI/targetver.h 2023-04-03 17:39:44.483731200 +0000 @@ -5,4 +5,6 @@ // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. +#define _WIN32_WINNT 0x0a00 + #include diff -Nur PyMI-1.0.6.orig/PyMI/Class.cpp PyMI-1.0.6/PyMI/Class.cpp --- PyMI-1.0.6.orig/PyMI/Class.cpp 2020-05-20 11:59:25.000000000 +0000 +++ PyMI-1.0.6/PyMI/Class.cpp 2023-04-03 17:36:45.449775600 +0000 @@ -112,7 +112,7 @@ { try { - std::wstring& className = self->miClass->GetClassName(); + std::wstring className = self->miClass->GetClassName(); return PyUnicode_FromWideChar(className.c_str(), className.length()); } catch (std::exception& ex) @@ -126,7 +126,7 @@ { try { - std::wstring& nameSpace = self->miClass->GetNameSpace(); + std::wstring nameSpace = self->miClass->GetNameSpace(); return PyUnicode_FromWideChar(nameSpace.c_str(), nameSpace.length()); } catch (std::exception& ex) @@ -140,7 +140,7 @@ { try { - std::wstring& serverName = self->miClass->GetServerName(); + std::wstring serverName = self->miClass->GetServerName(); return PyUnicode_FromWideChar(serverName.c_str(), serverName.length()); } catch (std::exception& ex) diff -Nur PyMI-1.0.6.orig/PyMI/Instance.cpp PyMI-1.0.6/PyMI/Instance.cpp --- PyMI-1.0.6.orig/PyMI/Instance.cpp 2020-05-20 11:59:25.000000000 +0000 +++ PyMI-1.0.6/PyMI/Instance.cpp 2023-04-03 17:37:12.355261900 +0000 @@ -212,7 +212,7 @@ { try { - std::wstring& className = self->instance->GetClassName(); + std::wstring className = self->instance->GetClassName(); return PyUnicode_FromWideChar(className.c_str(), className.length()); } catch (std::exception& ex) @@ -226,7 +226,7 @@ { try { - std::wstring& nameSpace = self->instance->GetNameSpace(); + std::wstring nameSpace = self->instance->GetNameSpace(); return PyUnicode_FromWideChar(nameSpace.c_str(), nameSpace.length()); } catch (std::exception& ex) @@ -240,7 +240,7 @@ { try { - std::wstring& serverName = self->instance->GetServerName(); + std::wstring serverName = self->instance->GetServerName(); return PyUnicode_FromWideChar(serverName.c_str(), serverName.length()); } catch (std::exception& ex) diff -Nur PyMI-1.0.6.orig/PyMI/targetver.h PyMI-1.0.6/PyMI/targetver.h --- PyMI-1.0.6.orig/PyMI/targetver.h 2020-05-20 11:59:25.000000000 +0000 +++ PyMI-1.0.6/PyMI/targetver.h 2023-04-03 17:40:02.251730000 +0000 @@ -5,4 +5,6 @@ // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. +#define _WIN32_WINNT 0x0a00 + #include diff -Nur PyMI-1.0.6.orig/PyMI/Utils.cpp PyMI-1.0.6/PyMI/Utils.cpp --- PyMI-1.0.6.orig/PyMI/Utils.cpp 2020-05-20 11:59:25.000000000 +0000 +++ PyMI-1.0.6/PyMI/Utils.cpp 2023-04-03 17:44:27.883315600 +0000 @@ -3,6 +3,7 @@ #include "Utils.h" #include "instance.h" #include +#include #include @@ -151,7 +152,7 @@ throw MI::Exception(L"PyUnicode_AsWideChar failed"); } - auto& value = std::wstring(w, len); + auto value = std::wstring(w, len); delete[] w; return value; } @@ -167,9 +168,9 @@ try { #ifdef IS_PY3K - auto& value = Py2WString(pyStrValue); + auto value = Py2WString(pyStrValue); #else - auto& value = std::string(PyString_AsString(pyStrValue)); + auto value = std::string(PyString_AsString(pyStrValue)); #endif Py_DECREF(pyStrValue); return MI::MIValue::FromString(value); @@ -372,7 +373,7 @@ pyObj = PyList_GetItem(pyValue, i); } - auto& tmpValue = Py2MI(pyObj, itemType); + auto tmpValue = Py2MI(pyObj, itemType); value->SetArrayItem(*tmpValue, (unsigned)i); } return value; diff -Nur PyMI-1.0.6.orig/setup.py PyMI-1.0.6/setup.py --- PyMI-1.0.6.orig/setup.py 2020-05-25 12:11:25.000000000 +0000 +++ PyMI-1.0.6/setup.py 2023-04-03 17:21:10.626872900 +0000 @@ -37,7 +37,7 @@ return Compiler(None, dry_run, force) -ccompiler.new_compiler = new_compiler +#ccompiler.new_compiler = new_compiler # Setuptools requires relative paths