ReactOS 0.4.15-dev-7958-gcd0bb1a
PackStrings.c File Reference
#include <apitest.h>
#include <windef.h>
#include <winbase.h>
#include <spoolss.h>
Include dependency graph for PackStrings.c:

Go to the source code of this file.

Classes

struct  _EXAMPLE_STRUCT
 

Macros

#define WIN32_NO_STATUS
 

Typedefs

typedef struct _EXAMPLE_STRUCT EXAMPLE_STRUCT
 
typedef struct _EXAMPLE_STRUCTPEXAMPLE_STRUCT
 

Functions

 START_TEST (PackStrings)
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 10 of file PackStrings.c.

Typedef Documentation

◆ EXAMPLE_STRUCT

◆ PEXAMPLE_STRUCT

Function Documentation

◆ START_TEST()

START_TEST ( PackStrings  )

Definition at line 22 of file PackStrings.c.

23{
24 PCWSTR Source1[] = { L"Test", L"String" };
25 PCWSTR Source2[] = { L"Test", NULL };
26
27 BYTE Buffer[50];
28 PBYTE pEnd;
30 DWORD Offsets[] = {
34 };
35
36 // Try a usual case with two strings. Verify that they are copied in reverse order.
37 pEnd = PackStrings(Source1, Buffer, Offsets, &Buffer[sizeof(Buffer)]);
38 ok(wcscmp(pStruct->String1, Source1[0]) == 0, "String1 and Source1[0] don't match!\n");
39 ok(wcscmp(pStruct->String2, Source1[1]) == 0, "String2 and Source1[1] don't match!\n");
40 ok(wcscmp((PWSTR)pEnd, Source1[1]) == 0, "pEnd and Source1[1] don't match!\n");
41
42 // Now verify that the corresponding pointer is set to NULL if a string is NULL.
43 pEnd = PackStrings(Source2, Buffer, Offsets, &Buffer[sizeof(Buffer)]);
44 ok(wcscmp(pStruct->String1, Source2[0]) == 0, "String1 and Source2[0] don't match!\n");
45 ok(!pStruct->String2, "String2 is %p!\n", pStruct->String2);
46 ok(wcscmp((PWSTR)pEnd, Source2[0]) == 0, "pEnd and Source2[0] don't match!\n");
47}
struct _EXAMPLE_STRUCT * PEXAMPLE_STRUCT
#define ok(value,...)
Definition: atltest.h:57
PBYTE WINAPI PackStrings(PCWSTR *pSource, PBYTE pDest, const DWORD *DestOffsets, PBYTE pEnd)
Definition: tools.c:39
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ const STRING * String2
Definition: rtlfuncs.h:2357
#define MAXDWORD
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char BYTE
Definition: xxhash.c:193