shlwapi: Import string functions from kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-20 09:12:29 +02:00
parent 931f2e450a
commit 47c131ebcb
5 changed files with 33 additions and 1994 deletions

View File

@ -1,5 +1,6 @@
MODULE = kernelbase.dll
IMPORTS = uuid advapi32 ntdll winecrt0 kernel32
MODULE = kernelbase.dll
IMPORTLIB = kernelbase
IMPORTS = uuid advapi32 ntdll winecrt0 kernel32
EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -mno-cygwin
C_SRCS = \

View File

@ -453,32 +453,32 @@
@ stdcall Shell_NotifyIconA(long ptr)
@ stdcall Shell_NotifyIconW(long ptr)
@ stdcall Shell_NotifyIconGetRect(ptr ptr)
@ stdcall StrChrA(str long) shlwapi.StrChrA
@ stdcall StrChrIA(str long) shlwapi.StrChrIA
@ stdcall StrChrIW(wstr long) shlwapi.StrChrIW
@ stdcall StrChrW(wstr long) shlwapi.StrChrW
@ stdcall StrCmpNA(str str long) shlwapi.StrCmpNA
@ stdcall StrCmpNIA(str str long) shlwapi.StrCmpNIA
@ stdcall StrCmpNIW(wstr wstr long) shlwapi.StrCmpNIW
@ stdcall StrCmpNW(wstr wstr long) shlwapi.StrCmpNW
@ stdcall StrCpyNA (ptr str long) kernel32.lstrcpynA
@ stdcall StrCpyNW(ptr wstr long) shlwapi.StrCpyNW
@ stdcall StrNCmpA(str str long) shlwapi.StrCmpNA
@ stdcall StrNCmpIA(str str long) shlwapi.StrCmpNIA
@ stdcall StrNCmpIW(wstr wstr long) shlwapi.StrCmpNIW
@ stdcall StrNCmpW(wstr wstr long) shlwapi.StrCmpNW
@ stdcall StrNCpyA (ptr str long) kernel32.lstrcpynA
@ stdcall StrNCpyW(ptr wstr long) shlwapi.StrCpyNW
@ stdcall StrRChrA(str str long) shlwapi.StrRChrA
@ stdcall StrRChrIA(str str long) shlwapi.StrRChrIA
@ stdcall StrRChrIW(wstr wstr long) shlwapi.StrRChrIW
@ stdcall StrRChrW(wstr wstr long) shlwapi.StrRChrW
@ stub StrRStrA
@ stdcall StrRStrIA(str str str) shlwapi.StrRStrIA
@ stdcall StrRStrIW(wstr wstr wstr) shlwapi.StrRStrIW
@ stub StrRStrW
@ stdcall StrStrA(str str) shlwapi.StrStrA
@ stdcall StrStrIA(str str) shlwapi.StrStrIA
@ stdcall StrStrIW(wstr wstr) shlwapi.StrStrIW
@ stdcall StrStrW(wstr wstr) shlwapi.StrStrW
@ stdcall -private StrChrA(str long) shlwapi.StrChrA
@ stdcall -private StrChrIA(str long) shlwapi.StrChrIA
@ stdcall -private StrChrIW(wstr long) shlwapi.StrChrIW
@ stdcall -private StrChrW(wstr long) shlwapi.StrChrW
@ stdcall -private StrCmpNA(str str long) shlwapi.StrCmpNA
@ stdcall -private StrCmpNIA(str str long) shlwapi.StrCmpNIA
@ stdcall -private StrCmpNIW(wstr wstr long) shlwapi.StrCmpNIW
@ stdcall -private StrCmpNW(wstr wstr long) shlwapi.StrCmpNW
@ stdcall -private StrCpyNA (ptr str long) kernel32.lstrcpynA
@ stdcall -private StrCpyNW(ptr wstr long) shlwapi.StrCpyNW
@ stdcall -private StrNCmpA(str str long) shlwapi.StrCmpNA
@ stdcall -private StrNCmpIA(str str long) shlwapi.StrCmpNIA
@ stdcall -private StrNCmpIW(wstr wstr long) shlwapi.StrCmpNIW
@ stdcall -private StrNCmpW(wstr wstr long) shlwapi.StrCmpNW
@ stdcall -private StrNCpyA (ptr str long) kernel32.lstrcpynA
@ stdcall -private StrNCpyW(ptr wstr long) shlwapi.StrCpyNW
@ stdcall -private StrRChrA(str str long) shlwapi.StrRChrA
@ stdcall -private StrRChrIA(str str long) shlwapi.StrRChrIA
@ stdcall -private StrRChrIW(wstr wstr long) shlwapi.StrRChrIW
@ stdcall -private StrRChrW(wstr wstr long) shlwapi.StrRChrW
@ stub -private StrRStrA
@ stdcall -private StrRStrIA(str str str) shlwapi.StrRStrIA
@ stdcall -private StrRStrIW(wstr wstr wstr) shlwapi.StrRStrIW
@ stub -private StrRStrW
@ stdcall -private StrStrA(str str) shlwapi.StrStrA
@ stdcall -private StrStrIA(str str) shlwapi.StrStrIA
@ stdcall -private StrStrIW(wstr wstr) shlwapi.StrStrIW
@ stdcall -private StrStrW(wstr wstr) shlwapi.StrStrW
@ stdcall WOWShellExecute(long str str str str long ptr)

View File

@ -1,7 +1,7 @@
EXTRADEFS = -D_SHLWAPI_
MODULE = shlwapi.dll
IMPORTLIB = shlwapi
IMPORTS = uuid user32 gdi32 advapi32
IMPORTS = uuid user32 gdi32 advapi32 kernelbase
DELAYIMPORTS = userenv oleaut32 ole32 comctl32 comdlg32 mpr mlang urlmon shell32 winmm version
C_SRCS = \

View File

@ -445,119 +445,6 @@ exit:
return hr;
}
/*************************************************************************
* @ [SHLWAPI.15]
*
* Get Explorers "AcceptLanguage" setting.
*
* PARAMS
* langbuf [O] Destination for language string
* buflen [I] Length of langbuf in characters
* [0] Success: used length of langbuf
*
* RETURNS
* Success: S_OK. langbuf is set to the language string found.
* Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
* does not contain the setting.
* E_NOT_SUFFICIENT_BUFFER, If the buffer is not big enough
*/
HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
{
static const WCHAR szkeyW[] = {
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
static const WCHAR valueW[] = {
'A','c','c','e','p','t','L','a','n','g','u','a','g','e',0};
DWORD mystrlen, mytype;
DWORD len;
HKEY mykey;
LCID mylcid;
WCHAR *mystr;
LONG lres;
TRACE("(%p, %p) *%p: %d\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
if(!langbuf || !buflen || !*buflen)
return E_FAIL;
mystrlen = (*buflen > 20) ? *buflen : 20 ;
len = mystrlen * sizeof(WCHAR);
mystr = HeapAlloc(GetProcessHeap(), 0, len);
mystr[0] = 0;
RegOpenKeyW(HKEY_CURRENT_USER, szkeyW, &mykey);
lres = RegQueryValueExW(mykey, valueW, 0, &mytype, (PBYTE)mystr, &len);
RegCloseKey(mykey);
len = lstrlenW(mystr);
if (!lres && (*buflen > len)) {
lstrcpyW(langbuf, mystr);
*buflen = len;
HeapFree(GetProcessHeap(), 0, mystr);
return S_OK;
}
/* Did not find a value in the registry or the user buffer is too small */
mylcid = GetUserDefaultLCID();
LcidToRfc1766W(mylcid, mystr, mystrlen);
len = lstrlenW(mystr);
memcpy( langbuf, mystr, min(*buflen, len+1)*sizeof(WCHAR) );
HeapFree(GetProcessHeap(), 0, mystr);
if (*buflen > len) {
*buflen = len;
return S_OK;
}
*buflen = 0;
return E_NOT_SUFFICIENT_BUFFER;
}
/*************************************************************************
* @ [SHLWAPI.14]
*
* Ascii version of GetAcceptLanguagesW.
*/
HRESULT WINAPI GetAcceptLanguagesA( LPSTR langbuf, LPDWORD buflen)
{
WCHAR *langbufW;
DWORD buflenW, convlen;
HRESULT retval;
TRACE("(%p, %p) *%p: %d\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
if(!langbuf || !buflen || !*buflen) return E_FAIL;
buflenW = *buflen;
langbufW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * buflenW);
retval = GetAcceptLanguagesW(langbufW, &buflenW);
if (retval == S_OK)
{
convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, -1, langbuf, *buflen, NULL, NULL);
convlen--; /* do not count the terminating 0 */
}
else /* copy partial string anyway */
{
convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, *buflen, langbuf, *buflen, NULL, NULL);
if (convlen < *buflen)
{
langbuf[convlen] = 0;
convlen--; /* do not count the terminating 0 */
}
else
{
convlen = *buflen;
}
}
*buflen = buflenW ? convlen : 0;
HeapFree(GetProcessHeap(), 0, langbufW);
return retval;
}
/*************************************************************************
* @ [SHLWAPI.23]
*
@ -626,102 +513,6 @@ INT WINAPI SHStringFromGUIDW(REFGUID guid, LPWSTR lpszDest, INT cchMax)
return iLen;
}
/*************************************************************************
* @ [SHLWAPI.30]
*
* Determine if a Unicode character is a blank.
*
* PARAMS
* wc [I] Character to check.
*
* RETURNS
* TRUE, if wc is a blank,
* FALSE otherwise.
*
*/
BOOL WINAPI IsCharBlankW(WCHAR wc)
{
WORD CharType;
return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_BLANK);
}
/*************************************************************************
* @ [SHLWAPI.31]
*
* Determine if a Unicode character is punctuation.
*
* PARAMS
* wc [I] Character to check.
*
* RETURNS
* TRUE, if wc is punctuation,
* FALSE otherwise.
*/
BOOL WINAPI IsCharPunctW(WCHAR wc)
{
WORD CharType;
return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_PUNCT);
}
/*************************************************************************
* @ [SHLWAPI.32]
*
* Determine if a Unicode character is a control character.
*
* PARAMS
* wc [I] Character to check.
*
* RETURNS
* TRUE, if wc is a control character,
* FALSE otherwise.
*/
BOOL WINAPI IsCharCntrlW(WCHAR wc)
{
WORD CharType;
return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_CNTRL);
}
/*************************************************************************
* @ [SHLWAPI.33]
*
* Determine if a Unicode character is a digit.
*
* PARAMS
* wc [I] Character to check.
*
* RETURNS
* TRUE, if wc is a digit,
* FALSE otherwise.
*/
BOOL WINAPI IsCharDigitW(WCHAR wc)
{
WORD CharType;
return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_DIGIT);
}
/*************************************************************************
* @ [SHLWAPI.34]
*
* Determine if a Unicode character is a hex digit.
*
* PARAMS
* wc [I] Character to check.
*
* RETURNS
* TRUE, if wc is a hex digit,
* FALSE otherwise.
*/
BOOL WINAPI IsCharXDigitW(WCHAR wc)
{
WORD CharType;
return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_XDIGIT);
}
/*************************************************************************
* @ [SHLWAPI.35]
*
@ -731,120 +522,6 @@ BOOL WINAPI GetStringType3ExW(LPWSTR src, INT count, LPWORD type)
return GetStringTypeW(CT_CTYPE3, src, count, type);
}
/*************************************************************************
* @ [SHLWAPI.151]
*
* Compare two Ascii strings up to a given length.
*
* PARAMS
* lpszSrc [I] Source string
* lpszCmp [I] String to compare to lpszSrc
* len [I] Maximum length
*
* RETURNS
* A number greater than, less than or equal to 0 depending on whether
* lpszSrc is greater than, less than or equal to lpszCmp.
*/
DWORD WINAPI StrCmpNCA(LPCSTR lpszSrc, LPCSTR lpszCmp, INT len)
{
return StrCmpNA(lpszSrc, lpszCmp, len);
}
/*************************************************************************
* @ [SHLWAPI.152]
*
* Unicode version of StrCmpNCA.
*/
DWORD WINAPI StrCmpNCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, INT len)
{
return StrCmpNW(lpszSrc, lpszCmp, len);
}
/*************************************************************************
* @ [SHLWAPI.153]
*
* Compare two Ascii strings up to a given length, ignoring case.
*
* PARAMS
* lpszSrc [I] Source string
* lpszCmp [I] String to compare to lpszSrc
* len [I] Maximum length
*
* RETURNS
* A number greater than, less than or equal to 0 depending on whether
* lpszSrc is greater than, less than or equal to lpszCmp.
*/
DWORD WINAPI StrCmpNICA(LPCSTR lpszSrc, LPCSTR lpszCmp, DWORD len)
{
return StrCmpNIA(lpszSrc, lpszCmp, len);
}
/*************************************************************************
* @ [SHLWAPI.154]
*
* Unicode version of StrCmpNICA.
*/
DWORD WINAPI StrCmpNICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp, DWORD len)
{
return StrCmpNIW(lpszSrc, lpszCmp, len);
}
/*************************************************************************
* @ [SHLWAPI.155]
*
* Compare two Ascii strings.
*
* PARAMS
* lpszSrc [I] Source string
* lpszCmp [I] String to compare to lpszSrc
*
* RETURNS
* A number greater than, less than or equal to 0 depending on whether
* lpszSrc is greater than, less than or equal to lpszCmp.
*/
DWORD WINAPI StrCmpCA(LPCSTR lpszSrc, LPCSTR lpszCmp)
{
return lstrcmpA(lpszSrc, lpszCmp);
}
/*************************************************************************
* @ [SHLWAPI.156]
*
* Unicode version of StrCmpCA.
*/
DWORD WINAPI StrCmpCW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
{
return lstrcmpW(lpszSrc, lpszCmp);
}
/*************************************************************************
* @ [SHLWAPI.157]
*
* Compare two Ascii strings, ignoring case.
*
* PARAMS
* lpszSrc [I] Source string
* lpszCmp [I] String to compare to lpszSrc
*
* RETURNS
* A number greater than, less than or equal to 0 depending on whether
* lpszSrc is greater than, less than or equal to lpszCmp.
*/
DWORD WINAPI StrCmpICA(LPCSTR lpszSrc, LPCSTR lpszCmp)
{
return lstrcmpiA(lpszSrc, lpszCmp);
}
/*************************************************************************
* @ [SHLWAPI.158]
*
* Unicode version of StrCmpICA.
*/
DWORD WINAPI StrCmpICW(LPCWSTR lpszSrc, LPCWSTR lpszCmp)
{
return lstrcmpiW(lpszSrc, lpszCmp);
}
/*************************************************************************
* @ [SHLWAPI.160]
*

File diff suppressed because it is too large Load Diff