+ ofn.lpstrFilter = (char *) HeapAlloc(GetProcessHeap(), 0, bufsize);\r
+ /* XXX: Escaping nulls with FormatMessage is tricky */\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
+ /* "Applications" + NULL + "*.exe" + NULL */\r
+ len = strlen(localised) + 1;\r
+ LocalFree(localised);\r
+ _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, "*.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
+ len += strlen(localised) + 1;\r
+ LocalFree(localised);\r
+ _snprintf((char *) ofn.lpstrFilter + len, bufsize - len, "*.*");\r
+ /* Remainder of the buffer is already zeroed */\r
+ }\r