summaryrefslogtreecommitdiff
path: root/gpg_wrapper.cpp
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-08-11 02:52:42 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-08-11 02:52:42 +0300
commitff34af8edad99fae99b59def8a3d5cce92085a9c (patch)
tree083fede580c7df94a0a588f5b325bf693bc427a6 /gpg_wrapper.cpp
parent1de40ac790d3218cc10d37f95f9f1a8c573dbe77 (diff)
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
Diffstat (limited to 'gpg_wrapper.cpp')
-rw-r--r--gpg_wrapper.cpp27
1 files changed, 26 insertions, 1 deletions
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)
{