ReactOS 0.4.16-dev-927-g467dec4
WinList.cpp File Reference
#include <apitest.h>
#include <shlobj.h>
Include dependency graph for WinList.cpp:

Go to the source code of this file.

Typedefs

typedef BOOL(WINAPIFN_WinList_Init) (VOID)
 
typedef VOID(WINAPIFN_WinList_Terminate) (VOID)
 
typedef IShellWindows *(WINAPIFN_WinList_GetShellWindows) (BOOL)
 

Functions

static VOID TEST_WinList_GetShellWindows (VOID)
 
static VOID TEST_WinList_Mix (VOID)
 
static VOID TEST_SHDOCVW_WinList (VOID)
 
static VOID TEST_CLSID_ShellWindows (VOID)
 
 START_TEST (WinList)
 

Variables

static FN_WinList_Init g_pWinList_Init = NULL
 
static FN_WinList_Terminate g_pWinList_Terminate = NULL
 
static FN_WinList_GetShellWindows g_pWinList_GetShellWindows = NULL
 

Typedef Documentation

◆ FN_WinList_GetShellWindows

typedef IShellWindows *(WINAPI * FN_WinList_GetShellWindows) (BOOL)

Definition at line 13 of file WinList.cpp.

◆ FN_WinList_Init

typedef BOOL(WINAPI * FN_WinList_Init) (VOID)

Definition at line 11 of file WinList.cpp.

◆ FN_WinList_Terminate

typedef VOID(WINAPI * FN_WinList_Terminate) (VOID)

Definition at line 12 of file WinList.cpp.

Function Documentation

◆ START_TEST()

START_TEST ( WinList  )

Definition at line 148 of file WinList.cpp.

149{
150 HRESULT hrCoInit = CoInitialize(NULL);
151
154
155 if (SUCCEEDED(hrCoInit))
157}
static VOID TEST_SHDOCVW_WinList(VOID)
Definition: WinList.cpp:87
static VOID TEST_CLSID_ShellWindows(VOID)
Definition: WinList.cpp:114
#define NULL
Definition: types.h:112
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
#define SUCCEEDED(hr)
Definition: intsafe.h:50

◆ TEST_CLSID_ShellWindows()

static VOID TEST_CLSID_ShellWindows ( VOID  )
static

Definition at line 114 of file WinList.cpp.

115{
116 IShellWindows *pShellWindows1 = NULL;
117 CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
118 IID_IShellWindows, (LPVOID *)&pShellWindows1);
119 ok(pShellWindows1 != NULL, "pShellWindows1 was null\n");
120
121 IShellWindows *pShellWindows2 = NULL;
122 CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
123 IID_IShellWindows, (LPVOID *)&pShellWindows2);
124 ok(pShellWindows2 != NULL, "pShellWindows2 was null\n");
125
126 ok_ptr(pShellWindows1, pShellWindows2);
127
128 if (pShellWindows1)
129 {
130 LONG nCount = -1;
131 HRESULT hr = pShellWindows1->get_Count(&nCount);
132 ok_hex(hr, S_OK);
133 ok(nCount >= 0, "nCount was %ld\n", nCount);
134 trace("%ld\n", nCount);
135
136 pShellWindows1->Release();
137 }
138 else
139 {
140 ok_int(TRUE, FALSE);
141 ok_int(TRUE, FALSE);
142 }
143
144 if (pShellWindows2)
145 pShellWindows2->Release();
146}
#define ok_hex(expression, result)
Definition: atltest.h:94
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define ok_int(expression, result)
Definition: atltest.h:134
#define ok_ptr(expression, result)
Definition: atltest.h:108
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
long LONG
Definition: pedump.c:60
HRESULT hr
Definition: shlfolder.c:183

Referenced by START_TEST().

◆ TEST_SHDOCVW_WinList()

static VOID TEST_SHDOCVW_WinList ( VOID  )
static

Definition at line 87 of file WinList.cpp.

88{
89 HINSTANCE hSHDOCVW = LoadLibraryW(L"shdocvw.dll");
90 if (!hSHDOCVW)
91 {
92 skip("shdocvw.dll not loaded\n");
93 return;
94 }
95
100 {
101 skip("Some WinList_* functions not found: %p %p %p\n",
103 }
104 else
105 {
108 }
109
110 FreeLibrary(hSHDOCVW);
111}
BOOL(WINAPI * FN_WinList_Init)(VOID)
Definition: WinList.cpp:11
VOID(WINAPI * FN_WinList_Terminate)(VOID)
Definition: WinList.cpp:12
static VOID TEST_WinList_Mix(VOID)
Definition: WinList.cpp:67
static FN_WinList_Terminate g_pWinList_Terminate
Definition: WinList.cpp:16
static FN_WinList_GetShellWindows g_pWinList_GetShellWindows
Definition: WinList.cpp:17
static VOID TEST_WinList_GetShellWindows(VOID)
Definition: WinList.cpp:20
IShellWindows *(WINAPI * FN_WinList_GetShellWindows)(BOOL)
Definition: WinList.cpp:13
static FN_WinList_Init g_pWinList_Init
Definition: WinList.cpp:15
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
#define L(x)
Definition: ntvdm.h:50
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581

Referenced by START_TEST().

◆ TEST_WinList_GetShellWindows()

static VOID TEST_WinList_GetShellWindows ( VOID  )
static

Definition at line 20 of file WinList.cpp.

21{
23 ok_int(bInited, FALSE); // WinList_Init should fail because this process is not explorer.exe
24
25 IShellWindows *pShellWindows1 = g_pWinList_GetShellWindows(FALSE);
26 trace("%p\n", pShellWindows1);
27 ok(pShellWindows1 != NULL, "pShellWindows1 was null\n");
28
29 IShellWindows *pShellWindows2 = g_pWinList_GetShellWindows(FALSE);
30 trace("%p\n", pShellWindows2);
31 ok(pShellWindows2 != NULL, "pShellWindows2 was null\n");
32
33 IShellWindows *pShellWindows3 = g_pWinList_GetShellWindows(TRUE);
34 trace("%p\n", pShellWindows3);
35 ok(pShellWindows3 != NULL, "pShellWindows3 was null\n");
36
37 ok_ptr(pShellWindows1, pShellWindows2);
38 ok_ptr(pShellWindows2, pShellWindows3);
39
40 if (pShellWindows1)
41 {
42 LONG nCount = -1;
43 HRESULT hr = pShellWindows1->get_Count(&nCount);
44 ok_hex(hr, S_OK);
45 ok(nCount >= 0, "nCount was %ld\n", nCount);
46 trace("%ld\n", nCount);
47
48 pShellWindows1->Release();
49 }
50 else
51 {
54 }
55
56 if (pShellWindows2)
57 pShellWindows2->Release();
58
59 if (pShellWindows3)
60 pShellWindows3->Release();
61
62 if (bInited && g_pWinList_Terminate)
64}
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by TEST_SHDOCVW_WinList().

◆ TEST_WinList_Mix()

static VOID TEST_WinList_Mix ( VOID  )
static

Definition at line 67 of file WinList.cpp.

68{
69 IShellWindows *pShellWindows1 = g_pWinList_GetShellWindows(FALSE);
70 trace("%p\n", pShellWindows1);
71 ok(pShellWindows1 != NULL, "pShellWindows1 was null\n");
72
73 IShellWindows *pShellWindows2 = NULL;
74 CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
75 IID_IShellWindows, (LPVOID *)&pShellWindows2);
76 ok(pShellWindows2 != NULL, "pShellWindows2 was null\n");
77
78 ok_ptr(pShellWindows1, pShellWindows2);
79
80 if (pShellWindows1)
81 pShellWindows1->Release();
82 if (pShellWindows2)
83 pShellWindows2->Release();
84}

Referenced by TEST_SHDOCVW_WinList().

Variable Documentation

◆ g_pWinList_GetShellWindows

FN_WinList_GetShellWindows g_pWinList_GetShellWindows = NULL
static

◆ g_pWinList_Init

FN_WinList_Init g_pWinList_Init = NULL
static

Definition at line 15 of file WinList.cpp.

Referenced by TEST_SHDOCVW_WinList(), and TEST_WinList_GetShellWindows().

◆ g_pWinList_Terminate

FN_WinList_Terminate g_pWinList_Terminate = NULL
static

Definition at line 16 of file WinList.cpp.

Referenced by TEST_SHDOCVW_WinList(), and TEST_WinList_GetShellWindows().