2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for AddFontResourceEx
5 * PROGRAMMERS: Timo Kreuzer
11 #include <libs/pseh/pseh2.h>
13 void Test_AddFontResourceExW()
15 WCHAR szFileName
[MAX_PATH
];
18 /* Test NULL filename */
19 SetLastError(ERROR_SUCCESS
);
21 /* Windows crashes, need SEH here */
24 result
= AddFontResourceExW(NULL
, 0, 0);
26 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
29 SetLastError(_SEH2_GetExceptionCode());
32 ok(result
== -1, "AddFontResourceExW should throw an exception!, result == %d\n", result
);
33 ok(GetLastError() == 0xc0000005, "GetLastError()==%lx\n", GetLastError());
35 /* Test "" filename */
36 SetLastError(ERROR_SUCCESS
);
37 result
= AddFontResourceExW(L
"", 0, 0);
38 ok(result
== 0, "AddFontResourceExW(L"", 0, 0) succeeded, result==%d\n", result
);
39 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
41 GetEnvironmentVariableW(L
"systemroot", szFileName
, MAX_PATH
);
42 wcscat(szFileName
, L
"\\Fonts\\cour.ttf");
45 SetLastError(ERROR_SUCCESS
);
46 result
= AddFontResourceExW(szFileName
, 0, 0);
47 ok(result
== 1, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
48 ok(GetLastError() == ERROR_SUCCESS
, "GetLastError()==%ld\n", GetLastError());
50 SetLastError(ERROR_SUCCESS
);
51 result
= AddFontResourceExW(szFileName
, 256, 0);
52 ok(result
== 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
53 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
55 /* Test invalid pointer as last parameter */
56 result
= AddFontResourceExW(szFileName
, 0, (void*)-1);
57 ok(result
!= 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
58 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
62 START_TEST(AddFontResourceEx
)
64 Test_AddFontResourceExW();