[PATCH] msvcrt:msvcrt_get_flags: Fix bug 51846 - fopen(..., "wx")
Ted Lyngmo
ted at lyncon.se
Thu Oct 7 14:21:33 CDT 2021
2021-10-07 kl. 20:49, Piotr Caban wrote:
>
> The msvcrt and ucrtbase dlls are sharing source. You can introduce
> version specific behavior by guarding the code in dlls/msvcrt with
> #if _MSVCR_VER>=140.
Oh, ok, so something like this would make it available for the correct
Windows version?
case 't':
*open_flags |= _O_TEXT;
*open_flags &= ~_O_BINARY;
break;
+ #if _MSVCR_VER>=140
+ case 'x':
+ *open_flags |= _O_EXCL;
+ break;
+ #endif
case 'D':
*open_flags |= _O_TEMPORARY;
break;
> In order to test the changes with ucrtbase.dll the tests needs to
> go into dlls/ucrtbase/tests.
Ok, so should I move or copy this test case into
"dlls/ucrtbase/tests/printf.c" (which is the only test suite using fopen
in ucrtbase)?
static void test_fopen_exclusive( void )
{
static const char * const testfile = "fileexcl.tst";
FILE *fp;
fp = fopen(testfile, "wx");
ok(fp != NULL, "creating file with mode wx failed\n");
if(fp) fclose(fp);
fp = fopen(testfile, "wx");
ok(fp == NULL, "overwrote existing file with mode wx\n");
if(fp) fclose(fp);
unlink(testfile);
fp = fopen(testfile, "w+x");
ok(fp != NULL, "creating file with mode w+x failed\n");
if(fp) fclose(fp);
fp = fopen(testfile, "w+x");
ok(fp == NULL, "overwrote existing file with mode w+x\n");
if(fp) fclose(fp);
unlink(testfile);
}
Should I guard that test case with #if _MSVCR_VER>=140 too?
Br,
Ted
More information about the wine-devel
mailing list