ReactOS 0.4.15-dev-8096-ga0eec98
atl_ax.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <wine/test.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <wingdi.h>
#include <winnls.h>
#include <winerror.h>
#include <winnt.h>
#include <wtypes.h>
#include <olectl.h>
#include <ocidl.h>
#include <exdisp.h>
#include <wine/atlbase.h>
Include dependency graph for atl_ax.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

static HRESULT (WINAPI *pAtlAxAttachControl)(IUnknown *
 
static IUnknown **static void init_function_pointers (void)
 
static ATOM register_class (void)
 
static void test_AtlAxAttachControl (void)
 
static void test_ax_win (void)
 
 START_TEST (atl_ax)
 

Variables

static HWND
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file atl_ax.c.

Function Documentation

◆ HRESULT()

static HRESULT ( WINAPI pAtlAxAttachControl)
static

◆ init_function_pointers()

static IUnknown **static void init_function_pointers ( void  )
static

Definition at line 42 of file atl_ax.c.

43{
44 HMODULE hatl = GetModuleHandleA("atl.dll");
45
46 pAtlAxAttachControl = (void *)GetProcAddress(hatl, "AtlAxAttachControl");
47}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812

Referenced by START_TEST().

◆ register_class()

static ATOM register_class ( void  )
static

Definition at line 49 of file atl_ax.c.

50{
51 WNDCLASSA wndclassA;
52
53 wndclassA.style = 0;
54 wndclassA.lpfnWndProc = DefWindowProcA;
55 wndclassA.cbClsExtra = 0;
56 wndclassA.cbWndExtra = 0;
57 wndclassA.hInstance = GetModuleHandleA(NULL);
58 wndclassA.hIcon = NULL;
59 wndclassA.hCursor = LoadCursorA(NULL, (LPSTR)IDC_ARROW);
60 wndclassA.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
61 wndclassA.lpszMenuName = NULL;
62 wndclassA.lpszClassName = "WineAtlTestClass";
63
64 return RegisterClassA(&wndclassA);
65}
#define NULL
Definition: types.h:112
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
UINT style
Definition: winuser.h:3163
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2121
#define COLOR_BTNFACE
Definition: winuser.h:928
char * LPSTR
Definition: xmlstorage.h:182

Referenced by apartment_createwindowifneeded(), and START_TEST().

◆ START_TEST()

START_TEST ( atl_ax  )

Definition at line 132 of file atl_ax.c.

133{
135
136 if (!register_class())
137 return;
138
140
141 if (pAtlAxAttachControl)
143 else
144 win_skip("AtlAxAttachControl is not available\n");
145
146 test_ax_win();
147
149}
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static IUnknown **static void init_function_pointers(void)
Definition: atl_ax.c:42
static ATOM register_class(void)
Definition: atl_ax.c:49
static void test_AtlAxAttachControl(void)
Definition: atl_ax.c:67
static void test_ax_win(void)
Definition: atl_ax.c:114
#define win_skip
Definition: test.h:163

◆ test_AtlAxAttachControl()

static void test_AtlAxAttachControl ( void  )
static

Definition at line 67 of file atl_ax.c.

68{
69 HWND hwnd = CreateWindowA("WineAtlTestClass", "Wine ATL Test Window", 0,
72 HRESULT hr;
73 IUnknown *pObj, *pContainer;
74
75 hr = pAtlAxAttachControl(NULL, NULL, NULL);
76 ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
77
78 pContainer = (IUnknown *)0xdeadbeef;
79 hr = pAtlAxAttachControl(NULL, NULL, &pContainer);
80 ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
81 ok(pContainer == (IUnknown *)0xdeadbeef,
82 "Expected the output container pointer to be untouched, got %p\n", pContainer);
83
84 hr = pAtlAxAttachControl(NULL, hwnd, NULL);
85 ok(hr == E_INVALIDARG, "Expected AtlAxAttachControl to return E_INVALIDARG, got 0x%08x\n", hr);
86
87 hr = CoCreateInstance(&CLSID_WebBrowser, NULL, CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
88 &IID_IOleObject, (void **)&pObj);
89 ok(hr == S_OK, "Expected CoCreateInstance to return S_OK, got 0x%08x\n", hr);
90
91 if (FAILED(hr))
92 {
93 skip("Couldn't obtain a test IOleObject instance\n");
94 return;
95 }
96
97 hr = pAtlAxAttachControl(pObj, NULL, NULL);
98 ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
99
100 pContainer = NULL;
101 hr = pAtlAxAttachControl(pObj, NULL, &pContainer);
102 ok(hr == S_FALSE, "Expected AtlAxAttachControl to return S_FALSE, got 0x%08x\n", hr);
103 ok(pContainer != NULL, "got %p\n", pContainer);
104 IUnknown_Release(pContainer);
105
106 hr = pAtlAxAttachControl(pObj, hwnd, NULL);
107 ok(hr == S_OK, "Expected AtlAxAttachControl to return S_OK, got 0x%08x\n", hr);
108
109 IUnknown_Release(pObj);
110
112}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const GUID IID_IOleObject
HRESULT hr
Definition: shlfolder.c:183
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define S_FALSE
Definition: winerror.h:2357
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_ax_win()

static void test_ax_win ( void  )
static

Definition at line 114 of file atl_ax.c.

115{
116 BOOL ret;
117 WNDCLASSEXW wcex;
118 static const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n',0};
119 static HMODULE hinstance = 0;
120
121 ret = AtlAxWinInit();
122 ok(ret, "AtlAxWinInit failed\n");
123
124 hinstance = GetModuleHandleA(NULL);
125 memset(&wcex, 0, sizeof(wcex));
126 wcex.cbSize = sizeof(wcex);
127 ret = GetClassInfoExW(hinstance, AtlAxWin, &wcex);
128 ok(ret, "AtlAxWin has not registered\n");
129 ok(wcex.style == CS_GLOBALCLASS, "wcex.style %08x\n", wcex.style);
130}
BOOL WINAPI AtlAxWinInit(void)
Definition: atl_ax.c:89
unsigned int BOOL
Definition: ntddk_ex.h:94
#define memset(x, y, z)
Definition: compat.h:39
UINT cbSize
Definition: winuser.h:3216
UINT style
Definition: winuser.h:3217
int ret
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
#define CS_GLOBALCLASS
Definition: winuser.h:652
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

Variable Documentation

◆ HWND

Definition at line 40 of file atl_ax.c.