2 * SHLWAPI ordinal functions
4 * Copyright 1997 Marcus Meissner
19 #include "wine/unicode.h"
20 #include "wine/obj_base.h"
21 #include "wine/obj_inplace.h"
22 #include "wine/obj_serviceprovider.h"
26 #include "debugtools.h"
30 DEFAULT_DEBUG_CHANNEL(shell
);
32 extern HINSTANCE shlwapi_hInstance
;
33 extern HMODULE SHLWAPI_hshell32
;
34 extern HMODULE SHLWAPI_hwinmm
;
35 extern HMODULE SHLWAPI_hcomdlg32
;
36 extern HMODULE SHLWAPI_hmpr
;
37 extern HMODULE SHLWAPI_hmlang
;
39 /* following is GUID for IObjectWithSite::SetSite -- see _174 */
40 static DWORD id1
[4] = {0xfc4801a3, 0x11cf2ba9, 0xaa0029a2, 0x52733d00};
41 /* following is GUID for IPersistMoniker::GetClassID -- see _174 */
42 static DWORD id2
[4] = {0x79eac9ee, 0x11cebaf9, 0xaa00828c, 0x0ba94b00};
44 /* The following schemes were identified in the native version of
45 * SHLWAPI.DLL version 5.50
48 URL_SCHEME_INVALID
= -1,
49 URL_SCHEME_UNKNOWN
= 0,
64 URL_SCHEME_JAVASCRIPT
,
72 URL_SCHEME scheme_number
;
76 static const SHL_2_inet_scheme shlwapi_schemes
[] = {
77 {URL_SCHEME_FTP
, "ftp"},
78 {URL_SCHEME_HTTP
, "http"},
79 {URL_SCHEME_GOPHER
, "gopher"},
80 {URL_SCHEME_MAILTO
, "mailto"},
81 {URL_SCHEME_NEWS
, "news"},
82 {URL_SCHEME_NNTP
, "nntp"},
83 {URL_SCHEME_TELNET
, "telnet"},
84 {URL_SCHEME_WAIS
, "wais"},
85 {URL_SCHEME_FILE
, "file"},
86 {URL_SCHEME_MK
, "mk"},
87 {URL_SCHEME_HTTPS
, "https"},
88 {URL_SCHEME_SHELL
, "shell"},
89 {URL_SCHEME_SNEWS
, "snews"},
90 {URL_SCHEME_LOCAL
, "local"},
91 {URL_SCHEME_JAVASCRIPT
, "javascript"},
92 {URL_SCHEME_VBSCRIPT
, "vbscript"},
93 {URL_SCHEME_ABOUT
, "about"},
94 {URL_SCHEME_RES
, "res"},
98 /* Macro to get function pointer for a module*/
99 #define GET_FUNC(module, name, fail) \
100 if (!SHLWAPI_h##module) SHLWAPI_h##module = LoadLibraryA(#module ".dll"); \
101 if (!SHLWAPI_h##module) return fail; \
102 if (!pfnFunc) pfnFunc = (void*)GetProcAddress(SHLWAPI_h##module, name); \
103 if (!pfnFunc) return fail
106 NOTES: Most functions exported by ordinal seem to be superflous.
107 The reason for these functions to be there is to provide a wraper
108 for unicode functions to provide these functions on systems without
109 unicode functions eg. win95/win98. Since we have such functions we just
110 call these. If running Wine with native DLL's, some late bound calls may
111 fail. However, its better to implement the functions in the forward DLL
112 and recommend the builtin rather than reimplementing the calls here!
115 /*************************************************************************
118 * Identifies the Internet "scheme" in the passed string. ASCII based.
119 * Also determines start and length of item after the ':'
121 DWORD WINAPI
SHLWAPI_1 (LPCSTR x
, UNKNOWN_SHLWAPI_1
*y
)
124 const SHL_2_inet_scheme
*inet_pro
;
126 if (y
->size
!= 0x18) return E_INVALIDARG
;
127 /* FIXME: leading white space generates error of 0x80041001 which
130 if (*x
<= ' ') return 0x80041001;
145 /* check for no scheme in string start */
146 /* (apparently schemes *must* be larger than a single character) */
147 if ((*x
== '\0') || (y
->sizep1
<= 1)) {
152 /* found scheme, set length of remainder */
153 y
->sizep2
= lstrlenA(y
->ap2
);
155 /* see if known scheme and return indicator number */
156 y
->fcncde
= URL_SCHEME_UNKNOWN
;
157 inet_pro
= shlwapi_schemes
;
158 while (inet_pro
->scheme_name
) {
159 if (!strncasecmp(inet_pro
->scheme_name
, y
->ap1
,
160 min(y
->sizep1
, lstrlenA(inet_pro
->scheme_name
)))) {
161 y
->fcncde
= inet_pro
->scheme_number
;
169 /*************************************************************************
172 * Identifies the Internet "scheme" in the passed string. UNICODE based.
173 * Also determines start and length of item after the ':'
175 DWORD WINAPI
SHLWAPI_2 (LPCWSTR x
, UNKNOWN_SHLWAPI_2
*y
)
178 const SHL_2_inet_scheme
*inet_pro
;
182 if (y
->size
!= 0x18) return E_INVALIDARG
;
183 /* FIXME: leading white space generates error of 0x80041001 which
186 if (*x
<= L
' ') return 0x80041001;
201 /* check for no scheme in string start */
202 /* (apparently schemes *must* be larger than a single character) */
203 if ((*x
== L
'\0') || (y
->sizep1
<= 1)) {
208 /* found scheme, set length of remainder */
209 y
->sizep2
= lstrlenW(y
->ap2
);
211 /* see if known scheme and return indicator number */
212 len
= WideCharToMultiByte(0, 0, y
->ap1
, y
->sizep1
, 0, 0, 0, 0);
213 cmpstr
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, len
+1);
214 WideCharToMultiByte(0, 0, y
->ap1
, y
->sizep1
, cmpstr
, len
+1, 0, 0);
215 y
->fcncde
= URL_SCHEME_UNKNOWN
;
216 inet_pro
= shlwapi_schemes
;
217 while (inet_pro
->scheme_name
) {
218 if (!strncasecmp(inet_pro
->scheme_name
, cmpstr
,
219 min(len
, lstrlenA(inet_pro
->scheme_name
)))) {
220 y
->fcncde
= inet_pro
->scheme_number
;
225 HeapFree(GetProcessHeap(), 0, cmpstr
);
229 /*************************************************************************
231 * (Used by IE4 during startup)
232 * appears to return HWND (used as input to 8 below)
234 HRESULT WINAPI
SHLWAPI_7 (
237 LPVOID y
) /* [???] appears to be result of GetCurrentProcessId() */
239 FIXME("(%p %p %p) stub\n", w
, x
, y
);
242 /* pseudo code extracted from relay trace */
243 fhnd
= CreateFileMappingA(-1, 0, 4, 0, 0x58, 0);
244 addr
= MapViewOfFile(fhnd
, 6, 0, 0, 0);
245 UnmapViewOfFile(addr
);
246 GetCurrentProcessId();
247 GetCurrentProcessId();
248 sph
= GetCurrentProcess();
249 GetCurrentProcessId();
250 dph
= GetCurrentProcess();
251 DuplicateHandle(sph
, fhnd
, dph
, &hoho
, 0x000f001f, 0, 2);
252 GetCurrentProcessId();
253 GetCurrentProcessId();
259 /*************************************************************************
261 * (Used by IE4 during startup)
262 * appears to return MapViewOfFile+4 (used as input to 9 below)
264 LONG WINAPI
SHLWAPI_8 (
265 LPVOID w
, /* [???] possibly HANDLE */
266 LPVOID x
) /* [???] appears to be result of GetCurrentProcessId() */
268 FIXME("(%p %p) stub\n", w
, x
);
271 /* pseudo code extracted from relay trace */
272 GetCurrentProcessId();
273 GetCurrentProcessId();
274 sph
= GetCurrentProcess();
275 GetCurrentProcessId();
276 dph
= GetCurrentProcess();
277 DuplicateHandle(sph
, w
, dph
, &hoho
, 0x000f001f, 0, 2);
278 GetCurrentProcessId();
279 GetCurrentProcessId();
280 addr
= MapViewOfFile(hoho
, 6, 0, 0, 0);
282 return (LONG
)addr
+ 4;
286 /*************************************************************************
288 * (Used by IE4 during startup)
290 HRESULT WINAPI
SHLWAPI_9 (
293 FIXME("(%p) stub\n", w
);
296 /* pseudo code extracted from relay trace */
297 return UnmapViewOfFile((LPVOID
)((LONG
)w
-4));
301 /*************************************************************************
303 * (Used by IE4 during startup)
305 HRESULT WINAPI
SHLWAPI_13 (
309 FIXME("(%p %p)stub\n",w
,x
);
312 /* pseudo code extracted from relay trace */
313 RegOpenKeyA(HKLM
, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Aceepted Documents", &newkey
);
318 ret
= RegEnumValueA(newkey
, i
, a1
, a2
, 0, a3
, 0, 0);
322 b1
= LocalAlloc(0x40, size
);
326 ret
= RegEnumValueA(newkey
, i
, a1
, a2
, 0, a3
, a4
, a5
);
327 RegisterClipBoardFormatA(a4
);
330 hwnd1
= GetModuleHandleA("URLMON.DLL");
331 proc
= GetProcAddress(hwnd1
, "CreateFormatEnumerator");
332 HeapAlloc(??, 0, 0x14);
333 HeapAlloc(??, 0, 0x50);
334 LocalAlloc(0x40, 0x78);
335 /* FIXME: bad string below */
336 lstrlenW(L
"{D0FCA420-D3F5-11CF-B211-00AA004AE837}");
337 StrCpyW(a6
, L
"{D0FCA420-D3F5-11CF-B211-00AA004AE837}");
340 IsBadReadPtr(c1
= 0x403fd210,4);
341 InterlockedIncrement(c1
+4);
344 IsBadReadPtr(c1
= 0x403fd210,4);
345 InterlockedIncrement(c1
+4);
347 HeapAlloc(40350000,00000000,00000014) retval
=403fd0a8
;
348 HeapAlloc(40350000,00000000,00000050) retval
=403feb44
;
349 hwnd1
= GetModuleHandleA("URLMON.DLL");
350 proc
= GetProcAddress(hwnd1
, "RegisterFormatEnumerator");
351 /* 0x1a40c88c is in URLMON.DLL just before above proc
352 * content is L"_EnumFORMATETC_"
355 IsBadReadPtr(d1
= 0x1a40c88c,00000002);
358 HeapAlloc(40350000,00000000,0000001e
) retval
=403fed44
;
359 IsBadReadPtr(d2
= 0x403fd0a8,00000004);
360 InterlockedIncrement(d2
+4);
361 IsBadReadPtr(d2
= 0x403fd0a8,00000004);
362 InterlockedDecrement(d2
+4);
363 IsBadReadPtr(c1
,00000004);
364 InterlockedDecrement(c1
+4);
365 IsBadReadPtr(c1
,00000004);
366 InterlockedDecrement(c1
+4);
371 /*************************************************************************
375 * Retrieves IE "AcceptLanguage" value from registry. ASCII mode.
378 HRESULT WINAPI
SHLWAPI_14 (
383 DWORD mystrlen
, mytype
;
387 mystrlen
= (*buflen
> 6) ? *buflen
: 6;
388 mystr
= (CHAR
*)HeapAlloc(GetProcessHeap(),
389 HEAP_ZERO_MEMORY
, mystrlen
);
390 RegOpenKeyA(HKEY_CURRENT_USER
,
391 "Software\\Microsoft\\Internet Explorer\\International",
393 if (RegQueryValueExA(mykey
, "AcceptLanguage",
394 0, &mytype
, mystr
, &mystrlen
)) {
395 /* Did not find value */
396 mylcid
= GetUserDefaultLCID();
397 /* somehow the mylcid translates into "en-us"
398 * this is similar to "LOCALE_SABBREVLANGNAME"
399 * which could be gotten via GetLocaleInfo.
400 * The only problem is LOCALE_SABBREVLANGUAGE" is
401 * a 3 char string (first 2 are country code and third is
402 * letter for "sublanguage", which does not come close to
405 lstrcpyA(mystr
, "en-us");
406 mystrlen
= lstrlenA(mystr
);
409 /* handle returned string */
410 FIXME("missing code\n");
412 if (mystrlen
> *buflen
)
413 lstrcpynA(langbuf
, mystr
, *buflen
);
415 lstrcpyA(langbuf
, mystr
);
416 *buflen
= lstrlenA(langbuf
);
419 HeapFree(GetProcessHeap(), 0, mystr
);
420 TRACE("language is %s\n", debugstr_a(langbuf
));
424 /*************************************************************************
428 * Retrieves IE "AcceptLanguage" value from registry. UNICODE mode.
431 HRESULT WINAPI
SHLWAPI_15 (
436 DWORD mystrlen
, mytype
;
440 mystrlen
= (*buflen
> 6) ? *buflen
: 6;
441 mystr
= (CHAR
*)HeapAlloc(GetProcessHeap(),
442 HEAP_ZERO_MEMORY
, mystrlen
);
443 RegOpenKeyA(HKEY_CURRENT_USER
,
444 "Software\\Microsoft\\Internet Explorer\\International",
446 if (RegQueryValueExA(mykey
, "AcceptLanguage",
447 0, &mytype
, mystr
, &mystrlen
)) {
448 /* Did not find value */
449 mylcid
= GetUserDefaultLCID();
450 /* somehow the mylcid translates into "en-us"
451 * this is similar to "LOCALE_SABBREVLANGNAME"
452 * which could be gotten via GetLocaleInfo.
453 * The only problem is LOCALE_SABBREVLANGUAGE" is
454 * a 3 char string (first 2 are country code and third is
455 * letter for "sublanguage", which does not come close to
458 lstrcpyA(mystr
, "en-us");
459 mystrlen
= lstrlenA(mystr
);
462 /* handle returned string */
463 FIXME("missing code\n");
466 *buflen
= MultiByteToWideChar(0, 0, mystr
, -1, langbuf
, (*buflen
)-1);
467 HeapFree(GetProcessHeap(), 0, mystr
);
468 TRACE("language is %s\n", debugstr_w(langbuf
));
472 /*************************************************************************
475 HRESULT WINAPI
SHLWAPI_16 (
481 FIXME("(%p %p %p %p)stub\n",w
,x
,y
,z
);
485 /*************************************************************************
488 * w is pointer to address of callback routine
489 * x is pointer to LPVOID to receive address of locally allocated
491 * return is 0 (unless out of memory???)
493 * related to _19, _21 and _22 below
494 * only seen invoked by SHDOCVW
496 LONG WINAPI
SHLWAPI_18 (
500 FIXME("(%p %p)stub\n",w
,x
);
505 /*************************************************************************
508 * w is address of allocated memory from _21
509 * return is 0 (unless out of memory???)
511 * related to _18, _21 and _22 below
512 * only seen invoked by SHDOCVW
514 LONG WINAPI
SHLWAPI_19 (
517 FIXME("(%p) stub\n",w
);
521 /*************************************************************************
524 * w points to space allocated via .18 above
525 * LocalSize is done on it (retrieves 18)
526 * LocalReAlloc is done on it to size 8 with LMEM_MOVEABLE & LMEM_ZEROINIT
527 * x values seen 0xa0000005
530 * relates to _18, _19 and _22 above and below
531 * only seen invoked by SHDOCVW
533 LONG WINAPI
SHLWAPI_21 (
537 FIXME("(%p %lx)stub\n",w
,x
);
541 /*************************************************************************
544 * return is 'w' value seen in x is 0xa0000005
546 * relates to _18, _19 and _21 above
547 * only seen invoked by SHDOCVW
549 LPVOID WINAPI
SHLWAPI_22 (
553 FIXME("(%p %lx)stub\n",w
,x
);
557 /*************************************************************************
561 * converts a guid to a string
562 * returns strlen(str)
564 DWORD WINAPI
SHLWAPI_23 (
565 REFGUID guid
, /* [in] clsid */
566 LPSTR str
, /* [out] buffer */
567 INT cmax
) /* [in] size of buffer */
571 sprintf( xguid
, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
572 guid
->Data1
, guid
->Data2
, guid
->Data3
,
573 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
574 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
575 TRACE("(%s %p 0x%08x)stub\n", xguid
, str
, cmax
);
576 if (strlen(xguid
)>=cmax
) return 0;
578 return strlen(xguid
) + 1;
581 /*************************************************************************
585 * converts a guid to a string
586 * returns strlen(str)
588 DWORD WINAPI
SHLWAPI_24 (
589 REFGUID guid
, /* [in] clsid */
590 LPWSTR str
, /* [out] buffer */
591 INT cmax
) /* [in] size of buffer */
595 sprintf( xguid
, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
596 guid
->Data1
, guid
->Data2
, guid
->Data3
,
597 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
598 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
599 return MultiByteToWideChar( CP_ACP
, 0, xguid
, -1, str
, cmax
);
602 /*************************************************************************
605 * Seems to be iswalpha
607 BOOL WINAPI
SHLWAPI_25(WCHAR wc
)
609 return (get_char_typeW(wc
) & C1_ALPHA
) != 0;
612 /*************************************************************************
615 * Seems to be iswupper
617 BOOL WINAPI
SHLWAPI_26(WCHAR wc
)
619 return (get_char_typeW(wc
) & C1_UPPER
) != 0;
622 /*************************************************************************
625 * Seems to be iswlower
627 BOOL WINAPI
SHLWAPI_27(WCHAR wc
)
629 return (get_char_typeW(wc
) & C1_LOWER
) != 0;
632 /*************************************************************************
635 * Seems to be iswalnum
637 BOOL WINAPI
SHLWAPI_28(WCHAR wc
)
639 return (get_char_typeW(wc
) & (C1_ALPHA
|C1_DIGIT
)) != 0;
642 /*************************************************************************
645 * Seems to be iswspace
647 BOOL WINAPI
SHLWAPI_29(WCHAR wc
)
649 return (get_char_typeW(wc
) & C1_SPACE
) != 0;
652 /*************************************************************************
655 * Seems to be iswblank
657 BOOL WINAPI
SHLWAPI_30(WCHAR wc
)
659 return (get_char_typeW(wc
) & C1_BLANK
) != 0;
662 /*************************************************************************
665 * Seems to be iswpunct
667 BOOL WINAPI
SHLWAPI_31(WCHAR wc
)
669 return (get_char_typeW(wc
) & C1_PUNCT
) != 0;
672 /*************************************************************************
675 * Seems to be iswcntrl
677 BOOL WINAPI
SHLWAPI_32(WCHAR wc
)
679 return (get_char_typeW(wc
) & C1_CNTRL
) != 0;
682 /*************************************************************************
685 * Seems to be iswdigit
687 BOOL WINAPI
SHLWAPI_33(WCHAR wc
)
689 return (get_char_typeW(wc
) & C1_DIGIT
) != 0;
692 /*************************************************************************
695 * Seems to be iswxdigit
697 BOOL WINAPI
SHLWAPI_34(WCHAR wc
)
699 return (get_char_typeW(wc
) & C1_XDIGIT
) != 0;
702 /*************************************************************************
706 BOOL WINAPI
SHLWAPI_35(LPVOID p1
, DWORD dw2
, LPVOID p3
)
708 FIXME("(%p, 0x%08lx, %p): stub\n", p1
, dw2
, p3
);
712 /*************************************************************************
716 BOOL WINAPI
SHLWAPI_36(HMENU h1
, UINT ui2
, UINT h3
, LPCWSTR p4
)
718 TRACE("(0x%08x, 0x%08x, 0x%08x, %s): stub\n",
719 h1
, ui2
, h3
, debugstr_w(p4
));
720 return AppendMenuW(h1
, ui2
, h3
, p4
);
723 /*************************************************************************
726 * Get pointer to next Unicode character.
728 LPCWSTR WINAPI
SHLWAPI_40(LPCWSTR str
)
730 return *str
? str
+ 1 : str
;
733 /*************************************************************************
736 * Get the text from a given dialog item.
738 INT WINAPI
SHLWAPI_74(HWND hWnd
, INT nItem
, LPWSTR lpsDest
,INT nDestLen
)
740 HWND hItem
= GetDlgItem(hWnd
, nItem
);
743 return GetWindowTextW(hItem
, lpsDest
, nDestLen
);
745 *lpsDest
= (WCHAR
)'\0';
749 /*************************************************************************
751 * Function: Compare two ASCII strings for "len" bytes.
752 * Returns: *str1-*str2 (case sensitive)
754 DWORD WINAPI
SHLWAPI_151(LPSTR str1
, LPSTR str2
, INT len
)
756 return strncmp( str1
, str2
, len
);
759 /*************************************************************************
762 * Function: Compare two WIDE strings for "len" bytes.
763 * Returns: *str1-*str2 (case sensitive)
765 DWORD WINAPI
SHLWAPI_152(LPWSTR str1
, LPWSTR str2
, INT len
)
767 return strncmpW( str1
, str2
, len
);
770 /*************************************************************************
772 * Function: Compare two ASCII strings for "len" bytes via caseless compare.
773 * Returns: *str1-*str2 (case insensitive)
775 DWORD WINAPI
SHLWAPI_153(LPSTR str1
, LPSTR str2
, DWORD len
)
777 return strncasecmp( str1
, str2
, len
);
780 /*************************************************************************
783 * Function: Compare two WIDE strings for "len" bytes via caseless compare.
784 * Returns: *str1-*str2 (case insensitive)
786 DWORD WINAPI
SHLWAPI_154(LPWSTR str1
, LPWSTR str2
, DWORD len
)
788 return strncmpiW( str1
, str2
, len
);
791 /*************************************************************************
794 * Case sensitive string compare. Does not SetLastError().
796 DWORD WINAPI
SHLWAPI_156 ( LPWSTR str1
, LPWSTR str2
)
798 return strcmpW( str1
, str2
);
801 /*************************************************************************
804 * Case insensitive string compare. Does not SetLastError(). ??
806 DWORD WINAPI
SHLWAPI_158 ( LPWSTR str1
, LPWSTR str2
)
808 return strcmpiW( str1
, str2
);
811 /*************************************************************************
814 * Ensure a multibyte character string doesn't end in a hanging lead byte.
816 DWORD WINAPI
SHLWAPI_162(LPSTR lpStr
, DWORD size
)
820 LPSTR lastByte
= lpStr
+ size
- 1;
822 while(lpStr
< lastByte
)
823 lpStr
+= IsDBCSLeadByte(*lpStr
) ? 2 : 1;
825 if(lpStr
== lastByte
&& IsDBCSLeadByte(*lpStr
))
835 /*************************************************************************
838 DWORD WINAPI
SHLWAPI_164 (
846 TRACE("(%p %p %p %p %p %p) stub\n",u
,v
,w
,x
,y
,z
);
847 return 0x80004002; /* E_NOINTERFACE */
850 /*************************************************************************
853 * SetWindowLongA with mask.
855 LONG WINAPI
SHLWAPI_165(HWND hwnd
, INT offset
, UINT wFlags
, UINT wMask
)
857 LONG ret
= GetWindowLongA(hwnd
, offset
);
858 UINT newFlags
= (wFlags
& wMask
) | (ret
& ~wFlags
);
861 ret
= SetWindowLongA(hwnd
, offset
, newFlags
);
865 /*************************************************************************
868 * Do IUnknown::Release on passed object.
870 DWORD WINAPI
SHLWAPI_169 (IUnknown
** lpUnknown
)
874 TRACE("(%p)\n",lpUnknown
);
875 if(!lpUnknown
|| !*((LPDWORD
)lpUnknown
)) return 0;
878 TRACE("doing Release\n");
879 return IUnknown_Release(temp
);
882 /*************************************************************************
885 * Skip URL '//' sequence.
887 LPCSTR WINAPI
SHLWAPI_170(LPCSTR lpszSrc
)
889 if (lpszSrc
&& lpszSrc
[0] == '/' && lpszSrc
[1] == '/')
894 /*************************************************************************
896 * Get window handle of OLE object
898 DWORD WINAPI
SHLWAPI_172 (
899 IUnknown
*y
, /* [in] OLE object interface */
900 LPHWND z
) /* [out] location to put window handle */
905 TRACE("(%p %p)\n",y
,z
);
906 if (!y
) return E_FAIL
;
908 if ((ret
= IUnknown_QueryInterface(y
, &IID_IOleWindow
,(LPVOID
*)&pv
)) < 0) {
912 ret
= IOleWindow_GetWindow((IOleWindow
*)pv
, z
);
913 IUnknown_Release(pv
);
914 TRACE("result hwnd=%08x\n", *z
);
918 /*************************************************************************
921 * Seems to do call either IObjectWithSite::SetSite or
922 * IPersistMoniker::GetClassID. But since we do not implement either
923 * of those classes in our headers, we will fake it out.
925 DWORD WINAPI
SHLWAPI_174(
926 IUnknown
*p1
, /* [in] OLE object */
927 LPVOID
*p2
) /* [out] ptr to result of either GetClassID */
928 /* or SetSite call. */
932 if (!p1
) return E_FAIL
;
934 /* see if SetSite interface exists for IObjectWithSite object */
935 ret
= IUnknown_QueryInterface((IUnknown
*)p1
, (REFIID
)id1
, (LPVOID
*)&p1
);
936 TRACE("first IU_QI ret=%08lx, p1=%p\n", ret
, p1
);
939 /* see if GetClassId interface exists for IPersistMoniker object */
940 ret
= IUnknown_QueryInterface((IUnknown
*)p1
, (REFIID
)id2
, (LPVOID
*)&aa
);
941 TRACE("second IU_QI ret=%08lx, aa=%08lx\n", ret
, aa
);
944 /* fake a GetClassId call */
945 ret
= IOleWindow_GetWindow((IOleWindow
*)aa
, (HWND
*)p2
);
946 TRACE("second IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret
,
948 IUnknown_Release((IUnknown
*)aa
);
951 /* fake a SetSite call */
952 ret
= IOleWindow_GetWindow((IOleWindow
*)p1
, (HWND
*)p2
);
953 TRACE("first IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret
,
955 IUnknown_Release((IUnknown
*)p1
);
960 /*************************************************************************
963 * Function appears to be interface to IServiceProvider::QueryService
966 * returns E_NOINTERFACE
968 * S_OK if _219 called successfully
970 DWORD WINAPI
SHLWAPI_176 (
971 IUnknown
* unk
, /* [in] object to give Service Provider */
972 REFGUID sid
, /* [in] Service ID */
973 REFIID riid
, /* [in] Function requested */
974 LPVOID
*z
) /* [out] place to save interface pointer */
979 if (!unk
) return E_FAIL
;
980 ret
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, &aa
);
981 TRACE("did IU_QI retval=%08lx, aa=%p\n", ret
, aa
);
983 ret
= IServiceProvider_QueryService((IServiceProvider
*)aa
, sid
, riid
,
985 TRACE("did ISP_QS retval=%08lx, *z=%p\n", ret
, (LPVOID
)*z
);
986 IUnknown_Release((IUnknown
*)aa
);
990 /*************************************************************************
993 * Enable or disable a menu item.
995 UINT WINAPI
SHLWAPI_181(HMENU hMenu
, UINT wItemID
, BOOL bEnable
)
997 return EnableMenuItem(hMenu
, wItemID
, bEnable
? MF_ENABLED
: MF_GRAYED
);
1000 /*************************************************************************
1003 * Register a window class if it isn't already.
1005 DWORD WINAPI
SHLWAPI_183(WNDCLASSA
*wndclass
)
1008 if (GetClassInfoA(wndclass
->hInstance
, wndclass
->lpszClassName
, &wca
))
1010 return (DWORD
)RegisterClassA(wndclass
);
1013 /*************************************************************************
1016 DWORD WINAPI
SHLWAPI_193 ()
1024 ret
= GetDeviceCaps(hdc
, BITSPIXEL
) * GetDeviceCaps(hdc
, PLANES
);
1029 /*************************************************************************
1032 * Copy interface pointer
1034 DWORD WINAPI
SHLWAPI_199 (
1035 IUnknown
**dest
, /* [out] pointer to copy of interface ptr */
1036 IUnknown
*src
) /* [in] interface pointer */
1038 TRACE("(%p %p)\n",dest
,src
);
1041 IUnknown_Release(*dest
);
1043 IUnknown_AddRef(src
);
1050 /*************************************************************************
1053 * Some sort of memory management process - associated with _210
1055 DWORD WINAPI
SHLWAPI_208 (
1062 FIXME("(0x%08lx 0x%08lx %p %p 0x%08lx) stub\n",
1067 /*************************************************************************
1070 * Some sort of memory management process - associated with _208
1072 DWORD WINAPI
SHLWAPI_210 (
1077 FIXME("(%p 0x%08lx %p) stub\n",
1082 /*************************************************************************
1085 DWORD WINAPI
SHLWAPI_211 (
1089 FIXME("(%p 0x%08lx) stub\n",
1094 /*************************************************************************
1100 DWORD WINAPI
SHLWAPI_215 (
1107 len_a
= lstrlenA(lpStrSrc
);
1108 ret
= MultiByteToWideChar(0, 0, lpStrSrc
, len_a
, lpwStrDest
, len
);
1109 TRACE("%s %s %d, ret=%d\n",
1110 debugstr_a(lpStrSrc
), debugstr_w(lpwStrDest
), len
, ret
);
1114 /*************************************************************************
1117 * WideCharToMultiByte with multi language support.
1119 INT WINAPI
SHLWAPI_218(UINT CodePage
, LPCWSTR lpSrcStr
, LPSTR lpDstStr
,
1120 LPINT lpnMultiCharCount
)
1122 static HRESULT (WINAPI
*pfnFunc
)(LPDWORD
,DWORD
,LPCWSTR
,LPINT
,LPSTR
,LPINT
);
1123 WCHAR emptyW
[] = { '\0' };
1127 if (!lpDstStr
|| !lpnMultiCharCount
)
1135 len
= strlenW(lpSrcStr
) + 1;
1140 CodePage
= CP_UTF8
; /* Fall through... */
1141 case 0x0000C350: /* FIXME: CP_ #define */
1146 INT nWideCharCount
= len
- 1;
1148 GET_FUNC(mlang
, "ConvertINetUnicodeToMultiByte", 0);
1149 if (!pfnFunc(&dwMode
, CodePage
, lpSrcStr
, &nWideCharCount
, lpDstStr
,
1153 if (nWideCharCount
< len
- 1)
1155 mem
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, *lpnMultiCharCount
);
1159 *lpnMultiCharCount
= 0;
1161 if (pfnFunc(&dwMode
, CodePage
, lpSrcStr
, &len
, mem
, lpnMultiCharCount
))
1163 SHLWAPI_162 (mem
, *lpnMultiCharCount
);
1164 lstrcpynA(lpDstStr
, mem
, *lpnMultiCharCount
+ 1);
1165 return *lpnMultiCharCount
+ 1;
1167 HeapFree(GetProcessHeap(), 0, mem
);
1168 return *lpnMultiCharCount
;
1170 lpDstStr
[*lpnMultiCharCount
] = '\0';
1171 return *lpnMultiCharCount
;
1178 reqLen
= WideCharToMultiByte(CodePage
, 0, lpSrcStr
, len
, lpDstStr
,
1179 *lpnMultiCharCount
, NULL
, NULL
);
1181 if (!reqLen
&& GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
1183 reqLen
= WideCharToMultiByte(CodePage
, 0, lpSrcStr
, len
, NULL
, 0, NULL
, NULL
);
1186 mem
= (LPSTR
)HeapAlloc(GetProcessHeap(), 0, reqLen
);
1189 reqLen
= WideCharToMultiByte(CodePage
, 0, lpSrcStr
, len
, mem
,
1190 reqLen
, NULL
, NULL
);
1192 reqLen
= SHLWAPI_162(mem
, *lpnMultiCharCount
);
1195 lstrcpynA(lpDstStr
, mem
, *lpnMultiCharCount
);
1197 HeapFree(GetProcessHeap(), 0, mem
);
1204 /*************************************************************************
1207 * Hmm, some program used lpnMultiCharCount == 0x3 (and lpSrcStr was "C")
1208 * --> Crash. Something wrong here.
1210 * It seems from OE v5 that the third param is the count. (GA 11/2001)
1212 INT WINAPI
SHLWAPI_217(LPCWSTR lpSrcStr
, LPSTR lpDstStr
, INT MultiCharCount
)
1214 INT myint
= MultiCharCount
;
1216 return SHLWAPI_218(CP_ACP
, lpSrcStr
, lpDstStr
, &myint
);
1219 /*************************************************************************
1222 * Seems to be "super" QueryInterface. Supplied with at table of interfaces
1223 * and an array of IIDs and offsets into the table.
1226 * error codes: E_POINTER, E_NOINTERFACE
1233 HRESULT WINAPI
SHLWAPI_219 (
1234 LPVOID w
, /* [in] table of interfaces */
1235 IFACE_INDEX_TBL
*x
, /* [in] array of REFIIDs and indexes to above */
1236 REFIID riid
, /* [in] REFIID to get interface for */
1237 LPVOID
*z
) /* [out] location to get interface pointer */
1241 IFACE_INDEX_TBL
*xmove
;
1243 TRACE("(%p %p %s %p)\n",
1244 w
,x
,debugstr_guid(riid
),z
);
1247 while (xmove
->refid
) {
1248 TRACE("trying (indx %ld) %s\n", xmove
->indx
,
1249 debugstr_guid(xmove
->refid
));
1250 if (IsEqualIID(riid
, xmove
->refid
)) {
1251 a_vtbl
= (IUnknown
*)(xmove
->indx
+ (LPBYTE
)w
);
1252 TRACE("matched, returning (%p)\n", a_vtbl
);
1253 *z
= (LPVOID
)a_vtbl
;
1254 IUnknown_AddRef(a_vtbl
);
1260 if (IsEqualIID(riid
, &IID_IUnknown
)) {
1261 a_vtbl
= (IUnknown
*)(x
->indx
+ (LPBYTE
)w
);
1262 TRACE("returning first for IUnknown (%p)\n", a_vtbl
);
1263 *z
= (LPVOID
)a_vtbl
;
1264 IUnknown_AddRef(a_vtbl
);
1268 ret
= E_NOINTERFACE
;
1274 /*************************************************************************
1278 * securityattributes missing
1280 HANDLE WINAPI
SHLWAPI_222 (LPCLSID guid
)
1284 sprintf( lpstrName
, "shell.{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
1285 guid
->Data1
, guid
->Data2
, guid
->Data3
,
1286 guid
->Data4
[0], guid
->Data4
[1], guid
->Data4
[2], guid
->Data4
[3],
1287 guid
->Data4
[4], guid
->Data4
[5], guid
->Data4
[6], guid
->Data4
[7] );
1288 FIXME("(%s) stub\n", lpstrName
);
1289 return CreateSemaphoreA(NULL
,0, 0x7fffffff, lpstrName
);
1292 /*************************************************************************
1296 * get the count of the semaphore
1298 DWORD WINAPI
SHLWAPI_223 (HANDLE handle
)
1302 FIXME("(0x%08x) stub\n",handle
);
1304 ReleaseSemaphore( handle
, 1, &oldCount
); /* +1 */
1305 WaitForSingleObject( handle
, 0 ); /* -1 */
1309 /*************************************************************************
1312 HMODULE WINAPI
SHLWAPI_236 (REFIID lpUnknown
)
1316 CHAR value
[MAX_PATH
], string
[MAX_PATH
];
1318 strcpy(string
, "CLSID\\");
1319 strcat(string
, debugstr_guid(lpUnknown
));
1320 strcat(string
, "\\InProcServer32");
1323 RegOpenKeyExA(HKEY_CLASSES_ROOT
, string
, 0, 1, &newkey
);
1324 RegQueryValueExA(newkey
, 0, 0, &type
, value
, &count
);
1325 RegCloseKey(newkey
);
1326 return LoadLibraryExA(value
, 0, 0);
1329 /*************************************************************************
1332 * Unicode version of SHLWAPI_183.
1334 DWORD WINAPI
SHLWAPI_237 (WNDCLASSW
* lpWndClass
)
1338 TRACE("(0x%08x %s)\n",lpWndClass
->hInstance
, debugstr_w(lpWndClass
->lpszClassName
));
1340 if (GetClassInfoW(lpWndClass
->hInstance
, lpWndClass
->lpszClassName
, &WndClass
))
1342 return RegisterClassW(lpWndClass
);
1345 /*************************************************************************
1348 DWORD WINAPI
SHLWAPI_239(HINSTANCE hInstance
, LPVOID p2
, DWORD dw3
)
1350 FIXME("(0x%08x %p 0x%08lx) stub\n",
1351 hInstance
, p2
, dw3
);
1354 /* pseudo code from relay trace */
1355 WideCharToMultiByte(0, 0, L
"Shell DocObject View", -1, &aa
, 0x0207, 0, 0);
1356 GetClassInfoA(70fe0000
,405868ec
"Shell DocObject View",40586b14
);
1357 /* above pair repeated for:
1358 TridentThicketUrlDlClass
1367 /*************************************************************************
1370 * Calls ASCII or Unicode WindowProc for the given window.
1372 LRESULT CALLBACK
SHLWAPI_240(HWND hWnd
, UINT uMessage
, WPARAM wParam
, LPARAM lParam
)
1374 if (IsWindowUnicode(hWnd
))
1375 return DefWindowProcW(hWnd
, uMessage
, wParam
, lParam
);
1376 return DefWindowProcA(hWnd
, uMessage
, wParam
, lParam
);
1379 /*************************************************************************
1383 DWORD WINAPI
SHLWAPI_241 ()
1386 return /* 0xabba1243 */ 0;
1389 /*************************************************************************
1392 DWORD WINAPI
SHLWAPI_266 (
1398 FIXME("(%p %p %p %p)stub\n",w
,x
,y
,z
);
1402 /*************************************************************************
1405 HRESULT WINAPI
SHLWAPI_267 (
1406 LPVOID w
, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */
1407 LPVOID x
, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */
1411 FIXME("(%p %p %p %p)stub\n",w
,x
,y
,z
);
1412 *((LPDWORD
)z
) = 0xabba1200;
1416 /*************************************************************************
1419 DWORD WINAPI
SHLWAPI_268 (
1423 FIXME("(%p %p)\n",w
,x
);
1424 return 0xabba1251; /* 0 = failure */
1427 /*************************************************************************
1431 DWORD WINAPI
SHLWAPI_276 ()
1434 return /* 0xabba1244 */ 0;
1437 /*************************************************************************
1441 HWND WINAPI
SHLWAPI_278 (
1452 char * clsname
= "WorkerA";
1454 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx) partial stub\n",
1455 wndProc
,hWndParent
,dwExStyle
,dwStyle
,hMenu
,z
);
1457 hCursor
= LoadCursorA(0x00000000,IDC_ARROWA
);
1459 if(!GetClassInfoA(shlwapi_hInstance
, clsname
, &wndclass
))
1461 RtlZeroMemory(&wndclass
, sizeof(WNDCLASSA
));
1462 wndclass
.lpfnWndProc
= DefWindowProcW
;
1463 wndclass
.cbWndExtra
= 4;
1464 wndclass
.hInstance
= shlwapi_hInstance
;
1465 wndclass
.hCursor
= hCursor
;
1466 wndclass
.hbrBackground
= COLOR_BTNSHADOW
;
1467 wndclass
.lpszMenuName
= NULL
;
1468 wndclass
.lpszClassName
= clsname
;
1469 RegisterClassA (&wndclass
);
1471 hwnd
= CreateWindowExA(dwExStyle
, clsname
, 0,dwStyle
,0,0,0,0,hWndParent
,
1472 hMenu
,shlwapi_hInstance
,0);
1473 SetWindowLongA(hwnd
, 0, z
);
1474 SetWindowLongA(hwnd
, GWL_WNDPROC
, wndProc
);
1478 /*************************************************************************
1481 * Late bound call to winmm.PlaySoundW
1483 BOOL WINAPI
SHLWAPI_289(LPCWSTR pszSound
, HMODULE hmod
, DWORD fdwSound
)
1485 static BOOL (WINAPI
*pfnFunc
)(LPCWSTR
, HMODULE
, DWORD
) = NULL
;
1487 GET_FUNC(winmm
, "PlaySoundW", FALSE
);
1488 return pfnFunc(pszSound
, hmod
, fdwSound
);
1491 /*************************************************************************
1494 BOOL WINAPI
SHLWAPI_294(LPSTR str1
, LPSTR str2
, LPSTR pStr
, DWORD some_len
, LPCSTR lpStr2
)
1497 * str1: "I" "I" pushl esp+0x20
1498 * str2: "U" "I" pushl 0x77c93810
1499 * (is "I" and "U" "integer" and "unsigned" ??)
1501 * pStr: "" "" pushl eax
1502 * some_len: 0x824 0x104 pushl 0x824
1503 * lpStr2: "%l" "%l" pushl esp+0xc
1505 * shlwapi. StrCpyNW(lpStr2, irrelevant_var, 0x104);
1506 * LocalAlloc(0x00, some_len) -> irrelevant_var
1507 * LocalAlloc(0x40, irrelevant_len) -> pStr
1508 * shlwapi.294(str1, str2, pStr, some_len, lpStr2);
1509 * shlwapi.PathRemoveBlanksW(pStr);
1511 ERR("('%s', '%s', '%s', %08lx, '%s'): stub!\n", str1
, str2
, pStr
, some_len
, lpStr2
);
1515 /*************************************************************************
1518 * Late bound call to shell32.SHGetFileInfoW
1520 DWORD WINAPI
SHLWAPI_313(LPCWSTR path
, DWORD dwFileAttributes
,
1521 SHFILEINFOW
*psfi
, UINT sizeofpsfi
, UINT flags
)
1523 static DWORD (WINAPI
*pfnFunc
)(LPCWSTR
,DWORD
,SHFILEINFOW
*,UINT
,UINT
) = NULL
;
1525 GET_FUNC(shell32
, "SHGetFileInfoW", 0);
1526 return pfnFunc(path
, dwFileAttributes
, psfi
, sizeofpsfi
, flags
);
1529 /*************************************************************************
1532 * Late bound call to shell32.DragQueryFileW
1534 UINT WINAPI
SHLWAPI_318(HDROP hDrop
, UINT lFile
, LPWSTR lpszFile
, UINT lLength
)
1536 static UINT (WINAPI
*pfnFunc
)(HDROP
, UINT
, LPWSTR
, UINT
) = NULL
;
1538 GET_FUNC(shell32
, "DragQueryFileW", 0);
1539 return pfnFunc(hDrop
, lFile
, lpszFile
, lLength
);
1542 /*************************************************************************
1545 * Late bound call to shell32.SHBrowseForFolderW
1547 LPITEMIDLIST WINAPI
SHLWAPI_333(LPBROWSEINFOW lpBi
)
1549 static LPITEMIDLIST (WINAPI
*pfnFunc
)(LPBROWSEINFOW
) = NULL
;
1551 GET_FUNC(shell32
, "SHBrowseForFolderW", NULL
);
1552 return pfnFunc(lpBi
);
1555 /*************************************************************************
1558 * Late bound call to shell32.SHGetPathFromIDListW
1560 BOOL WINAPI
SHLWAPI_334(LPCITEMIDLIST pidl
,LPWSTR pszPath
)
1562 static BOOL (WINAPI
*pfnFunc
)(LPCITEMIDLIST
, LPWSTR
) = NULL
;
1564 GET_FUNC(shell32
, "SHGetPathFromIDListW", 0);
1565 return pfnFunc(pidl
, pszPath
);
1568 /*************************************************************************
1571 * Late bound call to shell32.ShellExecuteExW
1573 BOOL WINAPI
SHLWAPI_335(LPSHELLEXECUTEINFOW lpExecInfo
)
1575 static BOOL (WINAPI
*pfnFunc
)(LPSHELLEXECUTEINFOW
) = NULL
;
1577 GET_FUNC(shell32
, "ShellExecuteExW", FALSE
);
1578 return pfnFunc(lpExecInfo
);
1581 /*************************************************************************
1584 * Late bound call to shell32.SHFileOperationW.
1586 DWORD WINAPI
SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp
)
1588 static HICON (WINAPI
*pfnFunc
)(LPSHFILEOPSTRUCTW
) = NULL
;
1590 GET_FUNC(shell32
, "SHFileOperationW", 0);
1591 return pfnFunc(lpFileOp
);
1594 /*************************************************************************
1597 * Late bound call to shell32.ExtractIconExW.
1599 HICON WINAPI
SHLWAPI_337(LPCWSTR lpszFile
, INT nIconIndex
, HICON
*phiconLarge
,
1600 HICON
*phiconSmall
, UINT nIcons
)
1602 static HICON (WINAPI
*pfnFunc
)(LPCWSTR
, INT
,HICON
*,HICON
*, UINT
) = NULL
;
1604 GET_FUNC(shell32
, "ExtractIconExW", (HICON
)0);
1605 return pfnFunc(lpszFile
, nIconIndex
, phiconLarge
, phiconSmall
, nIcons
);
1608 /*************************************************************************
1612 DWORD WINAPI
SHLWAPI_342 (
1613 LPDWORD w
, /* [out] location to put HKEY value??? */
1614 HKEY x
, /* [in] appears to be HKEY_CURRENT_USER */
1617 FIXME("(%p 0x%08x %p)stub\n", w
,x
,y
);
1619 return /* 0xabba1249 */ 0;
1622 /*************************************************************************
1625 DWORD WINAPI
SHLWAPI_346 (
1630 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src
),dest
,len
);
1631 lstrcpynW(dest
, src
, len
);
1632 return lstrlenW(dest
)+1;
1635 /*************************************************************************
1638 DWORD WINAPI
SHLWAPI_356 (
1643 FIXME("(%p %p %p)stub\n", x
,y
,z
);
1647 /*************************************************************************
1650 * Late bound call to shell32.SHGetNewLinkInfoW
1652 BOOL WINAPI
SHLWAPI_357(LPCWSTR pszLinkTo
, LPCWSTR pszDir
, LPWSTR pszName
,
1653 BOOL
*pfMustCopy
, UINT uFlags
)
1655 static BOOL (WINAPI
*pfnFunc
)(LPCWSTR
, LPCWSTR
, LPCWSTR
, BOOL
*, UINT
) = NULL
;
1657 GET_FUNC(shell32
, "SHGetNewLinkInfoW", FALSE
);
1658 return pfnFunc(pszLinkTo
, pszDir
, pszName
, pfMustCopy
, uFlags
);
1661 /*************************************************************************
1664 * Late bound call to shell32.SHDefExtractIconW
1666 DWORD WINAPI
SHLWAPI_358(LPVOID arg1
, LPVOID arg2
, LPVOID arg3
, LPVOID arg4
,
1667 LPVOID arg5
, LPVOID arg6
)
1669 /* FIXME: Correct args */
1670 static DWORD (WINAPI
*pfnFunc
)(LPVOID
, LPVOID
, LPVOID
, LPVOID
, LPVOID
, LPVOID
) = NULL
;
1672 GET_FUNC(shell32
, "SHDefExtractIconW", 0);
1673 return pfnFunc(arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
1676 /*************************************************************************
1679 * Wrapper for lstrcpynA with src and dst swapped.
1681 DWORD WINAPI
SHLWAPI_364(LPCSTR src
, LPSTR dst
, INT n
)
1683 lstrcpynA(dst
, src
, n
);
1687 /*************************************************************************
1690 * Late bound call to shell32.ExtractIconW
1692 HICON WINAPI
SHLWAPI_370(HINSTANCE hInstance
, LPCWSTR lpszExeFileName
,
1695 static HICON (WINAPI
*pfnFunc
)(HINSTANCE
, LPCWSTR
, UINT
) = NULL
;
1697 GET_FUNC(shell32
, "ExtractIconW", (HICON
)0);
1698 return pfnFunc(hInstance
, lpszExeFileName
, nIconIndex
);
1701 /*************************************************************************
1704 LANGID WINAPI
SHLWAPI_376 ()
1707 /* FIXME: This should be a forward in the .spec file to the win2k function
1708 * kernel32.GetUserDefaultUILanguage, however that function isn't there yet.
1710 return GetUserDefaultLangID();
1713 /*************************************************************************
1716 * FIXME: Native appears to do DPA_Create and a DPA_InsertPtr for
1718 * FIXME: Native shows calls to:
1719 * SHRegGetUSValue for "Software\Microsoft\Internet Explorer\International"
1721 * RegOpenKeyExA for "HKLM\Software\Microsoft\Internet Explorer"
1722 * RegQueryValueExA for "LPKInstalled"
1724 * RegOpenKeyExA for "HKCU\Software\Microsoft\Internet Explorer\International"
1725 * RegQueryValueExA for "ResourceLocale"
1727 * RegOpenKeyExA for "HKLM\Software\Microsoft\Active Setup\Installed Components\{guid}"
1728 * RegQueryValueExA for "Locale"
1730 * and then tests the Locale ("en" for me).
1732 * after the code then a DPA_Create (first time) and DPA_InsertPtr are done.
1734 DWORD WINAPI
SHLWAPI_377 (LPCSTR new_mod
, HMODULE inst_hwnd
, LPVOID z
)
1736 CHAR mod_path
[2*MAX_PATH
];
1739 GetModuleFileNameA(inst_hwnd
, mod_path
, 2*MAX_PATH
);
1740 ptr
= strrchr(mod_path
, '\\');
1742 strcpy(ptr
+1, new_mod
);
1743 TRACE("loading %s\n", debugstr_a(mod_path
));
1744 return (DWORD
)LoadLibraryA(mod_path
);
1749 /*************************************************************************
1752 * This is Unicode version of .377
1754 DWORD WINAPI
SHLWAPI_378 (
1755 LPCWSTR new_mod
, /* [in] new module name */
1756 HMODULE inst_hwnd
, /* [in] calling module handle */
1757 LPVOID z
) /* [???] 4 */
1759 WCHAR mod_path
[2*MAX_PATH
];
1762 GetModuleFileNameW(inst_hwnd
, mod_path
, 2*MAX_PATH
);
1763 ptr
= strrchrW(mod_path
, '\\');
1765 strcpyW(ptr
+1, new_mod
);
1766 TRACE("loading %s\n", debugstr_w(mod_path
));
1767 return (DWORD
)LoadLibraryW(mod_path
);
1772 /*************************************************************************
1775 * Late bound call to comdlg32.GetSaveFileNameW
1777 BOOL WINAPI
SHLWAPI_389(LPOPENFILENAMEW ofn
)
1779 static BOOL (WINAPI
*pfnFunc
)(LPOPENFILENAMEW
) = NULL
;
1781 GET_FUNC(comdlg32
, "GetSaveFileNameW", FALSE
);
1782 return pfnFunc(ofn
);
1785 /*************************************************************************
1788 * Late bound call to mpr.WNetRestoreConnectionW
1790 DWORD WINAPI
SHLWAPI_390(LPVOID arg1
, LPVOID arg2
)
1792 /* FIXME: Correct args */
1793 static DWORD (WINAPI
*pfnFunc
)(LPVOID
, LPVOID
) = NULL
;
1795 GET_FUNC(mpr
, "WNetRestoreConnectionW", 0);
1796 return pfnFunc(arg1
, arg2
);
1799 /*************************************************************************
1802 * Late bound call to mpr.WNetGetLastErrorW
1804 DWORD WINAPI
SHLWAPI_391(LPVOID arg1
, LPVOID arg2
, LPVOID arg3
, LPVOID arg4
,
1807 /* FIXME: Correct args */
1808 static DWORD (WINAPI
*pfnFunc
)(LPVOID
, LPVOID
, LPVOID
, LPVOID
, LPVOID
) = NULL
;
1810 GET_FUNC(mpr
, "WNetGetLastErrorW", 0);
1811 return pfnFunc(arg1
, arg2
, arg3
, arg4
, arg5
);
1814 /*************************************************************************
1817 * Late bound call to comdlg32.PageSetupDlgW
1819 BOOL WINAPI
SHLWAPI_401(LPPAGESETUPDLGW pagedlg
)
1821 static BOOL (WINAPI
*pfnFunc
)(LPPAGESETUPDLGW
) = NULL
;
1823 GET_FUNC(comdlg32
, "PageSetupDlgW", FALSE
);
1824 return pfnFunc(pagedlg
);
1827 /*************************************************************************
1830 * Late bound call to comdlg32.PrintDlgW
1832 BOOL WINAPI
SHLWAPI_402(LPPRINTDLGW printdlg
)
1834 static BOOL (WINAPI
*pfnFunc
)(LPPRINTDLGW
) = NULL
;
1836 GET_FUNC(comdlg32
, "PrintDlgW", FALSE
);
1837 return pfnFunc(printdlg
);
1840 /*************************************************************************
1843 * Late bound call to comdlg32.GetOpenFileNameW
1845 BOOL WINAPI
SHLWAPI_403(LPOPENFILENAMEW ofn
)
1847 static BOOL (WINAPI
*pfnFunc
)(LPOPENFILENAMEW
) = NULL
;
1849 GET_FUNC(comdlg32
, "GetOpenFileNameW", FALSE
);
1850 return pfnFunc(ofn
);
1853 /* INTERNAL: Map from HLS color space to RGB */
1854 static WORD
ConvertHue(int wHue
, WORD wMid1
, WORD wMid2
)
1856 wHue
= wHue
> 240 ? wHue
- 240 : wHue
< 0 ? wHue
+ 240 : wHue
;
1860 else if (wHue
> 120)
1865 return ((wHue
* (wMid2
- wMid1
) + 20) / 40) + wMid1
;
1868 /* Convert to RGB and scale into RGB range (0..255) */
1869 #define GET_RGB(h) (ConvertHue(h, wMid1, wMid2) * 255 + 120) / 240
1871 /*************************************************************************
1872 * ColorHLSToRGB [SHLWAPI.404]
1874 * Convert from HLS color space into an RGB COLORREF.
1877 * Input HLS values are constrained to the range (0..240).
1879 COLORREF WINAPI
ColorHLSToRGB(WORD wHue
, WORD wLuminosity
, WORD wSaturation
)
1885 WORD wGreen
, wBlue
, wMid1
, wMid2
;
1887 if (wLuminosity
> 120)
1888 wMid2
= wSaturation
+ wLuminosity
- (wSaturation
* wLuminosity
+ 120) / 240;
1890 wMid2
= ((wSaturation
+ 240) * wLuminosity
+ 120) / 240;
1892 wMid1
= wLuminosity
* 2 - wMid2
;
1894 wRed
= GET_RGB(wHue
+ 80);
1895 wGreen
= GET_RGB(wHue
);
1896 wBlue
= GET_RGB(wHue
- 80);
1898 return RGB(wRed
, wGreen
, wBlue
);
1901 wRed
= wLuminosity
* 255 / 240;
1902 return RGB(wRed
, wRed
, wRed
);
1905 /*************************************************************************
1908 * Function unknown seems to always to return 0
1910 DWORD WINAPI
SHLWAPI_413 (DWORD x
)
1912 FIXME("(0x%08lx)stub\n", x
);
1916 /*************************************************************************
1919 DWORD WINAPI
SHLWAPI_431 (DWORD x
)
1921 FIXME("(0x%08lx)stub\n", x
);
1925 /*************************************************************************
1929 * In the real shlwapi, One time initialisation calls GetVersionEx and reads
1930 * the registry to determine what O/S & Service Pack level is running, and
1931 * therefore which functions are available. Currently we always run as NT,
1932 * since this means that we don't need extra code to emulate Unicode calls,
1933 * they are forwarded directly to the appropriate API call instead.
1934 * Since the flags for whether to call or emulate Unicode are internal to
1935 * the dll, this function does not need a full implementation.
1937 DWORD WINAPI
SHLWAPI_437 (DWORD functionToCall
)
1939 FIXME("(0x%08lx)stub\n", functionToCall
);
1940 return /* 0xabba1247 */ 0;
1943 /*************************************************************************
1944 * ColorRGBToHLS [SHLWAPI.445]
1946 * Convert from RGB COLORREF into the HLS color space.
1949 * Input HLS values are constrained to the range (0..240).
1951 VOID WINAPI
ColorRGBToHLS(COLORREF drRGB
, LPWORD pwHue
,
1952 LPWORD wLuminance
, LPWORD pwSaturation
)
1958 /*************************************************************************
1959 * SHCreateShellPalette [SHLWAPI.@]
1961 HPALETTE WINAPI
SHCreateShellPalette(HDC hdc
)
1964 return CreateHalftonePalette(hdc
);
1967 /*************************************************************************
1968 * SHGetInverseCMAP (SHLWAPI.@)
1970 DWORD WINAPI
SHGetInverseCMAP (LPVOID x
, DWORD why
)
1972 FIXME("(%p, %#lx)stub\n", x
, why
);
1976 /*************************************************************************
1977 * SHIsLowMemoryMachine [SHLWAPI.@]
1979 DWORD WINAPI
SHIsLowMemoryMachine (DWORD x
)
1981 FIXME("0x%08lx\n", x
);
1985 /*************************************************************************
1986 * GetMenuPosFromID [SHLWAPI.@]
1988 INT WINAPI
GetMenuPosFromID(HMENU hMenu
, UINT wID
)
1991 INT nCount
= GetMenuItemCount(hMenu
), nIter
= 0;
1993 while (nIter
< nCount
)
1996 if (!GetMenuItemInfoA(hMenu
, nIter
, TRUE
, &mi
) && mi
.wID
== wID
)
2003 /*************************************************************************
2004 * _SHGetInstanceExplorer@4 [SHLWAPI.@]
2006 * Late bound call to shell32.SHGetInstanceExplorer.
2008 HRESULT WINAPI
_SHGetInstanceExplorer (LPUNKNOWN
*lpUnknown
)
2010 static HRESULT (WINAPI
*pfnFunc
)(LPUNKNOWN
*) = NULL
;
2012 GET_FUNC(shell32
, "SHGetInstanceExplorer", E_FAIL
);
2013 return pfnFunc(lpUnknown
);