summaryrefslogtreecommitdiff
path: root/gpg_wrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gpg_wrapper.cpp')
-rw-r--r--gpg_wrapper.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/gpg_wrapper.cpp b/gpg_wrapper.cpp
index db7d134..1907ed1 100644
--- a/gpg_wrapper.cpp
+++ b/gpg_wrapper.cpp
@@ -18,9 +18,12 @@
//thx gpg module from Harald Treder, Zakhar V. Bardymov
+HANDLE gpg_mutex = NULL;
+
pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode, pxResult *result)
{
+ WaitForSingleObject(gpg_mutex, INFINITE);
extern logtofile debuglog;
BOOL success;
STARTUPINFO sinfo = {0};
@@ -89,6 +92,7 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD
debuglog<<"in: "<<commandline<<"\n";
+ gpg_mutex = CreateMutex(NULL, FALSE, NULL);
setlocale( LC_ALL, "C" );
success = CreateProcess(NULL, (TCHAR*)commandline.c_str(), NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &sinfo, &pri);
@@ -119,6 +123,7 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD
inputpos+=transfered;
Sleep(200);
}
+ CloseHandle(gpg_mutex);
storeOutput(readstdout,aoutput);