[misc] add _mkdirExU and _rmdirU to msapi_utf8.h

This commit is contained in:
Pete Batard 2020-05-17 22:53:48 +01:00
parent 4bf69215bf
commit b3d35b27df
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
2 changed files with 43 additions and 5 deletions

View File

@ -29,6 +29,7 @@
#include <setupapi.h>
#include <direct.h>
#include <share.h>
#include <errno.h>
#include <fcntl.h>
#include <io.h>
#include <sys/types.h>
@ -1072,6 +1073,43 @@ static __inline int _mkdirU(const char* dirname)
return ret;
}
// This version of _mkdirU creates all needed directories along the way
static __inline int _mkdirExU(const char* dirname)
{
int ret = -1, trailing_slash = -1;
size_t i, len;
wconvert(dirname);
len = wcslen(wdirname);
while (trailing_slash && (len > 0)) {
if ((wdirname[len - 1] == '\\') || (wdirname[len - 1] == '/'))
wdirname[--len] = 0;
else
trailing_slash = 0;
}
for (i = 0; i < len; i++)
if ((wdirname[i] == '\\') || (wdirname[i] == '/'))
wdirname[i] = 0;
for (i = 0; i < len; ) {
if ((_wmkdir(wdirname) < 0) && (errno != EEXIST) && (errno != EACCES))
goto out;
i = wcslen(wdirname);
wdirname[i] = '\\';
}
ret = 0;
out:
wfree(dirname);
return ret;
}
static __inline int _rmdirU(const char* dirname)
{
wconvert(dirname);
int ret;
ret = _wrmdir(wdirname);
wfree(dirname);
return ret;
}
// The following expects PropertyBuffer to contain a single Unicode string
static __inline BOOL SetupDiGetDeviceRegistryPropertyU(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData,
DWORD Property, PDWORD PropertyRegDataType, PBYTE PropertyBuffer, DWORD PropertyBufferSize, PDWORD RequiredSize)

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.10.1654"
CAPTION "Rufus 3.10.1655"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,10,1654,0
PRODUCTVERSION 3,10,1654,0
FILEVERSION 3,10,1655,0
PRODUCTVERSION 3,10,1655,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.10.1654"
VALUE "FileVersion", "3.10.1655"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.10.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.10.1654"
VALUE "ProductVersion", "3.10.1655"
END
END
BLOCK "VarFileInfo"