ReactOS 0.4.15-dev-8236-g99f0937
AddFontResourceEx.c File Reference
#include "precomp.h"
#include <pseh/pseh2.h>
Include dependency graph for AddFontResourceEx.c:

Go to the source code of this file.

Functions

void Test_AddFontResourceExW ()
 
 START_TEST (AddFontResourceEx)
 

Function Documentation

◆ START_TEST()

START_TEST ( AddFontResourceEx  )

Definition at line 61 of file AddFontResourceEx.c.

62{
64}
void Test_AddFontResourceExW()

◆ Test_AddFontResourceExW()

void Test_AddFontResourceExW ( )

Definition at line 12 of file AddFontResourceEx.c.

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}
#define ok(value,...)
Definition: atltest.h:57
#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:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
_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

Referenced by START_TEST().