10#define WIN32_NO_STATUS
23#define ASSOCQUERY_DE (ASSOCQUERY_DIRECT | ASSOCQUERY_EXISTS)
24#define ASSOCQUERY_SDE (ASSOCQUERY_STRING | ASSOCQUERY_DE)
25#define ASSOCQUERY_SDED (ASSOCQUERY_SDE | ASSOCQUERY_DWORD)
26#define ASSOCQUERY_SDEI (ASSOCQUERY_SDE | ASSOCQUERY_INDIRECT)
27#define ASSOCQUERY_SDEEV (ASSOCQUERY_SDE | ASSOCQUERY_EXTRA_VERB)
49 { &CLSID_AssocShellElement,
L"AssocShellElement" },
50 { &CLSID_AssocApplicationElement,
L"AssocApplicationElement" },
51 { &CLSID_AssocProgidElement,
L"AssocProgidElement" },
52 { &CLSID_AssocClsidElement,
L"AssocClsidElement" },
53 { &CLSID_AssocSystemElement,
L"AssocSystemElement" },
54 { &CLSID_AssocFolderElement,
L"AssocFolderElement" },
55 { &CLSID_AssocStarElement,
L"AssocStarElement" },
56 { &CLSID_AssocPerceivedElement,
L"AssocPerceivedElement" },
57 { &CLSID_AssocClientElement,
L"AssocClientElement" },
83 IAssociationElement *pElement =
NULL;
86 ok(
hr ==
S_OK,
"[%s] AssocCreateElement failed: 0x%08lX\n",
93 ok(
hr ==
S_OK,
"[%s] QI(IPersist) failed: 0x%08lX\n",
99 ok(
hr ==
S_OK,
"[%s] GetClassID failed: 0x%08lX\n",
106 IPersistString2 *pPS2 =
NULL;
108 ok(
hr ==
S_OK,
"[%s] QI(IPersistString2) failed: 0x%08lX\n",
113 IObjectWithQuerySourceOld *pOWQS =
NULL;
115 ok(
hr ==
S_OK,
"[%s] QI(IObjectWithQuerySourceOld) failed: 0x%08lX\n",
124 IAssociationElementOld *pElement =
NULL;
127 ok(
hr ==
S_OK,
"[%s] AssocCreateElement failed: 0x%08lX\n",
134 ok(
hr ==
S_OK,
"[%s] QI(IPersist) failed: 0x%08lX\n",
140 ok(
hr ==
S_OK,
"[%s] GetClassID failed: 0x%08lX\n",
147 IPersistString2 *pPS2 =
NULL;
149 ok(
hr ==
S_OK,
"[%s] QI(IPersistString2) failed: 0x%08lX\n",
154 IObjectWithQuerySourceOld *pOWQS =
NULL;
156 ok(
hr ==
S_OK,
"[%s] QI(IObjectWithQuerySourceOld) failed: 0x%08lX\n",
171 IAssociationElement *pElement =
NULL;
174 ok(
hr ==
S_OK,
"AssocCreateElement failed: 0x%08lX\n",
hr);
189 ok(
hr == 0xDEAD,
"hr was 0x%08lX\n",
hr);
195 IAssociationElementOld *pElement =
NULL;
198 ok(
hr ==
S_OK,
"AssocCreateElement failed: 0x%08lX\n",
hr);
205 ok(psz ==
NULL,
"psz should be NULL\n");
214 IPersistString2 *pPS2 =
NULL;
217 ok(
hr ==
S_OK,
"AssocCreateElement failed: 0x%08lX\n",
hr);
221 hr = pPS2->SetString(
L"txtfile");
222 ok(
hr ==
S_OK,
"First SetString failed: 0x%08lX\n",
hr);
224 hr = pPS2->SetString(
L"txtfile");
236 IPersistString2 *pPS2 =
NULL;
239 ok(
hr ==
S_OK,
"AssocCreateElement(AssocShellElement) failed: 0x%08lX\n",
hr);
243 hr = pPS2->SetString(
L"txtfile");
246 skip(
"\"txtfile\" ProgID was not found in HKCR, skipping\n");
253 IAssociationElement *pElement =
NULL;
255 ok(
hr ==
S_OK,
"QI(IAssociationElement) failed: 0x%08lX\n",
hr);
260 ok(
hr ==
S_OK,
"QueryString(FriendlyTypeName) failed: 0x%08lX\n",
hr);
269 ok(
hr ==
S_OK,
"QueryExists(DefaultIcon) failed: 0x%08lX\n",
hr);
276 IAssociationElementOld *pElement =
NULL;
278 ok(
hr ==
S_OK,
"QI(IAssociationElementOld) failed: 0x%08lX\n",
hr);
283 ok(
hr ==
S_OK,
"QueryString(FriendlyTypeName) failed: 0x%08lX\n",
hr);
292 ok(
hr ==
S_OK,
"QueryExists(DefaultIcon) failed: 0x%08lX\n",
hr);
309 IQuerySource *pSource =
NULL;
314 skip(
"QuerySourceCreateFromKey(txtfile) failed: 0x%08lX\n",
hr);
318 IObjectWithQuerySource *pOWQS =
NULL;
321 ok(
hr ==
S_OK,
"AssocCreateElement(AssocShellElement) failed: 0x%08lX\n",
hr);
324 hr = pOWQS->SetSource(pSource);
325 ok(
hr ==
S_OK,
"SetSource failed: 0x%08lX\n",
hr);
327 IAssociationElement *pElement =
NULL;
329 ok(
hr ==
S_OK,
"QI(IAssociationElementOld) failed: 0x%08lX\n",
hr);
334 ok(
hr ==
S_OK,
"QueryString(FriendlyTypeName) failed: 0x%08lX\n",
hr);
337 trace(
"txtfile (explicit source) FriendlyTypeName: %s\n",
345 hr = pOWQS->SetSource(pSource);
356 IQuerySourceOld *pSource =
NULL;
361 skip(
"QuerySourceCreateFromKey(txtfile) failed: 0x%08lX\n",
hr);
365 IObjectWithQuerySourceOld *pOWQS =
NULL;
368 ok(
hr ==
S_OK,
"AssocCreateElement(AssocShellElement) failed: 0x%08lX\n",
hr);
371 hr = pOWQS->SetSource(pSource);
372 ok(
hr ==
S_OK,
"SetSource failed: 0x%08lX\n",
hr);
374 IAssociationElementOld *pElement =
NULL;
376 ok(
hr ==
S_OK,
"QI(IAssociationElementOld) failed: 0x%08lX\n",
hr);
381 ok(
hr ==
S_OK,
"QueryString(FriendlyTypeName) failed: 0x%08lX\n",
hr);
384 trace(
"txtfile (explicit source) FriendlyTypeName: %s\n",
392 hr = pOWQS->SetSource(pSource);
406 IPersistString2 *pPS2 =
NULL;
409 ok(
hr ==
S_OK,
"AssocCreateElement(AssocProgidElement) failed: 0x%08lX\n",
hr);
413 hr = pPS2->SetString(
L".txt");
418 IAssociationElement *pElement =
NULL;
420 ok(hr2 ==
S_OK,
"QI(IAssociationElement) failed: 0x%08lX\n", hr2);
426 IAssociationElementOld *pElement =
NULL;
428 ok(hr2 ==
S_OK,
"QI(IAssociationElementOld) failed: 0x%08lX\n", hr2);
433 ok(hr3 ==
S_OK,
"QueryString(FriendlyTypeName) for .txt failed: 0x%08lX\n", hr3);
450 IPersistString2 *pPS2 =
NULL;
453 ok(
hr ==
S_OK,
"AssocCreateElement(AssocStarElement) failed: 0x%08lX\n",
hr);
457 hr = pPS2->SetString(
L".rostestunknownext");
458 ok(
hr ==
S_OK,
"SetString failed: 0x%08lX\n",
hr);
462 IAssociationElement *pElement =
NULL;
464 ok(hr2 ==
S_OK,
"QI(IAssociationElement) failed: 0x%08lX\n", hr2);
469 ok(hr3 ==
S_OK,
"QueryString for unknown extension failed: 0x%08lX\n", hr3);
481 IAssociationElementOld *pElement =
NULL;
483 ok(hr2 ==
S_OK,
"QI(IAssociationElementOld) failed: 0x%08lX\n", hr2);
488 ok(hr3 ==
S_OK,
"QueryString for unknown extension failed: 0x%08lX\n", hr3);
505 IPersistString2 *pPS2 =
NULL;
508 ok(
hr ==
S_OK,
"AssocCreateElement(AssocFolderElement) failed: 0x%08lX\n",
hr);
512 hr = pPS2->SetString(
L"");
516 ok(
hr ==
S_OK,
"SetString failed: 0x%08lX\n",
hr);
520 IAssociationElement *pElement =
NULL;
522 ok(hr2 ==
S_OK,
"QI(IAssociationElement) failed: 0x%08lX\n", hr2);
527 ok(hr3 ==
S_OK,
"QueryString(Folder) failed: 0x%08lX\n", hr3);
538 IAssociationElementOld *pElement =
NULL;
540 ok(hr2 ==
S_OK,
"QI(IAssociationElementOld) failed: 0x%08lX\n", hr2);
545 ok(hr3 ==
S_OK,
"QueryString(Folder) failed: 0x%08lX\n", hr3);
566 trace(
"shell32!AssocCreateElement not found. Using shlwapi!AssocCreate instead...\n");
static void Test_QueryBeforeInit(void)
static void Test_StarElement_UnknownExt(void)
static void Test_QueryInterfaceAndClassID(void)
static void Test_InvalidClsid(void)
static const CLASS_ENTRY g_Classes[]
static void Test_ShellElement_ExplicitSource(void)
static void Test_ProgidElement_DotTxt(void)
static HRESULT MyAssocCreateElement(REFCLSID rclsid, REFIID riid, PVOID *ppvObj)
static void Test_FolderElement(void)
static void Test_DoubleSetString(void)
static FN_AssocCreateElement g_fnAssocCreateElement
static void Test_ShellElement_txtfile(void)
HRESULT(WINAPI * FN_AssocCreateElement)(REFCLSID, REFIID, PVOID *)
#define ok_hex(expression, result)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
void WINAPI CoTaskMemFree(void *ptr)
#define ERROR_INVALID_PARAMETER
#define GetProcAddress(x, y)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
EXTERN_C HRESULT WINAPI AssocCreateElement(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ PVOID *ppvObj)
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
#define EXCEPTION_EXECUTE_HANDLER
HRESULT GetClassID([out] CLSID *pClassID)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define IsEqualCLSID(rclsid1, rclsid2)
#define _SEH2_EXCEPT(...)
EXTERN_C HRESULT WINAPI QuerySourceCreateFromKey(_In_ HKEY hKey, _In_opt_ PCWSTR lpSubKey, _In_ BOOL bCreate, _In_ REFIID riid, _Outptr_ PVOID *ppv)
VERSIONHELPERAPI IsWindowsVistaOrGreater()
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
#define CLASS_E_CLASSNOTAVAILABLE
#define HKEY_CLASSES_ROOT
#define MAKEINTRESOURCEA(i)
#define IID_PPV_ARG(Itype, ppType)