- Forward ordinals 40, 41, 143, 362 to appropriate routines.

- Implement ordinals 155, 350, 351, 352, 418, 436.
- Fake implementation of SHGetInverseCMAP.
- Stub ordinal 209.
- Fix definition of ordinal 7.
- Implement SHGetThreadRef and SHSetThreadRef.
This commit is contained in:
Guy L. Albertelli 2002-02-21 20:09:17 +00:00 committed by Alexandre Julliard
parent a8bba78485
commit df30690e04
3 changed files with 262 additions and 27 deletions

View File

@ -35,6 +35,9 @@ extern HMODULE SHLWAPI_hwinmm;
extern HMODULE SHLWAPI_hcomdlg32; extern HMODULE SHLWAPI_hcomdlg32;
extern HMODULE SHLWAPI_hmpr; extern HMODULE SHLWAPI_hmpr;
extern HMODULE SHLWAPI_hmlang; extern HMODULE SHLWAPI_hmlang;
extern HMODULE SHLWAPI_hversion;
extern DWORD SHLWAPI_ThreadRef_index;
typedef HANDLE HSHARED; /* Shared memory */ typedef HANDLE HSHARED; /* Shared memory */
@ -303,7 +306,7 @@ HSHARED WINAPI SHLWAPI_DupSharedHandle(HSHARED hShared, DWORD dwDstProcId,
* SHLWAPI_8/SHLWAPI_9 - Get/Release a pointer to the shared data * SHLWAPI_8/SHLWAPI_9 - Get/Release a pointer to the shared data
* SHLWAPI_11 - Helper function; Duplicate cross-process handles * SHLWAPI_11 - Helper function; Duplicate cross-process handles
*/ */
HSHARED WINAPI SHLWAPI_7 (DWORD dwProcId, LPCVOID lpvData, DWORD dwSize) HSHARED WINAPI SHLWAPI_7 (DWORD dwProcId, DWORD dwSize, LPCVOID lpvData)
{ {
HANDLE hMap; HANDLE hMap;
LPVOID pMapped; LPVOID pMapped;
@ -874,16 +877,6 @@ BOOL WINAPI SHLWAPI_36(HMENU h1, UINT ui2, UINT h3, LPCWSTR p4)
return AppendMenuW(h1, ui2, h3, p4); return AppendMenuW(h1, ui2, h3, p4);
} }
/*************************************************************************
* @ [SHLWAPI.40]
*
* Get pointer to next Unicode character.
*/
LPCWSTR WINAPI SHLWAPI_40(LPCWSTR str)
{
return *str ? str + 1 : str;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.74] * @ [SHLWAPI.74]
* *
@ -942,6 +935,16 @@ DWORD WINAPI SHLWAPI_154(LPWSTR str1, LPWSTR str2, DWORD len)
return strncmpiW( str1, str2, len ); return strncmpiW( str1, str2, len );
} }
/*************************************************************************
* @ [SHLWAPI.155]
*
* Case sensitive string compare (ASCII). Does not SetLastError().
*/
DWORD WINAPI SHLWAPI_155 ( LPSTR str1, LPSTR str2)
{
return strcmp(str1, str2);
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.156] * @ [SHLWAPI.156]
* *
@ -1218,6 +1221,19 @@ DWORD WINAPI SHLWAPI_208 (
return 1; return 1;
} }
/*************************************************************************
* @ [SHLWAPI.209]
*
* Some sort of memory management process - associated with _208
*/
DWORD WINAPI SHLWAPI_209 (
LPVOID a)
{
FIXME("(%p) stub\n",
a);
return 1;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.210] * @ [SHLWAPI.210]
* *
@ -1786,6 +1802,70 @@ DWORD WINAPI SHLWAPI_346 (
return lstrlenW(dest)+1; return lstrlenW(dest)+1;
} }
/*************************************************************************
* @ [SHLWAPI.350]
*
* seems to be W interface to GetFileVersionInfoSizeA
*/
DWORD WINAPI SHLWAPI_350 (
LPWSTR x,
LPVOID y)
{
static DWORD WINAPI (*pfnFunc)(LPCSTR,LPDWORD) = NULL;
CHAR mbpath[MAX_PATH];
DWORD ret;
GET_FUNC(version, "GetFileVersionInfoSizeA", 0);
WideCharToMultiByte(0, 0, x, -1, mbpath, MAX_PATH, 0, 0);
ret = pfnFunc(mbpath, y);
return 0x208 + ret;
}
/*************************************************************************
* @ [SHLWAPI.351]
*
* seems to be W interface to GetFileVersionInfoA
*/
BOOL WINAPI SHLWAPI_351 (
LPWSTR w, /* [in] path to dll */
DWORD x, /* [in] parm 2 to GetFileVersionInfoA */
DWORD y, /* [in] return value from .350 - assume length */
LPVOID z) /* [in/out] buffer (+0x208 sent to GetFileVersionInfoA) */
{
static BOOL WINAPI (*pfnFunc)(LPCSTR,DWORD,DWORD,LPVOID) = NULL;
CHAR mbpath[MAX_PATH];
GET_FUNC(version, "GetFileVersionInfoA", 0);
WideCharToMultiByte(0, 0, w, -1, mbpath, MAX_PATH, 0, 0);
return pfnFunc(mbpath , x, y-0x208, z+0x208);
}
/*************************************************************************
* @ [SHLWAPI.352]
*
* seems to be W interface to VerQueryValueA
*/
WORD WINAPI SHLWAPI_352 (
LPVOID w, /* [in] buffer from _351 */
LPWSTR x, /* [in] value to retrieve -
converted and passed to VerQueryValueA as #2 */
LPVOID y, /* [out] ver buffer - passed to VerQueryValueA as #3 */
UINT* z) /* [in] ver length - passed to VerQueryValueA as #4 */
{
static WORD WINAPI (*pfnFunc)(LPVOID,LPCSTR,LPVOID*,UINT*) = NULL;
CHAR buf1[MAX_PATH];
WORD ret;
GET_FUNC(version, "VerQueryValueA", 0);
WideCharToMultiByte(0, 0, x, lstrlenW(x)+1, buf1, MAX_PATH, 0, 0);
ret = pfnFunc(w+0x208, buf1, y, z);
if (CompareStringA(GetThreadLocale(), NORM_IGNORECASE, buf1, 1,
"\\StringFileInfo", 15) == 2 /* CSTR_EQUAL */) {
ERR("Need to translate back to wide - should fail now\n");
}
return ret;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.356] * @ [SHLWAPI.356]
*/ */
@ -2067,6 +2147,26 @@ DWORD WINAPI SHLWAPI_413 (DWORD x)
return 0; return 0;
} }
/*************************************************************************
* @ [SHLWAPI.418]
*
* Function seems to do FreeLibrary plus other things.
*
* FIXME native shows the following calls:
* RtlEnterCriticalSection
* LocalFree
* GetProcAddress(Comctl32??, 150L)
* DPA_DeletePtr
* RtlLeaveCriticalSection
* followed by the FreeLibrary.
* The above code may be related to .377 above.
*/
BOOL WINAPI SHLWAPI_418 (HMODULE x)
{
FIXME("(0x%08lx) partial stub\n", (LONG)x);
return FreeLibrary(x);
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.431] * @ [SHLWAPI.431]
*/ */
@ -2076,6 +2176,101 @@ DWORD WINAPI SHLWAPI_431 (DWORD x)
return 0xabba1247; return 0xabba1247;
} }
/*************************************************************************
* @ [SHLWAPI.436]
*
* This is really CLSIDFromString which is exported by ole32.dll,
* however the native shlwapi.dll does *not* import ole32. Nor does
* ole32.dll import this ordinal from shlwapi. Therefore we must conclude
* that MS duplicated the code for CLSIDFromString.
*
* This is a duplicate (with changes for UNICODE) of CLSIDFromString16
* in dlls/ole32/compobj.c
*/
DWORD WINAPI SHLWAPI_436 (LPWSTR idstr, CLSID *id)
{
LPWSTR s = idstr;
BYTE *p;
INT i;
WCHAR table[256];
if (!s) {
memset(s, 0, sizeof(CLSID));
return S_OK;
}
else { /* validate the CLSID string */
if (strlenW(s) != 38)
return CO_E_CLASSSTRING;
if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
return CO_E_CLASSSTRING;
for (i=1; i<37; i++)
{
if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue;
if (!(((s[i] >= L'0') && (s[i] <= L'9')) ||
((s[i] >= L'a') && (s[i] <= L'f')) ||
((s[i] >= L'A') && (s[i] <= L'F')))
)
return CO_E_CLASSSTRING;
}
}
TRACE("%s -> %p\n", debugstr_w(s), id);
/* quick lookup table */
memset(table, 0, 256*sizeof(WCHAR));
for (i = 0; i < 10; i++) {
table['0' + i] = i;
}
for (i = 0; i < 6; i++) {
table['A' + i] = i+10;
table['a' + i] = i+10;
}
/* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
p = (BYTE *) id;
s++; /* skip leading brace */
for (i = 0; i < 4; i++) {
p[3 - i] = table[*s]<<4 | table[*(s+1)];
s += 2;
}
p += 4;
s++; /* skip - */
for (i = 0; i < 2; i++) {
p[1-i] = table[*s]<<4 | table[*(s+1)];
s += 2;
}
p += 2;
s++; /* skip - */
for (i = 0; i < 2; i++) {
p[1-i] = table[*s]<<4 | table[*(s+1)];
s += 2;
}
p += 2;
s++; /* skip - */
/* these are just sequential bytes */
for (i = 0; i < 2; i++) {
*p++ = table[*s]<<4 | table[*(s+1)];
s += 2;
}
s++; /* skip - */
for (i = 0; i < 6; i++) {
*p++ = table[*s]<<4 | table[*(s+1)];
s += 2;
}
return S_OK;
}
/************************************************************************* /*************************************************************************
* @ [SHLWAPI.437] * @ [SHLWAPI.437]
* *
@ -2121,10 +2316,15 @@ HPALETTE WINAPI SHCreateShellPalette(HDC hdc)
/************************************************************************* /*************************************************************************
* SHGetInverseCMAP (SHLWAPI.@) * SHGetInverseCMAP (SHLWAPI.@)
*/ */
DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why) DWORD WINAPI SHGetInverseCMAP (LPDWORD* x, DWORD why)
{ {
FIXME("(%p, %#lx)stub\n", x, why); if (why == 4) {
FIXME(" - returning bogus address for SHGetInverseCMAP\n");
*x = (LPDWORD)0xabba1249;
return 0; return 0;
}
FIXME("(%p, %#lx)stub\n", x, why);
return 0;
} }
/************************************************************************* /*************************************************************************
@ -2166,3 +2366,32 @@ HRESULT WINAPI _SHGetInstanceExplorer (LPUNKNOWN *lpUnknown)
GET_FUNC(shell32, "SHGetInstanceExplorer", E_FAIL); GET_FUNC(shell32, "SHGetInstanceExplorer", E_FAIL);
return pfnFunc(lpUnknown); return pfnFunc(lpUnknown);
} }
/*************************************************************************
* SHGetThreadRef [SHLWAPI.@]
*
* Retrieves the per-thread object reference set by SHSetThreadRef
* "punk" - Address of a pointer to the IUnknown interface. Returns S_OK if
* successful or E_NOINTERFACE otherwise.
*/
HRESULT WINAPI SHGetThreadRef (IUnknown ** ppunk)
{
if (SHLWAPI_ThreadRef_index < 0) return E_NOINTERFACE;
*ppunk = (IUnknown *)TlsGetValue(SHLWAPI_ThreadRef_index);
return S_OK;
}
/*************************************************************************
* SHSetThreadRef [SHLWAPI.@]
*
* Stores a per-thread reference to a COM object
* "punk" - Pointer to the IUnknown interface of the object to
* which you want to store a reference. Returns S_OK if successful
* or an OLE error value.
*/
HRESULT WINAPI SHSetThreadRef (IUnknown * punk)
{
if (SHLWAPI_ThreadRef_index < 0) return E_NOINTERFACE;
TlsSetValue(SHLWAPI_ThreadRef_index, (LPVOID) punk);
return S_OK;
}

View File

@ -16,7 +16,7 @@ debug_channels (shell)
4 stub @ 4 stub @
5 stub @ 5 stub @
6 stub @ 6 stub @
7 stdcall @(long ptr long) SHLWAPI_7 7 stdcall @(long long ptr) SHLWAPI_7
8 stdcall @(long long) SHLWAPI_8 8 stdcall @(long long) SHLWAPI_8
9 stdcall @(ptr) SHLWAPI_9 9 stdcall @(ptr) SHLWAPI_9
10 stdcall @(long long) SHLWAPI_10 10 stdcall @(long long) SHLWAPI_10
@ -49,8 +49,8 @@ debug_channels (shell)
37 forward @ user32.CallWindowProcW 37 forward @ user32.CallWindowProcW
38 forward @ user32.CharLowerW 38 forward @ user32.CharLowerW
39 forward @ user32.CharLowerBuffW 39 forward @ user32.CharLowerBuffW
40 stdcall @(wstr) SHLWAPI_40 40 forward @ user32.CharNextW
41 stub @ 41 forward @ user32.CharPrevW
42 stub @ 42 stub @
43 forward @ user32.CharUpperW 43 forward @ user32.CharUpperW
44 forward @ user32.CharUpperBuffW 44 forward @ user32.CharUpperBuffW
@ -152,7 +152,7 @@ debug_channels (shell)
140 forward @ user32.SetPropW 140 forward @ user32.SetPropW
141 forward @ user32.SetWindowLongW 141 forward @ user32.SetWindowLongW
142 forward @ user32.SetWindowsHookExW 142 forward @ user32.SetWindowsHookExW
143 stub @ 143 forward @ user32.SetWindowTextW
144 forward @ gdi32.StartDocW 144 forward @ gdi32.StartDocW
145 forward @ user32.SystemParametersInfoW 145 forward @ user32.SystemParametersInfoW
146 forward @ user32.TranslateAcceleratorW 146 forward @ user32.TranslateAcceleratorW
@ -164,7 +164,7 @@ debug_channels (shell)
152 stdcall @(wstr wstr long) SHLWAPI_152 152 stdcall @(wstr wstr long) SHLWAPI_152
153 stdcall @(long long long) SHLWAPI_153 153 stdcall @(long long long) SHLWAPI_153
154 stdcall @(wstr wstr long) SHLWAPI_154 154 stdcall @(wstr wstr long) SHLWAPI_154
155 stub @ 155 stdcall @(str str) SHLWAPI_155
156 stdcall @(wstr wstr) SHLWAPI_156 156 stdcall @(wstr wstr) SHLWAPI_156
157 stub @ 157 stub @
158 stdcall @(wstr wstr) SHLWAPI_158 158 stdcall @(wstr wstr) SHLWAPI_158
@ -218,7 +218,7 @@ debug_channels (shell)
206 stdcall @(long wstr wstr ptr ptr ptr) SHLWAPI_206 206 stdcall @(long wstr wstr ptr ptr ptr) SHLWAPI_206
207 stub @ 207 stub @
208 stdcall @(long long ptr ptr long) SHLWAPI_208 208 stdcall @(long long ptr ptr long) SHLWAPI_208
209 stub @ 209 stdcall @(ptr) SHLWAPI_209
210 stdcall @(ptr long ptr) SHLWAPI_210 210 stdcall @(ptr long ptr) SHLWAPI_210
211 stdcall @(ptr long) SHLWAPI_211 211 stdcall @(ptr long) SHLWAPI_211
212 stub @ 212 stub @
@ -359,9 +359,9 @@ debug_channels (shell)
347 forward @ advapi32.RegDeleteValueW 347 forward @ advapi32.RegDeleteValueW
348 stub @ 348 stub @
349 stub @ 349 stub @
350 stub @ 350 stdcall @(wstr ptr) SHLWAPI_350
351 stub @ 351 stdcall @(wstr ptr long ptr) SHLWAPI_351
352 stub @ 352 stdcall @(ptr wstr ptr ptr) SHLWAPI_352
353 stub @ 353 stub @
354 stub @ 354 stub @
355 stub @ 355 stub @
@ -371,7 +371,7 @@ debug_channels (shell)
359 forward @ kernel32.OpenEventW 359 forward @ kernel32.OpenEventW
360 forward @ kernel32.RemoveDirectoryW 360 forward @ kernel32.RemoveDirectoryW
361 forward @ kernel32.GetShortPathNameW 361 forward @ kernel32.GetShortPathNameW
362 stub @ 362 forward @ advapi32.GetUserNameW
363 stub @ 363 stub @
364 stdcall @(str str long) SHLWAPI_364 364 stdcall @(str str long) SHLWAPI_364
365 stub @ 365 stub @
@ -427,7 +427,7 @@ debug_channels (shell)
415 stub @ 415 stub @
416 stub @ 416 stub @
417 stub @ 417 stub @
418 stub @ 418 stdcall @(long) SHLWAPI_418
419 stub @ 419 stub @
420 stub @ 420 stub @
421 stub @ 421 stub @
@ -445,7 +445,7 @@ debug_channels (shell)
433 stub @ 433 stub @
434 forward @ user32.SendMessageTimeoutW 434 forward @ user32.SendMessageTimeoutW
435 stub @ 435 stub @
436 stub @ 436 stdcall @(wstr ptr) SHLWAPI_436
437 stdcall @(long) SHLWAPI_437 437 stdcall @(long) SHLWAPI_437
438 stub @ 438 stub @
439 stub @ 439 stub @
@ -722,12 +722,12 @@ debug_channels (shell)
@ stub SHCreateStreamOnFileW @ stub SHCreateStreamOnFileW
@ stub SHCreateStreamWrapper @ stub SHCreateStreamWrapper
@ stub SHCreateThread @ stub SHCreateThread
@ stub SHGetThreadRef @ stdcall SHGetThreadRef (ptr) SHGetThreadRef
@ stdcall SHRegDuplicateHKey (long) SHRegDuplicateHKey @ stdcall SHRegDuplicateHKey (long) SHRegDuplicateHKey
@ stdcall SHRegSetPathA(long str str str long) SHRegSetPathA @ stdcall SHRegSetPathA(long str str str long) SHRegSetPathA
@ stdcall SHRegSetPathW(long wstr wstr wstr long) SHRegSetPathW @ stdcall SHRegSetPathW(long wstr wstr wstr long) SHRegSetPathW
@ stub SHRegisterValidateTemplate @ stub SHRegisterValidateTemplate
@ stub SHSetThreadRef @ stdcall SHSetThreadRef (ptr) SHSetThreadRef
@ stub SHSkipJunction @ stub SHSkipJunction
@ stub SHStrDupA @ stub SHStrDupA
@ stub SHStrDupW @ stub SHStrDupW

View File

@ -20,6 +20,9 @@ HMODULE SHLWAPI_hwinmm = 0;
HMODULE SHLWAPI_hcomdlg32 = 0; HMODULE SHLWAPI_hcomdlg32 = 0;
HMODULE SHLWAPI_hmpr = 0; HMODULE SHLWAPI_hmpr = 0;
HMODULE SHLWAPI_hmlang = 0; HMODULE SHLWAPI_hmlang = 0;
HMODULE SHLWAPI_hversion = 0;
DWORD SHLWAPI_ThreadRef_index = -1;
/************************************************************************* /*************************************************************************
* SHLWAPI LibMain * SHLWAPI LibMain
@ -34,6 +37,7 @@ BOOL WINAPI SHLWAPI_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
shlwapi_hInstance = hinstDLL; shlwapi_hInstance = hinstDLL;
SHLWAPI_ThreadRef_index = TlsAlloc();
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (SHLWAPI_hshell32) FreeLibrary(SHLWAPI_hshell32); if (SHLWAPI_hshell32) FreeLibrary(SHLWAPI_hshell32);
@ -41,6 +45,8 @@ BOOL WINAPI SHLWAPI_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad
if (SHLWAPI_hcomdlg32) FreeLibrary(SHLWAPI_hcomdlg32); if (SHLWAPI_hcomdlg32) FreeLibrary(SHLWAPI_hcomdlg32);
if (SHLWAPI_hmpr) FreeLibrary(SHLWAPI_hmpr); if (SHLWAPI_hmpr) FreeLibrary(SHLWAPI_hmpr);
if (SHLWAPI_hmlang) FreeLibrary(SHLWAPI_hmlang); if (SHLWAPI_hmlang) FreeLibrary(SHLWAPI_hmlang);
if (SHLWAPI_hversion) FreeLibrary(SHLWAPI_hversion);
if (SHLWAPI_ThreadRef_index >= 0) TlsFree(SHLWAPI_ThreadRef_index);
break; break;
} }
return TRUE; return TRUE;