Browse Source

Fix compilation on VS2015.

Paul Baxter and Mathias Breiner independently reported fixes to get the
project to compile on Visual Studio 2015.
Iain Patterson 6 years ago
parent
commit
3b12cdde22
4 changed files with 5 additions and 4 deletions
  1. 1 0
      README.txt
  2. 1 1
      gui.cpp
  3. 1 1
      service.cpp
  4. 2 2
      settings.cpp

+ 1 - 0
README.txt

@@ -880,6 +880,7 @@ Thanks to Gerald Haider for noticing that installing a service with NSSM in a
 path containing spaces was technically a security vulnerability.
 Thanks to Scott Ware for reporting a crash saving the environment on XP 32-bit.
 Thanks to Stefan and Michael Scherer for reporting a bug writing the event messages source.
+Thanks to Paul Baxter and Mathias Breiner for help with Visual Studio 2015.
 
 Licence
 -------

+ 1 - 1
gui.cpp

@@ -1,6 +1,6 @@
 #include "nssm.h"
 
-static enum { NSSM_TAB_APPLICATION, NSSM_TAB_DETAILS, NSSM_TAB_LOGON, NSSM_TAB_DEPENDENCIES, NSSM_TAB_PROCESS, NSSM_TAB_SHUTDOWN, NSSM_TAB_EXIT, NSSM_TAB_IO, NSSM_TAB_ROTATION, NSSM_TAB_ENVIRONMENT, NSSM_TAB_HOOKS, NSSM_NUM_TABS };
+static enum { NSSM_TAB_APPLICATION, NSSM_TAB_DETAILS, NSSM_TAB_LOGON, NSSM_TAB_DEPENDENCIES, NSSM_TAB_PROCESS, NSSM_TAB_SHUTDOWN, NSSM_TAB_EXIT, NSSM_TAB_IO, NSSM_TAB_ROTATION, NSSM_TAB_ENVIRONMENT, NSSM_TAB_HOOKS, NSSM_NUM_TABS } nssm_tabs;
 static HWND tablist[NSSM_NUM_TABS];
 static const TCHAR *hook_event_strings[] = { NSSM_HOOK_EVENT_START, NSSM_HOOK_EVENT_STOP, NSSM_HOOK_EVENT_EXIT, NSSM_HOOK_EVENT_POWER, NSSM_HOOK_EVENT_ROTATE, NULL };
 static const TCHAR *hook_action_strings[] = { NSSM_HOOK_ACTION_PRE, NSSM_HOOK_ACTION_POST, NSSM_HOOK_ACTION_CHANGE, NSSM_HOOK_ACTION_RESUME, NULL };

+ 1 - 1
service.cpp

@@ -240,7 +240,7 @@ int affinity_string_to_mask(TCHAR *string, __int64 *mask) {
   return 0;
 }
 
-inline unsigned long priority_mask() {
+unsigned long priority_mask() {
  return REALTIME_PRIORITY_CLASS | HIGH_PRIORITY_CLASS | ABOVE_NORMAL_PRIORITY_CLASS | NORMAL_PRIORITY_CLASS | BELOW_NORMAL_PRIORITY_CLASS | IDLE_PRIORITY_CLASS;
 }
 

+ 2 - 2
settings.cpp

@@ -52,7 +52,7 @@ static int setting_set_number(const TCHAR *service_name, void *param, const TCHA
   }
   if (str_number(value->string, &number)) return -1;
 
-  if (default_value && number == (unsigned long) default_value) {
+  if (default_value && number == PtrToUlong(default_value)) {
     error = RegDeleteValue(key, name);
     if (error == ERROR_SUCCESS || error == ERROR_FILE_NOT_FOUND) return 0;
     print_message(stderr, NSSM_MESSAGE_REGDELETEVALUE_FAILED, name, service_name, error_string(error));
@@ -1058,7 +1058,7 @@ int get_setting(const TCHAR *service_name, HKEY key, settings_t *setting, value_
       break;
 
     case REG_DWORD:
-      value->numeric = (unsigned long) setting->default_value;
+      value->numeric = PtrToUlong(setting->default_value);
       if (setting->get) ret = setting->get(service_name, (void *) key, setting->name, setting->default_value, value, additional);
       else ret = -1;
       break;