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)
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

View File

@ -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 @@ 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(
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 */
LPSTR string, /* [I/O] string to check ??*/
DWORD len) /* [I] is 0 */
{
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;
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 */
LPWSTR string,
DWORD len)
{
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;
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;
}

View File

@ -901,6 +901,9 @@ BOOL WINAPI SHGetNewLinkInfoW(
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);