Hi Luke, On 8/2/21 5:03 PM, Luke Deller wrote:
+static void test_fopen_hints(void) +{ + char *tempf; + FILE *fp; + HANDLE handle; + FILE_MODE_INFORMATION mode_info; + IO_STATUS_BLOCK io; + NTSTATUS status; + + /* create a test file */ + tempf = _tempnam(".","wne"); + fp = fopen(tempf, "wb"); + ok(fp != NULL, "unable to create test file\n"); + fwrite("abc\n", 1, 4, fp); + fclose(fp); + + /* open test file with sequential access hint */ + fp = fopen(tempf, "rbS"); + ok(fp != NULL, "unable to open test file with sequential access hint\n"); + + /* check that sequential access hint is set on underlying file handle */ + handle = (HANDLE)_get_osfhandle(_fileno(fp)); + status = NtQueryInformationFile(handle, &io, &mode_info, sizeof(mode_info), + FileModeInformation); + ok(!status, "NtQueryInformationFile failed\n"); + ok(mode_info.Mode & FILE_SEQUENTIAL_ONLY, "handle missing hint\n"); + + /* clean up */ + fclose(fp); + unlink(tempf); + free(tempf); +} It would be nice to also test fp = fopen(tempf, "rbRS"); and fp = fopen(tempf, "rbSR"); case.
The same applies to second patch, what happens if _O_RANDOM and _O_SEQUENTIAL is passed? You will also need to mark the tests failing in wine with todo_wine or reorder the patches. Thanks, Piotr