diff --git a/PowerEditor/src/MISC/Process/Process.cpp b/PowerEditor/src/MISC/Process/Process.cpp index 3ff3f529d..2d04cc88e 100644 --- a/PowerEditor/src/MISC/Process/Process.cpp +++ b/PowerEditor/src/MISC/Process/Process.cpp @@ -56,8 +56,17 @@ BOOL Process::run() startup.hStdOutput = hPipeOutW; startup.hStdError = hPipeErrW; - BOOL started = ::CreateProcess((_type == WIN32_PROG)?_command:NULL, // command is part of input string - (_type == WIN32_PROG)?NULL:_command, // (writeable) command string + string cmd = "\""; + cmd += _command; + cmd += "\""; + + if (_args[0]) + { + cmd += " "; + cmd += _args; + } + BOOL started = ::CreateProcess(NULL, // command is part of input string + (LPSTR)cmd.c_str(), // (writeable) command string NULL, // process security NULL, // thread security TRUE, // inherit handles flag diff --git a/PowerEditor/src/MISC/Process/Process.h b/PowerEditor/src/MISC/Process/Process.h index 82805235b..2d35cf1c4 100644 --- a/PowerEditor/src/MISC/Process/Process.h +++ b/PowerEditor/src/MISC/Process/Process.h @@ -28,11 +28,12 @@ class Process { public: Process(progType pt = WIN32_PROG) : _type(pt) {}; - Process(const char *cmd, const char *cDir, progType pt = WIN32_PROG) + Process(const char *cmd, const char *args, const char *cDir, progType pt = WIN32_PROG) : _type(pt), _stdoutStr(""), _stderrStr(""), _hPipeOutR(NULL), _hPipeErrR(NULL), _hProcess(NULL), _hProcessThread(NULL) { strcpy(_command, cmd); + strcpy(_args, args); strcpy(_curDir, cDir); //_pid = id; @@ -65,8 +66,9 @@ protected: progType _type; // LES ENTREES - char _command[256]; - char _curDir[256]; + char _command[MAX_PATH]; + char _args[MAX_PATH]; + char _curDir[MAX_PATH]; // LES SORTIES string _stdoutStr; diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 8c3b39fd4..8d459ed81 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -21,10 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "resource.h" #include "menuCmdID.h" -#define NOTEPAD_PLUS_VERSION "Notepad++ v4.6" -#define VERSION_VALUE "4.6\0" -#define VERSION_DIGITALVALUE 4, 6, 0, 0 - VS_VERSION_INFO VERSIONINFO FILEVERSION VERSION_DIGITALVALUE PRODUCTVERSION VERSION_DIGITALVALUE diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index c80467397..fd7a75568 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -18,6 +18,10 @@ #ifndef RESOURCE_H #define RESOURCE_H +#define NOTEPAD_PLUS_VERSION "Notepad++ v4.6" +#define VERSION_VALUE "4.6\0" +#define VERSION_DIGITALVALUE 4, 6, 0, 0 + #ifndef IDC_STATIC #define IDC_STATIC -1 #endif diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 4773a6381..47838619c 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -237,7 +237,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh COPYDATASTRUCT fileNamesData; fileNamesData.dwData = COPYDATA_FILENAMES; - //pNppParameters->setCmdlineParam(cmdLineParams); + string quotFileName = "\""; // tell the other running instance the FULL path to the new file to load if (lpszCmdLine[0] == '"') @@ -268,15 +268,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh Notepad_plus notepad_plus_plus; NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI(); - char updaterPath[MAX_PATH]; - strcpy(updaterPath, pNppParameters->getNppPath()); - strcat(updaterPath, "\\updater\\gup.exe"); - bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterPath) == TRUE); + + string updaterDir = pNppParameters->getNppPath(); + updaterDir += "\\updater\\"; + + string updaterFullPath = updaterDir + "gup.exe"; + + string version = VERSION_VALUE; + + bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE); bool doUpdate = !nppGui._neverUpdate; if (TheFirstOne && isUpExist && doUpdate) { - Process updater(updaterPath, "c:\\"); + Process updater(updaterFullPath.c_str(), version.c_str(), updaterDir.c_str()); updater.run(); } @@ -312,7 +317,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh if (i == 106901) ::MessageBox(NULL, "Scintilla.init is failed!", "106901", MB_OK); else { - char str[50] = "God Damn Exception : "; + char str[50] = "God Damned Exception : "; char code[10]; itoa(i, code, 10); ::MessageBox(NULL, strcat(str, code), "int exception", MB_OK);