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

Go to the source code of this file.

Macros

#define CALL_NC(exp, str)
 

Functions

static BOOL (WINAPI *pNcIsValidConnectionName)(PCWSTR)
 
static void test_BadLetters (void)
 
 START_TEST (isvalidname)
 

Macro Definition Documentation

◆ CALL_NC

#define CALL_NC (   exp,
  str 
)
Value:
do { \
BOOL ret = pNcIsValidConnectionName((str)); \
ok(ret == (exp), "Expected %s to be %d, was %d\n", wine_dbgstr_w((str)), (exp), ret); \
} while (0)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define wine_dbgstr_w
Definition: kernel32.h:34
DWORD exp
Definition: msg.c:16058
const WCHAR * str
int ret

Definition at line 25 of file NcIsValidConnectionName.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pNcIsValidConnectionName)
static

◆ START_TEST()

START_TEST ( isvalidname  )

Definition at line 89 of file NcIsValidConnectionName.c.

90{
91 HMODULE hDll = LoadLibraryA("netshell.dll");
92
93 pNcIsValidConnectionName = (void*)GetProcAddress(hDll, "NcIsValidConnectionName");
94 if (!hDll || !pNcIsValidConnectionName)
95 {
96 skip("netshell.dll or export NcIsValidConnectionName not found! Tests will be skipped\n");
97 return;
98 }
99
100 CALL_NC(TRUE, L"Network");
101 CALL_NC(FALSE, L"Network?");
102
103 CALL_NC(FALSE, L"\\");
104 CALL_NC(FALSE, L"/");
105 CALL_NC(FALSE, L":");
106 CALL_NC(FALSE, L"*");
107 CALL_NC(FALSE, L"?");
108 CALL_NC(FALSE, L"<");
109 CALL_NC(FALSE, L">");
110 CALL_NC(FALSE, L"|");
111
113
114 CALL_NC(TRUE, L"Wireless");
115 CALL_NC(FALSE, L"Wireless:1");
116 CALL_NC(TRUE, L"Intranet");
117 CALL_NC(FALSE, L"Intranet<");
118 CALL_NC(TRUE, L"Network Connection");
119
121}
static void test_BadLetters(void)
#define CALL_NC(exp, str)
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define L(x)
Definition: ntvdm.h:50

◆ test_BadLetters()

static void test_BadLetters ( void  )
static

Definition at line 33 of file NcIsValidConnectionName.c.

34{
35 BOOL ret;
36
37 WCHAR buf[3] = { 0 };
38 int i;
39
40 for (i = 1; i <= 0xFFFF; ++i)
41 {
42 buf[0] = (WCHAR)i;
43 buf[1] = buf[2] = L'\0';
44
45 if (wcspbrk(buf, L"\\/:\t*? <>|\"") != NULL)
46 {
47 ret = pNcIsValidConnectionName(buf);
48 ok(ret == FALSE, "Expected %s (%i) to fail.\n", wine_dbgstr_w(buf), i);
49
50 /* How about two of a kind? */
51 buf[1] = (WCHAR)i;
52 ret = pNcIsValidConnectionName(buf);
53 ok(ret == FALSE, "Expected %s (%i) to fail.\n", wine_dbgstr_w(buf), i);
54
55 /* And something (bad) combined with a space? */
56 buf[1] = L' ';
57 ret = pNcIsValidConnectionName(buf);
58 ok(ret == FALSE, "Expected %s (%i) to fail.\n", wine_dbgstr_w(buf), i);
59
60
61 /* Something bad combined with a letter */
62 buf[1] = L'a';
63 ret = pNcIsValidConnectionName(buf);
64 if ((WCHAR)i == L' ')
65 ok(ret == TRUE, "Expected %s (%i) to succeed.\n", wine_dbgstr_w(buf), i);
66 else
67 ok(ret == FALSE, "Expected %s (%i) to fail.\n", wine_dbgstr_w(buf), i);
68 }
69 else
70 {
71 ret = pNcIsValidConnectionName(buf);
72 ok(ret == TRUE, "Expected %s (%i) to succeed.\n", wine_dbgstr_w(buf), i);
73
74 buf[1] = (WCHAR)i;
75 ret = pNcIsValidConnectionName(buf);
76 ok(ret == TRUE, "Expected %s (%i) to succeed.\n", wine_dbgstr_w(buf), i);
77
78 buf[1] = L'a';
79 ret = pNcIsValidConnectionName(buf);
80 ok(ret == TRUE, "Expected %s (%i) to succeed.\n", wine_dbgstr_w(buf), i);
81
82 buf[1] = L' ';
83 ret = pNcIsValidConnectionName(buf);
84 ok(ret == TRUE, "Expected %s (%i) to succeed.\n", wine_dbgstr_w(buf), i);
85 }
86 }
87}
#define ok(value,...)
Definition: atltest.h:57
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().