- Implement ordinals 7, 8, 9, 13, 14, 19, 36.

- Implement SHRegWriteUSValue{A|W}, UrlGetPart{A|W}, UrlIs...{A|W}
This commit is contained in:
Guy L. Albertelli 2001-11-13 21:28:21 +00:00 committed by Alexandre Julliard
parent fa7a8c6306
commit ad3815929d
5 changed files with 855 additions and 40 deletions

View File

@ -194,11 +194,206 @@ DWORD WINAPI SHLWAPI_2 (LPCWSTR x, UNKNOWN_SHLWAPI_2 *y)
return S_OK;
}
/*************************************************************************
* @ [SHLWAPI.7]
* (Used by IE4 during startup)
* appears to return HWND (used as input to 8 below)
*/
HRESULT WINAPI SHLWAPI_7 (
LPVOID w,
LPVOID x,
LPVOID y) /* appears to be result of GetCurrentProcessId() */
{
FIXME("(%p %p %p) stub\n", w, x, y);
return 0;
#if 0
/* pseudo code extracted from relay trace */
fhnd = CreateFileMappingA(-1, 0, 4, 0, 0x58, 0);
addr = MapViewOfFile(fhnd, 6, 0, 0, 0);
UnmapViewOfFile(addr);
GetCurrentProcessId();
GetCurrentProcessId();
sph = GetCurrentProcess();
GetCurrentProcessId();
dph = GetCurrentProcess();
DuplicateHandle(sph, fhnd, dph, &hoho, 0x000f001f, 0, 2);
GetCurrentProcessId();
GetCurrentProcessId();
CloseHandle(fhnd);
return hoho;
#endif
}
/*************************************************************************
* @ [SHLWAPI.8]
* (Used by IE4 during startup)
* appears to return MapViewOfFile+4 (used as input to 9 below)
*/
LONG WINAPI SHLWAPI_8 (
LPVOID w, /* possibly HANDLE */
LPVOID x) /* appears to be result of GetCurrentProcessId() */
{
FIXME("(%p %p) stub\n", w, x);
return 0;
#if 0
/* pseudo code extracted from relay trace */
GetCurrentProcessId();
GetCurrentProcessId();
sph = GetCurrentProcess();
GetCurrentProcessId();
dph = GetCurrentProcess();
DuplicateHandle(sph, w, dph, &hoho, 0x000f001f, 0, 2);
GetCurrentProcessId();
GetCurrentProcessId();
addr = MapViewOfFile(hoho, 6, 0, 0, 0);
CloseHandle(hoho);
return (LONG)addr + 4;
#endif
}
/*************************************************************************
* @ [SHLWAPI.9]
* (Used by IE4 during startup)
*/
HRESULT WINAPI SHLWAPI_9 (
LPVOID w)
{
FIXME("(%p) stub\n", w);
return 0;
#if 0
/* pseudo code extracted from relay trace */
return UnmapViewOfFile((LPVOID)((LONG)w-4));
#endif
}
/*************************************************************************
* @ [SHLWAPI.13]
* (Used by IE4 during startup)
*/
HRESULT WINAPI SHLWAPI_13 (
LPVOID w,
LPVOID x)
{
FIXME("(%p %p)stub\n",w,x);
return 1;
#if 0
/* pseudo code extracted from relay trace */
RegOpenKeyA(HKLM, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Aceepted Documents", &newkey);
ret = 0;
i = 0;
size = 0;
while(!ret) {
ret = RegEnumValueA(newkey, i, a1, a2, 0, a3, 0, 0);
size += ???;
i++;
}
b1 = LocalAlloc(0x40, size);
ret = 0;
i = 0;
while(!ret) {
ret = RegEnumValueA(newkey, i, a1, a2, 0, a3, a4, a5);
RegisterClipBoardFormatA(a4);
i++;
}
hwnd1 = GetModuleHandleA("URLMON.DLL");
proc = GetProcAddress(hwnd1, "CreateFormatEnumerator");
HeapAlloc(??, 0, 0x14);
HeapAlloc(??, 0, 0x50);
LocalAlloc(0x40, 0x78);
/* FIXME: bad string below */
lstrlenW(L"{D0FCA420-D3F5-11CF-B211-00AA004AE837}");
StrCpyW(a6, L"{D0FCA420-D3F5-11CF-B211-00AA004AE837}");
GetTickCount();
IsBadReadPtr(c1 = 0x403fd210,4);
InterlockedIncrement(c1+4);
LocalFree(b1);
RegCloseKey(newkey);
IsBadReadPtr(c1 = 0x403fd210,4);
InterlockedIncrement(c1+4);
HeapAlloc(40350000,00000000,00000014) retval=403fd0a8;
HeapAlloc(40350000,00000000,00000050) retval=403feb44;
hwnd1 = GetModuleHandleA("URLMON.DLL");
proc = GetProcAddress(hwnd1, "RegisterFormatEnumerator");
/* 0x1a40c88c is in URLMON.DLL just before above proc
* content is L"_EnumFORMATETC_"
* label is d1
*/
IsBadReadPtr(d1 = 0x1a40c88c,00000002);
lstrlenW(d1);
lstrlenW(d1);
HeapAlloc(40350000,00000000,0000001e) retval=403fed44;
IsBadReadPtr(d2 = 0x403fd0a8,00000004);
InterlockedIncrement(d2+4);
IsBadReadPtr(d2 = 0x403fd0a8,00000004);
InterlockedDecrement(d2+4);
IsBadReadPtr(c1,00000004);
InterlockedDecrement(c1+4);
IsBadReadPtr(c1,00000004);
InterlockedDecrement(c1+4);
#endif
}
/*************************************************************************
* SHLWAPI_14 [SHLWAPI.14]
*
* Function:
* Retrieves IE "AcceptLanguage" value from registry. ASCII mode.
*
*/
HRESULT WINAPI SHLWAPI_14 (
LPSTR langbuf,
LPDWORD buflen)
{
CHAR *mystr;
DWORD mystrlen, mytype;
HKEY mykey;
LCID mylcid;
mystrlen = (*buflen > 6) ? *buflen : 6;
mystr = (CHAR*)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, mystrlen);
RegOpenKeyA(HKEY_CURRENT_USER,
"Software\\Microsoft\\Internet Explorer\\International",
&mykey);
if (RegQueryValueExA(mykey, "AcceptLanguage",
0, &mytype, mystr, &mystrlen)) {
/* Did not find value */
mylcid = GetUserDefaultLCID();
/* somehow the mylcid translates into "en-us"
* this is similar to "LOCALE_SABBREVLANGNAME"
* which could be gotten via GetLocaleInfo.
* The only problem is LOCALE_SABBREVLANGUAGE" is
* a 3 char string (first 2 are country code and third is
* letter for "sublanguage", which does not come close to
* "en-us"
*/
lstrcpyA(mystr, "en-us");
mystrlen = lstrlenA(mystr);
}
else {
/* handle returned string */
FIXME("missing code\n");
}
if (mystrlen > *buflen)
lstrcpynA(langbuf, mystr, *buflen);
else {
lstrcpyA(langbuf, mystr);
*buflen = lstrlenA(langbuf);
}
RegCloseKey(mykey);
HeapFree(GetProcessHeap(), 0, mystr);
TRACE("language is %s\n", debugstr_a(langbuf));
return 0;
}
/*************************************************************************
* SHLWAPI_15 [SHLWAPI.15]
*
* Function:
* Retrieves IE "AcceptLanguage" value from registry
* Retrieves IE "AcceptLanguage" value from registry. UNICODE mode.
*
*/
HRESULT WINAPI SHLWAPI_15 (
@ -210,7 +405,7 @@ HRESULT WINAPI SHLWAPI_15 (
HKEY mykey;
LCID mylcid;
mystrlen = *buflen;
mystrlen = (*buflen > 6) ? *buflen : 6;
mystr = (CHAR*)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, mystrlen);
RegOpenKeyA(HKEY_CURRENT_USER,
@ -218,6 +413,7 @@ HRESULT WINAPI SHLWAPI_15 (
&mykey);
if (RegQueryValueExA(mykey, "AcceptLanguage",
0, &mytype, mystr, &mystrlen)) {
/* Did not find value */
mylcid = GetUserDefaultLCID();
/* somehow the mylcid translates into "en-us"
* this is similar to "LOCALE_SABBREVLANGNAME"
@ -227,7 +423,7 @@ HRESULT WINAPI SHLWAPI_15 (
* letter for "sublanguage", which does not come close to
* "en-us"
*/
lstrcpynA(mystr, "en-us", mystrlen);
lstrcpyA(mystr, "en-us");
mystrlen = lstrlenA(mystr);
}
else {
@ -262,7 +458,7 @@ HRESULT WINAPI SHLWAPI_16 (
* space size 0x14
* return is 0 (unless out of memory???)
*
* related to _21 and _22 below
* related to _19, _21 and _22 below
* only seen invoked by SHDOCVW
*/
LONG WINAPI SHLWAPI_18 (
@ -274,6 +470,22 @@ LONG WINAPI SHLWAPI_18 (
return 0;
}
/*************************************************************************
* @ [SHLWAPI.19]
*
* w is address of allocated memory from _21
* return is 0 (unless out of memory???)
*
* related to _18, _21 and _22 below
* only seen invoked by SHDOCVW
*/
LONG WINAPI SHLWAPI_19 (
LPVOID w)
{
FIXME("(%p) stub\n",w);
return 0;
}
/*************************************************************************
* @ [SHLWAPI.21]
*
@ -283,7 +495,7 @@ LONG WINAPI SHLWAPI_18 (
* x values seen 0xa0000005
* returns 1
*
* relates to _18 and _22 above and below
* relates to _18, _19 and _22 above and below
* only seen invoked by SHDOCVW
*/
LONG WINAPI SHLWAPI_21 (
@ -299,7 +511,7 @@ LONG WINAPI SHLWAPI_21 (
*
* return is 'w' value seen in x is 0xa0000005
*
* relates to _18 and _21 above
* relates to _18, _19 and _21 above
* only seen invoked by SHDOCVW
*/
LPVOID WINAPI SHLWAPI_22 (
@ -465,6 +677,17 @@ BOOL WINAPI SHLWAPI_35(LPVOID p1, DWORD dw2, LPVOID p3)
return TRUE;
}
/*************************************************************************
* SHLWAPI_36 [SHLWAPI.36]
*
*/
BOOL WINAPI SHLWAPI_36(HMENU h1, UINT ui2, UINT h3, LPCWSTR p4)
{
TRACE("(0x%08x, 0x%08x, 0x%08x, %s): stub\n",
h1, ui2, h3, debugstr_w(p4));
return AppendMenuW(h1, ui2, h3, p4);
}
/*************************************************************************
* @ [SHLWAPI.40]
*

View File

@ -563,13 +563,32 @@ DWORD WINAPI SHRegQueryInfoUSKeyW(
*/
LONG WINAPI SHRegEnumUSKeyA(
HUSKEY hUSKey, /* [in] */
DWORD dwIndex,
LPSTR pszName,
LPDWORD pcchValueNameLen,
DWORD dwIndex, /* [in] */
LPSTR pszName, /* [out] */
LPDWORD pcchValueNameLen, /* [in/out] */
SHREGENUM_FLAGS enumRegFlags) /* [in] */
{
FIXME("%s stub\n",debugstr_a(pszName));
return ERROR_NO_MORE_ITEMS;
HKEY dokey;
TRACE("(0x%lx,%ld,%p,%p(%ld),%d)\n",
(LONG)hUSKey, dwIndex, pszName, pcchValueNameLen,
*pcchValueNameLen, enumRegFlags);
if (((enumRegFlags == SHREGENUM_HKCU) ||
(enumRegFlags == SHREGENUM_DEFAULT)) &&
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
0, 0, 0, 0);
}
if (((enumRegFlags == SHREGENUM_HKLM) ||
(enumRegFlags == SHREGENUM_DEFAULT)) &&
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
return RegEnumKeyExA(dokey, dwIndex, pszName, pcchValueNameLen,
0, 0, 0, 0);
}
FIXME("no support for SHREGNUM_BOTH\n");
return ERROR_INVALID_FUNCTION;
}
/*************************************************************************
@ -577,13 +596,54 @@ LONG WINAPI SHRegEnumUSKeyA(
*/
LONG WINAPI SHRegEnumUSKeyW(
HUSKEY hUSKey, /* [in] */
DWORD dwIndex,
LPWSTR pszName,
LPDWORD pcchValueNameLen,
DWORD dwIndex, /* [in] */
LPWSTR pszName, /* [out] */
LPDWORD pcchValueNameLen, /* [in/out] */
SHREGENUM_FLAGS enumRegFlags) /* [in] */
{
FIXME("%s stub\n",debugstr_w(pszName));
return ERROR_NO_MORE_ITEMS;
HKEY dokey;
TRACE("(0x%lx,%ld,%p,%p(%ld),%d)\n",
(LONG)hUSKey, dwIndex, pszName, pcchValueNameLen,
*pcchValueNameLen, enumRegFlags);
if (((enumRegFlags == SHREGENUM_HKCU) ||
(enumRegFlags == SHREGENUM_DEFAULT)) &&
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKCU))) {
return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
0, 0, 0, 0);
}
if (((enumRegFlags == SHREGENUM_HKLM) ||
(enumRegFlags == SHREGENUM_DEFAULT)) &&
(dokey = REG_GetHKEYFromHUSKEY(hUSKey,REG_HKLM))) {
return RegEnumKeyExW(dokey, dwIndex, pszName, pcchValueNameLen,
0, 0, 0, 0);
}
FIXME("no support for SHREGNUM_BOTH\n");
return ERROR_INVALID_FUNCTION;
}
/*************************************************************************
* SHRegWriteUSValueA [SHLWAPI.@]
*/
LONG WINAPI SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType,
LPVOID pvData, DWORD cbData, DWORD dwFlags)
{
FIXME("(0x%lx,%s,%ld,%p,%ld,%ld): stub\n",
(LONG)hUSKey, debugstr_a(pszValue), dwType, pvData, cbData, dwFlags);
return ERROR_SUCCESS;
}
/*************************************************************************
* SHRegWriteUSValueW [SHLWAPI.@]
*/
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType,
LPVOID pvData, DWORD cbData, DWORD dwFlags)
{
FIXME("(0x%lx,%s,%ld,%p,%ld,%ld): stub\n",
(LONG)hUSKey, debugstr_w(pszValue), dwType, pvData, cbData, dwFlags);
return ERROR_SUCCESS;
}
/*************************************************************************

View File

@ -10,25 +10,25 @@ import ntdll.dll
debug_channels (shell)
1 stdcall @(ptr ptr) SHLWAPI_1
1 stdcall @(str ptr) SHLWAPI_1
2 stdcall @(wstr ptr) SHLWAPI_2
3 stub @
4 stub @
5 stub @
6 stub @
7 stub @
8 stub @
9 stub @
7 stdcall @(long long long) SHLWAPI_7
8 stdcall @(long long) SHLWAPI_8
9 stdcall @(long) SHLWAPI_9
10 stub @
11 stub @
12 stub @
13 stub @
14 stub @
13 stdcall @(ptr ptr) SHLWAPI_13
14 stdcall @(ptr ptr) SHLWAPI_14
15 stdcall @(ptr ptr) SHLWAPI_15
16 stdcall @(long long long long) SHLWAPI_16
17 stub @
18 stdcall @(ptr ptr) SHLWAPI_18
19 stub @
19 stdcall @(ptr) SHLWAPI_19
20 stub @
21 stdcall @(ptr long) SHLWAPI_21
22 stdcall @(ptr long) SHLWAPI_22
@ -45,7 +45,7 @@ debug_channels (shell)
33 stdcall @(long) SHLWAPI_33
34 stdcall @(long) SHLWAPI_34
35 stdcall @(ptr long ptr) SHLWAPI_35
36 stub @
36 stdcall @(long long long wstr) SHLWAPI_36
37 forward @ user32.CallWindowProcW
38 forward @ user32.CharLowerW
39 forward @ user32.CharLowerBuffW
@ -608,8 +608,8 @@ debug_channels (shell)
@ stdcall SHRegQueryUSValueW ( long wstr ptr ptr ptr long ptr long ) SHRegQueryUSValueW
@ stub SHRegSetUSValueA
@ stub SHRegSetUSValueW
@ stub SHRegWriteUSValueA
@ stub SHRegWriteUSValueW
@ stdcall SHRegWriteUSValueA (long str long ptr long long) SHRegWriteUSValueA
@ stdcall SHRegWriteUSValueW (long str long ptr long long) SHRegWriteUSValueW
@ stdcall SHSetValueA (long str str long ptr long) SHSetValueA
@ stdcall SHSetValueW (long wstr wstr long ptr long) SHSetValueW
@ stdcall StrCSpnA (str str) StrCSpnA
@ -675,16 +675,16 @@ debug_channels (shell)
@ stdcall UrlEscapeW(wstr ptr ptr long)UrlEscapeW
@ stdcall UrlGetLocationA(str) UrlGetLocationA
@ stdcall UrlGetLocationW(wstr) UrlGetLocationW
@ stub UrlGetPartA
@ stub UrlGetPartW
@ stdcall UrlGetPartA(str ptr ptr long long) UrlGetPartA
@ stdcall UrlGetPartW(wstr ptr ptr long long) UrlGetPartW
@ stdcall UrlHashA(str ptr long) UrlHashA
@ stub UrlHashW
@ stub UrlIsA
@ stub UrlIsNoHistoryA
@ stub UrlIsNoHistoryW
@ stub UrlIsOpaqueA
@ stub UrlIsOpaqueW
@ stub UrlIsW
@ stdcall UrlIsA(str long) UrlIsA
@ stdcall UrlIsNoHistoryA(str) UrlIsNoHistoryA
@ stdcall UrlIsNoHistoryW(wstr) UrlIsNoHistoryW
@ stdcall UrlIsOpaqueA(str) UrlIsOpaqueA
@ stdcall UrlIsOpaqueW(wstr) UrlIsOpaqueW
@ stdcall UrlIsW(wstr long) UrlIsW
@ stdcall UrlUnescapeA(str ptr ptr long) UrlUnescapeA
@ stdcall UrlUnescapeW(wstr ptr ptr long) UrlUnescapeW
@ varargs wnsprintfA(ptr long str) wnsprintfA

View File

@ -18,6 +18,30 @@
DEFAULT_DEBUG_CHANNEL(shell);
typedef struct {
LPCWSTR pScheme; /* [out] start of scheme */
DWORD szScheme; /* [out] size of scheme (until colon) */
LPCWSTR pUserName; /* [out] start of Username */
DWORD szUserName; /* [out] size of Username (until ":" or "@") */
LPCWSTR pPassword; /* [out] start of Password */
DWORD szPassword; /* [out] size of Password (until "@") */
LPCWSTR pHostName; /* [out] start of Hostname */
DWORD szHostName; /* [out] size of Hostname (until ":" or "/") */
LPCWSTR pPort; /* [out] start of Port */
DWORD szPort; /* [out] size of Port (until "/" or eos) */
LPCWSTR pQuery; /* [out] start of Query */
DWORD szQuery; /* [out] size of Query (until eos) */
} WINE_PARSE_URL;
typedef enum {
SCHEME,
HOST,
PORT,
USERPASS,
} WINE_URL_SCAN_TYPE;
static const WCHAR fileW[] = {'f','i','l','e','\0'};
static const unsigned char HashDataLookup[256] = {
0x01, 0x0E, 0x6E, 0x19, 0x61, 0xAE, 0x84, 0x77, 0x8A, 0xAA, 0x7D, 0x76, 0x1B,
0xE9, 0x8C, 0x33, 0x57, 0xC5, 0xB1, 0x6B, 0xEA, 0xA9, 0x38, 0x44, 0x1E, 0x07,
@ -384,7 +408,7 @@ HRESULT WINAPI UrlCombineA(LPCSTR pszBase, LPCSTR pszRelative,
len2 = WideCharToMultiByte(0, 0, combined, len, 0, 0, 0, 0);
if (len2 > *pcchCombined) {
*pcchCombined = len;
*pcchCombined = len2;
HeapFree(GetProcessHeap(), 0, base);
return E_POINTER;
}
@ -952,7 +976,7 @@ HRESULT WINAPI UrlUnescapeW(
WCHAR buf[3];
memcpy(buf, src + 1, 2*sizeof(WCHAR));
buf[2] = L'\0';
ih = wcstol(buf, NULL, 16);
ih = StrToIntW(buf);
next = (WCHAR) ih;
src += 2; /* Advance to end of escape */
} else
@ -982,22 +1006,60 @@ HRESULT WINAPI UrlUnescapeW(
/*************************************************************************
* UrlGetLocationA [SHLWAPI.@]
*
* Bugs/Features:
* MSDN (as of 2001-11-01) says that:
* "The location is the segment of the URL starting with a ?
* or # character."
* Neither V4 nor V5 of shlwapi.dll implement the '?' and always return
* a NULL.
* MSDN further states that:
* "If a file URL has a query string, ther returned string
* the query string."
* In all test cases if the scheme starts with "fi" then a NULL is
* returned. V5 gives the following results:
* NULL file://aa/b/cd#hohoh
* #hohoh http://aa/b/cd#hohoh
* NULL fi://aa/b/cd#hohoh
* #hohoh ff://aa/b/cd#hohoh
*/
LPCSTR WINAPI UrlGetLocationA(
LPCSTR pszUrl)
{
FIXME("(%s): stub\n", debugstr_a(pszUrl));
return 0;
UNKNOWN_SHLWAPI_1 base;
DWORD res1;
base.size = 24;
res1 = SHLWAPI_1(pszUrl, &base);
if (res1) return NULL; /* invalid scheme */
/* if scheme is file: then never return pointer */
if (strncmp(base.ap1, "file", min(4,base.sizep1)) == 0) return NULL;
/* Look for '#' and return its addr */
return strchr(base.ap2, '#');
}
/*************************************************************************
* UrlGetLocationW [SHLWAPI.@]
*
* See UrlGetLocationA for list of assumptions, bugs, and FIXMEs
*/
LPCWSTR WINAPI UrlGetLocationW(
LPCWSTR pszUrl)
{
FIXME("(%s): stub\n", debugstr_w(pszUrl));
return 0;
UNKNOWN_SHLWAPI_2 base;
DWORD res1;
base.size = 24;
res1 = SHLWAPI_2(pszUrl, &base);
if (res1) return NULL; /* invalid scheme */
/* if scheme is file: then never return pointer */
if (strncmpW(base.ap1, fileW, min(4,base.sizep1)) == 0) return NULL;
/* Look for '#' and return its addr */
return strchrW(base.ap2, L'#');
}
/*************************************************************************
@ -1059,3 +1121,381 @@ HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DW
return err;
}
/*************************************************************************
* UrlIsA [SHLWAPI.@]
*/
BOOL WINAPI UrlIsA(LPCSTR pszUrl, URLIS Urlis)
{
UNKNOWN_SHLWAPI_1 base;
DWORD res1;
switch (Urlis) {
case URLIS_OPAQUE:
base.size = 24;
res1 = SHLWAPI_1(pszUrl, &base);
if (res1) return FALSE; /* invalid scheme */
if ((*base.ap2 == '/') && (*(base.ap2+1) == '/'))
/* has scheme followed by 2 '/' */
return FALSE;
return TRUE;
case URLIS_URL:
case URLIS_NOHISTORY:
case URLIS_FILEURL:
case URLIS_APPLIABLE:
case URLIS_DIRECTORY:
case URLIS_HASQUERY:
default:
FIXME("(%s %d): stub\n", debugstr_a(pszUrl), Urlis);
}
return FALSE;
}
/*************************************************************************
* UrlIsW [SHLWAPI.@]
*/
BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis)
{
UNKNOWN_SHLWAPI_2 base;
DWORD res1;
switch (Urlis) {
case URLIS_OPAQUE:
base.size = 24;
res1 = SHLWAPI_2(pszUrl, &base);
if (res1) return FALSE; /* invalid scheme */
if ((*base.ap2 == L'/') && (*(base.ap2+1) == L'/'))
/* has scheme followed by 2 '/' */
return FALSE;
return TRUE;
case URLIS_URL:
case URLIS_NOHISTORY:
case URLIS_FILEURL:
case URLIS_APPLIABLE:
case URLIS_DIRECTORY:
case URLIS_HASQUERY:
default:
FIXME("(%s %d): stub\n", debugstr_w(pszUrl), Urlis);
}
return FALSE;
}
/*************************************************************************
* UrlIsNoHistoryA [SHLWAPI.@]
*/
BOOL WINAPI UrlIsNoHistoryA(LPCSTR pszUrl)
{
return UrlIsA(pszUrl, URLIS_NOHISTORY);
}
/*************************************************************************
* UrlIsNoHistoryW [SHLWAPI.@]
*/
BOOL WINAPI UrlIsNoHistoryW(LPCWSTR pszUrl)
{
return UrlIsW(pszUrl, URLIS_NOHISTORY);
}
/*************************************************************************
* UrlIsOpaqueA [SHLWAPI.@]
*/
BOOL WINAPI UrlIsOpaqueA(LPCSTR pszUrl)
{
return UrlIsA(pszUrl, URLIS_OPAQUE);
}
/*************************************************************************
* UrlIsOpaqueW [SHLWAPI.@]
*/
BOOL WINAPI UrlIsOpaqueW(LPCWSTR pszUrl)
{
return UrlIsW(pszUrl, URLIS_OPAQUE);
}
/*************************************************************************
* Scans for characters of type "type" and when not matching found,
* returns pointer to it and length in size.
*
* Characters tested based on RFC 1738
*/
LPCWSTR URL_ScanID(LPCWSTR start, LPDWORD size, WINE_URL_SCAN_TYPE type)
{
static DWORD alwayszero = 0;
BOOL cont = TRUE;
*size = 0;
switch(type){
case SCHEME:
while (cont) {
if ( (islowerW(*start) && isalphaW(*start)) ||
isdigitW(*start) ||
(*start == L'+') ||
(*start == L'-') ||
(*start == L'.')) {
start++;
(*size)++;
}
else
cont = FALSE;
}
break;
case USERPASS:
while (cont) {
if ( isalphaW(*start) ||
isdigitW(*start) ||
/* user/password only characters */
(*start == L';') ||
(*start == L'?') ||
(*start == L'&') ||
(*start == L'=') ||
/* *extra* characters */
(*start == L'!') ||
(*start == L'*') ||
(*start == L'\'') ||
(*start == L'(') ||
(*start == L')') ||
(*start == L',') ||
/* *safe* characters */
(*start == L'$') ||
(*start == L'_') ||
(*start == L'+') ||
(*start == L'-') ||
(*start == L'.')) {
start++;
(*size)++;
} else if (*start == L'%') {
if (isxdigitW(*(start+1)) &&
isxdigitW(*(start+2))) {
start += 3;
*size += 3;
} else
cont = FALSE;
} else
cont = FALSE;
}
break;
case PORT:
while (cont) {
if (isdigitW(*start)) {
start++;
(*size)++;
}
else
cont = FALSE;
}
break;
case HOST:
while (cont) {
if (isalnumW(*start) ||
(*start == L'-') ||
(*start == L'.') ) {
start++;
(*size)++;
}
else
cont = FALSE;
}
break;
default:
FIXME("unknown type %d\n", type);
return (LPWSTR)&alwayszero;
}
/* TRACE("scanned %ld characters next char %p<%c>\n",
*size, start, *start); */
return start;
}
/*************************************************************************
* Attempt to parse URL into pieces.
*/
LONG URL_ParseUrl(LPCWSTR pszUrl, WINE_PARSE_URL *pl)
{
LPCWSTR work;
memset(pl, 0, sizeof(WINE_PARSE_URL));
pl->pScheme = pszUrl;
work = URL_ScanID(pl->pScheme, &pl->szScheme, SCHEME);
if (!*work || (*work != L':')) goto ERROR;
work++;
if ((*work != L'/') || (*(work+1) != L'/')) goto ERROR;
pl->pUserName = work + 2;
work = URL_ScanID(pl->pUserName, &pl->szUserName, USERPASS);
if (*work == L':' ) {
/* parse password */
work++;
pl->pPassword = work;
work = URL_ScanID(pl->pPassword, &pl->szPassword, USERPASS);
if (*work != L'@') {
/* what we just parsed must be the hostname and port
* so reset pointers and clear then let it parse */
pl->szUserName = pl->szPassword = 0;
work = pl->pUserName - 1;
pl->pUserName = pl->pPassword = 0;
}
} else if (*work == L'@') {
/* no password */
pl->szPassword = 0;
pl->pPassword = 0;
} else if (!*work || (*work == L'/') || (*work == L'.')) {
/* what was parsed was hostname, so reset pointers and let it parse */
pl->szUserName = pl->szPassword = 0;
work = pl->pUserName - 1;
pl->pUserName = pl->pPassword = 0;
} else goto ERROR;
/* now start parsing hostname or hostnumber */
work++;
pl->pHostName = work;
work = URL_ScanID(pl->pHostName, &pl->szHostName, HOST);
if (*work == L':') {
/* parse port */
work++;
pl->pPort = work;
work = URL_ScanID(pl->pPort, &pl->szPort, PORT);
}
if (*work == L'/') {
/* see if query string */
pl->pQuery = strchrW(work, L'?');
if (pl->pQuery) pl->szQuery = strlenW(pl->pQuery);
}
TRACE("parse successful: scheme=%p(%ld), user=%p(%ld), pass=%p(%ld), host=%p(%ld), port=%p(%ld), query=%p(%ld)\n",
pl->pScheme, pl->szScheme,
pl->pUserName, pl->szUserName,
pl->pPassword, pl->szPassword,
pl->pHostName, pl->szHostName,
pl->pPort, pl->szPort,
pl->pQuery, pl->szQuery);
return S_OK;
ERROR:
FIXME("failed to parse %s\n", debugstr_w(pszUrl));
return E_INVALIDARG;
}
/*************************************************************************
* UrlGetPartA [SHLWAPI.@]
*/
HRESULT WINAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut,
DWORD dwPart, DWORD dwFlags)
{
LPWSTR in, out;
DWORD ret, len, len2;
in = (LPWSTR) HeapAlloc(GetProcessHeap(), 0,
(2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR));
out = in + INTERNET_MAX_URL_LENGTH;
MultiByteToWideChar(0, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH);
len = INTERNET_MAX_URL_LENGTH;
ret = UrlGetPartW(in, out, &len, dwPart, dwFlags);
if (ret != S_OK) {
HeapFree(GetProcessHeap(), 0, in);
return ret;
}
len2 = WideCharToMultiByte(0, 0, out, len, 0, 0, 0, 0);
if (len2 > *pcchOut) {
*pcchOut = len2;
HeapFree(GetProcessHeap(), 0, in);
return E_POINTER;
}
WideCharToMultiByte(0, 0, out, len+1, pszOut, *pcchOut, 0, 0);
*pcchOut = len2;
HeapFree(GetProcessHeap(), 0, in);
return S_OK;
}
/*************************************************************************
* UrlGetPartW [SHLWAPI.@]
*/
HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
DWORD dwPart, DWORD dwFlags)
{
WINE_PARSE_URL pl;
HRESULT ret;
DWORD size, schsize;
LPCWSTR addr, schaddr;
LPWSTR work;
TRACE("(%s %p %p(%ld) %08lx %08lx)\n",
debugstr_w(pszIn), pszOut, pcchOut, *pcchOut, dwPart, dwFlags);
ret = URL_ParseUrl(pszIn, &pl);
if (!ret) {
schaddr = pl.pScheme;
schsize = pl.szScheme;
switch (dwPart) {
case URL_PART_SCHEME:
if (!pl.szScheme) return E_INVALIDARG;
addr = pl.pScheme;
size = pl.szScheme;
break;
case URL_PART_HOSTNAME:
if (!pl.szHostName) return E_INVALIDARG;
addr = pl.pHostName;
size = pl.szHostName;
break;
case URL_PART_USERNAME:
if (!pl.szUserName) return E_INVALIDARG;
addr = pl.pUserName;
size = pl.szUserName;
break;
case URL_PART_PASSWORD:
if (!pl.szPassword) return E_INVALIDARG;
addr = pl.pPassword;
size = pl.szPassword;
break;
case URL_PART_PORT:
if (!pl.szPort) return E_INVALIDARG;
addr = pl.pPort;
size = pl.szPort;
break;
case URL_PART_QUERY:
if (!pl.szQuery) return E_INVALIDARG;
addr = pl.pQuery;
size = pl.szQuery;
break;
default:
return E_INVALIDARG;
}
if (dwFlags == URL_PARTFLAG_KEEPSCHEME) {
if (*pcchOut < size + schsize + 2) {
*pcchOut = size + schsize + 2;
return E_POINTER;
}
strncpyW(pszOut, schaddr, schsize);
work = pszOut + schsize;
*work = L':';
strncpyW(work+1, addr, size);
*pcchOut = size + schsize + 1;
work += (size + 1);
*work = L'\0';
}
else {
if (*pcchOut < size + 1) {*pcchOut = size+1; return E_POINTER;}
strncpyW(pszOut, addr, size);
*pcchOut = size;
work = pszOut + size;
*work = L'\0';
}
TRACE("len=%ld %s\n", *pcchOut, debugstr_w(pszOut));
}
return ret;
}

View File

@ -15,6 +15,30 @@ extern "C" {
#define GCT_WILD 0x0004
#define GCT_SEPARATOR 0x0008
/* These are used by UrlGetPart routine */
typedef enum {
URL_PART_NONE = 0,
URL_PART_SCHEME = 1,
URL_PART_HOSTNAME,
URL_PART_USERNAME,
URL_PART_PASSWORD,
URL_PART_PORT,
URL_PART_QUERY,
} URL_PART;
#define URL_PARTFLAG_KEEPSCHEME 0x00000001
/* These are used by the UrlIs... routines */
typedef enum {
URLIS_URL,
URLIS_OPAQUE,
URLIS_NOHISTORY,
URLIS_FILEURL,
URLIS_APPLIABLE,
URLIS_DIRECTORY,
URLIS_HASQUERY,
} URLIS;
#define URL_WININET_COMPATIBILITY 0x80000000
#define URL_PLUGGABLE_PROTOCOL 0x40000000
#define URL_ESCAPE_UNSAFE 0x20000000
@ -186,6 +210,8 @@ LPSTR WINAPI StrChrIA(LPCSTR lpStart, WORD wMatch);
LPWSTR WINAPI StrChrIW(LPCWSTR lpStart, WCHAR wMatch);
#define StrChrI WINELIB_NAME_AW(StrChrI)
INT WINAPI StrCmpIW(LPCWSTR lpStr1, LPCWSTR lpStr2);
INT WINAPI StrCmpNA(LPCSTR lpStr1, LPCSTR lpStr2, INT nChar);
INT WINAPI StrCmpNW(LPCWSTR lpStr1, LPCWSTR lpStr2, INT nChar);
#define StrCmpN WINELIB_NAME_AW(StrCmpN)
@ -194,6 +220,12 @@ INT WINAPI StrCmpNIA(LPCSTR lpStr1, LPCSTR lpStr2, INT nChar);
INT WINAPI StrCmpNIW(LPCWSTR lpStr1, LPCWSTR lpStr2, INT nChar);
#define StrCmpNI WINELIB_NAME_AW(StrCmpNI)
INT WINAPI StrCmpW(LPCWSTR lpStr1, LPCWSTR lpStr2);
LPWSTR WINAPI StrCpyW(LPWSTR lpStr1, LPCWSTR lpStr2);
LPWSTR WINAPI StrCpyNW(LPWSTR lpStr1, LPCWSTR lpStr2, int n);
LPSTR WINAPI StrDupA(LPCSTR lpSrc);
LPWSTR WINAPI StrDupW(LPCWSTR lpSrc);
#define StrDup WINELIB_NAME_AW(StrDup)
@ -202,6 +234,38 @@ LPSTR WINAPI StrFormatByteSizeA ( DWORD dw, LPSTR pszBuf, UINT cchBuf );
LPWSTR WINAPI StrFormatByteSizeW ( DWORD dw, LPWSTR pszBuf, UINT cchBuf );
#define StrFormatByteSize WINELIB_NAME_AW(StrFormatByteSize)
LPSTR WINAPI StrNCatA(LPSTR front, LPCSTR back, INT cchMax);
LPWSTR WINAPI StrNCatW(LPWSTR front, LPCWSTR back, INT cchMax);
#define StrNCat WINELIB_NAME_AW(StrNCat)
LPSTR WINAPI StrRChrA(LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch);
LPWSTR WINAPI StrRChrW(LPCWSTR lpStart, LPCWSTR lpEnd, WCHAR wMatch);
#define StrRChr WINELIB_NAME_AW(StrRChr)
LPSTR WINAPI StrRChrIA(LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch);
LPWSTR WINAPI StrRChrIW(LPCWSTR lpStart, LPCWSTR lpEnd, WCHAR wMatch);
#define StrRChrI WINELIB_NAME_AW(StrRChrI)
LPSTR WINAPI StrStrA(LPCSTR lpFirst, LPCSTR lpSrch);
LPWSTR WINAPI StrStrW(LPCWSTR lpFirst, LPCWSTR lpSrch);
#define StrStr WINELIB_NAME_AW(StrStr)
LPSTR WINAPI StrStrIA(LPCSTR lpFirst, LPCSTR lpSrch);
LPWSTR WINAPI StrStrIW(LPCWSTR lpFirst, LPCWSTR lpSrch);
#define StrStrI WINELIB_NAME_AW(StrStrI)
int WINAPI StrToIntA(LPCSTR lpSrc);
int WINAPI StrToIntW(LPCWSTR lpSrc);
#define StrToInt WINELIB_NAME_AW(StrToInt)
int WINAPI StrToIntExA(LPCSTR lpSrc, DWORD dwFlags, LPINT piRet);
int WINAPI StrToIntExW(LPCWSTR lpSrc, DWORD dwFlags, LPINT piRet);
#define StrToIntEx WINELIB_NAME_AW(StrToIntEx)
BOOL WINAPI StrTrimA(LPSTR pszSrc, LPCSTR pszTrimChars);
BOOL WINAPI StrTrimW(LPWSTR pszSrc, LPCWSTR pszTrimChars);
#define StrTrim WINELIB_NAME_AW(StrTrim)
INT WINAPI wvnsprintfA(LPSTR lpOut, INT cchLimitIn, LPCSTR lpFmt, va_list arglist);
INT WINAPI wvnsprintfW(LPWSTR lpOut, INT cchLimitIn, LPCWSTR lpFmt, va_list arglist);
#define wvnsprintf WINELIB_NAME_AW(wvnsprintf)
@ -273,6 +337,11 @@ typedef enum {
SHREGENUM_BOTH = 0x11, /* do both HKCU and HKLM without dups */
} SHREGENUM_FLAGS;
#define SHREGSET_HKCU 0x00000001 /* Write to HKCU if empty */
#define SHREGSET_FORCE_HKCU 0x00000002 /* Write to HKCU */
#define SHREGSET_HKLM 0x00000004 /* Write to HKLM if empty */
#define SHREGSET_FORCE_HKLM 0x00000008 /* Write to HKLM */
#define SHREGSET_DEFAULT (SHREGSET_FORCE_HKCU | SHREGSET_HKLM)
/* Shell User Key Registry interfaces */
@ -332,6 +401,11 @@ LONG WINAPI SHRegEnumUSKeyW(HUSKEY hUSKey, DWORD dwIndex, LPWSTR pszName,
SHREGENUM_FLAGS enumRegFlags);
#define SHRegEnumUSKey WINELIB_NAME_AW(SHRegEnumUSKey)
LONG WINAPI SHRegWriteUSValueA(HUSKEY hUSKey, LPCSTR pszValue, DWORD dwType,
LPVOID pvData, DWORD cbData, DWORD dwFlags);
LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType,
LPVOID pvData, DWORD cbData, DWORD dwFlags);
#define SHRegWriteUSValue WINELIB_NAME_AW(SHRegWriteUSValue)
/* Shell URL interfaces */
@ -359,12 +433,30 @@ LPCSTR WINAPI UrlGetLocationA(LPCSTR pszUrl);
LPCWSTR WINAPI UrlGetLocationW(LPCWSTR pszUrl);
#define UrlGetLocation WINELIB_NAME_AW(UrlGetLocation)
HRESULT WINAPI UrlGetPartA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut,
DWORD dwPart, DWORD dwFlags);
HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
DWORD dwPart, DWORD dwFlags);
#define UrlGetPart WINELIB_NAME_AW(UrlGetPart)
BOOL WINAPI HashData(const unsigned char *lpSrc, INT nSrcLen,
unsigned char *lpDest, INT nDestLen);
HRESULT WINAPI UrlHashA(LPCSTR pszUrl, unsigned char *lpDest, INT nDestlen);
HRESULT WINAPI UrlHashW(LPCWSTR pszUrl, unsigned char *lpDest, INT nDestlen);
#define UrlHash WINELIB_NAME_AW(UrlHash)
BOOL WINAPI UrlIsA(LPCSTR pszUrl, URLIS UrlIs);
BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS UrlIs);
#define UrlIs WINELIB_NAME_AW(UrlIs)
BOOL WINAPI UrlIsNoHistoryA(LPCSTR pszUrl);
BOOL WINAPI UrlIsNoHistoryW(LPCWSTR pszUrl);
#define UrlIsNoHistory WINELIB_NAME_AW(UrlIsNoHistory)
BOOL WINAPI UrlIsOpaqueA(LPCSTR pszUrl);
BOOL WINAPI UrlIsOpaqueW(LPCWSTR pszUrl);
#define UrlIsOpaque WINELIB_NAME_AW(UrlIsOpaque)
HRESULT WINAPI UrlUnescapeA(LPCSTR pszUrl, LPSTR pszUnescaped,
LPDWORD pcchUnescaped, DWORD dwFlags);
HRESULT WINAPI UrlUnescapeW(LPCWSTR pszUrl, LPWSTR pszUnescaped,