Sync to Wine-20040309:

Francois Gouget <fgouget@free.fr>
- Assorted spelling and case fixes.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Add SHMenuIndexFromID and SHCoCreateInstanceAC.
Patrik Stridvall <ps@leissner.se>
- Fixed some issues found by winapi_check.
Jon Griffiths <jon_p_griffiths@yahoo.com>
- Stub the stopwatch API.
- Implement DoesStringRoundTripW,@371-3,@392.
- Move a couple of string functions into string.c
Robert Shearman <R.J.Shearman@warwick.ac.uk>
- Add IntlStrEqWorkerA/W.
- StrCmp tests.
- Implement string functions in comctl32.
- Use CompareString in shlwapi wherever possible instead of ugly
  helpers.
Kevin Koltzau <kevin@plop.org>
- Fix UrlCanonicalize and add regression test.
- Prevent crash with invalid args in a few URL functions.

svn path=/trunk/; revision=8655
This commit is contained in:
Gé van Geldorp 2004-03-11 22:30:40 +00:00
parent 778b9378b6
commit 162e4ee1f5
8 changed files with 610 additions and 311 deletions

View file

@ -17,6 +17,7 @@ C_SRCS = \
reg.c \ reg.c \
regstream.c \ regstream.c \
shlwapi_main.c \ shlwapi_main.c \
stopwatch.c \
string.c \ string.c \
thread.c \ thread.c \
url.c \ url.c \

View file

@ -418,7 +418,7 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc
* Determine if a file association is dangerous (potentially malware). * Determine if a file association is dangerous (potentially malware).
* *
* PARAMS * PARAMS
* lpszAssoc [I] Name of file or file extention to check. * lpszAssoc [I] Name of file or file extension to check.
* *
* RETURNS * RETURNS
* TRUE, if lpszAssoc may potentially be malware (executable), * TRUE, if lpszAssoc may potentially be malware (executable),

View file

@ -34,7 +34,6 @@
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#include "winnls.h" #include "winnls.h"
#include "ddeml.h"
#include "docobj.h" #include "docobj.h"
#include "exdisp.h" #include "exdisp.h"
#include "shlguid.h" #include "shlguid.h"
@ -70,7 +69,6 @@ extern HMODULE SHLWAPI_hwinmm;
extern HMODULE SHLWAPI_hcomdlg32; extern HMODULE SHLWAPI_hcomdlg32;
extern HMODULE SHLWAPI_hcomctl32; extern HMODULE SHLWAPI_hcomctl32;
extern HMODULE SHLWAPI_hmpr; extern HMODULE SHLWAPI_hmpr;
extern HMODULE SHLWAPI_hmlang;
extern HMODULE SHLWAPI_hurlmon; extern HMODULE SHLWAPI_hurlmon;
extern HMODULE SHLWAPI_hversion; extern HMODULE SHLWAPI_hversion;
@ -86,8 +84,6 @@ static DWORD id2[4] = {0x79eac9ee, 0x11cebaf9, 0xaa00828c, 0x0ba94b00};
/* Function pointers for GET_FUNC macro; these need to be global because of gcc bug */ /* Function pointers for GET_FUNC macro; these need to be global because of gcc bug */
typedef LPITEMIDLIST (WINAPI *fnpSHBrowseForFolderW)(LPBROWSEINFOW); typedef LPITEMIDLIST (WINAPI *fnpSHBrowseForFolderW)(LPBROWSEINFOW);
static fnpSHBrowseForFolderW pSHBrowseForFolderW; static fnpSHBrowseForFolderW pSHBrowseForFolderW;
typedef HRESULT (WINAPI *fnpConvertINetUnicodeToMultiByte)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
static fnpConvertINetUnicodeToMultiByte pConvertINetUnicodeToMultiByte;
typedef BOOL (WINAPI *fnpPlaySoundW)(LPCWSTR, HMODULE, DWORD); typedef BOOL (WINAPI *fnpPlaySoundW)(LPCWSTR, HMODULE, DWORD);
static fnpPlaySoundW pPlaySoundW; static fnpPlaySoundW pPlaySoundW;
typedef DWORD (WINAPI *fnpSHGetFileInfoW)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT); typedef DWORD (WINAPI *fnpSHGetFileInfoW)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT);
@ -585,7 +581,7 @@ HRESULT WINAPI GetAcceptLanguagesA(
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.15] * @ [SHLWAPI.15]
* *
* Unicode version of SHLWAPI_14. * Unicode version of GetAcceptLanguagesA.
*/ */
HRESULT WINAPI GetAcceptLanguagesW( HRESULT WINAPI GetAcceptLanguagesW(
LPWSTR langbuf, LPWSTR langbuf,
@ -670,7 +666,7 @@ INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax)
{ {
char xguid[40]; char xguid[40];
INT iLen = SHStringFromGUIDA(guid, xguid, cchMax); INT iLen = SHStringFromGUIDA(guid, xguid, cchMax);
if (iLen) if (iLen)
MultiByteToWideChar(CP_ACP, 0, xguid, -1, lpszDest, cchMax); MultiByteToWideChar(CP_ACP, 0, xguid, -1, lpszDest, cchMax);
return iLen; return iLen;
@ -1168,38 +1164,6 @@ BOOL WINAPI SHAboutInfoW(LPWSTR lpszDest, DWORD dwDestLen)
return TRUE; return TRUE;
} }
/*************************************************************************
* @ [SHLWAPI.162]
*
* Remove a hanging lead byte from the end of a string, if present.
*
* PARAMS
* lpStr [I] String to check for a hanging lead byte
* size [I] Length of lpStr
*
* RETURNS
* Success: The new length of the string. Any hanging lead bytes are removed.
* Failure: 0, if any parameters are invalid.
*/
DWORD WINAPI SHTruncateString(LPSTR lpStr, DWORD size)
{
if (lpStr && size)
{
LPSTR lastByte = lpStr + size - 1;
while(lpStr < lastByte)
lpStr += IsDBCSLeadByte(*lpStr) ? 2 : 1;
if(lpStr == lastByte && IsDBCSLeadByte(*lpStr))
{
*lpStr = '\0';
size--;
}
return size;
}
return 0;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.163] * @ [SHLWAPI.163]
* *
@ -2176,148 +2140,6 @@ DWORD WINAPI FDSA_DeleteItem(
return 1; return 1;
} }
/*************************************************************************
* @ [SHLWAPI.215]
*
* NOTES
* check me!
*/
DWORD WINAPI SHAnsiToUnicode(
LPCSTR lpStrSrc,
LPWSTR lpwStrDest,
int len)
{
INT len_a, ret;
len_a = lstrlenA(lpStrSrc);
ret = MultiByteToWideChar(0, 0, lpStrSrc, len_a, lpwStrDest, len);
TRACE("%s %s %d, ret=%d\n",
debugstr_a(lpStrSrc), debugstr_w(lpwStrDest), len, ret);
return ret;
}
/*************************************************************************
* @ [SHLWAPI.218]
*
* WideCharToMultiByte with support for multiple codepages.
*
* PARAMS
* CodePage [I] Code page to use for the conversion
* lpSrcStr [I] Source Unicode string to convert
* lpDstStr [O] Destination for converted Ascii string
* lpnMultiCharCount [O] Input length of lpDstStr/destination for length of lpDstStr
*
* RETURNS
* Success: The number of characters that result from the conversion.
* Failure: 0.
*/
INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
LPINT lpnMultiCharCount)
{
WCHAR emptyW[] = { '\0' };
int len , reqLen;
LPSTR mem;
if (!lpDstStr || !lpnMultiCharCount)
return 0;
if (!lpSrcStr)
lpSrcStr = emptyW;
*lpDstStr = '\0';
len = strlenW(lpSrcStr) + 1;
switch (CodePage)
{
case CP_WINUNICODE:
CodePage = CP_UTF8; /* Fall through... */
case 0x0000C350: /* FIXME: CP_ #define */
case CP_UTF7:
case CP_UTF8:
{
DWORD dwMode = 0;
INT nWideCharCount = len - 1;
GET_FUNC(pConvertINetUnicodeToMultiByte, mlang, "ConvertINetUnicodeToMultiByte", 0);
if (!pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
lpnMultiCharCount))
return 0;
if (nWideCharCount < len - 1)
{
mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, *lpnMultiCharCount);
if (!mem)
return 0;
*lpnMultiCharCount = 0;
if (pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpnMultiCharCount))
{
SHTruncateString(mem, *lpnMultiCharCount);
lstrcpynA(lpDstStr, mem, *lpnMultiCharCount + 1);
return *lpnMultiCharCount + 1;
}
HeapFree(GetProcessHeap(), 0, mem);
return *lpnMultiCharCount;
}
lpDstStr[*lpnMultiCharCount] = '\0';
return *lpnMultiCharCount;
}
break;
default:
break;
}
reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, lpDstStr,
*lpnMultiCharCount, NULL, NULL);
if (!reqLen && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, NULL, 0, NULL, NULL);
if (reqLen)
{
mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, reqLen);
if (mem)
{
reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, mem,
reqLen, NULL, NULL);
reqLen = SHTruncateString(mem, *lpnMultiCharCount);
reqLen++;
lstrcpynA(lpDstStr, mem, *lpnMultiCharCount);
HeapFree(GetProcessHeap(), 0, mem);
}
}
}
return reqLen;
}
/*************************************************************************
* @ [SHLWAPI.217]
*
* WideCharToMultiByte with support for multiple codepages.
*
* PARAMS
* lpSrcStr [I] Source Unicode string to convert
* lpDstStr [O] Destination for converted Ascii string
* lpnMultiCharCount [O] Input length of lpDstStr/destination for length of lpDstStr
*
* RETURNS
* See SHUnicodeToAnsiCP
* NOTES
* This function simply calls SHUnicodeToAnsiCP with CodePage = CP_ACP.
*/
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT MultiCharCount)
{
INT myint = MultiCharCount;
return SHUnicodeToAnsiCP(CP_ACP, lpSrcStr, lpDstStr, &myint);
}
typedef struct { typedef struct {
REFIID refid; REFIID refid;
DWORD indx; DWORD indx;
@ -2514,16 +2336,6 @@ LRESULT CALLBACK SHDefWindowProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM
return DefWindowProcA(hWnd, uMessage, wParam, lParam); return DefWindowProcA(hWnd, uMessage, wParam, lParam);
} }
/*************************************************************************
* @ [SHLWAPI.241]
*
*/
DWORD WINAPI StopWatchMode()
{
FIXME("()stub\n");
return /* 0xabba1243 */ 0;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.257] * @ [SHLWAPI.257]
* *
@ -3357,25 +3169,6 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST
return hRet; return hRet;
} }
/*************************************************************************
* @ [SHLWAPI.364]
*
* Copy one string to another, up to a given length.
*
* PARAMS
* lpszSrc [I] Source string to copy
* lpszDst [O] Destination for copied string
* iLen [I] Number of characters to copy
*
* RETURNS
* TRUE.
*/
DWORD WINAPI DoesStringRoundTripA(LPCSTR lpszSrc, LPSTR lpszDst, INT iLen)
{
lstrcpynA(lpszDst, lpszSrc, iLen);
return TRUE;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.370] * @ [SHLWAPI.370]
* *
@ -3998,6 +3791,25 @@ INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
return -1; return -1;
} }
/*************************************************************************
* @ [SHLWAPI.179]
*
* Same as SHLWAPI.GetMenuPosFromID
*/
DWORD WINAPI SHMenuIndexFromID(HMENU hMenu, UINT uID)
{
return GetMenuPosFromID(hMenu, uID);
}
/*************************************************************************
* @ [SHLWAPI.549]
*/
HRESULT WINAPI SHCoCreateInstanceAC(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
DWORD dwClsContext, REFIID iid, LPVOID *ppv)
{
return CoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
}
/************************************************************************* /*************************************************************************
* SHSkipJunction [SHLWAPI.@] * SHSkipJunction [SHLWAPI.@]
* *
@ -4036,18 +3848,27 @@ BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
return bRet; return bRet;
} }
/***********************************************************************
* SHGetShellKey (SHLWAPI.@)
*/
DWORD WINAPI SHGetShellKey(DWORD a, DWORD b, DWORD c) DWORD WINAPI SHGetShellKey(DWORD a, DWORD b, DWORD c)
{ {
FIXME("(%lx, %lx, %lx): stub\n", a, b, c); FIXME("(%lx, %lx, %lx): stub\n", a, b, c);
return 0x50; return 0x50;
} }
/***********************************************************************
* SHQueueUserWorkItem (SHLWAPI.@)
*/
HRESULT WINAPI SHQueueUserWorkItem(DWORD a, DWORD b, DWORD c, DWORD d, DWORD e, DWORD f, DWORD g) HRESULT WINAPI SHQueueUserWorkItem(DWORD a, DWORD b, DWORD c, DWORD d, DWORD e, DWORD f, DWORD g)
{ {
FIXME("(%lx, %lx, %lx, %lx, %lx, %lx, %lx): stub\n", a, b, c, d, e, f, g); FIXME("(%lx, %lx, %lx, %lx, %lx, %lx, %lx): stub\n", a, b, c, d, e, f, g);
return E_FAIL; return E_FAIL;
} }
/***********************************************************************
* IUnknown_OnFocusChangeIS (SHLWAPI.@)
*/
DWORD WINAPI IUnknown_OnFocusChangeIS(IUnknown * pUnk, IUnknown * pFocusObject, BOOL bChange) DWORD WINAPI IUnknown_OnFocusChangeIS(IUnknown * pUnk, IUnknown * pFocusObject, BOOL bChange)
{ {
FIXME("(%p, %p, %s)\n", pUnk, pFocusObject, bChange ? "TRUE" : "FALSE"); FIXME("(%p, %p, %s)\n", pUnk, pFocusObject, bChange ? "TRUE" : "FALSE");
@ -4061,6 +3882,9 @@ DWORD WINAPI IUnknown_OnFocusChangeIS(IUnknown * pUnk, IUnknown * pFocusObject,
return 0; return 0;
} }
/***********************************************************************
* SHGetValueW (SHLWAPI.@)
*/
HRESULT WINAPI SKGetValueW(DWORD a, LPWSTR b, LPWSTR c, DWORD d, DWORD e, DWORD f) HRESULT WINAPI SKGetValueW(DWORD a, LPWSTR b, LPWSTR c, DWORD d, DWORD e, DWORD f)
{ {
FIXME("(%lx, %s, %s, %lx, %lx, %lx): stub\n", a, debugstr_w(b), debugstr_w(c), d, e, f); FIXME("(%lx, %s, %s, %lx, %lx, %lx): stub\n", a, debugstr_w(b), debugstr_w(c), d, e, f);

View file

@ -176,7 +176,7 @@
176 stdcall -noname IUnknown_QueryService(ptr ptr ptr ptr) 176 stdcall -noname IUnknown_QueryService(ptr ptr ptr ptr)
177 stdcall -noname SHLoadMenuPopup(ptr wstr) 177 stdcall -noname SHLoadMenuPopup(ptr wstr)
178 stdcall -noname SHPropagateMessage(ptr long long long long) 178 stdcall -noname SHPropagateMessage(ptr long long long long)
179 stub -noname SHMenuIndexFromID 179 stdcall -noname SHMenuIndexFromID(long long)
180 stdcall -noname SHRemoveAllSubMenus(long) 180 stdcall -noname SHRemoveAllSubMenus(long)
181 stdcall -noname SHEnableMenuItem(long long long) 181 stdcall -noname SHEnableMenuItem(long long long)
182 stdcall -noname SHCheckMenuItem(long long long) 182 stdcall -noname SHCheckMenuItem(long long long)
@ -239,17 +239,17 @@
239 stdcall -noname SHUnregisterClassesW(ptr ptr long) 239 stdcall -noname SHUnregisterClassesW(ptr ptr long)
240 stdcall -noname SHDefWindowProc(long long long long) 240 stdcall -noname SHDefWindowProc(long long long long)
241 stdcall -noname StopWatchMode() 241 stdcall -noname StopWatchMode()
242 stub -noname StopWatchFlush 242 stdcall -noname StopWatchFlush()
243 stub -noname StopWatchA 243 stdcall -noname StopWatchA(long str long long long)
244 stub -noname StopWatchW 244 stdcall -noname StopWatchW(long wstr long long long)
245 stub -noname StopWatch_TimerHandler 245 stdcall -noname StopWatch_TimerHandler(ptr ptr long ptr)
246 stub -noname StopWatch_CheckMsg 246 stub -noname StopWatch_CheckMsg
247 stub -noname StopWatch_MarkFrameStart 247 stdcall -noname StopWatch_MarkFrameStart(str)
248 stub -noname StopWatch_MarkSameFramStart 248 stub -noname StopWatch_MarkSameFrameStart
249 stub -noname StopWatch_MarkJavaStop 249 stdcall -noname StopWatch_MarkJavaStop(wstr ptr long)
250 stub -noname GetPerfTime 250 stdcall -noname GetPerfTime()
251 stub -noname StopWatch_DispatchTime 251 stub -noname StopWatch_DispatchTime
252 stub -noname StopWatch_SetMsgLastLocation 252 stdcall -noname StopWatch_SetMsgLastLocation(long)
253 stub -noname StopWatchExA 253 stub -noname StopWatchExA
254 stub -noname StopWatchExW 254 stub -noname StopWatchExW
255 stub -noname EventTraceHandler 255 stub -noname EventTraceHandler
@ -361,16 +361,16 @@
361 stdcall @(wstr ptr long) kernel32.GetShortPathNameW 361 stdcall @(wstr ptr long) kernel32.GetShortPathNameW
362 stdcall @(ptr ptr) advapi32.GetUserNameW 362 stdcall @(ptr ptr) advapi32.GetUserNameW
363 stdcall -noname SHInvokeCommand(ptr ptr ptr long) 363 stdcall -noname SHInvokeCommand(ptr ptr ptr long)
364 stdcall -noname DoesStringRoundTripA(str str long) 364 stdcall -noname DoesStringRoundTripA(str ptr long)
365 stub -noname DoesStringRoundTripW 365 stdcall -noname DoesStringRoundTripW(wstr ptr long)
366 stdcall @(long long ptr ptr ptr ptr ptr ptr) advapi32.RegEnumValueW 366 stdcall @(long long ptr ptr ptr ptr ptr ptr) advapi32.RegEnumValueW
367 stdcall @(wstr wstr ptr long wstr) kernel32.WritePrivateProfileStructW 367 stdcall @(wstr wstr ptr long wstr) kernel32.WritePrivateProfileStructW
368 stdcall @(wstr wstr ptr long wstr) kernel32.GetPrivateProfileStructW 368 stdcall @(wstr wstr ptr long wstr) kernel32.GetPrivateProfileStructW
369 stdcall @(wstr wstr ptr ptr long long ptr wstr ptr ptr) kernel32.CreateProcessW 369 stdcall @(wstr wstr ptr ptr long long ptr wstr ptr ptr) kernel32.CreateProcessW
370 stdcall -noname ExtractIconWrapW(long wstr long) 370 stdcall -noname ExtractIconWrapW(long wstr long)
371 stub -noname DdeInitializeWrapW 371 stdcall DdeInitializeWrapW(ptr ptr long long) user32.DdeInitializeW
372 stub -noname DdeCreateStringHandleWrapW 372 stdcall DdeCreateStringHandleWrapW(long ptr long) user32.DdeCreateStringHandleW
373 stub -noname DdeQueryStringWrapW 373 stdcall DdeQueryStringWrapW(long ptr wstr long long) user32.DdeQueryStringW
374 stub -noname SHCheckDiskForMediaA 374 stub -noname SHCheckDiskForMediaA
375 stub -noname SHCheckDiskForMediaW 375 stub -noname SHCheckDiskForMediaW
376 stdcall -noname MLGetUILanguage() # kernel32.GetUserDefaultUILanguage 376 stdcall -noname MLGetUILanguage() # kernel32.GetUserDefaultUILanguage
@ -389,7 +389,7 @@
389 stdcall -noname GetSaveFileNameWrapW(ptr) 389 stdcall -noname GetSaveFileNameWrapW(ptr)
390 stdcall -noname WNetRestoreConnectionWrapW(long wstr) 390 stdcall -noname WNetRestoreConnectionWrapW(long wstr)
391 stdcall -noname WNetGetLastErrorWrapW(ptr ptr long ptr long) 391 stdcall -noname WNetGetLastErrorWrapW(ptr ptr long ptr long)
392 stub -noname EndDialogWrap 392 stdcall EndDialogWrap(ptr ptr) user32.EndDialog
393 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamW 393 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamW
394 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamA 394 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamA
395 stub -noname MLWinHelpA 395 stub -noname MLWinHelpA
@ -542,7 +542,7 @@
546 stub -noname IUnknown_DoContextMenuPopup 546 stub -noname IUnknown_DoContextMenuPopup
548 stub -noname SHAreIconsEqual 548 stub -noname SHAreIconsEqual
549 stub -noname SHCoCreateInstanceAC 549 stdcall -noname SHCoCreateInstanceAC(ptr ptr long ptr ptr)
550 stub -noname GetTemplateInfoFroHandle 550 stub -noname GetTemplateInfoFroHandle
551 stub -noname IShellFolder_CompareIDs 551 stub -noname IShellFolder_CompareIDs
@ -561,8 +561,8 @@
@ stdcall DllGetVersion (ptr) SHLWAPI_DllGetVersion @ stdcall DllGetVersion (ptr) SHLWAPI_DllGetVersion
@ stdcall GetMenuPosFromID(ptr long) @ stdcall GetMenuPosFromID(ptr long)
@ stdcall HashData (ptr long ptr long) @ stdcall HashData (ptr long ptr long)
@ stub IntlStrEqWorkerA @ stdcall IntlStrEqWorkerA(long str str long) StrIsIntlEqualA
@ stub IntlStrEqWorkerW @ stdcall IntlStrEqWorkerW(long wstr wstr long) StrIsIntlEqualW
@ stdcall PathAddBackslashA (str) @ stdcall PathAddBackslashA (str)
@ stdcall PathAddBackslashW (wstr) @ stdcall PathAddBackslashW (wstr)
@ stdcall PathAddExtensionA (str str) @ stdcall PathAddExtensionA (str str)

View file

@ -0,0 +1,228 @@
/*
* Stopwatch Functions
*
* Copyright 2004 Jon Griffiths
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* NOTES
* These functions probably never need to be implemented unless we
* A) Rewrite explorer from scratch, and
* B) Want to use a substandard API to tune its performance.
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "wine/unicode.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#define NO_SHLWAPI_STREAM
#include "shlwapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/*************************************************************************
* @ [SHLWAPI.241]
*
* Get the current performance monitoring mode.
*
* PARAMS
* None.
*
* RETURNS
* The current performance monitoring mode. This is zero if monitoring
* is disabled (the default).
*
* NOTES
* If this function returns 0, no further StopWatch functions should be called.
*/
DWORD WINAPI StopWatchMode()
{
FIXME("() stub!\n");
return 0;
}
/*************************************************************************
* @ [SHLWAPI.242]
*
* Write captured performance nodes to a log file.
*
* PARAMS
* None.
*
* RETURNS
* Nothing.
*/
void WINAPI StopWatchFlush()
{
FIXME("() stub!\n");
}
/*************************************************************************
* @ [SHLWAPI.243]
*
* Write a performance event to a log file
*
* PARAMS
* dwClass [I] Class of event
* lpszStr [I] Text of event to log
* dwUnknown [I] Unknown
* dwMode [I] Mode flags
* dwTimeStamp [I] Timestamp
*
* RETURNS
* Success: ERROR_SUCCESS.
* Failure: A standard Win32 error code indicating the failure.
*/
DWORD WINAPI StopWatchA(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
DWORD dwMode, DWORD dwTimeStamp)
{
FIXME("(%ld,%s,%ld,%ld,%ld) stub!\n", dwClass, debugstr_a(lpszStr),
dwUnknown, dwMode, dwTimeStamp);
return ERROR_SUCCESS;
}
/*************************************************************************
* @ [SHLWAPI.244]
*
* See StopWatchA.
*/
DWORD WINAPI StopWatchW(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
DWORD dwMode, DWORD dwTimeStamp)
{
char szBuff[MAX_PATH];
if(!WideCharToMultiByte(0, 0, lpszStr, -1, szBuff, MAX_PATH, 0, 0))
return ERROR_NOT_ENOUGH_MEMORY;
return StopWatchA(dwClass, szBuff, dwUnknown, dwMode, dwTimeStamp);
}
/*************************************************************************
* @ [SHLWAPI.245]
*
* Log a shell frame event.
*
* PARAMS
* hWnd [I] Window having the event
* pvUnknown1 [I] Unknown
* bUnknown2 [I] Unknown
* pClassWnd [I] Window of class to log
*
* RETURNS
* Nothing.
*/
void WINAPI StopWatch_TimerHandler(HWND hWnd, PVOID pvUnknown1, BOOL bUnknown2, HWND *pClassWnd)
{
FIXME("(%p,%p,%d,%p) stub!\n", hWnd, pvUnknown1, bUnknown2 ,pClassWnd);
}
/* FIXME: Parameters for @246:StopWatch_CheckMsg unknown */
/*************************************************************************
* @ [SHLWAPI.247]
*
* Log the start of an applet.
*
* PARAMS
* lpszName [I] Name of the applet
*
* RETURNS
* Nothing.
*/
void WINAPI StopWatch_MarkFrameStart(LPCSTR lpszName)
{
FIXME("(%s) stub!\n", debugstr_a(lpszName));
}
/* FIXME: Parameters for @248:StopWatch_MarkSameFrameStart unknown */
/*************************************************************************
* @ [SHLWAPI.249]
*
* Log a java applet stopping.
*
* PARAMS
* lpszEvent [I] Name of the event (applet)
* hWnd [I] Window running the applet
* dwReserved [I] Unused
*
* RETURNS
* Nothing.
*/
void WINAPI StopWatch_MarkJavaStop(LPCWSTR lpszEvent, HWND hWnd, DWORD dwReserved)
{
FIXME("(%s,%p,0x%08lx) stub!\n", debugstr_w(lpszEvent), hWnd, dwReserved);
}
/*************************************************************************
* @ [SHLWAPI.250]
*
* Read the performance counter.
*
* PARAMS
* None.
*
* RETURNS
* The low 32 bits of the current performance counter reading.
*/
DWORD WINAPI GetPerfTime()
{
static LONG64 iCounterFreq = 0;
LARGE_INTEGER iCounter;
TRACE("()\n");
if (!iCounterFreq)
QueryPerformanceFrequency((LARGE_INTEGER*)&iCounterFreq);
QueryPerformanceCounter(&iCounter);
iCounter.QuadPart = iCounter.QuadPart * 1000 / iCounterFreq;
return iCounter.u.LowPart;
}
/* FIXME: Parameters for @251:StopWatch_DispatchTime unknown */
/*************************************************************************
* @ [SHLWAPI.252]
*
* Set an as yet unidentified performance value.
*
* PARAMS
* dwUnknown [I] Value to set
*
* RETURNS
* dwUnknown.
*/
DWORD WINAPI StopWatch_SetMsgLastLocation(DWORD dwUnknown)
{
FIXME("(%ld) stub!\n", dwUnknown);
return dwUnknown;
}
/* FIXME: Parameters for @253:StopWatchExA, 254:StopWatchExW unknown */

View file

@ -38,11 +38,27 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "shlobj.h" #include "shlobj.h"
#include "ddeml.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
/* Get a function pointer from a DLL handle */
#define GET_FUNC(func, module, name, fail) \
do { \
if (!func) { \
if (!SHLWAPI_h##module && !(SHLWAPI_h##module = LoadLibraryA(#module ".dll"))) return fail; \
func = (fn##func)GetProcAddress(SHLWAPI_h##module, name); \
if (!func) return fail; \
} \
} while (0)
extern HMODULE SHLWAPI_hmlang;
typedef HRESULT (WINAPI *fnpConvertINetUnicodeToMultiByte)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
static fnpConvertINetUnicodeToMultiByte pConvertINetUnicodeToMultiByte;
static HRESULT WINAPI _SHStrDupAA(LPCSTR,LPSTR*); static HRESULT WINAPI _SHStrDupAA(LPCSTR,LPSTR*);
static HRESULT WINAPI _SHStrDupAW(LPCWSTR,LPSTR*); static HRESULT WINAPI _SHStrDupAW(LPCWSTR,LPSTR*);
@ -264,51 +280,12 @@ LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
*/ */
int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp) int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp)
{ {
INT iRet; int iRet;
TRACE("(%s,%s)\n", debugstr_w(lpszStr),debugstr_w(lpszComp)); TRACE("(%s,%s)\n", debugstr_w(lpszStr),debugstr_w(lpszComp));
iRet = strcmpiW(lpszStr, lpszComp); iRet = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, -1, lpszComp, -1);
return iRet < 0 ? -1 : iRet ? 1 : 0; return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
}
/*************************************************************************
* SHLWAPI_StrCmpNHelperA
*
* Internal helper for StrCmpNA/StrCmpNIA.
*/
static INT WINAPI SHLWAPI_StrCmpNHelperA(LPCSTR lpszStr, LPCSTR lpszComp,
INT iLen,
BOOL (WINAPI *pChrCmpFn)(WORD,WORD))
{
if (!lpszStr)
{
if (!lpszComp)
return 0;
return 1;
}
else if (!lpszComp)
return -1;
while (iLen-- > 0)
{
int iDiff;
WORD ch1, ch2;
ch1 = IsDBCSLeadByte(*lpszStr)? *lpszStr << 8 | lpszStr[1] : *lpszStr;
ch2 = IsDBCSLeadByte(*lpszComp)? *lpszComp << 8 | lpszComp[1] : *lpszComp;
if ((iDiff = pChrCmpFn(ch1, ch2)) < 0)
return -1;
else if (iDiff > 0)
return 1;
else if (!*lpszStr && !*lpszComp)
return 0;
lpszStr = CharNextA(lpszStr);
lpszComp = CharNextA(lpszComp);
}
return 0;
} }
/************************************************************************* /*************************************************************************
@ -327,9 +304,12 @@ static INT WINAPI SHLWAPI_StrCmpNHelperA(LPCSTR lpszStr, LPCSTR lpszComp,
*/ */
INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen) INT WINAPI StrCmpNA(LPCSTR lpszStr, LPCSTR lpszComp, INT iLen)
{ {
INT iRet;
TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen); TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
return SHLWAPI_StrCmpNHelperA(lpszStr, lpszComp, iLen, SHLWAPI_ChrCmpA); iRet = CompareStringA(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen);
return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
} }
/************************************************************************* /*************************************************************************
@ -343,8 +323,8 @@ INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen); TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
iRet = strncmpW(lpszStr, lpszComp, iLen); iRet = CompareStringW(GetThreadLocale(), 0, lpszStr, iLen, lpszComp, iLen);
return iRet < 0 ? -1 : iRet ? 1 : 0; return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
} }
/************************************************************************* /*************************************************************************
@ -360,23 +340,15 @@ INT WINAPI StrCmpNW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
* RETURNS * RETURNS
* An integer less than, equal to or greater than 0, indicating that * An integer less than, equal to or greater than 0, indicating that
* lpszStr is less than, the same, or greater than lpszComp. * lpszStr is less than, the same, or greater than lpszComp.
*
* NOTES
* The Win32 version of this function is _completely_ broken for cases
* where iLen is greater than the length of lpszComp. Examples:
*
*| StrCmpNIA("foo.gif", "foo", 5) is -1 under Win32; Should return 1.
*| StrCmpNIA("\", "\\", 3) is 0 under Win32; Should return -1.
*| StrCmpNIA("\", "\..\foo\", 3) is 1 under Win32; Should return -1.
*
* This implementation behaves correctly, since it is unlikely any
* applications actually rely on this function being broken.
*/ */
int WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, int iLen) int WINAPI StrCmpNIA(LPCSTR lpszStr, LPCSTR lpszComp, int iLen)
{ {
INT iRet;
TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen); TRACE("(%s,%s,%i)\n", debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
return SHLWAPI_StrCmpNHelperA(lpszStr, lpszComp, iLen, ChrCmpIA); iRet = CompareStringA(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen);
return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
} }
/************************************************************************* /*************************************************************************
@ -390,8 +362,8 @@ INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, int iLen)
TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen); TRACE("(%s,%s,%i)\n", debugstr_w(lpszStr), debugstr_w(lpszComp), iLen);
iRet = strncmpiW(lpszStr, lpszComp, iLen); iRet = CompareStringW(GetThreadLocale(), NORM_IGNORECASE, lpszStr, iLen, lpszComp, iLen);
return iRet < 0 ? -1 : iRet ? 1 : 0; return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
} }
/************************************************************************* /*************************************************************************
@ -413,8 +385,8 @@ int WINAPI StrCmpW(LPCWSTR lpszStr, LPCWSTR lpszComp)
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp)); TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszComp));
iRet = strcmpW(lpszStr, lpszComp); iRet = CompareStringW(GetThreadLocale(), 0, lpszStr, -1, lpszComp, -1);
return iRet < 0 ? -1 : iRet ? 1 : 0; return iRet == CSTR_LESS_THAN ? -1 : iRet == CSTR_GREATER_THAN ? 1 : 0;
} }
/************************************************************************* /*************************************************************************
@ -671,13 +643,13 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch)
/************************************************************************* /*************************************************************************
* StrToIntA [SHLWAPI.@] * StrToIntA [SHLWAPI.@]
* *
* Read an integer from a string. * Read a signed integer from a string.
* *
* PARAMS * PARAMS
* lpszStr [I] String to read integer from * lpszStr [I] String to read integer from
* *
* RETURNS * RETURNS
* The integer value represented by the string, or 0 if no integer is * The signed integer value represented by the string, or 0 if no integer is
* present. * present.
* *
* NOTES * NOTES
@ -2389,6 +2361,38 @@ LPSTR WINAPI StrFormatByteSizeA(DWORD dwBytes, LPSTR lpszDest, UINT cchMax)
return StrFormatByteSize64A(dwBytes, lpszDest, cchMax); return StrFormatByteSize64A(dwBytes, lpszDest, cchMax);
} }
/*************************************************************************
* @ [SHLWAPI.162]
*
* Remove a hanging lead byte from the end of a string, if present.
*
* PARAMS
* lpStr [I] String to check for a hanging lead byte
* size [I] Length of lpStr
*
* RETURNS
* Success: The new length of the string. Any hanging lead bytes are removed.
* Failure: 0, if any parameters are invalid.
*/
DWORD WINAPI SHTruncateString(LPSTR lpStr, DWORD size)
{
if (lpStr && size)
{
LPSTR lastByte = lpStr + size - 1;
while(lpStr < lastByte)
lpStr += IsDBCSLeadByte(*lpStr) ? 2 : 1;
if(lpStr == lastByte && IsDBCSLeadByte(*lpStr))
{
*lpStr = '\0';
size--;
}
return size;
}
return 0;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.203] * @ [SHLWAPI.203]
* *
@ -2429,3 +2433,189 @@ char WINAPI SHStripMneumonicA(LPCSTR lpszStr)
return ch; return ch;
} }
/*************************************************************************
* @ [SHLWAPI.215]
*
* Convert an Ascii string to Unicode.
*
* PARAMS
* lpSrcStr [I] Source Ascii string to convert
* lpDstStr [O] Destination for converted Unicode string
* iLen [I] Length of lpDstStr
*
* RETURNS
* The return value of the MultiByteToWideChar() function called on lpSrcStr.
*/
DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
{
DWORD dwRet;
dwRet = MultiByteToWideChar(CP_ACP, 0, lpSrcStr, -1, lpDstStr, iLen);
TRACE("%s->%s,ret=%ld\n", debugstr_a(lpSrcStr), debugstr_w(lpDstStr), dwRet);
return dwRet;
}
/*************************************************************************
* @ [SHLWAPI.218]
*
* Convert a Unicode string to Ascii.
*
* PARAMS
* CodePage [I] Code page to use for the conversion
* lpSrcStr [I] Source Unicode string to convert
* lpDstStr [O] Destination for converted Ascii string
* lpiLen [I/O] Input length of lpDstStr/destination for length of lpDstStr
*
* RETURNS
* Success: The number of characters that result from the conversion.
* Failure: 0.
*/
INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
LPINT lpiLen)
{
WCHAR emptyW[] = { '\0' };
int len , reqLen;
LPSTR mem;
if (!lpDstStr || !lpiLen)
return 0;
if (!lpSrcStr)
lpSrcStr = emptyW;
*lpDstStr = '\0';
len = strlenW(lpSrcStr) + 1;
switch (CodePage)
{
case CP_WINUNICODE:
CodePage = CP_UTF8; /* Fall through... */
case 0x0000C350: /* FIXME: CP_ #define */
case CP_UTF7:
case CP_UTF8:
{
DWORD dwMode = 0;
INT nWideCharCount = len - 1;
GET_FUNC(pConvertINetUnicodeToMultiByte, mlang, "ConvertINetUnicodeToMultiByte", 0);
if (!pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
lpiLen))
return 0;
if (nWideCharCount < len - 1)
{
mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, *lpiLen);
if (!mem)
return 0;
*lpiLen = 0;
if (pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpiLen))
{
SHTruncateString(mem, *lpiLen);
lstrcpynA(lpDstStr, mem, *lpiLen + 1);
return *lpiLen + 1;
}
HeapFree(GetProcessHeap(), 0, mem);
return *lpiLen;
}
lpDstStr[*lpiLen] = '\0';
return *lpiLen;
}
break;
default:
break;
}
reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, lpDstStr,
*lpiLen, NULL, NULL);
if (!reqLen && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, NULL, 0, NULL, NULL);
if (reqLen)
{
mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, reqLen);
if (mem)
{
reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, mem,
reqLen, NULL, NULL);
reqLen = SHTruncateString(mem, *lpiLen);
reqLen++;
lstrcpynA(lpDstStr, mem, *lpiLen);
HeapFree(GetProcessHeap(), 0, mem);
}
}
}
return reqLen;
}
/*************************************************************************
* @ [SHLWAPI.217]
*
* Convert a Unicode string to Ascii.
*
* PARAMS
* lpSrcStr [I] Source Unicode string to convert
* lpDstStr [O] Destination for converted Ascii string
* iLen [O] Length of lpDstStr in characters
*
* RETURNS
* See SHUnicodeToAnsiCP
* NOTES
* This function simply calls SHUnicodeToAnsiCP() with CodePage = CP_ACP.
*/
INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen)
{
INT myint = iLen;
return SHUnicodeToAnsiCP(CP_ACP, lpSrcStr, lpDstStr, &myint);
}
/*************************************************************************
* @ [SHLWAPI.364]
*
* Determine if an Ascii string converts to Unicode and back identically.
*
* PARAMS
* lpSrcStr [I] Source Unicode string to convert
* lpDst [O] Destination for resulting Ascii string
* iLen [I] Length of lpDst in characters
*
* RETURNS
* TRUE, since Ascii strings always convert identically.
*/
BOOL WINAPI DoesStringRoundTripA(LPCSTR lpSrcStr, LPSTR lpDst, INT iLen)
{
lstrcpynA(lpDst, lpSrcStr, iLen);
return TRUE;
}
/*************************************************************************
* @ [SHLWAPI.365]
*
* Determine if a Unicode string converts to Ascii and back identically.
*
* PARAMS
* lpSrcStr [I] Source Unicode string to convert
* lpDst [O] Destination for resulting Ascii string
* iLen [I] Length of lpDst in characters
*
* RETURNS
* TRUE, if lpSrcStr converts to Ascii and back identically,
* FALSE otherwise.
*/
BOOL WINAPI DoesStringRoundTripW(LPCWSTR lpSrcStr, LPSTR lpDst, INT iLen)
{
WCHAR szBuff[MAX_PATH];
SHUnicodeToAnsi(lpSrcStr, lpDst, iLen);
SHAnsiToUnicode(lpDst, szBuff, MAX_PATH);
return !strcmpW(lpSrcStr, szBuff);
}

View file

@ -419,6 +419,9 @@ HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized,
debugstr_a(pszUrl), pszCanonicalized, debugstr_a(pszUrl), pszCanonicalized,
pcchCanonicalized, dwFlags); pcchCanonicalized, dwFlags);
if(!pszUrl || !pszCanonicalized || !pcchCanonicalized)
return E_INVALIDARG;
base = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, base = (LPWSTR) HeapAlloc(GetProcessHeap(), 0,
(2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR)); (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
canonical = base + INTERNET_MAX_URL_LENGTH; canonical = base + INTERNET_MAX_URL_LENGTH;
@ -461,6 +464,9 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszCanonicalized, TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszCanonicalized,
pcchCanonicalized, dwFlags); pcchCanonicalized, dwFlags);
if(!pszUrl || !pszCanonicalized || !pcchCanonicalized)
return E_INVALIDARG;
nByteLen = (lstrlenW(pszUrl) + 1) * sizeof(WCHAR); /* length in bytes */ nByteLen = (lstrlenW(pszUrl) + 1) * sizeof(WCHAR); /* length in bytes */
lpszUrlCpy = HeapAlloc(GetProcessHeap(), 0, nByteLen); lpszUrlCpy = HeapAlloc(GetProcessHeap(), 0, nByteLen);
@ -508,8 +514,8 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
wk2 += strlenW(wk2); wk2 += strlenW(wk2);
break; break;
case 4: case 4:
if (!isalnumW(*wk1) && (*wk1 != L'-')) {state = 3; break;} if (!isalnumW(*wk1) && (*wk1 != L'-') && (*wk1 != L'.')) {state = 3; break;}
while(isalnumW(*wk1) || (*wk1 == L'-')) *wk2++ = *wk1++; while(isalnumW(*wk1) || (*wk1 == L'-') || (*wk1 == L'.')) *wk2++ = *wk1++;
state = 5; state = 5;
break; break;
case 5: case 5:
@ -543,7 +549,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
else if (*(wk1+1) == L'.') { else if (*(wk1+1) == L'.') {
/* found /.. look for next / */ /* found /.. look for next / */
TRACE("found '/..'\n"); TRACE("found '/..'\n");
if (*(wk1+2) == L'/') { if (*(wk1+2) == L'/' || *(wk1+2) == L'?' || *(wk1+2) == L'#' || *(wk1+2) == 0) {
/* case /../ -> need to backup wk2 */ /* case /../ -> need to backup wk2 */
TRACE("found '/../'\n"); TRACE("found '/../'\n");
*(wk2-1) = L'\0'; /* set end of string */ *(wk2-1) = L'\0'; /* set end of string */
@ -551,7 +557,10 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
if (mp && (mp >= root)) { if (mp && (mp >= root)) {
/* found valid backup point */ /* found valid backup point */
wk2 = mp + 1; wk2 = mp + 1;
wk1 += 3; if(*(wk1+2) != L'/')
wk1 += 2;
else
wk1 += 3;
} }
else { else {
/* did not find point, restore '/' */ /* did not find point, restore '/' */
@ -629,7 +638,10 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx) using W version\n", TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx) using W version\n",
debugstr_a(pszBase),debugstr_a(pszRelative), debugstr_a(pszBase),debugstr_a(pszRelative),
*pcchCombined,dwFlags); pcchCombined?*pcchCombined:0,dwFlags);
if(!pszBase || !pszRelative || !pszCombined || !pcchCombined)
return E_INVALIDARG;
base = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, base = (LPWSTR) HeapAlloc(GetProcessHeap(), 0,
(3*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR)); (3*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
@ -678,7 +690,10 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx)\n", TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx)\n",
debugstr_w(pszBase),debugstr_w(pszRelative), debugstr_w(pszBase),debugstr_w(pszRelative),
*pcchCombined,dwFlags); pcchCombined?*pcchCombined:0,dwFlags);
if(!pszBase || !pszRelative || !pszCombined || !pcchCombined)
return E_INVALIDARG;
base.size = 24; base.size = 24;
relative.size = 24; relative.size = 24;
@ -964,7 +979,10 @@ HRESULT WINAPI UrlEscapeA(
INT len; INT len;
TRACE("(%s %p %lx 0x%08lx)\n", debugstr_a(pszUrl), pszEscaped, TRACE("(%s %p %lx 0x%08lx)\n", debugstr_a(pszUrl), pszEscaped,
*pcchEscaped, dwFlags); pcchEscaped?*pcchEscaped:0, dwFlags);
if(!pszUrl || !pszEscaped || !pcchEscaped)
return E_INVALIDARG;
if(dwFlags & ~(URL_ESCAPE_SPACES_ONLY | if(dwFlags & ~(URL_ESCAPE_SPACES_ONLY |
URL_ESCAPE_SEGMENT_ONLY | URL_ESCAPE_SEGMENT_ONLY |
@ -1039,6 +1057,9 @@ HRESULT WINAPI UrlEscapeW(
TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszEscaped, TRACE("(%s %p %p 0x%08lx)\n", debugstr_w(pszUrl), pszEscaped,
pcchEscaped, dwFlags); pcchEscaped, dwFlags);
if(!pszUrl || !pszEscaped || !pcchEscaped)
return E_INVALIDARG;
if(dwFlags & ~(URL_ESCAPE_SPACES_ONLY | if(dwFlags & ~(URL_ESCAPE_SPACES_ONLY |
URL_ESCAPE_SEGMENT_ONLY | URL_ESCAPE_SEGMENT_ONLY |
URL_DONT_ESCAPE_EXTRA_INFO | URL_DONT_ESCAPE_EXTRA_INFO |
@ -1144,6 +1165,9 @@ HRESULT WINAPI UrlUnescapeA(
TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_a(pszUrl), pszUnescaped, TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_a(pszUrl), pszUnescaped,
pcchUnescaped, dwFlags); pcchUnescaped, dwFlags);
if(!pszUrl || !pszUnescaped || !pcchUnescaped)
return E_INVALIDARG;
if(dwFlags & URL_UNESCAPE_INPLACE) if(dwFlags & URL_UNESCAPE_INPLACE)
dst = pszUrl; dst = pszUrl;
else else
@ -1208,6 +1232,9 @@ HRESULT WINAPI UrlUnescapeW(
TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_w(pszUrl), pszUnescaped, TRACE("(%s, %p, %p, 0x%08lx)\n", debugstr_w(pszUrl), pszUnescaped,
pcchUnescaped, dwFlags); pcchUnescaped, dwFlags);
if(!pszUrl || !pszUnescaped || !pcchUnescaped)
return E_INVALIDARG;
if(dwFlags & URL_UNESCAPE_INPLACE) if(dwFlags & URL_UNESCAPE_INPLACE)
dst = pszUrl; dst = pszUrl;
else else

View file

@ -4,7 +4,7 @@ RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.41 retrieving revision 1.41
diff -u -r1.41 path.c diff -u -r1.41 path.c
--- path.c 23 Jan 2004 22:45:25 -0000 1.41 --- path.c 23 Jan 2004 22:45:25 -0000 1.41
+++ path.c 28 Jan 2004 22:02:59 -0000 +++ path.c 11 Mar 2004 22:38:00 -0000
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
@ -13,14 +13,43 @@ diff -u -r1.41 path.c
#define NO_SHLWAPI_STREAM #define NO_SHLWAPI_STREAM
#include "shlwapi.h" #include "shlwapi.h"
#include "wine/debug.h" #include "wine/debug.h"
Index: shlwapi.spec
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/shlwapi.spec,v
retrieving revision 1.88
diff -u -r1.88 shlwapi.spec
--- shlwapi.spec 28 Feb 2004 01:46:56 -0000 1.88
+++ shlwapi.spec 11 Mar 2004 22:38:00 -0000
@@ -368,9 +368,9 @@
368 stdcall @(wstr wstr ptr long wstr) kernel32.GetPrivateProfileStructW
369 stdcall @(wstr wstr ptr ptr long long ptr wstr ptr ptr) kernel32.CreateProcessW
370 stdcall -noname ExtractIconWrapW(long wstr long)
-371 stdcall -noname DdeInitializeWrapW(ptr ptr long long) user32.DdeInitializeW
-372 stdcall -noname DdeCreateStringHandleWrapW(long ptr long) user32.DdeCreateStringHandleW
-373 stdcall -noname DdeQueryStringWrapW(long ptr wstr long long) user32.DdeQueryStringW
+371 stdcall DdeInitializeWrapW(ptr ptr long long) user32.DdeInitializeW
+372 stdcall DdeCreateStringHandleWrapW(long ptr long) user32.DdeCreateStringHandleW
+373 stdcall DdeQueryStringWrapW(long ptr wstr long long) user32.DdeQueryStringW
374 stub -noname SHCheckDiskForMediaA
375 stub -noname SHCheckDiskForMediaW
376 stdcall -noname MLGetUILanguage() # kernel32.GetUserDefaultUILanguage
@@ -389,7 +389,7 @@
389 stdcall -noname GetSaveFileNameWrapW(ptr)
390 stdcall -noname WNetRestoreConnectionWrapW(long wstr)
391 stdcall -noname WNetGetLastErrorWrapW(ptr ptr long ptr long)
-392 stdcall -noname EndDialogWrap(ptr ptr) user32.EndDialog
+392 stdcall EndDialogWrap(ptr ptr) user32.EndDialog
393 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamW
394 stdcall @(long ptr long ptr long) user32.CreateDialogIndirectParamA
395 stub -noname MLWinHelpA
Index: string.c Index: string.c
=================================================================== ===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/string.c,v RCS file: /home/wine/wine/dlls/shlwapi/string.c,v
retrieving revision 1.40 retrieving revision 1.44
diff -u -r1.40 string.c diff -u -r1.44 string.c
--- string.c 23 Jan 2004 22:45:25 -0000 1.40 --- string.c 20 Feb 2004 05:16:37 -0000 1.44
+++ string.c 28 Jan 2004 22:03:00 -0000 +++ string.c 11 Mar 2004 22:38:01 -0000
@@ -556,7 +556,7 @@ @@ -528,7 +528,7 @@
{ {
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch)); TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@ -29,7 +58,7 @@ diff -u -r1.40 string.c
} }
/************************************************************************* /*************************************************************************
@@ -665,7 +665,7 @@ @@ -637,7 +637,7 @@
{ {
TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch)); TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch));
@ -41,11 +70,11 @@ diff -u -r1.40 string.c
Index: url.c Index: url.c
=================================================================== ===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/url.c,v RCS file: /home/wine/wine/dlls/shlwapi/url.c,v
retrieving revision 1.27 retrieving revision 1.29
diff -u -r1.27 url.c diff -u -r1.29 url.c
--- url.c 23 Jan 2004 22:45:25 -0000 1.27 --- url.c 3 Mar 2004 20:11:46 -0000 1.29
+++ url.c 28 Jan 2004 22:03:02 -0000 +++ url.c 11 Mar 2004 22:38:02 -0000
@@ -1396,8 +1396,8 @@ @@ -1423,8 +1423,8 @@
* Success: TRUE. lpDest is filled with the computed hash value. * Success: TRUE. lpDest is filled with the computed hash value.
* Failure: FALSE, if any argument is invalid. * Failure: FALSE, if any argument is invalid.
*/ */