From ff34af8edad99fae99b59def8a3d5cce92085a9c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 11 Aug 2010 02:52:42 +0300 Subject: modified: commonheaders.h modified: gpg_wrapper.cpp modified: gpg_wrapper.h modified: init.cpp modified: main.cpp modified: messages.cpp modified: options.cpp modified: utilities.cpp modified: utilities.h --- gpg_wrapper.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'gpg_wrapper.cpp') diff --git a/gpg_wrapper.cpp b/gpg_wrapper.cpp index e2cfad6..b9e9029 100644 --- a/gpg_wrapper.cpp +++ b/gpg_wrapper.cpp @@ -29,6 +29,18 @@ pxResult pxExecute(TCHAR *acommandline, char *ainput, string *aoutput, LPDWORD a char *inputpos; unsigned long transfered; int size; + + TCHAR *bin_path = UniGetContactSettingUtf(NULL, szModuleName, "szGpgBinPath", _T("")); + { + if(_waccess(bin_path, 0) == -1) + if(errno == ENOENT) + { + mir_free(bin_path); + return pxNotFound; + } + } + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T("")); + TCHAR commandline[4096] = {0}; sattrs.nLength=sizeof(SECURITY_ATTRIBUTES); sattrs.bInheritHandle=TRUE; @@ -56,8 +68,21 @@ pxResult pxExecute(TCHAR *acommandline, char *ainput, string *aoutput, LPDWORD a sinfo.hStdOutput=newstdout; sinfo.hStdError=newstdout; 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); + mir_free(bin_path); + mir_free(home_dir); + } - success = CreateProcess(NULL, acommandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &sinfo, &pri); + success = CreateProcess(NULL, commandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &sinfo, &pri); if (!success) { -- cgit v1.2.3