Commit 905f04a9 authored by Guy L. Albertelli's avatar Guy L. Albertelli Committed by Alexandre Julliard

- Stub routines for _164, _208, _210, _211, _239, _356, _413, _437,

ColorRGBToHLS - Implement routines for _172, _174, _176, _199, _215, _219, _236, _377, _378, UrlCompare{A|W}, UrlApplyScheme{A|W}. - Fix routines _217, _169, _240, _276, _342, _376.
parent c7de3401
......@@ -1063,6 +1063,56 @@ LPCWSTR WINAPI UrlGetLocationW(
}
/*************************************************************************
* UrlCompareA [SHLWAPI.@]
*/
INT WINAPI UrlCompareA(
LPCSTR pszUrl1,
LPCSTR pszUrl2,
BOOL fIgnoreSlash)
{
INT ret, len, len1, len2;
if (!fIgnoreSlash)
return strcmp(pszUrl1, pszUrl2);
len1 = strlen(pszUrl1);
if (pszUrl1[len1-1] == L'/') len1--;
len2 = strlen(pszUrl2);
if (pszUrl2[len2-1] == L'/') len2--;
if (len1 == len2)
return strncmp(pszUrl1, pszUrl2, len1);
len = min(len1, len2);
ret = strncmp(pszUrl1, pszUrl2, len);
if (ret) return ret;
if (len1 > len2) return 1;
return -1;
}
/*************************************************************************
* UrlCompareW [SHLWAPI.@]
*/
INT WINAPI UrlCompareW(
LPCWSTR pszUrl1,
LPCWSTR pszUrl2,
BOOL fIgnoreSlash)
{
INT ret, len, len1, len2;
if (!fIgnoreSlash)
return strcmpW(pszUrl1, pszUrl2);
len1 = strlenW(pszUrl1);
if (pszUrl1[len1-1] == L'/') len1--;
len2 = strlenW(pszUrl2);
if (pszUrl2[len2-1] == L'/') len2--;
if (len1 == len2)
return strncmpW(pszUrl1, pszUrl2, len1);
len = min(len1, len2);
ret = strncmpW(pszUrl1, pszUrl2, len);
if (ret) return ret;
if (len1 > len2) return 1;
return -1;
}
/*************************************************************************
* HashData [SHLWAPI.@]
*
* Hash an input block into a variable sized digest.
......@@ -1110,15 +1160,181 @@ HRESULT WINAPI UrlHashA(LPCSTR pszUrl, unsigned char *lpDest, INT nDestLen)
}
/*************************************************************************
* UrlApplySchemeA [SHLWAPI.@]
*/
HRESULT WINAPI UrlApplySchemeA(LPCSTR pszIn, LPSTR pszOut, LPDWORD pcchOut, DWORD dwFlags)
{
LPWSTR in, out;
DWORD ret, len, len2;
TRACE("(in %s, out size %ld, flags %08lx) using W version\n",
debugstr_a(pszIn), *pcchOut, dwFlags);
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 = UrlApplySchemeW(in, out, &len, dwFlags);
if ((ret != S_OK) && (ret != S_FALSE)) {
HeapFree(GetProcessHeap(), 0, in);
return ret;
}
len2 = WideCharToMultiByte(0, 0, out, len+1, 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 ret;
}
HRESULT URL_GuessScheme(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut)
{
HKEY newkey;
BOOL j;
INT index, i;
DWORD value_len, data_len, dwType;
WCHAR reg_path[MAX_PATH];
WCHAR value[MAX_PATH], data[MAX_PATH];
WCHAR Wxx, Wyy;
MultiByteToWideChar(0, 0,
"Software\\Microsoft\\Windows\\CurrentVersion\\URL\\Prefixes",
-1, reg_path, MAX_PATH);
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey);
index = 0;
while(value_len = data_len = MAX_PATH,
RegEnumValueW(newkey, index, value, &value_len,
0, &dwType, (LPVOID)data, &data_len) == 0) {
TRACE("guess %d %s is %s\n",
index, debugstr_w(value), debugstr_w(data));
j = FALSE;
for(i=0; i<value_len; i++) {
Wxx = pszIn[i];
Wyy = value[i];
/* remember that TRUE is not-equal */
j = ChrCmpIW(Wxx, Wyy);
if (j) break;
}
if ((i == value_len) && !j) {
if (strlenW(data) + strlenW(pszIn) + 1 > *pcchOut) {
*pcchOut = strlenW(data) + strlenW(pszIn) + 1;
RegCloseKey(newkey);
return E_POINTER;
}
strcpyW(pszOut, data);
strcatW(pszOut, pszIn);
*pcchOut = strlenW(pszOut);
TRACE("matched and set to %s\n", debugstr_w(pszOut));
RegCloseKey(newkey);
return S_OK;
}
index++;
}
RegCloseKey(newkey);
return -1;
}
HRESULT URL_ApplyDefault(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut)
{
HKEY newkey;
DWORD data_len, dwType;
WCHAR reg_path[MAX_PATH];
WCHAR value[MAX_PATH], data[MAX_PATH];
/* get and prepend default */
MultiByteToWideChar(0, 0,
"Software\\Microsoft\\Windows\\CurrentVersion\\URL\\DefaultPrefix",
-1, reg_path, MAX_PATH);
RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey);
data_len = MAX_PATH;
value[0] = L'@';
value[1] = L'\0';
RegQueryValueExW(newkey, value, 0, &dwType, (LPBYTE)data, &data_len);
RegCloseKey(newkey);
if (strlenW(data) + strlenW(pszIn) + 1 > *pcchOut) {
*pcchOut = strlenW(data) + strlenW(pszIn) + 1;
return E_POINTER;
}
strcpyW(pszOut, data);
strcatW(pszOut, pszIn);
*pcchOut = strlenW(pszOut);
TRACE("used default %s\n", debugstr_w(pszOut));
return S_OK;
}
/*************************************************************************
* UrlApplySchemeW [SHLWAPI.@]
*/
HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwFlags)
{
HRESULT err = NOERROR;
FIXME("(%s %p %p %08lx): stub !\n", debugstr_w(pszIn), pszOut, pcchOut, dwFlags);
UNKNOWN_SHLWAPI_2 in_scheme;
DWORD res1;
HRESULT ret;
TRACE("(in %s, out size %ld, flags %08lx)\n",
debugstr_w(pszIn), *pcchOut, dwFlags);
if (dwFlags & URL_APPLY_GUESSFILE) {
FIXME("(%s %p %p(%ld) 0x%08lx): stub URL_APPLY_GUESSFILE not implemented\n",
debugstr_w(pszIn), pszOut, pcchOut, *pcchOut, dwFlags);
strcpyW(pszOut, pszIn);
*pcchOut = strlenW(pszOut);
return S_FALSE;
}
in_scheme.size = 24;
/* See if the base has a scheme */
res1 = SHLWAPI_2(pszIn, &in_scheme);
if (res1) {
/* no scheme in input, need to see if we need to guess */
if (dwFlags & URL_APPLY_GUESSSCHEME) {
if ((ret = URL_GuessScheme(pszIn, pszOut, pcchOut)) != -1)
return ret;
}
}
else {
/* we have a scheme, see if valid (known scheme) */
if (in_scheme.fcncde) {
/* have valid scheme, so just copy and exit */
if (strlenW(pszIn) + 1 > *pcchOut) {
*pcchOut = strlenW(pszIn) + 1;
return E_POINTER;
}
strcpyW(pszOut, pszIn);
*pcchOut = strlenW(pszOut);
TRACE("valid scheme, returing copy\n");
return S_OK;
}
}
/* If we are here, then either invalid scheme,
* or no scheme and can't/failed guess.
*/
if ( ( ((res1 == 0) && (dwFlags & URL_APPLY_FORCEAPPLY)) ||
((res1 != 0)) ) &&
(dwFlags & URL_APPLY_DEFAULT)) {
/* find and apply default scheme */
return URL_ApplyDefault(pszIn, pszOut, pcchOut);
}
/* just copy and give proper return code */
if (strlenW(pszIn) + 1 > *pcchOut) {
*pcchOut = strlenW(pszIn) + 1;
return E_POINTER;
}
strcpyW(pszOut, pszIn);
*pcchOut = (err != E_POINTER) ? strlenW(pszOut) : 0;
return err;
*pcchOut = strlenW(pszOut);
TRACE("returing copy, left alone\n");
return S_FALSE;
}
/*************************************************************************
......
......@@ -39,6 +39,40 @@ typedef enum {
URLIS_HASQUERY,
} URLIS;
/* This is used by the UrlApplyScheme... routines */
#define URL_APPLY_FORCEAPPLY 0x00000008
#define URL_APPLY_GUESSFILE 0x00000004
#define URL_APPLY_GUESSSCHEME 0x00000002
#define URL_APPLY_DEFAULT 0x00000001
/* This is used by shlwapi ordinal.1 & .2 */
typedef enum {
URL_SCHEME_INVALID = -1,
URL_SCHEME_UNKNOWN = 0,
URL_SCHEME_FTP,
URL_SCHEME_HTTP,
URL_SCHEME_GOPHER,
URL_SCHEME_MAILTO,
URL_SCHEME_NEWS,
URL_SCHEME_NNTP,
URL_SCHEME_TELNET,
URL_SCHEME_WAIS,
URL_SCHEME_FILE,
URL_SCHEME_MK,
URL_SCHEME_HTTPS,
URL_SCHEME_SHELL,
URL_SCHEME_SNEWS,
URL_SCHEME_LOCAL,
URL_SCHEME_JAVASCRIPT,
URL_SCHEME_VBSCRIPT,
URL_SCHEME_ABOUT,
URL_SCHEME_RES,
URL_SCHEME_MAXVALUE
} URL_SCHEME;
/* The following are used by UrlEscape..., UrlUnEscape...,
* UrlCanonicalize..., and UrlCombine... routines
*/
#define URL_WININET_COMPATIBILITY 0x80000000
#define URL_PLUGGABLE_PROTOCOL 0x40000000
#define URL_ESCAPE_UNSAFE 0x20000000
......@@ -169,6 +203,10 @@ BOOL WINAPI PathRemoveFileSpecA(LPSTR lpszPath);
BOOL WINAPI PathRemoveFileSpecW(LPWSTR lpszPath);
#define PathRemoveFileSpec WINELIB_NAME_AW(PathRemoveFileSpec)
BOOL WINAPI PathRenameExtensionA(LPSTR pszPath, LPCSTR pszExt);
BOOL WINAPI PathRenameExtensionW(LPWSTR pszPath, LPCWSTR pszExt);
#define PathRenameExtension WINELIB_NAME_AW(PathRenameExtension)
BOOL WINAPI PathSetDlgItemPathA(HWND hDlg, int id, LPCSTR pszPath);
BOOL WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR pszPath);
#define PathSetDlgItemPath WINELIB_NAME_AW(PathSetDlgItemPath)
......@@ -186,6 +224,10 @@ void WINAPI PathUnquoteSpacesW(LPWSTR str);
#define PathUnquoteSpaces WINELIB_NAME_AW(PathUnquoteSpaces)
BOOL WINAPI ChrCmpIA (WORD w1, WORD w2);
BOOL WINAPI ChrCmpIW (WCHAR w1, WCHAR w2);
#define ChrCmpI WINELIB_NAME_AW(ChrCmpI)
INT WINAPI StrCSpnA(LPCSTR lpStr, LPCSTR lpSet);
INT WINAPI StrCSpnW(LPCWSTR lpStr, LPCWSTR lpSet);
#define StrCSpn WINELIB_NAME_AW(StrCSpn)
......@@ -300,6 +342,8 @@ DWORD WINAPI SHDeleteEmptyKeyA(HKEY hKey, LPCSTR lpszSubKey);
DWORD WINAPI SHDeleteEmptyKeyW(HKEY hKey, LPCWSTR lpszSubKey);
#define SHDeleteEmptyKey WINELIB_NAME_AW(SHDeleteEmptyKey)
HKEY WINAPI SHRegDuplicateHKey(HKEY hKey);
DWORD WINAPI SHRegGetPathA(HKEY hKey, LPCSTR pcszSubKey,
LPCSTR pcszValue, LPSTR pszPath, DWORD dwFlags);
DWORD WINAPI SHRegGetPathW(HKEY hKey, LPCWSTR pcszSubKey,
......@@ -409,6 +453,12 @@ LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType,
/* Shell URL interfaces */
HRESULT WINAPI UrlApplySchemeA(LPCSTR pszIn, LPSTR pszOut,
LPDWORD pcchOut, DWORD dwFlags);
HRESULT WINAPI UrlApplySchemeW(LPCWSTR pszIn, LPWSTR pszOut,
LPDWORD pcchOut, DWORD dwFlags);
#define UrlApplyScheme WINELIB_NAME_AW(UrlApplyScheme)
HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized,
LPDWORD pcchCanonicalized, DWORD dwFlags);
HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
......@@ -423,6 +473,10 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative,
DWORD dwFlags);
#define UrlCombine WINELIB_NAME_AW(UrlCombine)
INT WINAPI UrlCompareA(LPCSTR pszUrl1, LPCSTR pszUrl2, BOOL fIgnoreSlash);
INT WINAPI UrlCompareW(LPCWSTR pszUrl1, LPCWSTR pszUrl2, BOOL fIgnoreSlash);
#define UrlCompare WINELIB_NAME_AW(UrlCompare)
HRESULT WINAPI UrlEscapeA(LPCSTR pszUrl, LPSTR pszEscaped, LPDWORD pcchEscaped,
DWORD dwFlags);
HRESULT WINAPI UrlEscapeW(LPCWSTR pszUrl, LPWSTR pszEscaped,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment