Implemented CheckEscapesA/W.

This commit is contained in:
Rolf Kalbermatter 2003-03-26 23:59:51 +00:00 committed by Alexandre Julliard
parent 3e588e3a57
commit 72da279d52
3 changed files with 65 additions and 35 deletions

View File

@ -17,12 +17,12 @@
19 stdcall ILCloneFirst (ptr) 19 stdcall ILCloneFirst (ptr)
20 stdcall ILGlobalClone (ptr) 20 stdcall ILGlobalClone (ptr)
21 stdcall ILIsEqual (ptr ptr) 21 stdcall ILIsEqual (ptr ptr)
23 stdcall ILIsParent (long long long) 23 stdcall ILIsParent (ptr ptr long)
24 stdcall ILFindChild (long long) 24 stdcall ILFindChild (ptr ptr)
25 stdcall ILCombine(ptr ptr) 25 stdcall ILCombine(ptr ptr)
26 stdcall ILLoadFromStream (ptr ptr) 26 stdcall ILLoadFromStream (ptr ptr)
27 stdcall ILSaveToStream(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 29 stdcall PathIsRoot(ptr) PathIsRootAW
30 stdcall PathBuildRoot(ptr long) PathBuildRootAW 30 stdcall PathBuildRoot(ptr long) PathBuildRootAW
31 stdcall PathFindExtension(ptr) PathFindExtensionAW 31 stdcall PathFindExtension(ptr) PathFindExtensionAW
@ -190,7 +190,7 @@
209 stub Int64ToString 209 stub Int64ToString
210 stub LargeIntegerToString 210 stub LargeIntegerToString
211 stub Printers_GetPidl 211 stub Printers_GetPidl
212 stub Printer_AddPrinterPropPages 212 stub Printers_AddPrinterPropPages
213 stub Printers_RegisterWindowW 213 stub Printers_RegisterWindowW
214 stub Printers_UnregisterWindow 214 stub Printers_UnregisterWindow
215 stub SHStartNetConnectionDialog@12 215 stub SHStartNetConnectionDialog@12
@ -306,8 +306,8 @@
# version 4.0 (win95) # version 4.0 (win95)
# _WIN32_IE >= 0x0200 # _WIN32_IE >= 0x0200
# #
@ stdcall CheckEscapesA(str long long ptr ptr long) @ stdcall CheckEscapesA(str long)
@ stdcall CheckEscapesW(wstr long long ptr ptr long) @ stdcall CheckEscapesW(wstr long)
@ stdcall CommandLineToArgvW(wstr ptr) @ stdcall CommandLineToArgvW(wstr ptr)
@ stdcall Control_FillCache_RunDLL(long long long long) @ stdcall Control_FillCache_RunDLL(long long long long)
@ stub Control_FillCache_RunDLLA @ stub Control_FillCache_RunDLLA

View File

@ -29,6 +29,7 @@
#include "shlobj.h" #include "shlobj.h"
#include "shellapi.h" #include "shellapi.h"
#include "shlwapi.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "undocshell.h" #include "undocshell.h"
#include "wine/unicode.h" #include "wine/unicode.h"
@ -217,40 +218,66 @@ BOOL WINAPI OleStrToStrNAW (LPVOID lpOut, INT nOut, LPCVOID lpIn, INT nIn)
/************************************************************************* /*************************************************************************
* 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( DWORD WINAPI CheckEscapesA(
LPSTR string, /* [in] string to check ??*/ LPSTR string, /* [I/O] string to check ??*/
DWORD b, /* [???] is 0 */ DWORD len) /* [I] 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", LPWSTR wString;
string, debugstr_a(string), DWORD ret = 0;
b,
c, TRACE("(%s %ld)\n", debugstr_a(string), len);
d, (d) ? *d : 0xabbacddc, wString = (LPWSTR)LocalAlloc(LPTR, len * sizeof(WCHAR));
e, (e) ? *e : 0xabbacddd, if (wString)
handle); {
return 0; 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( DWORD WINAPI CheckEscapesW(
LPWSTR string, /* [in] string to check ??*/ LPWSTR string,
DWORD b, /* [???] is 0 */ DWORD len)
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", DWORD size = lstrlenW(string);
string, debugstr_w(string), LPWSTR s, d;
b,
c, TRACE("(%s %ld) stub\n", debugstr_w(string), len);
d, (d) ? *d : 0xabbacddc,
e, (e) ? *e : 0xabbacddd, if (StrPBrkW(string, strEscapedChars) && size + 2 <= len)
handle); {
return 0; s = &string[size - 1];
d = &string[size + 2];
*d-- = 0;
*d-- = '"';
for (;d > string;)
*d-- = *s--;
*d = '"';
return size + 2;
}
return size;
} }

View File

@ -901,6 +901,9 @@ BOOL WINAPI SHGetNewLinkInfoW(
UINT uFlags); UINT uFlags);
#define SHGetNewLinkInfo WINELIB_NAME_AW(SHGetNewLinkInfo) #define SHGetNewLinkInfo WINELIB_NAME_AW(SHGetNewLinkInfo)
DWORD WINAPI CheckEscapesA(LPSTR string, DWORD len);
DWORD WINAPI CheckEscapesW(LPWSTR string, DWORD len);
/* policy functions */ /* policy functions */
BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey); BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey);
DWORD WINAPI SHRestricted (DWORD policy); DWORD WINAPI SHRestricted (DWORD policy);