source: trunk/src/shlwapi/ordinal.c@ 6650

Last change on this file since 6650 was 6650, checked in by bird, 24 years ago

Added $Id:$ keyword.

File size: 29.8 KB
Line 
1/* $Id: ordinal.c,v 1.6 2001-09-05 13:48:37 bird Exp $ */
2/*
3 * SHLWAPI ordinal functions
4 *
5 * Copyright 1997 Marcus Meissner
6 * 1998 Jürgen Schmied
7 * 2001 Jon Griffiths
8 */
9
10#include <stdio.h>
11#include <string.h>
12
13#include "windef.h"
14#include "winnls.h"
15#include "winbase.h"
16#include "ddeml.h"
17#include "shlobj.h"
18#include "shellapi.h"
19#include "commdlg.h"
20#include "wine/unicode.h"
21#include "wine/obj_base.h"
22#include "wingdi.h"
23#include "winuser.h"
24#include "debugtools.h"
25
26DEFAULT_DEBUG_CHANNEL(shell);
27
28#ifdef __WIN32OS2__
29extern HINSTANCE shlwapi_hInstance = 0;
30extern HMODULE SHLWAPI_hshell32 = 0;
31extern HMODULE SHLWAPI_hwinmm = 0;
32extern HMODULE SHLWAPI_hcomdlg32 = 0;
33extern HMODULE SHLWAPI_hmpr = 0;
34extern HMODULE SHLWAPI_hmlang = 0;
35#undef FIXME
36#ifdef DEBUG
37#define FIXME WriteLog("FIXME %s", __FUNCTION__); WriteLog
38#else
39#define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
40#endif
41#else
42extern HINSTANCE shlwapi_hInstance;
43extern HMODULE SHLWAPI_hshell32;
44extern HMODULE SHLWAPI_hwinmm;
45extern HMODULE SHLWAPI_hcomdlg32;
46extern HMODULE SHLWAPI_hmpr;
47extern HMODULE SHLWAPI_hmlang;
48#endif
49
50/* Macro to get function pointer for a module*/
51#define GET_FUNC(module, name, fail) \
52 if (!SHLWAPI_h##module) SHLWAPI_h##module = LoadLibraryA(#module ".dll"); \
53 if (!SHLWAPI_h##module) return fail; \
54 if (!pfnFunc) pfnFunc = (void*)GetProcAddress(SHLWAPI_h##module, name); \
55 if (!pfnFunc) return fail
56
57/*
58 NOTES: Most functions exported by ordinal seem to be superflous.
59 The reason for these functions to be there is to provide a wraper
60 for unicode functions to provide these functions on systems without
61 unicode functions eg. win95/win98. Since we have such functions we just
62 call these. If running Wine with native DLL's, some late bound calls may
63 fail. However, its better to implement the functions in the forward DLL
64 and recommend the builtin rather than reimplementing the calls here!
65*/
66#ifndef __WIN32OS2__
67/*************************************************************************
68 * SHLWAPI_1 [SHLWAPI.1]
69 */
70DWORD WINAPI SHLWAPI_1 (
71 LPSTR lpURL,
72 LPDWORD lpdwFlags)
73{
74 if (lpURL == NULL)
75 return E_INVALIDARG;
76
77 if (lpdwFlags == NULL)
78 return E_INVALIDARG;
79
80 // verify flags
81 if (*lpdwFlags != 0x18) // some unknown flag
82 return E_INVALIDARG; // some unknown error condition
83
84 FIXME("(%p %s %p %s)\n",lpStr, debugstr_a(lpStr),x, debugstr_a(x));
85 return 0;
86}
87
88/*************************************************************************
89 * SHLWAPI_2 [SHLWAPI.2]
90 */
91DWORD WINAPI SHLWAPI_2 (LPCWSTR x,LPVOID y)
92{
93 FIXME("(%s,%p)\n",debugstr_w(x),y);
94 return 0;
95}
96
97/*************************************************************************
98 * SHLWAPI_16 [SHLWAPI.16]
99 */
100HRESULT WINAPI SHLWAPI_16 (
101 LPVOID w,
102 LPVOID x,
103 LPVOID y,
104 LPWSTR z)
105{
106 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
107 return 0xabba1252;
108}
109#endif
110
111/*************************************************************************
112 * SHLWAPI_23 [SHLWAPI.23]
113 *
114 * NOTES
115 * converts a guid to a string
116 * returns strlen(str)
117 */
118DWORD WINAPI SHLWAPI_23 (
119 REFGUID guid, /* [in] clsid */
120 LPSTR str, /* [out] buffer */
121 INT cmax) /* [in] size of buffer */
122{
123 char xguid[40];
124
125 sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
126 guid->Data1, guid->Data2, guid->Data3,
127 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
128 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
129 TRACE("(%s %p 0x%08x)stub\n", xguid, str, cmax);
130 if (strlen(xguid)>=cmax) return 0;
131 strcpy(str,xguid);
132 return strlen(xguid) + 1;
133}
134
135/*************************************************************************
136 * SHLWAPI_24 [SHLWAPI.24]
137 *
138 * NOTES
139 * converts a guid to a string
140 * returns strlen(str)
141 */
142DWORD WINAPI SHLWAPI_24 (
143 REFGUID guid, /* [in] clsid */
144 LPWSTR str, /* [out] buffer */
145 INT cmax) /* [in] size of buffer */
146{
147 char xguid[40];
148
149 sprintf( xguid, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
150 guid->Data1, guid->Data2, guid->Data3,
151 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
152 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
153 return MultiByteToWideChar( CP_ACP, 0, xguid, -1, str, cmax );
154}
155
156/*************************************************************************
157 * SHLWAPI_30 [SHLWAPI.30]
158 *
159 * Seems to be an isspaceW.
160 */
161BOOL WINAPI SHLWAPI_30(LPWSTR lpcChar)
162{
163 switch (*lpcChar)
164 {
165 case (WCHAR)'\t':
166 case (WCHAR)' ':
167 case 160:
168 case 12288:
169 case 65279:
170 return TRUE;
171 }
172 return FALSE;
173}
174
175/*************************************************************************
176 * SHLWAPI_32 [SHLWAPI.32]
177 */
178BOOL WINAPI SHLWAPI_32(LPCWSTR lpcChar)
179{
180 if (*lpcChar < (WCHAR)' ')
181 return TRUE;
182
183 /* This is probably a shlwapi bug, but we do it the same for compatability */
184 if (((DWORD)lpcChar & 0xffff) - 127 <= (WCHAR)' ')
185 return TRUE;
186 return FALSE;
187}
188
189/*************************************************************************
190 * SHLWAPI_40 [SHLWAPI.40]
191 *
192 * Get pointer to next Unicode character.
193 */
194LPCWSTR WINAPI SHLWAPI_40(LPCWSTR str)
195{
196 return *str ? str + 1 : str;
197}
198
199/*************************************************************************
200 * SHLWAPI_74 [SHLWAPI.74]
201 *
202 * Get the text from a given dialog item.
203 */
204INT WINAPI SHLWAPI_74(HWND hWnd, INT nItem, LPWSTR lpsDest,INT nDestLen)
205{
206 HWND hItem = GetDlgItem(hWnd, nItem);
207
208 if (hItem)
209 return GetWindowTextW(hItem, lpsDest, nDestLen);
210 if (nDestLen)
211 *lpsDest = (WCHAR)'\0';
212 return 0;
213}
214/*************************************************************************
215 * SHLWAPI_151 [SHLWAPI.151]
216 */
217#ifdef __WIN32OS2__
218DWORD WINAPI SHLWAPI_151(LPSTR str1, LPSTR str2, INT len)
219{
220 dprintf(("SHLWAPI_151 (strcmpn) %s %s %d", str1, str2, len));
221 if (!len)
222 return 0;
223
224 while (--len && *str1 && *str1 == *str2)
225 {
226 str1++;
227 str2++;
228 }
229 return *str1 - *str2;
230
231}
232#else
233DWORD WINAPI SHLWAPI_151(void)
234{
235 FIXME(": stub\n");
236 return 0;
237}
238#endif
239
240/*************************************************************************
241 * SHLWAPI_152 [SHLWAPI.152]
242 */
243DWORD WINAPI SHLWAPI_152(LPWSTR str1, LPWSTR str2, INT len)
244{
245 if (!len)
246 return 0;
247
248 while (--len && *str1 && *str1 == *str2)
249 {
250 str1++;
251 str2++;
252 }
253 return *str1 - *str2;
254}
255
256/*************************************************************************
257 * SHLWAPI_153 [SHLWAPI.153]
258 */
259#ifdef __WIN32OS2__
260//case insensitive string compare with length (ascii)
261DWORD WINAPI SHLWAPI_153(LPSTR str1, LPSTR str2, DWORD len)
262{
263 if (!len)
264 return 0;
265
266 return lstrncmpiA(str1, str2, len);
267}
268
269//case insensitive string compare with length (unicode)
270DWORD WINAPI SHLWAPI_154(LPWSTR str1, LPWSTR str2, DWORD len)
271{
272 if (!len)
273 return 0;
274
275 return lstrncmpiW(str1, str2, len);
276}
277
278#else
279DWORD WINAPI SHLWAPI_153(DWORD dw1, DWORD dw2, DWORD dw3)
280{
281 FIXME("%08lx %08lx %08lx - stub\n", dw1, dw2, dw3);
282 return 0;
283}
284#endif
285
286/*************************************************************************
287 * SHLWAPI_156 [SHLWAPI.156]
288 *
289 * Case sensitive string compare. Does not SetLastError().
290 */
291DWORD WINAPI SHLWAPI_156 ( LPWSTR str1, LPWSTR str2)
292{
293 while (*str1 && (*str1 == *str2)) { str1++; str2++; }
294 return (INT)(*str1 - *str2);
295}
296
297/*************************************************************************
298 * SHLWAPI_162 [SHLWAPI.162]
299 *
300 * Ensure a multibyte character string doesn't end in a hanging lead byte.
301 */
302DWORD WINAPI SHLWAPI_162(LPSTR lpStr, DWORD size)
303{
304 if (lpStr && size)
305 {
306 LPSTR lastByte = lpStr + size - 1;
307
308 while(lpStr < lastByte)
309 lpStr += IsDBCSLeadByte(*lpStr) ? 2 : 1;
310
311 if(lpStr == lastByte && IsDBCSLeadByte(*lpStr))
312 {
313 *lpStr = '\0';
314 size--;
315 }
316 return size;
317 }
318 return 0;
319}
320
321/*************************************************************************
322 * SHLWAPI_165 [SHLWAPI.165]
323 *
324 * SetWindowLongA with mask.
325 */
326LONG WINAPI SHLWAPI_165(HWND hwnd, INT offset, UINT wFlags, UINT wMask)
327{
328 LONG ret = GetWindowLongA(hwnd, offset);
329 UINT newFlags = (wFlags & wMask) | (ret & ~wFlags);
330
331 if (newFlags != ret)
332 ret = SetWindowLongA(hwnd, offset, newFlags);
333 return ret;
334}
335
336/*************************************************************************
337 * SHLWAPI_169 [SHLWAPI.169]
338 */
339DWORD WINAPI SHLWAPI_169 (IUnknown * lpUnknown)
340{
341 TRACE("(%p)\n",lpUnknown);
342#if 0
343 if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0;
344 return IUnknown_Release(lpUnknown);
345#endif
346 return 0;
347}
348
349/*************************************************************************
350 * SHLWAPI_170 [SHLWAPI.170]
351 *
352 * Skip URL '//' sequence.
353 */
354LPCSTR WINAPI SHLWAPI_170(LPCSTR lpszSrc)
355{
356 if (lpszSrc && lpszSrc[0] == '/' && lpszSrc[1] == '/')
357 lpszSrc += 2;
358 return lpszSrc;
359}
360
361/*************************************************************************
362 * SHLWAPI_181 [SHLWAPI.181]
363 *
364 * Enable or disable a menu item.
365 */
366UINT WINAPI SHLWAPI_181(HMENU hMenu, UINT wItemID, BOOL bEnable)
367{
368 return EnableMenuItem(hMenu, wItemID, bEnable ? MF_ENABLED : MF_GRAYED);
369}
370
371/*************************************************************************
372 * SHLWAPI_183 [SHLWAPI.183]
373 *
374 * Register a window class if it isn't already.
375 */
376DWORD WINAPI SHLWAPI_183(WNDCLASSA *wndclass)
377{
378 WNDCLASSA wca;
379 if (GetClassInfoA(wndclass->hInstance, wndclass->lpszClassName, &wca))
380 return TRUE;
381 return (DWORD)RegisterClassA(wndclass);
382}
383
384/*************************************************************************
385 * SHLWAPI_193 [SHLWAPI.193]
386 */
387DWORD WINAPI SHLWAPI_193 ()
388{
389 HDC hdc;
390 DWORD ret;
391
392 TRACE("()\n");
393
394 hdc = GetDC(0);
395 ret = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES);
396 ReleaseDC(0, hdc);
397 return ret;
398}
399
400/*************************************************************************
401 * SHLWAPI_215 [SHLWAPI.215]
402 *
403 * NOTES
404 * check me!
405 */
406LPWSTR WINAPI SHLWAPI_215 (
407 LPWSTR lpStrSrc,
408 LPVOID lpwStrDest,
409 int len)
410{
411 WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len);
412 return strncpyW(lpwStrDest, lpStrSrc, len);
413}
414
415/*************************************************************************
416 * SHLWAPI_218 [SHLWAPI.218]
417 *
418 * WideCharToMultiByte with multi language support.
419 */
420INT WINAPI SHLWAPI_218(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
421 LPINT lpnMultiCharCount)
422{
423#ifdef __WIN32OS2__
424 static HRESULT (* WINAPI pfnFunc)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
425#else
426 static HRESULT (* WINAPI pfnFunc)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
427#endif
428 WCHAR emptyW[] = { '\0' };
429 int len , reqLen;
430 LPSTR mem;
431
432 if (!lpDstStr || !lpnMultiCharCount)
433 return 0;
434
435 if (!lpSrcStr)
436 lpSrcStr = emptyW;
437
438 *lpDstStr = '\0';
439
440 len = strlenW(lpSrcStr) + 1;
441
442 switch (CodePage)
443 {
444 case CP_WINUNICODE:
445 CodePage = CP_UTF8; /* Fall through... */
446 case 0x0000C350: /* FIXME: CP_ #define */
447 case CP_UTF7:
448 case CP_UTF8:
449 {
450 DWORD dwMode = 0;
451 INT nWideCharCount = len - 1;
452
453 GET_FUNC(mlang, "ConvertINetUnicodeToMultiByte", 0);
454 if (!pfnFunc(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
455 lpnMultiCharCount))
456 return 0;
457
458 if (nWideCharCount < len - 1)
459 {
460 mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, *lpnMultiCharCount);
461 if (!mem)
462 return 0;
463
464 *lpnMultiCharCount = 0;
465
466 if (pfnFunc(&dwMode, CodePage, lpSrcStr, &len, mem, lpnMultiCharCount))
467 {
468 SHLWAPI_162 (mem, *lpnMultiCharCount);
469 lstrcpynA(lpDstStr, mem, *lpnMultiCharCount + 1);
470 return *lpnMultiCharCount + 1;
471 }
472 HeapFree(GetProcessHeap(), 0, mem);
473 return *lpnMultiCharCount;
474 }
475 lpDstStr[*lpnMultiCharCount] = '\0';
476 return *lpnMultiCharCount;
477 }
478 break;
479 default:
480 break;
481 }
482
483 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, lpDstStr,
484 *lpnMultiCharCount, NULL, NULL);
485
486 if (!reqLen && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
487 {
488 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, NULL, 0, NULL, NULL);
489 if (reqLen)
490 {
491 mem = (LPSTR)HeapAlloc(GetProcessHeap(), 0, reqLen);
492 if (mem)
493 {
494 reqLen = WideCharToMultiByte(CodePage, 0, lpSrcStr, len, mem,
495 reqLen, NULL, NULL);
496
497 reqLen = SHLWAPI_162(mem, *lpnMultiCharCount);
498 reqLen++;
499
500 lstrcpynA(lpDstStr, mem, *lpnMultiCharCount);
501
502 HeapFree(GetProcessHeap(), 0, mem);
503 }
504 }
505 }
506 return reqLen;
507}
508
509/*************************************************************************
510 * SHLWAPI_217 [SHLWAPI.217]
511 *
512 */
513INT WINAPI SHLWAPI_217(LPCWSTR lpSrcStr, LPSTR lpDstStr, LPINT lpnMultiCharCount)
514{
515 return SHLWAPI_218(CP_ACP, lpSrcStr, lpDstStr, lpnMultiCharCount);
516}
517
518#ifndef __WIN32OS2__
519/*************************************************************************
520 * SHLWAPI_219 [SHLWAPI.219]
521 *
522 * NOTES
523 * error codes: E_POINTER, E_NOINTERFACE
524 */
525HRESULT WINAPI SHLWAPI_219 (
526 LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */
527 LPVOID x,
528 REFIID riid,
529 LPWSTR z) /* [???] NOTE: OUT: path */
530{
531 FIXME("(%p %p %s %p)stub\n",w,x,debugstr_guid(riid),z);
532 return 0xabba1252;
533}
534#endif
535
536/*************************************************************************
537 * SHLWAPI_222 [SHLWAPI.222]
538 *
539 * NOTES
540 * securityattributes missing
541 */
542HANDLE WINAPI SHLWAPI_222 (LPCLSID guid)
543{
544 char lpstrName[80];
545
546 sprintf( lpstrName, "shell.{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
547 guid->Data1, guid->Data2, guid->Data3,
548 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
549 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7] );
550 FIXME("(%s) stub\n", lpstrName);
551 return CreateSemaphoreA(NULL,0, 0x7fffffff, lpstrName);
552}
553
554/*************************************************************************
555 * SHLWAPI_223 [SHLWAPI.223]
556 *
557 * NOTES
558 * get the count of the semaphore
559 */
560DWORD WINAPI SHLWAPI_223 (HANDLE handle)
561{
562 DWORD oldCount;
563
564 FIXME("(0x%08x) stub\n",handle);
565
566 ReleaseSemaphore( handle, 1, &oldCount); /* +1 */
567 WaitForSingleObject( handle, 0 ); /* -1 */
568 return oldCount;
569}
570
571/*************************************************************************
572 * SHLWAPI_237 [SHLWAPI.237]
573 *
574 * Unicode version of SHLWAPI_183.
575 */
576DWORD WINAPI SHLWAPI_237 (WNDCLASSW * lpWndClass)
577{
578 WNDCLASSW WndClass;
579
580 TRACE("(0x%08x %s)\n",lpWndClass->hInstance, debugstr_w(lpWndClass->lpszClassName));
581
582 if (GetClassInfoW(lpWndClass->hInstance, lpWndClass->lpszClassName, &WndClass))
583 return TRUE;
584 return RegisterClassW(lpWndClass);
585}
586
587/*************************************************************************
588 * SHLWAPI_240 [SHLWAPI.240]
589 *
590 * Calls ASCII or Unicode WindowProc for the given window.
591 */
592LRESULT CALLBACK SHLWAPI_240(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
593{
594 if (IsWindowUnicode(hWnd))
595 return DefWindowProcW(hWnd, uMessage, wParam, lParam);
596 return DefWindowProcA(hWnd, uMessage, wParam, lParam);
597}
598#ifndef __WIN32OS2__
599/*************************************************************************
600 * SHLWAPI_241 [SHLWAPI.241]
601 *
602 */
603DWORD WINAPI SHLWAPI_241 ()
604{
605 FIXME("()stub\n");
606 return 0xabba1243;
607}
608
609/*************************************************************************
610 * SHLWAPI_266 [SHLWAPI.266]
611 */
612DWORD WINAPI SHLWAPI_266 (
613 LPVOID w,
614 LPVOID x,
615 LPVOID y,
616 LPVOID z)
617{
618 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
619 return 0xabba1248;
620}
621
622/*************************************************************************
623 * SHLWAPI_267 [SHLWAPI.267]
624 */
625HRESULT WINAPI SHLWAPI_267 (
626 LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */
627 LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */
628 LPVOID y,
629 LPVOID z)
630{
631 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
632 *((LPDWORD)z) = 0xabba1200;
633 return 0xabba1254;
634}
635
636/*************************************************************************
637 * SHLWAPI_268 [SHLWAPI.268]
638 */
639DWORD WINAPI SHLWAPI_268 (
640 LPVOID w,
641 LPVOID x)
642{
643 FIXME("(%p %p)\n",w,x);
644 return 0xabba1251; /* 0 = failure */
645}
646
647/*************************************************************************
648 * SHLWAPI_276 [SHLWAPI.276]
649 *
650 */
651DWORD WINAPI SHLWAPI_276 ()
652{
653 FIXME("()stub\n");
654 return 0xabba1244;
655}
656#endif
657/*************************************************************************
658 * SHLWAPI_278 [SHLWAPI.278]
659 *
660 */
661DWORD WINAPI SHLWAPI_278 (
662 LONG wndProc,
663 HWND hWndParent,
664 DWORD dwExStyle,
665 DWORD dwStyle,
666 HMENU hMenu,
667 LONG z)
668{
669 WNDCLASSA wndclass;
670 HWND hwnd;
671 HCURSOR hCursor;
672 char * clsname = "WorkerA";
673
674 FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n",
675 wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z);
676
677 hCursor = LoadCursorA(0x00000000,IDC_ARROWA);
678
679 if(!GetClassInfoA(shlwapi_hInstance, clsname, &wndclass))
680 {
681 RtlZeroMemory(&wndclass, sizeof(WNDCLASSA));
682 wndclass.lpfnWndProc = DefWindowProcW;
683 wndclass.cbWndExtra = 4;
684 wndclass.hInstance = shlwapi_hInstance;
685 wndclass.hCursor = hCursor;
686 wndclass.hbrBackground = COLOR_BTNSHADOW;
687 wndclass.lpszMenuName = NULL;
688 wndclass.lpszClassName = clsname;
689 RegisterClassA (&wndclass);
690 }
691 hwnd = CreateWindowExA(dwExStyle, clsname, 0,dwStyle,0,0,0,0,hWndParent,
692 hMenu,shlwapi_hInstance,0);
693 SetWindowLongA(hwnd, 0, z);
694 SetWindowLongA(hwnd, GWL_WNDPROC, wndProc);
695 return hwnd;
696}
697
698/*************************************************************************
699 * SHLWAPI_289 [SHLWAPI.289]
700 *
701 * Late bound call to winmm.PlaySoundW
702 */
703BOOL WINAPI SHLWAPI_289(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
704{
705 static BOOL (* WINAPI pfnFunc)(LPCWSTR, HMODULE, DWORD) = NULL;
706
707 GET_FUNC(winmm, "PlaySoundW", FALSE);
708 return pfnFunc(pszSound, hmod, fdwSound);
709}
710
711/*************************************************************************
712 * SHLWAPI_313 [SHLWAPI.313]
713 *
714 * Late bound call to shell32.SHGetFileInfoW
715 */
716DWORD WINAPI SHLWAPI_313(LPCWSTR path, DWORD dwFileAttributes,
717 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
718{
719 static DWORD (* WINAPI pfnFunc)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT) = NULL;
720
721 GET_FUNC(shell32, "SHGetFileInfoW", 0);
722 return pfnFunc(path, dwFileAttributes, psfi, sizeofpsfi, flags);
723}
724
725/*************************************************************************
726 * SHLWAPI_318 [SHLWAPI.318]
727 *
728 * Late bound call to shell32.DragQueryFileW
729 */
730UINT WINAPI SHLWAPI_318(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
731{
732 static UINT (* WINAPI pfnFunc)(HDROP, UINT, LPWSTR, UINT) = NULL;
733
734 GET_FUNC(shell32, "DragQueryFileW", 0);
735 return pfnFunc(hDrop, lFile, lpszFile, lLength);
736}
737
738/*************************************************************************
739 * SHLWAPI_333 [SHLWAPI.333]
740 *
741 * Late bound call to shell32.SHBrowseForFolderW
742 */
743LPITEMIDLIST WINAPI SHLWAPI_333(LPBROWSEINFOW lpBi)
744{
745 static LPITEMIDLIST (* WINAPI pfnFunc)(LPBROWSEINFOW) = NULL;
746
747 GET_FUNC(shell32, "SHBrowseForFolderW", NULL);
748 return pfnFunc(lpBi);
749}
750
751/*************************************************************************
752 * SHLWAPI_334 [SHLWAPI.334]
753 *
754 * Late bound call to shell32.SHGetPathFromIDListW
755 */
756BOOL WINAPI SHLWAPI_334(LPCITEMIDLIST pidl,LPWSTR pszPath)
757{
758 static BOOL (* WINAPI pfnFunc)(LPCITEMIDLIST, LPWSTR) = NULL;
759
760 GET_FUNC(shell32, "SHGetPathFromIDListW", 0);
761 return pfnFunc(pidl, pszPath);
762}
763
764/*************************************************************************
765 * SHLWAPI_335 [SHLWAPI.335]
766 *
767 * Late bound call to shell32.ShellExecuteExW
768 */
769BOOL WINAPI SHLWAPI_335(LPSHELLEXECUTEINFOW lpExecInfo)
770{
771 static BOOL (* WINAPI pfnFunc)(LPSHELLEXECUTEINFOW) = NULL;
772
773 GET_FUNC(shell32, "ShellExecuteExW", FALSE);
774 return pfnFunc(lpExecInfo);
775}
776
777/*************************************************************************
778 * SHLWAPI_336 [SHLWAPI.336]
779 *
780 * Late bound call to shell32.SHFileOperationW.
781 */
782DWORD WINAPI SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp)
783{
784 static HICON (* WINAPI pfnFunc)(LPSHFILEOPSTRUCTW) = NULL;
785
786 GET_FUNC(shell32, "SHFileOperationW", 0);
787 return pfnFunc(lpFileOp);
788}
789
790/*************************************************************************
791 * SHLWAPI_337 [SHLWAPI.337]
792 *
793 * Late bound call to shell32.ExtractIconExW.
794 */
795HICON WINAPI SHLWAPI_337(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge,
796 HICON *phiconSmall, UINT nIcons)
797{
798 static HICON (* WINAPI pfnFunc)(LPCWSTR, INT,HICON *,HICON *, UINT) = NULL;
799
800 GET_FUNC(shell32, "ExtractIconExW", (HICON)0);
801 return pfnFunc(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
802}
803#ifndef __WIN32OS2__
804//Bugbug: is forwarder for InterlockedCompareExchange
805/*************************************************************************
806 * SHLWAPI_342 [SHLWAPI.342]
807 *
808 */
809DWORD WINAPI SHLWAPI_342 (
810 LPVOID w,
811 LPVOID x,
812 LPVOID y,
813 LPVOID z)
814{
815 FIXME("(%p %p %p %p)stub\n",w,x,y,z);
816 return 0xabba1249;
817}
818#endif
819/*************************************************************************
820 * SHLWAPI_346 [SHLWAPI.346]
821 */
822DWORD WINAPI SHLWAPI_346 (
823 LPCWSTR src,
824 LPWSTR dest,
825 int len)
826{
827 FIXME("(%s %p 0x%08x)stub\n",debugstr_w(src),dest,len);
828 lstrcpynW(dest, src, len);
829 return lstrlenW(dest)+1;
830}
831
832/*************************************************************************
833 * SHLWAPI_357 [SHLWAPI.357]
834 *
835 * Late bound call to shell32.SHGetNewLinkInfoW
836 */
837BOOL WINAPI SHLWAPI_357(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName,
838 BOOL *pfMustCopy, UINT uFlags)
839{
840 static BOOL (* WINAPI pfnFunc)(LPCWSTR, LPCWSTR, LPCWSTR, BOOL*, UINT) = NULL;
841
842 GET_FUNC(shell32, "SHGetNewLinkInfoW", FALSE);
843 return pfnFunc(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
844}
845
846/*************************************************************************
847 * SHLWAPI_358 [SHLWAPI.358]
848 *
849 * Late bound call to shell32.SHDefExtractIconW
850 */
851DWORD WINAPI SHLWAPI_358(LPVOID arg1, LPVOID arg2, LPVOID arg3, LPVOID arg4,
852 LPVOID arg5, LPVOID arg6)
853{
854 /* FIXME: Correct args */
855 static DWORD (* WINAPI pfnFunc)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID, LPVOID) = NULL;
856
857 GET_FUNC(shell32, "SHDefExtractIconW", 0);
858 return pfnFunc(arg1, arg2, arg3, arg4, arg5, arg6);
859}
860
861/*************************************************************************
862 * SHLWAPI_364 [SHLWAPI.364]
863 *
864 * Wrapper for lstrcpynA with src and dst swapped.
865 */
866DWORD WINAPI SHLWAPI_364(LPCSTR src, LPSTR dst, INT n)
867{
868 lstrcpynA(dst, src, n);
869 return TRUE;
870}
871
872/*************************************************************************
873 * SHLWAPI_370 [SHLWAPI.370]
874 *
875 * Late bound call to shell32.ExtractIconW
876 */
877HICON WINAPI SHLWAPI_370(HINSTANCE hInstance, LPCWSTR lpszExeFileName,
878 UINT nIconIndex)
879{
880 static HICON (* WINAPI pfnFunc)(HINSTANCE, LPCWSTR, UINT) = NULL;
881
882 GET_FUNC(shell32, "ExtractIconW", (HICON)0);
883 return pfnFunc(hInstance, lpszExeFileName, nIconIndex);
884}
885
886/*************************************************************************
887 * SHLWAPI_376 [SHLWAPI.376]
888 */
889DWORD WINAPI SHLWAPI_376 (LONG x)
890{
891 FIXME("(0x%08lx)stub\n", x );
892 /* FIXME: This should be a forward in the .spec file to the win2k function
893 * kernel32.GetUserDefaultUILanguage, however that function isn't there yet.
894 */
895 return 0xabba1245;
896}
897#ifndef __WIN32OS2__
898/*************************************************************************
899 * SHLWAPI_377 [SHLWAPI.377]
900 */
901DWORD WINAPI SHLWAPI_377 (LPVOID x, LPVOID y, LPVOID z)
902{
903 FIXME("(%p %p %p)stub\n", x,y,z);
904 return 0xabba1246;
905}
906#endif
907/*************************************************************************
908 * SHLWAPI_378 [SHLWAPI.378]
909 */
910DWORD WINAPI SHLWAPI_378 (
911 LPSTR x,
912 LPVOID y, /* [???] 0x50000000 */
913 LPVOID z) /* [???] 4 */
914{
915 FIXME("(%s %p %p)stub\n", x,y,z);
916 return LoadLibraryA(x);
917}
918
919/*************************************************************************
920 * SHLWAPI_389 [SHLWAPI.389]
921 *
922 * Late bound call to comdlg32.GetSaveFileNameW
923 */
924BOOL WINAPI SHLWAPI_389(LPOPENFILENAMEW ofn)
925{
926 static BOOL (* WINAPI pfnFunc)(LPOPENFILENAMEW) = NULL;
927
928 GET_FUNC(comdlg32, "GetSaveFileNameW", FALSE);
929 return pfnFunc(ofn);
930}
931
932/*************************************************************************
933 * SHLWAPI_390 [SHLWAPI.390]
934 *
935 * Late bound call to mpr.WNetRestoreConnectionW
936 */
937DWORD WINAPI SHLWAPI_390(LPVOID arg1, LPVOID arg2)
938{
939 /* FIXME: Correct args */
940 static DWORD (* WINAPI pfnFunc)(LPVOID, LPVOID) = NULL;
941
942 GET_FUNC(mpr, "WNetRestoreConnectionW", 0);
943 return pfnFunc(arg1, arg2);
944}
945
946/*************************************************************************
947 * SHLWAPI_391 [SHLWAPI.391]
948 *
949 * Late bound call to mpr.WNetGetLastErrorW
950 */
951DWORD WINAPI SHLWAPI_391(LPVOID arg1, LPVOID arg2, LPVOID arg3, LPVOID arg4,
952 LPVOID arg5)
953{
954 /* FIXME: Correct args */
955 static DWORD (* WINAPI pfnFunc)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID) = NULL;
956
957 GET_FUNC(mpr, "WNetGetLastErrorW", 0);
958 return pfnFunc(arg1, arg2, arg3, arg4, arg5);
959}
960
961/*************************************************************************
962 * SHLWAPI_401 [SHLWAPI.401]
963 *
964 * Late bound call to comdlg32.PageSetupDlgW
965 */
966BOOL WINAPI SHLWAPI_401(LPPAGESETUPDLGW pagedlg)
967{
968 static BOOL (* WINAPI pfnFunc)(LPPAGESETUPDLGW) = NULL;
969
970 GET_FUNC(comdlg32, "PageSetupDlgW", FALSE);
971 return pfnFunc(pagedlg);
972}
973
974/*************************************************************************
975 * SHLWAPI_402 [SHLWAPI.402]
976 *
977 * Late bound call to comdlg32.PrintDlgW
978 */
979BOOL WINAPI SHLWAPI_402(LPPRINTDLGW printdlg)
980{
981 static BOOL (* WINAPI pfnFunc)(LPPRINTDLGW) = NULL;
982
983 GET_FUNC(comdlg32, "PrintDlgW", FALSE);
984 return pfnFunc(printdlg);
985}
986
987/*************************************************************************
988 * SHLWAPI_403 [SHLWAPI.403]
989 *
990 * Late bound call to comdlg32.GetOpenFileNameW
991 */
992BOOL WINAPI SHLWAPI_403(LPOPENFILENAMEW ofn)
993{
994 static BOOL (* WINAPI pfnFunc)(LPOPENFILENAMEW) = NULL;
995
996 GET_FUNC(comdlg32, "GetOpenFileNameW", FALSE);
997 return pfnFunc(ofn);
998}
999
1000/* INTERNAL: Map from HLS color space to RGB */
1001static WORD ConvertHue(int wHue, WORD wMid1, WORD wMid2)
1002{
1003 wHue = wHue > 240 ? wHue - 240 : wHue < 0 ? wHue + 240 : wHue;
1004
1005 if (wHue > 160)
1006 return wMid1;
1007 else if (wHue > 120)
1008 wHue = 160 - wHue;
1009 else if (wHue > 40)
1010 return wMid2;
1011
1012 return ((wHue * (wMid2 - wMid1) + 20) / 40) + wMid1;
1013}
1014
1015/* Convert to RGB and scale into RGB range (0..255) */
1016#define GET_RGB(h) (ConvertHue(h, wMid1, wMid2) * 255 + 120) / 240
1017
1018/*************************************************************************
1019 * ColorHLSToRGB [SHLWAPI.404]
1020 *
1021 * Convert from HLS color space into an RGB COLORREF.
1022 *
1023 * NOTES
1024 * Input HLS values are constrained to the range (0..240).
1025 */
1026COLORREF WINAPI ColorHLSToRGB(WORD wHue, WORD wLuminosity, WORD wSaturation)
1027{
1028 WORD wRed;
1029
1030 if (wSaturation)
1031 {
1032 WORD wGreen, wBlue, wMid1, wMid2;
1033
1034 if (wLuminosity > 120)
1035 wMid2 = wSaturation + wLuminosity - (wSaturation * wLuminosity + 120) / 240;
1036 else
1037 wMid2 = ((wSaturation + 240) * wLuminosity + 120) / 240;
1038
1039 wMid1 = wLuminosity * 2 - wMid2;
1040
1041 wRed = GET_RGB(wHue + 80);
1042 wGreen = GET_RGB(wHue);
1043 wBlue = GET_RGB(wHue - 80);
1044
1045 return RGB(wRed, wGreen, wBlue);
1046 }
1047
1048 wRed = wLuminosity * 255 / 240;
1049 return RGB(wRed, wRed, wRed);
1050}
1051
1052/*************************************************************************
1053 * SHLWAPI_431 [SHLWAPI.431]
1054 */
1055DWORD WINAPI SHLWAPI_431 (DWORD x)
1056{
1057 FIXME("(0x%08lx)stub\n", x);
1058 return 0xabba1247;
1059}
1060
1061#ifndef __WIN32OS2__
1062/*************************************************************************
1063 * SHLWAPI_437 [SHLWAPI.437]
1064 *
1065 * NOTES
1066 * In the real shlwapi, One time initilisation calls GetVersionEx and reads
1067 * the registry to determine what O/S & Service Pack level is running, and
1068 * therefore which functions are available. Currently we always run as NT,
1069 * since this means that we don't need extra code to emulate Unicode calls,
1070 * they are forwarded directly to the appropriate API call instead.
1071 * Since the flags for whether to call or emulate Unicode are internal to
1072 * the dll, this function does not need a full implementation.
1073 */
1074DWORD WINAPI SHLWAPI_437 (DWORD functionToCall)
1075{
1076 FIXME("(0x%08lx)stub\n", functionToCall);
1077 return 0xabba1247;
1078}
1079#endif
1080
1081/*************************************************************************
1082 * SHCreateShellPalette [SHLWAPI.@]
1083 */
1084HPALETTE WINAPI SHCreateShellPalette(HDC hdc)
1085{
1086 FIXME("stub\n");
1087 return CreateHalftonePalette(hdc);
1088}
1089
1090/*************************************************************************
1091 * SHGetInverseCMAP
1092 */
1093DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why)
1094{
1095 FIXME("(%p, %#lx)stub\n", x, why);
1096 return 0;
1097}
1098#ifndef __WIN32OS2__
1099/*************************************************************************
1100 * SHIsLowMemoryMachine [SHLWAPI.@]
1101 */
1102DWORD WINAPI SHIsLowMemoryMachine (DWORD x)
1103{
1104 FIXME("0x%08lx\n", x);
1105 return 0;
1106}
1107#endif
1108
1109/*************************************************************************
1110 * GetMenuPosFromID [SHLWAPI.@]
1111 */
1112INT WINAPI GetMenuPosFromID(HMENU hMenu, UINT wID)
1113{
1114 MENUITEMINFOA mi;
1115 INT nCount = GetMenuItemCount(hMenu), nIter = 0;
1116
1117 while (nIter < nCount)
1118 {
1119 mi.wID = 0;
1120 if (!GetMenuItemInfoA(hMenu, nIter, TRUE, &mi) && mi.wID == wID)
1121 return nIter;
1122 nIter++;
1123 }
1124 return -1;
1125}
1126
1127/*************************************************************************
1128 * _SHGetInstanceExplorer [SHLWAPI.@]
1129 *
1130 * Late bound call to shell32.SHGetInstanceExplorer.
1131 */
1132HRESULT WINAPI _SHGetInstanceExplorer (LPUNKNOWN *lpUnknown)
1133{
1134 static HRESULT (* WINAPI pfnFunc)(LPUNKNOWN *) = NULL;
1135
1136 GET_FUNC(shell32, "SHGetInstanceExplorer", E_FAIL);
1137 return pfnFunc(lpUnknown);
1138}
Note: See TracBrowser for help on using the repository browser.