Ignore:
Timestamp:
Feb 6, 2002, 9:18:30 PM (24 years ago)
Author:
sandervl
Message:

Wine resync

File:
1 edited

Legend:

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

    r7508 r7820  
    1919#include "wine/unicode.h"
    2020#include "wine/obj_base.h"
     21#include "wine/obj_inplace.h"
     22#include "wine/obj_serviceprovider.h"
    2123#include "wingdi.h"
     24#include "winreg.h"
    2225#include "winuser.h"
    2326#include "debugtools.h"
     27#include "ordinal.h"
     28#include "shlwapi.h"
    2429
    2530DEFAULT_DEBUG_CHANNEL(shell);
    2631
    27 #ifdef __WIN32OS2__
    28 extern HINSTANCE shlwapi_hInstance = 0;
    29 extern HMODULE SHLWAPI_hshell32 = 0;
    30 extern HMODULE SHLWAPI_hwinmm = 0;
    31 extern HMODULE SHLWAPI_hcomdlg32 = 0;
    32 extern HMODULE SHLWAPI_hmpr = 0;
    33 extern HMODULE SHLWAPI_hmlang = 0;
    34 #else
    3532extern HINSTANCE shlwapi_hInstance;
    3633extern HMODULE SHLWAPI_hshell32;
     
    3936extern HMODULE SHLWAPI_hmpr;
    4037extern HMODULE SHLWAPI_hmlang;
    41 #endif
     38
     39typedef HANDLE HSHARED; /* Shared memory */
     40
     41/* following is GUID for IObjectWithSite::SetSite  -- see _174           */
     42static DWORD id1[4] = {0xfc4801a3, 0x11cf2ba9, 0xaa0029a2, 0x52733d00};
     43/* following is GUID for IPersistMoniker::GetClassID  -- see _174        */
     44static DWORD id2[4] = {0x79eac9ee, 0x11cebaf9, 0xaa00828c, 0x0ba94b00};
     45
     46/* The following schemes were identified in the native version of
     47 * SHLWAPI.DLL version 5.50
     48 */
     49typedef enum {
     50    URL_SCHEME_INVALID     = -1,
     51    URL_SCHEME_UNKNOWN     =  0,
     52    URL_SCHEME_FTP,
     53    URL_SCHEME_HTTP,
     54    URL_SCHEME_GOPHER,
     55    URL_SCHEME_MAILTO,
     56    URL_SCHEME_NEWS,
     57    URL_SCHEME_NNTP,
     58    URL_SCHEME_TELNET,
     59    URL_SCHEME_WAIS,
     60    URL_SCHEME_FILE,
     61    URL_SCHEME_MK,
     62    URL_SCHEME_HTTPS,
     63    URL_SCHEME_SHELL,
     64    URL_SCHEME_SNEWS,
     65    URL_SCHEME_LOCAL,
     66    URL_SCHEME_JAVASCRIPT,
     67    URL_SCHEME_VBSCRIPT,
     68    URL_SCHEME_ABOUT,
     69    URL_SCHEME_RES,
     70    URL_SCHEME_MAXVALUE
     71} URL_SCHEME;
     72
     73typedef struct {
     74    URL_SCHEME  scheme_number;
     75    LPCSTR scheme_name;
     76} SHL_2_inet_scheme;
     77
     78static const SHL_2_inet_scheme shlwapi_schemes[] = {
     79  {URL_SCHEME_FTP,        "ftp"},
     80  {URL_SCHEME_HTTP,       "http"},
     81  {URL_SCHEME_GOPHER,     "gopher"},
     82  {URL_SCHEME_MAILTO,     "mailto"},
     83  {URL_SCHEME_NEWS,       "news"},
     84  {URL_SCHEME_NNTP,       "nntp"},
     85  {URL_SCHEME_TELNET,     "telnet"},
     86  {URL_SCHEME_WAIS,       "wais"},
     87  {URL_SCHEME_FILE,       "file"},
     88  {URL_SCHEME_MK,         "mk"},
     89  {URL_SCHEME_HTTPS,      "https"},
     90  {URL_SCHEME_SHELL,      "shell"},
     91  {URL_SCHEME_SNEWS,      "snews"},
     92  {URL_SCHEME_LOCAL,      "local"},
     93  {URL_SCHEME_JAVASCRIPT, "javascript"},
     94  {URL_SCHEME_VBSCRIPT,   "vbscript"},
     95  {URL_SCHEME_ABOUT,      "about"},
     96  {URL_SCHEME_RES,        "res"},
     97  {0, 0}
     98};
    4299
    43100/* Macro to get function pointer for a module*/
     
    57114 and recommend the builtin rather than reimplementing the calls here!
    58115*/
    59 #ifndef __WIN32OS2__
    60 /*************************************************************************
    61  *      SHLWAPI_1       [SHLWAPI.1]
    62  */
    63 DWORD WINAPI SHLWAPI_1 (
    64         LPSTR   lpURL,
    65         LPDWORD lpdwFlags)
    66 {
    67   if (lpURL == NULL)
    68     return E_INVALIDARG;
    69  
    70   if (lpdwFlags == NULL)
    71     return E_INVALIDARG;
    72  
    73   // verify flags
    74   if (*lpdwFlags != 0x18)   // some unknown flag
    75     return E_INVALIDARG;      // some unknown error condition
    76  
    77   FIXME("(%p %s %p %s)\n",lpStr, debugstr_a(lpStr),x, debugstr_a(x));
    78   return 0;
    79 }
    80 
    81 /*************************************************************************
    82  *      SHLWAPI_2       [SHLWAPI.2]
    83  */
    84 DWORD WINAPI SHLWAPI_2 (LPCWSTR x,LPVOID y)
    85 {
    86         FIXME("(%s,%p)\n",debugstr_w(x),y);
     116
     117/*************************************************************************
     118 *      @       [SHLWAPI.1]
     119 *
     120 * Identifies the Internet "scheme" in the passed string. ASCII based.
     121 * Also determines start and length of item after the ':'
     122 */
     123DWORD WINAPI SHLWAPI_1 (LPCSTR x, UNKNOWN_SHLWAPI_1 *y)
     124{
     125    DWORD cnt;
     126    const SHL_2_inet_scheme *inet_pro;
     127
     128    if (y->size != 0x18) return E_INVALIDARG;
     129    /* FIXME: leading white space generates error of 0x80041001 which
     130     *        is undefined
     131     */
     132    if (*x <= ' ') return 0x80041001;
     133    cnt = 0;
     134    y->sizep1 = 0;
     135    y->ap1 = x;
     136    while (*x) {
     137        if (*x == ':') {
     138            y->sizep1 = cnt;
     139            cnt = -1;
     140            y->ap2 = x+1;
     141            break;
     142        }
     143        x++;
     144        cnt++;
     145    }
     146
     147    /* check for no scheme in string start */
     148    /* (apparently schemes *must* be larger than a single character)  */
     149    if ((*x == '\0') || (y->sizep1 <= 1)) {
     150        y->ap1 = 0;
     151        return 0x80041001;
     152    }
     153
     154    /* found scheme, set length of remainder */
     155    y->sizep2 = lstrlenA(y->ap2);
     156
     157    /* see if known scheme and return indicator number */
     158    y->fcncde = URL_SCHEME_UNKNOWN;
     159    inet_pro = shlwapi_schemes;
     160    while (inet_pro->scheme_name) {
     161        if (!strncasecmp(inet_pro->scheme_name, y->ap1,
     162                    min(y->sizep1, lstrlenA(inet_pro->scheme_name)))) {
     163            y->fcncde = inet_pro->scheme_number;
     164            break;
     165        }
     166        inet_pro++;
     167    }
     168    return S_OK;
     169}
     170
     171/*************************************************************************
     172 *      @       [SHLWAPI.2]
     173 *
     174 * Identifies the Internet "scheme" in the passed string. UNICODE based.
     175 * Also determines start and length of item after the ':'
     176 */
     177DWORD WINAPI SHLWAPI_2 (LPCWSTR x, UNKNOWN_SHLWAPI_2 *y)
     178{
     179    DWORD cnt;
     180    const SHL_2_inet_scheme *inet_pro;
     181    LPSTR cmpstr;
     182    INT len;
     183
     184    if (y->size != 0x18) return E_INVALIDARG;
     185    /* FIXME: leading white space generates error of 0x80041001 which
     186     *        is undefined
     187     */
     188    if (*x <= L' ') return 0x80041001;
     189    cnt = 0;
     190    y->sizep1 = 0;
     191    y->ap1 = x;
     192    while (*x) {
     193        if (*x == L':') {
     194            y->sizep1 = cnt;
     195            cnt = -1;
     196            y->ap2 = x+1;
     197            break;
     198        }
     199        x++;
     200        cnt++;
     201    }
     202
     203    /* check for no scheme in string start */
     204    /* (apparently schemes *must* be larger than a single character)  */
     205    if ((*x == L'\0') || (y->sizep1 <= 1)) {
     206        y->ap1 = 0;
     207        return 0x80041001;
     208    }
     209
     210    /* found scheme, set length of remainder */
     211    y->sizep2 = lstrlenW(y->ap2);
     212
     213    /* see if known scheme and return indicator number */
     214    len = WideCharToMultiByte(0, 0, y->ap1, y->sizep1, 0, 0, 0, 0);
     215    cmpstr = (LPSTR)HeapAlloc(GetProcessHeap(), 0, len+1);
     216    WideCharToMultiByte(0, 0, y->ap1, y->sizep1, cmpstr, len+1, 0, 0);
     217    y->fcncde = URL_SCHEME_UNKNOWN;
     218    inet_pro = shlwapi_schemes;
     219    while (inet_pro->scheme_name) {
     220        if (!strncasecmp(inet_pro->scheme_name, cmpstr,
     221                    min(len, lstrlenA(inet_pro->scheme_name)))) {
     222            y->fcncde = inet_pro->scheme_number;
     223            break;
     224        }
     225        inet_pro++;
     226    }
     227    HeapFree(GetProcessHeap(), 0, cmpstr);
     228    return S_OK;
     229}
     230
     231/*************************************************************************
     232 * SHLWAPI_DupSharedHandle
     233 *
     234 * Internal implemetation of SHLWAPI_11.
     235 */
     236static
     237HSHARED WINAPI SHLWAPI_DupSharedHandle(HSHARED hShared, DWORD dwDstProcId,
     238                                       DWORD dwSrcProcId, DWORD dwAccess,
     239                                       DWORD dwOptions)
     240{
     241  HANDLE hDst, hSrc;
     242  DWORD dwMyProcId = GetCurrentProcessId();
     243  HSHARED hRet = (HSHARED)NULL;
     244
     245  TRACE("(%p,%ld,%ld,%08lx,%08lx)\n", (PVOID)hShared, dwDstProcId, dwSrcProcId,
     246        dwAccess, dwOptions);
     247
     248  /* Get dest process handle */
     249  if (dwDstProcId == dwMyProcId)
     250    hDst = GetCurrentProcess();
     251  else
     252    hDst = OpenProcess(PROCESS_DUP_HANDLE, 0, dwDstProcId);
     253
     254  if (hDst)
     255  {
     256    /* Get src process handle */
     257    if (dwSrcProcId == dwMyProcId)
     258      hSrc = GetCurrentProcess();
     259    else
     260      hSrc = OpenProcess(PROCESS_DUP_HANDLE, 0, dwSrcProcId);
     261
     262    if (hSrc)
     263    {
     264      /* Make handle available to dest process */
     265      if (!DuplicateHandle(hDst, (HANDLE)hShared, hSrc, &hRet,
     266                           dwAccess, 0, dwOptions | DUPLICATE_SAME_ACCESS))
     267        hRet = (HSHARED)NULL;
     268
     269      if (dwSrcProcId != dwMyProcId)
     270        CloseHandle(hSrc);
     271    }
     272
     273    if (dwDstProcId != dwMyProcId)
     274      CloseHandle(hDst);
     275  }
     276
     277  TRACE("Returning handle %p\n", (PVOID)hRet);
     278  return hRet;
     279}
     280
     281/*************************************************************************
     282 * @  [SHLWAPI.7]
     283 *
     284 * Create a block of sharable memory and initialise it with data.
     285 *
     286 * PARAMS
     287 * dwProcId [I] ID of process owning data
     288 * lpvData  [I] Pointer to data to write
     289 * dwSize   [I] Size of data
     290 *
     291 * RETURNS
     292 * Success: A shared memory handle
     293 * Failure: NULL
     294 *
     295 * NOTES
     296 * Ordinals 7-11 provide a set of calls to create shared memory between a
     297 * group of processes. The shared memory is treated opaquely in that its size
     298 * is not exposed to clients who map it. This is accomplished by storing
     299 * the size of the map as the first DWORD of mapped data, and then offsetting
     300 * the view pointer returned by this size.
     301 *
     302 * SHLWAPI_7/SHLWAPI_10 - Create/Destroy the shared memory handle
     303 * SHLWAPI_8/SHLWAPI_9  - Get/Release a pointer to the shared data
     304 * SHLWAPI_11           - Helper function; Duplicate cross-process handles
     305   */
     306HSHARED WINAPI SHLWAPI_7 (DWORD dwProcId, LPCVOID lpvData, DWORD dwSize)
     307{
     308  HANDLE hMap;
     309  LPVOID pMapped;
     310  HSHARED hRet = (HSHARED)NULL;
     311
     312  TRACE("(%ld,%p,%ld)\n", dwProcId, lpvData, dwSize);
     313
     314  /* Create file mapping of the correct length */
     315  hMap = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, FILE_MAP_READ, 0,
     316                            dwSize + sizeof(dwSize), NULL);
     317  if (!hMap)
     318    return hRet;
     319
     320  /* Get a view in our process address space */
     321  pMapped = MapViewOfFile(hMap, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
     322
     323  if (pMapped)
     324  {
     325    /* Write size of data, followed by the data, to the view */
     326    *((DWORD*)pMapped) = dwSize;
     327    if (dwSize)
     328      memcpy((char *) pMapped + sizeof(dwSize), lpvData, dwSize);
     329
     330    /* Release view. All further views mapped will be opaque */
     331    UnmapViewOfFile(pMapped);
     332    hRet = SHLWAPI_DupSharedHandle((HSHARED)hMap, dwProcId,
     333                                   GetCurrentProcessId(), FILE_MAP_ALL_ACCESS,
     334                                   DUPLICATE_SAME_ACCESS);
     335  }
     336
     337  CloseHandle(hMap);
     338  return hRet;
     339}
     340
     341/*************************************************************************
     342 * @ [SHLWAPI.8]
     343 *
     344 * Get a pointer to a block of shared memory from a shared memory handle.
     345 *
     346 * PARAMS
     347 * hShared  [I] Shared memory handle
     348 * dwProcId [I] ID of process owning hShared
     349 *
     350 * RETURNS
     351 * Success: A pointer to the shared memory
     352 * Failure: NULL
     353 *
     354 * NOTES
     355 * See SHLWAPI_7.
     356   */
     357PVOID WINAPI SHLWAPI_8 (HSHARED hShared, DWORD dwProcId)
     358  {
     359  HSHARED hDup;
     360  LPVOID pMapped;
     361
     362  TRACE("(%p %ld)\n", (PVOID)hShared, dwProcId);
     363
     364  /* Get handle to shared memory for current process */
     365  hDup = SHLWAPI_DupSharedHandle(hShared, dwProcId, GetCurrentProcessId(),
     366                                 FILE_MAP_ALL_ACCESS, 0);
     367  /* Get View */
     368  pMapped = MapViewOfFile((HANDLE)hDup, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
     369  CloseHandle(hDup);
     370
     371  if (pMapped)
     372    return (char *) pMapped + sizeof(DWORD); /* Hide size */
     373  return NULL;
     374}
     375
     376/*************************************************************************
     377 * @ [SHLWAPI.9]
     378 *
     379 * Release a pointer to a block of shared memory.
     380 *
     381 * PARAMS
     382 * lpView [I] Shared memory pointer
     383 *
     384 * RETURNS
     385 * Success: TRUE
     386 * Failure: FALSE
     387 *
     388 * NOTES
     389 * See SHLWAPI_7.
     390 */
     391BOOL WINAPI SHLWAPI_9 (LPVOID lpView)
     392{
     393  TRACE("(%p)\n", lpView);
     394  return UnmapViewOfFile((char *) lpView - sizeof(DWORD)); /* Include size */
     395}
     396
     397/*************************************************************************
     398 * @ [SHLWAPI.10]
     399 *
     400 * Destroy a block of sharable memory.
     401 *
     402 * PARAMS
     403 * hShared  [I] Shared memory handle
     404 * dwProcId [I] ID of process owning hShared
     405 *
     406 * RETURNS
     407 * Success: TRUE
     408 * Failure: FALSE
     409 *
     410 * NOTES
     411 * See SHLWAPI_7.
     412 */
     413BOOL WINAPI SHLWAPI_10 (HSHARED hShared, DWORD dwProcId)
     414{
     415  HSHARED hClose;
     416
     417  TRACE("(%p %ld)\n", (PVOID)hShared, dwProcId);
     418
     419  /* Get a copy of the handle for our process, closing the source handle */
     420  hClose = SHLWAPI_DupSharedHandle(hShared, dwProcId, GetCurrentProcessId(),
     421                                   FILE_MAP_ALL_ACCESS,DUPLICATE_CLOSE_SOURCE);
     422  /* Close local copy */
     423  return CloseHandle((HANDLE)hClose);
     424}
     425
     426/*************************************************************************
     427 * @   [SHLWAPI.11]
     428 *
     429 * Copy a sharable memory handle from one process to another.
     430 *
     431 * PARAMS
     432 * hShared     [I] Shared memory handle to duplicate
     433 * dwDstProcId [I] ID of the process wanting the duplicated handle
     434 * dwSrcProcId [I] ID of the process owning hShared
     435 * dwAccess    [I] Desired DuplicateHandle access
     436 * dwOptions   [I] Desired DuplicateHandle options
     437 *
     438 * RETURNS
     439 * Success: A handle suitable for use by the dwDstProcId process.
     440 * Failure: A NULL handle.
     441 *
     442 * NOTES
     443 * See SHLWAPI_7.
     444 */
     445HSHARED WINAPI SHLWAPI_11(HSHARED hShared, DWORD dwDstProcId, DWORD dwSrcProcId,
     446                          DWORD dwAccess, DWORD dwOptions)
     447{
     448  HSHARED hRet;
     449
     450  hRet = SHLWAPI_DupSharedHandle(hShared, dwDstProcId, dwSrcProcId,
     451                                 dwAccess, dwOptions);
     452  return hRet;
     453}
     454
     455/*************************************************************************
     456 *      @       [SHLWAPI.13]
     457 * (Used by IE4 during startup)
     458 */
     459HRESULT WINAPI SHLWAPI_13 (
     460        LPVOID w,
     461        LPVOID x)
     462{
     463        FIXME("(%p %p)stub\n",w,x);
     464        return 1;
     465#if 0
     466        /* pseudo code extracted from relay trace */
     467        RegOpenKeyA(HKLM, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Aceepted Documents", &newkey);
     468        ret = 0;
     469        i = 0;
     470        size = 0;
     471        while(!ret) {
     472            ret = RegEnumValueA(newkey, i, a1, a2, 0, a3, 0, 0);
     473            size += ???;
     474            i++;
     475        }
     476        b1 = LocalAlloc(0x40, size);
     477        ret = 0;
     478        i = 0;
     479        while(!ret) {
     480            ret = RegEnumValueA(newkey, i, a1, a2, 0, a3, a4, a5);
     481            RegisterClipBoardFormatA(a4);
     482            i++;
     483        }
     484        hwnd1 = GetModuleHandleA("URLMON.DLL");
     485        proc = GetProcAddress(hwnd1, "CreateFormatEnumerator");
     486        HeapAlloc(??, 0, 0x14);
     487        HeapAlloc(??, 0, 0x50);
     488        LocalAlloc(0x40, 0x78);
     489        /* FIXME: bad string below */
     490        lstrlenW(L"{D0FCA420-D3F5-11CF-B211-00AA004AE837}");
     491        StrCpyW(a6,  L"{D0FCA420-D3F5-11CF-B211-00AA004AE837}");
     492
     493        GetTickCount();
     494        IsBadReadPtr(c1 = 0x403fd210,4);
     495        InterlockedIncrement(c1+4);
     496        LocalFree(b1);
     497        RegCloseKey(newkey);
     498        IsBadReadPtr(c1 = 0x403fd210,4);
     499        InterlockedIncrement(c1+4);
     500
     501        HeapAlloc(40350000,00000000,00000014) retval=403fd0a8;
     502        HeapAlloc(40350000,00000000,00000050) retval=403feb44;
     503        hwnd1 = GetModuleHandleA("URLMON.DLL");
     504        proc = GetProcAddress(hwnd1, "RegisterFormatEnumerator");
     505        /* 0x1a40c88c is in URLMON.DLL just before above proc
     506         * content is L"_EnumFORMATETC_"
     507         * label is d1
     508         */
     509        IsBadReadPtr(d1 = 0x1a40c88c,00000002);
     510        lstrlenW(d1);
     511        lstrlenW(d1);
     512        HeapAlloc(40350000,00000000,0000001e) retval=403fed44;
     513        IsBadReadPtr(d2 = 0x403fd0a8,00000004);
     514        InterlockedIncrement(d2+4);
     515        IsBadReadPtr(d2 = 0x403fd0a8,00000004);
     516        InterlockedDecrement(d2+4);
     517        IsBadReadPtr(c1,00000004);
     518        InterlockedDecrement(c1+4);
     519        IsBadReadPtr(c1,00000004);
     520        InterlockedDecrement(c1+4);
     521
     522#endif
     523}
     524
     525/*************************************************************************
     526 *      @       [SHLWAPI.14]
     527 *
     528 * Function:
     529 *    Retrieves IE "AcceptLanguage" value from registry. ASCII mode.
     530 * 
     531 */
     532HRESULT WINAPI SHLWAPI_14 (
     533        LPSTR langbuf,
     534        LPDWORD buflen)
     535{
     536        CHAR *mystr;
     537        DWORD mystrlen, mytype;
     538        HKEY mykey;
     539        LCID mylcid;
     540
     541        mystrlen = (*buflen > 6) ? *buflen : 6;
     542        mystr = (CHAR*)HeapAlloc(GetProcessHeap(),
     543                                 HEAP_ZERO_MEMORY, mystrlen);
     544        RegOpenKeyA(HKEY_CURRENT_USER,
     545                    "Software\\Microsoft\\Internet Explorer\\International",
     546                    &mykey);
     547        if (RegQueryValueExA(mykey, "AcceptLanguage",
     548                              0, &mytype, mystr, &mystrlen)) {
     549            /* Did not find value */
     550            mylcid = GetUserDefaultLCID();
     551            /* somehow the mylcid translates into "en-us"
     552             *  this is similar to "LOCALE_SABBREVLANGNAME"
     553             *  which could be gotten via GetLocaleInfo.
     554             *  The only problem is LOCALE_SABBREVLANGUAGE" is
     555             *  a 3 char string (first 2 are country code and third is
     556             *  letter for "sublanguage", which does not come close to
     557             *  "en-us"
     558             */
     559            lstrcpyA(mystr, "en-us");
     560            mystrlen = lstrlenA(mystr);
     561        }
     562        else {
     563            /* handle returned string */
     564            FIXME("missing code\n");
     565        }
     566        if (mystrlen > *buflen)
     567            lstrcpynA(langbuf, mystr, *buflen);
     568        else {
     569            lstrcpyA(langbuf, mystr);
     570            *buflen = lstrlenA(langbuf);
     571        }       
     572        RegCloseKey(mykey);
     573        HeapFree(GetProcessHeap(), 0, mystr);
     574        TRACE("language is %s\n", debugstr_a(langbuf));
    87575        return 0;
    88576}
    89577
    90578/*************************************************************************
    91  *      SHLWAPI_16      [SHLWAPI.16]
     579 *      @       [SHLWAPI.15]
     580 *
     581 * Function:
     582 *    Retrieves IE "AcceptLanguage" value from registry. UNICODE mode.
     583 * 
     584 */
     585HRESULT WINAPI SHLWAPI_15 (
     586        LPWSTR langbuf,
     587        LPDWORD buflen)
     588{
     589        CHAR *mystr;
     590        DWORD mystrlen, mytype;
     591        HKEY mykey;
     592        LCID mylcid;
     593
     594        mystrlen = (*buflen > 6) ? *buflen : 6;
     595        mystr = (CHAR*)HeapAlloc(GetProcessHeap(),
     596                                 HEAP_ZERO_MEMORY, mystrlen);
     597        RegOpenKeyA(HKEY_CURRENT_USER,
     598                    "Software\\Microsoft\\Internet Explorer\\International",
     599                    &mykey);
     600        if (RegQueryValueExA(mykey, "AcceptLanguage",
     601                              0, &mytype, mystr, &mystrlen)) {
     602            /* Did not find value */
     603            mylcid = GetUserDefaultLCID();
     604            /* somehow the mylcid translates into "en-us"
     605             *  this is similar to "LOCALE_SABBREVLANGNAME"
     606             *  which could be gotten via GetLocaleInfo.
     607             *  The only problem is LOCALE_SABBREVLANGUAGE" is
     608             *  a 3 char string (first 2 are country code and third is
     609             *  letter for "sublanguage", which does not come close to
     610             *  "en-us"
     611             */
     612            lstrcpyA(mystr, "en-us");
     613            mystrlen = lstrlenA(mystr);
     614        }
     615        else {
     616            /* handle returned string */
     617            FIXME("missing code\n");
     618        }
     619        RegCloseKey(mykey);
     620        *buflen = MultiByteToWideChar(0, 0, mystr, -1, langbuf, (*buflen)-1);
     621        HeapFree(GetProcessHeap(), 0, mystr);
     622        TRACE("language is %s\n", debugstr_w(langbuf));
     623        return 0;
     624}
     625
     626/*************************************************************************
     627 *      @       [SHLWAPI.16]
    92628 */
    93629HRESULT WINAPI SHLWAPI_16 (
     
    100636        return 0xabba1252;
    101637}
    102 #endif
    103 
    104 /*************************************************************************
    105  *      SHLWAPI_23      [SHLWAPI.23]
     638
     639/*************************************************************************
     640 *      @       [SHLWAPI.18]
     641 *
     642 *  w is pointer to address of callback routine
     643 *  x is pointer to LPVOID to receive address of locally allocated
     644 *         space size 0x14
     645 *  return is 0 (unless out of memory???)
     646 *
     647 * related to _19, _21 and _22 below
     648 *  only seen invoked by SHDOCVW
     649 */
     650LONG WINAPI SHLWAPI_18 (
     651        LPVOID *w,
     652        LPVOID x)
     653{
     654        FIXME("(%p %p)stub\n",w,x);
     655        *((LPDWORD)x) = 0;
     656        return 0;
     657}
     658
     659/*************************************************************************
     660 *      @       [SHLWAPI.19]
     661 *
     662 *  w is address of allocated memory from _21
     663 *  return is 0 (unless out of memory???)
     664 *
     665 * related to _18, _21 and _22 below
     666 *  only seen invoked by SHDOCVW
     667 */
     668LONG WINAPI SHLWAPI_19 (
     669        LPVOID w)
     670{
     671        FIXME("(%p) stub\n",w);
     672        return 0;
     673}
     674
     675/*************************************************************************
     676 *      @       [SHLWAPI.21]
     677 *
     678 *  w points to space allocated via .18 above
     679 *      LocalSize is done on it (retrieves 18)
     680 *      LocalReAlloc is done on it to size 8 with LMEM_MOVEABLE & LMEM_ZEROINIT
     681 *  x values seen 0xa0000005
     682 *  returns 1
     683 *
     684 *  relates to _18, _19 and _22 above and below
     685 *   only seen invoked by SHDOCVW
     686 */
     687LONG WINAPI SHLWAPI_21 (
     688        LPVOID w,
     689        DWORD  x)
     690{
     691        FIXME("(%p %lx)stub\n",w,x);
     692        return 1;
     693}
     694
     695/*************************************************************************
     696 *      @       [SHLWAPI.22]
     697 *
     698 *  return is 'w' value seen in x is 0xa0000005
     699 *
     700 *  relates to _18, _19 and _21 above
     701 *   only seen invoked by SHDOCVW
     702 */
     703LPVOID WINAPI SHLWAPI_22 (
     704        LPVOID w,
     705        DWORD  x)
     706{
     707        FIXME("(%p %lx)stub\n",w,x);
     708        return w;
     709}
     710
     711/*************************************************************************
     712 *      @       [SHLWAPI.23]
    106713 *
    107714 * NOTES
     
    127734
    128735/*************************************************************************
    129  *      SHLWAPI_24      [SHLWAPI.24]
     736 *      @       [SHLWAPI.24]
    130737 *
    131738 * NOTES
     
    148755
    149756/*************************************************************************
    150  *      SHLWAPI_30      [SHLWAPI.30]
    151  *
    152  * Seems to be an isspaceW.
    153  */
    154 BOOL WINAPI SHLWAPI_30(LPWSTR lpcChar)
    155 {
    156   switch (*lpcChar)
    157   {
    158   case (WCHAR)'\t':
    159   case (WCHAR)' ':
    160   case 160:
    161   case 12288:
    162   case 65279:
     757 *      @       [SHLWAPI.25]
     758 *
     759 * Seems to be iswalpha
     760 */
     761BOOL WINAPI SHLWAPI_25(WCHAR wc)
     762{
     763    return (get_char_typeW(wc) & C1_ALPHA) != 0;
     764}
     765
     766/*************************************************************************
     767 *      @       [SHLWAPI.26]
     768 *
     769 * Seems to be iswupper
     770 */
     771BOOL WINAPI SHLWAPI_26(WCHAR wc)
     772{
     773    return (get_char_typeW(wc) & C1_UPPER) != 0;
     774}
     775
     776/*************************************************************************
     777 *      @       [SHLWAPI.27]
     778 *
     779 * Seems to be iswlower
     780 */
     781BOOL WINAPI SHLWAPI_27(WCHAR wc)
     782{
     783    return (get_char_typeW(wc) & C1_LOWER) != 0;
     784}
     785
     786/*************************************************************************
     787 *      @       [SHLWAPI.28]
     788 *
     789 * Seems to be iswalnum
     790 */
     791BOOL WINAPI SHLWAPI_28(WCHAR wc)
     792{
     793    return (get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT)) != 0;
     794}
     795
     796/*************************************************************************
     797 *      @       [SHLWAPI.29]
     798 *
     799 * Seems to be iswspace
     800 */
     801BOOL WINAPI SHLWAPI_29(WCHAR wc)
     802{
     803    return (get_char_typeW(wc) & C1_SPACE) != 0;
     804}
     805
     806/*************************************************************************
     807 *      @       [SHLWAPI.30]
     808 *
     809 * Seems to be iswblank
     810 */
     811BOOL WINAPI SHLWAPI_30(WCHAR wc)
     812{
     813    return (get_char_typeW(wc) & C1_BLANK) != 0;
     814}
     815
     816/*************************************************************************
     817 *      @       [SHLWAPI.31]
     818 *
     819 * Seems to be iswpunct
     820 */
     821BOOL WINAPI SHLWAPI_31(WCHAR wc)
     822{
     823    return (get_char_typeW(wc) & C1_PUNCT) != 0;
     824}
     825
     826/*************************************************************************
     827 *      @       [SHLWAPI.32]
     828 *
     829 * Seems to be iswcntrl
     830 */
     831BOOL WINAPI SHLWAPI_32(WCHAR wc)
     832{
     833    return (get_char_typeW(wc) & C1_CNTRL) != 0;
     834}
     835
     836/*************************************************************************
     837 *      @       [SHLWAPI.33]
     838 *
     839 * Seems to be iswdigit
     840 */
     841BOOL WINAPI SHLWAPI_33(WCHAR wc)
     842{
     843    return (get_char_typeW(wc) & C1_DIGIT) != 0;
     844}
     845
     846/*************************************************************************
     847 *      @       [SHLWAPI.34]
     848 *
     849 * Seems to be iswxdigit
     850 */
     851BOOL WINAPI SHLWAPI_34(WCHAR wc)
     852{
     853    return (get_char_typeW(wc) & C1_XDIGIT) != 0;
     854}
     855
     856/*************************************************************************
     857 *      @       [SHLWAPI.35]
     858 *
     859 */
     860BOOL WINAPI SHLWAPI_35(LPVOID p1, DWORD dw2, LPVOID p3)
     861{
     862    FIXME("(%p, 0x%08lx, %p): stub\n", p1, dw2, p3);
    163863    return TRUE;
    164   }
    165   return FALSE;
    166 }
    167 
    168 /*************************************************************************
    169  *      SHLWAPI_32      [SHLWAPI.32]
    170  */
    171 BOOL WINAPI SHLWAPI_32(LPCWSTR lpcChar)
    172 {
    173  if (*lpcChar < (WCHAR)' ')
    174    return TRUE;
    175 
    176  /* This is probably a shlwapi bug, but we do it the same for compatability */
    177  if (((DWORD)lpcChar & 0xffff) - 127 <= (WCHAR)' ')
    178    return TRUE;
    179  return FALSE;
    180 }
    181 
    182 /*************************************************************************
    183  *      SHLWAPI_40      [SHLWAPI.40]
     864}
     865
     866/*************************************************************************
     867 *      @       [SHLWAPI.36]
     868 *
     869 */
     870BOOL WINAPI SHLWAPI_36(HMENU h1, UINT ui2, UINT h3, LPCWSTR p4)
     871{
     872    TRACE("(0x%08x, 0x%08x, 0x%08x, %s): stub\n",
     873          h1, ui2, h3, debugstr_w(p4));
     874    return AppendMenuW(h1, ui2, h3, p4);
     875}
     876
     877/*************************************************************************
     878 *      @       [SHLWAPI.40]
    184879 *
    185880 * Get pointer to next Unicode character.
     
    191886
    192887/*************************************************************************
    193  *      SHLWAPI_74      [SHLWAPI.74]
     888 *      @       [SHLWAPI.74]
    194889 *
    195890 * Get the text from a given dialog item.
     
    205900  return 0;
    206901}
    207 /*************************************************************************
    208  *      SHLWAPI_151     [SHLWAPI.151]
    209  */
    210 #ifdef __WIN32OS2__
     902
     903/*************************************************************************
     904 *      @       [SHLWAPI.151]
     905 * Function:  Compare two ASCII strings for "len" bytes.
     906 * Returns:   *str1-*str2  (case sensitive)
     907 */
    211908DWORD WINAPI SHLWAPI_151(LPSTR str1, LPSTR str2, INT len)
    212909{
    213   dprintf(("SHLWAPI_151 (strcmpn) %s %s %d", str1, str2, len));
    214   if (!len)
    215     return 0;
    216 
    217   while (--len && *str1 && *str1 == *str2)
    218   {
    219     str1++;
    220     str2++;
    221   }
    222   return *str1 - *str2;
    223 
    224 }
    225 #else
    226 DWORD WINAPI SHLWAPI_151(void)
    227 {
    228   FIXME(": stub\n");
    229   return 0;
    230 }
    231 #endif
    232 
    233 /*************************************************************************
    234  *      SHLWAPI_152     [SHLWAPI.152]
     910    return strncmp( str1, str2, len );
     911}
     912
     913/*************************************************************************
     914 *      @       [SHLWAPI.152]
     915 *
     916 * Function:  Compare two WIDE strings for "len" bytes.
     917 * Returns:   *str1-*str2  (case sensitive)
    235918 */
    236919DWORD WINAPI SHLWAPI_152(LPWSTR str1, LPWSTR str2, INT len)
    237920{
    238   if (!len)
    239     return 0;
    240 
    241   while (--len && *str1 && *str1 == *str2)
    242   {
    243     str1++;
    244     str2++;
    245   }
    246   return *str1 - *str2;
    247 }
    248 
    249 /*************************************************************************
    250  *      SHLWAPI_153     [SHLWAPI.153]
    251  */
    252 #ifdef __WIN32OS2__
    253 //case insensitive string compare with length (ascii)
     921    return strncmpW( str1, str2, len );
     922}
     923
     924/*************************************************************************
     925 *      @       [SHLWAPI.153]
     926 * Function:  Compare two ASCII strings for "len" bytes via caseless compare.
     927 * Returns:   *str1-*str2  (case insensitive)
     928 */
    254929DWORD WINAPI SHLWAPI_153(LPSTR str1, LPSTR str2, DWORD len)
    255930{
    256   if (!len)
    257     return 0;
    258 
    259   return lstrncmpiA(str1, str2, len);
    260 }
    261 
    262 //case insensitive string compare with length (unicode)
     931    return strncasecmp( str1, str2, len );
     932}
     933
     934/*************************************************************************
     935 *      @       [SHLWAPI.154]
     936 *
     937 * Function:  Compare two WIDE strings for "len" bytes via caseless compare.
     938 * Returns:   *str1-*str2  (case insensitive)
     939 */
    263940DWORD WINAPI SHLWAPI_154(LPWSTR str1, LPWSTR str2, DWORD len)
    264941{
    265   if (!len)
    266     return 0;
    267 
    268   return lstrncmpiW(str1, str2, len);
    269 }
    270 
    271 #else
    272 DWORD WINAPI SHLWAPI_153(DWORD dw1, DWORD dw2, DWORD dw3)
    273 {
    274     FIXME("%08lx %08lx %08lx - stub\n", dw1, dw2, dw3);
    275     return 0;
    276 }
    277 #endif
    278 
    279 /*************************************************************************
    280  *      SHLWAPI_156     [SHLWAPI.156]
     942    return strncmpiW( str1, str2, len );
     943}
     944
     945/*************************************************************************
     946 *      @       [SHLWAPI.156]
    281947 *
    282948 *      Case sensitive string compare. Does not SetLastError().
     
    284950DWORD WINAPI SHLWAPI_156 ( LPWSTR str1, LPWSTR str2)
    285951{
    286   while (*str1 && (*str1 == *str2)) { str1++; str2++; }
    287   return (INT)(*str1 - *str2);
    288 }
    289 
    290 /*************************************************************************
    291  *      SHLWAPI_162     [SHLWAPI.162]
     952    return strcmpW( str1, str2 );
     953}
     954
     955/*************************************************************************
     956 *      @       [SHLWAPI.158]
     957 *
     958 *      Case insensitive string compare. Does not SetLastError(). ??
     959 */
     960DWORD WINAPI SHLWAPI_158 ( LPWSTR str1, LPWSTR str2)
     961{
     962    return strcmpiW( str1, str2 );
     963}
     964
     965/*************************************************************************
     966 *      @       [SHLWAPI.162]
    292967 *
    293968 * Ensure a multibyte character string doesn't end in a hanging lead byte.
     
    313988
    314989/*************************************************************************
    315  *      SHLWAPI_165     [SHLWAPI.165]
     990 *      @       [SHLWAPI.164]
     991 */
     992DWORD WINAPI SHLWAPI_164 (
     993        LPVOID u,
     994        LPVOID v,
     995        LPVOID w,
     996        LPVOID x,
     997        LPVOID y,
     998        LPVOID z)
     999{
     1000        TRACE("(%p %p %p %p %p %p) stub\n",u,v,w,x,y,z);
     1001        return 0x80004002;    /* E_NOINTERFACE */
     1002}
     1003
     1004/*************************************************************************
     1005 *      @       [SHLWAPI.165]
    3161006 *
    3171007 * SetWindowLongA with mask.
     
    3281018
    3291019/*************************************************************************
    330  *      SHLWAPI_169     [SHLWAPI.169]
    331  */
    332 DWORD WINAPI SHLWAPI_169 (IUnknown * lpUnknown)
    333 {
     1020 *      @       [SHLWAPI.169]
     1021 *
     1022 *  Do IUnknown::Release on passed object.
     1023 */
     1024DWORD WINAPI SHLWAPI_169 (IUnknown ** lpUnknown)
     1025{
     1026        IUnknown *temp;
     1027
    3341028        TRACE("(%p)\n",lpUnknown);
    335 #if 0
    3361029        if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0;
    337         return IUnknown_Release(lpUnknown);
    338 #endif
    339         return 0;
    340 }
    341 
    342 /*************************************************************************
    343  *      SHLWAPI_170     [SHLWAPI.170]
     1030        temp = *lpUnknown;
     1031        *lpUnknown = NULL;
     1032        TRACE("doing Release\n");
     1033        return IUnknown_Release(temp);
     1034}
     1035
     1036/*************************************************************************
     1037 *      @       [SHLWAPI.170]
    3441038 *
    3451039 * Skip URL '//' sequence.
     
    3531047
    3541048/*************************************************************************
    355  *      SHLWAPI_181     [SHLWAPI.181]
     1049 *      @       [SHLWAPI.172]
     1050 * Get window handle of OLE object
     1051 */
     1052DWORD WINAPI SHLWAPI_172 (
     1053        IUnknown *y,       /* [in]   OLE object interface */
     1054        LPHWND z)          /* [out]  location to put window handle */
     1055{
     1056        DWORD ret;
     1057        IUnknown *pv;
     1058
     1059        TRACE("(%p %p)\n",y,z);
     1060        if (!y) return E_FAIL;
     1061
     1062        if ((ret = IUnknown_QueryInterface(y, &IID_IOleWindow,(LPVOID *)&pv)) < 0) {
     1063            /* error */
     1064            return ret;
     1065        }
     1066        ret = IOleWindow_GetWindow((IOleWindow *)pv, z);
     1067        IUnknown_Release(pv);
     1068        TRACE("result hwnd=%08x\n", *z);
     1069        return ret;
     1070}
     1071
     1072/*************************************************************************
     1073 *      @       [SHLWAPI.174]
     1074 *
     1075 * Seems to do call either IObjectWithSite::SetSite or
     1076 *   IPersistMoniker::GetClassID.  But since we do not implement either
     1077 *   of those classes in our headers, we will fake it out.
     1078 */
     1079DWORD WINAPI SHLWAPI_174(
     1080        IUnknown *p1,     /* [in]   OLE object                          */
     1081        LPVOID *p2)       /* [out]  ptr to result of either GetClassID
     1082                                    or SetSite call.                    */
     1083{
     1084    DWORD ret, aa;
     1085
     1086    if (!p1) return E_FAIL;
     1087
     1088    /* see if SetSite interface exists for IObjectWithSite object */
     1089    ret = IUnknown_QueryInterface((IUnknown *)p1, (REFIID)id1, (LPVOID *)&p1);
     1090    TRACE("first IU_QI ret=%08lx, p1=%p\n", ret, p1);
     1091    if (ret) {
     1092
     1093        /* see if GetClassId interface exists for IPersistMoniker object */
     1094        ret = IUnknown_QueryInterface((IUnknown *)p1, (REFIID)id2, (LPVOID *)&aa);
     1095        TRACE("second IU_QI ret=%08lx, aa=%08lx\n", ret, aa);
     1096        if (ret) return ret;
     1097
     1098        /* fake a GetClassId call */
     1099        ret = IOleWindow_GetWindow((IOleWindow *)aa, (HWND*)p2);
     1100        TRACE("second IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret,
     1101              *(LPDWORD)p2);
     1102        IUnknown_Release((IUnknown *)aa);
     1103    }
     1104    else {
     1105        /* fake a SetSite call */
     1106        ret = IOleWindow_GetWindow((IOleWindow *)p1, (HWND*)p2);
     1107        TRACE("first IU_QI doing 0x0c ret=%08lx, *p2=%08lx\n", ret,
     1108              *(LPDWORD)p2);
     1109        IUnknown_Release((IUnknown *)p1);
     1110    }
     1111    return ret;
     1112}
     1113
     1114/*************************************************************************
     1115 *      @       [SHLWAPI.176]
     1116 *
     1117 * Function appears to be interface to IServiceProvider::QueryService
     1118 *
     1119 * NOTE:
     1120 *   returns E_NOINTERFACE
     1121 *           E_FAIL  if w == 0
     1122 *           S_OK    if _219 called successfully
     1123 */
     1124DWORD WINAPI SHLWAPI_176 (
     1125        IUnknown* unk,    /* [in]    object to give Service Provider */
     1126        REFGUID   sid,    /* [in]    Service ID                      */
     1127        REFIID    riid,   /* [in]    Function requested              */
     1128        LPVOID    *z)     /* [out]   place to save interface pointer */
     1129{
     1130    DWORD ret;
     1131    LPVOID aa;
     1132    *z = 0;
     1133    if (!unk) return E_FAIL;
     1134    ret = IUnknown_QueryInterface(unk, &IID_IServiceProvider, &aa);
     1135    TRACE("did IU_QI retval=%08lx, aa=%p\n", ret, aa);
     1136    if (ret) return ret;
     1137    ret = IServiceProvider_QueryService((IServiceProvider *)aa, sid, riid,
     1138                                        (void **)z);
     1139    TRACE("did ISP_QS retval=%08lx, *z=%p\n", ret, (LPVOID)*z);
     1140    IUnknown_Release((IUnknown*)aa);
     1141    return ret;
     1142}
     1143
     1144/*************************************************************************
     1145 *      @       [SHLWAPI.181]
    3561146 *
    3571147 *      Enable or disable a menu item.
     
    3631153
    3641154/*************************************************************************
    365  *      SHLWAPI_183     [SHLWAPI.183]
     1155 *      @       [SHLWAPI.183]
    3661156 *
    3671157 * Register a window class if it isn't already.
     
    3761166
    3771167/*************************************************************************
    378  *      SHLWAPI_193     [SHLWAPI.193]
     1168 *      @       [SHLWAPI.193]
    3791169 */
    3801170DWORD WINAPI SHLWAPI_193 ()
     
    3921182
    3931183/*************************************************************************
    394  *      SHLWAPI_215     [SHLWAPI.215]
     1184 *      @       [SHLWAPI.199]
     1185 *
     1186 * Copy interface pointer
     1187 */
     1188DWORD WINAPI SHLWAPI_199 (
     1189        IUnknown **dest,   /* [out] pointer to copy of interface ptr */
     1190        IUnknown *src)     /* [in]  interface pointer */
     1191{
     1192        TRACE("(%p %p)\n",dest,src);
     1193        if (*dest != src) {
     1194            if (*dest)
     1195                IUnknown_Release(*dest);
     1196            if (src) {
     1197                IUnknown_AddRef(src);
     1198                *dest = src;
     1199            }
     1200        }
     1201        return 4;
     1202}
     1203
     1204/*************************************************************************
     1205 *      @       [SHLWAPI.208]
     1206 *
     1207 * Some sort of memory management process - associated with _210
     1208 */
     1209DWORD WINAPI SHLWAPI_208 (
     1210        DWORD    a,
     1211        DWORD    b,
     1212        LPVOID   c,
     1213        LPVOID   d,
     1214        DWORD    e)
     1215{
     1216    FIXME("(0x%08lx 0x%08lx %p %p 0x%08lx) stub\n",
     1217          a, b, c, d, e);
     1218    return 1;
     1219}
     1220
     1221/*************************************************************************
     1222 *      @       [SHLWAPI.210]
     1223 *
     1224 * Some sort of memory management process - associated with _208
     1225 */
     1226DWORD WINAPI SHLWAPI_210 (
     1227        LPVOID   a,
     1228        DWORD    b,
     1229        LPVOID   c)
     1230{
     1231    FIXME("(%p 0x%08lx %p) stub\n",
     1232          a, b, c);
     1233    return 0;
     1234}
     1235
     1236/*************************************************************************
     1237 *      @       [SHLWAPI.211]
     1238 */
     1239DWORD WINAPI SHLWAPI_211 (
     1240        LPVOID   a,
     1241        DWORD    b)
     1242{
     1243    FIXME("(%p 0x%08lx) stub\n",
     1244          a, b);
     1245    return 1;
     1246}
     1247
     1248/*************************************************************************
     1249 *      @       [SHLWAPI.215]
    3951250 *
    3961251 * NOTES
    3971252 *  check me!
    3981253 */
    399 LPWSTR WINAPI SHLWAPI_215 (
    400         LPWSTR lpStrSrc,
    401         LPVOID lpwStrDest,
     1254DWORD WINAPI SHLWAPI_215 (
     1255        LPCSTR lpStrSrc,
     1256        LPWSTR lpwStrDest,
    4021257        int len)
    4031258{
    404         WARN("(%p %p %u)\n",lpStrSrc,lpwStrDest,len);
    405         return strncpyW(lpwStrDest, lpStrSrc, len);
    406 }
    407 
    408 /*************************************************************************
    409  *      SHLWAPI_218     [SHLWAPI.218]
     1259        INT len_a, ret;
     1260
     1261        len_a = lstrlenA(lpStrSrc);
     1262        ret = MultiByteToWideChar(0, 0, lpStrSrc, len_a, lpwStrDest, len);
     1263        TRACE("%s %s %d, ret=%d\n",
     1264              debugstr_a(lpStrSrc), debugstr_w(lpwStrDest), len, ret);
     1265        return ret;
     1266}
     1267
     1268/*************************************************************************
     1269 *      @       [SHLWAPI.218]
    4101270 *
    4111271 * WideCharToMultiByte with multi language support.
     
    4141274                       LPINT lpnMultiCharCount)
    4151275{
    416 #ifdef __WIN32OS2__
    4171276  static HRESULT (* WINAPI pfnFunc)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
    418 #else
    419   static HRESULT (* WINAPI pfnFunc)(LPDWORD,DWORD,LPCWSTR,LPINT,LPSTR,LPINT);
    420 #endif
    4211277  WCHAR emptyW[] = { '\0' };
    4221278  int len , reqLen;
     
    5011357
    5021358/*************************************************************************
    503  *      SHLWAPI_217     [SHLWAPI.217]
    504  *
    505  */
    506 INT WINAPI SHLWAPI_217(LPCWSTR lpSrcStr, LPSTR lpDstStr, LPINT lpnMultiCharCount)
    507 {
    508   return SHLWAPI_218(CP_ACP, lpSrcStr, lpDstStr, lpnMultiCharCount);
    509 }
    510 
    511 #ifndef __WIN32OS2__
    512 /*************************************************************************
    513  *      SHLWAPI_219     [SHLWAPI.219]
     1359 *      @       [SHLWAPI.217]
     1360 *
     1361 * Hmm, some program used lpnMultiCharCount == 0x3 (and lpSrcStr was "C")
     1362 * --> Crash. Something wrong here.
     1363 *
     1364 * It seems from OE v5 that the third param is the count. (GA 11/2001)
     1365 */
     1366INT WINAPI SHLWAPI_217(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT MultiCharCount)
     1367{
     1368    INT myint = MultiCharCount;
     1369
     1370    return SHLWAPI_218(CP_ACP, lpSrcStr, lpDstStr, &myint);
     1371}
     1372
     1373/*************************************************************************
     1374 *      @       [SHLWAPI.219]
     1375 *
     1376 * Seems to be "super" QueryInterface. Supplied with at table of interfaces
     1377 * and an array of IIDs and offsets into the table.
    5141378 *
    5151379 * NOTES
    5161380 *  error codes: E_POINTER, E_NOINTERFACE
    5171381 */
     1382typedef struct {
     1383    REFIID   refid;
     1384    DWORD    indx;
     1385} IFACE_INDEX_TBL;
     1386
    5181387HRESULT WINAPI SHLWAPI_219 (
    519         LPVOID w, /* [???] NOTE: returned by LocalAlloc, 0x450 bytes, iface */
    520         LPVOID x,
    521         REFIID riid,
    522         LPWSTR z) /* [???] NOTE: OUT: path */
    523 {
    524         FIXME("(%p %p %s %p)stub\n",w,x,debugstr_guid(riid),z);
    525         return 0xabba1252;
    526 }
    527 #endif
    528 
    529 /*************************************************************************
    530  *      SHLWAPI_222     [SHLWAPI.222]
     1388        LPVOID w,           /* [in]   table of interfaces                   */
     1389        IFACE_INDEX_TBL *x, /* [in]   array of REFIIDs and indexes to above */
     1390        REFIID riid,        /* [in]   REFIID to get interface for           */
     1391        LPVOID *z)          /* [out]  location to get interface pointer     */
     1392{
     1393        HRESULT ret;
     1394        IUnknown *a_vtbl;
     1395        IFACE_INDEX_TBL *xmove;
     1396
     1397        TRACE("(%p %p %s %p)\n",
     1398              w,x,debugstr_guid(riid),z);
     1399        if (z) {
     1400            xmove = x;
     1401            while (xmove->refid) {
     1402                TRACE("trying (indx %ld) %s\n", xmove->indx,
     1403                      debugstr_guid(xmove->refid));
     1404                if (IsEqualIID(riid, xmove->refid)) {
     1405                    a_vtbl = (IUnknown*)(xmove->indx + (LPBYTE)w);
     1406                    TRACE("matched, returning (%p)\n", a_vtbl);
     1407                    *z = (LPVOID)a_vtbl;
     1408                    IUnknown_AddRef(a_vtbl);
     1409                    return S_OK;
     1410                }
     1411                xmove++;
     1412            }
     1413
     1414            if (IsEqualIID(riid, &IID_IUnknown)) {
     1415                a_vtbl = (IUnknown*)(x->indx + (LPBYTE)w);
     1416                TRACE("returning first for IUnknown (%p)\n", a_vtbl);
     1417                *z = (LPVOID)a_vtbl;
     1418                IUnknown_AddRef(a_vtbl);
     1419                return S_OK;
     1420            }
     1421            *z = 0;
     1422            ret = E_NOINTERFACE;
     1423        } else
     1424            ret = E_POINTER;
     1425        return ret;
     1426}
     1427
     1428/*************************************************************************
     1429 *      @       [SHLWAPI.222]
    5311430 *
    5321431 * NOTES
     
    5461445
    5471446/*************************************************************************
    548  *      SHLWAPI_223     [SHLWAPI.223]
     1447 *      @       [SHLWAPI.223]
    5491448 *
    5501449 * NOTES
     
    5631462
    5641463/*************************************************************************
    565  *      SHLWAPI_237     [SHLWAPI.237]
     1464 *      @       [SHLWAPI.236]
     1465 */
     1466HMODULE WINAPI SHLWAPI_236 (REFIID lpUnknown)
     1467{
     1468    HKEY newkey;
     1469    DWORD type, count;
     1470    CHAR value[MAX_PATH], string[MAX_PATH];
     1471
     1472    strcpy(string, "CLSID\\");
     1473    strcat(string, debugstr_guid(lpUnknown));
     1474    strcat(string, "\\InProcServer32");
     1475
     1476    count = MAX_PATH;
     1477    RegOpenKeyExA(HKEY_CLASSES_ROOT, string, 0, 1, &newkey);
     1478    RegQueryValueExA(newkey, 0, 0, &type, value, &count);
     1479    RegCloseKey(newkey);
     1480    return LoadLibraryExA(value, 0, 0);
     1481}
     1482
     1483/*************************************************************************
     1484 *      @       [SHLWAPI.237]
    5661485 *
    5671486 * Unicode version of SHLWAPI_183.
     
    5791498
    5801499/*************************************************************************
    581  *      SHLWAPI_240     [SHLWAPI.240]
     1500 *      @       [SHLWAPI.239]
     1501 */
     1502DWORD WINAPI SHLWAPI_239(HINSTANCE hInstance, LPVOID p2, DWORD dw3)
     1503{
     1504    FIXME("(0x%08x %p 0x%08lx) stub\n",
     1505          hInstance, p2, dw3);
     1506    return 0;
     1507#if 0
     1508    /* pseudo code from relay trace */
     1509    WideCharToMultiByte(0, 0, L"Shell DocObject View", -1, &aa, 0x0207, 0, 0);
     1510    GetClassInfoA(70fe0000,405868ec "Shell DocObject View",40586b14);
     1511    /* above pair repeated for:
     1512           TridentThicketUrlDlClass
     1513           Shell Embedding
     1514           CIESplashScreen
     1515           Inet Notify_Hidden
     1516           OCHost
     1517    */
     1518#endif
     1519}
     1520
     1521/*************************************************************************
     1522 *      @       [SHLWAPI.240]
    5821523 *
    5831524 *      Calls ASCII or Unicode WindowProc for the given window.
     
    5891530        return DefWindowProcA(hWnd, uMessage, wParam, lParam);
    5901531}
    591 #ifndef __WIN32OS2__
    592 /*************************************************************************
    593  *      SHLWAPI_241     [SHLWAPI.241]
     1532
     1533/*************************************************************************
     1534 *      @       [SHLWAPI.241]
    5941535 *
    5951536 */
     
    5971538{
    5981539        FIXME("()stub\n");
    599         return 0xabba1243;
    600 }
    601 
    602 /*************************************************************************
    603  *      SHLWAPI_266     [SHLWAPI.266]
     1540        return /* 0xabba1243 */ 0;
     1541}
     1542
     1543/*************************************************************************
     1544 *      @       [SHLWAPI.266]
    6041545 */
    6051546DWORD WINAPI SHLWAPI_266 (
     
    6141555
    6151556/*************************************************************************
    616  *      SHLWAPI_267     [SHLWAPI.267]
     1557 *      @       [SHLWAPI.267]
    6171558 */
    6181559HRESULT WINAPI SHLWAPI_267 (
     
    6281569
    6291570/*************************************************************************
    630  *      SHLWAPI_268     [SHLWAPI.268]
     1571 *      @       [SHLWAPI.268]
    6311572 */
    6321573DWORD WINAPI SHLWAPI_268 (
     
    6391580
    6401581/*************************************************************************
    641  *      SHLWAPI_276     [SHLWAPI.276]
     1582 *      @       [SHLWAPI.276]
    6421583 *
    6431584 */
     
    6451586{
    6461587        FIXME("()stub\n");
    647         return 0xabba1244;
    648 }
    649 #endif
    650 /*************************************************************************
    651  *      SHLWAPI_278     [SHLWAPI.278]
    652  *
    653  */
    654 DWORD WINAPI SHLWAPI_278 (
     1588        return /* 0xabba1244 */ 0;
     1589}
     1590
     1591/*************************************************************************
     1592 *      @       [SHLWAPI.278]
     1593 *
     1594 */
     1595HWND WINAPI SHLWAPI_278 (
    6551596        LONG wndProc,
    6561597        HWND hWndParent,
     
    6651606        char * clsname = "WorkerA";
    6661607
    667         FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx)stub\n",
     1608        FIXME("(0x%08lx 0x%08x 0x%08lx 0x%08lx 0x%08x 0x%08lx) partial stub\n",
    6681609          wndProc,hWndParent,dwExStyle,dwStyle,hMenu,z);
    6691610
     
    6901631
    6911632/*************************************************************************
    692  *      SHLWAPI_289     [SHLWAPI.289]
     1633 *      @       [SHLWAPI.289]
    6931634 *
    6941635 * Late bound call to winmm.PlaySoundW
     
    7031644
    7041645/*************************************************************************
    705  *      SHLWAPI_313     [SHLWAPI.313]
     1646 *      @       [SHLWAPI.294]
     1647 */
     1648BOOL WINAPI SHLWAPI_294(LPSTR str1, LPSTR str2, LPSTR pStr, DWORD some_len,  LPCSTR lpStr2)
     1649{
     1650    /*
     1651     * str1:            "I"     "I"     pushl esp+0x20
     1652     * str2:            "U"     "I"     pushl 0x77c93810
     1653     * (is "I" and "U" "integer" and "unsigned" ??)
     1654     *
     1655     * pStr:            ""      ""      pushl eax
     1656     * some_len:        0x824   0x104   pushl 0x824
     1657     * lpStr2:          "%l"    "%l"    pushl esp+0xc
     1658     *
     1659     * shlwapi. StrCpyNW(lpStr2, irrelevant_var, 0x104);
     1660     * LocalAlloc(0x00, some_len) -> irrelevant_var
     1661     * LocalAlloc(0x40, irrelevant_len) -> pStr
     1662     * shlwapi.294(str1, str2, pStr, some_len, lpStr2);
     1663     * shlwapi.PathRemoveBlanksW(pStr);
     1664     */
     1665    ERR("('%s', '%s', '%s', %08lx, '%s'): stub!\n", str1, str2, pStr, some_len, lpStr2);
     1666    return TRUE;
     1667}
     1668
     1669/*************************************************************************
     1670 *      @       [SHLWAPI.313]
    7061671 *
    7071672 * Late bound call to shell32.SHGetFileInfoW
     
    7171682
    7181683/*************************************************************************
    719  *      SHLWAPI_318     [SHLWAPI.318]
     1684 *      @       [SHLWAPI.318]
    7201685 *
    7211686 * Late bound call to shell32.DragQueryFileW
     
    7301695
    7311696/*************************************************************************
    732  *      SHLWAPI_333     [SHLWAPI.333]
     1697 *      @       [SHLWAPI.333]
    7331698 *
    7341699 * Late bound call to shell32.SHBrowseForFolderW
     
    7431708
    7441709/*************************************************************************
    745  *      SHLWAPI_334     [SHLWAPI.334]
     1710 *      @       [SHLWAPI.334]
    7461711 *
    7471712 * Late bound call to shell32.SHGetPathFromIDListW
     
    7561721
    7571722/*************************************************************************
    758  *      SHLWAPI_335     [SHLWAPI.335]
     1723 *      @       [SHLWAPI.335]
    7591724 *
    7601725 * Late bound call to shell32.ShellExecuteExW
     
    7691734
    7701735/*************************************************************************
    771  *      SHLWAPI_336     [SHLWAPI.336]
     1736 *      @       [SHLWAPI.336]
    7721737 *
    7731738 * Late bound call to shell32.SHFileOperationW.
     
    7821747
    7831748/*************************************************************************
    784  *      SHLWAPI_337     [SHLWAPI.337]
     1749 *      @       [SHLWAPI.337]
    7851750 *
    7861751 * Late bound call to shell32.ExtractIconExW.
     
    7941759  return pfnFunc(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
    7951760}
    796 #ifndef __WIN32OS2__
    797 //Bugbug: is forwarder for InterlockedCompareExchange
    798 /*************************************************************************
    799  *      SHLWAPI_342     [SHLWAPI.342]
     1761
     1762/*************************************************************************
     1763 *      @       [SHLWAPI.342]
    8001764 *
    8011765 */
    8021766DWORD WINAPI SHLWAPI_342 (
    803         LPVOID w,
    804         LPVOID x,
    805         LPVOID y,
    806         LPVOID z)
    807 {
    808         FIXME("(%p %p %p %p)stub\n",w,x,y,z);
    809         return 0xabba1249;
    810 }
    811 #endif
    812 /*************************************************************************
    813  *      SHLWAPI_346     [SHLWAPI.346]
     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;
     1774}
     1775
     1776/*************************************************************************
     1777 *      @       [SHLWAPI.346]
    8141778 */
    8151779DWORD WINAPI SHLWAPI_346 (
     
    8241788
    8251789/*************************************************************************
    826  *      SHLWAPI_357     [SHLWAPI.357]
     1790 *      @       [SHLWAPI.356]
     1791 */
     1792DWORD 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}
     1800
     1801/*************************************************************************
     1802 *      @       [SHLWAPI.357]
    8271803 *
    8281804 * Late bound call to shell32.SHGetNewLinkInfoW
     
    8381814
    8391815/*************************************************************************
    840  *      SHLWAPI_358     [SHLWAPI.358]
     1816 *      @       [SHLWAPI.358]
    8411817 *
    8421818 * Late bound call to shell32.SHDefExtractIconW
     
    8531829
    8541830/*************************************************************************
    855  *      SHLWAPI_364     [SHLWAPI.364]
     1831 *      @       [SHLWAPI.364]
    8561832 *
    8571833 * Wrapper for lstrcpynA with src and dst swapped.
     
    8641840
    8651841/*************************************************************************
    866  *      SHLWAPI_370     [SHLWAPI.370]
     1842 *      @       [SHLWAPI.370]
    8671843 *
    8681844 * Late bound call to shell32.ExtractIconW
     
    8781854
    8791855/*************************************************************************
    880  *      SHLWAPI_376     [SHLWAPI.376]
    881  */
    882 DWORD WINAPI SHLWAPI_376 (LONG x)
    883 {
    884         FIXME("(0x%08lx)stub\n", x );
    885   /* FIXME: This should be a forward in the .spec file to the win2k function
    886    * kernel32.GetUserDefaultUILanguage, however that function isn't there yet.
    887    */
    888   return 0xabba1245;
    889 }
    890 #ifndef __WIN32OS2__
    891 /*************************************************************************
    892  *      SHLWAPI_377     [SHLWAPI.377]
    893  */
    894 DWORD WINAPI SHLWAPI_377 (LPVOID x, LPVOID y, LPVOID z)
    895 {
    896         FIXME("(%p %p %p)stub\n", x,y,z);
    897         return 0xabba1246;
    898 }
    899 #endif
    900 /*************************************************************************
    901  *      SHLWAPI_378     [SHLWAPI.378]
     1856 *      @       [SHLWAPI.376]
     1857 */
     1858LANGID WINAPI SHLWAPI_376 ()
     1859{
     1860    FIXME("() stub\n");
     1861    /* FIXME: This should be a forward in the .spec file to the win2k function
     1862     * kernel32.GetUserDefaultUILanguage, however that function isn't there yet.
     1863     */
     1864    return GetUserDefaultLangID();
     1865}
     1866
     1867/*************************************************************************
     1868 *      @       [SHLWAPI.377]
     1869 *
     1870 * FIXME: Native appears to do DPA_Create and a DPA_InsertPtr for
     1871 *        each call here.
     1872 * FIXME: Native shows calls to:
     1873 *  SHRegGetUSValue for "Software\Microsoft\Internet Explorer\International"
     1874 *                      CheckVersion
     1875 *  RegOpenKeyExA for "HKLM\Software\Microsoft\Internet Explorer"
     1876 *  RegQueryValueExA for "LPKInstalled"
     1877 *  RegCloseKey
     1878 *  RegOpenKeyExA for "HKCU\Software\Microsoft\Internet Explorer\International"
     1879 *  RegQueryValueExA for "ResourceLocale"
     1880 *  RegCloseKey
     1881 *  RegOpenKeyExA for "HKLM\Software\Microsoft\Active Setup\Installed Components\{guid}"
     1882 *  RegQueryValueExA for "Locale"
     1883 *  RegCloseKey
     1884 *  and then tests the Locale ("en" for me).
     1885 *     code below
     1886 *  after the code then a DPA_Create (first time) and DPA_InsertPtr are done.
     1887 */
     1888DWORD WINAPI SHLWAPI_377 (LPCSTR new_mod, HMODULE inst_hwnd, LPVOID z)
     1889{
     1890    CHAR mod_path[2*MAX_PATH];
     1891    LPSTR ptr;
     1892
     1893    GetModuleFileNameA(inst_hwnd, mod_path, 2*MAX_PATH);
     1894    ptr = strrchr(mod_path, '\\');
     1895    if (ptr) {
     1896        strcpy(ptr+1, new_mod);
     1897        TRACE("loading %s\n", debugstr_a(mod_path));
     1898        return (DWORD)LoadLibraryA(mod_path);
     1899    }
     1900    return 0;
     1901}
     1902
     1903/*************************************************************************
     1904 *      @       [SHLWAPI.378]
     1905 *
     1906 *  This is Unicode version of .377
    9021907 */
    9031908DWORD WINAPI SHLWAPI_378 (
    904         LPSTR x,
    905         LPVOID y, /* [???] 0x50000000 */
    906         LPVOID z) /* [???] 4 */
    907 {
    908         FIXME("(%s %p %p)stub\n", x,y,z);
    909         return LoadLibraryA(x);
    910 }
    911 
    912 /*************************************************************************
    913  *      SHLWAPI_389     [SHLWAPI.389]
     1909        LPCWSTR   new_mod,          /* [in] new module name        */
     1910        HMODULE   inst_hwnd,        /* [in] calling module handle  */
     1911        LPVOID z)                   /* [???] 4 */
     1912{
     1913    WCHAR mod_path[2*MAX_PATH];
     1914    LPWSTR ptr;
     1915
     1916    GetModuleFileNameW(inst_hwnd, mod_path, 2*MAX_PATH);
     1917    ptr = strrchrW(mod_path, '\\');
     1918    if (ptr) {
     1919        strcpyW(ptr+1, new_mod);
     1920        TRACE("loading %s\n", debugstr_w(mod_path));
     1921        return (DWORD)LoadLibraryW(mod_path);
     1922    }
     1923    return 0;
     1924}
     1925
     1926/*************************************************************************
     1927 *      @       [SHLWAPI.389]
    9141928 *
    9151929 * Late bound call to comdlg32.GetSaveFileNameW
     
    9241938
    9251939/*************************************************************************
    926  *      SHLWAPI_390     [SHLWAPI.390]
     1940 *      @       [SHLWAPI.390]
    9271941 *
    9281942 * Late bound call to mpr.WNetRestoreConnectionW
     
    9381952
    9391953/*************************************************************************
    940  *      SHLWAPI_391     [SHLWAPI.391]
     1954 *      @       [SHLWAPI.391]
    9411955 *
    9421956 * Late bound call to mpr.WNetGetLastErrorW
     
    9531967
    9541968/*************************************************************************
    955  *      SHLWAPI_401     [SHLWAPI.401]
     1969 *      @       [SHLWAPI.401]
    9561970 *
    9571971 * Late bound call to comdlg32.PageSetupDlgW
     
    9661980
    9671981/*************************************************************************
    968  *      SHLWAPI_402     [SHLWAPI.402]
     1982 *      @       [SHLWAPI.402]
    9691983 *
    9701984 * Late bound call to comdlg32.PrintDlgW
     
    9791993
    9801994/*************************************************************************
    981  *      SHLWAPI_403     [SHLWAPI.403]
     1995 *      @       [SHLWAPI.403]
    9821996 *
    9831997 * Late bound call to comdlg32.GetOpenFileNameW
     
    10442058
    10452059/*************************************************************************
    1046  *      SHLWAPI_431     [SHLWAPI.431]
     2060 *      @       [SHLWAPI.413]
     2061 *
     2062 * Function unknown seems to always to return 0
     2063 */
     2064DWORD WINAPI SHLWAPI_413 (DWORD x)
     2065{
     2066        FIXME("(0x%08lx)stub\n", x);
     2067        return 0;
     2068}
     2069
     2070/*************************************************************************
     2071 *      @       [SHLWAPI.431]
    10472072 */
    10482073DWORD WINAPI SHLWAPI_431 (DWORD x)
     
    10542079#ifndef __WIN32OS2__
    10552080/*************************************************************************
    1056  *      SHLWAPI_437     [SHLWAPI.437]
     2081 *      @       [SHLWAPI.437]
    10572082 *
    10582083 * NOTES
    1059  *  In the real shlwapi, One time initilisation calls GetVersionEx and reads
     2084 *  In the real shlwapi, One time initialisation calls GetVersionEx and reads
    10602085 *  the registry to determine what O/S & Service Pack level is running, and
    10612086 *  therefore which functions are available. Currently we always run as NT,
     
    10682093{
    10692094        FIXME("(0x%08lx)stub\n", functionToCall);
    1070         return 0xabba1247;
     2095        return /* 0xabba1247 */ 0;
    10712096}
    10722097#endif
     2098/*************************************************************************
     2099 *      ColorRGBToHLS   [SHLWAPI.445]
     2100 *
     2101 * Convert from RGB COLORREF into the HLS color space.
     2102 *
     2103 * NOTES
     2104 * Input HLS values are constrained to the range (0..240).
     2105 */
     2106VOID WINAPI ColorRGBToHLS(COLORREF drRGB, LPWORD pwHue,
     2107                          LPWORD wLuminance, LPWORD pwSaturation)
     2108{
     2109    FIXME("stub\n");
     2110    return;
     2111}
    10732112
    10742113/*************************************************************************
     
    10822121
    10832122/*************************************************************************
    1084  *      SHGetInverseCMAP
     2123 *      SHGetInverseCMAP (SHLWAPI.@)
    10852124 */
    10862125DWORD WINAPI SHGetInverseCMAP (LPVOID x, DWORD why)
     
    10892128        return 0;
    10902129}
     2130
    10912131#ifndef __WIN32OS2__
    10922132/*************************************************************************
     
    10992139}
    11002140#endif
    1101 
    11022141/*************************************************************************
    11032142 *      GetMenuPosFromID        [SHLWAPI.@]
     
    11192158
    11202159/*************************************************************************
    1121  *      _SHGetInstanceExplorer  [SHLWAPI.@]
     2160 *      _SHGetInstanceExplorer@4        [SHLWAPI.@]
    11222161 *
    11232162 * Late bound call to shell32.SHGetInstanceExplorer.
Note: See TracChangeset for help on using the changeset viewer.