From aac9cd589d6b381646727eadc331adfa3c403b19 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 18 May 2026 13:44:21 +0300 Subject: [PATCH] [SHLWAPI] Reduce diff to wine-10.0 --- dll/win32/shlwapi/CMakeLists.txt | 13 +- dll/win32/shlwapi/assoc.c | 20 ++- dll/win32/shlwapi/clist.c | 10 +- dll/win32/shlwapi/istream.c | 6 +- dll/win32/shlwapi/msgbox.c | 10 +- dll/win32/shlwapi/ordinal.c | 208 +++++++++++++++---------------- dll/win32/shlwapi/path.c | 153 +++++++++++------------ dll/win32/shlwapi/reg.c | 19 ++- dll/win32/shlwapi/regstream.c | 12 +- dll/win32/shlwapi/shlwapi_main.c | 2 +- dll/win32/shlwapi/stopwatch.c | 11 +- dll/win32/shlwapi/string.c | 134 ++++++++++---------- dll/win32/shlwapi/thread.c | 9 +- dll/win32/shlwapi/url.c | 22 ++-- 14 files changed, 301 insertions(+), 328 deletions(-) diff --git a/dll/win32/shlwapi/CMakeLists.txt b/dll/win32/shlwapi/CMakeLists.txt index 4d97403ee5e..f41b82c780e 100644 --- a/dll/win32/shlwapi/CMakeLists.txt +++ b/dll/win32/shlwapi/CMakeLists.txt @@ -1,9 +1,14 @@ project(SHELL) +remove_definitions(-D_WIN32_WINNT=0x502) +add_definitions(-D_WIN32_WINNT=0x600) + add_definitions( -D__WINESRC__ - -D_SHLWAPI_) + -D_SHLWAPI_ + -Dwcsicmp=strcmpiW +) spec2def(shlwapi.dll shlwapi.spec ADD_IMPORTLIB) @@ -45,6 +50,10 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU") target_compile_options(shlwapi PRIVATE "$<$:-Wno-overloaded-virtual>") endif() +if(MSVC) + target_compile_options(shlwapi PRIVATE /wd4267) # warning C4267: 'function': conversion from 'size_t' to 'DWORD', possible loss of data +endif() + # our C++ atlbase.h conflicts with the one from wine, so only use wine includes for C # Unfortunately, we can't use different includes for C & C++ in VS generator, so use an object library to achieve this target_include_directories(shlwapi BEFORE PRIVATE @@ -61,5 +70,5 @@ set_module_type(shlwapi win32dll UNICODE) target_link_libraries(shlwapi uuid wine cppstl) add_delay_importlibs(shlwapi userenv oleaut32 ole32 comctl32 comdlg32 mpr mlang urlmon shell32 winmm version) add_importlibs(shlwapi user32 gdi32 advapi32 wininet msvcrt kernel32 ntdll) -add_pch(shlwapi precomp.h "${PCH_SKIP_SOURCE}") +#add_pch(shlwapi precomp.h "${PCH_SKIP_SOURCE}") add_cd_file(TARGET shlwapi DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/shlwapi/assoc.c b/dll/win32/shlwapi/assoc.c index ad5b8cddf1a..892f7178671 100644 --- a/dll/win32/shlwapi/assoc.c +++ b/dll/win32/shlwapi/assoc.c @@ -17,10 +17,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifdef __REACTOS__ - #undef _WIN32_WINNT - #define _WIN32_WINNT _WIN32_WINNT_VISTA /* for RegGetValueW */ -#endif #include #include @@ -50,7 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); /************************************************************************* * SHLWAPI_ParamAToW * - * Internal helper function: Convert ASCII parameter to Unicode. + * Internal helper function: Convert ANSI parameter to Unicode. */ static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen, LPWSTR* lpszOut) @@ -372,7 +368,7 @@ HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAsso HRESULT hRet; IQueryAssociations* lpAssoc; - TRACE("(0x%x,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc), + TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc), debugstr_w(pszExtra), phkeyOut); hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc ); @@ -415,7 +411,7 @@ HRESULT WINAPI AssocQueryKeyA(ASSOCF cfFlags, ASSOCKEY assockey, LPCSTR pszAssoc WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL; HRESULT hRet = E_OUTOFMEMORY; - TRACE("(0x%x,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_a(pszAssoc), + TRACE("(0x%lx,%d,%s,%s,%p)\n", cfFlags, assockey, debugstr_a(pszAssoc), debugstr_a(pszExtra), phkeyOut); if (SHLWAPI_ParamAToW(pszAssoc, szAssocW, MAX_PATH, &lpszAssocW) && @@ -444,7 +440,7 @@ HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc, HRESULT hRet; IQueryAssociations* lpAssoc; - TRACE("(0x%x,%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_w(pszAssoc), + TRACE("(0x%lx,%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_w(pszAssoc), debugstr_w(pszExtra), pszOut, pcchOut); if (!pcchOut) @@ -488,7 +484,7 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc, WCHAR szExtraW[MAX_PATH], *lpszExtraW = NULL; HRESULT hRet = E_OUTOFMEMORY; - TRACE("(0x%x,0x%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_a(pszAssoc), + TRACE("(0x%lx,0x%d,%s,%s,%p,%p)\n", cfFlags, str, debugstr_a(pszAssoc), debugstr_a(pszExtra), pszOut, pcchOut); if (!pcchOut) @@ -503,7 +499,7 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc, lpszReturnW = HeapAlloc(GetProcessHeap(), 0, (dwLenOut + 1) * sizeof(WCHAR)); else - dwLenOut = sizeof(szReturnW) / sizeof(szReturnW[0]); + dwLenOut = ARRAY_SIZE(szReturnW); if (!lpszReturnW) hRet = E_OUTOFMEMORY; @@ -541,7 +537,7 @@ HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc HRESULT hRet; IQueryAssociations* lpAssoc; - TRACE("(0x%x,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc, + TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc, debugstr_w(pszExtra), pszOut, pcchOut); hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc ); @@ -587,7 +583,7 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc WCHAR szReturnW[MAX_PATH], *lpszReturnW = szReturnW; HRESULT hRet = E_OUTOFMEMORY; - TRACE("(0x%x,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc, + TRACE("(0x%lx,0x%d,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc, debugstr_a(pszExtra), pszOut, pcchOut); if (!pcchOut) diff --git a/dll/win32/shlwapi/clist.c b/dll/win32/shlwapi/clist.c index 77917b35469..beb47001c5a 100644 --- a/dll/win32/shlwapi/clist.c +++ b/dll/win32/shlwapi/clist.c @@ -72,7 +72,7 @@ BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem) TRACE("(%p,%p)\n", lppList, lpNewItem); - if(!lppList || !lpNewItem) + if(!lppList || !lpNewItem ) return FALSE; if (lpNewItem->cbSize < sizeof(DATABLOCK_HEADER) || @@ -85,7 +85,7 @@ BOOL WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewItem) { /* Tune size to a ULONG boundary, add space for container element */ ulSize = ((ulSize + 0x3) & 0xFFFFFFFC) + sizeof(DATABLOCK_HEADER); - TRACE("Creating container item, new size = %d\n", ulSize); + TRACE("Creating container item, new size = %ld\n", ulSize); } if(!*lppList) @@ -354,12 +354,12 @@ VOID WINAPI SHFreeDataBlockList(LPDBLIST lpList) */ BOOL WINAPI SHRemoveDataBlock(LPDBLIST* lppList, DWORD dwSignature) { - LPDATABLOCK_HEADER lpList = NULL; + LPDATABLOCK_HEADER lpList = 0; LPDATABLOCK_HEADER lpItem = NULL; LPDATABLOCK_HEADER lpNext; ULONG ulNewSize; - TRACE("(%p,%d)\n", lppList, dwSignature); + TRACE("(%p,%ld)\n", lppList, dwSignature); if(lppList && (lpList = *lppList)) { @@ -423,7 +423,7 @@ BOOL WINAPI SHRemoveDataBlock(LPDBLIST* lppList, DWORD dwSignature) */ DATABLOCK_HEADER* WINAPI SHFindDataBlock(LPDBLIST lpList, DWORD dwSignature) { - TRACE("(%p,%d)\n", lpList, dwSignature); + TRACE("(%p,%ld)\n", lpList, dwSignature); if(lpList) { diff --git a/dll/win32/shlwapi/istream.c b/dll/win32/shlwapi/istream.c index 3fed40c7f32..1da064014d7 100644 --- a/dll/win32/shlwapi/istream.c +++ b/dll/win32/shlwapi/istream.c @@ -21,8 +21,6 @@ #include #define COBJMACROS -#define NONAMELESSUNION - #include "windef.h" #include "winbase.h" #include "winerror.h" @@ -583,10 +581,10 @@ BOOL WINAPI SHIsEmptyStream(IStream *lpStream) } else { - DWORD dwDummy; + DWORD dummy, read_len; /* Try to read from the stream */ - if(SUCCEEDED(SHIStream_Read(lpStream, &dwDummy, sizeof(dwDummy)))) + if (SUCCEEDED(IStream_Read(lpStream, &dummy, sizeof(dummy), &read_len)) && read_len == sizeof(dummy)) { LARGE_INTEGER zero; zero.QuadPart = 0; diff --git a/dll/win32/shlwapi/msgbox.c b/dll/win32/shlwapi/msgbox.c index 90bbb592bfb..3a30e570fb4 100644 --- a/dll/win32/shlwapi/msgbox.c +++ b/dll/win32/shlwapi/msgbox.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include @@ -29,7 +26,6 @@ #include "winuser.h" #include "winreg.h" #include "shlwapi.h" -#include "wine/unicode.h" #include "wine/debug.h" #include "resource.h" @@ -61,7 +57,7 @@ static INT_PTR CALLBACK SHDlgProcEx(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM { DLGDATAEX *d = (DLGDATAEX *)GetWindowLongPtrW(hDlg, DWLP_USER); - TRACE("(%p,%u,%ld,%ld) data %p\n", hDlg, uMsg, wParam, lParam, d); + TRACE("(%p,%u,%Id,%Id) data %p\n", hDlg, uMsg, wParam, lParam, d); switch (uMsg) { @@ -185,14 +181,14 @@ typedef struct tagDLGDATA /* Dialogue procedure for shlwapi message boxes */ static INT_PTR CALLBACK SHDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - TRACE("(%p,%u,%ld,%ld)\n", hDlg, uMsg, wParam, lParam); + TRACE("(%p,%u,%Id,%Id)\n", hDlg, uMsg, wParam, lParam); switch (uMsg) { case WM_INITDIALOG: { DLGDATA *d = (DLGDATA *)lParam; - TRACE("WM_INITDIALOG: %p, %s,%s,%d\n", hDlg, debugstr_w(d->lpszTitle), + TRACE("WM_INITDIALOG: %p, %s,%s,%ld\n", hDlg, debugstr_w(d->lpszTitle), debugstr_w(d->lpszText), d->dwType); SetWindowTextW(hDlg, d->lpszTitle); diff --git a/dll/win32/shlwapi/ordinal.c b/dll/win32/shlwapi/ordinal.c index 99c17fc1275..2b11f9139c9 100644 --- a/dll/win32/shlwapi/ordinal.c +++ b/dll/win32/shlwapi/ordinal.c @@ -20,9 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -61,10 +58,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); extern HINSTANCE shlwapi_hInstance; extern DWORD SHLWAPI_ThreadRef_index; -HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); #ifdef __REACTOS__ +HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); +#define iunknown_query_service IUnknown_QueryService HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, LPCSTR lpVerb); #else +static HRESULT iunknown_query_service(IUnknown*,REFGUID,REFIID,LPVOID*); HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD); #endif BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD); @@ -103,7 +102,7 @@ HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId, DWORD dwMyProcId = GetCurrentProcessId(); HANDLE hRet = NULL; - TRACE("(%p,%d,%d,%08x,%08x)\n", hShared, dwDstProcId, dwSrcProcId, + TRACE("(%p,%ld,%ld,%08lx,%08lx)\n", hShared, dwDstProcId, dwSrcProcId, dwAccess, dwOptions); if (!hShared) @@ -173,7 +172,7 @@ HANDLE WINAPI SHAllocShared(LPCVOID lpvData, DWORD dwSize, DWORD dwProcId) LPVOID pMapped; HANDLE hRet = NULL; - TRACE("(%p,%d,%d)\n", lpvData, dwSize, dwProcId); + TRACE("(%p,%ld,%ld)\n", lpvData, dwSize, dwProcId); /* Create file mapping of the correct length */ hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, FILE_MAP_READ, 0, @@ -265,7 +264,7 @@ PVOID WINAPI SHLockShared(HANDLE hShared, DWORD dwProcId) HANDLE hDup; LPVOID pMapped; - TRACE("(%p %d)\n", hShared, dwProcId); + TRACE("(%p %ld)\n", hShared, dwProcId); /* Get handle to shared memory for current process */ hDup = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(), FILE_MAP_ALL_ACCESS, 0); @@ -317,7 +316,7 @@ BOOL WINAPI SHFreeShared(HANDLE hShared, DWORD dwProcId) { HANDLE hClose; - TRACE("(%p %d)\n", hShared, dwProcId); + TRACE("(%p %ld)\n", hShared, dwProcId); if (!hShared) return TRUE; @@ -359,7 +358,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown) TRACE("(%p, %p)\n", lpBC, lpUnknown); - hr = IUnknown_QueryService(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser); + hr = iunknown_query_service(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser); if (FAILED(hr)) return hr; @@ -633,8 +632,8 @@ INT WINAPI SHStringFromGUIDA(REFGUID guid, LPSTR lpszDest, INT cchMax) TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax); - sprintf(xguid, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", - (UINT)guid->Data1, guid->Data2, guid->Data3, + sprintf(xguid, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); @@ -669,11 +668,11 @@ INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax) TRACE("(%s,%p,%d)\n", debugstr_guid(guid), lpszDest, cchMax); - sprintfW(xguid, wszFormat, guid->Data1, guid->Data2, guid->Data3, + swprintf(xguid, ARRAY_SIZE(xguid), wszFormat, guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); - iLen = strlenW(xguid) + 1; + iLen = lstrlenW(xguid) + 1; if (iLen > cchMax) return 0; @@ -917,7 +916,7 @@ BOOL WINAPI SHAboutInfoA(LPSTR lpszDest, DWORD dwDestLen) { WCHAR buff[2084]; - TRACE("(%p,%d)\n", lpszDest, dwDestLen); + TRACE("(%p,%ld)\n", lpszDest, dwDestLen); if (lpszDest && SHAboutInfoW(buff, dwDestLen)) { @@ -963,7 +962,7 @@ BOOL WINAPI SHAboutInfoW(LPWSTR lpszDest, DWORD dwDestLen) HKEY hReg; DWORD dwType, dwLen; - TRACE("(%p,%d)\n", lpszDest, dwDestLen); + TRACE("(%p,%ld)\n", lpszDest, dwDestLen); if (!lpszDest) return FALSE; @@ -980,7 +979,7 @@ BOOL WINAPI SHAboutInfoW(LPWSTR lpszDest, DWORD dwDestLen) dwLen = 30; if (!SHGetValueW(HKEY_LOCAL_MACHINE, szIEKey, szVersion, &dwType, buff, &dwLen)) { - DWORD dwStrLen = strlenW(buff); + DWORD dwStrLen = lstrlenW(buff); dwLen = 30 - dwStrLen; SHGetValueW(HKEY_LOCAL_MACHINE, szIEKey, szCustomized, &dwType, buff+dwStrLen, &dwLen); @@ -1051,7 +1050,7 @@ HRESULT WINAPI IUnknown_QueryStatus(IUnknown* lpUnknown, REFGUID pguidCmdGroup, { HRESULT hRet = E_FAIL; - TRACE("(%p,%p,%d,%p,%p)\n",lpUnknown, pguidCmdGroup, cCmds, prgCmds, pCmdText); + TRACE("(%p,%p,%ld,%p,%p)\n",lpUnknown, pguidCmdGroup, cCmds, prgCmds, pCmdText); if (lpUnknown) { @@ -1091,7 +1090,7 @@ HRESULT WINAPI IUnknown_Exec(IUnknown* lpUnknown, REFGUID pguidCmdGroup, { HRESULT hRet = E_FAIL; - TRACE("(%p,%p,%d,%d,%p,%p)\n",lpUnknown, pguidCmdGroup, nCmdID, + TRACE("(%p,%p,%ld,%ld,%p,%p)\n",lpUnknown, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); if (lpUnknown) @@ -1557,17 +1556,17 @@ HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, IOleCommandTarget *target; HRESULT hr; - TRACE("%p %s %s %d %08x %p %p\n", lpUnknown, debugstr_guid(service), + TRACE("%p %s %s %ld %08lx %p %p\n", lpUnknown, debugstr_guid(service), debugstr_guid(group), cmdId, cmdOpt, pIn, pOut); - hr = IUnknown_QueryService(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target); + hr = iunknown_query_service(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target); if (hr == S_OK) { hr = IOleCommandTarget_Exec(target, group, cmdId, cmdOpt, pIn, pOut); IOleCommandTarget_Release(target); } - TRACE("<-- hr=0x%08x\n", hr); + TRACE("<-- hr=0x%08lx\n", hr); return hr; } @@ -1597,7 +1596,7 @@ HRESULT WINAPI IUnknown_ProfferService(IUnknown *lpUnknown, REFGUID service, ISe TRACE("%p %s %p %p\n", lpUnknown, debugstr_guid(service), pService, pCookie); - hr = IUnknown_QueryService(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer); + hr = iunknown_query_service(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer); if (hr == S_OK) { if (pService) @@ -1715,13 +1714,13 @@ static BOOL CALLBACK SHLWAPI_EnumChildProc(HWND hWnd, LPARAM lParam) * Nothing. * * NOTES - * The appropriate ASCII or Unicode function is called for the window. + * The appropriate ANSI or Unicode function is called for the window. */ void WINAPI SHPropagateMessage(HWND hWnd, UINT uiMsgId, WPARAM wParam, LPARAM lParam, BOOL bSend) { enumWndData data; - TRACE("(%p,%u,%ld,%ld,%d)\n", hWnd, uiMsgId, wParam, lParam, bSend); + TRACE("(%p,%u,%Id,%Id,%d)\n", hWnd, uiMsgId, wParam, lParam, bSend); if(hWnd) { @@ -1832,7 +1831,7 @@ BOOL WINAPI SHSimulateDrop(IDropTarget *pDrop, IDataObject *pDataObj, DWORD dwEffect = DROPEFFECT_LINK | DROPEFFECT_MOVE | DROPEFFECT_COPY; POINTL pt = { 0, 0 }; - TRACE("%p %p 0x%08x %p %p\n", pDrop, pDataObj, grfKeyState, lpPt, pdwEffect); + TRACE("%p %p 0x%08lx %p %p\n", pDrop, pDataObj, grfKeyState, lpPt, pdwEffect); if (!lpPt) lpPt = &pt; @@ -1901,7 +1900,7 @@ HRESULT WINAPI IUnknown_TranslateAcceleratorOCS(IUnknown *lpUnknown, LPMSG lpMsg IOleControlSite* lpCSite = NULL; HRESULT hRet = E_INVALIDARG; - TRACE("(%p,%p,0x%08x)\n", lpUnknown, lpMsg, dwModifiers); + TRACE("(%p,%p,0x%08lx)\n", lpUnknown, lpMsg, dwModifiers); if (lpUnknown) { hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleControlSite, @@ -1965,7 +1964,7 @@ HRESULT WINAPI IUnknown_HandleIRestrict(LPUNKNOWN lpUnknown, PVOID lpArg1, if (lpUnknown && lpArg4) { - hRet = IUnknown_QueryService(lpUnknown, (REFGUID)service_id, + hRet = iunknown_query_service(lpUnknown, (REFGUID)service_id, (REFGUID)function_id, (void**)&lpUnkInner); if (SUCCEEDED(hRet) && lpUnkInner) @@ -2229,7 +2228,7 @@ HRESULT WINAPI MayQSForward(IUnknown* lpUnknown, PVOID lpReserved, REFGUID riidCmdGrp, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT* pCmdText) { - FIXME("(%p,%p,%p,%d,%p,%p) - stub\n", + FIXME("(%p,%p,%p,%ld,%p,%p) - stub\n", lpUnknown, lpReserved, riidCmdGrp, cCmds, prgCmds, pCmdText); /* FIXME: Calls IsQSForward & IUnknown_QueryStatus */ @@ -2263,11 +2262,11 @@ MayExecForward( return IUnknown_Exec(lpUnknown, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); } #else -HRESULT WINAPI MayExecForward(IUnknown* lpUnknown, INT nUnknown, REFGUID pguidCmdGroup, +HRESULT WINAPI MayExecForward(IUnknown* lpUnknown, INT iUnk, REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut) { - FIXME("(%p,%d,%p,%d,%d,%p,%p) - stub!\n", lpUnknown, nUnknown, pguidCmdGroup, + FIXME("(%p,%d,%p,%ld,%ld,%p,%p) - stub!\n", lpUnknown, iUnk, pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); return DRAGDROP_E_NOTREGISTERED; } @@ -2352,7 +2351,7 @@ IsQSForward(_In_opt_ REFGUID pguidCmdGroup, _In_ ULONG cCmds, _In_ OLECMD *prgCm #else HRESULT WINAPI IsQSForward(REFGUID pguidCmdGroup,ULONG cCmds, OLECMD *prgCmds) { - FIXME("(%p,%d,%p) - stub!\n", pguidCmdGroup, cCmds, prgCmds); + FIXME("(%p,%ld,%p) - stub!\n", pguidCmdGroup, cCmds, prgCmds); return DRAGDROP_E_NOTREGISTERED; } #endif @@ -2405,7 +2404,7 @@ typedef struct BOOL WINAPI FDSA_Initialize(DWORD block_size, DWORD inc, FDSA_info *info, void *mem, DWORD init_blocks) { - TRACE("(0x%08x 0x%08x %p %p 0x%08x)\n", block_size, inc, info, mem, init_blocks); + TRACE("(0x%08lx 0x%08lx %p %p 0x%08lx)\n", block_size, inc, info, mem, init_blocks); if(inc == 0) inc = 1; @@ -2448,7 +2447,7 @@ BOOL WINAPI FDSA_Destroy(FDSA_info *info) */ DWORD WINAPI FDSA_InsertItem(FDSA_info *info, DWORD where, const void *block) { - TRACE("(%p 0x%08x %p)\n", info, where, block); + TRACE("(%p 0x%08lx %p)\n", info, where, block); if(where > info->num_items) where = info->num_items; @@ -2486,7 +2485,7 @@ DWORD WINAPI FDSA_InsertItem(FDSA_info *info, DWORD where, const void *block) */ BOOL WINAPI FDSA_DeleteItem(FDSA_info *info, DWORD where) { - TRACE("(%p 0x%08x)\n", info, where); + TRACE("(%p 0x%08lx)\n", info, where); if(where >= info->num_items) return FALSE; @@ -2660,7 +2659,7 @@ HMODULE WINAPI SHPinDllOfCLSID(REFIID refiid) CHAR value[MAX_PATH], string[MAX_PATH]; strcpy(string, "CLSID\\"); - SHStringFromGUIDA(refiid, string + 6, sizeof(string)/sizeof(char) - 6); + SHStringFromGUIDA(refiid, string + 6, ARRAY_SIZE(string) - 6); strcat(string, "\\InProcServer32"); count = MAX_PATH; @@ -2737,7 +2736,7 @@ void WINAPI SHUnregisterClassesW(HINSTANCE hInst, LPCWSTR *lppClasses, INT iCoun /************************************************************************* * @ [SHLWAPI.240] * - * Call The correct (Ascii/Unicode) default window procedure for a window. + * Call The correct (ANSI/Unicode) default window procedure for a window. * * PARAMS * hWnd [I] Window to call the default procedure for @@ -2802,7 +2801,7 @@ HWND WINAPI SHCreateWorkerWindowA(WNDPROC wndProc, HWND hWndParent, DWORD dwExSt WNDCLASSA wc; HWND hWnd; - TRACE("(%p, %p, 0x%08x, 0x%08x, %p, 0x%08lx)\n", + TRACE("(%p, %p, 0x%08lx, 0x%08lx, %p, 0x%08Ix)\n", wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra); /* Create Window class */ @@ -2934,7 +2933,7 @@ DWORD WINAPI SHRestrictionLookup( LPDWORD polArr) #endif { - TRACE("(0x%08x %s %p %p)\n", policy, debugstr_w(initial), polTable, polArr); + TRACE("(0x%08lx %s %p %p)\n", policy, debugstr_w(initial), polTable, polArr); #ifndef __REACTOS__ if (!polTable || !polArr) @@ -2958,7 +2957,7 @@ DWORD WINAPI SHRestrictionLookup( } } /* we don't know this policy, return 0 */ - TRACE("unknown policy: (%08x)\n", policy); + TRACE("unknown policy: (%08lx)\n", policy); return 0; } @@ -2991,7 +2990,7 @@ HRESULT WINAPI SHWeakQueryInterface( hret = IUnknown_QueryInterface(pInner, riid, ppv); if (SUCCEEDED(hret)) IUnknown_Release(pUnk); } - TRACE("-- 0x%08x\n", hret); + TRACE("-- 0x%08lx\n", hret); return hret; } @@ -3015,14 +3014,15 @@ VOID WINAPI SHWeakReleaseInterface(IUnknown *lpDest, IUnknown **lppUnknown) { /* Copy Reference*/ IUnknown_AddRef(lpDest); - IUnknown_AtomicRelease(lppUnknown); /* Release existing interface */ + IUnknown_Release(*lppUnknown); /* Release existing interface */ + *lppUnknown = NULL; } } /************************************************************************* * @ [SHLWAPI.269] * - * Convert an ASCII string of a CLSID into a CLSID. + * Convert an ANSI string of a CLSID into a CLSID. * * PARAMS * idstr [I] String representing a CLSID in registry format @@ -3035,7 +3035,7 @@ VOID WINAPI SHWeakReleaseInterface(IUnknown *lpDest, IUnknown **lppUnknown) BOOL WINAPI GUIDFromStringA(LPCSTR idstr, CLSID *id) { WCHAR wClsid[40]; - MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, sizeof(wClsid)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, ARRAY_SIZE(wClsid)); return SUCCEEDED(CLSIDFromString(wClsid, id)); } @@ -3131,13 +3131,13 @@ HWND WINAPI SHCreateWorkerWindowW(WNDPROC wndProc, HWND hWndParent, DWORD dwExSt WNDCLASSW wc; HWND hWnd; - TRACE("(%p, %p, 0x%08x, 0x%08x, %p, 0x%08lx)\n", + TRACE("(%p, %p, 0x%08lx, 0x%08lx, %p, 0x%08Ix)\n", wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra); /* If our OS is natively ANSI, use the ANSI version */ if (GetVersion() & 0x80000000) /* not NT */ { - TRACE("fallback to ANSI, ver 0x%08x\n", GetVersion()); + TRACE("fallback to ANSI, ver 0x%08lx\n", GetVersion()); return SHCreateWorkerWindowA(wndProc, hWndParent, dwExStyle, dwStyle, hMenu, wnd_extra); } @@ -3183,11 +3183,7 @@ HWND WINAPI SHCreateWorkerWindowW(WNDPROC wndProc, HWND hWndParent, DWORD dwExSt HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl) { TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl); -#ifdef __REACTOS__ - return SHInvokeCommand(hWnd, lpFolder, lpApidl, NULL); -#else return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0); -#endif } /************************************************************************* @@ -3195,7 +3191,7 @@ HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEM * * _SHPackDispParamsV */ -HRESULT WINAPI SHPackDispParamsV(DISPPARAMS *params, VARIANTARG *args, UINT cnt, __ms_va_list valist) +HRESULT WINAPI SHPackDispParamsV(DISPPARAMS *params, VARIANTARG *args, UINT cnt, va_list valist) { VARIANTARG *iter; @@ -3249,12 +3245,12 @@ HRESULT WINAPI SHPackDispParamsV(DISPPARAMS *params, VARIANTARG *args, UINT cnt, */ HRESULT WINAPIV SHPackDispParams(DISPPARAMS *params, VARIANTARG *args, UINT cnt, ...) { - __ms_va_list valist; + va_list valist; HRESULT hres; - __ms_va_start(valist, cnt); + va_start(valist, cnt); hres = SHPackDispParamsV(params, args, cnt, valist); - __ms_va_end(valist); + va_end(valist); return hres; } @@ -3311,7 +3307,7 @@ HRESULT WINAPI IConnectionPoint_InvokeWithCancel( IConnectionPoint* iCP, IID iid; HRESULT result; - FIXME("(%p)->(0x%x %p %x %x) partial stub\n", iCP, dispId, dispParams, unknown1, unknown2); + FIXME("(%p)->(0x%lx %p %lx %lx) partial stub\n", iCP, dispId, dispParams, unknown1, unknown2); result = IConnectionPoint_GetConnectionInterface(iCP, &iid); if (SUCCEEDED(result)) @@ -3336,7 +3332,7 @@ HRESULT WINAPI IConnectionPoint_SimpleInvoke( IID iid; HRESULT result; - TRACE("(%p)->(0x%x %p)\n",iCP,dispId,dispParams); + TRACE("(%p)->(0x%lx %p)\n",iCP,dispId,dispParams); result = IConnectionPoint_GetConnectionInterface(iCP, &iid); if (SUCCEEDED(result)) @@ -3366,7 +3362,7 @@ HRESULT WINAPI IConnectionPoint_OnChanged(IConnectionPoint* lpCP, DISPID dispID) IEnumConnections *lpEnum; HRESULT hRet = E_NOINTERFACE; - TRACE("(%p,0x%8X)\n", lpCP, dispID); + TRACE("(%p,0x%8lX)\n", lpCP, dispID); /* Get an enumerator for the connections */ if (lpCP) @@ -3411,7 +3407,7 @@ HRESULT WINAPIV IUnknown_CPContainerInvokeParam( IConnectionPoint *iCP; IConnectionPointContainer *iCPC; DISPPARAMS dispParams = {buffer, NULL, cParams, 0}; - __ms_va_list valist; + va_list valist; if (!container) return E_NOINTERFACE; @@ -3425,9 +3421,9 @@ HRESULT WINAPIV IUnknown_CPContainerInvokeParam( if(FAILED(result)) return result; - __ms_va_start(valist, cParams); + va_start(valist, cParams); SHPackDispParamsV(&dispParams, buffer, cParams, valist); - __ms_va_end(valist); + va_end(valist); result = SHLWAPI_InvokeByIID(iCP, riid, dispId, &dispParams); IConnectionPoint_Release(iCP); @@ -3454,7 +3450,7 @@ HRESULT WINAPI IUnknown_CPContainerOnChanged(IUnknown *lpUnknown, DISPID dispID) IConnectionPointContainer* lpCPC = NULL; HRESULT hRet = E_NOINTERFACE; - TRACE("(%p,0x%8X)\n", lpUnknown, dispID); + TRACE("(%p,0x%8lX)\n", lpUnknown, dispID); if (lpUnknown) hRet = IUnknown_QueryInterface(lpUnknown, &IID_IConnectionPointContainer, (void**)&lpCPC); @@ -3505,13 +3501,13 @@ DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out, INT ret; WCHAR *buf; - TRACE("(%s,%s,%p,%08x,%s)\n", debugstr_w(appName), debugstr_w(keyName), + TRACE("(%s,%s,%p,%08lx,%s)\n", debugstr_w(appName), debugstr_w(keyName), out, outLen, debugstr_w(filename)); if(outLen == 0) return 0; - buf = HeapAlloc(GetProcessHeap(), 0, outLen * sizeof(WCHAR)); + buf = malloc(outLen * sizeof(WCHAR)); if(!buf){ *out = 0; return 0; @@ -3519,13 +3515,13 @@ DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out, ret = GetPrivateProfileStringW(appName, keyName, NULL, buf, outLen, filename); if(ret) - strcpyW(out, buf); + lstrcpyW(out, buf); else *out = 0; - HeapFree(GetProcessHeap(), 0, buf); + free(buf); - return strlenW(out); + return lstrlenW(out); } #endif @@ -3549,7 +3545,7 @@ DWORD WINAPI SHGetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPWSTR out, BOOL WINAPI SHSetIniStringW(LPCWSTR appName, LPCWSTR keyName, LPCWSTR str, LPCWSTR filename) { - TRACE("(%s, %p, %s, %s)\n", debugstr_w(appName), keyName, debugstr_w(str), + TRACE("(%s, %s, %s, %s)\n", debugstr_w(appName), debugstr_w(keyName), debugstr_w(str), debugstr_w(filename)); return WritePrivateProfileStringW(appName, keyName, str, filename); @@ -3758,7 +3754,7 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST IContextMenu *iContext; HRESULT hRet; - TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId); + TRACE("(%p, %p, %p, %lu)\n", hWnd, lpFolder, lpApidl, dwCommandId); if (!lpFolder) return E_FAIL; @@ -3856,7 +3852,7 @@ HMODULE WINAPI MLLoadLibraryA(LPCSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossCo LPSTR ptr; DWORD len; - FIXME("(%s,%p,%d) semi-stub!\n", debugstr_a(new_mod), inst_hwnd, dwCrossCodePage); + FIXME("(%s,%p,%ld) semi-stub!\n", debugstr_a(new_mod), inst_hwnd, dwCrossCodePage); len = GetModuleFileNameA(inst_hwnd, mod_path, sizeof(mod_path)); if (!len || len >= sizeof(mod_path)) return NULL; @@ -3880,13 +3876,13 @@ HMODULE WINAPI MLLoadLibraryW(LPCWSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossC LPWSTR ptr; DWORD len; - FIXME("(%s,%p,%d) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage); - len = GetModuleFileNameW(inst_hwnd, mod_path, sizeof(mod_path) / sizeof(WCHAR)); - if (!len || len >= sizeof(mod_path) / sizeof(WCHAR)) return NULL; + FIXME("(%s,%p,%ld) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage); + len = GetModuleFileNameW(inst_hwnd, mod_path, ARRAY_SIZE(mod_path)); + if (!len || len >= ARRAY_SIZE(mod_path)) return NULL; - ptr = strrchrW(mod_path, '\\'); + ptr = wcsrchr(mod_path, '\\'); if (ptr) { - strcpyW(ptr+1, new_mod); + lstrcpyW(ptr+1, new_mod); TRACE("loading %s\n", debugstr_w(mod_path)); return LoadLibraryW(mod_path); } @@ -3908,7 +3904,7 @@ HMODULE WINAPI MLLoadLibraryW(LPCWSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossC */ COLORREF WINAPI ColorAdjustLuma(COLORREF cRGB, int dwLuma, BOOL bUnknown) { - TRACE("(0x%8x,%d,%d)\n", cRGB, dwLuma, bUnknown); + TRACE("(0x%8lx,%d,%d)\n", cRGB, dwLuma, bUnknown); if (dwLuma) { @@ -4082,7 +4078,7 @@ DWORD WINAPI SHGetMachineInfo(DWORD dwFlags) { HW_PROFILE_INFOA hwInfo; - TRACE("(0x%08x)\n", dwFlags); + TRACE("(0x%08lx)\n", dwFlags); GetCurrentHwProfileA(&hwInfo); switch (hwInfo.dwDockInfo & (DOCKINFO_DOCKED|DOCKINFO_UNDOCKED)) @@ -4102,7 +4098,7 @@ DWORD WINAPI SHGetMachineInfo(DWORD dwFlags) DWORD WINAPI SHWinHelpOnDemandW(HWND hwnd, LPCWSTR helpfile, DWORD flags1, VOID *ptr1, DWORD flags2) { - FIXME("(%p, %s, 0x%x, %p, %d)\n", hwnd, debugstr_w(helpfile), flags1, ptr1, flags2); + FIXME("(%p, %s, 0x%lx, %p, %ld)\n", hwnd, debugstr_w(helpfile), flags1, ptr1, flags2); return 0; } @@ -4113,7 +4109,7 @@ DWORD WINAPI SHWinHelpOnDemandW(HWND hwnd, LPCWSTR helpfile, DWORD flags1, VOID DWORD WINAPI SHWinHelpOnDemandA(HWND hwnd, LPCSTR helpfile, DWORD flags1, VOID *ptr1, DWORD flags2) { - FIXME("(%p, %s, 0x%x, %p, %d)\n", hwnd, debugstr_a(helpfile), flags1, ptr1, flags2); + FIXME("(%p, %s, 0x%lx, %p, %ld)\n", hwnd, debugstr_a(helpfile), flags1, ptr1, flags2); return 0; } @@ -4170,7 +4166,7 @@ DWORD WINAPI MLSetMLHInstance(HINSTANCE hInst, HANDLE hHeap) */ DWORD WINAPI MLClearMLHInstance(DWORD x) { - FIXME("(0x%08x)stub\n", x); + FIXME("(0x%08lx)stub\n", x); return 0xabba1247; } @@ -4508,7 +4504,7 @@ VOID WINAPI ColorRGBToHLS(COLORREF cRGB, LPWORD pwHue, { int wR, wG, wB, wMax, wMin, wHue, wLuminosity, wSaturation; - TRACE("(%08x,%p,%p,%p)\n", cRGB, pwHue, pwLuminance, pwSaturation); + TRACE("(%08lx,%p,%p,%p)\n", cRGB, pwHue, pwLuminance, pwSaturation); wR = GetRValue(cRGB); wG = GetGValue(cRGB); @@ -4648,7 +4644,7 @@ HRESULT WINAPI SHGetInverseCMAP(LPDWORD dest, DWORD dwSize) *dest = (DWORD)0xabba1249; return 0; } - FIXME("(%p, %#x) stub\n", dest, dwSize); + FIXME("(%p, %#lx) stub\n", dest, dwSize); return 0; } @@ -4757,17 +4753,19 @@ VOID WINAPI FixSlashesAndColonW(LPWSTR lpwstr) } } + #ifndef __REACTOS__ /* See appcompat.c */ /************************************************************************* * @ [SHLWAPI.461] */ DWORD WINAPI SHGetAppCompatFlags(DWORD dwUnknown) { - FIXME("(0x%08x) stub\n", dwUnknown); + FIXME("(0x%08lx) stub\n", dwUnknown); return 0; } #endif + /************************************************************************* * @ [SHLWAPI.549] */ @@ -4864,7 +4862,7 @@ HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create) int size_key, size_subkey, size_user; HKEY hkey = NULL; - TRACE("(0x%08x, %s, %d)\n", flags, debugstr_w(sub_key), create); + TRACE("(0x%08lx, %s, %d)\n", flags, debugstr_w(sub_key), create); /* For compatibility with Vista+ */ if(flags == 0x1ffff) @@ -4888,7 +4886,7 @@ HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create) size_key = sizeof(classesW); break; default: - FIXME("unsupported flags (0x%08x)\n", flags); + FIXME("unsupported flags (0x%08lx)\n", flags); return NULL; } @@ -4922,7 +4920,7 @@ HKEY WINAPI SHGetShellKey(DWORD flags, LPCWSTR sub_key, BOOL create) size_subkey = sizeof(file_extsW); break; default: - FIXME("unsupported flags (0x%08x)\n", flags); + FIXME("unsupported flags (0x%08lx)\n", flags); return NULL; } @@ -4962,7 +4960,7 @@ BOOL WINAPI SHQueueUserWorkItem(LPTHREAD_START_ROUTINE pfnCallback, LPVOID pContext, LONG lPriority, DWORD_PTR dwTag, DWORD_PTR *pdwId, LPCSTR pszModule, DWORD dwFlags) { - TRACE("(%p, %p, %d, %lx, %p, %s, %08x)\n", pfnCallback, pContext, + TRACE("(%p, %p, %ld, %Ix, %p, %s, %08lx)\n", pfnCallback, pContext, lPriority, dwTag, pdwId, debugstr_a(pszModule), dwFlags); if(lPriority || dwTag || pdwId || pszModule || dwFlags) @@ -5029,7 +5027,7 @@ HRESULT WINAPI SKAllocValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD * DWORD ret, size; HKEY hkey; - TRACE("(0x%x, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey), + TRACE("(0x%lx, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey), debugstr_w(value), type, data, count); hkey = SHGetShellKey(flags, subkey, FALSE); @@ -5065,7 +5063,7 @@ HRESULT WINAPI SKDeleteValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value) DWORD ret; HKEY hkey; - TRACE("(0x%x, %s %s)\n", flags, debugstr_w(subkey), debugstr_w(value)); + TRACE("(0x%lx, %s %s)\n", flags, debugstr_w(subkey), debugstr_w(value)); hkey = SHGetShellKey(flags, subkey, FALSE); if (!hkey) @@ -5086,7 +5084,7 @@ HRESULT WINAPI SKGetValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD *ty DWORD ret; HKEY hkey; - TRACE("(0x%x, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey), + TRACE("(0x%lx, %s, %s, %p, %p, %p)\n", flags, debugstr_w(subkey), debugstr_w(value), type, data, count); hkey = SHGetShellKey(flags, subkey, FALSE); @@ -5108,7 +5106,7 @@ HRESULT WINAPI SKSetValueW(DWORD flags, LPCWSTR subkey, LPCWSTR value, DWORD ret; HKEY hkey; - TRACE("(0x%x, %s, %s, %x, %p, %d)\n", flags, debugstr_w(subkey), + TRACE("(0x%lx, %s, %s, %lx, %p, %ld)\n", flags, debugstr_w(subkey), debugstr_w(value), type, data, count); hkey = SHGetShellKey(flags, subkey, TRUE); @@ -5180,10 +5178,10 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, WCHAR *szText = NULL, szTitle[100]; LPCWSTR pszText, pszTitle = szTitle; LPWSTR pszTemp; - __ms_va_list args; + va_list args; int ret; - __ms_va_start(args, uType); + va_start(args, uType); TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType); @@ -5205,7 +5203,7 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, pszText = szText; if (!pszText) { WARN("Failed to load id %d\n", LOWORD(lpText)); - __ms_va_end(args); + va_end(args); return 0; } } @@ -5215,7 +5213,7 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText, FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args); - __ms_va_end(args); + va_end(args); #ifdef __REACTOS__ uType |= MB_SETFOREGROUND; @@ -5413,7 +5411,7 @@ free_sids: HRESULT WINAPI SHCreatePropertyBagOnRegKey (HKEY hKey, LPCWSTR subkey, DWORD grfMode, REFIID riid, void **ppv) { - FIXME("%p %s %d %s %p STUB\n", hKey, debugstr_w(subkey), grfMode, + FIXME("%p %s %ld %s %p STUB\n", hKey, debugstr_w(subkey), grfMode, debugstr_guid(riid), ppv); return E_NOTIMPL; @@ -5480,7 +5478,7 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, return 0; if (fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS) - FIXME("ignoring some flags - 0x%08x\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS); + FIXME("ignoring some flags - 0x%08lx\n", fmt_flags & SHFORMATDT_UNSUPPORTED_FLAGS); FileTimeToLocalFileTime(fileTime, &ft); FileTimeToSystemTime(&ft, &st); @@ -5543,7 +5541,7 @@ INT WINAPI SHFormatDateTimeA(const FILETIME UNALIGNED *fileTime, DWORD *flags, retval = SHFormatDateTimeW(fileTime, flags, bufW, size); if (retval != 0) - WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, size, NULL, NULL); + retval = WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, size, NULL, NULL); HeapFree(GetProcessHeap(), 0, bufW); return retval; @@ -5569,7 +5567,7 @@ INT WINAPI ZoneCheckUrlExW(LPWSTR szURL, PVOID pUnknown, DWORD dwUnknown2, DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5, DWORD dwUnknown6, DWORD dwUnknown7) { - FIXME("(%s,%p,%x,%x,%x,%x,%x,%x) STUB\n", debugstr_w(szURL), pUnknown, dwUnknown2, + FIXME("(%s,%p,%lx,%lx,%lx,%lx,%lx,%lx) STUB\n", debugstr_w(szURL), pUnknown, dwUnknown2, dwUnknown3, dwUnknown4, dwUnknown5, dwUnknown6, dwUnknown7); return 0; @@ -5591,7 +5589,7 @@ INT WINAPI ZoneCheckUrlExW(LPWSTR szURL, PVOID pUnknown, DWORD dwUnknown2, */ INT WINAPI SHVerbExistsNA(LPSTR verb, PVOID pUnknown, PVOID pUnknown2, DWORD dwUnknown3) { - FIXME("(%s, %p, %p, %i) STUB\n",verb, pUnknown, pUnknown2, dwUnknown3); + FIXME("(%s, %p, %p, %li) STUB\n",verb, pUnknown, pUnknown2, dwUnknown3); return 0; } @@ -6519,7 +6517,7 @@ static const struct objcompat_entry objcompat_table[] = { * in registry for CLSID under ShellCompatibility subkey. * * PARAMS - * pUnk: pointer to object IUnknown interface, idetifies CLSID + * pUnk: pointer to object IUnknown interface, identifies CLSID * clsid: pointer to CLSID to retrieve data for * * RETURNS @@ -6532,8 +6530,8 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid) 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'S','h','e','l','l','C','o','m','p','a','t','i','b','i','l','i','t','y','\\', 'O','b','j','e','c','t','s','\\','%','s',0}; - WCHAR strW[sizeof(compatpathW)/sizeof(WCHAR) + 38 /* { CLSID } */]; - DWORD ret, length = sizeof(strW)/sizeof(WCHAR); + WCHAR strW[ARRAY_SIZE(compatpathW) + 38 /* { CLSID } */]; + DWORD ret, length = ARRAY_SIZE(strW); OLECHAR *clsid_str; HKEY key; INT i; @@ -6549,7 +6547,7 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid) } StringFromCLSID(clsid, &clsid_str); - sprintfW(strW, compatpathW, clsid_str); + swprintf(strW, ARRAY_SIZE(strW), compatpathW, clsid_str); CoTaskMemFree(clsid_str); ret = RegOpenKeyW(HKEY_LOCAL_MACHINE, strW, &key); @@ -6563,11 +6561,11 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid) /* search in table */ left = 0; - right = sizeof(objcompat_table) / sizeof(struct objcompat_entry) - 1; + right = ARRAY_SIZE(objcompat_table) - 1; while (right >= left) { x = (left + right) / 2; - res = strcmpW(strW, objcompat_table[x].name); + res = wcscmp(strW, objcompat_table[x].name); if (res == 0) { ret |= objcompat_table[x].value; @@ -6579,7 +6577,7 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid) left = x + 1; } - length = sizeof(strW)/sizeof(WCHAR); + length = ARRAY_SIZE(strW); } return ret; diff --git a/dll/win32/shlwapi/path.c b/dll/win32/shlwapi/path.c index cc6640506cb..196e8dfcf1c 100644 --- a/dll/win32/shlwapi/path.c +++ b/dll/win32/shlwapi/path.c @@ -19,9 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -1133,7 +1130,7 @@ BOOL WINAPI PathFileExistsDefExtW(LPWSTR lpszPath,DWORD dwWhich) { '.', 'c', 'm', 'd', 0}, { 0, 0, 0, 0, 0} }; - TRACE("(%s,%d)\n", debugstr_w(lpszPath), dwWhich); + TRACE("(%s,%ld)\n", debugstr_w(lpszPath), dwWhich); if (!lpszPath || PathIsUNCServerW(lpszPath) || PathIsUNCServerShareW(lpszPath)) return FALSE; @@ -1205,7 +1202,7 @@ BOOL WINAPI PathFileExistsDefExtA(LPSTR lpszPath,DWORD dwWhich) { BOOL bRet = FALSE; - TRACE("(%s,%d)\n", debugstr_a(lpszPath), dwWhich); + TRACE("(%s,%ld)\n", debugstr_a(lpszPath), dwWhich); if (lpszPath) { @@ -1232,7 +1229,7 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich) WCHAR *lpszPATH; WCHAR buff[MAX_PATH]; - TRACE("(%s,%08x)\n", debugstr_w(lpszFile), dwWhich); + TRACE("(%s,%08lx)\n", debugstr_w(lpszFile), dwWhich); /* Try system directories */ GetSystemDirectoryW(buff, MAX_PATH); @@ -1240,7 +1237,7 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich) return FALSE; if (PathFileExistsDefExtW(buff, dwWhich)) { - strcpyW(lpszFile, buff); + lstrcpyW(lpszFile, buff); return TRUE; } GetWindowsDirectoryW(buff, MAX_PATH); @@ -1248,7 +1245,7 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich) return FALSE; if (PathFileExistsDefExtW(buff, dwWhich)) { - strcpyW(lpszFile, buff); + lstrcpyW(lpszFile, buff); return TRUE; } GetWindowsDirectoryW(buff, MAX_PATH); @@ -1256,7 +1253,7 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich) return FALSE; if (PathFileExistsDefExtW(buff, dwWhich)) { - strcpyW(lpszFile, buff); + lstrcpyW(lpszFile, buff); return TRUE; } /* Try dirs listed in %PATH% */ @@ -1290,7 +1287,7 @@ static BOOL SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich) } if (PathFileExistsDefExtW(buff, dwWhich)) { - strcpyW(lpszFile, buff); + lstrcpyW(lpszFile, buff); HeapFree(GetProcessHeap(), 0, lpszPATH); return TRUE; } @@ -1318,7 +1315,7 @@ BOOL WINAPI PathFindOnPathExA(LPSTR lpszFile,LPCSTR *lppszOtherDirs,DWORD dwWhic WCHAR szFile[MAX_PATH]; WCHAR buff[MAX_PATH]; - TRACE("(%s,%p,%08x)\n", debugstr_a(lpszFile), lppszOtherDirs, dwWhich); + TRACE("(%s,%p,%08lx)\n", debugstr_a(lpszFile), lppszOtherDirs, dwWhich); if (!lpszFile || !PathIsFileSpecA(lpszFile)) return FALSE; @@ -1361,7 +1358,7 @@ BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile,LPCWSTR *lppszOtherDirs,DWORD dwWh { WCHAR buff[MAX_PATH]; - TRACE("(%s,%p,%08x)\n", debugstr_w(lpszFile), lppszOtherDirs, dwWhich); + TRACE("(%s,%p,%08lx)\n", debugstr_w(lpszFile), lppszOtherDirs, dwWhich); if (!lpszFile || !PathIsFileSpecW(lpszFile)) return FALSE; @@ -1375,7 +1372,7 @@ BOOL WINAPI PathFindOnPathExW(LPWSTR lpszFile,LPCWSTR *lppszOtherDirs,DWORD dwWh PathCombineW(buff, *lpszOtherPath, lpszFile); if (PathFileExistsDefExtW(buff, dwWhich)) { - strcpyW(lpszFile, buff); + lstrcpyW(lpszFile, buff); return TRUE; } lpszOtherPath++; @@ -1446,7 +1443,7 @@ BOOL WINAPI PathCompactPathExA(LPSTR lpszDest, LPCSTR lpszPath, { BOOL bRet = FALSE; - TRACE("(%p,%s,%d,0x%08x)\n", lpszDest, debugstr_a(lpszPath), cchMax, dwFlags); + TRACE("(%p,%s,%d,0x%08lx)\n", lpszDest, debugstr_a(lpszPath), cchMax, dwFlags); if (lpszPath && lpszDest) { @@ -1473,7 +1470,7 @@ BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, LPCWSTR lpszFile; DWORD dwLen, dwFileLen = 0; - TRACE("(%p,%s,%d,0x%08x)\n", lpszDest, debugstr_w(lpszPath), cchMax, dwFlags); + TRACE("(%p,%s,%d,0x%08lx)\n", lpszDest, debugstr_w(lpszPath), cchMax, dwFlags); if (!lpszPath) return FALSE; @@ -1489,7 +1486,7 @@ BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, if (cchMax < 2) return TRUE; - dwLen = strlenW(lpszPath) + 1; + dwLen = lstrlenW(lpszPath) + 1; if (dwLen < cchMax) { @@ -1515,7 +1512,7 @@ BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, /* Compact the file name with ellipses at the end */ cchMax -= 4; memcpy(lpszDest, lpszFile, cchMax * sizeof(WCHAR)); - strcpyW(lpszDest + cchMax, szEllipses); + lstrcpyW(lpszDest + cchMax, szEllipses); return TRUE; } /* We have a root in the path */ @@ -1532,7 +1529,7 @@ BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, *lpszDest = '\0'; return TRUE; } - strcpyW(lpszDest, szEllipses); + lstrcpyW(lpszDest, szEllipses); lpszDest += 3; cchMax -= 4; *lpszDest++ = *lpszFile++; @@ -1545,15 +1542,15 @@ BOOL WINAPI PathCompactPathExW(LPWSTR lpszDest, LPCWSTR lpszPath, } cchMax -= 4; memcpy(lpszDest, lpszFile, cchMax * sizeof(WCHAR)); - strcpyW(lpszDest + cchMax, szEllipses); + lstrcpyW(lpszDest + cchMax, szEllipses); return TRUE; } /* Only the root needs to be Compacted */ dwLen = cchMax - dwFileLen - 3; memcpy(lpszDest, lpszPath, dwLen * sizeof(WCHAR)); - strcpyW(lpszDest + dwLen, szEllipses); - strcpyW(lpszDest + dwLen + 3, lpszFile); + lstrcpyW(lpszDest + dwLen, szEllipses); + lstrcpyW(lpszDest + dwLen + 3, lpszFile); return TRUE; } @@ -2102,22 +2099,18 @@ BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2) * a content type is registered, it is compared (case insensitively) to * lpszContentType. Only if this matches does the function succeed. */ -BOOL WINAPI PathIsContentTypeA(LPCSTR lpszPath, LPCSTR lpszContentType) +BOOL WINAPI PathIsContentTypeA(LPCSTR path, LPCSTR content_type) { - LPCSTR szExt; - DWORD dwDummy; - char szBuff[MAX_PATH]; + char buf[MAX_PATH]; + DWORD size = sizeof(buf); + LPCSTR ext; - TRACE("(%s,%s)\n", debugstr_a(lpszPath), debugstr_a(lpszContentType)); + TRACE("(%s,%s)\n", debugstr_a(path), debugstr_a(content_type)); - if (lpszPath && (szExt = PathFindExtensionA(lpszPath)) && *szExt && - !SHGetValueA(HKEY_CLASSES_ROOT, szExt, "Content Type", - REG_NONE, szBuff, &dwDummy) && - !strcasecmp(lpszContentType, szBuff)) - { - return TRUE; - } - return FALSE; + if(!path) return FALSE; + if(!(ext = PathFindExtensionA(path)) || !*ext) return FALSE; + if(SHGetValueA(HKEY_CLASSES_ROOT, ext, "Content Type", NULL, buf, &size)) return FALSE; + return !lstrcmpiA(content_type, buf); } /************************************************************************* @@ -2137,7 +2130,7 @@ BOOL WINAPI PathIsContentTypeW(LPCWSTR lpszPath, LPCWSTR lpszContentType) if (lpszPath && (szExt = PathFindExtensionW(lpszPath)) && *szExt && !SHGetValueW(HKEY_CLASSES_ROOT, szExt, szContentType, REG_NONE, szBuff, &dwDummy) && - !strcmpiW(lpszContentType, szBuff)) + !wcsicmp(lpszContentType, szBuff)) { return TRUE; } @@ -2246,7 +2239,7 @@ BOOL WINAPI PathIsPrefixW(LPCWSTR lpszPrefix, LPCWSTR lpszPath) */ BOOL WINAPI PathIsSystemFolderA(LPCSTR lpszPath, DWORD dwAttrib) { - TRACE("(%s,0x%08x)\n", debugstr_a(lpszPath), dwAttrib); + TRACE("(%s,0x%08lx)\n", debugstr_a(lpszPath), dwAttrib); if (lpszPath && *lpszPath) dwAttrib = GetFileAttributesA(lpszPath); @@ -2264,7 +2257,7 @@ BOOL WINAPI PathIsSystemFolderA(LPCSTR lpszPath, DWORD dwAttrib) */ BOOL WINAPI PathIsSystemFolderW(LPCWSTR lpszPath, DWORD dwAttrib) { - TRACE("(%s,0x%08x)\n", debugstr_w(lpszPath), dwAttrib); + TRACE("(%s,0x%08lx)\n", debugstr_w(lpszPath), dwAttrib); if (lpszPath && *lpszPath) dwAttrib = GetFileAttributesW(lpszPath); @@ -2757,14 +2750,14 @@ BOOL WINAPI PathMakePrettyW(LPWSTR lpszPath) { do { - if (islowerW(*pszIter)) + if (iswlower(*pszIter)) return FALSE; /* Not DOS path */ pszIter++; } while (*pszIter); pszIter = lpszPath + 1; while (*pszIter) { - *pszIter = tolowerW(*pszIter); + *pszIter = towlower(*pszIter); pszIter++; } } @@ -2953,7 +2946,7 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) hdc = hDC = GetDC(0); /* Get the length of the whole path */ - dwLen = strlenW(lpszPath); + dwLen = lstrlenW(lpszPath); GetTextExtentPointW(hDC, lpszPath, dwLen, &size); if ((UINT)size.cx > dx) @@ -2969,7 +2962,7 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) GetTextExtentPointW(hDC, szEllipses, 3, &size); dwEllipsesLen = size.cx; /* Get the size of the file name */ - GetTextExtentPointW(hDC, sFile, strlenW(sFile), &size); + GetTextExtentPointW(hDC, sFile, lstrlenW(sFile), &size); dwPathLen = size.cx; if (sFile != lpszPath) @@ -3003,14 +2996,14 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) { if (bEllipses) { - strcpyW(sPath, szEllipses); - strcpyW(sPath+3, buff); + lstrcpyW(sPath, szEllipses); + lstrcpyW(sPath+3, buff); } bRet = TRUE; goto end; } - strcpyW(lpszPath, szEllipses); - strcpyW(lpszPath+3, buff); + lstrcpyW(lpszPath, szEllipses); + lstrcpyW(lpszPath+3, buff); bRet = FALSE; goto end; } @@ -3018,7 +3011,7 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) /* Trim the path by adding ellipses to the end, e.g: * A very long file name.txt ==> A very... */ - dwLen = strlenW(lpszPath); + dwLen = lstrlenW(lpszPath); if (dwLen > MAX_PATH - 3) dwLen = MAX_PATH - 3; @@ -3047,8 +3040,8 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx) } else { - strcpyW(buff + dwLen, szEllipses); - strcpyW(lpszPath, buff); + lstrcpyW(buff + dwLen, szEllipses); + lstrcpyW(lpszPath, buff); } } @@ -3176,11 +3169,11 @@ BOOL WINAPI PathMakeSystemFolderW(LPCWSTR lpszPath) /* If the directory is already a system directory, don't do anything */ GetSystemDirectoryW(buff, MAX_PATH); - if (!strcmpW(buff, lpszPath)) + if (!wcscmp(buff, lpszPath)) return TRUE; GetWindowsDirectoryW(buff, MAX_PATH); - if (!strcmpW(buff, lpszPath)) + if (!wcscmp(buff, lpszPath)) return TRUE; /* "UseSystemForSystemFolders" Tells Win what attributes to use */ @@ -3777,7 +3770,7 @@ VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath) return; if (lpszPath) - lstrcpynW(path, lpszPath, sizeof(path) / sizeof(WCHAR)); + lstrcpynW(path, lpszPath, ARRAY_SIZE(path)); else path[0] = '\0'; @@ -3991,11 +3984,11 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath) lstrcpynW(szSearch, lpszPath, MAX_PATH); PathAddBackslashW(szSearch); - dwLen = strlenW(szSearch); + dwLen = lstrlenW(szSearch); if (dwLen > MAX_PATH - 4) return FALSE; - strcpyW(szSearch + dwLen, szAllFiles); + lstrcpyW(szSearch + dwLen, szAllFiles); hfind = FindFirstFileW(szSearch, &find_data); if (hfind == INVALID_HANDLE_VALUE) return FALSE; @@ -4077,14 +4070,14 @@ LPCWSTR WINAPI PathFindSuffixArrayW(LPCWSTR lpszSuffix, LPCWSTR *lppszArray, int if (lpszSuffix && lppszArray && dwCount > 0) { - dwLen = strlenW(lpszSuffix); + dwLen = lstrlenW(lpszSuffix); while (dwRet < dwCount) { - size_t dwCompareLen = strlenW(*lppszArray); + size_t dwCompareLen = lstrlenW(*lppszArray); if (dwCompareLen < dwLen) { - if (!strcmpW(lpszSuffix + dwLen - dwCompareLen, *lppszArray)) + if (!wcscmp(lpszSuffix + dwLen - dwCompareLen, *lppszArray)) return *lppszArray; /* Found */ } dwRet++; @@ -4108,22 +4101,22 @@ LPCWSTR WINAPI PathFindSuffixArrayW(LPCWSTR lpszSuffix, LPCWSTR *lppszArray, int * NOTES * A decorations form is "path[n].ext" where "n" is an optional decimal number. */ -void WINAPI PathUndecorateA(LPSTR pszPath) +void WINAPI PathUndecorateA(char *path) { char *ext, *skip; - TRACE("(%s)\n", debugstr_a(pszPath)); + TRACE("(%s)\n", debugstr_a(path)); - if (!pszPath) return; + if (!path) return; - ext = PathFindExtensionA(pszPath); - if (ext == pszPath || ext[-1] != ']') return; + ext = PathFindExtensionA(path); + if (ext == path || ext[-1] != ']') return; skip = ext - 2; - while (skip > pszPath && '0' <= *skip && *skip <= '9') + while (skip > path && '0' <= *skip && *skip <= '9') skip--; - if (skip > pszPath && *skip == '[' && skip[-1] != '\\') + if (skip > path && *skip == '[' && skip[-1] != '\\') memmove(skip, ext, strlen(ext) + 1); } @@ -4132,22 +4125,22 @@ void WINAPI PathUndecorateA(LPSTR pszPath) * * See PathUndecorateA. */ -void WINAPI PathUndecorateW(LPWSTR pszPath) +void WINAPI PathUndecorateW(WCHAR *path) { WCHAR *ext, *skip; - TRACE("(%s)\n", debugstr_w(pszPath)); + TRACE("(%s)\n", debugstr_w(path)); - if (!pszPath) return; + if (!path) return; - ext = PathFindExtensionW(pszPath); - if (ext == pszPath || ext[-1] != ']') return; + ext = PathFindExtensionW(path); + if (ext == path || ext[-1] != ']') return; skip = ext - 2; - while (skip > pszPath && '0' <= *skip && *skip <= '9') + while (skip > path && '0' <= *skip && *skip <= '9') skip--; - if (skip > pszPath && *skip == '[' && skip[-1] != '\\') + if (skip > path && *skip == '[' && skip[-1] != '\\') memmove(skip, ext, (wcslen(ext) + 1) * sizeof(WCHAR)); } @@ -4284,7 +4277,7 @@ HRESULT WINAPI SHGetWebFolderFilePathA(LPCSTR lpszFile, LPSTR lpszPath, DWORD dw WCHAR szFile[MAX_PATH], szPath[MAX_PATH]; HRESULT hRet; - TRACE("(%s,%p,%d)\n", lpszFile, lpszPath, dwPathLen); + TRACE("(%s,%p,%ld)\n", lpszFile, lpszPath, dwPathLen); MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, szFile, MAX_PATH); szPath[0] = '\0'; @@ -4302,25 +4295,23 @@ HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR lpszFile, LPWSTR lpszPath, DWORD { static const WCHAR szWeb[] = {'\\','W','e','b','\\','\0'}; static const WCHAR szWebMui[] = {'m','u','i','\\','%','0','4','x','\\','\0'}; -#define szWebLen (sizeof(szWeb)/sizeof(WCHAR)) -#define szWebMuiLen ((sizeof(szWebMui)+1)/sizeof(WCHAR)) DWORD dwLen, dwFileLen; LANGID lidSystem, lidUser; - TRACE("(%s,%p,%d)\n", debugstr_w(lpszFile), lpszPath, dwPathLen); + TRACE("(%s,%p,%ld)\n", debugstr_w(lpszFile), lpszPath, dwPathLen); /* Get base directory for web content */ dwLen = GetSystemWindowsDirectoryW(lpszPath, dwPathLen); if (dwLen > 0 && lpszPath[dwLen-1] == '\\') dwLen--; - dwFileLen = strlenW(lpszFile); + dwFileLen = lstrlenW(lpszFile); - if (dwLen + dwFileLen + szWebLen >= dwPathLen) + if (dwLen + dwFileLen + ARRAY_SIZE(szWeb) >= dwPathLen) return E_FAIL; /* lpszPath too short */ - strcpyW(lpszPath+dwLen, szWeb); - dwLen += szWebLen; + lstrcpyW(lpszPath+dwLen, szWeb); + dwLen += ARRAY_SIZE(szWeb); dwPathLen = dwPathLen - dwLen; /* Remaining space */ lidSystem = GetSystemDefaultUILanguage(); @@ -4328,18 +4319,18 @@ HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR lpszFile, LPWSTR lpszPath, DWORD if (lidSystem != lidUser) { - if (dwFileLen + szWebMuiLen < dwPathLen) + if (dwFileLen + ARRAY_SIZE(szWebMui) < dwPathLen) { /* Use localised content in the users UI language if present */ wsprintfW(lpszPath + dwLen, szWebMui, lidUser); - strcpyW(lpszPath + dwLen + szWebMuiLen, lpszFile); + lstrcpyW(lpszPath + dwLen + ARRAY_SIZE(szWebMui), lpszFile); if (PathFileExistsW(lpszPath)) return S_OK; } } /* Fall back to OS default installed content */ - strcpyW(lpszPath + dwLen, lpszFile); + lstrcpyW(lpszPath + dwLen, lpszFile); if (PathFileExistsW(lpszPath)) return S_OK; return E_FAIL; diff --git a/dll/win32/shlwapi/reg.c b/dll/win32/shlwapi/reg.c index 0af0ce66d62..228d066d98e 100644 --- a/dll/win32/shlwapi/reg.c +++ b/dll/win32/shlwapi/reg.c @@ -1976,7 +1976,7 @@ BOOL WINAPI RegisterMIMETypeForExtensionW(LPCWSTR lpszSubKey, LPCWSTR lpszValue) } return !SHSetValueW(HKEY_CLASSES_ROOT, lpszSubKey, lpszContentTypeW, - REG_SZ, lpszValue, strlenW(lpszValue)); + REG_SZ, lpszValue, lstrlenW(lpszValue)); } /************************************************************************* @@ -2025,7 +2025,7 @@ BOOL WINAPI UnregisterMIMETypeForExtensionW(LPCWSTR lpszSubKey) */ BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen) { - TRACE("(%s,%p,%d)\n", debugstr_a(lpszType), lpszBuffer, dwLen); + TRACE("(%s,%p,%ld)\n", debugstr_a(lpszType), lpszBuffer, dwLen); if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer) { @@ -2048,11 +2048,11 @@ BOOL WINAPI GetMIMETypeSubKeyA(LPCSTR lpszType, LPSTR lpszBuffer, DWORD dwLen) */ BOOL WINAPI GetMIMETypeSubKeyW(LPCWSTR lpszType, LPWSTR lpszBuffer, DWORD dwLen) { - TRACE("(%s,%p,%d)\n", debugstr_w(lpszType), lpszBuffer, dwLen); + TRACE("(%s,%p,%ld)\n", debugstr_w(lpszType), lpszBuffer, dwLen); if (dwLen > dwLenMimeDbContent && lpszType && lpszBuffer) { - DWORD dwStrLen = strlenW(lpszType); + DWORD dwStrLen = lstrlenW(lpszType); if (dwStrLen < dwLen - dwLenMimeDbContent) { @@ -2127,7 +2127,7 @@ BOOL WINAPI MIME_GetExtensionW(LPCWSTR lpszType, LPWSTR lpExt, INT iLen) lpExt[1]) { if (lpExt[1] == '.') - memmove(lpExt, lpExt + 1, (strlenW(lpExt + 1) + 1) * sizeof(WCHAR)); + memmove(lpExt, lpExt + 1, (lstrlenW(lpExt + 1) + 1) * sizeof(WCHAR)); else *lpExt = '.'; /* Supply a '.' */ bRet = TRUE; @@ -2451,7 +2451,7 @@ HRESULT WINAPI SHRegGetCLSIDKeyA(REFGUID guid, LPCSTR lpszValue, BOOL bUseHKCU, WCHAR szValue[MAX_PATH]; if (lpszValue) - MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, sizeof(szValue)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, ARRAY_SIZE(szValue)); return SHRegGetCLSIDKeyW(guid, lpszValue ? szValue : NULL, bUseHKCU, bCreate, phKey); } @@ -2470,7 +2470,6 @@ HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID guid, LPCWSTR lpszValue, BOOL bUseHKCU, 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'E','x','p','l','o','r','e','r','\\','C','L','S','I','D','\\' }; #endif -#define szClassIdKeyLen (sizeof(szClassIdKey)/sizeof(WCHAR)) WCHAR szKey[MAX_PATH]; DWORD dwRet; HKEY hkey; @@ -2491,12 +2490,12 @@ HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID guid, LPCWSTR lpszValue, BOOL bUseHKCU, } #else memcpy(szKey, szClassIdKey, sizeof(szClassIdKey)); - SHStringFromGUIDW(guid, szKey + szClassIdKeyLen, 39); /* Append guid */ + SHStringFromGUIDW(guid, szKey + ARRAY_SIZE(szClassIdKey), 39); /* Append guid */ if(lpszValue) { - szKey[szClassIdKeyLen + 39] = '\\'; - strcpyW(szKey + szClassIdKeyLen + 40, lpszValue); /* Append value name */ + szKey[ARRAY_SIZE(szClassIdKey) + 39] = '\\'; + lstrcpyW(szKey + ARRAY_SIZE(szClassIdKey) + 40, lpszValue); /* Append value name */ } #endif diff --git a/dll/win32/shlwapi/regstream.c b/dll/win32/shlwapi/regstream.c index 39889705014..de2fa94394f 100644 --- a/dll/win32/shlwapi/regstream.c +++ b/dll/win32/shlwapi/regstream.c @@ -88,7 +88,7 @@ static ULONG WINAPI IStream_fnAddRef(IStream *iface) ISHRegStream *This = impl_from_IStream(iface); ULONG refCount = InterlockedIncrement(&This->ref); - TRACE("(%p)->(ref before=%u)\n",This, refCount - 1); + TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1); return refCount; } @@ -101,7 +101,7 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface) ISHRegStream *This = impl_from_IStream(iface); ULONG refCount = InterlockedDecrement(&This->ref); - TRACE("(%p)->(ref before=%u)\n",This, refCount + 1); + TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1); if (!refCount) { @@ -150,7 +150,7 @@ static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG ISHRegStream *This = impl_from_IStream(iface); DWORD dwBytesToRead; - TRACE("(%p)->(%p,0x%08x,%p)\n",This, pv, cb, pcbRead); + TRACE("(%p)->(%p,0x%08lx,%p)\n",This, pv, cb, pcbRead); if (This->dwPos >= This->dwLength) dwBytesToRead = 0; @@ -178,7 +178,7 @@ static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb ISHRegStream *This = impl_from_IStream(iface); DWORD newLen = This->dwPos + cb; - TRACE("(%p, %p, %d, %p)\n",This, pv, cb, pcbWritten); + TRACE("(%p, %p, %ld, %p)\n",This, pv, cb, pcbWritten); if (newLen < This->dwPos) /* overflow */ return STG_E_INSUFFICIENTMEMORY; @@ -208,7 +208,7 @@ static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, D { ISHRegStream *This = impl_from_IStream(iface); LARGE_INTEGER tmp; - TRACE("(%p, %s, %d %p)\n", This, + TRACE("(%p, %s, %ld %p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition); if (dwOrigin == STREAM_SEEK_SET) @@ -317,7 +317,7 @@ static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD { ISHRegStream *This = impl_from_IStream(iface); - TRACE("(%p, %p, %d)\n",This,pstatstg,grfStatFlag); + TRACE("(%p, %p, %ld)\n",This,pstatstg,grfStatFlag); pstatstg->pwcsName = NULL; pstatstg->type = STGTY_STREAM; diff --git a/dll/win32/shlwapi/shlwapi_main.c b/dll/win32/shlwapi/shlwapi_main.c index 97385915c6a..758aaf91aed 100644 --- a/dll/win32/shlwapi/shlwapi_main.c +++ b/dll/win32/shlwapi/shlwapi_main.c @@ -132,6 +132,6 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi) return S_OK; } - WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize); + WARN("pdvi->cbSize = %ld, unhandled\n", pdvi2->info1.cbSize); return E_INVALIDARG; } diff --git a/dll/win32/shlwapi/stopwatch.c b/dll/win32/shlwapi/stopwatch.c index fcee075fca3..8a5d07b14e4 100644 --- a/dll/win32/shlwapi/stopwatch.c +++ b/dll/win32/shlwapi/stopwatch.c @@ -23,15 +23,10 @@ * B) Want to use a substandard API to tune its performance. */ -#include "config.h" -#include "wine/port.h" - #include #include #include -#define NONAMELESSUNION - #include "windef.h" #include "winbase.h" #include "winreg.h" @@ -96,7 +91,7 @@ void WINAPI StopWatchFlush(void) DWORD WINAPI StopWatchW(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown, DWORD dwMode, DWORD dwTimeStamp) { - FIXME("(%d,%s,%d,%d,%d) stub!\n", dwClass, debugstr_w(lpszStr), + FIXME("(%ld,%s,%ld,%ld,%ld) stub!\n", dwClass, debugstr_w(lpszStr), dwUnknown, dwMode, dwTimeStamp); return ERROR_SUCCESS; } @@ -174,7 +169,7 @@ void WINAPI StopWatch_MarkFrameStart(LPCSTR lpszName) */ void WINAPI StopWatch_MarkJavaStop(LPCWSTR lpszEvent, HWND hWnd, DWORD dwReserved) { - FIXME("(%s,%p,0x%08x) stub!\n", debugstr_w(lpszEvent), hWnd, dwReserved); + FIXME("(%s,%p,0x%08lx) stub!\n", debugstr_w(lpszEvent), hWnd, dwReserved); } /************************************************************************* @@ -218,7 +213,7 @@ DWORD WINAPI GetPerfTime(void) */ DWORD WINAPI StopWatch_SetMsgLastLocation(DWORD dwUnknown) { - FIXME("(%d) stub!\n", dwUnknown); + FIXME("(%ld) stub!\n", dwUnknown); return dwUnknown; } diff --git a/dll/win32/shlwapi/string.c b/dll/win32/shlwapi/string.c index 16110831c2b..413688bbbe0 100644 --- a/dll/win32/shlwapi/string.c +++ b/dll/win32/shlwapi/string.c @@ -19,16 +19,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include #include -#define NONAMELESSUNION - #include "windef.h" #include "winbase.h" #define NO_SHLWAPI_REG @@ -51,6 +46,7 @@ extern HINSTANCE shlwapi_hInstance; static HRESULT _SHStrDupAA(LPCSTR,LPSTR*); static HRESULT _SHStrDupAW(LPCWSTR,LPSTR*); +DWORD WINAPI SHTruncateString(LPSTR lpStr, DWORD size); static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bufwlen, LPWSTR thousand_buffer, int thousand_bufwlen) @@ -71,7 +67,7 @@ static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bu * http://blogs.msdn.com/oldnewthing/archive/2006/04/18/578251.aspx */ fmt->Grouping = 0; - GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, grouping, sizeof(grouping)/sizeof(WCHAR)); + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, grouping, ARRAY_SIZE(grouping)); for (c = grouping; *c; c++) if (*c >= '0' && *c < '9') { @@ -101,8 +97,7 @@ static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf) WCHAR *c; BOOL neg = (qdwValue < 0); - FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR), - thousand, sizeof thousand / sizeof (WCHAR)); + FillNumberFmt(&fmt, decimal, ARRAY_SIZE(decimal), thousand, ARRAY_SIZE(thousand)); c = &buf[24]; *(--c) = 0; @@ -133,10 +128,9 @@ static int FormatDouble(double value, int decimals, LPWSTR pszBuf, int cchBuf) NUMBERFMTW fmt; WCHAR decimal[8], thousand[8]; - snprintfW(buf, 64, flfmt, value); + swprintf(buf, 64, flfmt, value); - FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR), - thousand, sizeof thousand / sizeof (WCHAR)); + FillNumberFmt(&fmt, decimal, ARRAY_SIZE(decimal), thousand, ARRAY_SIZE(thousand)); fmt.NumDigits = decimals; return GetNumberFormatW(LOCALE_USER_DEFAULT, 0, buf, &fmt, pszBuf, cchBuf); } @@ -454,7 +448,7 @@ LPWSTR WINAPI StrCatW(LPWSTR lpszStr, LPCWSTR lpszSrc) TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSrc)); if (lpszStr && lpszSrc) - strcatW(lpszStr, lpszSrc); + lstrcatW(lpszStr, lpszSrc); return lpszStr; } @@ -516,7 +510,7 @@ LPWSTR WINAPI StrCpyW(LPWSTR lpszStr, LPCWSTR lpszSrc) TRACE("(%p,%s)\n", lpszStr, debugstr_w(lpszSrc)); if (lpszStr && lpszSrc) - strcpyW(lpszStr, lpszSrc); + lstrcpyW(lpszStr, lpszSrc); return lpszStr; } @@ -1633,16 +1627,16 @@ HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, U switch (src->uType) { case STRRET_WSTR: - WideCharToMultiByte(CP_ACP, 0, src->u.pOleStr, -1, dest, len, NULL, NULL); - CoTaskMemFree(src->u.pOleStr); + WideCharToMultiByte(CP_ACP, 0, src->pOleStr, -1, dest, len, NULL, NULL); + CoTaskMemFree(src->pOleStr); break; case STRRET_CSTR: - lstrcpynA(dest, src->u.cStr, len); + lstrcpynA(dest, src->cStr, len); break; case STRRET_OFFSET: - lstrcpynA((LPSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len); + lstrcpynA(dest, ((LPCSTR)&pidl->mkid)+src->uOffset, len); break; default: @@ -1677,12 +1671,12 @@ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, switch (src->uType) { case STRRET_WSTR: { size_t dst_len; - if (!src->u.pOleStr) + if (!src->pOleStr) return E_FAIL; - dst_len = strlenW(src->u.pOleStr); - memcpy(dest, src->u.pOleStr, min(dst_len, len-1) * sizeof(WCHAR)); + dst_len = lstrlenW(src->pOleStr); + memcpy(dest, src->pOleStr, min(dst_len, len-1) * sizeof(WCHAR)); dest[min(dst_len, len-1)] = 0; - CoTaskMemFree(src->u.pOleStr); + CoTaskMemFree(src->pOleStr); if (len <= dst_len) { dest[0] = 0; @@ -1692,14 +1686,14 @@ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, } case STRRET_CSTR: - if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len )) + if (!MultiByteToWideChar( CP_ACP, 0, src->cStr, -1, dest, len )) dest[len-1] = 0; break; case STRRET_OFFSET: if (pidl) { - if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->u.uOffset, -1, + if (!MultiByteToWideChar( CP_ACP, 0, ((LPCSTR)&pidl->mkid)+src->uOffset, -1, dest, len )) dest[len-1] = 0; } @@ -1734,16 +1728,16 @@ HRESULT WINAPI StrRetToStrA(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPSTR *pp switch (lpStrRet->uType) { case STRRET_WSTR: - hRet = _SHStrDupAW(lpStrRet->u.pOleStr, ppszName); - CoTaskMemFree(lpStrRet->u.pOleStr); + hRet = _SHStrDupAW(lpStrRet->pOleStr, ppszName); + CoTaskMemFree(lpStrRet->pOleStr); break; case STRRET_CSTR: - hRet = _SHStrDupAA(lpStrRet->u.cStr, ppszName); + hRet = _SHStrDupAA(lpStrRet->cStr, ppszName); break; case STRRET_OFFSET: - hRet = _SHStrDupAA(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, ppszName); + hRet = _SHStrDupAA(((LPCSTR)&pidl->mkid) + lpStrRet->uOffset, ppszName); break; default: @@ -1766,21 +1760,21 @@ HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *p { case STRRET_WSTR: #ifdef __REACTOS__ - hRet = lpStrRet->u.pOleStr ? S_OK : E_FAIL; - *ppszName = lpStrRet->u.pOleStr; - lpStrRet->u.pOleStr = NULL; /* Windows does this, presumably in case someone calls SHFree */ + hRet = lpStrRet->pOleStr ? S_OK : E_FAIL; + *ppszName = lpStrRet->pOleStr; + lpStrRet->pOleStr = NULL; /* Windows does this, presumably in case someone calls SHFree */ #else - hRet = SHStrDupW(lpStrRet->u.pOleStr, ppszName); - CoTaskMemFree(lpStrRet->u.pOleStr); + hRet = SHStrDupW(lpStrRet->pOleStr, ppszName); + CoTaskMemFree(lpStrRet->pOleStr); #endif break; case STRRET_CSTR: - hRet = SHStrDupA(lpStrRet->u.cStr, ppszName); + hRet = SHStrDupA(lpStrRet->cStr, ppszName); break; case STRRET_OFFSET: - hRet = SHStrDupA(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, ppszName); + hRet = SHStrDupA(((LPCSTR)&pidl->mkid) + lpStrRet->uOffset, ppszName); break; default: @@ -1790,7 +1784,7 @@ HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *p return hRet; } -/* Create an ASCII string copy using SysAllocString() */ +/* Makes a Unicode copy of an ANSI string using SysAllocString() */ static HRESULT _SHStrDupAToBSTR(LPCSTR src, BSTR *pBstrOut) { *pBstrOut = NULL; @@ -1834,18 +1828,18 @@ HRESULT WINAPI StrRetToBSTR(STRRET *lpStrRet, LPCITEMIDLIST pidl, BSTR* pBstrOut switch (lpStrRet->uType) { case STRRET_WSTR: - *pBstrOut = SysAllocString(lpStrRet->u.pOleStr); + *pBstrOut = SysAllocString(lpStrRet->pOleStr); if (*pBstrOut) hRet = S_OK; - CoTaskMemFree(lpStrRet->u.pOleStr); + CoTaskMemFree(lpStrRet->pOleStr); break; case STRRET_CSTR: - hRet = _SHStrDupAToBSTR(lpStrRet->u.cStr, pBstrOut); + hRet = _SHStrDupAToBSTR(lpStrRet->cStr, pBstrOut); break; case STRRET_OFFSET: - hRet = _SHStrDupAToBSTR(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, pBstrOut); + hRet = _SHStrDupAToBSTR(((LPCSTR)&pidl->mkid) + lpStrRet->uOffset, pBstrOut); break; default: @@ -1952,7 +1946,7 @@ LPWSTR WINAPI StrNCatW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax) return NULL; } - StrCpyNW(lpszStr + strlenW(lpszStr), lpszCat, cchMax); + StrCpyNW(lpszStr + lstrlenW(lpszStr), lpszCat, cchMax); return lpszRet; } @@ -2048,7 +2042,7 @@ BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim) /************************************************************************* * _SHStrDupAA [INTERNAL] * - * Duplicates a ASCII string to ASCII. The destination buffer is allocated. + * Duplicates a ANSI string to ANSI. The destination buffer is allocated. */ static HRESULT _SHStrDupAA(LPCSTR src, LPSTR * dest) { @@ -2115,7 +2109,7 @@ HRESULT WINAPI SHStrDupA(LPCSTR lpszStr, LPWSTR * lppszDest) /************************************************************************* * _SHStrDupAW [INTERNAL] * - * Duplicates a UNICODE to a ASCII string. The destination buffer is allocated. + * Duplicates a UNICODE to a ANSI string. The destination buffer is allocated. */ static HRESULT _SHStrDupAW(LPCWSTR src, LPSTR * dest) { @@ -2223,7 +2217,7 @@ static int SHLWAPI_WriteTimeClass(LPWSTR lpszOut, DWORD dwValue, iDigits = SHLWAPI_FormatSignificant(szOut + 1, iDigits); *szOut = ' '; LoadStringW(shlwapi_hInstance, uClassStringId, szBuff + 32, 32); - strcatW(lpszOut, szOut); + lstrcatW(lpszOut, szOut); return iDigits; } @@ -2263,12 +2257,12 @@ INT WINAPI StrFromTimeIntervalA(LPSTR lpszStr, UINT cchMax, DWORD dwMS, { INT iRet = 0; - TRACE("(%p,%d,%d,%d)\n", lpszStr, cchMax, dwMS, iDigits); + TRACE("(%p,%d,%ld,%d)\n", lpszStr, cchMax, dwMS, iDigits); if (lpszStr && cchMax) { WCHAR szBuff[128]; - StrFromTimeIntervalW(szBuff, sizeof(szBuff)/sizeof(WCHAR), dwMS, iDigits); + StrFromTimeIntervalW(szBuff, ARRAY_SIZE(szBuff), dwMS, iDigits); WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszStr,cchMax,0,0); } return iRet; @@ -2285,7 +2279,7 @@ INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS, { INT iRet = 0; - TRACE("(%p,%d,%d,%d)\n", lpszStr, cchMax, dwMS, iDigits); + TRACE("(%p,%d,%ld,%d)\n", lpszStr, cchMax, dwMS, iDigits); if (lpszStr && cchMax) { @@ -2317,7 +2311,7 @@ INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS, SHLWAPI_WriteTimeClass(szCopy, dwMS, IDS_TIME_INTERVAL_SECONDS, iDigits); lstrcpynW(lpszStr, szCopy, cchMax); - iRet = strlenW(lpszStr); + iRet = lstrlenW(lpszStr); } return iRet; } @@ -2584,14 +2578,14 @@ LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax) { WCHAR wszBytesFormat[64]; LoadStringW(shlwapi_hInstance, IDS_BYTES_FORMAT, wszBytesFormat, 64); - snprintfW(lpszDest, cchMax, wszBytesFormat, (int)llBytes); + swprintf(lpszDest, cchMax, wszBytesFormat, (int)llBytes); return lpszDest; } /* Note that if this loop completes without finding a match, i will be * pointing at the last entry, which is a catch all for > 1000 PB */ - while (i < sizeof(bfFormats) / sizeof(SHLWAPI_BYTEFORMATS) - 1) + while (i < ARRAY_SIZE(bfFormats) - 1) { if (llBytes < bfFormats[i].dLimit) break; @@ -2633,7 +2627,7 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax) { WCHAR wszBuff[32]; - StrFormatByteSizeW(llBytes, wszBuff, sizeof(wszBuff)/sizeof(WCHAR)); + StrFormatByteSizeW(llBytes, wszBuff, ARRAY_SIZE(wszBuff)); if (lpszDest) WideCharToMultiByte(CP_ACP, 0, wszBuff, -1, lpszDest, cchMax, 0, 0); @@ -2654,12 +2648,12 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax) * lpszDest. * * NOTES - * The Ascii and Unicode versions of this function accept a different + * The ANSI and Unicode versions of this function accept a different * integer type for dwBytes. See StrFormatByteSize64A(). */ LPSTR WINAPI StrFormatByteSizeA(DWORD dwBytes, LPSTR lpszDest, UINT cchMax) { - TRACE("(%d,%p,%d)\n", dwBytes, lpszDest, cchMax); + TRACE("(%ld,%p,%d)\n", dwBytes, lpszDest, cchMax); return StrFormatByteSize64A(dwBytes, lpszDest, cchMax); } @@ -2754,7 +2748,7 @@ WCHAR WINAPI SHStripMneumonicW(LPCWSTR lpszStr) if (*lpszTmp != '&') ch = *lpszTmp; - memmove( lpszIter, lpszTmp, (strlenW(lpszTmp) + 1) * sizeof(WCHAR) ); + memmove( lpszIter, lpszTmp, (lstrlenW(lpszTmp) + 1) * sizeof(WCHAR) ); } } @@ -2764,11 +2758,11 @@ WCHAR WINAPI SHStripMneumonicW(LPCWSTR lpszStr) /************************************************************************* * @ [SHLWAPI.216] * - * Convert an Ascii string to Unicode. + * Convert an ANSI string to Unicode. * * PARAMS * dwCp [I] Code page for the conversion - * lpSrcStr [I] Source Ascii string to convert + * lpSrcStr [I] Source ANSI string to convert * lpDstStr [O] Destination for converted Unicode string * iLen [I] Length of lpDstStr * @@ -2780,17 +2774,17 @@ DWORD WINAPI SHAnsiToUnicodeCP(DWORD dwCp, LPCSTR lpSrcStr, LPWSTR lpDstStr, int DWORD dwRet; dwRet = MultiByteToWideChar(dwCp, 0, lpSrcStr, -1, lpDstStr, iLen); - TRACE("%s->%s,ret=%d\n", debugstr_a(lpSrcStr), debugstr_w(lpDstStr), dwRet); + TRACE("%s->%s,ret=%ld\n", debugstr_a(lpSrcStr), debugstr_w(lpDstStr), dwRet); return dwRet; } /************************************************************************* * @ [SHLWAPI.215] * - * Convert an Ascii string to Unicode. + * Convert an ANSI string to Unicode. * * PARAMS - * lpSrcStr [I] Source Ascii string to convert + * lpSrcStr [I] Source ANSI string to convert * lpDstStr [O] Destination for converted Unicode string * iLen [I] Length of lpDstStr * @@ -2808,12 +2802,12 @@ DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen) /************************************************************************* * @ [SHLWAPI.218] * - * Convert a Unicode string to Ascii. + * Convert a Unicode string to ANSI. * * PARAMS * CodePage [I] Code page to use for the conversion * lpSrcStr [I] Source Unicode string to convert - * lpDstStr [O] Destination for converted Ascii string + * lpDstStr [O] Destination for converted ANSI string * dstlen [I] Length of buffer at lpDstStr * * RETURNS @@ -2839,7 +2833,7 @@ DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, *lpDstStr = '\0'; - len = strlenW(lpSrcStr) + 1; + len = lstrlenW(lpSrcStr) + 1; switch (CodePage) { @@ -2911,11 +2905,11 @@ DWORD WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr, /************************************************************************* * @ [SHLWAPI.217] * - * Convert a Unicode string to Ascii. + * Convert a Unicode string to ANSI. * * PARAMS * lpSrcStr [I] Source Unicode string to convert - * lpDstStr [O] Destination for converted Ascii string + * lpDstStr [O] Destination for converted ANSI string * iLen [O] Length of lpDstStr in characters * * RETURNS @@ -2971,15 +2965,15 @@ DWORD WINAPI SHUnicodeToUnicode(LPCWSTR lpszSrc, LPWSTR lpszDst, int iLen) /************************************************************************* * @ [SHLWAPI.364] * - * Determine if an Ascii string converts to Unicode and back identically. + * Determine if an ANSI string converts to Unicode and back identically. * * PARAMS * lpSrcStr [I] Source Unicode string to convert - * lpDst [O] Destination for resulting Ascii string + * lpDst [O] Destination for resulting ANSI string * iLen [I] Length of lpDst in characters * * RETURNS - * TRUE, since Ascii strings always convert identically. + * TRUE, since ANSI strings always convert identically. */ BOOL WINAPI DoesStringRoundTripA(LPCSTR lpSrcStr, LPSTR lpDst, INT iLen) { @@ -2990,15 +2984,15 @@ BOOL WINAPI DoesStringRoundTripA(LPCSTR lpSrcStr, LPSTR lpDst, INT iLen) /************************************************************************* * @ [SHLWAPI.365] * - * Determine if a Unicode string converts to Ascii and back identically. + * Determine if a Unicode string converts to ANSI and back identically. * * PARAMS * lpSrcStr [I] Source Unicode string to convert - * lpDst [O] Destination for resulting Ascii string + * lpDst [O] Destination for resulting ANSI string * iLen [I] Length of lpDst in characters * * RETURNS - * TRUE, if lpSrcStr converts to Ascii and back identically, + * TRUE, if lpSrcStr converts to ANSI and back identically, * FALSE otherwise. */ BOOL WINAPI DoesStringRoundTripW(LPCWSTR lpSrcStr, LPSTR lpDst, INT iLen) @@ -3007,7 +3001,7 @@ BOOL WINAPI DoesStringRoundTripW(LPCWSTR lpSrcStr, LPSTR lpDst, INT iLen) SHUnicodeToAnsi(lpSrcStr, lpDst, iLen); SHAnsiToUnicode(lpDst, szBuff, MAX_PATH); - return !strcmpW(lpSrcStr, szBuff); + return !wcscmp(lpSrcStr, szBuff); } /************************************************************************* diff --git a/dll/win32/shlwapi/thread.c b/dll/win32/shlwapi/thread.c index eb2c35d6dcc..0fe8ff2cae1 100644 --- a/dll/win32/shlwapi/thread.c +++ b/dll/win32/shlwapi/thread.c @@ -68,7 +68,7 @@ LPSECURITY_ATTRIBUTES WINAPI CreateAllAccessSecurityAttributes( /* This function is used within SHLWAPI only to create security attributes * for shell semaphores. */ - TRACE("(%p,%p,%08x)\n", lpAttr, lpSec, p3); + TRACE("(%p,%p,%08lx)\n", lpAttr, lpSec, p3); if (!(GetVersion() & 0x80000000)) /* NT */ { @@ -491,17 +491,16 @@ HANDLE WINAPI SHGlobalCounterCreateNamedW(LPCWSTR lpszName, DWORD iInitial) static const WCHAR szPrefix[] = { 's', 'h', 'e', 'l', 'l', '.', '\0' }; const int iPrefixLen = 6; WCHAR szBuff[MAX_PATH]; - const int iBuffLen = sizeof(szBuff)/sizeof(WCHAR); SECURITY_DESCRIPTOR sd; SECURITY_ATTRIBUTES sAttr, *pSecAttr; HANDLE hRet; - TRACE("(%s,%d)\n", debugstr_w(lpszName), iInitial); + TRACE("(%s,%ld)\n", debugstr_w(lpszName), iInitial); /* Create Semaphore name */ memcpy(szBuff, szPrefix, (iPrefixLen + 1) * sizeof(WCHAR)); if (lpszName) - StrCpyNW(szBuff + iPrefixLen, lpszName, iBuffLen - iPrefixLen); + StrCpyNW(szBuff + iPrefixLen, lpszName, ARRAY_SIZE(szBuff) - iPrefixLen); /* Initialise security attributes */ pSecAttr = CreateAllAccessSecurityAttributes(&sAttr, &sd, 0); @@ -527,7 +526,7 @@ HANDLE WINAPI SHGlobalCounterCreateNamedA(LPCSTR lpszName, DWORD iInitial) { WCHAR szBuff[MAX_PATH]; - TRACE("(%s,%d)\n", debugstr_a(lpszName), iInitial); + TRACE("(%s,%ld)\n", debugstr_a(lpszName), iInitial); if (lpszName) MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szBuff, MAX_PATH); diff --git a/dll/win32/shlwapi/url.c b/dll/win32/shlwapi/url.c index f5df0b2970c..fae290ca4ac 100644 --- a/dll/win32/shlwapi/url.c +++ b/dll/win32/shlwapi/url.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" #include #include #include @@ -2560,13 +2558,13 @@ HRESULT WINAPI MLBuildResURLA(LPCSTR lpszLibName, HMODULE hMod, DWORD dwFlags, HRESULT hRet; if (lpszLibName) - MultiByteToWideChar(CP_ACP, 0, lpszLibName, -1, szLibName, sizeof(szLibName)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpszLibName, -1, szLibName, ARRAY_SIZE(szLibName)); if (lpszRes) - MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, szRes, sizeof(szRes)/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, szRes, ARRAY_SIZE(szRes)); - if (dwDestLen > sizeof(szLibName)/sizeof(WCHAR)) - dwDestLen = sizeof(szLibName)/sizeof(WCHAR); + if (dwDestLen > ARRAY_SIZE(szLibName)) + dwDestLen = ARRAY_SIZE(szLibName); hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags, lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen); @@ -2585,10 +2583,10 @@ HRESULT WINAPI MLBuildResURLW(LPCWSTR lpszLibName, HMODULE hMod, DWORD dwFlags, LPCWSTR lpszRes, LPWSTR lpszDest, DWORD dwDestLen) { static const WCHAR szRes[] = { 'r','e','s',':','/','/','\0' }; -#define szResLen ((sizeof(szRes) - sizeof(WCHAR))/sizeof(WCHAR)) + static const unsigned int szResLen = ARRAY_SIZE(szRes) - 1; HRESULT hRet = E_FAIL; - TRACE("(%s,%p,0x%08x,%s,%p,%d)\n", debugstr_w(lpszLibName), hMod, dwFlags, + TRACE("(%s,%p,0x%08lx,%s,%p,%ld)\n", debugstr_w(lpszLibName), hMod, dwFlags, debugstr_w(lpszRes), lpszDest, dwDestLen); if (!lpszLibName || !hMod || hMod == INVALID_HANDLE_VALUE || !lpszRes || @@ -2607,10 +2605,10 @@ HRESULT WINAPI MLBuildResURLW(LPCWSTR lpszLibName, HMODULE hMod, DWORD dwFlags, WCHAR szBuff[MAX_PATH]; DWORD len; - len = GetModuleFileNameW(hMod, szBuff, sizeof(szBuff)/sizeof(WCHAR)); - if (len && len < sizeof(szBuff)/sizeof(WCHAR)) + len = GetModuleFileNameW(hMod, szBuff, ARRAY_SIZE(szBuff)); + if (len && len < ARRAY_SIZE(szBuff)) { - DWORD dwPathLen = strlenW(szBuff) + 1; + DWORD dwPathLen = lstrlenW(szBuff) + 1; if (dwDestLen >= dwPathLen) { @@ -2619,7 +2617,7 @@ HRESULT WINAPI MLBuildResURLW(LPCWSTR lpszLibName, HMODULE hMod, DWORD dwFlags, dwDestLen -= dwPathLen; memcpy(lpszDest + szResLen, szBuff, dwPathLen * sizeof(WCHAR)); - dwResLen = strlenW(lpszRes) + 1; + dwResLen = lstrlenW(lpszRes) + 1; if (dwDestLen >= dwResLen + 1) { lpszDest[szResLen + dwPathLen-1] = '/';