From d3fd5bdd974ba222aa37324e35861e2059f7cc9d Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sun, 4 Mar 2018 13:17:11 +0100 Subject: [PATCH] [SHLWAPI] Sync with Wine Staging 3.3. CORE-14434 --- dll/win32/shlwapi/assoc.c | 38 ++++++++++---------------- dll/win32/shlwapi/clist.c | 47 ++++++++++---------------------- dll/win32/shlwapi/istream.c | 18 ++++++++++-- dll/win32/shlwapi/msgbox.c | 18 +++++++++++- dll/win32/shlwapi/ordinal.c | 46 ++++++++++++++++++++++++------- dll/win32/shlwapi/path.c | 20 +++++++++++++- dll/win32/shlwapi/precomp.h | 5 ++-- dll/win32/shlwapi/reg.c | 13 ++++++++- dll/win32/shlwapi/regstream.c | 16 ++++++++++- dll/win32/shlwapi/resource.h | 4 ++- dll/win32/shlwapi/shlwapi_main.c | 11 +++++++- dll/win32/shlwapi/stopwatch.c | 17 +++++++++++- dll/win32/shlwapi/string.c | 27 ++++++++++++++++-- dll/win32/shlwapi/thread.c | 21 ++++++++++++-- dll/win32/shlwapi/url.c | 28 +++++++++++++++---- dll/win32/shlwapi/wsprintf.c | 12 ++++++-- media/doc/README.WINE | 2 +- 17 files changed, 252 insertions(+), 91 deletions(-) diff --git a/dll/win32/shlwapi/assoc.c b/dll/win32/shlwapi/assoc.c index a6d03a1a4bc..a5cb4b11290 100644 --- a/dll/win32/shlwapi/assoc.c +++ b/dll/win32/shlwapi/assoc.c @@ -17,8 +17,21 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include "precomp.h" +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "winreg.h" +#include "objbase.h" +#include "shlguid.h" +#include "shlobj.h" +#include "shlwapi.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); /* Default IQueryAssociations::Init() flags */ #define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME|ASSOCF_INIT_DEFAULTTOSTAR| \ @@ -89,7 +102,6 @@ HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface) return SHCoCreateInstance( NULL, &clsid, NULL, refiid, lpInterface ); } -#ifdef __REACTOS__ struct AssocPerceivedInfo { @@ -257,8 +269,6 @@ static const struct AssocPerceivedInfo* AssocFindByType(LPCWSTR pszType) return NULL; } -#endif - /************************************************************************* * AssocGetPerceivedType [SHLWAPI.@] @@ -281,26 +291,10 @@ static const struct AssocPerceivedInfo* AssocFindByType(LPCWSTR pszType) * lppszType is optional and it can be NULL. * if lpType or lpFlag are NULL, the function will crash. * if lpszExt is NULL, an error is returned. - * -#ifndef __REACTOS__ - * BUGS - * Unimplemented. -#endif */ HRESULT WINAPI AssocGetPerceivedType(LPCWSTR lpszExt, PERCEIVED *lpType, INT *lpFlag, LPWSTR *lppszType) { -#ifndef __REACTOS__ - - FIXME("(%s, %p, %p, %p) not supported\n", debugstr_w(lpszExt), lpType, lpFlag, lppszType); - - if (lpszExt == NULL) - return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - - return E_NOTIMPL; - -#else - static const WCHAR PerceivedTypeKey[] = {'P','e','r','c','e','i','v','e','d','T','y','p','e',0}; static const WCHAR SystemFileAssociationsKey[] = {'S','y','s','t','e','m','F','i','l','e', 'A','s','s','o','c','i','a','t','i','o','n','s','\\','%','s',0}; @@ -355,8 +349,6 @@ HRESULT WINAPI AssocGetPerceivedType(LPCWSTR lpszExt, PERCEIVED *lpType, *lpFlag = 0; } return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - -#endif } /************************************************************************* diff --git a/dll/win32/shlwapi/clist.c b/dll/win32/shlwapi/clist.c index 52c5f6107ff..77917b35469 100644 --- a/dll/win32/shlwapi/clist.c +++ b/dll/win32/shlwapi/clist.c @@ -17,8 +17,19 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include +#include -#include "precomp.h" +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "objbase.h" +#include "shlobj.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); /* dwSignature for contained DATABLOCK_HEADER items */ #define CLIST_ID_CONTAINER (~0U) @@ -45,13 +56,8 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList) * lpNewItem [I] The new item to add to the list * * RETURNS -#ifndef __REACTOS__ * Success: S_OK. The item is added to the list. * Failure: An HRESULT error code. -#else - * Success: TRUE. The item is added to the list. - * Failure: FALSE. -#endif * * NOTES * If the size of the element to be inserted is less than the size of a @@ -59,32 +65,19 @@ static inline LPDATABLOCK_HEADER NextItem(LPDBLIST lpList) * the call returns S_OK but does not actually add the element. * See SHWriteDataBlockList. */ -#ifndef __REACTOS__ -HRESULT -#else -BOOL -#endif -WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem) +BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem) { LPDATABLOCK_HEADER lpInsertAt = NULL; ULONG ulSize; TRACE("(%p,%p)\n", lppList, lpNewItem); - if(!lppList || !lpNewItem ) -#ifndef __REACTOS__ - return E_INVALIDARG; -#else + if(!lppList || !lpNewItem) return FALSE; -#endif if (lpNewItem->cbSize < sizeof(DATABLOCK_HEADER) || lpNewItem->dwSignature == CLIST_ID_CONTAINER) -#ifndef __REACTOS__ - return S_OK; -#else return FALSE; -#endif ulSize = lpNewItem->cbSize; @@ -141,17 +134,9 @@ WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem) lpInsertAt = NextItem(lpInsertAt); lpInsertAt->cbSize = 0; -#ifndef __REACTOS__ - return lpNewItem->cbSize; -#else return TRUE; -#endif } -#ifndef __REACTOS__ - return S_OK; -#else return FALSE; -#endif } /************************************************************************* @@ -369,11 +354,7 @@ VOID WINAPI SHFreeDataBlockList(LPDBLIST lpList) */ BOOL WINAPI SHRemoveDataBlock(LPDBLIST* lppList, DWORD dwSignature) { -#ifndef __REACTOS__ - LPDATABLOCK_HEADER lpList = 0; -#else LPDATABLOCK_HEADER lpList = NULL; -#endif LPDATABLOCK_HEADER lpItem = NULL; LPDATABLOCK_HEADER lpNext; ULONG ulNewSize; diff --git a/dll/win32/shlwapi/istream.c b/dll/win32/shlwapi/istream.c index d11a5f12d75..946d2c84b6e 100644 --- a/dll/win32/shlwapi/istream.c +++ b/dll/win32/shlwapi/istream.c @@ -17,8 +17,22 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include "precomp.h" +#include +#include + +#define COBJMACROS +#define NONAMELESSUNION + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winnls.h" +#define NO_SHLWAPI_REG +#define NO_SHLWAPI_PATH +#include "shlwapi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); #define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f) #define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0) diff --git a/dll/win32/shlwapi/msgbox.c b/dll/win32/shlwapi/msgbox.c index 31f53f9479a..90bbb592bfb 100644 --- a/dll/win32/shlwapi/msgbox.c +++ b/dll/win32/shlwapi/msgbox.c @@ -18,7 +18,23 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" +#include "wine/port.h" + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "shlwapi.h" +#include "wine/unicode.h" +#include "wine/debug.h" +#include "resource.h" + + +WINE_DEFAULT_DEBUG_CHANNEL(shell); extern HINSTANCE shlwapi_hInstance; /* in shlwapi_main.c */ diff --git a/dll/win32/shlwapi/ordinal.c b/dll/win32/shlwapi/ordinal.c index 61e8804d50b..9adf962ed2a 100644 --- a/dll/win32/shlwapi/ordinal.c +++ b/dll/win32/shlwapi/ordinal.c @@ -20,18 +20,38 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" +#include "wine/port.h" +#include #include - -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "winreg.h" +#include "wingdi.h" +#include "winuser.h" +#include "winver.h" +#include "winnetwk.h" +#include "mmsystem.h" +#include "objbase.h" +#include "exdisp.h" +#include "shdeprecated.h" +#include "shlobj.h" +#include "shlwapi.h" +#include "shellapi.h" +#include "commdlg.h" +#include "mlang.h" +#include "mshtmhst.h" +#include "wine/unicode.h" +#include "wine/debug.h" + + +WINE_DEFAULT_DEBUG_CHANNEL(shell); /* DLL handles for late bound calls */ extern HINSTANCE shlwapi_hInstance; @@ -78,6 +98,12 @@ HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId, TRACE("(%p,%d,%d,%08x,%08x)\n", hShared, dwDstProcId, dwSrcProcId, dwAccess, dwOptions); + if (!hShared) + { + TRACE("Returning handle NULL\n"); + return NULL; + } + /* Get dest process handle */ if (dwDstProcId == dwMyProcId) hDst = GetCurrentProcess(); diff --git a/dll/win32/shlwapi/path.c b/dll/win32/shlwapi/path.c index 94472580d94..f3149f35e58 100644 --- a/dll/win32/shlwapi/path.c +++ b/dll/win32/shlwapi/path.c @@ -19,7 +19,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" +#include "wine/port.h" + +#include +#include +#include + +#include "wine/unicode.h" +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "winternl.h" +#define NO_SHLWAPI_STREAM +#include "shlwapi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); #ifdef __REACTOS__ int WINAPI IsNetDrive(int drive); diff --git a/dll/win32/shlwapi/precomp.h b/dll/win32/shlwapi/precomp.h index 90d50f72a61..eff450aa861 100644 --- a/dll/win32/shlwapi/precomp.h +++ b/dll/win32/shlwapi/precomp.h @@ -1,3 +1,4 @@ + #ifndef _SHLWAPI_PCH_ #define _SHLWAPI_PCH_ @@ -29,6 +30,4 @@ #include "resource.h" -WINE_DEFAULT_DEBUG_CHANNEL(shell); - -#endif /* _SHLWAPI_PCH_ */ +#endif /* !_SHLWAPI_PCH_ */ diff --git a/dll/win32/shlwapi/reg.c b/dll/win32/shlwapi/reg.c index 74c1ab8c3c4..a72f4c24e46 100644 --- a/dll/win32/shlwapi/reg.c +++ b/dll/win32/shlwapi/reg.c @@ -19,7 +19,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include +#include +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "wine/debug.h" +#define NO_SHLWAPI_STREAM +#include "shlwapi.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); /* Key/Value names for MIME content types */ static const char lpszContentTypeA[] = "Content Type"; diff --git a/dll/win32/shlwapi/regstream.c b/dll/win32/shlwapi/regstream.c index 4aebab7480c..63615d3d9cf 100644 --- a/dll/win32/shlwapi/regstream.c +++ b/dll/win32/shlwapi/regstream.c @@ -19,7 +19,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include +#include + +#define COBJMACROS + +#include "winerror.h" +#include "windef.h" +#include "winbase.h" +#include "objbase.h" +#include "winreg.h" +#include "shlwapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct { diff --git a/dll/win32/shlwapi/resource.h b/dll/win32/shlwapi/resource.h index 2cc17a886e3..a9af2bad621 100644 --- a/dll/win32/shlwapi/resource.h +++ b/dll/win32/shlwapi/resource.h @@ -17,10 +17,12 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - #ifndef WINE_SHLWAPI_RESOURCE_H #define WINE_SHLWAPI_RESOURCE_H +#include +#include + #define IDS_BYTES_FORMAT 64 #define IDS_TIME_INTERVAL_HOURS 65 #define IDS_TIME_INTERVAL_MINUTES 66 diff --git a/dll/win32/shlwapi/shlwapi_main.c b/dll/win32/shlwapi/shlwapi_main.c index bf4cf72e306..f466bb485aa 100644 --- a/dll/win32/shlwapi/shlwapi_main.c +++ b/dll/win32/shlwapi/shlwapi_main.c @@ -19,7 +19,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include + +#include "windef.h" +#include "winbase.h" +#define NO_SHLWAPI_REG +#define NO_SHLWAPI_STREAM +#include "shlwapi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); DECLSPEC_HIDDEN HINSTANCE shlwapi_hInstance = 0; DECLSPEC_HIDDEN DWORD SHLWAPI_ThreadRef_index = TLS_OUT_OF_INDEXES; diff --git a/dll/win32/shlwapi/stopwatch.c b/dll/win32/shlwapi/stopwatch.c index 60dc1a6688e..fcee075fca3 100644 --- a/dll/win32/shlwapi/stopwatch.c +++ b/dll/win32/shlwapi/stopwatch.c @@ -23,7 +23,22 @@ * B) Want to use a substandard API to tune its performance. */ -#include "precomp.h" +#include "config.h" +#include "wine/port.h" + +#include +#include +#include + +#define NONAMELESSUNION + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winternl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); /************************************************************************* * @ [SHLWAPI.241] diff --git a/dll/win32/shlwapi/string.c b/dll/win32/shlwapi/string.c index 64a75719616..0b34d43624c 100644 --- a/dll/win32/shlwapi/string.c +++ b/dll/win32/shlwapi/string.c @@ -19,11 +19,32 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "config.h" +#include "wine/port.h" #include -#include -#include +#include +#include +#include + +#define NONAMELESSUNION + +#include "windef.h" +#include "winbase.h" +#define NO_SHLWAPI_REG +#define NO_SHLWAPI_STREAM +#include "shlwapi.h" +#include "wingdi.h" +#include "winuser.h" +#include "shlobj.h" +#include "mlang.h" +#include "ddeml.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +#include "resource.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); extern HINSTANCE shlwapi_hInstance; diff --git a/dll/win32/shlwapi/thread.c b/dll/win32/shlwapi/thread.c index 4fd0d46cd9d..eb2c35d6dcc 100644 --- a/dll/win32/shlwapi/thread.c +++ b/dll/win32/shlwapi/thread.c @@ -18,8 +18,25 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include "precomp.h" +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "winuser.h" +#define NO_SHLWAPI_REG +#define NO_SHLWAPI_PATH +#define NO_SHLWAPI_GDI +#define NO_SHLWAPI_STREAM +#define NO_SHLWAPI_USER +#include "shlwapi.h" +#include "shlobj.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(shell); extern DWORD SHLWAPI_ThreadRef_index; /* Initialised in shlwapi_main.c */ diff --git a/dll/win32/shlwapi/url.c b/dll/win32/shlwapi/url.c index ed34aa73a5b..c858ebde695 100644 --- a/dll/win32/shlwapi/url.c +++ b/dll/win32/shlwapi/url.c @@ -18,15 +18,30 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" - -#include -#include +#include "config.h" +#include "wine/port.h" +#include +#include +#include +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "winerror.h" +#include "wine/unicode.h" +#include "wininet.h" +#include "winreg.h" +#include "winternl.h" +#define NO_SHLWAPI_STREAM +#include "shlwapi.h" +#include "intshcut.h" +#include "wine/debug.h" HMODULE WINAPI MLLoadLibraryW(LPCWSTR,HMODULE,DWORD); BOOL WINAPI MLFreeLibrary(HMODULE); HRESULT WINAPI MLBuildResURLW(LPCWSTR,HMODULE,DWORD,LPCWSTR,LPWSTR,DWORD); +WINE_DEFAULT_DEBUG_CHANNEL(shell); + static inline WCHAR *heap_strdupAtoW(const char *str) { LPWSTR ret = NULL; @@ -902,7 +917,10 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, work = preliminary + base.cchProtocol+1+base.cchSuffix - 1; if (*work++ != '/') *(work++) = '/'; - strcpyW(work, relative.pszSuffix); + if (relative.pszSuffix[0] == '.' && relative.pszSuffix[1] == 0) + *work = 0; + else + strcpyW(work, relative.pszSuffix); break; default: diff --git a/dll/win32/shlwapi/wsprintf.c b/dll/win32/shlwapi/wsprintf.c index 34c7a4df8fa..6a36b6a28e3 100644 --- a/dll/win32/shlwapi/wsprintf.c +++ b/dll/win32/shlwapi/wsprintf.c @@ -22,8 +22,16 @@ * to change it in user32 too. */ -#define WIN32_NO_STATUS -#include +#include +#include +#include + +#include "windef.h" +#include "winbase.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" + +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(string); diff --git a/media/doc/README.WINE b/media/doc/README.WINE index d31a67f70fe..3c8bf8dd870 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -174,7 +174,7 @@ reactos/dll/win32/shdoclc # Synced to WineStaging-2.9 reactos/dll/win32/shdocvw # Synced to Wine-3.0 reactos/dll/win32/shell32 # Forked at Wine-20071011 reactos/dll/win32/shfolder # Synced to WineStaging-2.9 -reactos/dll/win32/shlwapi # Synced to Wine-3.0 +reactos/dll/win32/shlwapi # Synced to WineStaging-3.3 reactos/dll/win32/slbcsp # Synced to WineStaging-2.9 reactos/dll/win32/snmpapi # Synced to WineStaging-2.9 reactos/dll/win32/softpub # Synced to WineStaging-2.9 -- 2.17.1