ReactOS  0.4.14-dev-606-g14ebc0b
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 {
16  PWSTR Buffer;
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 }
uint16_t * PWSTR
Definition: typedefs.h:54
WCHAR Second[]
Definition: FormatMessage.c:12
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
WCHAR First[]
Definition: FormatMessage.c:11
#define UNICODE_NULL
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define ok(value,...)
Definition: atltest.h:57
WCHAR * LPWSTR
Definition: xmlstorage.h:184
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

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 AppendUnicodeString(), DuplicatesTest(), get_fattime(), and START_TEST().