Changelog * dlls/shell32/shell32.spec Fix signature of CheckEscapesA/W as observed on W2K * dlls/shell32/undocshell.h Add function declarations for CheckEscapesA/W * dlls/shell32/shellstring.c Implement CheckEscapesA/W License: X11/LGPL Rolf Kalbermatter Index: dlls/shell32/shell32.spec =================================================================== RCS file: /home/wine/wine/dlls/shell32/shell32.spec,v retrieving revision 1.66 diff -u -r1.66 shell32.spec --- dlls/shell32/shell32.spec 21 Mar 2003 21:23:33 -0000 1.66 +++ dlls/shell32/shell32.spec 26 Mar 2003 16:26:16 -0000 @@ -17,12 +17,12 @@ 19 stdcall ILCloneFirst (ptr) 20 stdcall ILGlobalClone (ptr) 21 stdcall ILIsEqual (ptr ptr) - 23 stdcall ILIsParent (long long long) - 24 stdcall ILFindChild (long long) + 23 stdcall ILIsParent (ptr ptr long) + 24 stdcall ILFindChild (ptr ptr) 25 stdcall ILCombine(ptr ptr) 26 stdcall ILLoadFromStream (ptr ptr) 27 stdcall ILSaveToStream(ptr ptr) - 28 stdcall SHILCreateFromPath (long long long) SHILCreateFromPathAW + 28 stdcall SHILCreateFromPath(ptr ptr ptr) SHILCreateFromPathAW 29 stdcall PathIsRoot(ptr) PathIsRootAW 30 stdcall PathBuildRoot(ptr long) PathBuildRootAW 31 stdcall PathFindExtension(ptr) PathFindExtensionAW @@ -190,7 +190,7 @@ 209 stub Int64ToString 210 stub LargeIntegerToString 211 stub Printers_GetPidl - 212 stub Printer_AddPrinterPropPages + 212 stub Printers_AddPrinterPropPages 213 stub Printers_RegisterWindowW 214 stub Printers_UnregisterWindow 215 stub SHStartNetConnectionDialog@12 @@ -306,8 +306,8 @@ # version 4.0 (win95) # _WIN32_IE >= 0x0200 # -@ stdcall CheckEscapesA(str long long ptr ptr long) -@ stdcall CheckEscapesW(wstr long long ptr ptr long) +@ stdcall CheckEscapesA(str long) +@ stdcall CheckEscapesW(wstr long) @ stdcall CommandLineToArgvW(wstr ptr) @ stdcall Control_FillCache_RunDLL(long long long long) @ stub Control_FillCache_RunDLLA Index: dlls/shell32/undocshell.h =================================================================== RCS file: /home/wine/wine/dlls/shell32/undocshell.h,v retrieving revision 1.8 diff -u -r1.8 undocshell.h --- dlls/shell32/undocshell.h 21 Mar 2003 21:26:25 -0000 1.8 +++ dlls/shell32/undocshell.h 26 Mar 2003 16:19:33 -0000 @@ -901,6 +901,9 @@ UINT uFlags); #define SHGetNewLinkInfo WINELIB_NAME_AW(SHGetNewLinkInfo) +DWORD WINAPI CheckEscapesA(LPSTR string, DWORD len); +DWORD WINAPI CheckEscapesW(LPWSTR string, DWORD len); + /* policy functions */ BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey); DWORD WINAPI SHRestricted (DWORD policy); Index: dlls/shell32/shellstring.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/shellstring.c,v retrieving revision 1.25 diff -u -r1.25 shellstring.c --- dlls/shell32/shellstring.c 7 Jan 2003 20:36:24 -0000 1.25 +++ dlls/shell32/shellstring.c 26 Mar 2003 16:21:17 -0000 @@ -29,6 +29,7 @@ #include "shlobj.h" #include "shellapi.h" +#include "shlwapi.h" #include "shell32_main.h" #include "undocshell.h" #include "wine/unicode.h" @@ -217,40 +218,66 @@ /************************************************************************* - * CheckEscapes [SHELL32] + * CheckEscapesA [SHELL32.@] + * + * Checks a string for special characters which are not allowed in a path + * and encloses it in quotes if that is the case. + * + * PARAMS + * string [I/O] string to check and on return eventually quoted + * len [I] length of string + * + * RETURNS + * length of actual string + * + * NOTES + * Not really sure if this function returns actually a value at all. */ DWORD WINAPI CheckEscapesA( - LPSTR string, /* [in] string to check ??*/ - DWORD b, /* [???] is 0 */ - DWORD c, /* [???] is 0 */ - LPDWORD d, /* [???] is address */ - LPDWORD e, /* [???] is address */ - DWORD handle ) /* [in] looks like handle but not */ -{ - FIXME("(%p<%s> %ld %ld %p<%ld> %p<%ld> 0x%08lx) stub\n", - string, debugstr_a(string), - b, - c, - d, (d) ? *d : 0xabbacddc, - e, (e) ? *e : 0xabbacddd, - handle); - return 0; + LPSTR string, /* [I/O] string to check ??*/ + DWORD len) /* [I] is 0 */ +{ + LPWSTR wString; + DWORD ret = 0; + + TRACE("(%s %ld)\n", debugstr_a(string), len); + wString = (LPWSTR)LocalAlloc(LPTR, len * sizeof(WCHAR)); + if (wString) + { + MultiByteToWideChar(CP_ACP, 0, string, len, wString, len); + ret = CheckEscapesW(wString, len); + WideCharToMultiByte(CP_ACP, 0, wString, len, string, len, NULL, NULL); + LocalFree(wString); + } + return ret; } +static const WCHAR strEscapedChars[] = {' ','"',',',';','^',0}; + +/************************************************************************* + * CheckEscapesW [SHELL32.@] + * + * see CheckEscapesA + */ DWORD WINAPI CheckEscapesW( - LPWSTR string, /* [in] string to check ??*/ - DWORD b, /* [???] is 0 */ - DWORD c, /* [???] is 0 */ - LPDWORD d, /* [???] is address */ - LPDWORD e, /* [???] is address */ - DWORD handle ) /* [in] looks like handle but not */ -{ - FIXME("(%p<%s> %ld %ld %p<%ld> %p<%ld> 0x%08lx) stub\n", - string, debugstr_w(string), - b, - c, - d, (d) ? *d : 0xabbacddc, - e, (e) ? *e : 0xabbacddd, - handle); - return 0; + LPWSTR string, + DWORD len) +{ + DWORD size = lstrlenW(string); + LPWSTR s, d; + + TRACE("(%s %ld) stub\n", debugstr_w(string), len); + + if (StrPBrkW(string, strEscapedChars) && size + 2 <= len) + { + s = &string[size - 1]; + d = &string[size + 2]; + *d-- = 0; + *d-- = '"'; + for (;d > string;) + *d-- = *s--; + *d = '"'; + return size + 2; + } + return size; }