X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinmisc.c;h=f2e4f223595b4b73d642df1648223f282583d85a;hb=af1460d6e5044a3344aaacd15c91cfdcb58578e7;hp=3b57adf8f66ebbfc9c5fe5aa40153a5e3d75b689;hpb=b7a703d38c939202f59682dfa41ed24a16f80da5;p=PuTTY.git diff --git a/windows/winmisc.c b/windows/winmisc.c index 3b57adf8..f2e4f223 100644 --- a/windows/winmisc.c +++ b/windows/winmisc.c @@ -5,6 +5,9 @@ #include #include #include "putty.h" +#ifndef SECURITY_WIN32 +#define SECURITY_WIN32 +#endif #include OSVERSIONINFO osVersion; @@ -68,6 +71,13 @@ Filename *filename_deserialise(void *vdata, int maxsize, int *used) return filename_from_str(data); } +char filename_char_sanitise(char c) +{ + if (strchr("<>:\"/\\|?*", c)) + return '.'; + return c; +} + #ifndef NO_SECUREZEROMEMORY /* * Windows implementation of smemclr (see misc.c) using SecureZeroMemory. @@ -219,8 +229,8 @@ const char *win_strerror(int error) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), msgtext, lenof(msgtext)-1, NULL)) { sprintf(msgtext, - "(unable to format: FormatMessage returned %d)", - error, GetLastError()); + "(unable to format: FormatMessage returned %u)", + (unsigned int)GetLastError()); } else { int len = strlen(msgtext); if (len > 0 && msgtext[len-1] == '\n') @@ -238,7 +248,7 @@ static FILE *debug_fp = NULL; static HANDLE debug_hdl = INVALID_HANDLE_VALUE; static int debug_got_console = 0; -void dputs(char *buf) +void dputs(const char *buf) { DWORD dw;