diff options
Diffstat (limited to 'gpg_wrapper.cpp')
-rw-r--r-- | gpg_wrapper.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gpg_wrapper.cpp b/gpg_wrapper.cpp index 3091566..3ed7f4a 100644 --- a/gpg_wrapper.cpp +++ b/gpg_wrapper.cpp @@ -18,12 +18,12 @@ //thx gpg module from Harald Treder, Zakhar V. Bardymov -boost::mutex gpg_mutex; +//boost::mutex gpg_mutex; -pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode, pxResult *result) +pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode, pxResult *result, HANDLE hProcess) { - gpg_mutex.lock(); +// gpg_mutex.lock(); if(!gpg_configured) return pxNotConfigured; extern logtofile debuglog; @@ -80,6 +80,7 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD if(errno == ENOENT) { mir_free(bin_path); + debuglog<<time_str()<<": GPG executable not found\n"; *result = pxNotFound; return pxNotFound; } @@ -99,8 +100,7 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD delete [] home_dir; } - debuglog<<time_str()<<": gpg in: "<<commandline; - + debuglog<<time_str()<<": gpg in: "<<commandline<<"\n"; success = CreateProcess(NULL, (TCHAR*)commandline.c_str(), NULL, NULL, TRUE, CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT, (void*)_T("LANGUAGE=en@quot\0LC_ALL=English\0"), NULL, &sinfo, &pri); @@ -110,11 +110,14 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD CloseHandle(writestdin); CloseHandle(newstdout); CloseHandle(readstdout); - gpg_mutex.unlock(); + debuglog<<time_str()<<": Failed to create process\n"; +// gpg_mutex.unlock(); *result = pxCreateProcessFailed; return pxCreateProcessFailed; } + hProcess = pri.hProcess; + inputpos=ainput; while (TRUE) @@ -147,16 +150,12 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD CloseHandle(writestdin); *result = pxSuccess; - gpg_mutex.unlock(); +// gpg_mutex.unlock(); return pxSuccess; } void pxEexcute_thread(void *param) { gpg_execution_params *params = (gpg_execution_params*)param; - pxResult result = pxExecute(params->cmd, params->useless, params->out, params->code, params->result); - if(result == pxNotFound) - { - debuglog<<time_str()<<": Gpg binary not found"; - } + pxResult result = pxExecute(params->cmd, params->useless, params->out, params->code, params->result, params->hProcess); } |