ReactOS  0.4.14-dev-317-g96040ec
Control_RunDLLW.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4  * PURPOSE: Test for Control_RunDLLW
5  * PROGRAMMER: Giannis Adamopoulos
6  */
7 
8 #include "shelltest.h"
9 
10 #include <cpl.h>
11 #include <stdio.h>
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 extern "C"
18 
20 int g_iClk;
22 
23 extern "C"
25 CPlApplet(HWND hwndCPl,
26  UINT uMsg,
27  LPARAM lParam1,
28  LPARAM lParam2)
29 {
30  INT i = (INT)lParam1;
31 
32  switch (uMsg)
33  {
34  case CPL_INIT:
35  return TRUE;
36 
37  case CPL_GETCOUNT:
38  return 2;
39 
40  case CPL_INQUIRE:
41  {
42  CPLINFO *CPlInfo = (CPLINFO*)lParam2;
43  CPlInfo->lData = 0;
44  CPlInfo->idIcon = CPL_DYNAMIC_RES ;
45  CPlInfo->idName = CPL_DYNAMIC_RES ;
46  CPlInfo->idInfo = CPL_DYNAMIC_RES ;
47  }
48  break;
49  case CPL_NEWINQUIRE:
50  {
51  LPNEWCPLINFOW pinfo = (LPNEWCPLINFOW)lParam2;
52 
53  memset(pinfo, 0, sizeof(NEWCPLINFOW));
54  pinfo->dwSize = sizeof(NEWCPLINFOW);
56  if (i == 0)
57  {
58  wcscpy(pinfo->szName, L"name0");
59  wcscpy(pinfo->szInfo, L"info0");
60  wcscpy(pinfo->szHelpFile, L"help0");
61  }
62  else
63  {
64  wcscpy(pinfo->szName, L"name1");
65  wcscpy(pinfo->szInfo, L"info1");
66  wcscpy(pinfo->szHelpFile, L"help1");
67  }
68  break;
69  }
70  case CPL_DBLCLK:
71  g_iClk = i;
72  break;
73  case CPL_STARTWPARMSW:
74  g_iParams = i;
75  ok(lParam2 != NULL, "Got NULL lParam2!\n");
76  if (lParam2)
77  wcscpy(g_wstrParams, (LPCWSTR)lParam2);
78  break;
79  }
80 
81  return FALSE;
82 }
83 
84 
85 #define MSG_NOT_CALLED -1
86 
87 struct param_test
88 {
89  int srcLine;
91  INT iStartParams; /* MSG_NOT_CALLED when CPL_STARTWPARMS is not sent */
92  LPCWSTR params; /* second param of CPL_STARTWPARMS */
93  INT iClick; /* MSG_NOT_CALLED when CPL_DBLCLK is not sent */
94 };
95 
96 struct param_test tests[] =
97 {
98  {__LINE__, L"", MSG_NOT_CALLED, L"", 0},
99  {__LINE__, L",name0", MSG_NOT_CALLED, L"", 0},
100  {__LINE__, L",name1", MSG_NOT_CALLED, L"", 1},
101  {__LINE__, L",@0", MSG_NOT_CALLED, L"", 0},
102  {__LINE__, L",@1", MSG_NOT_CALLED, L"", 1},
103  {__LINE__, L",0", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
104  {__LINE__, L",1", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
105  {__LINE__, L",@name0", MSG_NOT_CALLED, L"", 0},
106  {__LINE__, L",@name1", MSG_NOT_CALLED, L"", 0},
107  {__LINE__, L" name0", MSG_NOT_CALLED, L"", 0},
108  {__LINE__, L" name1", MSG_NOT_CALLED, L"", 1},
109  {__LINE__, L" @0", MSG_NOT_CALLED, L"", 0},
110  {__LINE__, L" @1", MSG_NOT_CALLED, L"", 1},
111  {__LINE__, L" 0", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
112  {__LINE__, L" 1", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
113  {__LINE__, L" @name0", MSG_NOT_CALLED, L"", 0},
114  {__LINE__, L" @name1", MSG_NOT_CALLED, L"", 0},
115  {__LINE__, L"\"name0\"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
116  {__LINE__, L"\"name1\"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
117  {__LINE__, L",\"name0\"", MSG_NOT_CALLED, L"", 0},
118  {__LINE__, L",\"name1\"", MSG_NOT_CALLED, L"", 1},
119  {__LINE__, L"\",name0\"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
120  {__LINE__, L"\",name1\"", MSG_NOT_CALLED, L"", MSG_NOT_CALLED},
121  {__LINE__, L",name0,@1", 0, L"@1", 0},
122  {__LINE__, L",name1,@0", 1, L"@0", 1},
123  {__LINE__, L",name0, ", 0, L" ", 0},
124  {__LINE__, L",name1, ", 1, L" ", 1},
125  {__LINE__, L",@0,@1", 0, L"@1", 0},
126  {__LINE__, L",@1,@0", 1, L"@0", 1},
127  {__LINE__, L",\"@0\",@1", 0, L"@1", 0},
128  {__LINE__, L",\"@1\",@0", 1, L"@0", 1},
129  {__LINE__, L",\"@0\",\"@1\"", 0, L"\"@1\"", 0},
130  {__LINE__, L",\"@1\",\"@0\"", 1, L"\"@0\"", 1},
131  {__LINE__, L",\"@0\",@1,2,3,4,5", 0, L"@1,2,3,4,5", 0},
132  {__LINE__, L",\"@1\",@0,2,3,4,5", 1, L"@0,2,3,4,5", 1},
133  {__LINE__, L",\"@0\",@1,2,\"3\",4,5", 0, L"@1,2,\"3\",4,5", 0},
134  {__LINE__, L",\"@1\",@0,2,\"3\",4,5", 1, L"@0,2,\"3\",4,5", 1},
135  {__LINE__, L",\"@0\", @1 , 2 , 3 , 4 , 5", 0, L" @1 , 2 , 3 , 4 , 5", 0},
136  {__LINE__, L",\"@1\", @0 , 2 , 3 , 4 , 5", 1, L" @0 , 2 , 3 , 4 , 5", 1},
137  {__LINE__, L",\"@0\", @1 , 2 , /3 , 4 , 5", 0, L" @1 , 2 , /3 , 4 , 5", 0},
138  {__LINE__, L",\"@1\", @0 , 2 , /3 , 4 , 5", 1, L" @0 , 2 , /3 , 4 , 5", 1},
139  {__LINE__, L",\"@0\", @1 , 2 , /3 , 4 , 5", 0, L" @1 , 2 , /3 , 4 , 5", 0},
140  {__LINE__, L",\"@1\", @0 , 2 , /3 , 4 , 5", 1, L" @0 , 2 , /3 , 4 , 5", 1},
141 
142 };
143 
145 {
146  WCHAR finename[MAX_PATH];
148 
149  GetModuleFileNameW(NULL, finename, MAX_PATH);
150 
151  for (UINT i = 0; i < _countof(tests); i++)
152  {
153  swprintf(buffer, L"%s%s", finename, tests[i].cmd);
154 
157  g_wstrParams[0] = 0;
159  ok (tests[i].iClick == g_iClk, "%d, CPL_DBLCLK: expected %d got %d\n", tests[i].srcLine, tests[i].iClick, g_iClk);
160  ok (tests[i].iStartParams == g_iParams, "%d, CPL_STARTWPARMSW: expected %d got %d\n", tests[i].srcLine, tests[i].iStartParams, g_iParams);
161  ok (wcscmp(tests[i].params, g_wstrParams) == 0, "%d, CPL_STARTWPARMSW: expected %S got %S\n", tests[i].srcLine, tests[i].params, g_wstrParams);
162  }
163 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
struct param_test tests[]
#define TRUE
Definition: types.h:120
Definition: cpl.h:24
struct tagNEWCPLINFOW * LPNEWCPLINFOW
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: ftp_var.h:139
#define _countof(array)
Definition: fontsub.cpp:30
#define INT
Definition: polytest.cpp:20
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
int idInfo
Definition: cpl.h:27
WCHAR g_wstrParams[MAX_PATH]
GLuint buffer
Definition: glext.h:5915
#define IDI_APPLICATION
Definition: winuser.h:699
int32_t INT
Definition: typedefs.h:56
struct tagNEWCPLINFOW NEWCPLINFOW
int g_iClk
int idIcon
Definition: cpl.h:25
#define CPL_DBLCLK
Definition: cpl.h:16
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
GLenum const GLfloat * params
Definition: glext.h:5645
long LONG
Definition: pedump.c:60
#define CPL_DYNAMIC_RES
Definition: cpl.h:11
#define CPL_NEWINQUIRE
Definition: cpl.h:19
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:652
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR szHelpFile[128]
Definition: cpl.h:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwSize
Definition: cpl.h:41
#define CPL_STARTWPARMSW
Definition: cpl.h:21
#define CPL_INIT
Definition: cpl.h:12
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define CPL_INQUIRE
Definition: cpl.h:14
static const WCHAR L[]
Definition: oid.c:1250
LONG CALLBACK CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
LONG_PTR lData
Definition: cpl.h:28
int idName
Definition: cpl.h:26
HICON hIcon
Definition: cpl.h:45
WCHAR szInfo[64]
Definition: cpl.h:47
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HINSTANCE hInst
Definition: dxdiag.c:13
void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
Definition: control.c:873
int g_iParams
#define ok(value,...)
Definition: atltest.h:57
WCHAR szName[32]
Definition: cpl.h:46
unsigned int UINT
Definition: ndis.h:50
START_TEST(Control_RunDLLW)
#define LoadIcon
Definition: winuser.h:5714
#define MSG_NOT_CALLED
#define memset(x, y, z)
Definition: compat.h:39
#define CPL_GETCOUNT
Definition: cpl.h:13