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
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