[PATCH v2] shell32: handle writing an iconresource entry in SHGetSetFolderCustomSettings
v2: -fixed a misleading comment - only print fixme when needed This fixes bug https://bugs.winehq.org/show_bug.cgi?id=44959 I also tried to write a test, that test passes on the 32-bit testbots, but somehow the last test fails on 64-bit testbots and i don`t know why. Test is at https://testbot.winehq.org/GetFile.pl?JobKey=37794&StepKey=1 Also win2003 testbot gives strange errors in a test above this one that i don`t get. See for example https://testbot.winehq.org/JobDetails.pl?Key=37794. So this goes without submitted test for now Signed-off-by: Louis Lenders <xerox.xerox2000x(a)gmail.com> --- dlls/shell32/shlfolder.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 9143f1e..c94c90e 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -607,12 +607,38 @@ HRESULT WINAPI SHOpenFolderAndSelectItems( PCIDLIST_ABSOLUTE pidlFolder, UINT ci /*********************************************************************** * SHGetSetFolderCustomSettings * - * Only Unicode above Server 2003 + * Only Unicode above Server 2003, writes/reads from a desktop.ini */ HRESULT WINAPI SHGetSetFolderCustomSettings( LPSHFOLDERCUSTOMSETTINGS fcs, PCWSTR path, DWORD flag ) { - FIXME("%p %s 0x%x: stub\n", fcs, debugstr_w(path), flag); - return E_NOTIMPL; + static const WCHAR iconresourceW[] = {'I','c','o','n','R','e','s','o','u','r','c','e',0}; + static const WCHAR desktop_iniW[] = {'D','e','s','k','t','o','p','.','i','n','i',0}; + WCHAR bufferW[MAX_PATH]= {0}; + HRESULT hr; + + hr = E_FAIL; + + if (flag & FCS_FORCEWRITE) + { + if (fcs->dwMask & FCSM_ICONFILE) + { + lstrcpyW(bufferW, path); + PathAddBackslashW(bufferW); + lstrcatW(bufferW, desktop_iniW); + + if (WritePrivateProfileStringW(wszDotShellClassInfo, iconresourceW, fcs->pszIconFile, bufferW)) + { + TRACE("Wrote an iconresource entry %s into %s\n", debugstr_w(fcs->pszIconFile), debugstr_w(bufferW)); + hr = S_OK; + } + else + ERR("Failed to write (to) Desktop.ini file\n"); + } + } + else + FIXME("%p %s 0x%x: stub\n", fcs, debugstr_w(path), flag); + + return hr; } /*********************************************************************** -- 2.7.4
Louis Lenders <xerox.xerox2000x(a)gmail.com> writes:
v2: -fixed a misleading comment - only print fixme when needed
This fixes bug https://bugs.winehq.org/show_bug.cgi?id=44959
I also tried to write a test, that test passes on the 32-bit testbots, but somehow the last test fails on 64-bit testbots and i don`t know why. Test is at https://testbot.winehq.org/GetFile.pl?JobKey=37794&StepKey=1
Probably the structure is using the wrong packing for 64-bit. -- Alexandre Julliard julliard(a)winehq.org
With a bit of searching i found the following below*** makes the tests pass on 64-bit testbots. I`ll send tests for review then, but note that there are still 12 failures in win2003, but they also appear when you send a NOOP to testbot like here below *****. So I guess that`s not due to the test i added. *****: this causes 12 failures on win2003: diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index c976c85..aba60d0 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -3944,7 +3944,7 @@ static void test_ShellItemBindToHandler(void) /* BHID_Stream */ hr = IShellItem_BindToHandler(psi, NULL, &BHID_Stream, &IID_IStream, (void**)&punk); - ok(hr == E_NOINTERFACE, "Got 0x%08x\n", hr); + ok(hr == E_NOINTERFACE, "Got test 0x%08x\n", hr); if(SUCCEEDED(hr)) IUnknown_Release(punk); hr = IShellItem_BindToHandler(psi, NULL, &BHID_Stream, &IID_IUnknown, (void**)&punk); ok(hr == S_OK, "Got 0x%08x\n", hr); ***:this makes test pass on 64bot diff --git a/include/shlobj.h b/include/shlobj.h index 9d6dcdd..d66e0eb 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -1472,6 +1472,8 @@ int WINAPI SHCreateDirectoryExA(HWND, LPCSTR, LPSECURITY_ATTRIBUTES); int WINAPI SHCreateDirectoryExW(HWND, LPCWSTR, LPSECURITY_ATTRIBUTES); #define SHCreateDirectoryEx WINELIB_NAME_AW(SHCreateDirectoryEx) +#include <pshpack8.h> + /**************************************************************************** * SHGetSetFolderCustomSettings API */ @@ -1510,6 +1512,7 @@ typedef struct { HRESULT WINAPI SHGetSetFolderCustomSettings(LPSHFOLDERCUSTOMSETTINGS pfcs, PCWSTR pszPath, DWORD dwReadWrite); +#include <poppack.h> /**************************************************************************** * SHGetSpecialFolderLocation API */ 2018-04-20 9:06 GMT+02:00 Alexandre Julliard <julliard(a)winehq.org>:
Louis Lenders <xerox.xerox2000x(a)gmail.com> writes:
v2: -fixed a misleading comment - only print fixme when needed
This fixes bug https://bugs.winehq.org/show_bug.cgi?id=44959
I also tried to write a test, that test passes on the 32-bit testbots, but somehow the last test fails on 64-bit testbots and i don`t know why. Test is at https://testbot.winehq.org/GetFile.pl?JobKey=37794&StepKey=1
Probably the structure is using the wrong packing for 64-bit.
-- Alexandre Julliard julliard(a)winehq.org
Hi, While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=37883 Your paranoid android. === build (build) === Patch failed to apply
participants (3)
-
Alexandre Julliard -
Louis Lenders -
Marvin