[PATCH] shell32: handle writing an iconresource entry in SHGetSetFolderCustomSettings
Louis Lenders
xerox.xerox2000x at gmail.com
Thu Apr 19 11:57:08 CDT 2018
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 at gmail.com>
---
dlls/shell32/shlfolder.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index 9143f1e..0348418 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -607,12 +607,37 @@ HRESULT WINAPI SHOpenFolderAndSelectItems( PCIDLIST_ABSOLUTE pidlFolder, UINT ci
/***********************************************************************
* SHGetSetFolderCustomSettings
*
- * Only Unicode above Server 2003
+ * Only in XP (up to SP2) and Server 2003, writes/reads from a desktop.ini
*/
HRESULT WINAPI SHGetSetFolderCustomSettings( LPSHFOLDERCUSTOMSETTINGS fcs, PCWSTR path, DWORD flag )
{
+ 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");
+ }
+ }
+
FIXME("%p %s 0x%x: stub\n", fcs, debugstr_w(path), flag);
- return E_NOTIMPL;
+ return hr;
}
/***********************************************************************
--
2.7.4
More information about the wine-devel
mailing list