mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[SHLWAPI] Move all remaining kernelbase functions to kernelbase.c
This way the other files are almost completely identical to Wine-10 and once we export those functions from kernelbase, we can delete them from there.
This commit is contained in:
@@ -16,6 +16,7 @@ list(APPEND SOURCE
|
||||
appcompat.c
|
||||
clist.c
|
||||
istream.c
|
||||
kernelbase.c
|
||||
msgbox.c
|
||||
ordinal.c
|
||||
path.c
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -497,119 +497,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]
|
||||
*
|
||||
@@ -678,102 +565,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]
|
||||
*
|
||||
@@ -2279,57 +2070,6 @@ BOOL WINAPI FDSA_DeleteItem(FDSA_info *info, DWORD where)
|
||||
info->num_items--;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* @ [SHLWAPI.219]
|
||||
*
|
||||
* Call IUnknown_QueryInterface() on a table of objects.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK.
|
||||
* Failure: E_POINTER or E_NOINTERFACE.
|
||||
*/
|
||||
HRESULT WINAPI QISearch(
|
||||
void *base, /* [in] Table of interfaces */
|
||||
const QITAB *table, /* [in] Array of REFIIDs and indexes into the table */
|
||||
REFIID riid, /* [in] REFIID to get interface for */
|
||||
void **ppv) /* [out] Destination for interface pointer */
|
||||
{
|
||||
HRESULT ret;
|
||||
IUnknown *a_vtbl;
|
||||
const QITAB *xmove;
|
||||
|
||||
TRACE("(%p %p %s %p)\n", base, table, debugstr_guid(riid), ppv);
|
||||
if (ppv) {
|
||||
xmove = table;
|
||||
while (xmove->piid) {
|
||||
TRACE("trying (offset %d) %s\n", xmove->dwOffset, debugstr_guid(xmove->piid));
|
||||
if (IsEqualIID(riid, xmove->piid)) {
|
||||
a_vtbl = (IUnknown*)(xmove->dwOffset + (LPBYTE)base);
|
||||
TRACE("matched, returning (%p)\n", a_vtbl);
|
||||
*ppv = a_vtbl;
|
||||
IUnknown_AddRef(a_vtbl);
|
||||
return S_OK;
|
||||
}
|
||||
xmove++;
|
||||
}
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown)) {
|
||||
a_vtbl = (IUnknown*)(table->dwOffset + (LPBYTE)base);
|
||||
TRACE("returning first for IUnknown (%p)\n", a_vtbl);
|
||||
*ppv = a_vtbl;
|
||||
IUnknown_AddRef(a_vtbl);
|
||||
return S_OK;
|
||||
}
|
||||
*ppv = 0;
|
||||
ret = E_NOINTERFACE;
|
||||
} else
|
||||
ret = E_POINTER;
|
||||
|
||||
TRACE("-- 0x%08x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* @ [SHLWAPI.220]
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1304,27 +1304,3 @@ BOOL WINAPI DoesStringRoundTripW(LPCWSTR lpSrcStr, LPSTR lpDst, INT iLen)
|
||||
return !wcscmp(lpSrcStr, szBuff);
|
||||
}
|
||||
|
||||
BOOL WINAPI IsCharSpaceA(CHAR c)
|
||||
{
|
||||
WORD CharType;
|
||||
return GetStringTypeA(GetSystemDefaultLCID(), CT_CTYPE1, &c, 1, &CharType) && (CharType & C1_SPACE);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* @ [SHLWAPI.29]
|
||||
*
|
||||
* Determine if a Unicode character is a space.
|
||||
*
|
||||
* PARAMS
|
||||
* wc [I] Character to check.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE, if wc is a space,
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
BOOL WINAPI IsCharSpaceW(WCHAR wc)
|
||||
{
|
||||
WORD CharType;
|
||||
|
||||
return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_SPACE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user