Module: wine Branch: master Commit: 5021e91940fe01a54e6ee91f9d9f246ce8f6dd84 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5021e91940fe01a54e6ee91f9d...
Author: Huw Davies huw@codeweavers.com Date: Thu Aug 20 10:50:24 2015 +0100
gdi32/tests: 64-bit GetFontFileInfo may fail with error ERROR_NOACCESS.
---
dlls/gdi32/tests/font.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index 68ade9a..65685ac 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -4116,7 +4116,7 @@ static void test_RealizationInfo(void) { HDC hdc; DWORD info[4], info2[10]; - BOOL r; + BOOL r, have_file = FALSE; HFONT hfont, hfont_old; LOGFONTA lf; DWORD needed, read; @@ -4199,25 +4199,30 @@ static void test_RealizationInfo(void)
/* Test GetFontFileInfo() */ r = pGetFontFileInfo(info2[3], 0, &file_info, sizeof(file_info), &needed); - ok(r != 0, "ret 0 gle %d\n", GetLastError()); - - h = CreateFileW(file_info.path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - ok(h != INVALID_HANDLE_VALUE, "Unable to open file %d\n", GetLastError()); + ok(r != 0 || GetLastError() == ERROR_NOACCESS, "ret %d gle %d\n", r, GetLastError());
- GetFileTime(h, NULL, NULL, &time); - ok(!CompareFileTime(&file_info.time, &time), "time mismatch\n"); - GetFileSizeEx(h, &size); - ok(file_info.size.QuadPart == size.QuadPart, "size mismatch\n"); - - /* Read first 16 bytes from the file */ - ReadFile(h, file, sizeof(file), &read, NULL); - CloseHandle(h); + if (r) + { + h = CreateFileW(file_info.path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + ok(h != INVALID_HANDLE_VALUE, "Unable to open file %d\n", GetLastError()); + + GetFileTime(h, NULL, NULL, &time); + ok(!CompareFileTime(&file_info.time, &time), "time mismatch\n"); + GetFileSizeEx(h, &size); + ok(file_info.size.QuadPart == size.QuadPart, "size mismatch\n"); + + /* Read first 16 bytes from the file */ + ReadFile(h, file, sizeof(file), &read, NULL); + CloseHandle(h); + have_file = TRUE; + }
/* Get bytes 2 - 16 using GetFontFileData */ r = pGetFontFileData(info2[3], 0, 2, data, sizeof(data)); ok(r != 0, "ret 0 gle %d\n", GetLastError());
- ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n"); + if (have_file) + ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n"); }
DeleteObject(SelectObject(hdc, hfont_old));