ReactOS 0.4.15-dev-8231-g29a56f3
GUIDFromString.cpp File Reference
#include <shelltest.h>
#include <initguid.h>
#include <undocshell.h>
#include <versionhelpers.h>
Include dependency graph for GUIDFromString.cpp:

Go to the source code of this file.

Functions

 DEFINE_GUID (invalid_guid, 0xDEADDEAD, 0xDEAD, 0xDEAD, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED, 0xED)
 
static void TEST_GUIDFromStringA (void)
 
static void TEST_GUIDFromStringW (void)
 
 START_TEST (GUIDFromString)
 

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( invalid_guid  ,
0xDEADDEAD  ,
0xDEAD  ,
0xDEAD  ,
0xED  ,
0xED  ,
0xED  ,
0xED  ,
0xED  ,
0xED  ,
0xED  ,
0xED   
)

◆ START_TEST()

START_TEST ( GUIDFromString  )

Definition at line 115 of file GUIDFromString.cpp.

116{
119}
static void TEST_GUIDFromStringW(void)
static void TEST_GUIDFromStringA(void)

◆ TEST_GUIDFromStringA()

static void TEST_GUIDFromStringA ( void  )
static

Definition at line 21 of file GUIDFromString.cpp.

22{
23 GUID guid;
24 BOOL ret;
25
26 guid = invalid_guid;
28 {
30 }
32 {
33 ret = 0xDEADBEEF;
34 }
36
39 else
40 ok_int(ret, 0xDEADBEEF);
41 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
42
43 guid = invalid_guid;
45 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
46
47 guid = invalid_guid;
49 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
50
51 guid = invalid_guid;
52 ok_int(GUIDFromStringA("{000214F9-0000-0000-C000-000000000046", &guid), FALSE);
53 //ok_int(memcmp(&guid, &IID_IShellLinkW_Invalid, sizeof(guid)) == 0, TRUE); // Ignorable corner case
54
55 guid = invalid_guid;
56 ok_int(GUIDFromStringA("{000214F9-0000-0000-C000-000000000046}", &guid), TRUE);
57 ok_int(memcmp(&guid, &IID_IShellLinkW, sizeof(guid)) == 0, TRUE);
58
59 guid = invalid_guid;
60 ok_int(GUIDFromStringA("{000214F9-0000-0000-C000-000000000046}g", &guid), TRUE);
61 ok_int(memcmp(&guid, &IID_IShellLinkW, sizeof(guid)) == 0, TRUE);
62
63 guid = invalid_guid;
64 ok_int(GUIDFromStringA(" {000214F9-0000-0000-C000-000000000046}", &guid), FALSE);
65 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
66}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
const GUID * guid
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
BOOL WINAPI GUIDFromStringA(LPCSTR str, LPGUID guid)
Definition: shellord.c:1890
VERSIONHELPERAPI IsWindowsVistaOrGreater()
int ret

Referenced by START_TEST().

◆ TEST_GUIDFromStringW()

static void TEST_GUIDFromStringW ( void  )
static

Definition at line 68 of file GUIDFromString.cpp.

69{
70 GUID guid;
71 BOOL ret;
72
73 guid = invalid_guid;
75 {
77 }
79 {
80 ret = 0xDEADBEEF;
81 }
83
85 ok_int(ret, 0xDEADBEEF);
86 else
88 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
89
90 guid = invalid_guid;
92 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
93
94 guid = invalid_guid;
96 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
97
98 guid = invalid_guid;
99 ok_int(GUIDFromStringW(L"{000214F9-0000-0000-C000-000000000046", &guid), FALSE);
100 //ok_int(memcmp(&guid, &IID_IShellLinkW_Invalid, sizeof(guid)) == 0, TRUE); // Ignorable corner case
101
102 guid = invalid_guid;
103 ok_int(GUIDFromStringW(L"{000214F9-0000-0000-C000-000000000046}", &guid), TRUE);
104 ok_int(memcmp(&guid, &IID_IShellLinkW, sizeof(guid)) == 0, TRUE);
105
106 guid = invalid_guid;
107 ok_int(GUIDFromStringW(L"{000214F9-0000-0000-C000-000000000046}g", &guid), TRUE);
108 ok_int(memcmp(&guid, &IID_IShellLinkW, sizeof(guid)) == 0, TRUE);
109
110 guid = invalid_guid;
111 ok_int(GUIDFromStringW(L" {000214F9-0000-0000-C000-000000000046}", &guid), FALSE);
112 ok_int(memcmp(&guid, &invalid_guid, sizeof(guid)) == 0, TRUE);
113}
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI GUIDFromStringW(_In_ PCWSTR psz, _Out_ LPGUID pguid)

Referenced by START_TEST().