v2: - use temp path instead of hardcoded path - Delete the temperorary file before removing directory
Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com --- dlls/shell32/tests/shlfolder.c | 52 ++++++++++++++++++++++++++++++++++++++++++ include/shlobj.h | 3 ++- 2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index c976c85..d4ded64 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -65,6 +65,7 @@ static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFIID,void**); static BOOL (WINAPI *pSHGetPathFromIDListEx)(PCIDLIST_ABSOLUTE,WCHAR*,DWORD,GPFIDL_FLAGS); +static HRESULT (WINAPI *pSHGetSetFolderCustomSettings)(LPSHFOLDERCUSTOMSETTINGS,PCWSTR,DWORD);
static WCHAR *make_wstr(const char *str) { @@ -118,6 +119,7 @@ static void init_function_pointers(void) MAKEFUNC(SHGetItemFromObject); MAKEFUNC(SHCreateDefaultContextMenu); MAKEFUNC(SHGetPathFromIDListEx); + MAKEFUNC(SHGetSetFolderCustomSettings); #undef MAKEFUNC
/* test named exports */ @@ -5246,6 +5248,55 @@ todo_wine IShellFolder_Release(desktop); }
+static void test_SHGetSetFolderCustomSettings(void) +{ + HRESULT hr; + SHFOLDERCUSTOMSETTINGS fcs; + static WCHAR pathW[MAX_PATH]; + static WCHAR iconpathW[MAX_PATH]; + static const WCHAR somedirW[] = {'\','s','o','m','e','_','d','i','r',0}; + static const WCHAR iconW[] = {'\','s','o','m','e','_','i','c','o','n','.','i','c','o',0}; + WCHAR bufferW[MAX_PATH] = {0}; + + if (!pSHGetSetFolderCustomSettings) + { + win_skip("SHGetSetFolderCustomSetting not exported by name (only by ordinal) for version XP/win2003\n"); + return; + } + + GetTempPathW(sizeof(pathW), pathW); + lstrcatW(pathW, somedirW); + GetTempPathW(sizeof(iconpathW), iconpathW); + lstrcatW(iconpathW, somedirW); + lstrcatW(iconpathW, iconW); + + CreateDirectoryW(pathW, NULL); + + memset(&fcs, 0, sizeof(fcs)); + fcs.dwSize = sizeof(fcs); + fcs.dwMask = FCSM_ICONFILE; + fcs.pszIconFile = iconpathW; + + hr = pSHGetSetFolderCustomSettings(&fcs, pathW, FCS_FORCEWRITE); /*creates and writes to a Desktop.ini*/ + todo_wine ok(hr == S_OK, "Expected S_OK, got %#x\n", hr); + + memset(&fcs, 0, sizeof(fcs)); + fcs.dwSize = sizeof(fcs); + fcs.dwMask = FCSM_ICONFILE; + fcs.cchIconFile = MAX_PATH; + fcs.pszIconFile = bufferW; + + hr = pSHGetSetFolderCustomSettings(&fcs, pathW, FCS_READ); + todo_wine ok(hr == S_OK, "Expected S_OK, got %#x\n", hr); + todo_wine ok(!lstrcmpW(iconpathW, fcs.pszIconFile), "Expected %s, got %s\n", wine_dbgstr_w(iconpathW), wine_dbgstr_w(fcs.pszIconFile)); + + hr = pSHGetSetFolderCustomSettings(&fcs, NULL, FCS_READ); + todo_wine ok(hr == E_FAIL, "Expected E_FAIL, got %#x\n", hr); + + DeleteFileW(iconpathW); + RemoveDirectoryW(pathW); +} + START_TEST(shlfolder) { init_function_pointers(); @@ -5288,6 +5339,7 @@ START_TEST(shlfolder) test_GetDefaultColumn(); test_GetDefaultSearchGUID(); test_SHLimitInputEdit(); + test_SHGetSetFolderCustomSettings();
OleUninitialize(); } diff --git a/include/shlobj.h b/include/shlobj.h index 9d6dcdd..7bf0d2e 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -1489,7 +1489,7 @@ int WINAPI SHCreateDirectoryExW(HWND, LPCWSTR, LPSECURITY_ATTRIBUTES); #define FCSM_ICONFILE 0x00000010 #define FCSM_LOGO 0x00000020 #define FCSM_FLAGS 0x00000040 - +#include <pshpack8.h> typedef struct { DWORD dwSize; DWORD dwMask; @@ -1507,6 +1507,7 @@ typedef struct { LPWSTR pszLogo; DWORD cchLogo; } SHFOLDERCUSTOMSETTINGS, *LPSHFOLDERCUSTOMSETTINGS; +#include <poppack.h>
HRESULT WINAPI SHGetSetFolderCustomSettings(LPSHFOLDERCUSTOMSETTINGS pfcs, PCWSTR pszPath, DWORD dwReadWrite);
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=37939
Your paranoid android.
=== w2003std (32 bit shlfolder) === shlfolder.c:4957: Test failed: MKDIR: Expected wndproc to be called shlfolder.c:4869: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 8) shlfolder.c:4957: Test failed: CREATE: Expected wndproc to be called shlfolder.c:4869: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 2) shlfolder.c:4957: Test failed: RMDIR: Expected wndproc to be called shlfolder.c:4869: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 10) shlfolder.c:4957: Test failed: MKDIR: Expected wndproc to be called shlfolder.c:4869: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 6ac) shlfolder.c:4957: Test failed: CREATE: Expected wndproc to be called shlfolder.c:4869: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 6ac) shlfolder.c:4957: Test failed: RMDIR: Expected wndproc to be called shlfolder.c:4869: Test failed: Didn't expect a WM_USER_NOTIFY message (event: 6ac)