ReactOS 0.4.15-dev-7157-gb7dcc10
module.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <wine/atlbase.h>
#include <wine/atlwin.h>
#include <wine/test.h>
Include dependency graph for module.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define MAXSIZE   512
 

Functions

static void test_StructSize (void)
 
static void test_winmodule (void)
 
static void test_winclassinfo (void)
 
static void WINAPI term_callback (DWORD_PTR dw)
 
static void test_term (void)
 
 START_TEST (module)
 

Variables

static DWORD_PTR cb_val
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file module.c.

◆ MAXSIZE

#define MAXSIZE   512

Definition at line 32 of file module.c.

Function Documentation

◆ START_TEST()

START_TEST ( module  )

Definition at line 208 of file module.c.

209{
213 test_term();
214}
static void test_StructSize(void)
Definition: module.c:33
static void test_winmodule(void)
Definition: module.c:62
static void test_winclassinfo(void)
Definition: module.c:117
static void test_term(void)
Definition: module.c:173

◆ term_callback()

static void WINAPI term_callback ( DWORD_PTR  dw)
static

Definition at line 168 of file module.c.

169{
170 cb_val = dw;
171}
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
static DWORD_PTR cb_val
Definition: module.c:166

Referenced by test_term().

◆ test_StructSize()

static void test_StructSize ( void  )
static

Definition at line 33 of file module.c.

34{
35 _ATL_MODULEW *tst;
37 int i;
38
40
41 for (i=0;i<MAXSIZE;i++) {
42 tst->cbSize = i;
43 hres = AtlModuleInit(tst, NULL, NULL);
44
45 switch (i) {
46 case FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer):
47 case sizeof(_ATL_MODULEW):
48#ifdef _WIN64
49 case sizeof(_ATL_MODULEW) + sizeof(void *):
50#endif
51 ok (hres == S_OK, "AtlModuleInit with %d failed (0x%x).\n", i, (int)hres);
52 break;
53 default:
54 ok (FAILED(hres), "AtlModuleInit with %d succeeded? (0x%x).\n", i, (int)hres);
55 break;
56 }
57 }
58
59 HeapFree (GetProcessHeap(), 0, tst);
60}
HRESULT WINAPI AtlModuleInit(_ATL_MODULEW *pM, _ATL_OBJMAP_ENTRYW *p, HINSTANCE h)
Definition: atl30.c:39
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
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
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define MAXSIZE
Definition: module.c:32
HRESULT hres
Definition: protocol.c:465
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by START_TEST().

◆ test_term()

static void test_term ( void  )
static

Definition at line 173 of file module.c.

174{
178
179 ex = (ULONG_PTR)-37;
180
181 test.cbSize = sizeof(_ATL_MODULEW);
182
184 ok (hres == S_OK, "AtlModuleInit failed (0x%x).\n", hres);
185
187 ok (hres == S_OK, "AtlModuleAddTermFunc failed (0x%x).\n", hres);
188
189 cb_val = 0xdeadbeef;
191 ok (hres == S_OK, "AtlModuleTerm failed (0x%x).\n", hres);
192 ok (cb_val == ex, "wrong callback value (0x%lx).\n", cb_val);
193
194 test.cbSize = FIELD_OFFSET(_ATL_MODULEW, dwAtlBuildVer);
195
197 ok (hres == S_OK, "AtlModuleInit failed (0x%x).\n", hres);
198
200 ok (hres == S_OK, "AtlModuleAddTermFunc failed (0x%x).\n", hres);
201
202 cb_val = 0xdeadbeef;
204 ok (hres == S_OK, "AtlModuleTerm failed (0x%x).\n", hres);
205 ok (cb_val == 0xdeadbeef, "wrong callback value (0x%lx).\n", cb_val);
206}
HRESULT WINAPI AtlModuleTerm(_ATL_MODULE *pM)
Definition: atl30.c:112
HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULE *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw)
Definition: atl.c:297
#define ULONG_PTR
Definition: config.h:101
struct _ATL_MODULEW_TAG _ATL_MODULEW
static void WINAPI term_callback(DWORD_PTR dw)
Definition: module.c:168
#define test
Definition: rosglue.h:37
Definition: comerr.c:44
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by START_TEST().

◆ test_winclassinfo()

static void test_winclassinfo ( void  )
static

Definition at line 117 of file module.c.

118{
119 _ATL_MODULEW winmod;
121 int len, expectedLen;
122 ATOM atom;
125 {
126 /* .m_wc = */
127 {
128 sizeof(WNDCLASSEXW),
131 0,
132 0,
133 NULL,
134 NULL,
136 (HBRUSH)(COLOR_BTNFACE + 1),
137 NULL,
138 NULL, /* LPCSTR lpszClassName; <-- We force ATL class name generation */
139 NULL
140 },
141 /* .m_lpszOrigName = */ NULL,
142 /* .pWndProc = */ NULL,
143 /* .m_lpszCursorID = */ (LPCWSTR)IDC_ARROW,
144 /* .m_bSystemCursor = */ TRUE,
145 /* .m_atom = */ 0,
146 /* .m_szAutoName = */ L""
147 };
148
149 winmod.cbSize = sizeof(winmod);
150 winmod.m_pCreateWndList = (void*)0xdeadbeef;
151 hres = AtlModuleInit(&winmod, NULL, NULL);
152 ok(hres == S_OK, "AtlModuleInit failed: %08x\n", hres);
153 ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
154
155 atom = AtlModuleRegisterWndClassInfoW(&winmod, &wci, &wndProc);
156 ok(atom, "AtlModuleRegisterWndClassInfoA failed: %08x\n", atom);
157 ok(atom == wci.m_atom, "(atom = %08x) is != than (wci.m_atom = %08x)\n", atom, wci.m_atom);
158
159 ok(wcsncmp(wci.m_szAutoName, L"ATL:", 4) == 0, "wci.m_szAutoName = '%ls', expected starting with 'ATL:'\n", wci.m_szAutoName);
160
161 len = wcslen(wci.m_szAutoName);
162 expectedLen = sizeof("ATL:") + sizeof(void *) * 2 - 1;
163 ok(len == expectedLen, "wci.m_szAutoName has length %d, expected length %d\n", len, expectedLen);
164}
ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW *wci, WNDPROC *pProc)
Definition: atl30.c:357
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
GLenum GLsizei len
Definition: glext.h:6722
static LRESULT WINAPI wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: imm32.c:185
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define L(x)
Definition: ntvdm.h:50
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
_AtlCreateWndData * m_pCreateWndList
Definition: atlbase.h:174
WCHAR m_szAutoName[sizeof("ATL:")+sizeof(void *) *2]
Definition: atlwin.h:43
#define CS_VREDRAW
Definition: winuser.h:658
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
struct _WNDCLASSEXW WNDCLASSEXW
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2905
#define COLOR_BTNFACE
Definition: winuser.h:927
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ test_winmodule()

static void test_winmodule ( void  )
static

Definition at line 62 of file module.c.

63{
64 _AtlCreateWndData create_data[3];
65 _ATL_MODULEW winmod;
66 void *p;
68
69 winmod.cbSize = sizeof(winmod);
70 winmod.m_pCreateWndList = (void*)0xdeadbeef;
71 winmod.m_csWindowCreate.LockCount = 0xdeadbeef;
72 hres = AtlModuleInit(&winmod, NULL, NULL);
73 ok(hres == S_OK, "AtlModuleInit failed: %08x\n", hres);
74 ok(!winmod.m_pCreateWndList, "winmod.m_pCreateWndList = %p\n", winmod.m_pCreateWndList);
75 ok(winmod.m_csWindowCreate.LockCount == -1, "winmod.m_csWindowCreate.LockCount = %d\n",
77
78 AtlModuleAddCreateWndData(&winmod, create_data, (void*)0xdead0001);
79 ok(winmod.m_pCreateWndList == create_data, "winmod.m_pCreateWndList != create_data\n");
80 ok(create_data[0].m_pThis == (void*)0xdead0001, "unexpected create_data[0].m_pThis %p\n", create_data[0].m_pThis);
81 ok(create_data[0].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[0].m_dwThreadID %x\n",
82 create_data[0].m_dwThreadID);
83 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
84
85 AtlModuleAddCreateWndData(&winmod, create_data+1, (void*)0xdead0002);
86 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
87 ok(create_data[1].m_pThis == (void*)0xdead0002, "unexpected create_data[1].m_pThis %p\n", create_data[1].m_pThis);
88 ok(create_data[1].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[1].m_dwThreadID %x\n",
89 create_data[1].m_dwThreadID);
90 ok(create_data[1].m_pNext == create_data, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
91
92 AtlModuleAddCreateWndData(&winmod, create_data+2, (void*)0xdead0003);
93 ok(winmod.m_pCreateWndList == create_data+2, "winmod.m_pCreateWndList != create_data\n");
94 ok(create_data[2].m_pThis == (void*)0xdead0003, "unexpected create_data[2].m_pThis %p\n", create_data[2].m_pThis);
95 ok(create_data[2].m_dwThreadID == GetCurrentThreadId(), "unexpected create_data[2].m_dwThreadID %x\n",
96 create_data[2].m_dwThreadID);
97 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
98
100 ok(p == (void*)0xdead0003, "unexpected AtlModuleExtractCreateWndData result %p\n", p);
101 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
102 ok(create_data[2].m_pNext == create_data+1, "unexpected create_data[2].m_pNext %p\n", create_data[2].m_pNext);
103
104 create_data[1].m_dwThreadID = 0xdeadbeef;
105
107 ok(p == (void*)0xdead0001, "unexpected AtlModuleExtractCreateWndData result %p\n", p);
108 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
109 ok(!create_data[0].m_pNext, "unexpected create_data[0].m_pNext %p\n", create_data[0].m_pNext);
110 ok(!create_data[1].m_pNext, "unexpected create_data[1].m_pNext %p\n", create_data[1].m_pNext);
111
113 ok(!p, "unexpected AtlModuleExtractCreateWndData result %p\n", p);
114 ok(winmod.m_pCreateWndList == create_data+1, "winmod.m_pCreateWndList != create_data\n");
115}
void *WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM)
Definition: atl30.c:425
void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void *pvObject)
Definition: atl30.c:405
GLfloat GLfloat p
Definition: glext.h:8902
CRITICAL_SECTION m_csWindowCreate
Definition: atlbase.h:170
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459

Referenced by START_TEST().

Variable Documentation

◆ cb_val

DWORD_PTR cb_val
static

Definition at line 166 of file module.c.

Referenced by term_callback(), and test_term().