2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for AddFontResourceEx
5 * PROGRAMMERS: Timo Kreuzer
12 void Test_AddFontResourceExW()
14 WCHAR szFileName
[MAX_PATH
];
17 /* Test NULL filename */
18 SetLastError(ERROR_SUCCESS
);
20 /* Windows crashes, need SEH here */
23 result
= AddFontResourceExW(NULL
, 0, 0);
25 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
28 SetLastError(_SEH2_GetExceptionCode());
31 ok(result
== -1, "AddFontResourceExW should throw an exception!, result == %d\n", result
);
32 ok(GetLastError() == 0xc0000005, "GetLastError()==%lx\n", GetLastError());
34 /* Test "" filename */
35 SetLastError(ERROR_SUCCESS
);
36 result
= AddFontResourceExW(L
"", 0, 0);
37 ok(result
== 0, "AddFontResourceExW(L"", 0, 0) succeeded, result==%d\n", result
);
38 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
40 GetEnvironmentVariableW(L
"systemroot", szFileName
, MAX_PATH
);
41 wcscat(szFileName
, L
"\\Fonts\\cour.ttf");
44 SetLastError(ERROR_SUCCESS
);
45 result
= AddFontResourceExW(szFileName
, 0, 0);
46 ok(result
== 1, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
47 ok(GetLastError() == ERROR_SUCCESS
, "GetLastError()==%ld\n", GetLastError());
49 SetLastError(ERROR_SUCCESS
);
50 result
= AddFontResourceExW(szFileName
, 256, 0);
51 ok(result
== 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
52 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
54 /* Test invalid pointer as last parameter */
55 result
= AddFontResourceExW(szFileName
, 0, (void*)-1);
56 ok(result
!= 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
57 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
61 START_TEST(AddFontResourceEx
)
63 Test_AddFontResourceExW();