diff --git a/src/.msvc/rufus.vcxproj b/src/.msvc/rufus.vcxproj index 7805730b..3212fddf 100644 --- a/src/.msvc/rufus.vcxproj +++ b/src/.msvc/rufus.vcxproj @@ -81,7 +81,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) @@ -109,7 +109,7 @@ ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ProgramDatabase @@ -133,7 +133,7 @@ - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;%(PreprocessorDefinitions) MultiThreaded Level3 ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) @@ -160,7 +160,7 @@ X64 - _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + _OFF_T_DEFINED;_off_t=__int64;off_t=_off_t;%(PreprocessorDefinitions) MultiThreaded Level3 ..\msvc-missing;..\ms-sys\inc;..\syslinux\libinstaller;..\syslinux\libfat;..\libcdio;..\getopt;%(AdditionalIncludeDirectories) diff --git a/src/getopt/.msvc/getopt.vcxproj b/src/getopt/.msvc/getopt.vcxproj index b87f738d..9c02fc4b 100644 --- a/src/getopt/.msvc/getopt.vcxproj +++ b/src/getopt/.msvc/getopt.vcxproj @@ -74,7 +74,7 @@ - HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + HAVE_STRING_H;%(PreprocessorDefinitions) true MultiThreadedDebug Level3 @@ -90,7 +90,7 @@ X64 - HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + HAVE_STRING_H;%(PreprocessorDefinitions) MultiThreadedDebug Level3 ProgramDatabase @@ -103,7 +103,7 @@ MaxSpeed - HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + HAVE_STRING_H;%(PreprocessorDefinitions) MultiThreaded Level3 28252;28253 @@ -117,7 +117,7 @@ X64 - HAVE_STRING_H;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + HAVE_STRING_H;%(PreprocessorDefinitions) MultiThreaded Level3 28252;28253 diff --git a/src/getopt/getopt.c b/src/getopt/getopt.c index b7f26eb4..64416810 100644 --- a/src/getopt/getopt.c +++ b/src/getopt/getopt.c @@ -391,6 +391,8 @@ _getopt_initialize (argc, argv, optstring) char *const *argv; const char *optstring; { + size_t posixly_correct_size = 0; + char posixly_correct_buffer[16]; /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ @@ -399,7 +401,9 @@ _getopt_initialize (argc, argv, optstring) nextchar = NULL; - posixly_correct = getenv ("POSIXLY_CORRECT"); + if ((getenv_s(&posixly_correct_size, posixly_correct_buffer, sizeof(posixly_correct_buffer), + "POSIXLY_CORRECT") == 0) && (posixly_correct_size != 0)) + posixly_correct = _strdup(posixly_correct_buffer); /* Determine how to handle the ordering of options and nonoptions. */ diff --git a/src/ms-sys/.msvc/ms-sys.vcxproj b/src/ms-sys/.msvc/ms-sys.vcxproj index 83b1b6a7..22e0676f 100644 --- a/src/ms-sys/.msvc/ms-sys.vcxproj +++ b/src/ms-sys/.msvc/ms-sys.vcxproj @@ -140,7 +140,7 @@ Level3 Disabled - _CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) ../inc;%(AdditionalIncludeDirectories) MultiThreadedDebug ProgramDatabase @@ -161,7 +161,7 @@ MaxSpeed true - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + %(PreprocessorDefinitions) ../inc;%(AdditionalIncludeDirectories) MultiThreaded ProgramDatabase @@ -177,7 +177,7 @@ Level3 Disabled - _CRT_SECURE_NO_WARNINGS;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) + _CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions) ../inc;%(AdditionalIncludeDirectories) MultiThreadedDebug ProgramDatabase @@ -198,7 +198,7 @@ MaxSpeed true - _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + %(PreprocessorDefinitions) ../inc;%(AdditionalIncludeDirectories) MultiThreaded ProgramDatabase diff --git a/src/msapi_utf8.h b/src/msapi_utf8.h index 548878f7..7fae6a55 100644 --- a/src/msapi_utf8.h +++ b/src/msapi_utf8.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #pragma once @@ -771,7 +773,7 @@ static __inline FILE* fopenU(const char* filename, const char* mode) FILE* ret = NULL; wconvert(filename); wconvert(mode); - ret = _wfopen(wfilename, wmode); + _wfopen_s(&ret, wfilename, wmode); wfree(filename); wfree(mode); return ret; @@ -780,8 +782,14 @@ static __inline FILE* fopenU(const char* filename, const char* mode) static __inline int _openU(const char *filename, int oflag , int pmode) { int ret = -1; + int shflag = _SH_DENYNO; wconvert(filename); - ret = _wopen(wfilename, oflag, pmode); + // Try to match the share flag to the oflag + if (oflag & _O_RDONLY) + shflag = _SH_DENYWR; + else if (oflag & _O_WRONLY) + shflag = _SH_DENYRD; + _wsopen_s(&ret, wfilename, oflag, shflag, pmode); wfree(filename); return ret; } @@ -790,8 +798,12 @@ static __inline int _openU(const char *filename, int oflag , int pmode) static __inline char* getenvU(const char* varname) { wconvert(varname); - char* ret; - ret = wchar_to_utf8(_wgetenv(wvarname)); + char *ret; + wchar_t value[256]; + size_t value_size; + // MinGW and WDK don't know wdupenv_s, so we use wgetenv_s + _wgetenv_s(&value_size, value, sizeof(value), wvarname); + ret = wchar_to_utf8(value); wfree(varname); return ret; } diff --git a/src/rufus.rc b/src/rufus.rc index fcc94fb5..0dc24b77 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 242, 376 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 2.4.721" +CAPTION "Rufus 2.4.722" FONT 8, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 @@ -317,8 +317,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,4,721,0 - PRODUCTVERSION 2,4,721,0 + FILEVERSION 2,4,722,0 + PRODUCTVERSION 2,4,722,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -335,13 +335,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "2.4.721" + VALUE "FileVersion", "2.4.722" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "2.4.721" + VALUE "ProductVersion", "2.4.722" END END BLOCK "VarFileInfo"