ReactOS 0.4.15-dev-8021-g7ce96fd
AddFontResourceEx.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for AddFontResourceEx
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8#include "precomp.h"
9
10#include <pseh/pseh2.h>
11
13{
14 WCHAR szFileName[MAX_PATH];
15 int result;
16
17 /* Test NULL filename */
19
20 /* Windows crashes, need SEH here */
22 {
24 }
26 {
27 result = -1;
29 }
31 ok(result == -1, "AddFontResourceExW should throw an exception!, result == %d\n", result);
32 ok(GetLastError() == 0xc0000005, "GetLastError()==%lx\n", GetLastError());
33
34 /* Test "" filename */
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());
39
40 GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
41 wcscat(szFileName, L"\\Fonts\\cour.ttf");
42
43 /* Test flags = 0 */
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());
48
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());
53
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());
58
59}
60
61START_TEST(AddFontResourceEx)
62{
64}
65
void Test_AddFontResourceExW()
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
GLuint64EXT * result
Definition: glext.h:11304
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define L(x)
Definition: ntvdm.h:50
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
INT WINAPI AddFontResourceExW(_In_ LPCWSTR pszFilename, _In_ DWORD fl, _Reserved_ PVOID pvReserved)
__wchar_t WCHAR
Definition: xmlstorage.h:180