AttachConsole() isn't available in Windows 2000.
[nssm.git] / gui.cpp
diff --git a/gui.cpp b/gui.cpp
index 97c69a8..84fd4c2 100644 (file)
--- a/gui.cpp
+++ b/gui.cpp
@@ -63,9 +63,9 @@ int install(HWND window) {
   if (! window) return 1;\r
 \r
   /* Check parameters in the window */\r
-  char name[STRING_SIZE];\r
+  char name[VALUE_LENGTH];\r
   char exe[EXE_LENGTH];\r
-  char flags[STRING_SIZE];\r
+  char flags[VALUE_LENGTH];\r
 \r
   /* Get service name */\r
   if (! GetDlgItemText(window, IDC_NAME, name, sizeof(name))) {\r
@@ -120,7 +120,7 @@ int remove(HWND window) {
   if (! window) return 1;\r
 \r
   /* Check parameters in the window */\r
-  char name[STRING_SIZE];\r
+  char name[VALUE_LENGTH];\r
 \r
   /* Get service name */\r
   if (! GetDlgItemText(window, IDC_NAME, name, sizeof(name))) {\r
@@ -154,8 +154,8 @@ int remove(HWND window) {
 void browse(HWND window) {\r
   if (! window) return;\r
 \r
-  unsigned long bufsize = 256;\r
-  unsigned long len = bufsize;\r
+  size_t bufsize = 256;\r
+  size_t len = bufsize;\r
   OPENFILENAME ofn;\r
   ZeroMemory(&ofn, sizeof(ofn));\r
   ofn.lStructSize = sizeof(ofn);\r
@@ -164,18 +164,18 @@ void browse(HWND window) {
   if (ofn.lpstrFilter) {\r
     ZeroMemory((void *) ofn.lpstrFilter, bufsize);\r
     char *localised = message_string(NSSM_GUI_BROWSE_FILTER_APPLICATIONS);\r
-    _snprintf((char *) ofn.lpstrFilter, bufsize, localised);\r
+    _snprintf_s((char *) ofn.lpstrFilter, bufsize, _TRUNCATE, localised);\r
     /* "Applications" + NULL + "*.exe" + NULL */\r
     len = strlen(localised) + 1;\r
     LocalFree(localised);\r
-    _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, "*.exe");\r
+    _snprintf_s((char *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, "*.exe");\r
     /* "All files" + NULL + "*.*" + NULL */\r
     len += 6;\r
     localised = message_string(NSSM_GUI_BROWSE_FILTER_ALL_FILES);\r
-    _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, localised);\r
+    _snprintf_s((char *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, localised);\r
     len += strlen(localised) + 1;\r
     LocalFree(localised);\r
-    _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, "*.*");\r
+    _snprintf_s((char *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, "*.*");\r
     /* Remainder of the buffer is already zeroed */\r
   }\r
   ofn.lpstrFile = new char[MAX_PATH];\r