ReactOS 0.4.16-dev-2332-g4cba65d
compobj.c
Go to the documentation of this file.
1/*
2 * Component Object Tests
3 *
4 * Copyright 2005 Robert Shearman
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22#define CONST_VTABLE
23
24#include <stdarg.h>
25#include <stdio.h>
26
27#include "windef.h"
28#include "winbase.h"
29#define USE_COM_CONTEXT_DEF
30#include "objbase.h"
31#include "shlguid.h"
32#include "urlmon.h" /* for CLSID_FileProtocol */
33#include "dde.h"
34#include "cguid.h"
35
36#include "ctxtcall.h"
37
38#include "wine/test.h"
39#include "winternl.h"
40#include "initguid.h"
41
42#define DEFINE_EXPECT(func) \
43 static BOOL expect_ ## func = FALSE; static unsigned int called_ ## func = 0
44
45#define SET_EXPECT(func) \
46 expect_ ## func = TRUE
47
48#define CHECK_EXPECT2(func) \
49 do { \
50 ok(expect_ ##func, "unexpected call " #func "\n"); \
51 called_ ## func++; \
52 }while(0)
53
54#define CHECK_EXPECT(func) \
55 do { \
56 CHECK_EXPECT2(func); \
57 expect_ ## func = FALSE; \
58 }while(0)
59
60#define CHECK_CALLED(func, n) \
61 do { \
62 ok(called_ ## func == n, "expected " #func " called %u times, got %u\n", n, called_ ## func); \
63 expect_ ## func = FALSE; \
64 called_ ## func = 0; \
65 }while(0)
66
67DEFINE_EXPECT(CreateStub);
68DEFINE_EXPECT(PreInitialize);
69DEFINE_EXPECT(PostInitialize);
70DEFINE_EXPECT(PreUninitialize);
71DEFINE_EXPECT(PostUninitialize);
72
73/* functions that are not present on all versions of Windows */
74static HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv);
75static HRESULT (WINAPI * pCoSwitchCallContext)(IUnknown *pObject, IUnknown **ppOldObject);
76static HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token);
77static HRESULT (WINAPI * pCoGetApartmentType)(APTTYPE *type, APTTYPEQUALIFIER *qualifier);
78static HRESULT (WINAPI * pCoIncrementMTAUsage)(CO_MTA_USAGE_COOKIE *cookie);
79static HRESULT (WINAPI * pCoDecrementMTAUsage)(CO_MTA_USAGE_COOKIE cookie);
80static LONG (WINAPI * pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
81static LONG (WINAPI * pRegOverridePredefKey)(HKEY key, HKEY override);
82static HRESULT (WINAPI * pCoCreateInstanceFromApp)(REFCLSID clsid, IUnknown *outer, DWORD clscontext,
83 void *reserved, DWORD count, MULTI_QI *results);
84
85static BOOL (WINAPI *pIsWow64Process)(HANDLE, LPBOOL);
86
87#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
88#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %ld\n", cLocks)
89#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %ld\n", cLocks)
90
91static const CLSID CLSID_non_existent = { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
92static const CLSID CLSID_StdFont = { 0x0be35203, 0x8f91, 0x11ce, { 0x9d, 0xe3, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51 } };
93static const GUID IID_Testiface = { 0x22222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
94static const GUID IID_Testiface2 = { 0x32222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
95static const GUID IID_Testiface3 = { 0x42222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
96static const GUID IID_Testiface4 = { 0x52222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
97static const GUID IID_Testiface5 = { 0x62222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
98static const GUID IID_Testiface6 = { 0x72222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
99static const GUID IID_Testiface7 = { 0x82222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
100static const GUID IID_Testiface8 = { 0x92222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
101static const GUID IID_TestPS = { 0x66666666, 0x8888, 0x7777, { 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 } };
102
103DEFINE_GUID(CLSID_testclsid, 0xacd014c7,0x9535,0x4fac,0x8b,0x53,0xa4,0x8c,0xa7,0xf4,0xd7,0x26);
104
105static const WCHAR stdfont[] = {'S','t','d','F','o','n','t',0};
106static const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0};
107static const WCHAR wszCLSID_StdFont[] =
108{
109 '{','0','b','e','3','5','2','0','3','-','8','f','9','1','-','1','1','c','e','-',
110 '9','d','e','3','-','0','0','a','a','0','0','4','b','b','8','5','1','}',0
111};
112static const WCHAR progidW[] = {'P','r','o','g','I','d','.','P','r','o','g','I','d',0};
113static const WCHAR cf_brokenW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
114 'c','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}','a',0};
115
116DEFINE_GUID(IID_IWineTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd);
117DEFINE_GUID(CLSID_WineOOPTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd);
118
120
121static void LockModule(void)
122{
124}
125
126static void UnlockModule(void)
127{
129}
130
132 LPCLASSFACTORY iface,
133 REFIID riid,
134 LPVOID *ppvObj)
135{
136 if (ppvObj == NULL) return E_POINTER;
137
140 {
141 *ppvObj = iface;
142 IClassFactory_AddRef(iface);
143 return S_OK;
144 }
145
146 *ppvObj = NULL;
147 return E_NOINTERFACE;
148}
149
150static ULONG WINAPI Test_IClassFactory_AddRef(LPCLASSFACTORY iface)
151{
152 LockModule();
153 return 2; /* non-heap-based object */
154}
155
156static ULONG WINAPI Test_IClassFactory_Release(LPCLASSFACTORY iface)
157{
158 UnlockModule();
159 return 1; /* non-heap-based object */
160}
161
164 LPCLASSFACTORY iface,
165 IUnknown *pUnkOuter,
166 REFIID riid,
167 LPVOID *ppvObj)
168{
169 *ppvObj = NULL;
171 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
172 return E_NOINTERFACE;
173}
174
176 LPCLASSFACTORY iface,
177 BOOL fLock)
178{
179 return S_OK;
180}
181
182static const IClassFactoryVtbl TestClassFactory_Vtbl =
183{
189};
190
192
194
195static BOOL create_manifest_file(const char *filename, const char *manifest)
196{
197 int manifest_len;
198 DWORD size;
199 HANDLE file;
201
204
205 manifest_len = strlen(manifest);
208 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
210 return FALSE;
211 WriteFile(file, manifest, manifest_len, &size, NULL);
213
214 return TRUE;
215}
216
217static void extract_resource(const char *name, const char *type, const char *path)
218{
219 DWORD written;
220 HANDLE file;
221 HRSRC res;
222 void *ptr;
223
225 ok(file != INVALID_HANDLE_VALUE, "Failed to create a file at %s, error %ld.\n", path, GetLastError());
226
228 ok(res != 0, "Failed to find resource.\n");
231 ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write file.\n" );
233}
234
235static char testlib[MAX_PATH];
236
238{
240 ACTCTXW actctx;
242 BOOL ret;
243
244 create_manifest_file("file.manifest", manifest);
245
246 MultiByteToWideChar( CP_ACP, 0, "file.manifest", -1, path, MAX_PATH );
247 memset(&actctx, 0, sizeof(ACTCTXW));
248 actctx.cbSize = sizeof(ACTCTXW);
249 actctx.lpSource = path;
250
252 ok(handle != INVALID_HANDLE_VALUE || broken(handle == INVALID_HANDLE_VALUE) /* some old XP/2k3 versions */,
253 "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
255 {
256 win_skip("activation context generation failed, some tests will be skipped. Error %ld\n", GetLastError());
257 handle = NULL;
258 }
259
260 ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%ld\n", actctx.cbSize);
261 ok(actctx.dwFlags == 0, "actctx.dwFlags=%ld\n", actctx.dwFlags);
262 ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
263 ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
264 ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
265 ok(actctx.lpAssemblyDirectory == NULL, "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
266 ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
267 ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n", actctx.lpApplicationName);
268 ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
269
270 DeleteFileA("file.manifest");
271
272 if (handle)
273 {
275 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
276 }
277
278 return handle;
279}
280
282{
283 BOOL ret;
284
286 ok(ret, "Failed to deactivate context, error %ld.\n", GetLastError());
288}
289
290static const char actctx_manifest[] =
291"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
292"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
293" publicKeyToken=\"6595b6414666f1df\" />"
294"<file name=\"testlib.dll\">"
295" <comClass"
296" clsid=\"{0000033a-0000-0000-c000-000000000046}\""
297" progid=\"FTMarshal\""
298" />"
299" <comClass"
300" clsid=\"{5201163f-8164-4fd0-a1a2-5d5a3654d3bd}\""
301" progid=\"WineOOPTest\""
302" />"
303" <comClass description=\"Test com class\""
304" clsid=\"{12345678-1234-1234-1234-56789abcdef0}\""
305" progid=\"ProgId.ProgId\""
306" miscStatusIcon=\"recomposeonresize\""
307" />"
308" <comClass description=\"CustomFont Description\" clsid=\"{0be35203-8f91-11ce-9de3-00aa004bb851}\""
309" progid=\"CustomFont\""
310" miscStatusIcon=\"recomposeonresize\""
311" miscStatusContent=\"insideout\""
312" />"
313" <comClass description=\"StdFont Description\" clsid=\"{0be35203-8f91-11ce-9de3-00aa004bb852}\""
314" progid=\"StdFont\""
315" />"
316" <comClass clsid=\"{62222222-1234-1234-1234-56789abcdef0}\" >"
317" <progid>ProgId.ProgId.1</progid>"
318" </comClass>"
319" <comInterfaceProxyStub "
320" name=\"Iifaceps\""
321" iid=\"{22222222-1234-1234-1234-56789abcdef0}\""
322" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\""
323" />"
324" <comInterfaceProxyStub "
325" name=\"Iifaceps5\""
326" iid=\"{82222222-1234-1234-1234-56789abcdef0}\""
327" />"
328"</file>"
329" <comInterfaceExternalProxyStub "
330" name=\"Iifaceps2\""
331" iid=\"{32222222-1234-1234-1234-56789abcdef0}\""
332" />"
333" <comInterfaceExternalProxyStub "
334" name=\"Iifaceps3\""
335" iid=\"{42222222-1234-1234-1234-56789abcdef0}\""
336" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\""
337" />"
338" <comInterfaceExternalProxyStub "
339" name=\"Iifaceps4\""
340" iid=\"{52222222-1234-1234-1234-56789abcdef0}\""
341" proxyStubClsid32=\"{00000000-0000-0000-0000-000000000000}\""
342" />"
343" <clrClass "
344" clsid=\"{72222222-1234-1234-1234-56789abcdef0}\""
345" name=\"clrclass\""
346" >"
347" <progid>clrprogid.1</progid>"
348" </clrClass>"
349"</assembly>";
350
351static const char actctx_manifest2[] =
352"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
353"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
354" publicKeyToken=\"6595b6414666f1df\" />"
355"<file name=\"testlib.dll\">"
356" <comInterfaceProxyStub "
357" name=\"Testiface7\""
358" iid=\"{52222222-1234-1234-1234-56789abcdef0}\""
359" proxyStubClsid32=\"{82222222-1234-1234-1234-56789abcdef0}\""
360" threadingModel=\"Apartment\""
361" />"
362"</file>"
363"<file name=\"testlib4.dll\">"
364" <comInterfaceProxyStub "
365" name=\"Testiface8\""
366" iid=\"{92222222-1234-1234-1234-56789abcdef0}\""
367" threadingModel=\"Apartment\""
368" />"
369"</file>"
370" <comInterfaceExternalProxyStub "
371" name=\"Iifaceps3\""
372" iid=\"{42222222-1234-1234-1234-56789abcdef0}\""
373" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\""
374" />"
375"</assembly>";
376
377DEFINE_GUID(CLSID_Testclass, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0);
378
379static void test_ProgIDFromCLSID(void)
380{
381 ULONG_PTR cookie = 0;
384 HRESULT hr;
385
387 ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08lx\n", hr);
388 if (hr == S_OK)
389 {
390 ok(!lstrcmpiW(progid, stdfont), "Didn't get expected prog ID\n");
392 }
393
394 progid = (LPWSTR)0xdeadbeef;
396 ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08lx\n", hr);
397 ok(progid == NULL, "ProgIDFromCLSID returns with progid %p\n", progid);
398
400 ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08lx\n", hr);
401
403 {
404 static const WCHAR customfontW[] = {'C','u','s','t','o','m','F','o','n','t',0};
405
407 ok(hr == S_OK, "got 0x%08lx\n", hr);
408 ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid));
410
411 /* try something registered and redirected */
412 progid = NULL;
414 ok(hr == S_OK, "got 0x%08lx\n", hr);
415 ok(!lstrcmpiW(progid, customfontW), "got wrong progid %s\n", wine_dbgstr_w(progid));
417
418 /* classes without default progid, progid list is not used */
419 progid = (void *)0xdeadbeef;
421 ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08lx, progid %p\n", hr, progid);
422
423 progid = (void *)0xdeadbeef;
425 ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08lx, progid %p\n", hr, progid);
426
428 }
429}
430
431static void test_CLSIDFromProgID(void)
432{
433 ULONG_PTR cookie = 0;
435 CLSID clsid;
437 ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08lx\n", hr);
438 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
439
441 ok_ole_success(hr, "CLSIDFromString");
442 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
443
444 /* test some failure cases */
445
447 ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
448
450 ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
451
452 memset(&clsid, 0xcc, sizeof(clsid));
454 ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08lx\n", hr);
455 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n");
456
457 /* fails without proper context */
458 memset(&clsid, 0xcc, sizeof(clsid));
460 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
461 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n");
462
464 {
465 GUID clsid1;
466
467 memset(&clsid, 0xcc, sizeof(clsid));
469 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
470 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "should have zero CLSID on failure\n");
471
472 /* CLSIDFromString() doesn't check activation context */
474 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
475
478 ok(hr == S_OK, "got 0x%08lx\n", hr);
479 /* it returns generated CLSID here */
481 "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
482
483 /* duplicate progid present in context - returns generated guid here too */
486 ok(hr == S_OK, "got 0x%08lx\n", hr);
487 clsid1 = CLSID_StdFont;
488 /* that's where it differs from StdFont */
489 clsid1.Data4[7] = 0x52;
491 "got %s\n", wine_dbgstr_guid(&clsid));
492
494 }
495}
496
497static void test_CLSIDFromString(void)
498{
499 CLSID clsid;
500 WCHAR wszCLSID_Broken[50];
501 UINT i;
502
504 ok_ole_success(hr, "CLSIDFromString");
505 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
506
507 memset(&clsid, 0xab, sizeof(clsid));
509 ok(hr == S_OK, "got 0x%08lx\n", hr);
510 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
511
512 /* string is longer, but starts with a valid CLSID */
513 memset(&clsid, 0, sizeof(clsid));
515 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
517
518 lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont);
519 for(i = lstrlenW(wszCLSID_StdFont); i < 49; i++)
520 wszCLSID_Broken[i] = 'A';
521 wszCLSID_Broken[i] = '\0';
522
523 memset(&clsid, 0, sizeof(CLSID));
524 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
525 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
526 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
527
528 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A';
529 memset(&clsid, 0, sizeof(CLSID));
530 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
531 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
532 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
533
534 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0';
535 memset(&clsid, 0, sizeof(CLSID));
536 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
537 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
538 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
539
540 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0';
541 memset(&clsid, 0, sizeof(CLSID));
542 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
543 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
544 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
545
546 memset(&clsid, 0xcc, sizeof(CLSID));
547 hr = CLSIDFromString(wszCLSID_Broken+1, &clsid);
548 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
549 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
550
551 wszCLSID_Broken[9] = '*';
552 memset(&clsid, 0xcc, sizeof(CLSID));
553 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
554 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
555 ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %s\n", debugstr_guid(&clsid));
556 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
557
558 wszCLSID_Broken[3] = '*';
559 memset(&clsid, 0xcc, sizeof(CLSID));
560 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
561 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
562 ok(clsid.Data1 == 0xb, "Got %s\n", debugstr_guid(&clsid));
563 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
564
565 wszCLSID_Broken[3] = '\0';
566 memset(&clsid, 0xcc, sizeof(CLSID));
567 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
568 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
569 ok(clsid.Data1 == 0xb, "Got %s\n", debugstr_guid(&clsid));
570 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
571}
572
573static void test_IIDFromString(void)
574{
575 static const WCHAR cfW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
576 'c','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
577 static const WCHAR brokenW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
578 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
579 static const WCHAR broken2W[] = {'{','0','0','0','0','0','0','0','1','=','0','0','0','0','-','0','0','0','0','-',
580 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
581 static const WCHAR broken3W[] = {'b','r','o','k','e','n','0','0','1','=','0','0','0','0','-','0','0','0','0','-',
582 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
583 HRESULT hr;
584 IID iid;
585
587 ok(hr == S_OK, "got 0x%08lx\n", hr);
588 ok(IsEqualIID(&iid, &CLSID_StdFont), "got iid %s\n", wine_dbgstr_guid(&iid));
589
590 memset(&iid, 0xab, sizeof(iid));
591 hr = IIDFromString(NULL, &iid);
592 ok(hr == S_OK, "got 0x%08lx\n", hr);
593 ok(IsEqualIID(&iid, &CLSID_NULL), "got iid %s\n", wine_dbgstr_guid(&iid));
594
595 hr = IIDFromString(cfW, &iid);
596 ok(hr == S_OK, "got 0x%08lx\n", hr);
597 ok(IsEqualIID(&iid, &IID_IClassFactory), "got iid %s\n", wine_dbgstr_guid(&iid));
598
599 /* string starts with a valid IID but is longer */
600 memset(&iid, 0xab, sizeof(iid));
601 hr = IIDFromString(cf_brokenW, &iid);
602 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
603 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
604
605 /* invalid IID in a valid format */
606 memset(&iid, 0xab, sizeof(iid));
607 hr = IIDFromString(brokenW, &iid);
608 ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
609 ok(iid.Data1 == 0x00000001, "Got %s\n", debugstr_guid(&iid));
610
611 memset(&iid, 0xab, sizeof(iid));
612 hr = IIDFromString(broken2W, &iid);
613 ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
614 ok(iid.Data1 == 0x00000001, "Got %s\n", debugstr_guid(&iid));
615
616 /* format is broken, but string length is okay */
617 memset(&iid, 0xab, sizeof(iid));
618 hr = IIDFromString(broken3W, &iid);
619 ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
620 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
621
622 /* invalid string */
623 memset(&iid, 0xab, sizeof(iid));
625 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
626 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
627
628 /* valid ProgID */
629 memset(&iid, 0xab, sizeof(iid));
630 hr = IIDFromString(stdfont, &iid);
631 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
632 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
633}
634
635static void test_StringFromGUID2(void)
636{
637 WCHAR str[50];
638 int len;
639
640 /* invalid pointer */
641 SetLastError(0xdeadbeef);
643 ok(len == 0, "len: %d (expected 0)\n", len);
644 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %lx\n", GetLastError());
645
646 /* Test corner cases for buffer size */
648 ok(len == 39, "len: %d (expected 39)\n", len);
649 ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n");
650
651 memset(str,0,sizeof str);
653 ok(len == 39, "len: %d (expected 39)\n", len);
654 ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n");
655
657 ok(len == 0, "len: %d (expected 0)\n", len);
658
660 ok(len == 0, "len: %d (expected 0)\n", len);
661}
662
663#define test_apt_type(t, q) _test_apt_type(t, q, __LINE__)
664static void _test_apt_type(APTTYPE expected_type, APTTYPEQUALIFIER expected_qualifier, int line)
665{
667 APTTYPE type = ~0u;
668 HRESULT hr;
669
670 if (!pCoGetApartmentType)
671 return;
672
673 hr = pCoGetApartmentType(&type, &qualifier);
674 ok_(__FILE__, line)(hr == S_OK || (type == APTTYPE_CURRENT && hr == CO_E_NOTINITIALIZED),
675 "Unexpected hr %#lx.\n", hr);
676 ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
677 ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
678 expected_qualifier);
679}
680
681static void test_CoCreateInstance(void)
682{
683 HRESULT hr;
684 IUnknown *pUnk;
685 REFCLSID rclsid = &CLSID_InternetZoneManager;
686
687 pUnk = (IUnknown *)0xdeadbeef;
688 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
689 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
690 ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
691
693
694 /* test errors returned for non-registered clsids */
695 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
696 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
697 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
698 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
699 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
700 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
701 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
702 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
703
704 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
706 {
707 skip("IE not installed so can't test CoCreateInstance\n");
709 return;
710 }
711
712 ok_ole_success(hr, "CoCreateInstance");
713 if(pUnk) IUnknown_Release(pUnk);
715
716 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
717 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
718
719 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
720}
721
723{
724 ULONG size;
725 ULONG flags;
726 DWORD model;
727 GUID clsid;
728 GUID alias;
729 GUID clsid2;
730 GUID tlid;
742};
743
744static void test_CoGetClassObject(void)
745{
746 HRESULT hr;
749 IUnknown *pUnk;
750 REFCLSID rclsid = &CLSID_InternetZoneManager;
751 HKEY hkey;
752 LONG res;
753
754 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
755 ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
756 ok(pUnk == NULL, "CoGetClassObject should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
757
758 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, NULL);
759 ok(hr == E_INVALIDARG ||
760 broken(hr == CO_E_NOTINITIALIZED), /* win9x */
761 "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
762
763 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
764
765 if (!pRegOverridePredefKey)
766 {
767 win_skip("RegOverridePredefKey not available\n");
768 return;
769 }
770
772
773 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
774 if (hr == S_OK)
775 {
776 IUnknown_Release(pUnk);
777
778 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
779 KEY_ALL_ACCESS, NULL, &hkey, NULL);
780 ok(!res, "RegCreateKeyEx returned %ld\n", res);
781
782 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
783 ok(!res, "RegOverridePredefKey returned %ld\n", res);
784
785 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
786 ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08lx\n", hr);
787
788 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
789 ok(!res, "RegOverridePredefKey returned %ld\n", res);
790
791 if (hr == S_OK) IUnknown_Release(pUnk);
792 RegCloseKey(hkey);
793 }
794
795 hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
796 ok(hr == S_OK, "got 0x%08lx\n", hr);
797 IUnknown_Release(pUnk);
798
799 /* context redefines FreeMarshaler CLSID */
801 {
802 hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
803 ok(hr == S_OK, "got 0x%08lx\n", hr);
804 IUnknown_Release(pUnk);
805
806 hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
807 ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
808
809 hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
810 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
811
813 }
814
816 {
817 struct comclassredirect_data *comclass;
818 ACTCTX_SECTION_KEYED_DATA data;
819 BOOL ret;
820
821 /* This one will load test dll and get back specific error code. */
822 hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
823 ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
824
825 hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
826 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
827
828 memset(&data, 0, sizeof(data));
829 data.cbSize = sizeof(data);
830 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, &IID_Testiface8, &data);
831 ok(ret, "Section not found.\n");
832
833 memset(&data, 0, sizeof(data));
834 data.cbSize = sizeof(data);
835
836 /* External proxy-stubs are not accessible. */
837 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface3, &data);
838 ok(!ret, "Unexpected return value.\n");
839
840 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_TestPS, &data);
841 ok(!ret, "Unexpected return value.\n");
842
843 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface7, &data);
844 ok(ret, "Unexpected return value.\n");
845
846 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface4, &data);
847 ok(!ret, "Unexpected return value.\n");
848
849 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface8, &data);
850 ok(ret, "Unexpected return value.\n");
851
852 comclass = data.lpData;
853 if (comclass)
854 {
855 WCHAR *name = (WCHAR *)((char *)data.lpSectionBase + comclass->name_offset);
856 ok(!lstrcmpW(name, L"testlib4.dll"), "Unexpected module name %s.\n", wine_dbgstr_w(name));
857 }
858
860 }
861
863}
864
865static void test_CoCreateInstanceEx(void)
866{
867 MULTI_QI qi_res = { &IID_IMoniker };
869 HRESULT hr;
870
872
874 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
875 ok_ole_success(hr, "CoRegisterClassObject");
876
878 hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
879 ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08lx\n", hr);
880 ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
882
884 ok_ole_success(hr, "CoRevokeClassObject");
885
887}
888
890{
891 WNDCLASSA wc =
892 {
893 0,
895 0,
896 0,
898 NULL,
900 (HBRUSH)(COLOR_BTNFACE+1),
901 NULL,
902 "WineOleTestClass",
903 };
904
905 return RegisterClassA(&wc);
906}
907
908static void test_ole_menu(void)
909{
910 HWND hwndFrame;
911 HRESULT hr;
912
914 hr = OleSetMenuDescriptor(NULL, hwndFrame, NULL, NULL, NULL);
915 todo_wine ok_ole_success(hr, "OleSetMenuDescriptor");
916
917 DestroyWindow(hwndFrame);
918}
919
920
922{
923 if (ppvObj == NULL) return E_POINTER;
924
926 IsEqualGUID(riid, &IID_IMessageFilter))
927 {
928 *ppvObj = iface;
929 IMessageFilter_AddRef(iface);
930 return S_OK;
931 }
932
933 return E_NOINTERFACE;
934}
935
937{
938 return 2; /* non-heap object */
939}
940
942{
943 return 1; /* non-heap object */
944}
945
947 IMessageFilter *iface,
948 DWORD dwCallType,
949 HTASK threadIDCaller,
950 DWORD dwTickCount,
951 LPINTERFACEINFO lpInterfaceInfo)
952{
953 trace("HandleInComingCall\n");
954 return SERVERCALL_ISHANDLED;
955}
956
958 IMessageFilter *iface,
959 HTASK threadIDCallee,
960 DWORD dwTickCount,
961 DWORD dwRejectType)
962{
963 trace("RetryRejectedCall\n");
964 return 0;
965}
966
968 IMessageFilter *iface,
969 HTASK threadIDCallee,
970 DWORD dwTickCount,
971 DWORD dwPendingType)
972{
973 trace("MessagePending\n");
974 todo_wine ok(0, "unexpected call\n");
975 return PENDINGMSG_WAITNOPROCESS;
976}
977
978static const IMessageFilterVtbl MessageFilter_Vtbl =
979{
986};
987
989
991{
992 HRESULT hr;
993 IMessageFilter *prev_filter;
994
995 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
997 "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08lx\n",
998 hr);
999
1001 prev_filter = (IMessageFilter *)0xdeadbeef;
1002 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
1004 "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08lx\n",
1005 hr);
1006 ok(prev_filter == (IMessageFilter *)0xdeadbeef,
1007 "prev_filter should have been set to %p\n", prev_filter);
1009
1011
1013 ok_ole_success(hr, "CoRegisterMessageFilter");
1014
1015 prev_filter = (IMessageFilter *)0xdeadbeef;
1016 hr = CoRegisterMessageFilter(NULL, &prev_filter);
1017 ok_ole_success(hr, "CoRegisterMessageFilter");
1018 ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
1019
1020 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
1021 ok_ole_success(hr, "CoRegisterMessageFilter");
1022 ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
1023
1025 ok_ole_success(hr, "CoRegisterMessageFilter");
1026
1028}
1029
1031
1033{
1034 return IUnknown_QueryInterface(&Test_Unknown, riid, ppv);
1035}
1036
1038{
1039 return 2;
1040}
1041
1043{
1044 return 1;
1045}
1046
1047static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, OLEVERB *rgelt, ULONG *fetched)
1048{
1049 ok(0, "unexpected call\n");
1050 return E_NOTIMPL;
1051}
1052
1054{
1055 ok(0, "unexpected call\n");
1056 return E_NOTIMPL;
1057}
1058
1060{
1061 ok(0, "unexpected call\n");
1062 return E_NOTIMPL;
1063}
1064
1066{
1067 ok(0, "unexpected call\n");
1068 return E_NOTIMPL;
1069}
1070
1071static const IEnumOLEVERBVtbl EnumOLEVERBVtbl = {
1079};
1080
1082
1084 IUnknown *iface,
1085 REFIID riid,
1086 LPVOID *ppvObj)
1087{
1088 if (ppvObj == NULL) return E_POINTER;
1089
1091 *ppvObj = iface;
1092 }else if(IsEqualIID(riid, &IID_IEnumOLEVERB)) {
1093 *ppvObj = &EnumOLEVERB;
1094 }else {
1095 *ppvObj = NULL;
1096 return E_NOINTERFACE;
1097 }
1098
1099 IUnknown_AddRef((IUnknown*)*ppvObj);
1100 return S_OK;
1101}
1102
1104{
1105 return 2; /* non-heap-based object */
1106}
1107
1109{
1110 return 1; /* non-heap-based object */
1111}
1112
1113static const IUnknownVtbl TestUnknown_Vtbl =
1114{
1118};
1119
1121
1123
1126 /* [in] */ REFIID riid,
1127 /* [iid_is][out] */ void **ppvObject)
1128{
1129 if (IsEqualIID(riid, &IID_IUnknown) ||
1130 IsEqualIID(riid, &IID_IPSFactoryBuffer))
1131 {
1132 *ppvObject = This;
1133 IPSFactoryBuffer_AddRef(This);
1134 return S_OK;
1135 }
1136 return E_NOINTERFACE;
1137}
1138
1141{
1142 return 2;
1143}
1144
1147{
1148 return 1;
1149}
1150
1153 /* [in] */ IUnknown *pUnkOuter,
1154 /* [in] */ REFIID riid,
1155 /* [out] */ IRpcProxyBuffer **ppProxy,
1156 /* [out] */ void **ppv)
1157{
1158 return E_NOTIMPL;
1159}
1160
1163 /* [in] */ REFIID riid,
1164 /* [unique][in] */ IUnknown *pUnkServer,
1165 /* [out] */ IRpcStubBuffer **ppStub)
1166{
1167 CHECK_EXPECT(CreateStub);
1168
1169 ok(pUnkServer == &Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer);
1171 return E_NOTIMPL;
1172
1173 return IPSFactoryBuffer_CreateStub(ps_factory_buffer, &IID_IEnumOLEVERB, pUnkServer, ppStub);
1174}
1175
1176static IPSFactoryBufferVtbl PSFactoryBufferVtbl =
1177{
1183};
1184
1186
1188{
1189 0x52011640,
1190 0x8164,
1191 0x4fd0,
1192 {0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd}
1193}; /* 52011640-8164-4fd0-a1a2-5d5a3654d3bd */
1194
1196{
1197 HRESULT hr;
1198 CLSID clsid = {0};
1199
1201
1203 ok_ole_success(hr, "CoGetPSClsid");
1204 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1206
1207 /* test registering a PSClsid in an apartment which is then destroyed */
1209 ok_ole_success(hr, "CoRegisterPSClsid");
1210
1212
1213 return hr;
1214}
1215
1216static void test_CoRegisterPSClsid(void)
1217{
1218 HRESULT hr;
1219 DWORD dwRegistrationKey;
1220 IStream *stream;
1221 CLSID clsid;
1222 HANDLE thread;
1223 DWORD tid;
1224
1226 ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
1227
1229
1231 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegistrationKey);
1232 ok_ole_success(hr, "CoRegisterClassObject");
1233
1235 ok_ole_success(hr, "CoRegisterPSClsid");
1236
1238 ok_ole_success(hr, "CoGetPSClsid");
1239 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1241
1243 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1244 ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1246
1248 ok_ole_success(hr, "CoGetPSClsid");
1249 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1251
1253 ok_ole_success(hr, "CreateStreamOnHGlobal");
1254
1255 SET_EXPECT(CreateStub);
1256 hr = CoMarshalInterface(stream, &IID_IWineTest, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1257 ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
1258 CHECK_CALLED(CreateStub, 1);
1259
1261 ok_ole_success(hr, "CoGetPSClsid");
1262
1263 hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&ps_factory_buffer);
1264 ok_ole_success(hr, "CoGetClassObject");
1265
1267 ok_ole_success(hr, "CoRegisterPSClsid");
1268
1269 SET_EXPECT(CreateStub);
1270 hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, (IUnknown*)&EnumOLEVERB, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1271 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
1272 CHECK_CALLED(CreateStub, 1);
1273
1274 hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1275 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
1276
1277 IStream_Release(stream);
1278 IPSFactoryBuffer_Release(ps_factory_buffer);
1280
1281 hr = CoRevokeClassObject(dwRegistrationKey);
1282 ok_ole_success(hr, "CoRevokeClassObject");
1283
1285
1287
1289 ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08lx\n", hr);
1290
1292 ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08lx\n", hr);
1293
1295
1297
1299 ok_ole_success(hr, "CoRegisterPSClsid");
1300
1302 ok_ole_success(hr, "CoGetPSClsid");
1303 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1305
1307 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1308 ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1310
1312 ok_ole_success(hr, "CoGetPSClsid");
1313 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1315
1317}
1318
1319static void test_CoGetPSClsid(void)
1320{
1322 HANDLE handle;
1323 HRESULT hr;
1324 CLSID clsid;
1325 HKEY hkey;
1326 LONG res;
1327 const BOOL is_win64 = (sizeof(void*) != sizeof(int));
1329
1332 "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n",
1333 hr);
1334
1336
1338 ok_ole_success(hr, "CoGetPSClsid");
1339
1342 "CoGetPSClsid for random IID returned 0x%08lx instead of REGDB_E_IIDNOTREG\n",
1343 hr);
1344
1346 ok(hr == E_INVALIDARG,
1347 "CoGetPSClsid for null clsid returned 0x%08lx instead of E_INVALIDARG\n",
1348 hr);
1349
1350 if (!pRegOverridePredefKey)
1351 {
1352 win_skip("RegOverridePredefKey not available\n");
1354 return;
1355 }
1357 ok_ole_success(hr, "CoGetPSClsid");
1358
1359 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
1360 KEY_ALL_ACCESS, NULL, &hkey, NULL);
1361 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1362
1363 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
1364 ok(!res, "RegOverridePredefKey returned %ld\n", res);
1365
1367 ok_ole_success(hr, "CoGetPSClsid");
1368
1369 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
1370 ok(!res, "RegOverridePredefKey returned %ld\n", res);
1371
1372 RegCloseKey(hkey);
1373
1374 /* not registered CLSID */
1376 ok(hr == REGDB_E_IIDNOTREG, "got 0x%08lx\n", hr);
1377
1379 {
1380 memset(&clsid, 0, sizeof(clsid));
1382 ok(hr == S_OK, "got 0x%08lx\n", hr);
1383 ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1384
1385 memset(&clsid, 0, sizeof(clsid));
1387 ok(hr == S_OK, "got 0x%08lx\n", hr);
1388 ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1389
1390 memset(&clsid, 0, sizeof(clsid));
1392 ok(hr == S_OK, "got 0x%08lx\n", hr);
1393 ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1394
1395 memset(&clsid, 0xaa, sizeof(clsid));
1397 ok(hr == S_OK, "got 0x%08lx\n", hr);
1398 ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1399
1400 memset(&clsid, 0xaa, sizeof(clsid));
1402 ok(hr == S_OK, "Failed to get PS CLSID, hr %#lx.\n", hr);
1403 ok(IsEqualGUID(&clsid, &IID_Testiface7), "Unexpected CLSID %s.\n", wine_dbgstr_guid(&clsid));
1404
1405 /* register same interface and try to get CLSID back */
1407 ok(hr == S_OK, "got 0x%08lx\n", hr);
1408 memset(&clsid, 0, sizeof(clsid));
1410 ok(hr == S_OK, "got 0x%08lx\n", hr);
1411 ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1412
1414 }
1415
1416 if (pRegDeleteKeyExA &&
1417 (is_win64 ||
1418 (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
1419 {
1420 static GUID IID_DeadBeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
1421 static const char clsidDeadBeef[] = "{deadbeef-dead-beef-dead-beefdeadbeef}";
1422 static const char clsidA[] = "{66666666-8888-7777-6666-555555555555}";
1423 HKEY hkey_iface, hkey_psclsid;
1425
1426 hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1427 ok(hr == REGDB_E_IIDNOTREG, "got 0x%08lx\n", hr);
1428
1429 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
1430 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
1431 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1432 res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
1433 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
1434 if (res == ERROR_ACCESS_DENIED)
1435 {
1436 win_skip("Failed to create a key, skipping some of CoGetPSClsid() tests\n");
1437 goto cleanup;
1438 }
1439
1440 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1441 res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
1442 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
1443 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1444 res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
1445 ok(!res, "RegSetValueEx returned %ld\n", res);
1446 RegCloseKey(hkey_psclsid);
1447
1448 hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1449 ok_ole_success(hr, "CoGetPSClsid");
1450 ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1451
1452 res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
1453 ok(!res, "RegDeleteKeyEx returned %ld\n", res);
1454 RegCloseKey(hkey);
1455 res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
1456 ok(!res, "RegDeleteKeyEx returned %ld\n", res);
1457
1458 cleanup:
1459 RegCloseKey(hkey_iface);
1460 }
1461
1463}
1464
1465/* basic test, mainly for invalid arguments. see marshal.c for more */
1467{
1468 IUnknown *pProxy;
1469 IStream *pStream;
1470 HRESULT hr;
1471
1472 hr = CoUnmarshalInterface(NULL, &IID_IUnknown, (void **)&pProxy);
1473 ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1474
1475 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1476 ok_ole_success(hr, "CreateStreamOnHGlobal");
1477
1478 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
1479 todo_wine
1480 ok(hr == CO_E_NOTINITIALIZED, "CoUnmarshalInterface should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
1481
1483
1484 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
1485 ok(hr == STG_E_READFAULT, "CoUnmarshalInterface should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
1486
1488
1490 ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1491
1492 IStream_Release(pStream);
1493}
1494
1496{
1497 HRESULT hr;
1498 IUnknown *pUnk;
1499
1501
1503 ok(hr == E_INVALIDARG, "hr %08lx\n", hr);
1504
1506}
1507
1508/* basic test, mainly for invalid arguments. see marshal.c for more */
1510{
1511 IStream *pStream;
1512 HRESULT hr;
1513 static const LARGE_INTEGER llZero;
1514
1516
1517 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1518 ok_ole_success(hr, "CreateStreamOnHGlobal");
1519
1520 hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1521 ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1522
1523 hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1524 ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1525
1526 hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1527 ok_ole_success(hr, "CoMarshalInterface");
1528
1529 /* stream not rewound */
1530 hr = CoReleaseMarshalData(pStream);
1531 ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
1532
1533 hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
1534 ok_ole_success(hr, "IStream_Seek");
1535
1536 hr = CoReleaseMarshalData(pStream);
1537 ok_ole_success(hr, "CoReleaseMarshalData");
1538
1539 IStream_Release(pStream);
1540
1542}
1543
1545{
1546 IStream *pStream;
1547 HRESULT hr;
1548 IClassFactory *pProxy;
1549
1551
1552 cLocks = 0;
1553
1555 ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1556
1558 ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1559
1560 ok_no_locks();
1561
1563 ok_ole_success(hr, "CoMarshalInterThreadInterfaceInStream");
1564
1566
1567 hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
1568 ok_ole_success(hr, "CoUnmarshalInterface");
1569
1570 IClassFactory_Release(pProxy);
1571 IStream_Release(pStream);
1572
1573 ok_no_locks();
1574
1576}
1577
1579{
1580 ULONG_PTR ctxcookie;
1581 HANDLE handle;
1582 DWORD cookie;
1583 HRESULT hr;
1584 IClassFactory *pcf;
1585
1587
1588 /* CLSCTX_INPROC_SERVER */
1590 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1591 ok_ole_success(hr, "CoRegisterClassObject");
1593 ok_ole_success(hr, "CoRevokeClassObject");
1594
1596 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1597 ok_ole_success(hr, "CoRegisterClassObject");
1599 ok_ole_success(hr, "CoRevokeClassObject");
1600
1602 CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1603 ok_ole_success(hr, "CoRegisterClassObject");
1605 ok_ole_success(hr, "CoRevokeClassObject");
1606
1607 /* CLSCTX_LOCAL_SERVER */
1609 CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1610 ok_ole_success(hr, "CoRegisterClassObject");
1612 ok_ole_success(hr, "CoRevokeClassObject");
1613
1615 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1616 ok_ole_success(hr, "CoRegisterClassObject");
1618 ok_ole_success(hr, "CoRevokeClassObject");
1619
1621 CLSCTX_LOCAL_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1622 ok_ole_success(hr, "CoRegisterClassObject");
1624 ok_ole_success(hr, "CoRevokeClassObject");
1625
1626 /* CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER */
1628 CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1629 ok_ole_success(hr, "CoRegisterClassObject");
1631 ok_ole_success(hr, "CoRevokeClassObject");
1632
1633 /* test whether an object that doesn't support IClassFactory can be
1634 * registered for CLSCTX_LOCAL_SERVER */
1636 CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1637 ok_ole_success(hr, "CoRegisterClassObject");
1639 ok_ole_success(hr, "CoRevokeClassObject");
1640
1641 /* test whether registered class becomes invalid when apartment is destroyed */
1643 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1644 ok_ole_success(hr, "CoRegisterClassObject");
1645
1648
1649 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL,
1650 &IID_IClassFactory, (void **)&pcf);
1651 ok(hr == REGDB_E_CLASSNOTREG, "object registered in an apartment shouldn't accessible after it is destroyed\n");
1652
1653 /* crashes with at least win9x DCOM! */
1654 if (0)
1656
1657 /* test that object is accessible */
1660 ok(hr == S_OK, "got 0x%08lx\n", hr);
1661
1662 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1663 ok(hr == S_OK, "got 0x%08lx\n", hr);
1664 IClassFactory_Release(pcf);
1665
1666 /* context now contains CLSID_WineOOPTest, test if registered one could still be used */
1667 if ((handle = activate_context(actctx_manifest, &ctxcookie)))
1668 {
1669 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1670 ok(hr == 0x80001234 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
1671
1672 deactivate_context(handle, ctxcookie);
1673 }
1674
1675 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1676 ok(hr == S_OK, "got 0x%08lx\n", hr);
1677 IClassFactory_Release(pcf);
1678
1680 ok(hr == S_OK, "got 0x%08lx\n", hr);
1681
1683}
1684
1685static HRESULT get_class_object(CLSCTX clsctx)
1686{
1687 HRESULT hr;
1688 IClassFactory *pcf;
1689
1691 (void **)&pcf);
1692
1693 if (SUCCEEDED(hr))
1694 IClassFactory_Release(pcf);
1695
1696 return hr;
1697}
1698
1700{
1701 CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1702 HRESULT hr;
1703
1705
1706 hr = get_class_object(clsctx);
1707
1709
1710 return hr;
1711}
1712
1714{
1715 CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1716 HRESULT hr;
1717 IClassFactory *pcf;
1718 IMultiQI *pMQI;
1719
1721
1723 (void **)&pcf);
1724
1725 if (SUCCEEDED(hr))
1726 {
1727 hr = IClassFactory_QueryInterface(pcf, &IID_IMultiQI, (void **)&pMQI);
1728 if (SUCCEEDED(hr))
1729 IMultiQI_Release(pMQI);
1730 IClassFactory_Release(pcf);
1731 }
1732
1734
1735 return hr;
1736}
1737
1739{
1740 HRESULT hr;
1741 DWORD cookie;
1742
1744
1746 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1747
1749
1750 return hr;
1751}
1752
1754{
1755 DWORD cookie = (DWORD_PTR)pv;
1756 HRESULT hr;
1757
1759
1761
1763
1764 return hr;
1765}
1766
1768{
1769 HRESULT hr;
1770 DWORD cookie;
1771 HANDLE thread;
1772 DWORD tid;
1773 DWORD exitcode;
1774
1776
1777 /* CLSCTX_INPROC_SERVER */
1778
1780 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1781 ok_ole_success(hr, "CoRegisterClassObject");
1782
1783 thread = CreateThread(NULL, 0, get_class_object_thread, (LPVOID)CLSCTX_INPROC_SERVER, 0, &tid);
1784 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1785 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1786 GetExitCodeThread(thread, &exitcode);
1787 hr = exitcode;
1788 ok(hr == REGDB_E_CLASSNOTREG, "CoGetClassObject on inproc object "
1789 "registered in different thread should return REGDB_E_CLASSNOTREG "
1790 "instead of 0x%08lx\n", hr);
1791
1792 hr = get_class_object(CLSCTX_INPROC_SERVER);
1793 ok(hr == S_OK, "CoGetClassObject on inproc object registered in same "
1794 "thread should return S_OK instead of 0x%08lx\n", hr);
1795
1797 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1798 ok ( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1799 GetExitCodeThread(thread, &exitcode);
1800 hr = exitcode;
1801 ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different thread should return S_OK instead of 0x%08lx\n", hr);
1802
1804 ok_ole_success(hr, "CoRevokeClassObject");
1805
1806 /* CLSCTX_LOCAL_SERVER */
1807
1809 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1810 ok_ole_success(hr, "CoRegisterClassObject");
1811
1812 thread = CreateThread(NULL, 0, get_class_object_proxy_thread, (LPVOID)CLSCTX_LOCAL_SERVER, 0, &tid);
1813 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1815 {
1816 MSG msg;
1817 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
1818 {
1821 }
1822 }
1823 GetExitCodeThread(thread, &exitcode);
1824 hr = exitcode;
1825 ok(hr == S_OK, "CoGetClassObject on local server object "
1826 "registered in different thread should return S_OK "
1827 "instead of 0x%08lx\n", hr);
1828
1829 hr = get_class_object(CLSCTX_LOCAL_SERVER);
1830 ok(hr == S_OK, "CoGetClassObject on local server object registered in same "
1831 "thread should return S_OK instead of 0x%08lx\n", hr);
1832
1834 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1835 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1836 GetExitCodeThread(thread, &exitcode);
1837 hr = exitcode;
1838 ok(hr == RPC_E_WRONG_THREAD || broken(hr == S_OK) /* win8 */, "CoRevokeClassObject called from different "
1839 "thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08lx\n", hr);
1840
1842 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1843 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1844 GetExitCodeThread(thread, &exitcode);
1845 hr = exitcode;
1846 ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different "
1847 "thread should return S_OK instead of 0x%08lx\n", hr);
1848
1850 ok_ole_success(hr, "CoRevokeClassObject");
1851
1853}
1854
1856{
1858 return 0;
1859}
1860
1861static inline BOOL is_module_loaded(const char *module)
1862{
1863 return GetModuleHandleA(module) != 0;
1864}
1865
1867{
1868 HRESULT hr;
1869 IUnknown *pUnk;
1870 DWORD tid;
1871 HANDLE thread;
1872
1874
1875 ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1876
1877 hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
1878 if (hr == REGDB_E_CLASSNOTREG)
1879 {
1880 skip("IE not installed so can't run CoFreeUnusedLibraries test\n");
1882 return;
1883 }
1884 ok_ole_success(hr, "CoCreateInstance");
1885
1886 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1887
1888 ok(pUnk != NULL ||
1889 broken(pUnk == NULL), /* win9x */
1890 "Expected a valid pointer\n");
1891 if (pUnk)
1892 IUnknown_Release(pUnk);
1893
1894 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1895
1897 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1899
1900 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1901
1903
1904 ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1905
1907}
1908
1910{
1911 HRESULT hr;
1912 ULONG refs;
1913 IComThreadingInfo *pComThreadingInfo, *threadinginfo2;
1914 IContextCallback *pContextCallback;
1915 IObjContext *pObjContext;
1916 APTTYPE apttype;
1917 THDTYPE thdtype;
1918 GUID id, id2;
1919
1920 if (!pCoGetObjectContext)
1921 {
1922 win_skip("CoGetObjectContext not present\n");
1923 return;
1924 }
1925
1926 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1927 ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
1928 ok(pComThreadingInfo == NULL, "pComThreadingInfo should have been set to NULL\n");
1929
1931
1933
1934 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1935 ok_ole_success(hr, "CoGetObjectContext");
1936
1937 threadinginfo2 = NULL;
1938 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&threadinginfo2);
1939 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
1940 ok(pComThreadingInfo == threadinginfo2, "got different instance\n");
1941 IComThreadingInfo_Release(threadinginfo2);
1942
1943 hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, NULL);
1944 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1945
1946 id = id2 = GUID_NULL;
1947 hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, &id);
1948 ok(hr == S_OK, "got 0x%08lx\n", hr);
1949
1951 ok(IsEqualGUID(&id, &id2), "got %s, expected %s\n", wine_dbgstr_guid(&id), wine_dbgstr_guid(&id2));
1952
1953 hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1954 ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1955 ok(apttype == APTTYPE_MAINSTA, "apartment type should be APTTYPE_MAINSTA instead of %d\n", apttype);
1956
1957 hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1958 ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1959 ok(thdtype == THDTYPE_PROCESSMESSAGES, "thread type should be THDTYPE_PROCESSMESSAGES instead of %d\n", thdtype);
1960
1961 refs = IComThreadingInfo_Release(pComThreadingInfo);
1962 ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %ld refs\n", refs);
1963
1964 hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1965 ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1966
1967 refs = IContextCallback_Release(pContextCallback);
1968 ok(refs == 0, "pContextCallback should have 0 refs instead of %ld refs\n", refs);
1969
1971
1973
1974 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1975 ok_ole_success(hr, "CoGetObjectContext");
1976
1977 hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1978 ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1979 ok(apttype == APTTYPE_MTA, "apartment type should be APTTYPE_MTA instead of %d\n", apttype);
1980
1981 hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1982 ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1983 ok(thdtype == THDTYPE_BLOCKMESSAGES, "thread type should be THDTYPE_BLOCKMESSAGES instead of %d\n", thdtype);
1984
1985 refs = IComThreadingInfo_Release(pComThreadingInfo);
1986 ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %ld refs\n", refs);
1987
1988 hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1989 ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1990
1991 refs = IContextCallback_Release(pContextCallback);
1992 ok(refs == 0, "pContextCallback should have 0 refs instead of %ld refs\n", refs);
1993
1994 hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext);
1995 ok_ole_success(hr, "CoGetObjectContext");
1996
1997 refs = IObjContext_Release(pObjContext);
1998 ok(refs == 0, "pObjContext should have 0 refs instead of %ld refs\n", refs);
1999
2001}
2002
2003typedef struct {
2007
2009{
2010 return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface);
2011}
2012
2014 IUnknown *iface,
2015 REFIID riid,
2016 LPVOID *ppvObj)
2017{
2018 if (ppvObj == NULL) return E_POINTER;
2019
2021 {
2022 *ppvObj = iface;
2023 IUnknown_AddRef(iface);
2024 return S_OK;
2025 }
2026
2027 *ppvObj = NULL;
2028 return E_NOINTERFACE;
2029}
2030
2032{
2034 return InterlockedIncrement(&This->refs);
2035}
2036
2038{
2040 ULONG refs = InterlockedDecrement(&This->refs);
2041 if (!refs)
2042 free(This);
2043 return refs;
2044}
2045
2046static const IUnknownVtbl TestCallContext_Vtbl =
2047{
2051};
2052
2053static void test_CoGetCallContext(void)
2054{
2055 HRESULT hr;
2056 ULONG refs;
2057 IUnknown *pUnk;
2059
2060 if (!pCoSwitchCallContext)
2061 {
2062 skip("CoSwitchCallContext not present\n");
2063 return;
2064 }
2065
2067
2069 test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl;
2070 test_object->refs = 1;
2071
2072 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2073 ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08lx\n", hr);
2074
2075 pUnk = (IUnknown*)0xdeadbeef;
2076 hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk);
2077 ok_ole_success(hr, "CoSwitchCallContext");
2078 ok(pUnk == NULL, "expected NULL, got %p\n", pUnk);
2079 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2080 ok(refs == 2, "Expected refcount 2, got %ld\n", refs);
2081 IUnknown_Release(&test_object->IUnknown_iface);
2082
2083 pUnk = (IUnknown*)0xdeadbeef;
2084 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2085 ok_ole_success(hr, "CoGetCallContext");
2086 ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
2087 &test_object->IUnknown_iface, pUnk);
2088 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2089 ok(refs == 3, "Expected refcount 3, got %ld\n", refs);
2090 IUnknown_Release(&test_object->IUnknown_iface);
2091 IUnknown_Release(pUnk);
2092
2093 pUnk = (IUnknown*)0xdeadbeef;
2094 hr = pCoSwitchCallContext(NULL, &pUnk);
2095 ok_ole_success(hr, "CoSwitchCallContext");
2096 ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
2097 &test_object->IUnknown_iface, pUnk);
2098 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2099 ok(refs == 2, "Expected refcount 2, got %ld\n", refs);
2100 IUnknown_Release(&test_object->IUnknown_iface);
2101
2102 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2103 ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08lx\n", hr);
2104
2105 IUnknown_Release(&test_object->IUnknown_iface);
2106
2108}
2109
2110static void test_CoGetContextToken(void)
2111{
2112 HRESULT hr;
2113 ULONG refs;
2114 ULONG_PTR token, token2;
2116
2117 if (!pCoGetContextToken)
2118 {
2119 win_skip("CoGetContextToken not present\n");
2120 return;
2121 }
2122
2123 token = 0xdeadbeef;
2124 hr = pCoGetContextToken(&token);
2125 ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08lx\n", hr);
2126 ok(token == 0xdeadbeef, "Expected 0, got 0x%Ix\n", token);
2127
2128 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
2129
2131
2133
2134 hr = pCoGetContextToken(NULL);
2135 ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08lx\n", hr);
2136
2137 token = 0;
2138 hr = pCoGetContextToken(&token);
2139 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2140 ok(token, "Expected token != 0\n");
2141
2142 token2 = 0;
2143 hr = pCoGetContextToken(&token2);
2144 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2145 ok(token2 == token, "got different token\n");
2146
2147 refs = IUnknown_AddRef((IUnknown *)token);
2148 ok(refs == 1, "Expected 1, got %lu\n", refs);
2149
2150 hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
2151 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2152 ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2153
2154 refs = IObjContext_AddRef(ctx);
2155 ok(refs == 3, "Expected 3, got %lu\n", refs);
2156
2157 refs = IObjContext_Release(ctx);
2158 ok(refs == 2, "Expected 2, got %lu\n", refs);
2159
2160 refs = IUnknown_Release((IUnknown *)token);
2161 ok(refs == 1, "Expected 1, got %lu\n", refs);
2162
2163 /* CoGetContextToken does not add a reference */
2164 token = 0;
2165 hr = pCoGetContextToken(&token);
2166 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2167 ok(token, "Expected token != 0\n");
2168 ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2169
2170 refs = IObjContext_AddRef(ctx);
2171 ok(refs == 2, "Expected 1, got %lu\n", refs);
2172
2173 refs = IObjContext_Release(ctx);
2174 ok(refs == 1, "Expected 0, got %lu\n", refs);
2175
2176 refs = IObjContext_Release(ctx);
2177 ok(refs == 0, "Expected 0, got %lu\n", refs);
2178
2180}
2181
2182static void test_TreatAsClass(void)
2183{
2184 HRESULT hr;
2185 CLSID out;
2186 static GUID deadbeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
2187 static const char deadbeefA[] = "{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}";
2188 IInternetProtocol *pIP = NULL;
2189 HKEY clsidkey, deadbeefkey;
2190 LONG lr;
2191
2192 hr = CoGetTreatAsClass(&deadbeef,&out);
2193 ok (hr == S_FALSE, "expected S_FALSE got %lx\n",hr);
2194 ok (IsEqualGUID(&out,&deadbeef), "expected to get same clsid back\n");
2195
2197 ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
2198 ok(IsEqualGUID(&out, &deadbeef), "expected no change to the clsid\n");
2199
2200 hr = CoGetTreatAsClass(&deadbeef, NULL);
2201 ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
2202
2203 lr = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &clsidkey);
2204 ok(!lr, "Couldn't open CLSID key, error %ld\n", lr);
2205
2206 lr = RegCreateKeyExA(clsidkey, deadbeefA, 0, NULL, 0, KEY_WRITE, NULL, &deadbeefkey, NULL);
2207 if (lr) {
2208 win_skip("CoGetTreatAsClass() tests will be skipped (failed to create a test key, error %ld)\n", lr);
2209 RegCloseKey(clsidkey);
2210 return;
2211 }
2212
2213 hr = CoTreatAsClass(&deadbeef, &deadbeef);
2214 ok(hr == REGDB_E_WRITEREGDB, "CoTreatAsClass gave wrong error: %08lx\n", hr);
2215
2216 hr = CoTreatAsClass(&deadbeef, &CLSID_FileProtocol);
2217 if(hr == REGDB_E_WRITEREGDB){
2218 win_skip("Insufficient privileges to use CoTreatAsClass\n");
2219 goto exit;
2220 }
2221 ok(hr == S_OK, "CoTreatAsClass failed: %08lx\n", hr);
2222
2223 hr = CoGetTreatAsClass(&deadbeef, &out);
2224 ok(hr == S_OK, "CoGetTreatAsClass failed: %08lx\n",hr);
2225 ok(IsEqualGUID(&out, &CLSID_FileProtocol), "expected to get substituted clsid\n");
2226
2228
2229 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2230 if(hr == REGDB_E_CLASSNOTREG)
2231 {
2232 win_skip("IE not installed so can't test CoCreateInstance\n");
2233 goto exit;
2234 }
2235
2236 ok(hr == S_OK, "CoCreateInstance failed: %08lx\n", hr);
2237 if(pIP){
2238 IInternetProtocol_Release(pIP);
2239 pIP = NULL;
2240 }
2241
2242 if (pCoCreateInstanceFromApp)
2243 {
2244 MULTI_QI mqi = { 0 };
2245
2246 mqi.pIID = &IID_IInternetProtocol;
2247 hr = pCoCreateInstanceFromApp(&deadbeef, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
2248 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
2249
2250 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER, &IID_IInternetProtocol,
2251 (void **)&pIP);
2252 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
2253
2254 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2255 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2256 IUnknown_Release(pIP);
2257 }
2258
2259 hr = CoTreatAsClass(&deadbeef, &CLSID_NULL);
2260 ok(hr == S_OK, "CoTreatAsClass failed: %08lx\n", hr);
2261
2262 hr = CoGetTreatAsClass(&deadbeef, &out);
2263 ok(hr == S_FALSE, "expected S_FALSE got %08lx\n", hr);
2264 ok(IsEqualGUID(&out, &deadbeef), "expected to get same clsid back\n");
2265
2266 /* bizarrely, native's CoTreatAsClass takes some time to take effect in CoCreateInstance */
2267 Sleep(200);
2268
2269 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2270 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance gave wrong error: %08lx\n", hr);
2271
2272 if(pIP)
2273 IInternetProtocol_Release(pIP);
2274
2275exit:
2277 RegCloseKey(deadbeefkey);
2278 RegDeleteKeyA(clsidkey, deadbeefA);
2279 RegCloseKey(clsidkey);
2280}
2281
2282static void test_CoInitializeEx(void)
2283{
2284 HRESULT hr;
2285
2287 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2288
2289 /* Calling OleInitialize for the first time should yield S_OK even with
2290 * apartment already initialized by previous CoInitialize(Ex) calls. */
2292 ok(hr == S_OK, "OleInitialize failed with error 0x%08lx\n", hr);
2293
2294 /* Subsequent calls to OleInitialize should return S_FALSE */
2296 ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08lx\n", hr);
2297
2298 /* Cleanup */
2302}
2303
2305{
2306 HRESULT hr;
2307 IUnknown *pUnk;
2308 REFCLSID rclsid = &CLSID_InternetZoneManager;
2309
2310 /* 1. OleInitialize fails but OleUninitialize is still called: apartment stays initialized */
2312 ok(hr == S_OK, "CoInitializeEx(COINIT_MULTITHREADED) failed with error 0x%08lx\n", hr);
2313
2315 ok(hr == RPC_E_CHANGED_MODE, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", RPC_E_CHANGED_MODE, hr);
2317
2318 pUnk = (IUnknown *)0xdeadbeef;
2319 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2320 ok(hr == S_OK, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2321 if (pUnk) IUnknown_Release(pUnk);
2322
2324
2325 /* 2. Extra multiple OleUninitialize: apartment stays initialized until CoUninitialize */
2326 hr = CoInitialize(NULL);
2327 ok(hr == S_OK, "CoInitialize() failed with error 0x%08lx\n", hr);
2328
2330 ok(hr == S_OK, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2334
2335 pUnk = (IUnknown *)0xdeadbeef;
2336 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2337 ok(hr == S_OK, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2338 if (pUnk) IUnknown_Release(pUnk);
2339
2341
2342 pUnk = (IUnknown *)0xdeadbeef;
2343 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2344 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", CO_E_NOTINITIALIZED, hr);
2345 if (pUnk) IUnknown_Release(pUnk);
2346
2347 /* 3. CoUninitialize does not formally deinit Ole */
2348 hr = CoInitialize(NULL);
2349 ok(hr == S_OK, "CoInitialize() failed with error 0x%08lx\n", hr);
2350
2352 ok(hr == S_OK, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2353
2356
2357 pUnk = (IUnknown *)0xdeadbeef;
2358 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2359 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", CO_E_NOTINITIALIZED, hr);
2360 /* COM is not initialized anymore */
2361 if (pUnk) IUnknown_Release(pUnk);
2362
2364 ok(hr == S_FALSE, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_FALSE, hr);
2365 /* ... but native OleInit returns S_FALSE as if Ole is considered initialized */
2366
2368
2369}
2370
2372{
2374 HANDLE handle;
2375 DWORD status;
2376 HRESULT hr;
2377
2378 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, NULL);
2379 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
2380
2381 status = 0xdeadbeef;
2382 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
2383 ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", hr);
2384 ok(status == 0, "got 0x%08lx\n", status);
2385
2386 status = -1;
2387 hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
2388 ok(hr == S_OK, "got 0x%08lx\n", hr);
2389 ok(status == 0, "got 0x%08lx\n", status);
2390
2392 {
2393 status = 0;
2394 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
2395 ok(hr == S_OK, "got 0x%08lx\n", hr);
2396 ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08lx\n", status);
2397
2398 /* context data takes precedence over registration info */
2399 status = 0;
2400 hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
2401 ok(hr == S_OK, "got 0x%08lx\n", hr);
2402 ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08lx\n", status);
2403
2404 /* there's no such attribute in context */
2405 status = -1;
2406 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status);
2407 ok(hr == S_OK, "got 0x%08lx\n", hr);
2408 ok(status == 0, "got 0x%08lx\n", status);
2409
2411 }
2412}
2413
2414static void test_OleRegGetUserType(void)
2415{
2416 static const WCHAR stdfont_usertypeW[] = {'S','t','a','n','d','a','r','d',' ','F','o','n','t',0};
2417 static const WCHAR stdfont2_usertypeW[] = {'C','L','S','I','D','_','S','t','d','F','o','n','t',0};
2418 static const WCHAR clsidkeyW[] = {'C','L','S','I','D',0};
2419 static const WCHAR defvalueW[] = {'D','e','f','a','u','l','t',' ','N','a','m','e',0};
2420 static const WCHAR auxvalue0W[] = {'A','u','x',' ','N','a','m','e',' ','0',0};
2421 static const WCHAR auxvalue2W[] = {'A','u','x',' ','N','a','m','e',' ','2',0};
2422 static const WCHAR auxvalue3W[] = {'A','u','x',' ','N','a','m','e',' ','3',0};
2423 static const WCHAR auxvalue4W[] = {'A','u','x',' ','N','a','m','e',' ','4',0};
2424
2425 static const char auxvalues[][16] = {
2426 "Aux Name 0",
2427 "Aux Name 1",
2428 "Aux Name 2",
2429 "Aux Name 3",
2430 "Aux Name 4"
2431 };
2432
2433 HKEY clsidhkey, hkey, auxhkey, classkey;
2434 DWORD form, ret, disposition;
2435 WCHAR clsidW[39];
2437 HANDLE handle;
2438 HRESULT hr;
2439 WCHAR *str;
2440 int i;
2441
2442 for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
2443 hr = OleRegGetUserType(&CLSID_Testclass, form, NULL);
2444 ok(hr == E_INVALIDARG, "form %lu: got 0x%08lx\n", form, hr);
2445
2446 str = (void*)0xdeadbeef;
2447 hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
2448 ok(hr == REGDB_E_CLASSNOTREG, "form %lu: got 0x%08lx\n", form, hr);
2449 ok(str == NULL, "form %lu: got %p\n", form, str);
2450
2451 /* same string returned for StdFont for all form types */
2452 str = NULL;
2454 ok(hr == S_OK, "form %lu: got 0x%08lx\n", form, hr);
2455 ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
2456 "form %lu, got %s\n", form, wine_dbgstr_w(str));
2458 }
2459
2461 {
2462 for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
2463 str = (void*)0xdeadbeef;
2464 hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
2465 ok(hr == REGDB_E_CLASSNOTREG, "form %lu: got 0x%08lx\n", form, hr);
2466 ok(str == NULL, "form %lu: got %s\n", form, wine_dbgstr_w(str));
2467
2468 /* same string returned for StdFont for all form types */
2469 str = NULL;
2471 ok(hr == S_OK, "form %lu: got 0x%08lx\n", form, hr);
2472 ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
2473 "form %lu, got %s\n", form, wine_dbgstr_w(str));
2475 }
2476
2478 }
2479
2480 /* test using registered CLSID */
2482
2483 ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsidkeyW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &clsidhkey, &disposition);
2484 if (!ret)
2485 {
2486 ret = RegCreateKeyExW(clsidhkey, clsidW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &classkey, NULL);
2487 if (ret)
2488 RegCloseKey(clsidhkey);
2489 }
2490
2491 if (ret == ERROR_ACCESS_DENIED)
2492 {
2493 win_skip("Failed to create test key, skipping some of OleRegGetUserType() tests.\n");
2494 return;
2495 }
2496
2497 ok(!ret, "failed to create a key, error %ld\n", ret);
2498
2499 ret = RegSetValueExW(classkey, NULL, 0, REG_SZ, (const BYTE*)defvalueW, sizeof(defvalueW));
2500 ok(!ret, "got error %ld\n", ret);
2501
2502 ret = RegCreateKeyExA(classkey, "AuxUserType", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &auxhkey, NULL);
2503 ok(!ret, "got error %ld\n", ret);
2504
2505 /* populate AuxUserType */
2506 for (i = 0; i <= 4; i++) {
2507 char name[16];
2508
2509 sprintf(name, "AuxUserType\\%d", i);
2510 ret = RegCreateKeyExA(classkey, name, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
2511 ok(!ret, "got error %ld\n", ret);
2512
2513 ret = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE*)auxvalues[i], strlen(auxvalues[i]));
2514 ok(!ret, "got error %ld\n", ret);
2515 RegCloseKey(hkey);
2516 }
2517
2518 str = NULL;
2520 ok(hr == S_OK, "got 0x%08lx\n", hr);
2521 ok(!lstrcmpW(str, auxvalue0W), "got %s\n", wine_dbgstr_w(str));
2523
2524 str = NULL;
2525 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_FULL, &str);
2526 ok(hr == S_OK, "got 0x%08lx\n", hr);
2527 ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
2529
2530 str = NULL;
2531 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_SHORT, &str);
2532 ok(hr == S_OK, "got 0x%08lx\n", hr);
2533 ok(!lstrcmpW(str, auxvalue2W), "got %s\n", wine_dbgstr_w(str));
2535
2536 str = NULL;
2537 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME, &str);
2538 ok(hr == S_OK, "got 0x%08lx\n", hr);
2539 ok(!lstrcmpW(str, auxvalue3W), "got %s\n", wine_dbgstr_w(str));
2541
2542 str = NULL;
2543 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+1, &str);
2544 ok(hr == S_OK, "got 0x%08lx\n", hr);
2545 ok(!lstrcmpW(str, auxvalue4W), "got %s\n", wine_dbgstr_w(str));
2547
2548 str = NULL;
2549 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+2, &str);
2550 ok(hr == S_OK, "got 0x%08lx\n", hr);
2551 ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
2553
2554 /* registry cleanup */
2555 for (i = 0; i <= 4; i++)
2556 {
2557 char name[2];
2558 sprintf(name, "%d", i);
2559 RegDeleteKeyA(auxhkey, name);
2560 }
2561 RegCloseKey(auxhkey);
2562 RegDeleteKeyA(classkey, "AuxUserType");
2563 RegCloseKey(classkey);
2564 RegDeleteKeyW(clsidhkey, clsidW);
2565 RegCloseKey(clsidhkey);
2566 if (disposition == REG_CREATED_NEW_KEY)
2568}
2569
2570static void test_CoCreateGuid(void)
2571{
2572 HRESULT hr;
2573
2574 hr = CoCreateGuid(NULL);
2575 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
2576}
2577
2579{
2580 /* nothing */
2581}
2582
2584{
2585 HANDLE handle = arg;
2588 return 0;
2589}
2590
2592{
2593 HWND hWnd = arg;
2595 return 0;
2596}
2597
2599{
2600 HWND hwnd = arg;
2601 Sleep(30);
2602 SendMessageA(hwnd, WM_USER, 0, 0);
2603 PostMessageA(hwnd, WM_USER, 0, 0);
2604 return 0;
2605}
2606
2608{
2609 HWND hWnd = arg;
2611 return 0;
2612}
2613
2614static const char cls_name[] = "cowait_test_class";
2615
2617
2618static void cowait_msgs_reset(void)
2619{
2621}
2622
2623#define cowait_msgs_expect_empty() _cowait_msgs_expect_empty(__LINE__)
2624static void _cowait_msgs_expect_empty(unsigned line)
2625{
2627 ok_(__FILE__,line)(0, "unexpected message %u\n", cowait_msgs[cowait_msgs_first]);
2629 }
2631}
2632
2633#define cowait_msgs_expect_notified(a) _cowait_msgs_expect_notified(__LINE__,a)
2634static void _cowait_msgs_expect_notified(unsigned line, UINT expected_msg)
2635{
2637 ok_(__FILE__,line)(0, "expected message %u, received none\n", expected_msg);
2638 }else {
2639 ok_(__FILE__,line)(cowait_msgs[cowait_msgs_first] == expected_msg,
2640 "expected message %u, received %u \n",
2641 expected_msg, cowait_msgs[cowait_msgs_first]);
2643 }
2644}
2645
2646#define cowait_msgs_expect_queued(a,b) _cowait_msgs_expect_queued(__LINE__,a,b)
2647static void _cowait_msgs_expect_queued(unsigned line, HWND hwnd, UINT expected_msg)
2648{
2649 MSG msg;
2650 BOOL success;
2651
2652 success = PeekMessageA(&msg, hwnd, expected_msg, expected_msg, PM_REMOVE);
2653 ok_(__FILE__,line)(success, "PeekMessageA failed: %lu\n", GetLastError());
2654 if(success)
2655 ok_(__FILE__,line)(msg.message == expected_msg, "unexpected message %u, expected %u\n",
2656 msg.message, expected_msg);
2657}
2658
2659static void flush_messages(void)
2660{
2661 MSG msg;
2662 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ));
2663}
2664
2666{
2669 if(msg == WM_DDE_FIRST)
2670 return 6;
2671 return DefWindowProcA(hwnd, msg, wparam, lparam);
2672}
2673
2675{
2676 IStream *stream = arg;
2677 IEnumOLEVERB *enum_verb;
2679 IUnknown *unk;
2680 HRESULT hr;
2681
2683
2684 zero.QuadPart = 0;
2685 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
2686 ok(hr == S_OK, "Seek failed: %08lx\n", hr);
2687
2688 hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
2689 ok(hr == S_OK, "CoUnmarshalInterface failed: %08lx\n", hr);
2690
2691 hr = IUnknown_QueryInterface(unk, &IID_IEnumOLEVERB, (void**)&enum_verb);
2692 ok(hr == S_OK, "QueryInterface failed: %08lx\n", hr);
2693
2694 IEnumOLEVERB_Release(enum_verb);
2695 IUnknown_Release(unk);
2696
2698 return 0;
2699}
2700
2702{
2704 IStream *stream;
2705 BOOL success;
2706 DWORD index, tid;
2707 HRESULT hr;
2708 HWND hWnd;
2709 UINT uMSG = 0xc065;
2710 MSG msg;
2711 int ret;
2712
2714 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2715
2716 hWnd = CreateWindowExA(0, cls_name, "Test (thread)", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2717 ok(hWnd != 0, "CreateWindowExA failed %lu\n", GetLastError());
2718
2719 index = 0xdeadbeef;
2722 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2723 ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %lu\n", index);
2725 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2726
2727 index = 0xdeadbeef;
2728 PostMessageA(hWnd, WM_USER, 0, 0);
2730 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2731 ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %lu\n", index);
2733 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2734
2735 /* Even if CoWaitForMultipleHandles does not pump a message it peeks
2736 * at ALL of them */
2737 index = 0xdeadbeef;
2738 PostMessageA(NULL, uMSG, 0, 0);
2739
2741 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2742 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2743
2744 /* Make sure message was peeked at */
2746 ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
2747
2748 /* But not pumped */
2749 success = PeekMessageA(&msg, NULL, uMSG, uMSG, PM_REMOVE);
2750 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2751
2754
2756 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2757
2759 ok(hr == S_OK, "CreateStreamOnHGlobal failed: %08lx\n", hr);
2760
2761 hr = CoMarshalInterface(stream, &IID_IUnknown, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
2762 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
2763
2764 event = CreateEventW(NULL, TRUE, FALSE, NULL);
2765
2766 PostQuitMessage(66);
2768
2770 ok(hr == S_OK, "CoRegisterMessageFilter failed: %08lx\n", hr);
2771
2773 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2774 hr = CoWaitForMultipleHandles(0, 50, 1, &event, &index);
2775 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2776 hr = CoWaitForMultipleHandles(0, 200, 1, &thread, &index);
2777 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2778 ok(index == WAIT_OBJECT_0, "cowait_unmarshal_thread didn't finish\n");
2780
2782 ok(hr == S_OK, "CoRegisterMessageFilter failed: %08lx\n", hr);
2783
2784 IStream_Release(stream);
2785
2788 return 0;
2789}
2790
2792{
2793 HANDLE handles[2], thread;
2794 DWORD index, tid;
2795 WNDCLASSEXA wc;
2796 BOOL success;
2797 HRESULT hr;
2798 HWND hWnd;
2799 MSG msg;
2800
2802 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2803
2804 memset(&wc, 0, sizeof(wc));
2805 wc.cbSize = sizeof(wc);
2809 wc.hbrBackground = NULL;
2812 success = RegisterClassExA(&wc) != 0;
2813 ok(success, "RegisterClassExA failed %lu\n", GetLastError());
2814
2815 hWnd = CreateWindowExA(0, cls_name, "Test", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2816 ok(hWnd != 0, "CreateWindowExA failed %lu\n", GetLastError());
2817 handles[0] = CreateSemaphoreA(NULL, 1, 1, NULL);
2818 ok(handles[0] != 0, "CreateSemaphoreA failed %lu\n", GetLastError());
2819 handles[1] = CreateSemaphoreA(NULL, 1, 1, NULL);
2820 ok(handles[1] != 0, "CreateSemaphoreA failed %lu\n", GetLastError());
2821
2822 /* test without flags */
2823
2826 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08lx\n", hr);
2828 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2829
2830 index = 0xdeadbeef;
2832 hr = CoWaitForMultipleHandles(0, 50, 0, NULL, &index);
2833 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08lx\n", hr);
2834 ok(index == 0, "expected index 0, got %lu\n", index);
2836 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2837
2838 index = 0xdeadbeef;
2841 ok(hr == RPC_E_NO_SYNC, "expected RPC_E_NO_SYNC, got 0x%08lx\n", hr);
2842 ok(index == 0, "expected index 0, got %lu\n", index);
2844 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2845
2846 index = 0xdeadbeef;
2849 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2850 ok(index == 0, "expected index 0, got %lu\n", index);
2852 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2853
2854 index = 0xdeadbeef;
2857 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2858 ok(index == 1, "expected index 1, got %lu\n", index);
2860 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2861
2862 index = 0xdeadbeef;
2865 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2866 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2868 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2869
2870 /* test PostMessageA/SendMessageA from a different thread */
2871
2872 index = 0xdeadbeef;
2874 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2875 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2876 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2877 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2879 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2881 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2883
2884 index = 0xdeadbeef;
2886 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2887 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2888 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2889 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2891 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2893 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2895
2898
2899 /* test with COWAIT_WAITALL */
2900
2901 index = 0xdeadbeef;
2904 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2905 ok(index == 0, "expected index 0, got %lu\n", index);
2907 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2908
2909 index = 0xdeadbeef;
2912 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2913 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2915 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2916
2919
2920 /* test with COWAIT_ALERTABLE */
2921
2922 index = 0xdeadbeef;
2925 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2926 ok(index == 0, "expected index 0, got %lu\n", index);
2928 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2929
2930 index = 0xdeadbeef;
2933 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2934 ok(index == 1, "expected index 1, got %lu\n", index);
2936 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2937
2938 index = 0xdeadbeef;
2941 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2942 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2944 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2945
2946 index = 0xdeadbeef;
2949 ok(success, "QueueUserAPC failed %lu\n", GetLastError());
2951 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2952 ok(index == WAIT_IO_COMPLETION, "expected index WAIT_IO_COMPLETION, got %lu\n", index);
2954 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2955
2956 /* test with COWAIT_INPUTAVAILABLE (semaphores are still locked) */
2957
2958 index = 0xdeadbeef;
2961 ok(success, "PeekMessageA returned FALSE\n");
2963 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2964 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2966 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2967
2968 index = 0xdeadbeef;
2971 ok(success, "PeekMessageA returned FALSE\n");
2973 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2975 ok(hr == RPC_S_CALLPENDING || broken(hr == E_INVALIDARG) || broken(hr == S_OK) /* Win 8 */,
2976 "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2977 if (hr != S_OK) ReleaseSemaphore(handles[1], 1, NULL);
2978 ok(index == 0 || broken(index == 1) /* Win 8 */, "expected index 0, got %lu\n", index);
2981 "CoWaitForMultipleHandles didn't pump any messages\n");
2983 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2985
2987 PostMessageA(hWnd, 0, 0, 0);
2989 PostMessageA(hWnd, WM_USER+1, 0, 0);
2990 PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
2992 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2993
2994 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2995 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2996
3004
3006 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3008
3009 /* test behaviour of WM_QUIT (semaphores are still locked) */
3010
3011 PostMessageA(hWnd, WM_QUIT, 40, 0);
3012 memset(&msg, 0, sizeof(msg));
3014 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3015 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3016 ok(msg.wParam == 40, "expected msg.wParam = 40, got %Iu\n", msg.wParam);
3018 ok(!success, "PeekMessageA succeeded\n");
3019
3021 PostMessageA(hWnd, WM_QUIT, 40, 0);
3022 PostMessageA(hWnd, 0, 0, 0);
3024 PostMessageA(hWnd, WM_USER+1, 0, 0);
3025 PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
3027 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3028
3029 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3030 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3031
3038
3040 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3042
3043 index = 0xdeadbeef;
3045 PostMessageA(hWnd, WM_QUIT, 41, 0);
3047 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3048 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3049 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3050 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3052 todo_wine
3053 ok(success || broken(!success) /* Win 2000/XP/8 */, "PeekMessageA failed, error %lu\n", GetLastError());
3055 ok(!success, "PeekMessageA succeeded\n");
3056 memset(&msg, 0, sizeof(msg));
3058 todo_wine
3059 ok(!success || broken(success) /* Win 2000/XP/8 */, "PeekMessageA succeeded\n");
3060 if (success)
3061 {
3062 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3063 ok(msg.wParam == 41, "expected msg.wParam = 41, got %Iu\n", msg.wParam);
3064 }
3066 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3068
3069 index = 0xdeadbeef;
3071 PostMessageA(hWnd, WM_QUIT, 42, 0);
3073 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3074 hr = CoWaitForMultipleHandles(0, 500, 2, handles, &index);
3075 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3076 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3078 ok(!success, "CoWaitForMultipleHandles didn't pump all WM_DDE_FIRST messages\n");
3079 memset(&msg, 0, sizeof(msg));
3081 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3082 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3083 ok(msg.wParam == 42, "expected msg.wParam = 42, got %Iu\n", msg.wParam);
3085 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3087
3088 PostQuitMessage(43);
3089 memset(&msg, 0, sizeof(msg));
3091 ok(success || broken(!success) /* Win 8 */, "PeekMessageA failed, error %lu\n", GetLastError());
3092 if (!success)
3093 win_skip("PostQuitMessage didn't queue a WM_QUIT message, skipping tests\n");
3094 else
3095 {
3096 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3097 ok(msg.wParam == 43, "expected msg.wParam = 43, got %Iu\n", msg.wParam);
3099 ok(!success, "PeekMessageA succeeded\n");
3100
3101 index = 0xdeadbeef;
3103 PostQuitMessage(44);
3105 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3106 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3107 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3108 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3110 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3112 ok(!success, "PeekMessageA succeeded\n");
3114 ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
3116 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3118
3119 index = 0xdeadbeef;
3121 PostQuitMessage(45);
3123 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3124 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3125 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3126 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3128 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3130 ok(!success, "PeekMessageA succeeded\n");
3132 ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
3134 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3136 }
3137
3138 /* test message pumping when CoWaitForMultipleHandles is called from non main apartment thread */
3141 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3143
3145
3146 /* If COM was not initialized, messages are neither pumped nor peeked at */
3148 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3149 ok(hr == RPC_S_CALLPENDING, "got %#lx\n", hr);
3151 ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
3153 ok(success, "PeekMessage failed: %lu\n", GetLastError());
3154
3155 /* same in an MTA */
3157
3159 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3160 ok(hr == RPC_S_CALLPENDING, "got %#lx\n", hr);
3162 ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
3164 ok(success, "PeekMessage failed: %lu\n", GetLastError());
3165
3167
3168 CloseHandle(handles[0]);
3169 CloseHandle(handles[1]);
3171
3173 ok(success, "UnregisterClass failed %lu\n", GetLastError());
3174}
3175
3176static void test_CoGetMalloc(void)
3177{
3178 IMalloc *imalloc;
3179 SIZE_T size;
3180 HRESULT hr;
3181 char *ptr;
3182 int ret;
3183
3184 if (0) /* crashes on native */
3185 hr = CoGetMalloc(0, NULL);
3186
3187 imalloc = (void*)0xdeadbeef;
3188 hr = CoGetMalloc(0, &imalloc);
3189 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3190 ok(imalloc == NULL, "got %p\n", imalloc);
3191
3192 imalloc = (void*)0xdeadbeef;
3193 hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
3194 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3195 ok(imalloc == NULL, "got %p\n", imalloc);
3196
3197 imalloc = (void*)0xdeadbeef;
3198 hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
3199 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3200 ok(imalloc == NULL, "got %p\n", imalloc);
3201
3202 imalloc = (void*)0xdeadbeef;
3203 hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
3204 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3205 ok(imalloc == NULL, "got %p\n", imalloc);
3206
3207 imalloc = (void*)0xdeadbeef;
3208 hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
3209 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3210 ok(imalloc == NULL, "got %p\n", imalloc);
3211
3212 imalloc = NULL;
3213 hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3214 ok(hr == S_OK, "got 0x%08lx\n", hr);
3215 ok(imalloc != NULL, "got %p\n", imalloc);
3216
3217 /* DidAlloc() */
3218 ptr = IMalloc_Alloc(imalloc, 16);
3219 ok(!!ptr, "Failed to allocate block.\n");
3220
3221 ret = IMalloc_DidAlloc(imalloc, ptr);
3222 ok(ret == 1, "Unexpected return value %d.\n", ret);
3223
3224 ret = IMalloc_DidAlloc(imalloc, NULL);
3225 ok(ret == -1, "Unexpected return value %d.\n", ret);
3226
3227 ret = IMalloc_DidAlloc(imalloc, (void *)0x1);
3228 ok(ret == 0, "Unexpected return value %d.\n", ret);
3229
3230 ret = IMalloc_DidAlloc(imalloc, ptr + 4);
3231 ok(ret == 0, "Unexpected return value %d.\n", ret);
3232
3233 /* GetSize() */
3234 size = IMalloc_GetSize(imalloc, NULL);
3235 ok(size == (SIZE_T)-1, "Unexpected return value.\n");
3236
3237 size = IMalloc_GetSize(imalloc, ptr);
3238 ok(size == 16, "Unexpected return value.\n");
3239
3240 IMalloc_Free(imalloc, ptr);
3241
3242 IMalloc_Release(imalloc);
3243}
3244
3246{
3248 APTTYPE type;
3249 HRESULT hr;
3250
3251 if (!pCoGetApartmentType)
3252 {
3253 win_skip("CoGetApartmentType not present\n");
3254 return;
3255 }
3256
3257 hr = pCoGetApartmentType(NULL, NULL);
3258 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3259
3260 type = 0xdeadbeef;
3261 hr = pCoGetApartmentType(&type, NULL);
3262 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3263 ok(type == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", type);
3264
3265 qualifier = 0xdeadbeef;
3266 hr = pCoGetApartmentType(NULL, &qualifier);
3267 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3268 ok(qualifier == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", qualifier);
3269
3270 type = 0xdeadbeef;
3271 qualifier = 0xdeadbeef;
3272 hr = pCoGetApartmentType(&type, &qualifier);
3273 ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3274 ok(type == APTTYPE_CURRENT, "Expected APTTYPE_CURRENT, got %u\n", type);
3275 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3276
3277 type = 0xdeadbeef;
3278 qualifier = 0xdeadbeef;
3280 ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08lx\n", hr);
3281 hr = pCoGetApartmentType(&type, &qualifier);
3282 ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08lx\n", hr);
3283 ok(type == APTTYPE_MAINSTA, "Expected APTTYPE_MAINSTA, got %u\n", type);
3284 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3286
3287 type = 0xdeadbeef;
3288 qualifier = 0xdeadbeef;
3290 ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08lx\n", hr);
3291 hr = pCoGetApartmentType(&type, &qualifier);
3292 ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08lx\n", hr);
3293 ok(type == APTTYPE_MTA, "Expected APTTYPE_MTA, got %u\n", type);
3294 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3296}
3297
3299{
3300 if (IsEqualIID(riid, &IID_IMallocSpy) || IsEqualIID(riid, &IID_IUnknown))
3301 {
3302 *obj = iface;
3303 IMallocSpy_AddRef(iface);
3304 return S_OK;
3305 }
3306
3307 return E_NOINTERFACE;
3308}
3309
3311{
3312 return 2;
3313}
3314
3316{
3317 return 1;
3318}
3319
3321{
3322 ok(0, "unexpected call\n");
3323 return 0;
3324}
3325
3326static void* WINAPI testspy_PostAlloc(IMallocSpy *iface, void *ptr)
3327{
3328 ok(0, "unexpected call\n");
3329 return NULL;
3330}
3331
3332static void* WINAPI testspy_PreFree(IMallocSpy *iface, void *ptr, BOOL spyed)
3333{
3334 ok(0, "unexpected call\n");
3335 return NULL;
3336}
3337
3338static void WINAPI testspy_PostFree(IMallocSpy *iface, BOOL spyed)
3339{
3340 ok(0, "unexpected call\n");
3341}
3342
3343static SIZE_T WINAPI testspy_PreRealloc(IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
3344{
3345 ok(0, "unexpected call\n");
3346 return 0;
3347}
3348
3349static void* WINAPI testspy_PostRealloc(IMallocSpy *iface, void *ptr, BOOL spyed)
3350{
3351 ok(0, "unexpected call\n");
3352 return NULL;
3353}
3354
3355static void* WINAPI testspy_PreGetSize(IMallocSpy *iface, void *ptr, BOOL spyed)
3356{
3357 ok(0, "unexpected call\n");
3358 return NULL;
3359}
3360
3362{
3363 ok(0, "unexpected call\n");
3364 return 0;
3365}
3366
3367static void* WINAPI testspy_PreDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed)
3368{
3369 ok(0, "unexpected call\n");
3370 return NULL;
3371}
3372
3373static int WINAPI testspy_PostDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
3374{
3375 ok(0, "unexpected call\n");
3376 return 0;
3377}
3378
3380{
3381 ok(0, "unexpected call\n");
3382}
3383
3385{
3386 ok(0, "unexpected call\n");
3387}
3388
3389static const IMallocSpyVtbl testspyvtbl =
3390{
3391 testspy_QI,
3406};
3407
3409
3410static void test_IMallocSpy(void)
3411{
3412 IMalloc *imalloc;
3413 HRESULT hr;
3414
3416 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3417
3419 ok(hr == CO_E_OBJNOTREG, "got 0x%08lx\n", hr);
3420
3422 ok(hr == S_OK, "got 0x%08lx\n", hr);
3423
3425 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3426
3428 ok(hr == CO_E_OBJISREG, "got 0x%08lx\n", hr);
3429
3430 imalloc = NULL;
3431 hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3432 ok(hr == S_OK, "got 0x%08lx\n", hr);
3433 ok(imalloc != NULL, "got %p\n", imalloc);
3434
3435 IMalloc_Free(imalloc, NULL);
3436
3437 IMalloc_Release(imalloc);
3438
3440 ok(hr == S_OK, "got 0x%08lx\n", hr);
3441
3443 ok(hr == CO_E_OBJNOTREG, "got 0x%08lx\n", hr);
3444}
3445
3447{
3448 HRESULT hr;
3449 GUID id;
3450
3452 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3453
3454 id = GUID_NULL;
3456 ok(hr == S_OK, "got 0x%08lx\n", hr);
3457 ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
3458}
3459
3461{
3462 if (IsEqualIID(riid, &IID_IInitializeSpy) || IsEqualIID(riid, &IID_IUnknown))
3463 {
3464 *obj = iface;
3465 IInitializeSpy_AddRef(iface);
3466 return S_OK;
3467 }
3468
3469 *obj = NULL;
3470 return E_NOINTERFACE;
3471}
3472
3474{
3475 return 2;
3476}
3477
3479{
3480 return 1;
3481}
3482
3486
3488{
3489 CHECK_EXPECT2(PreInitialize);
3490 ok(coinit == expected_coinit_flags, "Unexpected init flags %#lx, expected %#lx.\n", coinit, expected_coinit_flags);
3491 return S_OK;
3492}
3493
3495{
3496 CHECK_EXPECT2(PostInitialize);
3497 ok(coinit == expected_coinit_flags, "Unexpected init flags %#lx, expected %#lx.\n", coinit, expected_coinit_flags);
3498 return hr;
3499}
3500
3502{
3503 HRESULT hr;
3504 CHECK_EXPECT2(PreUninitialize);
3506 {
3508 ok(hr == S_OK, "got 0x%08lx\n", hr);
3509
3511 ok(hr == S_OK, "got 0x%08lx\n", hr);
3512
3514 ok(hr == S_OK, "got 0x%08lx\n", hr);
3515
3517 }
3518 return S_OK;
3519}
3520
3522{
3523 CHECK_EXPECT2(PostUninitialize);
3524 return E_NOTIMPL;
3525}
3526
3527static const IInitializeSpyVtbl testinitializevtbl =
3528{
3536};
3537
3539
3541{
3542 HRESULT hr;
3543
3545 ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
3546
3548 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3549
3551 return 0;
3552}
3553
3555{
3556 HRESULT hr;
3557
3558 if (mt)
3559 {
3561 ok(hr == S_OK, "CoInitializeEx failed: %#lx\n", hr);
3562 }
3563
3565 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3566
3567 init_cookies[0].QuadPart = 1;
3569 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3570 ok(init_cookies[0].QuadPart == 1, "got wrong cookie\n");
3571
3573 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3574
3575 init_cookies[0].HighPart = 0;
3576 init_cookies[0].LowPart = 1;
3578 ok(hr == S_OK, "got 0x%08lx\n", hr);
3579 ok(init_cookies[0].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[0].HighPart,
3581 if (!mt) ok(init_cookies[0].LowPart == 0, "got wrong low part 0x%lx\n", init_cookies[0].LowPart);
3582
3583 /* register same instance one more time */
3584 init_cookies[1].HighPart = 0;
3585 init_cookies[1].LowPart = 0;
3587 ok(hr == S_OK, "got 0x%08lx\n", hr);
3588 ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[1].HighPart,
3590 if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%lx\n", init_cookies[1].LowPart);
3591
3592 init_cookies[2].HighPart = 0;
3593 init_cookies[2].LowPart = 0;
3595 ok(hr == S_OK, "got 0x%08lx\n", hr);
3596 ok(init_cookies[2].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[2].HighPart,
3598 if (!mt) ok(init_cookies[2].LowPart == 2, "got wrong low part 0x%lx\n", init_cookies[2].LowPart);
3599
3601 ok(hr == S_OK, "got 0x%08lx\n", hr);
3602
3604 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3605
3606 init_cookies[1].HighPart = 0;
3607 init_cookies[1].LowPart = 0;
3609 ok(hr == S_OK, "got 0x%08lx\n", hr);
3610 ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[1].HighPart,
3612 if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%lx\n", init_cookies[1].LowPart);
3613
3614 SET_EXPECT(PreInitialize);
3615 SET_EXPECT(PostInitialize);
3617 ok(hr == (mt ? S_FALSE : S_OK), "Failed to initialize COM, hr %#lx.\n", hr);
3618 CHECK_CALLED(PreInitialize, 3);
3619 CHECK_CALLED(PostInitialize, 3);
3620
3621 if (mt)
3622 {
3623 HANDLE thread;
3625 ok(thread != NULL, "CreateThread failed: %lu\n", GetLastError());
3626 ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
3627 }
3628
3629 SET_EXPECT(PreInitialize);
3630 SET_EXPECT(PostInitialize);
3632 ok(hr == S_FALSE, "Failed to initialize COM, hr %#lx.\n", hr);
3633 CHECK_CALLED(PreInitialize, 3);
3634 CHECK_CALLED(PostInitialize, 3);
3635
3636 SET_EXPECT(PreUninitialize);
3637 SET_EXPECT(PostUninitialize);
3639 CHECK_CALLED(PreUninitialize, 3);
3640 CHECK_CALLED(PostUninitialize, 3);
3641
3642 SET_EXPECT(PreUninitialize);
3643 SET_EXPECT(PostUninitialize);
3645 CHECK_CALLED(PreUninitialize, 3);
3646 CHECK_CALLED(PostUninitialize, 3);
3647
3648 if (mt)
3649 {
3650 SET_EXPECT(PreUninitialize);
3651 SET_EXPECT(PostUninitialize);
3653 CHECK_CALLED(PreUninitialize, 3);
3654 CHECK_CALLED(PostUninitialize, 3);
3655 }
3656
3657 SET_EXPECT(PreInitialize);
3658 SET_EXPECT(PostInitialize);
3660 ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
3661 CHECK_CALLED(PreInitialize, 3);
3662 CHECK_CALLED(PostInitialize, 3);
3663
3664 SET_EXPECT(PreUninitialize);
3667 CHECK_CALLED(PreUninitialize, 1);
3668}
3669
3673{
3674 if (IsEqualIID(riid, &IID_IUnknown)) {
3675 *obj = iface;
3676 IUnknown_AddRef(iface);
3677 return S_OK;
3678 }
3679
3682 *obj = iface;
3683 IUnknown_AddRef(iface);
3684 }
3685 else
3686 *obj = NULL;
3687 return g_persistfile_qi_ret;
3688 }
3689
3690 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
3691 *obj = NULL;
3692 return E_NOINTERFACE;
3693}
3694
3696{
3697 return 2;
3698}
3699
3701{
3702 return 1;
3703}
3704
3706{
3707 ok(0, "unexpected call\n");
3708 return E_NOTIMPL;
3709}
3710
3712{
3713 ok(0, "unexpected call\n");
3714 return E_NOTIMPL;
3715}
3716
3718{
3720}
3721
3722static HRESULT WINAPI testinstance_Save(IPersistFile *iface, LPCOLESTR filename, BOOL remember)
3723{
3724 return E_NOTIMPL;
3725}
3726
3728{
3729 ok(0, "unexpected call\n");
3730 return E_NOTIMPL;
3731}
3732
3734{
3735 ok(0, "unexpected call\n");
3736 return E_NOTIMPL;
3737}
3738
3739static const IPersistFileVtbl testpersistfilevtbl = {
3749};
3750
3752
3754{
3756 *obj = iface;
3757 IClassFactory_AddRef(iface);
3758 return S_OK;
3759 }
3760
3761 *obj = NULL;
3762 return E_NOINTERFACE;
3763}
3764
3766{
3767 return 2;
3768}
3769
3771{
3772 return 1;
3773}
3774
3776 REFIID riid, void **obj)
3777{
3778 if (IsEqualIID(riid, &IID_IUnknown)) {
3779 *obj = &testpersistfile;
3780 return S_OK;
3781 }
3782
3783 ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
3784 *obj = NULL;
3785 return E_NOTIMPL;
3786}
3787
3789{
3790 ok(0, "unexpected call\n");
3791 return E_NOTIMPL;
3792}
3793
3794static const IClassFactoryVtbl getinstance_cf_vtbl = {
3800};
3801
3803
3805{
3806 static const WCHAR filenameW[] = {'d','u','m','m','y','p','a','t','h',0};
3807 CLSID *clsid = (CLSID*)&CLSID_testclsid;
3808 MULTI_QI mqi[2];
3809 DWORD cookie;
3810 HRESULT hr;
3811
3813 ok(hr == S_OK, "got 0x%08lx\n", hr);
3814
3815 /* CLSID is not specified, file does not exist */
3816 mqi[0].pIID = &IID_IUnknown;
3817 mqi[0].pItf = NULL;
3818 mqi[0].hr = E_NOTIMPL;
3819 hr = CoGetInstanceFromFile(NULL, NULL, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3820 todo_wine
3821 ok(hr == MK_E_CANTOPENFILE, "got 0x%08lx\n", hr);
3822 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3823 ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08lx\n", mqi[0].hr);
3824
3825 /* class is not available */
3826 mqi[0].pIID = &IID_IUnknown;
3827 mqi[0].pItf = NULL;
3828 mqi[0].hr = E_NOTIMPL;
3829 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3830 ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", hr);
3831 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3832 ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", mqi[0].hr);
3833
3835 &cookie);
3836 ok(hr == S_OK, "got 0x%08lx\n", hr);
3837
3838 mqi[0].pIID = &IID_IUnknown;
3839 mqi[0].pItf = (void*)0xdeadbeef;
3840 mqi[0].hr = S_OK;
3841 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3842todo_wine {
3843 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3844 ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3845}
3846 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3847
3848 mqi[0].pIID = &IID_IUnknown;
3849 mqi[0].pItf = (void*)0xdeadbeef;
3850 mqi[0].hr = E_NOTIMPL;
3851 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3852todo_wine {
3853 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3854 ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3855 ok(mqi[0].hr == E_NOTIMPL, "got 0x%08lx\n", mqi[0].hr);
3856}
3857 mqi[0].pIID = &IID_IUnknown;
3858 mqi[0].pItf = NULL;
3859 mqi[0].hr = E_NOTIMPL;
3860 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3861 ok(hr == S_OK, "got 0x%08lx\n", hr);
3862 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3863 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3864
3865 mqi[0].pIID = &IID_IUnknown;
3866 mqi[0].pItf = NULL;
3867 mqi[0].hr = S_OK;
3868 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3869 ok(hr == S_OK, "got 0x%08lx\n", hr);
3870 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3871 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3872
3873 mqi[0].pIID = &IID_IUnknown;
3874 mqi[0].pItf = NULL;
3875 mqi[0].hr = S_OK;
3877 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3878 ok(hr == S_OK, "got 0x%08lx\n", hr);
3879 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3880 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3882
3883 mqi[0].pIID = &IID_IUnknown;
3884 mqi[0].pItf = NULL;
3885 mqi[0].hr = S_OK;
3886 mqi[1].pIID = &IID_IUnknown;
3887 mqi[1].pItf = NULL;
3888 mqi[1].hr = S_OK;
3889 g_persistfile_qi_ret = 0x8000efef;
3890 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3891 ok(hr == 0x8000efef, "got 0x%08lx\n", hr);
3892 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3893 ok(mqi[0].hr == 0x8000efef, "got 0x%08lx\n", mqi[0].hr);
3894 ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3895 ok(mqi[1].hr == 0x8000efef, "got 0x%08lx\n", mqi[1].hr);
3897
3898 mqi[0].pIID = &IID_IUnknown;
3899 mqi[0].pItf = NULL;
3900 mqi[0].hr = S_OK;
3901 mqi[1].pIID = &IID_IUnknown;
3902 mqi[1].pItf = NULL;
3903 mqi[1].hr = S_OK;
3904 g_persistfile_load_ret = 0x8000fefe;
3905 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3906 ok(hr == 0x8000fefe, "got 0x%08lx\n", hr);
3907 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3908 ok(mqi[0].hr == 0x8000fefe, "got 0x%08lx\n", mqi[0].hr);
3909 ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3910 ok(mqi[1].hr == 0x8000fefe, "got 0x%08lx\n", mqi[1].hr);
3912
3914 ok(hr == S_OK, "got 0x%08lx\n", hr);
3915
3917}
3918
3919static void test_GlobalOptions(void)
3920{
3923 HRESULT hres;
3924
3926
3927 hres = CoCreateInstance(&CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER,
3928 &IID_IGlobalOptions, (void**)&global_options);
3929 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "CoCreateInstance(CLSID_GlobalOptions) failed: %08lx\n", hres);
3930 if(FAILED(hres))
3931 {
3932 win_skip("CLSID_GlobalOptions not available\n");
3934 return;
3935 }
3936
3937 hres = IGlobalOptions_Query(global_options, 0, &value);
3938 ok(FAILED(hres), "Unexpected hr %#lx.\n", hres);
3939
3940 hres = IGlobalOptions_Query(global_options, COMGLB_PROPERTIES_RESERVED3 + 1, &value);
3941 ok(FAILED(hres), "Unexpected hr %#lx.\n", hres);
3942
3943 value = ~0u;
3944 hres = IGlobalOptions_Query(global_options, COMGLB_EXCEPTION_HANDLING, &value);
3945 ok(hres == S_OK || broken(hres == E_FAIL) /* Vista */, "Unexpected hr %#lx.\n", hres);
3946 if (SUCCEEDED(hres))
3947 ok(value == COMGLB_EXCEPTION_HANDLE, "Unexpected value %Id.\n", value);
3948
3949 IGlobalOptions_Release(global_options);
3950
3951 hres = CoCreateInstance(&CLSID_GlobalOptions, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
3952 &IID_IGlobalOptions, (void**)&global_options);
3953 ok(hres == E_INVALIDARG, "CoCreateInstance(CLSID_GlobalOptions) failed: %08lx\n", hres);
3954
3956}
3957
3958static void init_funcs(void)
3959{
3960 HMODULE hOle32 = GetModuleHandleA("ole32");
3961 HMODULE hAdvapi32 = GetModuleHandleA("advapi32");
3962 HMODULE hkernel32 = GetModuleHandleA("kernel32");
3963
3964 pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
3965 pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
3966 pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
3967 pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType");
3968 pCoIncrementMTAUsage = (void*)GetProcAddress(hOle32, "CoIncrementMTAUsage");
3969 pCoDecrementMTAUsage = (void*)GetProcAddress(hOle32, "CoDecrementMTAUsage");
3970 pCoCreateInstanceFromApp = (void*)GetProcAddress(hOle32, "CoCreateInstanceFromApp");
3971 pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA");
3972 pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
3973
3974 pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
3975}
3976
3978{
3979 IComThreadingInfo *threading_info;
3981 IUnknown *unk;
3982 DWORD cookie;
3983 CLSID clsid;
3984 HRESULT hr;
3985
3987
3988 hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
3989 ok_ole_success(hr, "CoCreateInstance");
3990 IUnknown_Release(unk);
3991
3992 hr = CoGetClassObject(&CLSID_InternetZoneManager, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&unk);
3993 ok_ole_success(hr, "CoGetClassObject");
3994 IUnknown_Release(unk);
3995
3996 hr = CoGetObjectContext(&IID_IComThreadingInfo, (void **)&threading_info);
3997 ok_ole_success(hr, "CoGetObjectContext");
3998 IComThreadingInfo_Release(threading_info);
3999
4001 ok_ole_success(hr, "CoGetContextToken");
4002
4004 ok_ole_success(hr, "CoRegisterPSClsid");
4005
4007 ok_ole_success(hr, "CoGetPSClsid");
4008
4010 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
4011 ok_ole_success(hr, "CoRegisterClassObject");
4012
4014 ok_ole_success(hr, "CoRevokeClassObject");
4015
4017 ok(hr == CO_E_NOT_SUPPORTED, "got %#lx\n", hr);
4018
4020 ok_ole_success(hr, "CoLockObjectExternal");
4021
4023 ok_ole_success(hr, "CoDisconnectObject");
4024
4025 return 0;
4026}
4027
4028/* Some COM functions (perhaps even all of them?) can make use of an "implicit"
4029 * multi-threaded apartment created by another thread in the same process. */
4030static void test_implicit_mta(void)
4031{
4032 HANDLE thread;
4033
4035
4037 ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
4038
4040}
4041
4043{
4044 DWORD *id = param;
4045
4046 *id = CoGetCurrentProcess();
4047 return 0;
4048}
4049
4051{
4052 DWORD id, id2;
4053 HANDLE thread;
4054
4055 id = CoGetCurrentProcess();
4056 ok(!!id && id != GetCurrentProcessId() && id != GetCurrentThreadId(), "Unexpected result %ld.\n", id);
4057
4058 id2 = 0;
4060 ok(thread != NULL, "Failed to create test thread.\n");
4061 ok(!WaitForSingleObject(thread, 10000), "Wait timed out.\n");
4063
4064 ok(id2 && id2 != id, "Unexpected id from another thread.\n");
4065}
4066
4067static void test_mta_usage(void)
4068{
4069 CO_MTA_USAGE_COOKIE cookie, cookie2;
4070 HRESULT hr;
4071
4072 if (!pCoIncrementMTAUsage)
4073 {
4074 win_skip("CoIncrementMTAUsage() is not available.\n");
4075 return;
4076 }
4077
4078 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
4079
4080 cookie = 0;
4081 hr = pCoIncrementMTAUsage(&cookie);
4082 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4083 ok(cookie != NULL, "Unexpected cookie %p.\n", cookie);
4084
4085 cookie2 = 0;
4086 hr = pCoIncrementMTAUsage(&cookie2);
4087 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4088 ok(cookie2 != NULL && cookie2 != cookie, "Unexpected cookie %p.\n", cookie2);
4089
4091
4092 hr = pCoDecrementMTAUsage(cookie);
4093 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4094
4096
4097 hr = pCoDecrementMTAUsage(cookie2);
4098 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4099
4100 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
4101
4103 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4104
4106
4107 cookie = 0;
4108 hr = pCoIncrementMTAUsage(&cookie);
4109 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4110 ok(cookie != NULL, "Unexpected cookie %p.\n", cookie);
4111
4113
4114 hr = pCoDecrementMTAUsage(cookie);
4115 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4116
4118
4119 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
4120}
4121
4123{
4124 static const CLSID *supported_classes[] =
4125 {
4129 };
4130 static const CLSID *unsupported_classes[] =
4131 {
4133 };
4134 unsigned int i;
4135 IUnknown *unk;
4136 DWORD cookie;
4137 MULTI_QI mqi;
4138 HRESULT hr;
4139 HANDLE handle;
4140 ULONG_PTR actctx_cookie;
4141
4142 if (!pCoCreateInstanceFromApp)
4143 {
4144 win_skip("CoCreateInstanceFromApp() is not available.\n");
4145 return;
4146 }
4147
4149
4150 for (i = 0; i < ARRAY_SIZE(supported_classes); ++i)
4151 {
4152 memset(&mqi, 0, sizeof(mqi));
4153 mqi.pIID = &IID_IUnknown;
4154 hr = pCoCreateInstanceFromApp(supported_classes[i], NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
4155 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4156 IUnknown_Release(mqi.pItf);
4157
4158 hr = CoCreateInstance(supported_classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4159 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4160 IUnknown_Release(unk);
4161 }
4162
4163 for (i = 0; i < ARRAY_SIZE(unsupported_classes); ++i)
4164 {
4165 memset(&mqi, 0, sizeof(mqi));
4166 mqi.pIID = &IID_IUnknown;
4167 hr = pCoCreateInstanceFromApp(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
4168 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4169
4170 hr = CoCreateInstance(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
4171 &IID_IUnknown, (void **)&unk);
4172 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4173
4174 hr = CoCreateInstance(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4175 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4176 IUnknown_Release(unk);
4177 }
4178
4179 /* Locally registered classes are filtered out. */
4182 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4183
4184 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&unk);
4185 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4186
4187 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER, NULL,
4188 &IID_IClassFactory, (void **)&unk);
4189 todo_wine
4190 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
4191
4192 hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4193 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
4194
4195 hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
4196 &IID_IUnknown, (void **)&unk);
4197 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4198
4199 memset(&mqi, 0, sizeof(mqi));
4200 mqi.pIID = &IID_IUnknown;
4201 hr = pCoCreateInstanceFromApp(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
4202 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4203
4205 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4206
4207 /* Activation context */
4208 if ((handle = activate_context(actctx_manifest, &actctx_cookie)))
4209 {
4210 hr = CoCreateInstance(&IID_Testiface7, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4211 ok(hr == 0x80001235, "Unexpected hr %#lx.\n", hr);
4212
4213 hr = CoCreateInstance(&IID_Testiface7, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
4214 &IID_IUnknown, (void **)&unk);
4215 ok(hr == 0x80001235, "Unexpected hr %#lx.\n", hr);
4216
4217 deactivate_context(handle, actctx_cookie);
4218 }
4219
4221}
4222
4223static void test_call_cancellation(void)
4224{
4225 HRESULT hr;
4226
4227 /* Cancellation is disabled initially. */
4229 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4230
4232 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4233
4235 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4236
4238 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4239
4241 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4242
4243 /* Counter is not affected by initialization. */
4244 hr = CoInitialize(NULL);
4245 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4246
4248 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4249
4251 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4252
4254 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4255
4257
4259 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4260
4262 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4263
4264 /* It's cumulative. */
4266 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4267
4269 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4270
4272 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4273
4275 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4276
4278 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4279}
4280
4282{
4287};
4288
4290{
4295};
4296
4298{
4299 struct oletlsdata *data = NtCurrentTeb()->ReservedForOle;
4300 return data ? data->flags : 0;
4301}
4302
4304{
4305 IUnknown *unk;
4306 DWORD flags;
4307 HRESULT hr;
4308
4309 hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4310 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4311 IUnknown_Release(unk);
4312
4313 /* Flag is not set for implicit MTA. */
4315 ok(!(flags & OLETLS_MULTITHREADED), "Unexpected flags %#lx.\n", flags);
4316
4317 return 0;
4318}
4319
4320static void test_oletlsdata(void)
4321{
4322 HANDLE thread;
4323 DWORD flags;
4324 HRESULT hr;
4325 GUID guid;
4326
4327 /* STA */
4328 hr = CoInitialize(NULL);
4329 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4331 ok(flags & OLETLS_APARTMENTTHREADED && !(flags & OLETLS_DISABLE_OLE1DDE), "Unexpected flags %#lx.\n", flags);
4334 ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
4335
4337 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4339 ok(flags & OLETLS_APARTMENTTHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#lx.\n", flags);
4342 ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
4343
4344 /* MTA */
4346 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4348 ok(flags & OLETLS_MULTITHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#lx.\n", flags);
4349
4350 /* Implicit case. */
4352 ok(thread != NULL, "Failed to create a test thread, error %ld.\n", GetLastError());
4353 ok(!WaitForSingleObject(thread, 5000), "Wait timed out.\n");
4355
4358 ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
4359
4360 /* Thread ID. */
4362 ok(!(flags & OLETLS_UUIDINITIALIZED), "Unexpected flags %#lx.\n", flags);
4363
4365 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4366
4369 "Unexpected flags %#lx.\n", flags);
4370}
4371
4373{
4374 init_funcs();
4375
4378 lstrcatA(testlib, "\\testlib.dll");
4379 extract_resource("testlib.dll", "TESTDLL", testlib);
4380
4388 test_ole_menu();
4424
4426}
#define CO_E_NOTINITIALIZED
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
static HANDLE thread
Definition: service.c:33
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define RegCloseKey(hKey)
Definition: registry.h:49
HANDLE HKEY
Definition: registry.h:26
const CLSID CLSID_GlobalOptions
const CLSID CLSID_ManualResetEvent
const CLSID CLSID_InProcFreeMarshaler
const CLSID CLSID_StdGlobalInterfaceTable
#define WM_DDE_FIRST
Definition: dde.h:47
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
static const WCHAR clsidW[]
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, CLSID *clsid)
Definition: combase.c:1437
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: combase.c:2294
DWORD WINAPI CoGetCurrentProcess(void)
Definition: combase.c:2739
HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, CLSID *clsidNew)
Definition: combase.c:1224
HRESULT WINAPI CoRegisterMessageFilter(IMessageFilter *filter, IMessageFilter **ret_filter)
Definition: combase.c:2220
HRESULT WINAPI IIDFromString(LPCOLESTR str, IID *iid)
Definition: combase.c:1492
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, COSERVERINFO *server_info, ULONG count, MULTI_QI *results)
Definition: combase.c:1882
HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie)
Definition: combase.c:1983
HRESULT WINAPI CoDisableCallCancellation(void *reserved)
Definition: combase.c:3284
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD cookie)
Definition: combase.c:3107
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: combase.c:2668
HRESULT WINAPI CoEnableCallCancellation(void *reserved)
Definition: combase.c:3305
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *progid)
Definition: combase.c:1262
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: combase.c:1936
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD clscontext, COSERVERINFO *server_info, REFIID riid, void **obj)
Definition: combase.c:1925
HRESULT WINAPI CoDisconnectObject(IUnknown *object, DWORD reserved)
Definition: combase.c:3190
HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
Definition: combase.c:1176
HRESULT WINAPI CoGetCallContext(REFIID riid, void **obj)
Definition: combase.c:1944
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: combase.c:2359
HRESULT WINAPI CoCreateGuid(GUID *guid)
Definition: combase.c:1016
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetInstanceFromFile(COSERVERINFO *server_info, CLSID *rclsid, IUnknown *outer, DWORD cls_context, DWORD grfmode, OLECHAR *filename, DWORD count, MULTI_QI *results)
Definition: combase.c:1575
HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
Definition: combase.c:2029
HRESULT WINAPI CoLockObjectExternal(IUnknown *object, BOOL lock, BOOL last_unlock_releases)
Definition: combase.c:3237
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: combase.c:2714
HRESULT WINAPI CoWaitForMultipleHandles(DWORD flags, DWORD timeout, ULONG handle_count, HANDLE *handles, DWORD *index)
Definition: combase.c:2067
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, IUnknown *object, DWORD clscontext, DWORD flags, DWORD *cookie)
Definition: combase.c:2970
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, IUnknown *unk, IStream **stream)
Definition: marshal.c:154
HRESULT WINAPI CoGetInterfaceAndReleaseStream(IStream *stream, REFIID riid, void **obj)
Definition: marshal.c:139
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
HRESULT WINAPI CoReleaseMarshalData(IStream *stream)
Definition: marshal.c:673
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
#define CloseHandle
Definition: compat.h:739
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
WCHAR OLECHAR
Definition: compat.h:2292
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GetCurrentProcess()
Definition: compat.h:759
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define lstrlenW
Definition: compat.h:750
static void cleanup(void)
Definition: main.c:1335
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2125
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:1973
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
Definition: thread.c:959
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:265
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
GUID guid
Definition: version.c:147
static MonoProfilerRuntimeShutdownBeginCallback cb
Definition: metahost.c:118
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
Definition: compobj.c:716
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:668
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
HRESULT WINAPI OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
Definition: ole2.c:848
HRESULT WINAPI OleSetMenuDescriptor(HOLEMENU hOleMenu, HWND hwndFrame, HWND hwndActiveObject, LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject)
Definition: ole2.c:1856
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
#define progid(str)
Definition: exdisp.idl:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
int form
Definition: main.c:89
FxObject * pObject
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct _cl_event * event
Definition: glext.h:7739
GLuint res
Definition: glext.h:9613
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum mode
Definition: glext.h:6217
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
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
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 * u
Definition: glfuncs.h:240
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 token
Definition: glfuncs.h:210
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static TfClientId tid
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define NtCurrentTeb
#define debugstr_guid
Definition: kernel32.h:35
#define actctx
Definition: kernel32.h:8
#define wine_dbgstr_w
Definition: kernel32.h:34
BOOL is_wow64
Definition: main.c:38
static const BOOL is_win64
Definition: kernelbase.h:49
#define GUID_NULL
Definition: ks.h:106
#define REG_SZ
Definition: layer.c:22
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
HRESULT WINAPI CoRevokeMallocSpy(void)
Definition: malloc.c:431
HRESULT WINAPI CoRegisterMallocSpy(IMallocSpy *spy)
Definition: malloc.c:405
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: malloc.c:365
#define win_skip
Definition: minitest.h:67
#define todo_wine
Definition: minitest.h:80
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define CREATE_ALWAYS
Definition: disk.h:72
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
static const WCHAR filenameW[]
Definition: amstream.c:41
static void test_object(void)
Definition: d3drm.c:1575
HRESULT hres
Definition: protocol.c:465
static HINSTANCE hkernel32
Definition: process.c:68
#define ok_more_than_one_lock()
Definition: compobj.c:88
static const GUID IID_Testiface
Definition: compobj.c:93
#define SET_EXPECT(func)
Definition: compobj.c:45
static IUnknown ** ppOldObject
Definition: compobj.c:75
static IID create_instance_iid
Definition: compobj.c:162
static int WINAPI testspy_PostDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
Definition: compobj.c:3373
static ULONG WINAPI Test_CallContext_AddRef(IUnknown *iface)
Definition: compobj.c:2031
static void test_CoInitializeEx(void)
Definition: compobj.c:2282
static void test_CoMarshalInterThreadInterfaceInStream(void)
Definition: compobj.c:1544
static HRESULT WINAPI getinstance_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
Definition: compobj.c:3775
static ATOM register_dummy_class(void)
Definition: compobj.c:889
static LONG cLocks
Definition: compobj.c:119
static LRESULT CALLBACK cowait_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: compobj.c:2665
static void test_CoRegisterMessageFilter(void)
Definition: compobj.c:990
static void test_CoGetInstanceFromFile(void)
Definition: compobj.c:3804
static void *WINAPI testspy_PreGetSize(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3355
static DWORD CALLBACK send_message_thread(LPVOID arg)
Definition: compobj.c:2591
static ULONG WINAPI testspy_AddRef(IMallocSpy *iface)
Definition: compobj.c:3310
static HRESULT WINAPI testinitialize_QI(IInitializeSpy *iface, REFIID riid, void **obj)
Definition: compobj.c:3460
static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, OLEVERB *rgelt, ULONG *fetched)
Definition: compobj.c:1047
static IPersistFile testpersistfile
Definition: compobj.c:3751
static const GUID IID_Testiface7
Definition: compobj.c:99
static ULONG WINAPI PSFactoryBuffer_AddRef(IPSFactoryBuffer *This)
Definition: compobj.c:1139
static void test_CoGetClassObject(void)
Definition: compobj.c:744
#define test_apt_type(t, q)
Definition: compobj.c:663
static HRESULT WINAPI testinitialize_PreUninitialize(IInitializeSpy *iface, DWORD aptrefs)
Definition: compobj.c:3501
static HRESULT WINAPI PSFactoryBuffer_QueryInterface(IPSFactoryBuffer *This, REFIID riid, void **ppvObject)
Definition: compobj.c:1124
static void test_ole_menu(void)
Definition: compobj.c:908
static void WINAPI testspy_PreHeapMinimize(IMallocSpy *iface)
Definition: compobj.c:3379
static DWORD CALLBACK get_class_object_proxy_thread(LPVOID pv)
Definition: compobj.c:1713
static ULONG WINAPI MessageFilter_AddRef(IMessageFilter *iface)
Definition: compobj.c:936
static DWORD CALLBACK register_ps_clsid_thread(void *context)
Definition: compobj.c:1195
static void test_registered_object_thread_affinity(void)
Definition: compobj.c:1767
static void deactivate_context(HANDLE handle, ULONG_PTR cookie)
Definition: compobj.c:281
static void test_CoCreateInstanceFromApp(void)
Definition: compobj.c:4122
static HRESULT WINAPI EnumOLEVERB_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
Definition: compobj.c:1032
static HRESULT WINAPI testinstance_QI(IPersistFile *iface, REFIID riid, void **obj)
Definition: compobj.c:3672
static const char actctx_manifest[]
Definition: compobj.c:290
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1187
static ULONG WINAPI EnumOLEVERB_AddRef(IEnumOLEVERB *iface)
Definition: compobj.c:1037
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:77
static void test_CoGetApartmentType(void)
Definition: compobj.c:3245
static void cowait_msgs_reset(void)
Definition: compobj.c:2618
static void test_implicit_mta(void)
Definition: compobj.c:4030
static HRESULT WINAPI Test_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:131
static const IMallocSpyVtbl testspyvtbl
Definition: compobj.c:3389
static DWORD expected_coinit_flags
Definition: compobj.c:3483
static DWORD CALLBACK free_libraries_thread(LPVOID p)
Definition: compobj.c:1855
#define CHECK_CALLED(func, n)
Definition: compobj.c:60
static UINT cowait_msgs[100]
Definition: compobj.c:2616
#define ok_ole_success(hr, func)
Definition: compobj.c:87
static HRESULT WINAPI PSFactoryBuffer_CreateProxy(IPSFactoryBuffer *This, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
Definition: compobj.c:1151
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:2008
static DWORD CALLBACK send_and_post_user_message_thread(void *arg)
Definition: compobj.c:2598
static HRESULT WINAPI testinstance_Save(IPersistFile *iface, LPCOLESTR filename, BOOL remember)
Definition: compobj.c:3722
static IUnknown Test_Unknown
Definition: compobj.c:1030
static HRESULT WINAPI getinstance_cf_QI(IClassFactory *iface, REFIID riid, void **obj)
Definition: compobj.c:3753
static void CALLBACK apc_test_proc(ULONG_PTR param)
Definition: compobj.c:2578
static HRESULT WINAPI testinitialize_PostInitialize(IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD aptrefs)
Definition: compobj.c:3494
static const IInitializeSpyVtbl testinitializevtbl
Definition: compobj.c:3527
static IClassFactory Test_ClassFactory
Definition: compobj.c:191
static const WCHAR stdfont[]
Definition: compobj.c:105
static HRESULT WINAPI Test_IUnknown_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:1083
static void test_OleRegGetUserType(void)
Definition: compobj.c:2414
static const char cls_name[]
Definition: compobj.c:2614
static void test_TreatAsClass(void)
Definition: compobj.c:2182
static char testlib[MAX_PATH]
Definition: compobj.c:235
static void test_call_cancellation(void)
Definition: compobj.c:4223
static DWORD CALLBACK register_class_object_thread(LPVOID pv)
Definition: compobj.c:1738
static void test_CoCreateInstance(void)
Definition: compobj.c:681
#define CHECK_EXPECT(func)
Definition: compobj.c:54
static void test_GlobalOptions(void)
Definition: compobj.c:3919
static ULONG WINAPI testinstance_Release(IPersistFile *iface)
Definition: compobj.c:3700
static const GUID IID_Testiface4
Definition: compobj.c:96
static HRESULT WINAPI Test_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: compobj.c:175
static ULONG WINAPI Test_CallContext_Release(IUnknown *iface)
Definition: compobj.c:2037
static ULONG WINAPI testinitialize_Release(IInitializeSpy *iface)
Definition: compobj.c:3478
#define DEFINE_EXPECT(func)
Definition: compobj.c:42
static ULONG WINAPI getinstance_cf_Release(IClassFactory *iface)
Definition: compobj.c:3770
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:237
static SIZE_T WINAPI testspy_PostGetSize(IMallocSpy *iface, SIZE_T actual, BOOL spyed)
Definition: compobj.c:3361
static REGSAM
Definition: compobj.c:80
static DWORD CALLBACK revoke_class_object_thread(LPVOID pv)
Definition: compobj.c:1753
static const WCHAR progidW[]
Definition: compobj.c:112
static ULONG WINAPI MessageFilter_Release(IMessageFilter *iface)
Definition: compobj.c:941
static HRESULT g_persistfile_qi_ret
Definition: compobj.c:3670
static IMallocSpy testspy
Definition: compobj.c:3408
static DWORD CALLBACK get_class_object_thread(LPVOID pv)
Definition: compobj.c:1699
static LPVOID * ppv
Definition: compobj.c:74
static void test_CoGetInterfaceAndReleaseStream(void)
Definition: compobj.c:1495
static HRESULT WINAPI testinstance_GetCurFile(IPersistFile *iface, LPOLESTR *filename)
Definition: compobj.c:3733
static const CLSID CLSID_non_existent
Definition: compobj.c:91
static IUnknown DWORD clscontext
Definition: compobj.c:82
static void test_IInitializeSpy(BOOL mt)
Definition: compobj.c:3554
static HRESULT WINAPI getinstance_cf_LockServer(IClassFactory *iface, BOOL lock)
Definition: compobj.c:3788
static const IUnknownVtbl TestCallContext_Vtbl
Definition: compobj.c:2046
oletlsflags
Definition: compobj.c:4282
@ OLETLS_DISABLE_OLE1DDE
Definition: compobj.c:4284
@ OLETLS_APARTMENTTHREADED
Definition: compobj.c:4285
@ OLETLS_MULTITHREADED
Definition: compobj.c:4286
@ OLETLS_UUIDINITIALIZED
Definition: compobj.c:4283
static HRESULT WINAPI testinstance_SaveCompleted(IPersistFile *iface, LPCOLESTR filename)
Definition: compobj.c:3727
static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
Definition: compobj.c:1042
static HRESULT WINAPI Test_IClassFactory_CreateInstance(LPCLASSFACTORY iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:163
static DWORD WINAPI MessageFilter_RetryRejectedCall(IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwRejectType)
Definition: compobj.c:957
static void test_CoRegisterClassObject(void)
Definition: compobj.c:1578
static HRESULT WINAPI EnumOLEVERB_Reset(IEnumOLEVERB *iface)
Definition: compobj.c:1059
static IUnknown * outer
Definition: compobj.c:82
static SIZE_T WINAPI testspy_PreAlloc(IMallocSpy *iface, SIZE_T cb)
Definition: compobj.c:3320
static LPBOOL
Definition: compobj.c:85
static ULONG WINAPI Test_IUnknown_Release(IUnknown *iface)
Definition: compobj.c:1108
static IEnumOLEVERB EnumOLEVERB
Definition: compobj.c:1081
static void test_CoFreeUnusedLibraries(void)
Definition: compobj.c:1866
static const char actctx_manifest2[]
Definition: compobj.c:351
#define cowait_msgs_expect_queued(a, b)
Definition: compobj.c:2646
static void WINAPI testspy_PostFree(IMallocSpy *iface, BOOL spyed)
Definition: compobj.c:3338
static const GUID IID_Testiface6
Definition: compobj.c:98
static ULONG WINAPI Test_IUnknown_AddRef(IUnknown *iface)
Definition: compobj.c:1103
static void test_CoRegisterPSClsid(void)
Definition: compobj.c:1216
static DWORD WINAPI MessageFilter_HandleInComingCall(IMessageFilter *iface, DWORD dwCallType, HTASK threadIDCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo)
Definition: compobj.c:946
static DWORD
Definition: compobj.c:80
static void test_CoMarshalInterface(void)
Definition: compobj.c:1509
#define CHECK_EXPECT2(func)
Definition: compobj.c:48
static void UnlockModule(void)
Definition: compobj.c:126
static DWORD WINAPI test_init_spies_proc(void *arg)
Definition: compobj.c:3540
static BOOL revoke_spies_on_uninit
Definition: compobj.c:3485
static HRESULT WINAPI MessageFilter_QueryInterface(IMessageFilter *iface, REFIID riid, void **ppvObj)
Definition: compobj.c:921
static ULONG WINAPI Test_IClassFactory_AddRef(LPCLASSFACTORY iface)
Definition: compobj.c:150
static HRESULT WINAPI EnumOLEVERB_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
Definition: compobj.c:1065
#define ok_no_locks()
Definition: compobj.c:89
static void test_StringFromGUID2(void)
Definition: compobj.c:635
static const IPersistFileVtbl testpersistfilevtbl
Definition: compobj.c:3739
static void test_CoGetCurrentProcess(void)
Definition: compobj.c:4050
static DWORD CALLBACK cowait_unmarshal_thread(void *arg)
Definition: compobj.c:2674
static void WINAPI testspy_PostHeapMinimize(IMallocSpy *iface)
Definition: compobj.c:3384
static IClassFactory getinstance_cf
Definition: compobj.c:3802
static void test_ProgIDFromCLSID(void)
Definition: compobj.c:379
static void test_IMallocSpy(void)
Definition: compobj.c:3410
static void test_CoGetCurrentLogicalThreadId(void)
Definition: compobj.c:3446
static void _cowait_msgs_expect_queued(unsigned line, HWND hwnd, UINT expected_msg)
Definition: compobj.c:2647
static DWORD WINAPI co_get_current_process_thread(void *param)
Definition: compobj.c:4042
static IUnknown DWORD void DWORD count
Definition: compobj.c:83
static void test_CoGetObjectContext(void)
Definition: compobj.c:1909
static void extract_resource(const char *name, const char *type, const char *path)
Definition: compobj.c:217
static void test_CoGetMalloc(void)
Definition: compobj.c:3176
static void test_CoGetContextToken(void)
Definition: compobj.c:2110
static const CLSID CLSID_StdFont
Definition: compobj.c:92
static ULONG WINAPI PSFactoryBuffer_Release(IPSFactoryBuffer *This)
Definition: compobj.c:1145
static void *WINAPI testspy_PreDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3367
static const IClassFactoryVtbl getinstance_cf_vtbl
Definition: compobj.c:3794
static ULONG WINAPI getinstance_cf_AddRef(IClassFactory *iface)
Definition: compobj.c:3765
static void _cowait_msgs_expect_empty(unsigned line)
Definition: compobj.c:2624
static ULONG WINAPI testinstance_AddRef(IPersistFile *iface)
Definition: compobj.c:3695
static const IMessageFilterVtbl MessageFilter_Vtbl
Definition: compobj.c:978
static SIZE_T WINAPI testspy_PreRealloc(IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
Definition: compobj.c:3343
static IPSFactoryBuffer * ps_factory_buffer
Definition: compobj.c:1122
static UINT cowait_msgs_first
Definition: compobj.c:2616
static void test_OleInitialize_InitCounting(void)
Definition: compobj.c:2304
static const GUID IID_Testiface3
Definition: compobj.c:95
static void test_OleRegGetMiscStatus(void)
Definition: compobj.c:2371
static void test_CoCreateGuid(void)
Definition: compobj.c:2570
static void test_oletlsdata(void)
Definition: compobj.c:4320
static void _cowait_msgs_expect_notified(unsigned line, UINT expected_msg)
Definition: compobj.c:2634
static const GUID IID_Testiface2
Definition: compobj.c:94
static const IEnumOLEVERBVtbl EnumOLEVERBVtbl
Definition: compobj.c:1071
static BOOL is_module_loaded(const char *module)
Definition: compobj.c:1861
static void test_CLSIDFromProgID(void)
Definition: compobj.c:431
static const WCHAR wszCLSID_StdFont[]
Definition: compobj.c:107
static ULARGE_INTEGER init_cookies[3]
Definition: compobj.c:3484
static void *WINAPI testspy_PreFree(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3332
static BOOL create_manifest_file(const char *filename, const char *manifest)
Definition: compobj.c:195
static HRESULT WINAPI testinstance_Load(IPersistFile *iface, LPCOLESTR filename, DWORD mode)
Definition: compobj.c:3717
#define cowait_msgs_expect_notified(a)
Definition: compobj.c:2633
static void _test_apt_type(APTTYPE expected_type, APTTYPEQUALIFIER expected_qualifier, int line)
Definition: compobj.c:664
static HRESULT WINAPI testinitialize_PreInitialize(IInitializeSpy *iface, DWORD coinit, DWORD aptrefs)
Definition: compobj.c:3487
static UINT cowait_msgs_last
Definition: compobj.c:2616
static DWORD CALLBACK implicit_mta_proc(void *param)
Definition: compobj.c:3977
static HRESULT g_persistfile_load_ret
Definition: compobj.c:3671
static IPSFactoryBufferVtbl PSFactoryBufferVtbl
Definition: compobj.c:1176
static const GUID IID_TestPS
Definition: compobj.c:101
static HRESULT WINAPI testinstance_GetClassID(IPersistFile *iface, CLSID *clsid)
Definition: compobj.c:3705
static ULONG WINAPI testinitialize_AddRef(IInitializeSpy *iface)
Definition: compobj.c:3473
static void init_funcs(void)
Definition: compobj.c:3958
static IUnknown DWORD void DWORD MULTI_QI * results
Definition: compobj.c:83
static void test_CoGetCallContext(void)
Definition: compobj.c:2053
static const WCHAR wszNonExistent[]
Definition: compobj.c:106
static DWORD WINAPI MessageFilter_MessagePending(IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwPendingType)
Definition: compobj.c:967
static const GUID IID_Testiface5
Definition: compobj.c:97
static const GUID IID_Testiface8
Definition: compobj.c:100
static void test_CoCreateInstanceEx(void)
Definition: compobj.c:865
static void flush_messages(void)
Definition: compobj.c:2659
static void test_mta_usage(void)
Definition: compobj.c:4067
static HRESULT WINAPI testspy_QI(IMallocSpy *iface, REFIID riid, void **obj)
Definition: compobj.c:3298
static HRESULT WINAPI EnumOLEVERB_Skip(IEnumOLEVERB *iface, ULONG celt)
Definition: compobj.c:1053
static DWORD CALLBACK oletlsdata_test_thread(void *arg)
Definition: compobj.c:4303
static HRESULT WINAPI testinitialize_PostUninitialize(IInitializeSpy *iface, DWORD aptrefs)
Definition: compobj.c:3521
static HRESULT WINAPI PSFactoryBuffer_CreateStub(IPSFactoryBuffer *This, REFIID riid, IUnknown *pUnkServer, IRpcStubBuffer **ppStub)
Definition: compobj.c:1161
static const IClassFactoryVtbl TestClassFactory_Vtbl
Definition: compobj.c:182
static LPCSTR
Definition: compobj.c:80
static DWORD CALLBACK post_message_thread(LPVOID arg)
Definition: compobj.c:2607
static void *WINAPI testspy_PostAlloc(IMallocSpy *iface, void *ptr)
Definition: compobj.c:3326
static HRESULT WINAPI testinstance_IsDirty(IPersistFile *iface)
Definition: compobj.c:3711
static void test_CoWaitForMultipleHandles(void)
Definition: compobj.c:2791
static HRESULT WINAPI Test_CallContext_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:2013
static IMessageFilter MessageFilter
Definition: compobj.c:988
static void LockModule(void)
Definition: compobj.c:121
static DWORD CALLBACK release_semaphore_thread(LPVOID arg)
Definition: compobj.c:2583
static void test_CoGetPSClsid(void)
Definition: compobj.c:1319
static DWORD get_oletlsflags(void)
Definition: compobj.c:4297
static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
Definition: compobj.c:2701
static IInitializeSpy testinitialize
Definition: compobj.c:3538
static void test_CLSIDFromString(void)
Definition: compobj.c:497
static WCHAR manifest_path[MAX_PATH]
Definition: compobj.c:193
static ULONG WINAPI testspy_Release(IMallocSpy *iface)
Definition: compobj.c:3315
static const WCHAR cf_brokenW[]
Definition: compobj.c:113
static void test_CoUnmarshalInterface(void)
Definition: compobj.c:1466
static void *WINAPI testspy_PostRealloc(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3349
static void test_IIDFromString(void)
Definition: compobj.c:573
#define cowait_msgs_expect_empty()
Definition: compobj.c:2623
static const IUnknownVtbl TestUnknown_Vtbl
Definition: compobj.c:1113
static ULONG WINAPI Test_IClassFactory_Release(LPCLASSFACTORY iface)
Definition: compobj.c:156
static HRESULT get_class_object(CLSCTX clsctx)
Definition: compobj.c:1685
static const IID IID_IWineTest
Definition: marshal.c:121
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:140
static const LARGE_INTEGER llZero
Definition: moniker.c:1425
static BSTR *static LPOLESTR
Definition: varformat.c:44
const CLSID * clsid
Definition: msctf.cpp:50
unsigned int UINT
Definition: ndis.h:50
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
#define KEY_READ
Definition: nt_native.h:1026
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1087
#define BOOL
Definition: nt_native.h:43
#define KEY_WRITE
Definition: nt_native.h:1034
#define GENERIC_WRITE
Definition: nt_native.h:90
@ REGCLS_MULTI_SEPARATE
Definition: objbase.h:397
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:396
@ REGCLS_SINGLEUSE
Definition: objbase.h:395
@ COWAIT_ALERTABLE
Definition: objbase.h:714
@ COWAIT_INPUTAVAILABLE
Definition: objbase.h:715
@ COWAIT_WAITALL
Definition: objbase.h:713
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:281
@ COINIT_MULTITHREADED
Definition: objbase.h:280
#define STGM_READ
Definition: objbase.h:934
enum _THDTYPE THDTYPE
@ APTTYPEQUALIFIER_IMPLICIT_MTA
@ APTTYPEQUALIFIER_NONE
@ COMGLB_EXCEPTION_HANDLE
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
@ THDTYPE_PROCESSMESSAGES
@ THDTYPE_BLOCKMESSAGES
const GUID IID_IEnumOLEVERB
const GUID IID_IPersistFile
#define WS_TILEDWINDOW
Definition: pedump.c:643
long LONG
Definition: pedump.c:60
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define CLSID_NULL
Definition: guiddef.h:99
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
#define REFCLSID
Definition: guiddef.h:117
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
const WCHAR * str
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:206
#define exit(n)
Definition: config.h:202
#define memset(x, y, z)
Definition: compat.h:39
@ OLEMISC_RECOMPOSEONRESIZE
Definition: actctx.c:82
int zero
Definition: sehframes.cpp:29
HRESULT hr
Definition: shlfolder.c:183
IUnknown IUnknown_iface
Definition: compobj.c:2004
$ULONG LowPart
Definition: ntbasedef.h:581
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
$ULONG HighPart
Definition: ntbasedef.h:582
HINSTANCE hInstance
Definition: winuser.h:3308
HCURSOR hCursor
Definition: winuser.h:3310
UINT style
Definition: winuser.h:3304
UINT cbSize
Definition: winuser.h:3303
WNDPROC lpfnWndProc
Definition: winuser.h:3305
LPCSTR lpszClassName
Definition: winuser.h:3313
HBRUSH hbrBackground
Definition: winuser.h:3311
DWORD miscstatuscontent
Definition: combase.c:71
DWORD miscstatusdocprint
Definition: combase.c:74
DWORD miscstatusthumbnail
Definition: combase.c:72
Definition: http.c:7252
Definition: cookie.c:34
Definition: fci.c:127
Definition: copy.c:22
Definition: parser.c:49
Definition: name.c:39
void * threadbase
Definition: compobj.c:4291
DWORD id
Definition: compobj.c:4293
DWORD flags
Definition: compobj.c:4294
void * smallocator
Definition: compobj.c:4292
Definition: ps.c:97
Definition: parse.h:23
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:491
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synchansi.c:44
rwlock_t lock
Definition: tcpcore.h:0
#define DWORD_PTR
Definition: treelist.c:76
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint32_t DWORD_PTR
Definition: typedefs.h:65
PVOID HANDLE
Definition: typedefs.h:73
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
static EFI_HANDLE * handles
Definition: uefidisk.c:118
Definition: pdh_main.c:96
static const CHAR manifest[]
Definition: v6util.h:41
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1146
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define WAIT_IO_COMPLETION
Definition: winbase.h:388
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1156
#define MAKEINTATOM(i)
Definition: winbase.h:1220
#define WAIT_OBJECT_0
Definition: winbase.h:383
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
void * arg
Definition: msvc.h:10
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801
#define S_FALSE
Definition: winerror.h:3451
#define CO_E_IIDSTRING
Definition: winerror.h:3920
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define CO_E_CANCEL_DISABLED
Definition: winerror.h:3611
#define RPC_E_WRONG_THREAD
Definition: winerror.h:3562
#define E_NOINTERFACE
Definition: winerror.h:3479
#define STG_E_READFAULT
Definition: winerror.h:3671
#define REGDB_E_IIDNOTREG
Definition: winerror.h:3802
#define REGDB_E_WRITEREGDB
Definition: winerror.h:3798
#define CO_E_OBJNOTREG
Definition: winerror.h:3927
#define RPC_S_CALLPENDING
Definition: winerror.h:3569
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:3571
#define MK_E_CANTOPENFILE
Definition: winerror.h:3905
#define RPC_E_NO_SYNC
Definition: winerror.h:3580
#define E_POINTER
Definition: winerror.h:3480
#define CO_E_OBJISREG
Definition: winerror.h:3928
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:3510
#define RPC_E_CHANGED_MODE
Definition: winerror.h:3554
#define CO_E_CLASSSTRING
Definition: winerror.h:3919
#define HKEY_CURRENT_USER
Definition: winreg.h:11
ACCESS_MASK REGSAM
Definition: winreg.h:76
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define CS_VREDRAW
Definition: winuser.h:666
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define WM_QUIT
Definition: winuser.h:1651
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define MWMO_ALERTABLE
Definition: winuser.h:920
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4417
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CS_HREDRAW
Definition: winuser.h:661
#define IDC_ARROW
Definition: winuser.h:695
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:893
#define QS_ALLINPUT
Definition: winuser.h:914
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PM_REMOVE
Definition: winuser.h:1207
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_USER
Definition: winuser.h:1923
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PM_NOREMOVE
Definition: winuser.h:1206
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
#define COLOR_BTNFACE
Definition: winuser.h:939
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
ret QuadPart
Definition: rtlfuncs.h:3106
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182
unsigned char BYTE
Definition: xxhash.c:193