Ignore:
Timestamp:
Jun 7, 2002, 10:02:20 AM (23 years ago)
Author:
sandervl
Message:

resynced with latest Wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shlwapi/ordinal.c

    r7820 r8584  
    55 *           1998 Jürgen Schmied
    66 *           2001 Jon Griffiths
     7 *
     8 * This library is free software; you can redistribute it and/or
     9 * modify it under the terms of the GNU Lesser General Public
     10 * License as published by the Free Software Foundation; either
     11 * version 2.1 of the License, or (at your option) any later version.
     12 *
     13 * This library is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 * Lesser General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU Lesser General Public
     19 * License along with this library; if not, write to the Free Software
     20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    721 */
    822
     
    2438#include "winreg.h"
    2539#include "winuser.h"
    26 #include "debugtools.h"
     40#include "wine/debug.h"
    2741#include "ordinal.h"
    2842#include "shlwapi.h"
    2943
    30 DEFAULT_DEBUG_CHANNEL(shell);
     44WINE_DEFAULT_DEBUG_CHANNEL(shell);
    3145
    3246extern HINSTANCE shlwapi_hInstance;
     
    3650extern HMODULE SHLWAPI_hmpr;
    3751extern HMODULE SHLWAPI_hmlang;
     52extern HMODULE SHLWAPI_hversion;
     53
     54extern DWORD SHLWAPI_ThreadRef_index;
    3855
    3956typedef HANDLE HSHARED; /* Shared memory */
     
    98115};
    99116
    100 /* Macro to get function pointer for a module*/
    101 #define GET_FUNC(module, name, fail) \
    102   if (!SHLWAPI_h##module) SHLWAPI_h##module = LoadLibraryA(#module ".dll"); \
    103   if (!SHLWAPI_h##module) return fail; \
    104   if (!pfnFunc) pfnFunc = (void*)GetProcAddress(SHLWAPI_h##module, name); \
    105   if (!pfnFunc) return fail
     117/* function pointers for GET_FUNC macro; these need to be global because of gcc bug */
     118#ifdef __WIN32OS2__
     119static LPITEMIDLIST (* WINAPI pSHBrowseForFolderW)(LPBROWSEINFOW);
     120static HRESULT (* WINAPI pConvertINetUnicodeToMultiByte)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
     121static BOOL    (* WINAPI pPlaySoundW)(LPCWSTR, HMODULE, DWORD);
     122static DWORD   (* WINAPI pSHGetFileInfoW)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT);
     123static UINT    (* WINAPI pDragQueryFileW)(HDROP, UINT, LPWSTR, UINT);
     124static BOOL    (* WINAPI pSHGetPathFromIDListW)(LPCITEMIDLIST, LPWSTR);
     125static BOOL    (* WINAPI pShellExecuteExW)(LPSHELLEXECUTEINFOW);
     126static HICON   (* WINAPI pSHFileOperationW)(LPSHFILEOPSTRUCTW);
     127static HICON   (* WINAPI pExtractIconExW)(LPCWSTR, INT,HICON *,HICON *, UINT);
     128static BOOL    (* WINAPI pSHGetNewLinkInfoW)(LPCWSTR, LPCWSTR, LPCWSTR, BOOL*, UINT);
     129static DWORD   (* WINAPI pSHDefExtractIconW)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID, LPVOID); /* FIXME: Correct args */
     130static HICON   (* WINAPI pExtractIconW)(HINSTANCE, LPCWSTR, UINT);
     131static BOOL    (* WINAPI pGetSaveFileNameW)(LPOPENFILENAMEW);
     132static DWORD   (* WINAPI pWNetRestoreConnectionW)(LPVOID, LPVOID); /* FIXME: Correct args */
     133static DWORD   (* WINAPI pWNetGetLastErrorW)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID); /* FIXME: Correct args */
     134static BOOL    (* WINAPI pPageSetupDlgW)(LPPAGESETUPDLGW);
     135static BOOL    (* WINAPI pPrintDlgW)(LPPRINTDLGW);
     136static BOOL    (* WINAPI pGetOpenFileNameW)(LPOPENFILENAMEW);
     137static HRESULT (* WINAPI pSHGetInstanceExplorer)(LPUNKNOWN *);
     138static DWORD   (* WINAPI pGetFileVersionInfoSizeW)(LPCWSTR,LPDWORD);
     139static BOOL    (* WINAPI pGetFileVersionInfoW)(LPCWSTR,DWORD,DWORD,LPVOID);
     140static WORD    (* WINAPI pVerQueryValueW)(LPVOID,LPCWSTR,LPVOID*,UINT*);
     141#else
     142static LPITEMIDLIST (WINAPI *pSHBrowseForFolderW)(LPBROWSEINFOW);
     143static HRESULT (WINAPI *pConvertINetUnicodeToMultiByte)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
     144static BOOL    (WINAPI *pPlaySoundW)(LPCWSTR, HMODULE, DWORD);
     145static DWORD   (WINAPI *pSHGetFileInfoW)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT);
     146static UINT    (WINAPI *pDragQueryFileW)(HDROP, UINT, LPWSTR, UINT);
     147static BOOL    (WINAPI *pSHGetPathFromIDListW)(LPCITEMIDLIST, LPWSTR);
     148static BOOL    (WINAPI *pShellExecuteExW)(LPSHELLEXECUTEINFOW);
     149static HICON   (WINAPI *pSHFileOperationW)(LPSHFILEOPSTRUCTW);
     150static HICON   (WINAPI *pExtractIconExW)(LPCWSTR, INT,HICON *,HICON *, UINT);
     151static BOOL    (WINAPI *pSHGetNewLinkInfoW)(LPCWSTR, LPCWSTR, LPCWSTR, BOOL*, UINT);
     152static DWORD   (WINAPI *pSHDefExtractIconW)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID, LPVOID); /* FIXME: Correct args */
     153static HICON   (WINAPI *pExtractIconW)(HINSTANCE, LPCWSTR, UINT);
     154static BOOL    (WINAPI *pGetSaveFileNameW)(LPOPENFILENAMEW);
     155static DWORD   (WINAPI *pWNetRestoreConnectionW)(LPVOID, LPVOID); /* FIXME: Correct args */
     156static DWORD   (WINAPI *pWNetGetLastErrorW)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID); /* FIXME: Correct args */
     157static BOOL    (WINAPI *pPageSetupDlgW)(LPPAGESETUPDLGW);
     158static BOOL    (WINAPI *pPrintDlgW)(LPPRINTDLGW);
     159static BOOL    (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW);
     160static HRESULT (WINAPI *pSHGetInstanceExplorer)(LPUNKNOWN *);
     161static DWORD   (WINAPI *pGetFileVersionInfoSizeW)(LPCWSTR,LPDWORD);
     162static BOOL    (WINAPI *pGetFileVersionInfoW)(LPCWSTR,DWORD,DWORD,LPVOID);
     163static WORD    (WINAPI *pVerQueryValueW)(LPVOID,LPCWSTR,LPVOID*,UINT*);
     164#endif
    106165
    107166/*
     
    127186
    128187    if (y->size != 0x18) return E_INVALIDARG;
    129     /* FIXME: leading white space generates error of 0x80041001 which 
     188    /* FIXME: leading white space generates error of 0x80041001 which
    130189     *        is undefined
    131190     */
     
    183242
    184243    if (y->size != 0x18) return E_INVALIDARG;
    185     /* FIXME: leading white space generates error of 0x80041001 which 
     244    /* FIXME: leading white space generates error of 0x80041001 which
    186245     *        is undefined
    187246     */
     
    230289
    231290/*************************************************************************
     291 * @    [SHLWAPI.3]
     292 *
     293 * Determine if a file exists locally and is of an executable type.
     294 *
     295 * PARAMS
     296 *  lpszFile       [O] File to search for
     297 *  dwWhich        [I] Type of executable to search for
     298 *
     299 * RETURNS
     300 *  TRUE  If the file was found. lpszFile contains the file name.
     301 *  FALSE Otherwise.
     302 *
     303 * NOTES
     304 *  lpszPath is modified in place and must be at least MAX_PATH in length.
     305 *  If the function returns FALSE, the path is modified to its orginal state.
     306 *  If the given path contains an extension or dwWhich is 0, executable
     307 *  extensions are not checked.
     308 *
     309 *  Ordinals 3-6 are a classic case of MS exposing limited functionality to
     310 *  users (here through PathFindOnPath) and keeping advanced functionality for
     311 *  their own developers exclusive use. Monopoly, anyone?
     312 */
     313BOOL WINAPI SHLWAPI_3(LPSTR lpszFile,DWORD dwWhich)
     314{
     315  return SHLWAPI_PathFindLocalExeA(lpszFile,dwWhich);
     316}
     317
     318/*************************************************************************
     319 * @    [SHLWAPI.4]
     320 *
     321 * Unicode version of SHLWAPI_3.
     322 */
     323BOOL WINAPI SHLWAPI_4(LPWSTR lpszFile,DWORD dwWhich)
     324{
     325  return SHLWAPI_PathFindLocalExeW(lpszFile,dwWhich);
     326}
     327
     328/*************************************************************************
     329 * @    [SHLWAPI.5]
     330 *
     331 * Search a range of paths for a specific type of executable.
     332 *
     333 * PARAMS
     334 *  lpszFile       [O] File to search for
     335 *  lppszOtherDirs [I] Other directories to look in
     336 *  dwWhich        [I] Type of executable to search for
     337 *
     338 * RETURNS
     339 *  Success: TRUE. The path to the executable is stored in sFile.
     340 *  Failure: FALSE. The path to the executable is unchanged.
     341 */
     342BOOL WINAPI SHLWAPI_5(LPSTR lpszFile,LPCSTR *lppszOtherDirs,DWORD dwWhich)
     343{
     344  return SHLWAPI_PathFindOnPathExA(lpszFile,lppszOtherDirs,dwWhich);
     345}
     346
     347/*************************************************************************
     348 * @    [SHLWAPI.6]
     349 *
     350 * Unicode version of SHLWAPI_5.
     351 */
     352BOOL WINAPI SHLWAPI_6(LPWSTR lpszFile,LPCWSTR *lppszOtherDirs,DWORD dwWhich)
     353{
     354  return SHLWAPI_PathFindOnPathExW(lpszFile,lppszOtherDirs,dwWhich);
     355}
     356
     357/*************************************************************************
    232358 * SHLWAPI_DupSharedHandle
    233359 *
     
    304430 * SHLWAPI_11           - Helper function; Duplicate cross-process handles
    305431   */
    306 HSHARED WINAPI SHLWAPI_7 (DWORD dwProcId, LPCVOID lpvData, DWORD dwSize)
     432HSHARED WINAPI SHLWAPI_7 (DWORD dwProcId, DWORD dwSize, LPCVOID lpvData)
    307433{
    308434  HANDLE hMap;
     
    528654 * Function:
    529655 *    Retrieves IE "AcceptLanguage" value from registry. ASCII mode.
    530  * 
     656 *
    531657 */
    532658HRESULT WINAPI SHLWAPI_14 (
     
    540666
    541667        mystrlen = (*buflen > 6) ? *buflen : 6;
    542         mystr = (CHAR*)HeapAlloc(GetProcessHeap(), 
     668        mystr = (CHAR*)HeapAlloc(GetProcessHeap(),
    543669                                 HEAP_ZERO_MEMORY, mystrlen);
    544         RegOpenKeyA(HKEY_CURRENT_USER, 
    545                     "Software\\Microsoft\\Internet Explorer\\International", 
     670        RegOpenKeyA(HKEY_CURRENT_USER,
     671                    "Software\\Microsoft\\Internet Explorer\\International",
    546672                    &mykey);
    547         if (RegQueryValueExA(mykey, "AcceptLanguage", 
     673        if (RegQueryValueExA(mykey, "AcceptLanguage",
    548674                              0, &mytype, mystr, &mystrlen)) {
    549675            /* Did not find value */
     
    564690            FIXME("missing code\n");
    565691        }
    566         if (mystrlen > *buflen) 
     692        if (mystrlen > *buflen)
    567693            lstrcpynA(langbuf, mystr, *buflen);
    568694        else {
    569695            lstrcpyA(langbuf, mystr);
    570696            *buflen = lstrlenA(langbuf);
    571         }       
     697        }
    572698        RegCloseKey(mykey);
    573699        HeapFree(GetProcessHeap(), 0, mystr);
     
    581707 * Function:
    582708 *    Retrieves IE "AcceptLanguage" value from registry. UNICODE mode.
    583  * 
     709 *
    584710 */
    585711HRESULT WINAPI SHLWAPI_15 (
     
    593719
    594720        mystrlen = (*buflen > 6) ? *buflen : 6;
    595         mystr = (CHAR*)HeapAlloc(GetProcessHeap(), 
     721        mystr = (CHAR*)HeapAlloc(GetProcessHeap(),
    596722                                 HEAP_ZERO_MEMORY, mystrlen);
    597         RegOpenKeyA(HKEY_CURRENT_USER, 
    598                     "Software\\Microsoft\\Internet Explorer\\International", 
     723        RegOpenKeyA(HKEY_CURRENT_USER,
     724                    "Software\\Microsoft\\Internet Explorer\\International",
    599725                    &mykey);
    600         if (RegQueryValueExA(mykey, "AcceptLanguage", 
     726        if (RegQueryValueExA(mykey, "AcceptLanguage",
    601727                              0, &mytype, mystr, &mystrlen)) {
    602728            /* Did not find value */
     
    870996BOOL WINAPI SHLWAPI_36(HMENU h1, UINT ui2, UINT h3, LPCWSTR p4)
    871997{
    872     TRACE("(0x%08x, 0x%08x, 0x%08x, %s): stub\n", 
     998    TRACE("(0x%08x, 0x%08x, 0x%08x, %s): stub\n",
    873999          h1, ui2, h3, debugstr_w(p4));
    8741000    return AppendMenuW(h1, ui2, h3, p4);
    875 }
    876 
    877 /*************************************************************************
    878  *      @       [SHLWAPI.40]
    879  *
    880  * Get pointer to next Unicode character.
    881  */
    882 LPCWSTR WINAPI SHLWAPI_40(LPCWSTR str)
    883 {
    884   return *str ? str + 1 : str;
    8851001}
    8861002
     
    9411057{
    9421058    return strncmpiW( str1, str2, len );
     1059}
     1060
     1061/*************************************************************************
     1062 *      @       [SHLWAPI.155]
     1063 *
     1064 *      Case sensitive string compare (ASCII). Does not SetLastError().
     1065 */
     1066DWORD WINAPI SHLWAPI_155 ( LPSTR str1, LPSTR str2)
     1067{
     1068    return strcmp(str1, str2);
    9431069}
    9441070
     
    10731199 *      @       [SHLWAPI.174]
    10741200 *
    1075  * Seems to do call either IObjectWithSite::SetSite or 
     1201 * Seems to do call either IObjectWithSite::SetSite or
    10761202 *   IPersistMoniker::GetClassID.  But since we do not implement either
    10771203 *   of those classes in our headers, we will fake it out.
     
    10791205DWORD WINAPI SHLWAPI_174(
    10801206        IUnknown *p1,     /* [in]   OLE object                          */
    1081         LPVOID *p2)       /* [out]  ptr to result of either GetClassID 
     1207        LPVOID *p2)       /* [out]  ptr to result of either GetClassID
    10821208                                    or SetSite call.                    */
    10831209{
     
    10891215    ret = IUnknown_QueryInterface((IUnknown *)p1, (REFIID)id1, (LPVOID *)&p1);
    10901216    TRACE("first IU_QI ret=%08lx, p1=%p\n", ret, p1);
    1091     if (ret) { 
     1217    if (ret) {
    10921218
    10931219        /* see if GetClassId interface exists for IPersistMoniker object */
     
    10981224        /* fake a GetClassId call */
    10991225        ret = IOleWindow_GetWindow((IOleWindow *)aa, (HWND*)p2);
    1100         TRACE("second IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret, 
     1226        TRACE("second IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret,
    11011227              *(LPDWORD)p2);
    11021228        IUnknown_Release((IUnknown *)aa);
     
    11051231        /* fake a SetSite call */
    11061232        ret = IOleWindow_GetWindow((IOleWindow *)p1, (HWND*)p2);
    1107         TRACE("first IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret, 
     1233        TRACE("first IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret,
    11081234              *(LPDWORD)p2);
    11091235        IUnknown_Release((IUnknown *)p1);
     
    11121238}
    11131239
     1240/*************************************************************************
     1241 *      @       [SHLWAPI.175]
     1242 *
     1243 *      NOTE:
     1244 *        Param1 can be an IShellFolder Object
     1245 */
     1246HRESULT WINAPI SHLWAPI_175 (LPVOID x, LPVOID y)
     1247{
     1248        FIXME("(%p %p) stub\n", x,y);
     1249        return E_FAIL;
     1250}
    11141251/*************************************************************************
    11151252 *      @       [SHLWAPI.176]
     
    11331270    if (!unk) return E_FAIL;
    11341271    ret = IUnknown_QueryInterface(unk, &IID_IServiceProvider, &aa);
    1135     TRACE("did IU_QI retval=%08lx, aa=%p\n", ret, aa); 
     1272    TRACE("did IU_QI retval=%08lx, aa=%p\n", ret, aa);
    11361273    if (ret) return ret;
    1137     ret = IServiceProvider_QueryService((IServiceProvider *)aa, sid, riid, 
     1274    ret = IServiceProvider_QueryService((IServiceProvider *)aa, sid, riid,
    11381275                                        (void **)z);
    1139     TRACE("did ISP_QS retval=%08lx, *z=%p\n", ret, (LPVOID)*z); 
     1276    TRACE("did ISP_QS retval=%08lx, *z=%p\n", ret, (LPVOID)*z);
    11401277    IUnknown_Release((IUnknown*)aa);
    11411278    return ret;
     
    12201357
    12211358/*************************************************************************
     1359 *      @       [SHLWAPI.209]
     1360 *
     1361 * Some sort of memory management process - associated with _208
     1362 */
     1363DWORD WINAPI SHLWAPI_209 (
     1364        LPVOID   a)
     1365{
     1366    FIXME("(%p) stub\n",
     1367          a);
     1368    return 1;
     1369}
     1370
     1371/*************************************************************************
    12221372 *      @       [SHLWAPI.210]
    12231373 *
     
    12611411        len_a = lstrlenA(lpStrSrc);
    12621412        ret = MultiByteToWideChar(0, 0, lpStrSrc, len_a, lpwStrDest, len);
    1263         TRACE("%s %s %d, ret=%d\n", 
     1413        TRACE("%s %s %d, ret=%d\n",
    12641414              debugstr_a(lpStrSrc), debugstr_w(lpwStrDest), len, ret);
    12651415        return ret;
     
    12741424                       LPINT lpnMultiCharCount)
    12751425{
    1276   static HRESULT (* WINAPI pfnFunc)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
    12771426  WCHAR emptyW[] = { '\0' };
    12781427  int len , reqLen;
     
    13001449      INT nWideCharCount = len - 1;
    13011450
    1302       GET_FUNC(mlang, "ConvertINetUnicodeToMultiByte", 0);
    1303       if (!pfnFunc(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
    1304                    lpnMultiCharCount))
     1451      GET_FUNC(pConvertINetUnicodeToMultiByte, mlang, "ConvertINetUnicodeToMultiByte", 0);
     1452      if (!pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &nWideCharCount, lpDstStr,
     1453                                          lpnMultiCharCount))
    13051454        return 0;
    13061455
     
    13131462        *lpnMultiCharCount = 0;
    13141463
    1315         if (pfnFunc(&dwMode, CodePage, lpSrcStr, &len, mem, lpnMultiCharCount))
     1464        if (pConvertINetUnicodeToMultiByte(&dwMode, CodePage, lpSrcStr, &len, mem, lpnMultiCharCount))
    13161465        {
    13171466          SHLWAPI_162 (mem, *lpnMultiCharCount);
     
    14001549            xmove = x;
    14011550            while (xmove->refid) {
    1402                 TRACE("trying (indx %ld) %s\n", xmove->indx, 
     1551                TRACE("trying (indx %ld) %s\n", xmove->indx,
    14031552                      debugstr_guid(xmove->refid));
    14041553                if (IsEqualIID(riid, xmove->refid)) {
     
    15431692/*************************************************************************
    15441693 *      @       [SHLWAPI.266]
     1694 *
     1695 * native does at least approximately:
     1696 *     strcpyW(newstr, x);
     1697 *     strcatW(newstr, "\\Restrictions");
     1698 *     if (RegOpenKeyExA(80000001, newstr, 00000000,00000001,40520b78))
     1699 *        return 0;
     1700 *    *unknown*
    15451701 */
    15461702DWORD WINAPI SHLWAPI_266 (
    15471703        LPVOID w,
    1548         LPVOID x,
     1704        LPVOID x,   /* [in] partial registry key */
    15491705        LPVOID y,
    15501706        LPVOID z)
    15511707{
    15521708        FIXME("(%p %p %p %p)stub\n",w,x,y,z);
    1553         return 0xabba1248;
     1709        return /* 0xabba1248 */ 0;
    15541710}
    15551711
     
    15581714 */
    15591715HRESULT WINAPI SHLWAPI_267 (
    1560         LPVOID w, /* [???] NOTE: same as 1th parameter of SHLWAPI_219 */
    1561         LPVOID x, /* [???] NOTE: same as 2nd parameter of SHLWAPI_219 */
    1562         LPVOID y,
    1563         LPVOID z)
     1716        LPVOID w,
     1717        LPVOID x,
     1718        LPVOID y, /* [???] NOTE: same as 3rd parameter of SHLWAPI_219 */
     1719        LPVOID z) /* [???] NOTE: same as 4th parameter of SHLWAPI_219 */
    15641720{
    15651721        FIXME("(%p %p %p %p)stub\n",w,x,y,z);
     1722
     1723        /* native seems to do:
     1724         *  SHLWAPI_219 ((LPVOID)(((LPSTR)x)-4), ???, (REFIID) y, (LPVOID*) z);
     1725         */
     1726
    15661727        *((LPDWORD)z) = 0xabba1200;
    1567         return 0xabba1254;
     1728        return /* 0xabba1254 */ 0;
    15681729}
    15691730
     
    15821743 *      @       [SHLWAPI.276]
    15831744 *
     1745 * on first call process does following:  other calls just returns 2
     1746 *  instance = LoadLibraryA("SHELL32.DLL");
     1747 *  func = GetProcAddress(instance, "DllGetVersion");
     1748 *  ret = RegOpenKeyExA(80000002, "Software\\Microsoft\\Internet Explorer",00000000,0002001f, newkey);
     1749 *  ret = RegQueryValueExA(newkey, "IntegratedBrowser",00000000,00000000,4052588c,40525890);
     1750 *  RegCloseKey(newkey);
     1751 *  FreeLibrary(instance);
     1752 *  return 2;
    15841753 */
    15851754DWORD WINAPI SHLWAPI_276 ()
    15861755{
    15871756        FIXME("()stub\n");
    1588         return /* 0xabba1244 */ 0;
     1757        return /* 0xabba1244 */ 2;
    15891758}
    15901759
     
    16371806BOOL WINAPI SHLWAPI_289(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
    16381807{
    1639   static BOOL (* WINAPI pfnFunc)(LPCWSTR, HMODULE, DWORD) = NULL;
    1640 
    1641   GET_FUNC(winmm, "PlaySoundW", FALSE);
    1642   return pfnFunc(pszSound, hmod, fdwSound);
     1808  GET_FUNC(pPlaySoundW, winmm, "PlaySoundW", FALSE);
     1809  return pPlaySoundW(pszSound, hmod, fdwSound);
    16431810}
    16441811
     
    16751842                         SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
    16761843{
    1677   static DWORD (* WINAPI pfnFunc)(LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT) = NULL;
    1678 
    1679   GET_FUNC(shell32, "SHGetFileInfoW", 0);
    1680   return pfnFunc(path, dwFileAttributes, psfi, sizeofpsfi, flags);
     1844  GET_FUNC(pSHGetFileInfoW, shell32, "SHGetFileInfoW", 0);
     1845  return pSHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags);
    16811846}
    16821847
     
    16881853UINT WINAPI SHLWAPI_318(HDROP hDrop, UINT lFile, LPWSTR lpszFile, UINT lLength)
    16891854{
    1690   static UINT (* WINAPI pfnFunc)(HDROP, UINT, LPWSTR, UINT) = NULL;
    1691 
    1692   GET_FUNC(shell32, "DragQueryFileW", 0);
    1693   return pfnFunc(hDrop, lFile, lpszFile, lLength);
     1855  GET_FUNC(pDragQueryFileW, shell32, "DragQueryFileW", 0);
     1856  return pDragQueryFileW(hDrop, lFile, lpszFile, lLength);
    16941857}
    16951858
     
    17011864LPITEMIDLIST WINAPI SHLWAPI_333(LPBROWSEINFOW lpBi)
    17021865{
    1703   static LPITEMIDLIST (* WINAPI pfnFunc)(LPBROWSEINFOW) = NULL;
    1704 
    1705   GET_FUNC(shell32, "SHBrowseForFolderW", NULL);
    1706   return pfnFunc(lpBi);
     1866  GET_FUNC(pSHBrowseForFolderW, shell32, "SHBrowseForFolderW", NULL);
     1867  return pSHBrowseForFolderW(lpBi);
    17071868}
    17081869
     
    17141875BOOL WINAPI SHLWAPI_334(LPCITEMIDLIST pidl,LPWSTR pszPath)
    17151876{
    1716   static BOOL (* WINAPI pfnFunc)(LPCITEMIDLIST, LPWSTR) = NULL;
    1717 
    1718   GET_FUNC(shell32, "SHGetPathFromIDListW", 0);
    1719   return pfnFunc(pidl, pszPath);
     1877  GET_FUNC(pSHGetPathFromIDListW, shell32, "SHGetPathFromIDListW", 0);
     1878  return pSHGetPathFromIDListW(pidl, pszPath);
    17201879}
    17211880
     
    17271886BOOL WINAPI SHLWAPI_335(LPSHELLEXECUTEINFOW lpExecInfo)
    17281887{
    1729   static BOOL (* WINAPI pfnFunc)(LPSHELLEXECUTEINFOW) = NULL;
    1730 
    1731   GET_FUNC(shell32, "ShellExecuteExW", FALSE);
    1732   return pfnFunc(lpExecInfo);
     1888  GET_FUNC(pShellExecuteExW, shell32, "ShellExecuteExW", FALSE);
     1889  return pShellExecuteExW(lpExecInfo);
    17331890}
    17341891
     
    17401897DWORD WINAPI SHLWAPI_336(LPSHFILEOPSTRUCTW lpFileOp)
    17411898{
    1742   static HICON (* WINAPI pfnFunc)(LPSHFILEOPSTRUCTW) = NULL;
    1743 
    1744   GET_FUNC(shell32, "SHFileOperationW", 0);
    1745   return pfnFunc(lpFileOp);
     1899  GET_FUNC(pSHFileOperationW, shell32, "SHFileOperationW", 0);
     1900  return pSHFileOperationW(lpFileOp);
    17461901}
    17471902
     
    17541909                         HICON *phiconSmall, UINT nIcons)
    17551910{
    1756   static HICON (* WINAPI pfnFunc)(LPCWSTR, INT,HICON *,HICON *, UINT) = NULL;
    1757 
    1758   GET_FUNC(shell32, "ExtractIconExW", (HICON)0);
    1759   return pfnFunc(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
     1911  GET_FUNC(pExtractIconExW, shell32, "ExtractIconExW", (HICON)0);
     1912  return pExtractIconExW(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
    17601913}
    17611914
     
    17641917 *
    17651918 */
    1766 DWORD WINAPI SHLWAPI_342 (
    1767         LPDWORD  w,   /* [out] location to put HKEY value???   */
    1768         HKEY     x,   /* [in]  appears to be HKEY_CURRENT_USER */
    1769         LPVOID y)
    1770 {
    1771         FIXME("(%p 0x%08x %p)stub\n", w,x,y);
    1772         *w = (DWORD)x;
    1773         return /* 0xabba1249 */ 0;
     1919LONG WINAPI SHInterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare)
     1920{
     1921        return InterlockedCompareExchange(dest, xchg, compare);
    17741922}
    17751923
     
    17881936
    17891937/*************************************************************************
    1790  *      @       [SHLWAPI.356]
    1791  */
    1792 DWORD WINAPI SHLWAPI_356 (
    1793         LPVOID x,
    1794         LPVOID y,
    1795         LPVOID z)
    1796 {
    1797         FIXME("(%p %p %p)stub\n", x,y,z);
    1798         return 0;
    1799 }
     1938 *      @       [SHLWAPI.350]
     1939 *
     1940 * seems to be late bound call to GetFileVersionInfoSizeW
     1941 */
     1942DWORD WINAPI SHLWAPI_350 (
     1943        LPWSTR x,
     1944        LPVOID y)
     1945{
     1946        DWORD ret;
     1947
     1948        GET_FUNC(pGetFileVersionInfoSizeW, version, "GetFileVersionInfoSizeW", 0);
     1949        ret = pGetFileVersionInfoSizeW(x, y);
     1950        return 0x208 + ret;
     1951}
     1952
     1953/*************************************************************************
     1954 *      @       [SHLWAPI.351]
     1955 *
     1956 * seems to be late bound call to GetFileVersionInfoW
     1957 */
     1958BOOL  WINAPI SHLWAPI_351 (
     1959        LPWSTR w,   /* [in] path to dll */
     1960        DWORD  x,   /* [in] parm 2 to GetFileVersionInfoA */
     1961        DWORD  y,   /* [in] return value from .350 - assume length */
     1962        LPVOID z)   /* [in/out] buffer (+0x208 sent to GetFileVersionInfoA) */
     1963{
     1964    GET_FUNC(pGetFileVersionInfoW, version, "GetFileVersionInfoW", 0);
     1965#ifdef __WIN32OS2__
     1966    return pGetFileVersionInfoW(w, x, y-0x208, (LPSTR)z+0x208);
     1967#else
     1968    return pGetFileVersionInfoW(w, x, y-0x208, z+0x208);
     1969#endif
     1970}
     1971
     1972/*************************************************************************
     1973 *      @       [SHLWAPI.352]
     1974 *
     1975 * seems to be late bound call to VerQueryValueW
     1976 */
     1977WORD WINAPI SHLWAPI_352 (
     1978        LPVOID w,   /* [in] buffer from _351 */
     1979        LPWSTR x,   /* [in]   value to retrieve -
     1980                              converted and passed to VerQueryValueA as #2 */
     1981        LPVOID y,   /* [out]  ver buffer - passed to VerQueryValueA as #3 */
     1982        UINT*  z)   /* [in]   ver length - passed to VerQueryValueA as #4 */
     1983{
     1984    GET_FUNC(pVerQueryValueW, version, "VerQueryValueW", 0);
     1985#ifdef __WIN32OS2__
     1986    return pVerQueryValueW((LPSTR)w+0x208, x, y, z);
     1987#else
     1988    return pVerQueryValueW(w+0x208, x, y, z);
     1989#endif
     1990}
     1991
     1992/**************************************************************************
     1993 *      @       [SHLWAPI.356]
     1994 *
     1995 *      mbc - this function is undocumented, The parameters are correct and
     1996 *            the calls to InitializeSecurityDescriptor and
     1997 *            SetSecurityDescriptorDacl are correct, but apparently some
     1998 *            apps call this function with all zero parameters.
     1999 */
     2000
     2001DWORD WINAPI SHLWAPI_356(PACL pDacl, PSECURITY_DESCRIPTOR pSD, LPCSTR *str)
     2002{
     2003  if(str != 0){
     2004    *str = 0;
     2005  }
     2006
     2007  if(!pDacl){
     2008    return 0;
     2009  }
     2010
     2011  if (!InitializeSecurityDescriptor(pSD, 1)) return 0;
     2012  return SetSecurityDescriptorDacl(pSD, 1, pDacl, 0);
     2013}
     2014
    18002015
    18012016/*************************************************************************
     
    18072022                        BOOL *pfMustCopy, UINT uFlags)
    18082023{
    1809   static BOOL (* WINAPI pfnFunc)(LPCWSTR, LPCWSTR, LPCWSTR, BOOL*, UINT) = NULL;
    1810 
    1811   GET_FUNC(shell32, "SHGetNewLinkInfoW", FALSE);
    1812   return pfnFunc(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
     2024  GET_FUNC(pSHGetNewLinkInfoW, shell32, "SHGetNewLinkInfoW", FALSE);
     2025  return pSHGetNewLinkInfoW(pszLinkTo, pszDir, pszName, pfMustCopy, uFlags);
    18132026}
    18142027
     
    18212034                         LPVOID arg5, LPVOID arg6)
    18222035{
    1823   /* FIXME: Correct args */
    1824   static DWORD (* WINAPI pfnFunc)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID, LPVOID) = NULL;
    1825 
    1826   GET_FUNC(shell32, "SHDefExtractIconW", 0);
    1827   return pfnFunc(arg1, arg2, arg3, arg4, arg5, arg6);
     2036  GET_FUNC(pSHDefExtractIconW, shell32, "SHDefExtractIconW", 0);
     2037  return pSHDefExtractIconW(arg1, arg2, arg3, arg4, arg5, arg6);
    18282038}
    18292039
     
    18472057                         UINT nIconIndex)
    18482058{
    1849   static HICON (* WINAPI pfnFunc)(HINSTANCE, LPCWSTR, UINT) = NULL;
    1850 
    1851   GET_FUNC(shell32, "ExtractIconW", (HICON)0);
    1852   return pfnFunc(hInstance, lpszExeFileName, nIconIndex);
     2059  GET_FUNC(pExtractIconW, shell32, "ExtractIconW", (HICON)0);
     2060  return pExtractIconW(hInstance, lpszExeFileName, nIconIndex);
    18532061}
    18542062
     
    18682076 *      @       [SHLWAPI.377]
    18692077 *
    1870  * FIXME: Native appears to do DPA_Create and a DPA_InsertPtr for 
     2078 * FIXME: Native appears to do DPA_Create and a DPA_InsertPtr for
    18712079 *        each call here.
    18722080 * FIXME: Native shows calls to:
     
    19312139BOOL WINAPI SHLWAPI_389(LPOPENFILENAMEW ofn)
    19322140{
    1933   static BOOL (* WINAPI pfnFunc)(LPOPENFILENAMEW) = NULL;
    1934 
    1935   GET_FUNC(comdlg32, "GetSaveFileNameW", FALSE);
    1936   return pfnFunc(ofn);
     2141  GET_FUNC(pGetSaveFileNameW, comdlg32, "GetSaveFileNameW", FALSE);
     2142  return pGetSaveFileNameW(ofn);
    19372143}
    19382144
     
    19442150DWORD WINAPI SHLWAPI_390(LPVOID arg1, LPVOID arg2)
    19452151{
    1946   /* FIXME: Correct args */
    1947   static DWORD (* WINAPI pfnFunc)(LPVOID, LPVOID) = NULL;
    1948 
    1949   GET_FUNC(mpr, "WNetRestoreConnectionW", 0);
    1950   return pfnFunc(arg1, arg2);
     2152  GET_FUNC(pWNetRestoreConnectionW, mpr, "WNetRestoreConnectionW", 0);
     2153  return pWNetRestoreConnectionW(arg1, arg2);
    19512154}
    19522155
     
    19592162                         LPVOID arg5)
    19602163{
    1961   /* FIXME: Correct args */
    1962   static DWORD (* WINAPI pfnFunc)(LPVOID, LPVOID, LPVOID, LPVOID, LPVOID) = NULL;
    1963 
    1964   GET_FUNC(mpr, "WNetGetLastErrorW", 0);
    1965   return pfnFunc(arg1, arg2, arg3, arg4, arg5);
     2164  GET_FUNC(pWNetGetLastErrorW, mpr, "WNetGetLastErrorW", 0);
     2165  return pWNetGetLastErrorW(arg1, arg2, arg3, arg4, arg5);
    19662166}
    19672167
     
    19732173BOOL WINAPI SHLWAPI_401(LPPAGESETUPDLGW pagedlg)
    19742174{
    1975   static BOOL (* WINAPI pfnFunc)(LPPAGESETUPDLGW) = NULL;
    1976 
    1977   GET_FUNC(comdlg32, "PageSetupDlgW", FALSE);
    1978   return pfnFunc(pagedlg);
     2175  GET_FUNC(pPageSetupDlgW, comdlg32, "PageSetupDlgW", FALSE);
     2176  return pPageSetupDlgW(pagedlg);
    19792177}
    19802178
     
    19862184BOOL WINAPI SHLWAPI_402(LPPRINTDLGW printdlg)
    19872185{
    1988   static BOOL (* WINAPI pfnFunc)(LPPRINTDLGW) = NULL;
    1989 
    1990   GET_FUNC(comdlg32, "PrintDlgW", FALSE);
    1991   return pfnFunc(printdlg);
     2186  GET_FUNC(pPrintDlgW, comdlg32, "PrintDlgW", FALSE);
     2187  return pPrintDlgW(printdlg);
    19922188}
    19932189
     
    19992195BOOL WINAPI SHLWAPI_403(LPOPENFILENAMEW ofn)
    20002196{
    2001   static BOOL (* WINAPI pfnFunc)(LPOPENFILENAMEW) = NULL;
    2002 
    2003   GET_FUNC(comdlg32, "GetOpenFileNameW", FALSE);
    2004   return pfnFunc(ofn);
     2197  GET_FUNC(pGetOpenFileNameW, comdlg32, "GetOpenFileNameW", FALSE);
     2198  return pGetOpenFileNameW(ofn);
    20052199}
    20062200
     
    20692263
    20702264/*************************************************************************
     2265 *      @       [SHLWAPI.418]
     2266 *
     2267 * Function seems to do FreeLibrary plus other things.
     2268 *
     2269 * FIXME native shows the following calls:
     2270 *   RtlEnterCriticalSection
     2271 *   LocalFree
     2272 *   GetProcAddress(Comctl32??, 150L)
     2273 *   DPA_DeletePtr
     2274 *   RtlLeaveCriticalSection
     2275 *  followed by the FreeLibrary.
     2276 *  The above code may be related to .377 above.
     2277 */
     2278BOOL  WINAPI SHLWAPI_418 (HMODULE x)
     2279{
     2280        FIXME("(0x%08lx) partial stub\n", (LONG)x);
     2281        return FreeLibrary(x);
     2282}
     2283
     2284/*************************************************************************
    20712285 *      @       [SHLWAPI.431]
    20722286 */
     
    20772291}
    20782292
     2293/*************************************************************************
     2294 *      @       [SHLWAPI.436]
     2295 *
     2296 *  This is really CLSIDFromString which is exported by ole32.dll,
     2297 *  however the native shlwapi.dll does *not* import ole32. Nor does
     2298 *  ole32.dll import this ordinal from shlwapi. Therefore we must conclude
     2299 *  that MS duplicated the code for CLSIDFromString.
     2300 *
     2301 *  This is a duplicate (with changes for UNICODE) of CLSIDFromString16
     2302 *  in dlls/ole32/compobj.c
     2303 */
     2304DWORD WINAPI SHLWAPI_436 (LPWSTR idstr, CLSID *id)
     2305{
     2306    LPWSTR s = idstr;
     2307    BYTE *p;
     2308    INT i;
     2309    WCHAR table[256];
     2310
     2311    if (!s) {
     2312        memset(s, 0, sizeof(CLSID));
     2313        return S_OK;
     2314    }
     2315    else {  /* validate the CLSID string */
     2316
     2317        if (strlenW(s) != 38)
     2318            return CO_E_CLASSSTRING;
     2319
     2320        if ((s[0]!=L'{') || (s[9]!=L'-') || (s[14]!=L'-') || (s[19]!=L'-') || (s[24]!=L'-') || (s[37]!=L'}'))
     2321            return CO_E_CLASSSTRING;
     2322
     2323        for (i=1; i<37; i++)
     2324            {
     2325                if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue;
     2326                if (!(((s[i] >= L'0') && (s[i] <= L'9'))  ||
     2327                      ((s[i] >= L'a') && (s[i] <= L'f'))  ||
     2328                      ((s[i] >= L'A') && (s[i] <= L'F')))
     2329                    )
     2330                    return CO_E_CLASSSTRING;
     2331            }
     2332    }
     2333
     2334    TRACE("%s -> %p\n", debugstr_w(s), id);
     2335
     2336  /* quick lookup table */
     2337    memset(table, 0, 256*sizeof(WCHAR));
     2338
     2339    for (i = 0; i < 10; i++) {
     2340        table['0' + i] = i;
     2341    }
     2342    for (i = 0; i < 6; i++) {
     2343        table['A' + i] = i+10;
     2344        table['a' + i] = i+10;
     2345    }
     2346
     2347    /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
     2348
     2349    p = (BYTE *) id;
     2350
     2351    s++;        /* skip leading brace  */
     2352    for (i = 0; i < 4; i++) {
     2353        p[3 - i] = table[*s]<<4 | table[*(s+1)];
     2354        s += 2;
     2355    }
     2356    p += 4;
     2357    s++;        /* skip - */
     2358
     2359    for (i = 0; i < 2; i++) {
     2360        p[1-i] = table[*s]<<4 | table[*(s+1)];
     2361        s += 2;
     2362    }
     2363    p += 2;
     2364    s++;        /* skip - */
     2365
     2366    for (i = 0; i < 2; i++) {
     2367        p[1-i] = table[*s]<<4 | table[*(s+1)];
     2368        s += 2;
     2369    }
     2370    p += 2;
     2371    s++;        /* skip - */
     2372
     2373    /* these are just sequential bytes */
     2374    for (i = 0; i < 2; i++) {
     2375        *p++ = table[*s]<<4 | table[*(s+1)];
     2376        s += 2;
     2377    }
     2378    s++;        /* skip - */
     2379
     2380    for (i = 0; i < 6; i++) {
     2381        *p++ = table[*s]<<4 | table[*(s+1)];
     2382        s += 2;
     2383    }
     2384
     2385    return S_OK;
     2386}
    20792387#ifndef __WIN32OS2__
    20802388/*************************************************************************
     
    21042412 * Input HLS values are constrained to the range (0..240).
    21052413 */
    2106 VOID WINAPI ColorRGBToHLS(COLORREF drRGB, LPWORD pwHue, 
     2414VOID WINAPI ColorRGBToHLS(COLORREF drRGB, LPWORD pwHue,
    21072415                          LPWORD wLuminance, LPWORD pwSaturation)
    21082416{
     
    21232431 *      SHGetInverseCMAP (SHLWAPI.@)
    21242432 */
    2125 DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why)
    2126 {
    2127         FIXME("(%p, %#lx)stub\n", x, why);
     2433DWORD WINAPI SHGetInverseCMAP (LPDWORD* x, DWORD why)
     2434{
     2435    if (why == 4) {
     2436        FIXME(" - returning bogus address for SHGetInverseCMAP\n");
     2437        *x = (LPDWORD)0xabba1249;
    21282438        return 0;
    2129 }
    2130 
    2131 #ifndef __WIN32OS2__
     2439    }
     2440    FIXME("(%p, %#lx)stub\n", x, why);
     2441    return 0;
     2442}
     2443
    21322444/*************************************************************************
    21332445 *      SHIsLowMemoryMachine    [SHLWAPI.@]
     
    21382450        return 0;
    21392451}
    2140 #endif
     2452
    21412453/*************************************************************************
    21422454 *      GetMenuPosFromID        [SHLWAPI.@]
     
    21642476HRESULT WINAPI _SHGetInstanceExplorer (LPUNKNOWN *lpUnknown)
    21652477{
    2166   static HRESULT (* WINAPI pfnFunc)(LPUNKNOWN *) = NULL;
    2167 
    2168   GET_FUNC(shell32, "SHGetInstanceExplorer", E_FAIL);
    2169   return pfnFunc(lpUnknown);
    2170 }
     2478  GET_FUNC(pSHGetInstanceExplorer, shell32, "SHGetInstanceExplorer", E_FAIL);
     2479  return pSHGetInstanceExplorer(lpUnknown);
     2480}
     2481
     2482/*************************************************************************
     2483 *      SHGetThreadRef  [SHLWAPI.@]
     2484 *
     2485 * Retrieves the per-thread object reference set by SHSetThreadRef
     2486 * "punk" - Address of a pointer to the IUnknown interface. Returns S_OK if
     2487 *          successful or E_NOINTERFACE otherwise.
     2488 */
     2489HRESULT WINAPI SHGetThreadRef (IUnknown ** ppunk)
     2490{
     2491    if (SHLWAPI_ThreadRef_index < 0) return E_NOINTERFACE;
     2492    *ppunk = (IUnknown *)TlsGetValue(SHLWAPI_ThreadRef_index);
     2493    return S_OK;
     2494}
     2495
     2496/*************************************************************************
     2497 *      SHSetThreadRef  [SHLWAPI.@]
     2498 *
     2499 * Stores a per-thread reference to a COM object
     2500 * "punk" - Pointer to the IUnknown interface of the object to
     2501 *          which you want to store a reference. Returns S_OK if successful
     2502 *          or an OLE error value.
     2503 */
     2504HRESULT WINAPI SHSetThreadRef (IUnknown * punk)
     2505{
     2506    if (SHLWAPI_ThreadRef_index < 0) return E_NOINTERFACE;
     2507    TlsSetValue(SHLWAPI_ThreadRef_index, (LPVOID) punk);
     2508    return S_OK;
     2509}
Note: See TracChangeset for help on using the changeset viewer.