mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
kernel32: CreateFile uses an nonalertable io mode.
This commit is contained in:
parent
69afb0985d
commit
c19d166529
2 changed files with 19 additions and 1 deletions
|
@ -1361,7 +1361,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
|
|||
if (attributes & FILE_FLAG_NO_BUFFERING)
|
||||
options |= FILE_NO_INTERMEDIATE_BUFFERING;
|
||||
if (!(attributes & FILE_FLAG_OVERLAPPED))
|
||||
options |= FILE_SYNCHRONOUS_IO_ALERT;
|
||||
options |= FILE_SYNCHRONOUS_IO_NONALERT;
|
||||
if (attributes & FILE_FLAG_RANDOM_ACCESS)
|
||||
options |= FILE_RANDOM_ACCESS;
|
||||
attributes &= FILE_ATTRIBUTE_VALID_FLAGS;
|
||||
|
|
|
@ -38,6 +38,7 @@ static BOOL (WINAPI *pReplaceFileA)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOI
|
|||
static BOOL (WINAPI *pReplaceFileW)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPVOID, LPVOID);
|
||||
static UINT (WINAPI *pGetSystemWindowsDirectoryA)(LPSTR, UINT);
|
||||
static BOOL (WINAPI *pGetVolumeNameForVolumeMountPointA)(LPCSTR, LPSTR, DWORD);
|
||||
static DWORD WINAPI (*pQueueUserAPC)(PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData);
|
||||
|
||||
/* keep filename and filenameW the same */
|
||||
static const char filename[] = "testfile.xxx";
|
||||
|
@ -71,6 +72,7 @@ static void InitFunctionPointers(void)
|
|||
pReplaceFileW=(void*)GetProcAddress(hkernel32, "ReplaceFileW");
|
||||
pGetSystemWindowsDirectoryA=(void*)GetProcAddress(hkernel32, "GetSystemWindowsDirectoryA");
|
||||
pGetVolumeNameForVolumeMountPointA = (void *) GetProcAddress(hkernel32, "GetVolumeNameForVolumeMountPointA");
|
||||
pQueueUserAPC = (void *) GetProcAddress(hkernel32, "QueueUserAPC");
|
||||
}
|
||||
|
||||
static void test__hread( void )
|
||||
|
@ -2362,6 +2364,12 @@ static void test_async_file_errors(void)
|
|||
HeapFree(GetProcessHeap(), 0, lpBuffer);
|
||||
}
|
||||
|
||||
static BOOL user_apc_ran;
|
||||
static void CALLBACK user_apc(ULONG_PTR param)
|
||||
{
|
||||
user_apc_ran = TRUE;
|
||||
}
|
||||
|
||||
static void test_read_write(void)
|
||||
{
|
||||
DWORD bytes, ret, old_prot;
|
||||
|
@ -2382,6 +2390,12 @@ static void test_read_write(void)
|
|||
CREATE_ALWAYS, FILE_FLAG_RANDOM_ACCESS, 0);
|
||||
ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA: error %d\n", GetLastError());
|
||||
|
||||
user_apc_ran = FALSE;
|
||||
if (pQueueUserAPC) {
|
||||
trace("Queueing an user APC\n"); /* verify the file is non alerable */
|
||||
ok(pQueueUserAPC(&user_apc, GetCurrentThread(), 0), "QueueUserAPC failed: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
SetLastError(12345678);
|
||||
bytes = 12345678;
|
||||
ret = WriteFile(hFile, NULL, 0, &bytes, NULL);
|
||||
|
@ -2418,6 +2432,10 @@ static void test_read_write(void)
|
|||
"ret = %d, error %d\n", ret, GetLastError());
|
||||
ok(!bytes, "bytes = %d\n", bytes);
|
||||
|
||||
ok(user_apc_ran == FALSE, "UserAPC ran, file using alertable io mode\n");
|
||||
if (pQueueUserAPC)
|
||||
SleepEx(0, TRUE); /* get rid of apc */
|
||||
|
||||
/* test passing protected memory as buffer */
|
||||
|
||||
mem = VirtualAlloc( NULL, 0x4000, MEM_COMMIT, PAGE_READWRITE );
|
||||
|
|
Loading…
Reference in a new issue