Pageant now detects if it is already running and refuses to start if so
[u/mdw/putty] / pageant.c
index 1619749..f8d7ad2 100644 (file)
--- a/pageant.c
+++ b/pageant.c
@@ -545,6 +545,15 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
     WNDCLASS wndclass;
     MSG msg;
 
+    /*
+     * First bomb out totally if we are already running.
+     */
+    if (FindWindow("Pageant", "Pageant")) {
+        MessageBox(NULL, "Pageant is already running", "Pageant Error",
+                   MB_ICONERROR | MB_OK);
+        return 0;
+    }
+
     instance = inst;
 
     if (!prev) {