2 * SHLWAPI ordinal functions
4 * Copyright 1997 Marcus Meissner
19 #include "wine/unicode.h"
20 #include "wine/obj_base.h"
23 #include "debugtools.h"
25 DEFAULT_DEBUG_CHANNEL(shell);
27 extern HINSTANCE shlwapi_hInstance;
28 extern HMODULE SHLWAPI_hshell32;
29 extern HMODULE SHLWAPI_hwinmm;
30 extern HMODULE SHLWAPI_hcomdlg32;
31 extern HMODULE SHLWAPI_hmpr;
32 extern HMODULE SHLWAPI_hmlang;
34 /* Macro to get function pointer for a module*/
35 #define GET_FUNC(module, name, fail) \
36 if (!SHLWAPI_h##module) SHLWAPI_h##module = LoadLibraryA(#module ".dll"); \
37 if (!SHLWAPI_h##module) return fail; \
38 if (!pfnFunc) pfnFunc = (void*)GetProcAddress(SHLWAPI_h##module, name); \
39 if (!pfnFunc) return fail
42 NOTES: Most functions exported by ordinal seem to be superflous.
43 The reason for these functions to be there is to provide a wraper
44 for unicode functions to provide these functions on systems without
45 unicode functions eg. win95/win98. Since we have such functions we just
46 call these. If running Wine with native DLL's, some late bound calls may
47 fail. However, its better to implement the functions in the forward DLL
48 and recommend the builtin rather than reimplementing the calls here!
51 /*************************************************************************
52 * SHLWAPI_1 [SHLWAPI.1]
54 DWORD WINAPI SHLWAPI_1 (
58 FIXME("(%p %s %p %s)\n",lpStr, debugstr_a(lpStr),x, debugstr_a(x));
62 /*************************************************************************
63 * SHLWAPI_2 [SHLWAPI.2]
65 DWORD WINAPI SHLWAPI_2 (LPCWSTR x,LPVOID y)
67 FIXME("(%s,%p)\n",debugstr_w(x),y);
71 /*************************************************************************
72 * SHLWAPI_16 [SHLWAPI.16]
74 HRESULT WINAPI SHLWAPI_16 (
80 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
84 /*************************************************************************
85 * SHLWAPI_23 [SHLWAPI.23]
88 * converts a guid to a string
91 DWORD WINAPI SHLWAPI_23 (
92 REFGUID guid, /* [in] clsid */
93 LPSTR str, /* [out] buffer */
94 INT cmax) /* [in] size of buffer */
98 sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
99 guid->Data1, guid->Data2, guid->Data3,
100 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
101 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
102 TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax);
103 if (strlen(xguid)>=cmax) return 0;
105 return strlen(xguid) + 1;
108 /*************************************************************************
109 * SHLWAPI_24 [SHLWAPI.24]
112 * converts a guid to a string
113 * returns strlen(str)
115 DWORD WINAPI SHLWAPI_24 (
116 REFGUID guid, /* [in] clsid */
117 LPWSTR str, /* [out] buffer */
118 INT cmax) /* [in] size of buffer */
122 sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
123 guid->Data1, guid->Data2, guid->Data3,
124 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
125 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
126 return MultiByteToWideChar( CP_ACP, 0, xguid, -1, str, cmax );
129 /*************************************************************************
130 * SHLWAPI_30 [SHLWAPI.30]
132 * Seems to be an isspaceW.
134 BOOL WINAPI SHLWAPI_30(LPWSTR lpcChar)
148 /*************************************************************************
149 * SHLWAPI_32 [SHLWAPI.32]
151 BOOL WINAPI SHLWAPI_32(LPCWSTR lpcChar)
153 if (*lpcChar < (WCHAR)' ')
156 /* This is probably a shlwapi bug, but we do it the same for compatability */
157 if (((DWORD)lpcChar & 0xffff) - 127 <= (WCHAR)' ')
162 /*************************************************************************
163 * SHLWAPI_40 [SHLWAPI.40]
165 * Get pointer to next Unicode character.
167 LPCWSTR WINAPI SHLWAPI_40(LPCWSTR str)
169 return *str ? str + 1 : str;
172 /*************************************************************************
173 * SHLWAPI_74 [SHLWAPI.74]
175 * Get the text from a given dialog item.
177 INT WINAPI SHLWAPI_74(HWND hWnd, INT nItem, LPWSTR lpsDest,INT nDestLen)
179 HWND hItem = GetDlgItem(hWnd, nItem);
182 return GetWindowTextW(hItem, lpsDest, nDestLen);
184 *lpsDest = (WCHAR)'\0';
188 /*************************************************************************
189 * SHLWAPI_151 [SHLWAPI.151]
191 * pStr "HTTP/1.1", dw1 0x5
193 DWORD WINAPI SHLWAPI_151(LPSTR pStr, LPVOID ptr, DWORD dw1)
195 FIXME("('%s', %p, %08lx): stub\n", pStr, ptr, dw1);
199 /*************************************************************************
200 * SHLWAPI_152 [SHLWAPI.152]
202 DWORD WINAPI SHLWAPI_152(LPWSTR str1, LPWSTR str2, INT len)
207 while (--len && *str1 && *str1 == *str2)
212 return *str1 - *str2;
215 /*************************************************************************
216 * SHLWAPI_153 [SHLWAPI.153]
218 DWORD WINAPI SHLWAPI_153(LPSTR str1, LPSTR str2, DWORD dw3)
220 FIXME("'%s' '%s' %08lx - stub\n", str1, str2, dw3);
224 /*************************************************************************
225 * SHLWAPI_156 [SHLWAPI.156]
227 * Case sensitive string compare. Does not SetLastError().
229 DWORD WINAPI SHLWAPI_156 ( LPWSTR str1, LPWSTR str2)
231 while (*str1 && (*str1 == *str2)) { str1++; str2++; }
232 return (INT)(*str1 - *str2);
235 /*************************************************************************
236 * SHLWAPI_162 [SHLWAPI.162]
238 * Ensure a multibyte character string doesn't end in a hanging lead byte.
240 DWORD WINAPI SHLWAPI_162(LPSTR lpStr, DWORD size)
244 LPSTR lastByte = lpStr + size - 1;
246 while(lpStr < lastByte)
247 lpStr += IsDBCSLeadByte(*lpStr) ? 2 : 1;
249 if(lpStr == lastByte && IsDBCSLeadByte(*lpStr))
259 /*************************************************************************
260 * SHLWAPI_165 [SHLWAPI.165]
262 * SetWindowLongA with mask.
264 LONG WINAPI SHLWAPI_165(HWND hwnd, INT offset, UINT wFlags, UINT wMask)
266 LONG ret = GetWindowLongA(hwnd, offset);
267 UINT newFlags = (wFlags & wMask) | (ret & ~wFlags);
270 ret = SetWindowLongA(hwnd, offset, newFlags);
274 /*************************************************************************
275 * SHLWAPI_169 [SHLWAPI.169]
277 DWORD WINAPI SHLWAPI_169 (IUnknown * lpUnknown)
279 TRACE("(%p)\n",lpUnknown);
281 if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0;
282 return IUnknown_Release(lpUnknown);
287 /*************************************************************************
288 * SHLWAPI_170 [SHLWAPI.170]
290 * Skip URL '//' sequence.
292 LPCSTR WINAPI SHLWAPI_170(LPCSTR lpszSrc)
294 if (lpszSrc && lpszSrc[0] == '/' && lpszSrc[1] == '/')
299 /*************************************************************************
300 * SHLWAPI_181 [SHLWAPI.181]
302 * Enable or disable a menu item.
304 UINT WINAPI SHLWAPI_181(HMENU hMenu, UINT wItemID, BOOL bEnable)
306 return EnableMenuItem(hMenu, wItemID, bEnable ? MF_ENABLED : MF_GRAYED);
309 /*************************************************************************
310 * SHLWAPI_183 [SHLWAPI.183]
312 * Register a window class if it isn't already.
314 DWORD WINAPI SHLWAPI_183(WNDCLASSA *wndclass)
317 if (GetClassInfoA(wndclass->hInstance, wndclass->lpszClassName, &wca))
319 return (DWORD)RegisterClassA(wndclass);
322 /*************************************************************************
323 * SHLWAPI_193 [SHLWAPI.193]
325 DWORD WINAPI SHLWAPI_193 ()
333 ret = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
338 /*************************************************************************
339 * SHLWAPI_215 [SHLWAPI.215]
344 LPWSTR WINAPI SHLWAPI_215 (
349 WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len);
350 return strncpyW(lpwStrDest, lpStrSrc, len);
353 /*************************************************************************
354 * SHLWAPI_218 [SHLWAPI.218]
356 * WideCharToMultiByte with multi language support.
358 INT WINAPI SHLWAPI_218(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
359 LPINT lpnMultiCharCount)
361 static HRESULT (WINAPI *pfnFunc)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
362 WCHAR emptyW[] = { '\0' };
366 if (!lpDstStr || !lpnMultiCharCount)
374 len = strlenW(lpSrcStr) + 1;
379 CodePage = CP_UTF8; /* Fall through... */
380 case 0x0000C350: /* FIXME: CP_ #define */
385 INT nWideCharCount = len - 1;
387 GET_FUNC(mlang, "ConvertINetUnicodeToMultiByte", 0);
388 if (!pfnFunc(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
392 if (nWideCharCount < len - 1)
394 mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, *lpnMultiCharCount);
398 *lpnMultiCharCount = 0;
400 if (pfnFunc(&dwMode, CodePage, lpSrcStr, &len, mem, lpnMultiCharCount))
402 SHLWAPI_162 (mem, *lpnMultiCharCount);
403 lstrcpynA(lpDstStr, mem, *lpnMultiCharCount + 1);
404 return *lpnMultiCharCount + 1;
406 HeapFree(GetProcessHeap(), 0, mem);
407 return *lpnMultiCharCount;
409 lpDstStr[*lpnMultiCharCount] = '\0';
410 return *lpnMultiCharCount;
417 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, lpDstStr,
418 *lpnMultiCharCount, NULL, NULL);
420 if (!reqLen && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
422 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, NULL, 0, NULL, NULL);
425 mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, reqLen);
428 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, mem,
431 reqLen = SHLWAPI_162(mem, *lpnMultiCharCount);
434 lstrcpynA(lpDstStr, mem, *lpnMultiCharCount);
436 HeapFree(GetProcessHeap(), 0, mem);
443 /*************************************************************************
444 * SHLWAPI_217 [SHLWAPI.217]
447 INT WINAPI SHLWAPI_217(LPCWSTR lpSrcStr, LPSTR lpDstStr, LPINT lpnMultiCharCount)
449 return SHLWAPI_218(CP_ACP, lpSrcStr, lpDstStr, lpnMultiCharCount);
452 /*************************************************************************
453 * SHLWAPI_219 [SHLWAPI.219]
456 * error codes: E_POINTER, E_NOINTERFACE
458 HRESULT WINAPI SHLWAPI_219 (
459 LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */
461 REFIID riid, /* e.g. IWebBrowser2 */
462 LPWSTR z) /* [???] NOTE: OUT: path */
464 FIXME("(%p %s %s %p)stub\n",w,debugstr_a(x),debugstr_guid(riid),z);
468 /*************************************************************************
469 * SHLWAPI_222 [SHLWAPI.222]
472 * securityattributes missing
474 HANDLE WINAPI SHLWAPI_222 (LPCLSID guid)
478 sprintf( lpstrName, "shell.{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
479 guid->Data1, guid->Data2, guid->Data3,
480 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
481 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
482 FIXME("(%s) stub\n", lpstrName);
483 return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName);
486 /*************************************************************************
487 * SHLWAPI_223 [SHLWAPI.223]
490 * get the count of the semaphore
492 DWORD WINAPI SHLWAPI_223 (HANDLE handle)
496 FIXME("(0x%08x) stub\n",handle);
498 ReleaseSemaphore( handle, 1, &oldCount); /* +1 */
499 WaitForSingleObject( handle, 0 ); /* -1 */
503 /*************************************************************************
504 * SHLWAPI_237 [SHLWAPI.237]
506 * Unicode version of SHLWAPI_183.
508 DWORD WINAPI SHLWAPI_237 (WNDCLASSW * lpWndClass)
512 TRACE("(0x%08x %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName));
514 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass))
516 return RegisterClassW(lpWndClass);
519 /*************************************************************************
520 * SHLWAPI_240 [SHLWAPI.240]
522 * Calls ASCII or Unicode WindowProc for the given window.
524 LRESULT CALLBACK SHLWAPI_240(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
526 if (IsWindowUnicode(hWnd))
527 return DefWindowProcW(hWnd, uMessage, wParam, lParam);
528 return DefWindowProcA(hWnd, uMessage, wParam, lParam);
531 /*************************************************************************
532 * SHLWAPI_241 [SHLWAPI.241]
535 DWORD WINAPI SHLWAPI_241 ()
541 /*************************************************************************
542 * SHLWAPI_266 [SHLWAPI.266]
544 DWORD WINAPI SHLWAPI_266 (
550 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
554 /*************************************************************************
555 * SHLWAPI_267 [SHLWAPI.267]
557 HRESULT WINAPI SHLWAPI_267 (
558 LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */
559 LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */
563 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
564 *((LPDWORD)z) = 0xabba1200;
568 /*************************************************************************
569 * SHLWAPI_268 [SHLWAPI.268]
571 DWORD WINAPI SHLWAPI_268 (
575 FIXME("(%p %p)\n",w,x);
576 return 0xabba1251; /* 0 = failure */
579 /*************************************************************************
580 * SHLWAPI_276 [SHLWAPI.276]
583 DWORD WINAPI SHLWAPI_276 ()
589 /*************************************************************************
590 * SHLWAPI_278 [SHLWAPI.278]
593 DWORD WINAPI SHLWAPI_278 (
604 char * clsname = "WorkerA";
606 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n",
607 wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z);
609 hCursor = LoadCursorA(0x00000000,IDC_ARROWA);
611 if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass))
613 RtlZeroMemory(&wndclass, sizeof(WNDCLASSA));
614 wndclass.lpfnWndProc = DefWindowProcW;
615 wndclass.cbWndExtra = 4;
616 wndclass.hInstance = shlwapi_hInstance;
617 wndclass.hCursor = hCursor;
618 wndclass.hbrBackground = COLOR_BTNSHADOW;
619 wndclass.lpszMenuName = NULL;
620 wndclass.lpszClassName = clsname;
621 RegisterClassA (&wndclass);
623 hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent,
624 hMenu,shlwapi_hInstance,0);
625 SetWindowLongA(hwnd, 0, z);
626 SetWindowLongA(hwnd, GWL_WNDPROC, wndProc);
630 /*************************************************************************
631 * SHLWAPI_289 [SHLWAPI.289]
633 * Late bound call to winmm.PlaySoundW
635 BOOL WINAPI SHLWAPI_289(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
637 static BOOL (WINAPI *pfnFunc)(LPCWSTR, HMODULE, DWORD) = NULL;
639 GET_FUNC(winmm, "PlaySoundW", FALSE);
640 return pfnFunc(pszSound, hmod, fdwSound);
643 /*************************************************************************
644 * SHLWAPI_294 [SHLWAPI.294]
646 BOOL WINAPI SHLWAPI_294(LPSTR str1, LPSTR str2, LPSTR pStr, DWORD some_len, LPCSTR lpStr2)
649 * str1: "I" "I" pushl esp+0x20
650 * str2: "U" "I" pushl 0x77c93810
651 * (is "I" and "U" "integer" and "unsigned" ??)
653 * pStr: "" "" pushl eax
654 * some_len: 0x824 0x104 pushl 0x824
655 * lpStr2: "%l" "%l" pushl esp+0xc
657 * shlwapi. StrCpyNW(lpStr2, irrelevant_var, 0x104);
658 * LocalAlloc(0x00, some_len) -> irrelevant_var
659 * LocalAlloc(0x40, irrelevant_len) -> pStr
660 * shlwapi.294(str1, str2, pStr, some_len, lpStr2);
661 * shlwapi.PathRemoveBlanksW(pStr);
663 ERR("('%s', '%s', '%s', %08lx, '%s'): stub!\n", str1, str2, pStr, some_len, lpStr2);
667 /*************************************************************************
668 * SHLWAPI_313 [SHLWAPI.313]
670 * Late bound call to shell32.SHGetFileInfoW
672 DWORD WINAPI SHLWAPI_313(LPCWSTR path, DWORD dwFileAttributes,
673 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
675 static DWORD (WINAPI *pfnFunc)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT) = NULL;
677 GET_FUNC(shell32, "SHGetFileInfoW", 0);
678 return pfnFunc(path, dwFileAttributes, psfi, sizeofpsfi, flags);
681 /*************************************************************************
682 * SHLWAPI_318 [SHLWAPI.318]
684 * Late bound call to shell32.DragQueryFileW
686 UINT WINAPI SHLWAPI_318(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
688 static UINT (WINAPI *pfnFunc)(HDROP, UINT, LPWSTR, UINT) = NULL;
690 GET_FUNC(shell32, "DragQueryFileW", 0);
691 return pfnFunc(hDrop, lFile, lpszFile, lLength);
694 /*************************************************************************
695 * SHLWAPI_333 [SHLWAPI.333]
697 * Late bound call to shell32.SHBrowseForFolderW
699 LPITEMIDLIST WINAPI SHLWAPI_333(LPBROWSEINFOW lpBi)
701 static LPITEMIDLIST (WINAPI *pfnFunc)(LPBROWSEINFOW) = NULL;
703 GET_FUNC(shell32, "SHBrowseForFolderW", NULL);
704 return pfnFunc(lpBi);
707 /*************************************************************************
708 * SHLWAPI_334 [SHLWAPI.334]
710 * Late bound call to shell32.SHGetPathFromIDListW
712 BOOL WINAPI SHLWAPI_334(LPCITEMIDLIST pidl,LPWSTR pszPath)
714 static BOOL (WINAPI *pfnFunc)(LPCITEMIDLIST, LPWSTR) = NULL;
716 GET_FUNC(shell32, "SHGetPathFromIDListW", 0);
717 return pfnFunc(pidl, pszPath);
720 /*************************************************************************
721 * SHLWAPI_335 [SHLWAPI.335]
723 * Late bound call to shell32.ShellExecuteExW
725 BOOL WINAPI SHLWAPI_335(LPSHELLEXECUTEINFOW lpExecInfo)
727 static BOOL (WINAPI *pfnFunc)(LPSHELLEXECUTEINFOW) = NULL;
729 GET_FUNC(shell32, "ShellExecuteExW", FALSE);
730 return pfnFunc(lpExecInfo);
733 /*************************************************************************
734 * SHLWAPI_336 [SHLWAPI.336]
736 * Late bound call to shell32.SHFileOperationW.
738 DWORD WINAPI SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp)
740 static HICON (WINAPI *pfnFunc)(LPSHFILEOPSTRUCTW) = NULL;
742 GET_FUNC(shell32, "SHFileOperationW", 0);
743 return pfnFunc(lpFileOp);
746 /*************************************************************************
747 * SHLWAPI_337 [SHLWAPI.337]
749 * Late bound call to shell32.ExtractIconExW.
751 HICON WINAPI SHLWAPI_337(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge,
752 HICON *phiconSmall, UINT nIcons)
754 static HICON (WINAPI *pfnFunc)(LPCWSTR, INT,HICON *,HICON *, UINT) = NULL;
756 GET_FUNC(shell32, "ExtractIconExW", (HICON)0);
757 return pfnFunc(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
760 /*************************************************************************
761 * SHLWAPI_342 [SHLWAPI.342]
764 DWORD WINAPI SHLWAPI_342 (
770 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
774 /*************************************************************************
775 * SHLWAPI_346 [SHLWAPI.346]
777 DWORD WINAPI SHLWAPI_346 (
782 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src),dest,len);
783 lstrcpynW(dest, src, len);
784 return lstrlenW(dest)+1;
787 /*************************************************************************
788 * SHLWAPI_357 [SHLWAPI.357]
790 * Late bound call to shell32.SHGetNewLinkInfoW
792 BOOL WINAPI SHLWAPI_357(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName,
793 BOOL *pfMustCopy, UINT uFlags)
795 static BOOL (WINAPI *pfnFunc)(LPCWSTR, LPCWSTR, LPCWSTR, BOOL*, UINT) = NULL;
797 GET_FUNC(shell32, "SHGetNewLinkInfoW", FALSE);
798 return pfnFunc(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
801 /*************************************************************************
802 * SHLWAPI_358 [SHLWAPI.358]
804 * Late bound call to shell32.SHDefExtractIconW
806 DWORD WINAPI SHLWAPI_358(LPVOID arg1, LPVOID arg2, LPVOID arg3, LPVOID arg4,
807 LPVOID arg5, LPVOID arg6)
809 /* FIXME: Correct args */
810 static DWORD (WINAPI *pfnFunc)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID, LPVOID) = NULL;
812 GET_FUNC(shell32, "SHDefExtractIconW", 0);
813 return pfnFunc(arg1, arg2, arg3, arg4, arg5, arg6);
816 /*************************************************************************
817 * SHLWAPI_364 [SHLWAPI.364]
819 * Wrapper for lstrcpynA with src and dst swapped.
821 DWORD WINAPI SHLWAPI_364(LPCSTR src, LPSTR dst, INT n)
823 lstrcpynA(dst, src, n);
827 /*************************************************************************
828 * SHLWAPI_370 [SHLWAPI.370]
830 * Late bound call to shell32.ExtractIconW
832 HICON WINAPI SHLWAPI_370(HINSTANCE hInstance, LPCWSTR lpszExeFileName,
835 static HICON (WINAPI *pfnFunc)(HINSTANCE, LPCWSTR, UINT) = NULL;
837 GET_FUNC(shell32, "ExtractIconW", (HICON)0);
838 return pfnFunc(hInstance, lpszExeFileName, nIconIndex);
841 /*************************************************************************
842 * SHLWAPI_376 [SHLWAPI.376]
844 DWORD WINAPI SHLWAPI_376 (LONG x)
846 FIXME("(0x%08lx)stub\n", x );
847 /* FIXME: This should be a forward in the .spec file to the win2k function
848 * kernel32.GetUserDefaultUILanguage, however that function isn't there yet.
853 /*************************************************************************
854 * SHLWAPI_377 [SHLWAPI.377]
856 DWORD WINAPI SHLWAPI_377 (LPVOID x, LPVOID y, LPVOID z)
858 FIXME("(%p %p %p)stub\n", x,y,z);
862 /*************************************************************************
863 * SHLWAPI_378 [SHLWAPI.378]
865 DWORD WINAPI SHLWAPI_378 (
867 LPVOID y, /* [???] 0x50000000 */
868 LPVOID z) /* [???] 4 */
870 FIXME("(%s %p %p)stub\n", x,y,z);
871 return LoadLibraryA(x);
874 /*************************************************************************
875 * SHLWAPI_389 [SHLWAPI.389]
877 * Late bound call to comdlg32.GetSaveFileNameW
879 BOOL WINAPI SHLWAPI_389(LPOPENFILENAMEW ofn)
881 static BOOL (WINAPI *pfnFunc)(LPOPENFILENAMEW) = NULL;
883 GET_FUNC(comdlg32, "GetSaveFileNameW", FALSE);
887 /*************************************************************************
888 * SHLWAPI_390 [SHLWAPI.390]
890 * Late bound call to mpr.WNetRestoreConnectionW
892 DWORD WINAPI SHLWAPI_390(LPVOID arg1, LPVOID arg2)
894 /* FIXME: Correct args */
895 static DWORD (WINAPI *pfnFunc)(LPVOID, LPVOID) = NULL;
897 GET_FUNC(mpr, "WNetRestoreConnectionW", 0);
898 return pfnFunc(arg1, arg2);
901 /*************************************************************************
902 * SHLWAPI_391 [SHLWAPI.391]
904 * Late bound call to mpr.WNetGetLastErrorW
906 DWORD WINAPI SHLWAPI_391(LPVOID arg1, LPVOID arg2, LPVOID arg3, LPVOID arg4,
909 /* FIXME: Correct args */
910 static DWORD (WINAPI *pfnFunc)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID) = NULL;
912 GET_FUNC(mpr, "WNetGetLastErrorW", 0);
913 return pfnFunc(arg1, arg2, arg3, arg4, arg5);
916 /*************************************************************************
917 * SHLWAPI_401 [SHLWAPI.401]
919 * Late bound call to comdlg32.PageSetupDlgW
921 BOOL WINAPI SHLWAPI_401(LPPAGESETUPDLGW pagedlg)
923 static BOOL (WINAPI *pfnFunc)(LPPAGESETUPDLGW) = NULL;
925 GET_FUNC(comdlg32, "PageSetupDlgW", FALSE);
926 return pfnFunc(pagedlg);
929 /*************************************************************************
930 * SHLWAPI_402 [SHLWAPI.402]
932 * Late bound call to comdlg32.PrintDlgW
934 BOOL WINAPI SHLWAPI_402(LPPRINTDLGW printdlg)
936 static BOOL (WINAPI *pfnFunc)(LPPRINTDLGW) = NULL;
938 GET_FUNC(comdlg32, "PrintDlgW", FALSE);
939 return pfnFunc(printdlg);
942 /*************************************************************************
943 * SHLWAPI_403 [SHLWAPI.403]
945 * Late bound call to comdlg32.GetOpenFileNameW
947 BOOL WINAPI SHLWAPI_403(LPOPENFILENAMEW ofn)
949 static BOOL (WINAPI *pfnFunc)(LPOPENFILENAMEW) = NULL;
951 GET_FUNC(comdlg32, "GetOpenFileNameW", FALSE);
955 /* INTERNAL: Map from HLS color space to RGB */
956 static WORD ConvertHue(int wHue, WORD wMid1, WORD wMid2)
958 wHue = wHue > 240 ? wHue - 240 : wHue < 0 ? wHue + 240 : wHue;
967 return ((wHue * (wMid2 - wMid1) + 20) / 40) + wMid1;
970 /* Convert to RGB and scale into RGB range (0..255) */
971 #define GET_RGB(h) (ConvertHue(h, wMid1, wMid2) * 255 + 120) / 240
973 /*************************************************************************
974 * ColorHLSToRGB [SHLWAPI.404]
976 * Convert from HLS color space into an RGB COLORREF.
979 * Input HLS values are constrained to the range (0..240).
981 COLORREF WINAPI ColorHLSToRGB(WORD wHue, WORD wLuminosity, WORD wSaturation)
987 WORD wGreen, wBlue, wMid1, wMid2;
989 if (wLuminosity > 120)
990 wMid2 = wSaturation + wLuminosity - (wSaturation * wLuminosity + 120) / 240;
992 wMid2 = ((wSaturation + 240) * wLuminosity + 120) / 240;
994 wMid1 = wLuminosity * 2 - wMid2;
996 wRed = GET_RGB(wHue + 80);
997 wGreen = GET_RGB(wHue);
998 wBlue = GET_RGB(wHue - 80);
1000 return RGB(wRed, wGreen, wBlue);
1003 wRed = wLuminosity * 255 / 240;
1004 return RGB(wRed, wRed, wRed);
1007 /*************************************************************************
1008 * SHLWAPI_431 [SHLWAPI.431]
1010 DWORD WINAPI SHLWAPI_431 (DWORD x)
1012 FIXME("(0x%08lx)stub\n", x);
1016 /*************************************************************************
1017 * SHLWAPI_437 [SHLWAPI.437]
1020 * In the real shlwapi, One time initialisation calls GetVersionEx and reads
1021 * the registry to determine what O/S & Service Pack level is running, and
1022 * therefore which functions are available. Currently we always run as NT,
1023 * since this means that we don't need extra code to emulate Unicode calls,
1024 * they are forwarded directly to the appropriate API call instead.
1025 * Since the flags for whether to call or emulate Unicode are internal to
1026 * the dll, this function does not need a full implementation.
1028 DWORD WINAPI SHLWAPI_437 (DWORD functionToCall)
1030 FIXME("(0x%08lx)stub\n", functionToCall);
1034 /*************************************************************************
1035 * SHCreateShellPalette [SHLWAPI.@]
1037 HPALETTE WINAPI SHCreateShellPalette(HDC hdc)
1040 return CreateHalftonePalette(hdc);
1043 /*************************************************************************
1046 DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why)
1048 FIXME("(%p, %#lx)stub\n", x, why);
1052 /*************************************************************************
1053 * SHIsLowMemoryMachine [SHLWAPI.@]
1055 DWORD WINAPI SHIsLowMemoryMachine (DWORD x)
1057 FIXME("0x%08lx\n", x);
1061 /*************************************************************************
1062 * GetMenuPosFromID [SHLWAPI.@]
1064 INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
1067 INT nCount = GetMenuItemCount(hMenu), nIter = 0;
1069 while (nIter < nCount)
1072 if (!GetMenuItemInfoA(hMenu, nIter, TRUE, &mi) && mi.wID == wID)
1079 /*************************************************************************
1080 * _SHGetInstanceExplorer [SHLWAPI.@]
1082 * Late bound call to shell32.SHGetInstanceExplorer.
1084 HRESULT WINAPI _SHGetInstanceExplorer (LPUNKNOWN *lpUnknown)
1086 static HRESULT (WINAPI *pfnFunc)(LPUNKNOWN *) = NULL;
1088 GET_FUNC(shell32, "SHGetInstanceExplorer", E_FAIL);
1089 return pfnFunc(lpUnknown);