sync shlwapi to wine 1.1.32

svn path=/trunk/; revision=44083
This commit is contained in:
Christoph von Wittich 2009-11-10 21:36:55 +00:00
parent 2afeb94e20
commit a72dd3434c
2 changed files with 38 additions and 59 deletions

View file

@ -221,7 +221,7 @@ static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, D
return STG_E_INVALIDFUNCTION; return STG_E_INVALIDFUNCTION;
/* we cut off the high part here */ /* we cut off the high part here */
This->dwPos = tmp.LowPart; This->dwPos = tmp.u.LowPart;
if (plibNewPosition) if (plibNewPosition)
plibNewPosition->QuadPart = This->dwPos; plibNewPosition->QuadPart = This->dwPos;
@ -240,7 +240,7 @@ static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewS
TRACE("(%p, %s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart)); TRACE("(%p, %s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart));
/* we cut off the high part here */ /* we cut off the high part here */
newLen = libNewSize.LowPart; newLen = libNewSize.u.LowPart;
newBuf = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pbBuffer, newLen); newBuf = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pbBuffer, newLen);
if (!newBuf) if (!newBuf)
return STG_E_INSUFFICIENTMEMORY; return STG_E_INSUFFICIENTMEMORY;

View file

@ -145,40 +145,29 @@ static DWORD get_scheme_code(LPCWSTR scheme, DWORD scheme_len)
HRESULT WINAPI ParseURLA(LPCSTR x, PARSEDURLA *y) HRESULT WINAPI ParseURLA(LPCSTR x, PARSEDURLA *y)
{ {
WCHAR scheme[INTERNET_MAX_SCHEME_LENGTH]; WCHAR scheme[INTERNET_MAX_SCHEME_LENGTH];
DWORD cnt, len; const char *ptr = x;
int len;
y->nScheme = URL_SCHEME_INVALID; TRACE("%s %p\n", debugstr_a(x), y);
if (y->cbSize != sizeof(*y)) return E_INVALIDARG;
/* FIXME: leading white space generates error of 0x80041001 which
* is undefined
*/
if (*x <= ' ') return 0x80041001;
cnt = 0;
y->cchProtocol = 0;
y->pszProtocol = x;
while (*x) {
if (*x == ':') {
y->cchProtocol = cnt;
cnt = -1;
y->pszSuffix = x+1;
break;
}
x++;
cnt++;
}
/* check for no scheme in string start */ if(y->cbSize != sizeof(*y))
/* (apparently schemes *must* be larger than a single character) */ return E_INVALIDARG;
if ((*x == '\0') || (y->cchProtocol <= 1)) {
while(*ptr && (isalnum(*ptr) || *ptr == '-'))
ptr++;
if (*ptr != ':' || ptr <= x+1) {
y->pszProtocol = NULL; y->pszProtocol = NULL;
return 0x80041001; return 0x80041001;
} }
/* found scheme, set length of remainder */ y->pszProtocol = x;
y->cchSuffix = lstrlenA(y->pszSuffix); y->cchProtocol = ptr-x;
y->pszSuffix = ptr+1;
y->cchSuffix = strlen(y->pszSuffix);
len = MultiByteToWideChar(CP_ACP, 0, y->pszProtocol, y->cchProtocol, len = MultiByteToWideChar(CP_ACP, 0, x, ptr-x,
scheme, sizeof(scheme)/sizeof(WCHAR)); scheme, sizeof(scheme)/sizeof(WCHAR));
y->nScheme = get_scheme_code(scheme, len); y->nScheme = get_scheme_code(scheme, len);
return S_OK; return S_OK;
@ -191,38 +180,26 @@ HRESULT WINAPI ParseURLA(LPCSTR x, PARSEDURLA *y)
*/ */
HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y) HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y)
{ {
DWORD cnt; const WCHAR *ptr = x;
y->nScheme = URL_SCHEME_INVALID; TRACE("%s %p\n", debugstr_w(x), y);
if (y->cbSize != sizeof(*y)) return E_INVALIDARG;
/* FIXME: leading white space generates error of 0x80041001 which
* is undefined
*/
if (*x <= ' ') return 0x80041001;
cnt = 0;
y->cchProtocol = 0;
y->pszProtocol = x;
while (*x) {
if (*x == ':') {
y->cchProtocol = cnt;
cnt = -1;
y->pszSuffix = x+1;
break;
}
x++;
cnt++;
}
/* check for no scheme in string start */ if(y->cbSize != sizeof(*y))
/* (apparently schemes *must* be larger than a single character) */ return E_INVALIDARG;
if ((*x == '\0') || (y->cchProtocol <= 1)) {
while(*ptr && (isalnumW(*ptr) || *ptr == '-'))
ptr++;
if (*ptr != ':' || ptr <= x+1) {
y->pszProtocol = NULL; y->pszProtocol = NULL;
return 0x80041001; return 0x80041001;
} }
/* found scheme, set length of remainder */ y->pszProtocol = x;
y->cchSuffix = lstrlenW(y->pszSuffix); y->cchProtocol = ptr-x;
y->nScheme = get_scheme_code(y->pszProtocol, y->cchProtocol); y->pszSuffix = ptr+1;
y->cchSuffix = strlenW(y->pszSuffix);
y->nScheme = get_scheme_code(x, ptr-x);
return S_OK; return S_OK;
} }
@ -2141,6 +2118,7 @@ HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut,
BOOL WINAPI PathIsURLA(LPCSTR lpstrPath) BOOL WINAPI PathIsURLA(LPCSTR lpstrPath)
{ {
PARSEDURLA base; PARSEDURLA base;
HRESULT hres;
TRACE("%s\n", debugstr_a(lpstrPath)); TRACE("%s\n", debugstr_a(lpstrPath));
@ -2148,8 +2126,8 @@ BOOL WINAPI PathIsURLA(LPCSTR lpstrPath)
/* get protocol */ /* get protocol */
base.cbSize = sizeof(base); base.cbSize = sizeof(base);
ParseURLA(lpstrPath, &base); hres = ParseURLA(lpstrPath, &base);
return (base.nScheme != URL_SCHEME_INVALID); return hres == S_OK && (base.nScheme != URL_SCHEME_INVALID);
} }
/************************************************************************* /*************************************************************************
@ -2160,6 +2138,7 @@ BOOL WINAPI PathIsURLA(LPCSTR lpstrPath)
BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath) BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
{ {
PARSEDURLW base; PARSEDURLW base;
HRESULT hres;
TRACE("%s\n", debugstr_w(lpstrPath)); TRACE("%s\n", debugstr_w(lpstrPath));
@ -2167,8 +2146,8 @@ BOOL WINAPI PathIsURLW(LPCWSTR lpstrPath)
/* get protocol */ /* get protocol */
base.cbSize = sizeof(base); base.cbSize = sizeof(base);
ParseURLW(lpstrPath, &base); hres = ParseURLW(lpstrPath, &base);
return (base.nScheme != URL_SCHEME_INVALID); return hres == S_OK && (base.nScheme != URL_SCHEME_INVALID);
} }
/************************************************************************* /*************************************************************************