From 07bff43c1ee8ffb1e19dc2ed6419f602c0053f56 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 12 Aug 2010 21:19:08 +0300 Subject: modified: gpg_wrapper.cpp modified: gpg_wrapper.h modified: main.cpp modified: messages.cpp modified: options.cpp --- gpg_wrapper.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'gpg_wrapper.cpp') diff --git a/gpg_wrapper.cpp b/gpg_wrapper.cpp index b9e9029..53f06dc 100644 --- a/gpg_wrapper.cpp +++ b/gpg_wrapper.cpp @@ -18,7 +18,7 @@ //thx gpg module from Harald Treder, Zakhar V. Bardymov -pxResult pxExecute(TCHAR *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode) +pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode) { BOOL success; STARTUPINFO sinfo = {0}; @@ -39,8 +39,7 @@ pxResult pxExecute(TCHAR *acommandline, char *ainput, string *aoutput, LPDWORD a return pxNotFound; } } - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T("")); - TCHAR commandline[4096] = {0}; + wstring commandline; sattrs.nLength=sizeof(SECURITY_ATTRIBUTES); sattrs.bInheritHandle=TRUE; @@ -70,19 +69,18 @@ pxResult pxExecute(TCHAR *acommandline, char *ainput, string *aoutput, LPDWORD a sinfo.hStdInput=newstdin; { //form initial command - _tcscpy(commandline, _T("\"")); - _tcscat(commandline, bin_path); - _tcscat(commandline, _T("\"")); - _tcscat(commandline, _T(" --homedir")); - _tcscat(commandline, _T(" \"")); - _tcscat(commandline, home_dir); - _tcscat(commandline, _T("\" ")); - _tcscat(commandline, acommandline); + commandline += _T("\""); + commandline += bin_path; + commandline += _T("\" --homedir \""); + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T("")); + commandline += home_dir; + commandline += _T("\" "); + commandline += *acommandline; mir_free(bin_path); mir_free(home_dir); } - success = CreateProcess(NULL, commandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &sinfo, &pri); + success = CreateProcess(NULL, (TCHAR*)commandline.c_str(), NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &sinfo, &pri); if (!success) { -- cgit v1.2.3