Do not set event if not initialized

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/daemon/branches/1.0.x@1817507 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c
index af151b3..856fc81 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.c
+++ b/src/native/windows/apps/prunsrv/prunsrv.c
@@ -1018,7 +1018,7 @@
         }
         if (!apxProcessSetExecutableW(hWorker, SO_STOPIMAGE)) {
             apxLogWrite(APXLOG_MARK_ERROR "Failed setting process executable %S",
-                        SO_STARTIMAGE);
+                        SO_STOPIMAGE);
             rv = 2;
             goto cleanup;
         }
@@ -1112,7 +1112,9 @@
     }
 
     apxLogWrite(APXLOG_MARK_INFO "Service stop thread completed.");
-    SetEvent(gShutdownEvent);
+    if (gShutdownEvent) {
+        SetEvent(gShutdownEvent);
+    }
     return rv;
 }
 
@@ -1544,6 +1546,7 @@
         WaitForSingleObject(gShutdownEvent, ONE_MINUTE);
         apxLogWrite(APXLOG_MARK_DEBUG "ShutdownEvent signaled");
         CloseHandle(gShutdownEvent);
+        gShutdownEvent = NULL;
 
         /* This will cause to wait for all threads to exit
          */
@@ -1768,6 +1771,10 @@
     _service_mode = FALSE;
     _flushall();
     apxLogClose(NULL);
+#if 0
+    /* Memory will be destoyed uppon exit
+     */
     apxHandleManagerDestroy();
+#endif
     ExitProcess(rv);
 }
diff --git a/src/native/windows/apps/prunsrv/prunsrv.h b/src/native/windows/apps/prunsrv/prunsrv.h
index 5e1ce4c..4ba5f7d 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.h
+++ b/src/native/windows/apps/prunsrv/prunsrv.h
@@ -14,18 +14,11 @@
  * limitations under the License.
  */
 
-/* ====================================================================
- * jar2exe -- convert .jar file to WIN32 executable.
- * Contributed by Mladen Turk <mturk@apache.org>
- * 05 Aug 2003
- * ====================================================================
- */
-
 #ifndef _PRUNSRV_H
 #define _PRUNSRV_H
 
 #undef  PRG_VERSION
-#define PRG_VERSION    "1.0.15.0"
+#define PRG_VERSION    "1.0.16.0"
 #define PRG_REGROOT   L"Apache Software Foundation\\Procrun 2.0"
 
 #endif /* _PRUNSRV_H */
diff --git a/src/native/windows/apps/prunsrv/prunsrv.rc b/src/native/windows/apps/prunsrv/prunsrv.rc
index 6357a68..1336bff 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.rc
+++ b/src/native/windows/apps/prunsrv/prunsrv.rc
@@ -23,8 +23,8 @@
 CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "prunsrv.manifest"
 
 1 VERSIONINFO
- FILEVERSION 1,0,15,0
- PRODUCTVERSION 1,0,15,0
+ FILEVERSION 1,0,16,0
+ PRODUCTVERSION 1,0,16,0
  FILEFLAGSMASK 0x3fL
 #if defined(_DEBUG)
  FILEFLAGS 0x03L
@@ -44,7 +44,7 @@
       VALUE "FileDescription", RSTR_PRUNSRV "\0"
       VALUE "FileVersion", PRG_VERSION
       VALUE "InternalName", RSTR_PRUNSRV "\0"
-      VALUE "LegalCopyright", "Copyright (c) 2000-2013 The Apache Software Foundation.\0"
+      VALUE "LegalCopyright", "Copyright (c) 2000-2017 The Apache Software Foundation.\0"
       VALUE "OriginalFilename", "prunsrv.exe\0"
       VALUE "ProductName", RSTR_PRUNSRV "\0"
       VALUE "ProductVersion", PRG_VERSION
diff --git a/src/native/windows/include/Makefile.inc b/src/native/windows/include/Makefile.inc
index d5a0183..09c3c7b 100644
--- a/src/native/windows/include/Makefile.inc
+++ b/src/native/windows/include/Makefile.inc
@@ -284,7 +284,7 @@
 # Always add debugging to the linker
 OPT_LFLAGS = /INCREMENTAL:NO /DEBUG
 !IF "$(BUILD)" == "RELEASE"
-OPT_LFLAGS = /OPT:REF
+OPT_LFLAGS = $(OPT_LFLAGS) /OPT:REF
 !ENDIF
 
 !IF "$(TARGET)" == "EXE"