ReactOS 0.4.16-dev-292-gbbdcc14
FormatMessage.c File Reference
#include <apitest.h>
#include <FormatMessage.h>
Include dependency graph for FormatMessage.c:

Go to the source code of this file.

Functions

 START_TEST (FormatMessage)
 

Variables

WCHAR First [] = L"This is a test message.\r\n"
 
WCHAR Second [] = L"This is a second test message.\r\n"
 

Function Documentation

◆ START_TEST()

START_TEST ( FormatMessage  )

Definition at line 14 of file FormatMessage.c.

15{
17 DWORD Written;
18
19 Buffer = NULL;
21 NULL, MSG_FIRST_MESSAGE, 0, (LPWSTR)&Buffer, 0, NULL);
22 ok(Written != 0, "Unexpected error: %lx\n", GetLastError());
23 ok(Buffer != NULL, "No buffer allocated\n");
24 ok(Written == (sizeof(First) - sizeof(UNICODE_NULL)) / sizeof(WCHAR),
25 "Invalid size: %ld (expected: %d)\n",
26 Written, (sizeof(First) - sizeof(UNICODE_NULL)) / sizeof(WCHAR));
27 ok(RtlCompareMemory(Buffer, First, sizeof(First) - sizeof(UNICODE_NULL)) ==
28 sizeof(First) - sizeof(UNICODE_NULL),
29 "Mismatching string: %S (expected : %S)\n", Buffer, First);
31
32 Buffer = NULL;
34 NULL, MSG_SECOND_MESSAGE, 0, (LPWSTR)&Buffer, 0, NULL);
35 ok(Written != 0, "Unexpected error: %lx\n", GetLastError());
36 ok(Buffer != NULL, "No buffer allocated\n");
37 ok(Written == (sizeof(Second) - sizeof(UNICODE_NULL)) / sizeof(WCHAR),
38 "Invalid size: %ld (expected: %d)\n",
39 Written, (sizeof(Second) - sizeof(UNICODE_NULL)) / sizeof(WCHAR));
40 ok(RtlCompareMemory(Buffer, Second, sizeof(Second) - sizeof(UNICODE_NULL)) ==
41 sizeof(Second) - sizeof(UNICODE_NULL),
42 "Mismatching string: %S (expected: %S)\n", Buffer, Second);
44
45 Buffer = NULL;
47 NULL, MSG_SECOND_MESSAGE + 1, 0, (LPWSTR)&Buffer, 0, NULL);
48 ok(Written == 0, "Unexpected success: %ld\n", Written);
49 ok(Buffer == NULL, "Unexpected success: %p\n", Buffer);
50 ok(GetLastError() == 0x13d, "Unexpected error: %lx\n", GetLastError());
51}
WCHAR Second[]
Definition: FormatMessage.c:12
WCHAR First[]
Definition: FormatMessage.c:11
#define ok(value,...)
Definition: atltest.h:57
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define UNICODE_NULL
uint16_t * PWSTR
Definition: typedefs.h:56
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:445
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:448
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Variable Documentation

◆ First

◆ Second

WCHAR Second[] = L"This is a second test message.\r\n"

Definition at line 12 of file FormatMessage.c.

Referenced by addtwo(), AppendUnicodeString(), DuplicatesTest(), get_fattime(), and START_TEST().