From ee8236c5241374cebb561ea7c16ac7e8c9cb2d9c Mon Sep 17 00:00:00 2001
From: "SND\\ussrhero_cp"
 <SND\ussrhero_cp@9b283d60-5439-405e-af05-b73fd8c4d996>
Date: Fri, 7 Apr 2017 19:29:17 +0000
Subject: [PATCH] [pykd_ext_2.0] fixed : issue #14086  (invalid sys.argv values
 )

git-svn-id: https://pykd.svn.codeplex.com/svn@91206 9b283d60-5439-405e-af05-b73fd8c4d996
---
 pykd_ext/version.h     |  2 +-
 pykd_ext/windbgext.cpp | 17 +++++++++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/pykd_ext/version.h b/pykd_ext/version.h
index 1139188..d026650 100644
--- a/pykd_ext/version.h
+++ b/pykd_ext/version.h
@@ -3,7 +3,7 @@
 #define PYKDEXT_VERSION_MAJOR      2
 #define PYKDEXT_VERSION_MINOR      0
 #define PYKDEXT_VERSION_SUBVERSION 0
-#define PYKDEXT_VERSION_BUILDNO    10
+#define PYKDEXT_VERSION_BUILDNO    11
 
 #define __VER_STR2__(x) #x
 #define __VER_STR1__(x) __VER_STR2__(x)
diff --git a/pykd_ext/windbgext.cpp b/pykd_ext/windbgext.cpp
index d75a285..3308262 100644
--- a/pykd_ext/windbgext.cpp
+++ b/pykd_ext/windbgext.cpp
@@ -387,18 +387,19 @@ py(
 
             if (IsPy3())
             {
-                // �������������� ����������� ���������
-                std::vector<wchar_t*>  pythonArgs(opts.args.size());
-
                 std::wstring  scriptFileNameW = _bstr_t(scriptFileName.c_str());
 
-                pythonArgs[0] = const_cast<wchar_t*>(scriptFileNameW.c_str());
+                // �������������� ����������� ���������
+                std::vector<std::wstring>   argws(opts.args.size());
+
+                argws[0] = scriptFileNameW;
 
                 for (size_t i = 1; i < opts.args.size(); ++i)
-                {
-                    std::wstring  argw = _bstr_t(opts.args[i].c_str());
-                    pythonArgs[i] = const_cast<wchar_t*>(argw.c_str());
-                }
+                    argws[i] = _bstr_t(opts.args[i].c_str());
+
+                std::vector<wchar_t*>  pythonArgs(opts.args.size());
+                for (size_t i = 0; i < opts.args.size(); ++i)
+                    pythonArgs[i] = const_cast<wchar_t*>(argws[i].c_str());
 
                 PySys_SetArgv_Py3((int)opts.args.size(), &pythonArgs[0]);