summaryrefslogtreecommitdiff
path: root/gpg_wrapper.cpp
diff options
context:
space:
mode:
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)
{