[misc] fix XP breakage

* Can't wait until XP support is dropped from Rufus altogether...
This commit is contained in:
Pete Batard 2015-09-28 02:32:11 +01:00
parent 9411716074
commit 5025e27228
2 changed files with 37 additions and 5 deletions

View file

@ -768,6 +768,37 @@ static __inline int _chdirU(const char *dirname)
return ret;
}
#if defined(_WIN32_WINNT) && (_WIN32_WINNT <= 0x501)
static __inline FILE* fopenU(const char* filename, const char* mode)
{
FILE* ret = NULL;
wconvert(filename);
wconvert(mode);
ret = _wfopen(wfilename, wmode);
wfree(filename);
wfree(mode);
return ret;
}
static __inline int _openU(const char *filename, int oflag, int pmode)
{
int ret = -1;
wconvert(filename);
ret = _wopen(wfilename, oflag, pmode);
wfree(filename);
return ret;
}
// returned UTF-8 string must be freed
static __inline char* getenvU(const char* varname)
{
wconvert(varname);
char* ret;
ret = wchar_to_utf8(_wgetenv(wvarname));
wfree(varname);
return ret;
}
#else
static __inline FILE* fopenU(const char* filename, const char* mode)
{
FILE* ret = NULL;
@ -807,6 +838,7 @@ static __inline char* getenvU(const char* varname)
wfree(varname);
return ret;
}
#endif
static __inline int _mkdirU(const char* dirname)
{