From f92caf5ba77abadd8d8c67a14437e45184c5d175 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sat, 8 Jun 2013 16:55:00 +0400 Subject: [PATCH] comdlg32: Store client GUID with SetClientGuid(). --- dlls/comdlg32/itemdlg.c | 9 +++++++-- dlls/comdlg32/tests/itemdlg.c | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index 33398b5741a..2313b0af910 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -125,6 +125,8 @@ typedef struct FileDialogImpl { HWND cctrls_hwnd; struct list cctrls; UINT_PTR cctrl_next_dlgid; + + GUID client_guid; } FileDialogImpl; /************************************************************************** @@ -2032,8 +2034,9 @@ static HRESULT WINAPI IFileDialog2_fnClose(IFileDialog2 *iface, HRESULT hr) static HRESULT WINAPI IFileDialog2_fnSetClientGuid(IFileDialog2 *iface, REFGUID guid) { FileDialogImpl *This = impl_from_IFileDialog2(iface); - FIXME("stub - %p (%s)\n", This, debugstr_guid(guid)); - return E_NOTIMPL; + TRACE("%p (%s)\n", This, debugstr_guid(guid)); + This->client_guid = *guid; + return S_OK; } static HRESULT WINAPI IFileDialog2_fnClearClientData(IFileDialog2 *iface) @@ -3627,6 +3630,8 @@ static HRESULT FileDialog_constructor(IUnknown *pUnkOuter, REFIID riid, void **p fdimpl->default_ext = NULL; fdimpl->custom_cancelbutton = fdimpl->custom_filenamelabel = NULL; + fdimpl->client_guid = GUID_NULL; + /* FIXME: The default folder setting should be restored for the * application if it was previously set. */ SHGetDesktopFolder(&psf); diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index 4e50926560e..bb7205fc1b4 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -1392,6 +1392,7 @@ static void test_customize(void) if(FAILED(hr)) { skip("Skipping IFileDialogCustomize tests.\n"); + IFileDialog_Release(pfod); return; } @@ -1897,6 +1898,30 @@ static void test_customize(void) ok(!ref, "Refcount not zero (%d).\n", ref); } +static void test_persistent_state(void) +{ + IFileDialog *fd; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, + &IID_IFileDialog, (void**)&fd); + ok(hr == S_OK, "got 0x%08x.\n", hr); + +if (0) +{ + /* crashes at least on Win8 */ + hr = IFileDialog_SetClientGuid(fd, NULL); +} + + hr = IFileDialog_SetClientGuid(fd, &IID_IUnknown); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IFileDialog_SetClientGuid(fd, &IID_NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IFileDialog_Release(fd); +} + START_TEST(itemdlg) { OleInitialize(NULL); @@ -1908,6 +1933,7 @@ START_TEST(itemdlg) test_advise(); test_filename(); test_customize(); + test_persistent_state(); } else skip("Skipping all Item Dialog tests.\n");