diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2011-04-01 02:24:07 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2011-04-01 02:24:07 +0300 |
commit | a7823b56a5b08f81248e83804349bc8e9fc61206 (patch) | |
tree | 9d2e3a7a558498be03513c96c35796b948418115 /gpg_wrapper.cpp | |
parent | b0e1bb306eec7f2d13ff385d4c1191646cc3e7f9 (diff) | |
parent | 8cdda41b119526a2741938d57b7e066e1697315b (diff) |
Merge branch 'new_gpg' into new_gpg_autoexchange
Conflicts:
messages.cpp
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); } |