ReactOS  0.4.15-dev-439-g292f67a
confdlg.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "wine/test.h"
Include dependency graph for confdlg.c:

Go to the source code of this file.

Functions

static DWORD (WINAPI *pCommConfigDialogA)(LPCSTR
 
static LPCSTR load_functions (void)
 
static void test_drvCommConfigDialogA (void)
 
static void test_drvCommConfigDialogW (void)
 
static void test_drvGetDefaultCommConfigA (void)
 
static void test_drvGetDefaultCommConfigW (void)
 
 START_TEST (confdlg)
 

Variables

static HINSTANCE hdll
 
static HWND
 
static LPCOMMCONFIG
 
static LPDWORD
 
static const CHAR com1A [] = "com1"
 
static const CHAR emptyA [] = ""
 
static const CHAR fmt_comA [] = "com%d"
 
static const CHAR str_colonA [] = ":"
 
static const WCHAR com1W [] = {'c','o','m','1',0}
 
static const WCHAR emptyW [] = {0}
 
static const WCHAR str_colonW [] = {':',0}
 

Function Documentation

◆ DWORD()

static DWORD ( WINAPI pCommConfigDialogA)
static

◆ load_functions()

static LPCSTR load_functions ( void  )
static

Definition at line 51 of file confdlg.c.

52 {
53  LPCSTR ptr;
54 
55  ptr = "serialui.dll";
57  if (!hdll) return ptr;
58 
59  ptr = "drvCommConfigDialogA";
60  pCommConfigDialogA = (VOID *) GetProcAddress(hdll, ptr);
61  if (!pCommConfigDialogA) return ptr;
62 
63  ptr = "drvCommConfigDialogW";
64  pCommConfigDialogW = (VOID *) GetProcAddress(hdll, ptr);
65  if (!pCommConfigDialogW) return ptr;
66 
67  ptr = "drvGetDefaultCommConfigA";
68  pGetDefaultCommConfigA = (VOID *) GetProcAddress(hdll, ptr);
69  if (!pGetDefaultCommConfigA) return ptr;
70 
71  ptr = "drvGetDefaultCommConfigW";
72  pGetDefaultCommConfigW = (VOID *) GetProcAddress(hdll, ptr);
73  if (!pGetDefaultCommConfigW) return ptr;
74 
75 
76  return NULL;
77 }
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
static HINSTANCE hdll
Definition: confdlg.c:33
#define GetProcAddress(x, y)
Definition: compat.h:419

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( confdlg  )

Definition at line 416 of file confdlg.c.

417 {
418  LPCSTR ptr;
419 
420  ptr = load_functions();
421  if (ptr) {
422  win_skip("got NULL with %u for %s\n", GetLastError(), ptr);
423  return;
424  }
425 
430 
431 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static LPCSTR load_functions(void)
Definition: confdlg.c:51
static void test_drvGetDefaultCommConfigA(void)
Definition: confdlg.c:230
static void test_drvCommConfigDialogW(void)
Definition: confdlg.c:155
static PVOID ptr
Definition: dispmode.c:27
const char * LPCSTR
Definition: xmlstorage.h:183
static void test_drvCommConfigDialogA(void)
Definition: confdlg.c:81
static void test_drvGetDefaultCommConfigW(void)
Definition: confdlg.c:322
#define win_skip
Definition: test.h:149

◆ test_drvCommConfigDialogA()

static void test_drvCommConfigDialogA ( void  )
static

Definition at line 81 of file confdlg.c.

82 {
83  COMMCONFIG pCC[3];
84  CHAR bufferA[16];
85  DWORD i;
86  DWORD res;
87  DWORD len;
88 
89 
90  /* test ports "com1" - "com4" */
91  for (i = 1; i < 5 ; i++) {
92  sprintf(bufferA, fmt_comA, i);
93  len = sizeof(pCC);
94  ZeroMemory(pCC, sizeof(pCC));
95  SetLastError(0xdeadbeef);
96  res = pGetDefaultCommConfigA(bufferA, pCC, &len);
98  /* NT does not implement the ANSI API */
99  win_skip("*A not implemented\n");
100  return;
101  }
102 
103  if (res == ERROR_SUCCESS) {
104 
105  if (winetest_interactive) {
106  SetLastError(0xdeadbeef);
107  res = pCommConfigDialogA(bufferA, NULL, pCC);
108  /* OK: ERROR_SUCCESS, Cancel: ERROR_CANCELLED */
109  trace("returned %u with %u for '%s'\n", res, GetLastError(), bufferA);
110  }
111 
112  ZeroMemory(pCC, sizeof(pCC));
113  SetLastError(0xdeadbeef);
114  res = pCommConfigDialogA(bufferA, NULL, pCC);
116  "returned %u with %u for '%s' (expected ERROR_INSUFFICIENT_BUFFER)\n",
117  res, GetLastError(), bufferA);
118 
119 
120  SetLastError(0xdeadbeef);
121  res = pCommConfigDialogA(bufferA, NULL, NULL);
123  "returned %u with %u for '%s' (expected ERROR_INVALID_PARAMETER)\n",
124  res, GetLastError(), bufferA);
125  }
126  }
127 
128 
129  ZeroMemory(pCC, sizeof(pCC));
130  SetLastError(0xdeadbeef);
131  res = pCommConfigDialogA(emptyA, NULL, pCC);
133  "returned %u with %u (expected ERROR_INSUFFICIENT_BUFFER)\n",
134  res, GetLastError());
135 
136 
137  ZeroMemory(pCC, sizeof(pCC));
138  pCC[0].dwSize = sizeof(COMMCONFIG);
139  SetLastError(0xdeadbeef);
140  res = pCommConfigDialogA(emptyA, NULL, pCC);
141  ok( res == ERROR_BADKEY, "returned %u with %u (expected ERROR_BADKEY)\n",
142  res, GetLastError());
143 
144 
145  ZeroMemory(pCC, sizeof(pCC));
146  SetLastError(0xdeadbeef);
147  res = pCommConfigDialogA(NULL, NULL, pCC);
149  "returned %u with %u (expected ERROR_INVALID_PARAMETER)\n",
150  res, GetLastError());
151 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct _COMM_CONFIG COMMCONFIG
#define ERROR_SUCCESS
Definition: deptool.c:10
char CHAR
Definition: xmlstorage.h:175
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
int winetest_interactive
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static const CHAR emptyA[]
Definition: confdlg.c:41
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
smooth NULL
Definition: ftsmooth.c:416
static const CHAR fmt_comA[]
Definition: confdlg.c:42
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define ERROR_BADKEY
Definition: winerror.h:589
DWORD dwSize
Definition: winbase.h:655
GLenum GLsizei len
Definition: glext.h:6722
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:149
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_drvCommConfigDialogW()

static void test_drvCommConfigDialogW ( void  )
static

Definition at line 155 of file confdlg.c.

156 {
157  COMMCONFIG pCC[3];
158  CHAR bufferA[16];
159  WCHAR bufferW[16];
160  DWORD i;
161  DWORD res;
162  DWORD len;
163 
164 
165  /* test ports "com1" - "com4" */
166  for (i = 1; i < 5 ; i++) {
167  sprintf(bufferA, fmt_comA, i);
168  MultiByteToWideChar(CP_ACP, 0, bufferA, -1, bufferW, ARRAY_SIZE(bufferW));
169  len = sizeof(pCC);
170  ZeroMemory(pCC, sizeof(pCC));
171  SetLastError(0xdeadbeef);
172  res = pGetDefaultCommConfigW(bufferW, pCC, &len);
174  win_skip("*W not implemented\n");
175  return;
176  }
177 
178  if (res == ERROR_SUCCESS) {
179 
180  if (winetest_interactive) {
181  SetLastError(0xdeadbeef);
182  res = pCommConfigDialogW(bufferW, NULL, pCC);
183  /* OK: ERROR_SUCCESS, Cancel: ERROR_CANCELLED */
184  trace("returned %u with %u for '%s'\n", res, GetLastError(), bufferA);
185  }
186 
187  ZeroMemory(pCC, sizeof(pCC));
188  SetLastError(0xdeadbeef);
189  res = pCommConfigDialogW(bufferW, NULL, pCC);
191  "returned %u with %u for '%s' (expected ERROR_INSUFFICIENT_BUFFER)\n",
192  res, GetLastError(), bufferA);
193 
194  SetLastError(0xdeadbeef);
195  res = pCommConfigDialogW(bufferW, NULL, NULL);
197  "returned %u with %u for '%s' (expected ERROR_INVALID_PARAMETER)\n",
198  res, GetLastError(), bufferA);
199  }
200  }
201 
202 
203  ZeroMemory(pCC, sizeof(pCC));
204  SetLastError(0xdeadbeef);
205  res = pCommConfigDialogW(emptyW, NULL, pCC);
207  "returned %u with %u (expected ERROR_INSUFFICIENT_BUFFER)\n",
208  res, GetLastError());
209 
210 
211  ZeroMemory(pCC, sizeof(pCC));
212  pCC[0].dwSize = sizeof(COMMCONFIG);
213  SetLastError(0xdeadbeef);
214  res = pCommConfigDialogW(emptyW, NULL, pCC);
215  ok( res == ERROR_BADKEY, "returned %u with %u (expected ERROR_BADKEY)\n",
216  res, GetLastError());
217 
218 
219  ZeroMemory(pCC, sizeof(pCC));
220  SetLastError(0xdeadbeef);
221  res = pCommConfigDialogW(NULL, NULL, pCC);
223  "returned %u with %u (expected ERROR_INVALID_PARAMETER)\n",
224  res, GetLastError());
225 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct _COMM_CONFIG COMMCONFIG
#define ERROR_SUCCESS
Definition: deptool.c:10
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
int winetest_interactive
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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
smooth NULL
Definition: ftsmooth.c:416
static const CHAR fmt_comA[]
Definition: confdlg.c:42
static const WCHAR emptyW[]
Definition: confdlg.c:46
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define ERROR_BADKEY
Definition: winerror.h:589
DWORD dwSize
Definition: winbase.h:655
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:149
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_drvGetDefaultCommConfigA()

static void test_drvGetDefaultCommConfigA ( void  )
static

Definition at line 230 of file confdlg.c.

231 {
232  COMMCONFIG pCC[3];
233  CHAR bufferA[16];
234  DWORD i;
235  DWORD res;
236  DWORD len;
237 
238 
239  /* off by one: one byte smaller */
240  i = sizeof(COMMCONFIG);
241  len = sizeof(COMMCONFIG) -1;
242  ZeroMemory(pCC, sizeof(pCC));
243  SetLastError(0xdeadbeef);
244  res = pGetDefaultCommConfigA(com1A, pCC, &len);
246  /* NT does not implement the ANSI API */
247  win_skip("*A not implemented\n");
248  return;
249  }
250  ok( (res == ERROR_INSUFFICIENT_BUFFER) && (len >= i),
251  "returned %u with %u and %u (expected "
252  "ERROR_INSUFFICIENT_BUFFER and '>= %u')\n", res, GetLastError(), len, i);
253 
254  /* test ports "com0" - "com10" */
255  for (i = 0; i < 11 ; i++) {
256  sprintf(bufferA, fmt_comA, i);
257  len = sizeof(pCC);
258  ZeroMemory(pCC, sizeof(pCC));
259  SetLastError(0xdeadbeef);
260  res = pGetDefaultCommConfigA(bufferA, pCC, &len);
261  if (i == 0) {
262  ok( res == ERROR_BADKEY,
263  "returned %u with %u and %u for %s (expected "
264  "ERROR_BADKEY)\n", res, GetLastError(), len, bufferA);
265  }
266  else
267  {
268  ok((res == ERROR_SUCCESS) || (res == ERROR_BADKEY),
269  "returned %u with %u and %u for %s (expected ERROR_SUCCESS or "
270  "ERROR_BADKEY)\n", res, GetLastError(), len, bufferA);
271  }
272 
273  /* a name with a colon is invalid */
274  if (res == ERROR_SUCCESS) {
275  lstrcatA(bufferA, str_colonA);
276  len = sizeof(pCC);
277  ZeroMemory(pCC, sizeof(pCC));
278  res = pGetDefaultCommConfigA(bufferA, pCC, &len);
279  ok( res == ERROR_BADKEY,
280  "returned %u with %u and %u for %s (expected '0' with "
281  "ERROR_BADKEY)\n", res, GetLastError(), len, bufferA);
282  }
283  }
284 
285 
286  /* an empty String is not allowed */
287  len = sizeof(pCC);
288  ZeroMemory(pCC, sizeof(pCC));
289  SetLastError(0xdeadbeef);
290  res = pGetDefaultCommConfigA(emptyA, pCC, &len);
291  ok( res == ERROR_BADKEY,
292  "returned %u with %u and %u for %s (expected ERROR_BADKEY)\n",
293  res, GetLastError(), len, emptyA);
294 
295  /* some NULL checks */
296  len = sizeof(pCC);
297  ZeroMemory(pCC, sizeof(pCC));
298  SetLastError(0xdeadbeef);
299  res = pGetDefaultCommConfigA(NULL, pCC, &len);
301  "returned %u with %u and %u for NULL (expected ERROR_INVALID_PARAMETER)\n",
302  res, GetLastError(), len);
303 
304 
305  len = sizeof(pCC);
306  SetLastError(0xdeadbeef);
307  res = pGetDefaultCommConfigA(com1A, NULL, &len);
309  "returned %u with %u and %u (expected ERROR_INVALID_PARAMETER)\n",
310  res, GetLastError(), len);
311 
312 
313  SetLastError(0xdeadbeef);
314  res = pGetDefaultCommConfigA(com1A, pCC, NULL);
316  "returned %u with %u (expected ERROR_INVALID_PARAMETER)\n",
317  res, GetLastError());
318 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct _COMM_CONFIG COMMCONFIG
#define ERROR_SUCCESS
Definition: deptool.c:10
static const CHAR str_colonA[]
Definition: confdlg.c:43
char CHAR
Definition: xmlstorage.h:175
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
static const CHAR com1A[]
Definition: confdlg.c:40
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static const CHAR emptyA[]
Definition: confdlg.c:41
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
smooth NULL
Definition: ftsmooth.c:416
static const CHAR fmt_comA[]
Definition: confdlg.c:42
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define ERROR_BADKEY
Definition: winerror.h:589
GLenum GLsizei len
Definition: glext.h:6722
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:149
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

◆ test_drvGetDefaultCommConfigW()

static void test_drvGetDefaultCommConfigW ( void  )
static

Definition at line 322 of file confdlg.c.

323 {
324  COMMCONFIG pCC[3];
325  WCHAR bufferW[16];
326  CHAR bufferA[16];
327  DWORD i;
328  DWORD res;
329  DWORD len;
330 
331 
332  /* off by one: one byte smaller */
333  i = sizeof(COMMCONFIG);
334  len = sizeof(COMMCONFIG) -1;
335  ZeroMemory(pCC, sizeof(pCC));
336  SetLastError(0xdeadbeef);
337  res = pGetDefaultCommConfigW(com1W, pCC, &len);
339  win_skip("*W not implemented\n");
340  return;
341  }
342  ok( (res == ERROR_INSUFFICIENT_BUFFER) && (len >= i),
343  "returned %u with %u and %u (expected "
344  "ERROR_INSUFFICIENT_BUFFER and '>= %u')\n", res, GetLastError(), len, i);
345 
346  /* test ports "com0" - "com10" */
347  for (i = 0; i < 11 ; i++) {
348  sprintf(bufferA, fmt_comA, i);
349  MultiByteToWideChar(CP_ACP, 0, bufferA, -1, bufferW, ARRAY_SIZE(bufferW));
350  len = sizeof(pCC);
351  ZeroMemory(pCC, sizeof(pCC));
352  SetLastError(0xdeadbeef);
353  res = pGetDefaultCommConfigW(bufferW, pCC, &len);
354  if (i == 0) {
355  ok( res == ERROR_BADKEY,
356  "returned %u with %u and %u for %s (expected "
357  "ERROR_BADKEY)\n", res, GetLastError(), len, bufferA);
358  }
359  else
360  {
361  ok((res == ERROR_SUCCESS) || (res == ERROR_BADKEY),
362  "returned %u with %u and %u for %s (expected ERROR_SUCCESS or "
363  "ERROR_BADKEY)\n", res, GetLastError(), len, bufferA);
364  }
365 
366  /* a name with a colon is invalid */
367  if (res == ERROR_SUCCESS) {
368  lstrcatA(bufferA, str_colonA);
369  lstrcatW(bufferW, str_colonW);
370  len = sizeof(pCC);
371  ZeroMemory(pCC, sizeof(pCC));
372  res = pGetDefaultCommConfigW(bufferW, pCC, &len);
373  ok( res == ERROR_BADKEY,
374  "returned %u with %u and %u for %s (expected '0' with "
375  "ERROR_BADKEY)\n", res, GetLastError(), len, bufferA);
376  }
377  }
378 
379  /* an empty String is not allowed */
380  len = sizeof(pCC);
381  ZeroMemory(pCC, sizeof(pCC));
382  SetLastError(0xdeadbeef);
383  res = pGetDefaultCommConfigW(emptyW, pCC, &len);
384  ok( res == ERROR_BADKEY,
385  "returned %u with %u and %u for %s (expected ERROR_BADKEY)\n",
386  res, GetLastError(), len, emptyA);
387 
388  /* some NULL checks */
389  len = sizeof(pCC);
390  ZeroMemory(pCC, sizeof(pCC));
391  SetLastError(0xdeadbeef);
392  res = pGetDefaultCommConfigW(NULL, pCC, &len);
394  "returned %u with %u and %u for NULL (expected ERROR_INVALID_PARAMETER)\n",
395  res, GetLastError(), len);
396 
397 
398  len = sizeof(pCC);
399  SetLastError(0xdeadbeef);
400  res = pGetDefaultCommConfigW(com1W, NULL, &len);
402  "returned %u with %u and %u (expected ERROR_INVALID_PARAMETER)\n",
403  res, GetLastError(), len);
404 
405 
406  SetLastError(0xdeadbeef);
407  res = pGetDefaultCommConfigW(com1W, pCC, NULL);
409  "returned %u with %u (expected ERROR_INVALID_PARAMETER)\n",
410  res, GetLastError());
411 
412 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct _COMM_CONFIG COMMCONFIG
#define ERROR_SUCCESS
Definition: deptool.c:10
static const CHAR str_colonA[]
Definition: confdlg.c:43
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static const CHAR emptyA[]
Definition: confdlg.c:41
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
smooth NULL
Definition: ftsmooth.c:416
static const CHAR fmt_comA[]
Definition: confdlg.c:42
static const WCHAR emptyW[]
Definition: confdlg.c:46
static const WCHAR com1W[]
Definition: confdlg.c:45
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define ERROR_BADKEY
Definition: winerror.h:589
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR str_colonW[]
Definition: confdlg.c:47
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define MultiByteToWideChar
Definition: compat.h:100
GLuint res
Definition: glext.h:9613
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define win_skip
Definition: test.h:149
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by START_TEST().

Variable Documentation

◆ com1A

const CHAR com1A[] = "com1"
static

Definition at line 40 of file confdlg.c.

Referenced by test_drvGetDefaultCommConfigA().

◆ com1W

const WCHAR com1W[] = {'c','o','m','1',0}
static

Definition at line 45 of file confdlg.c.

Referenced by test_drvGetDefaultCommConfigW().

◆ emptyA

const CHAR emptyA[] = ""
static

◆ emptyW

const WCHAR emptyW[] = {0}
static

Definition at line 46 of file confdlg.c.

Referenced by test_drvCommConfigDialogW(), and test_drvGetDefaultCommConfigW().

◆ fmt_comA

◆ hdll

HINSTANCE hdll
static

Definition at line 33 of file confdlg.c.

Referenced by load_functions().

◆ HWND

Definition at line 34 of file confdlg.c.

◆ LPCOMMCONFIG

Definition at line 34 of file confdlg.c.

◆ LPDWORD

Definition at line 36 of file confdlg.c.

◆ str_colonA

const CHAR str_colonA[] = ":"
static

Definition at line 43 of file confdlg.c.

Referenced by test_drvGetDefaultCommConfigA(), and test_drvGetDefaultCommConfigW().

◆ str_colonW

const WCHAR str_colonW[] = {':',0}
static

Definition at line 47 of file confdlg.c.

Referenced by test_drvGetDefaultCommConfigW().