Changeset 1360 for trunk/src


Ignore:
Timestamp:
Oct 19, 1999, 4:32:14 PM (26 years ago)
Author:
phaller
Message:

Fix: debug info

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/shell32_main.cpp

    r1252 r1360  
    1 /* $Id: shell32_main.cpp,v 1.3 1999-10-11 20:17:11 sandervl Exp $ */
     1/* $Id: shell32_main.cpp,v 1.4 1999-10-19 14:32:14 phaller Exp $ */
     2
    23/*
    3  *                              Shell basics
     4 * Win32 SHELL32 for OS/2
     5 *
     6 * Copyright 1999 Patrick Haller (haller@zebra.fh-weingarten.de)
     7 * Project Odin Software License can be found in LICENSE.TXT
     8 *
     9 *             Shell basics
    410 *
    511 *  1998 Marcus Meissner
    612 *  1998 Juergen Schmied (jsch)  *  <juergen.schmied@metronet.de>
    713 */
     14
     15/*****************************************************************************
     16 * Includes                                                                  *
     17 *****************************************************************************/
     18
     19#include <odin.h>
     20#include <odinwrap.h>
     21#include <os2sel.h>
     22
    823#include <stdlib.h>
    924#include <string.h>
    10 #include <odin.h>
    1125
    1226#define ICOM_CINTERFACE 1
     
    3650#include <misc.h>
    3751
    38 DECLARE_DEBUG_CHANNEL(exec)
    39 DECLARE_DEBUG_CHANNEL(shell)
     52
     53/*****************************************************************************
     54 * Local Variables                                                           *
     55 *****************************************************************************/
     56
     57ODINDEBUGCHANNEL(SHELL32-MAIN)
     58
    4059
    4160#define MORE_DEBUG 1
    42 /*************************************************************************
    43  * CommandLineToArgvW                   [SHELL32.7]
    44  */
    45 LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs)
    46 {       LPWSTR  *argv,s,t;
    47         int     i;
    48         TRACE_(shell)("\n");
    49 
    50         /* to get writeable copy */
    51         cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
    52         s=cmdline;i=0;
    53         while (*s)
    54         { /* space */
    55           if (*s==0x0020)
    56           { i++;
    57             s++;
    58             while (*s && *s==0x0020)
    59               s++;
    60             continue;
    61           }
    62           s++;
    63         }
    64         argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
    65         s=t=cmdline;
    66         i=0;
    67         while (*s)
    68         { if (*s==0x0020)
    69           { *s=0;
    70             argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
    71             *s=0x0020;
    72             while (*s && *s==0x0020)
    73               s++;
    74             if (*s)
    75               t=s+1;
    76             else
    77               t=s;
    78             continue;
    79           }
    80           s++;
    81         }
    82         if (*t)
    83           argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
    84 
    85         HeapFree( GetProcessHeap(), 0, cmdline );
    86         argv[i]=NULL;
    87         *numargs=i;
    88         return argv;
    89 }
    90 
    91 /*************************************************************************
    92  * Control_RunDLL                       [SHELL32.12]
     61
     62
     63/*************************************************************************
     64 * CommandLineToArgvW                          [SHELL32.7]
     65 */
     66
     67ODINFUNCTION2(LPWSTR*, CommandLineToArgvW, LPWSTR,  cmdline,
     68                                           LPDWORD, numargs)
     69{  LPWSTR  *argv,s,t;
     70   int   i;
     71
     72   /* to get writeable copy */
     73   cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
     74   s=cmdline;i=0;
     75   while (*s)
     76   { /* space */
     77     if (*s==0x0020)
     78     { i++;
     79       s++;
     80       while (*s && *s==0x0020)
     81         s++;
     82       continue;
     83     }
     84     s++;
     85   }
     86   argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
     87   s=t=cmdline;
     88   i=0;
     89   while (*s)
     90   { if (*s==0x0020)
     91     { *s=0;
     92       argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
     93       *s=0x0020;
     94       while (*s && *s==0x0020)
     95         s++;
     96       if (*s)
     97         t=s+1;
     98       else
     99         t=s;
     100       continue;
     101     }
     102     s++;
     103   }
     104   if (*t)
     105     argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
     106
     107   HeapFree( GetProcessHeap(), 0, cmdline );
     108   argv[i]=NULL;
     109   *numargs=i;
     110   return argv;
     111}
     112
     113/*************************************************************************
     114 * Control_RunDLL                           [SHELL32.12]
    93115 *
    94116 * Wild speculation in the following!
     
    97119 */
    98120
    99 void WINAPI Control_RunDLL( HWND hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 )
    100 {
    101     FIXME_(shell)("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd, code,
    102           debugstr_a(cmd), arg4);
    103 }
    104 
    105 /*************************************************************************
    106  * SHGetFileInfoA                       [SHELL32.254]
    107  */
    108 
    109 DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
    110                               SHFILEINFOA *psfi, UINT sizeofpsfi,
    111                               UINT flags )
    112 {
    113         char szLoaction[MAX_PATH];
    114         int iIndex;
    115         DWORD ret = TRUE, dwAttributes = 0;
    116         IShellFolder * psfParent = NULL;
    117         IExtractIcon * pei = NULL;
    118         LPITEMIDLIST    pidlLast, pidl = NULL;
    119         HRESULT hr = S_OK;
    120 
    121         TRACE_(shell)("(%s,0x%lx,%p,0x%x,0x%x)\n",
    122           (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, sizeofpsfi, flags);
     121ODINPROCEDURE4(Control_RunDLL,HWND,   hwnd,
     122                              LPCVOID,code,
     123                              LPCSTR, cmd,
     124                              DWORD,  arg4)
     125{
     126  dprintf(("SHELL32:Shell32_Main:Control_RunDLL not implemented.\n"));
     127}
     128
     129/*************************************************************************
     130 * SHGetFileInfoA                           [SHELL32.254]
     131 */
     132
     133ODINFUNCTION5(DWORD, SHGetFileInfoA, LPCSTR,       path,
     134                                     DWORD,        dwFileAttributes,
     135                                     SHFILEINFOA*, psfi,
     136                                     UINT,         sizeofpsfi,
     137                                     UINT,         flags )
     138{
     139   char szLoaction[MAX_PATH];
     140   int iIndex;
     141   DWORD ret = TRUE, dwAttributes = 0;
     142   IShellFolder * psfParent = NULL;
     143   IExtractIcon * pei = NULL;
     144   LPITEMIDLIST   pidlLast, pidl = NULL;
     145   HRESULT hr = S_OK;
     146
     147   dprintf(("SHELL32:Shell32_main:SHGetFileInfoA (%s,0x%lx,%p,0x%x,0x%x)\n",
     148     (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, sizeofpsfi, flags));
    123149
    124150#ifdef MORE_DEBUG
    125         ZeroMemory(psfi, sizeof(SHFILEINFOA));
     151   ZeroMemory(psfi, sizeof(SHFILEINFOA));
    126152#endif
    127         if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
    128           return FALSE;
    129        
    130         /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
    131            the pidl functions fail on not existing file names */
    132         if (flags & SHGFI_PIDL)
    133         {
    134           pidl = (LPCITEMIDLIST) path;
    135         }
    136         else if (!(flags & SHGFI_USEFILEATTRIBUTES))
    137         {
    138           hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
    139           /* note: the attributes in ISF::ParseDisplayName are not implemented */
    140         }
    141        
    142         /* get the parent shellfolder */
    143         if (pidl)
    144         {
    145           hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
    146         }
    147        
    148         /* get the attributes of the child */
    149         if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
    150         {
    151           if (!(flags & SHGFI_ATTR_SPECIFIED))
    152           {
    153             psfi->dwAttributes = 0xffffffff;
    154           }
    155           IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
    156         }
    157 
    158         /* get the displayname */
    159         if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
    160         {
    161           if (flags & SHGFI_USEFILEATTRIBUTES)
    162           {
    163             strcpy (psfi->szDisplayName, PathFindFilenameA(path));
    164           }
    165           else
    166           {
    167             STRRET str;
    168             hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
    169             StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
    170           }
    171         }
    172 
    173         /* get the type name */
    174         if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
    175         {
    176           if(_ILIsValue(pidlLast))
    177           {
    178             char sTemp[64];
    179             if (_ILGetExtension (pidlLast, sTemp, 64))
    180             {
    181               if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE)
    182                   && HCR_MapTypeToValue(sTemp, psfi->szTypeName, 80, FALSE )))
    183               {
    184                 lstrcpynA (psfi->szTypeName, sTemp, 74);
    185                 strcat (psfi->szTypeName, "-file");
    186               }
    187             }
    188           }
    189           else
    190           {
    191             strcpy(psfi->szTypeName, "Folder");
    192           }
    193         }
    194 
    195         /* ### icons ###*/
    196         if (flags & SHGFI_LINKOVERLAY)
    197           FIXME_(shell)("set icon to link, stub\n");
    198 
    199         if (flags & SHGFI_OPENICON)
    200           FIXME_(shell)("set to open icon, stub\n");
    201 
    202         if (flags & SHGFI_SELECTED)
    203           FIXME_(shell)("set icon to selected, stub\n");
    204 
    205         if (flags & SHGFI_SHELLICONSIZE)
    206           FIXME_(shell)("set icon to shell size, stub\n");
    207 
    208         /* get the iconlocation */
    209         if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
    210         {
    211           UINT uDummy,uFlags;
    212           hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
    213 
    214           if (SUCCEEDED(hr))
    215           {
    216             hr = IExtractIconA_GetIconLocation(pei, 0, szLoaction, MAX_PATH, &iIndex, &uFlags);
    217             /* fixme what to do with the index? */
    218 
    219             if(uFlags != GIL_NOTFILENAME)
    220               strcpy (psfi->szDisplayName, szLoaction);
    221             else
    222               ret = FALSE;
    223        
    224             IExtractIconA_Release(pei);
    225           }
    226         }
    227 
    228         /* get icon index (or load icon)*/
    229         if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
    230         {
    231           if (flags & SHGFI_USEFILEATTRIBUTES)
    232           {
    233             char sTemp [MAX_PATH];
    234             char * szExt;
    235             DWORD dwNr=0;
    236 
    237             lstrcpynA(sTemp, path, MAX_PATH);
    238             szExt = (LPSTR) PathFindExtensionA(sTemp);
    239             if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
     153   if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
     154     return FALSE;
     155
     156   /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
     157      the pidl functions fail on not existing file names */
     158   if (flags & SHGFI_PIDL)
     159   {
     160     pidl = (LPCITEMIDLIST) path;
     161   }
     162   else if (!(flags & SHGFI_USEFILEATTRIBUTES))
     163   {
     164     hr = SHILCreateFromPathA ( path, &pidl, &dwAttributes);
     165     /* note: the attributes in ISF::ParseDisplayName are not implemented */
     166   }
     167
     168   /* get the parent shellfolder */
     169   if (pidl)
     170   {
     171     hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidlLast);
     172   }
     173
     174   /* get the attributes of the child */
     175   if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES))
     176   {
     177     if (!(flags & SHGFI_ATTR_SPECIFIED))
     178     {
     179       psfi->dwAttributes = 0xffffffff;
     180     }
     181     IShellFolder_GetAttributesOf(psfParent, 1 , &pidlLast, &(psfi->dwAttributes));
     182   }
     183
     184   /* get the displayname */
     185   if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME))
     186   {
     187     if (flags & SHGFI_USEFILEATTRIBUTES)
     188     {
     189       strcpy (psfi->szDisplayName, PathFindFilenameA(path));
     190     }
     191     else
     192     {
     193       STRRET str;
     194       hr = IShellFolder_GetDisplayNameOf(psfParent, pidlLast, SHGDN_INFOLDER, &str);
     195       StrRetToStrNA (psfi->szDisplayName, MAX_PATH, &str, pidlLast);
     196     }
     197   }
     198
     199   /* get the type name */
     200   if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
     201   {
     202     if(_ILIsValue(pidlLast))
     203     {
     204       char sTemp[64];
     205       if (_ILGetExtension (pidlLast, sTemp, 64))
     206       {
     207         if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE)
     208             && HCR_MapTypeToValue(sTemp, psfi->szTypeName, 80, FALSE )))
     209         {
     210           lstrcpynA (psfi->szTypeName, sTemp, 74);
     211           strcat (psfi->szTypeName, "-file");
     212         }
     213       }
     214     }
     215     else
     216     {
     217       strcpy(psfi->szTypeName, "Folder");
     218     }
     219   }
     220
     221   /* ### icons ###*/
     222   if (flags & SHGFI_LINKOVERLAY)
     223   dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set icon to link, stub\n"));
     224
     225   if (flags & SHGFI_OPENICON)
     226   dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set to open icon, stub\n"));
     227
     228   if (flags & SHGFI_SELECTED)
     229   dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set icon to selected, stub\n"));
     230
     231   if (flags & SHGFI_SHELLICONSIZE)
     232   dprintf(("SHELL32:Shell32_main:SHGetFileInfoA set icon to shell size, stub\n"));
     233
     234   /* get the iconlocation */
     235   if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
     236   {
     237     UINT uDummy,uFlags;
     238     hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, &pidlLast, &IID_IExtractIconA, &uDummy, (LPVOID*)&pei);
     239
     240     if (SUCCEEDED(hr))
     241     {
     242       hr = IExtractIconA_GetIconLocation(pei, 0, szLoaction, MAX_PATH, &iIndex, &uFlags);
     243       /* fixme what to do with the index? */
     244
     245       if(uFlags != GIL_NOTFILENAME)
     246         strcpy (psfi->szDisplayName, szLoaction);
     247       else
     248         ret = FALSE;
     249
     250       IExtractIconA_Release(pei);
     251     }
     252   }
     253
     254   /* get icon index (or load icon)*/
     255   if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
     256   {
     257     if (flags & SHGFI_USEFILEATTRIBUTES)
     258     {
     259       char sTemp [MAX_PATH];
     260       char * szExt;
     261       DWORD dwNr=0;
     262
     263       lstrcpynA(sTemp, path, MAX_PATH);
     264       szExt = (LPSTR) PathFindExtensionA(sTemp);
     265       if( szExt && HCR_MapTypeToValue(szExt, sTemp, MAX_PATH, TRUE)
    240266              && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
    241267            {
     
    244270                strcpy(sTemp, path);
    245271              }
    246               /* FIXME: if sTemp contains a valid filename, get the icon
    247                  from there, index is in dwNr
    248               */
     272         /* FIXME: if sTemp contains a valid filename, get the icon
     273            from there, index is in dwNr
     274         */
    249275              psfi->iIcon = 2;
    250276            }
     
    253279              psfi->iIcon = 0;
    254280            }
    255           }
    256           else
    257           {
    258             if (!(PidlToSicIndex(psfParent, pidlLast, (flags && SHGFI_LARGEICON), (PUINT)&(psfi->iIcon))))
    259             {
    260               ret = FALSE;
    261             }
    262           }
    263           if (ret)
    264           {
    265             ret = (DWORD) ((flags && SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
    266           }
    267         }
    268 
    269         /* icon handle */
    270         if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
    271           psfi->hIcon = pImageList_GetIcon((flags && SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
    272 
    273 
    274         if (flags & SHGFI_EXETYPE)
    275           FIXME_(shell)("type of executable, stub\n");
    276 
    277         if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
    278           FIXME_(shell)("unknown attribute!\n");
    279 
    280         if (psfParent)
    281           IShellFolder_Release(psfParent);
    282 
    283         if (hr != S_OK)
    284           ret = FALSE;
     281     }
     282     else
     283     {
     284       if (!(PidlToSicIndex(psfParent, pidlLast, (flags && SHGFI_LARGEICON), (PUINT)&(psfi->iIcon))))
     285       {
     286         ret = FALSE;
     287       }
     288     }
     289     if (ret)
     290     {
     291       ret = (DWORD) ((flags && SHGFI_LARGEICON) ? ShellBigIconList : ShellSmallIconList);
     292     }
     293   }
     294
     295   /* icon handle */
     296   if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
     297     psfi->hIcon = pImageList_GetIcon((flags && SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
     298
     299
     300   if (flags & SHGFI_EXETYPE)
     301     dprintf(("SHELL32:Shell32_main:SHGetFileInfoA type of executable, stub\n"));
     302
     303   if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
     304     dprintf(("SHELL32:Shell32_main:SHGetFileInfoA unknown attribute!\n"));
     305
     306   if (psfParent)
     307     IShellFolder_Release(psfParent);
     308
     309   if (hr != S_OK)
     310     ret = FALSE;
    285311
    286312#ifdef MORE_DEBUG
    287         TRACE_(shell) ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s\n",
    288                 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName);
     313   TRACE_(shell) ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s\n",
     314      psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName);
    289315#endif
    290         return ret;
    291 }
    292 
    293 /*************************************************************************
    294  * SHGetFileInfoW                       [SHELL32.255]
    295  */
    296 
    297 DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
    298                               SHFILEINFOW *psfi, UINT sizeofpsfi,
    299                               UINT flags )
    300 {       FIXME_(shell)("(%s,0x%lx,%p,0x%x,0x%x)\n",
    301               debugstr_w(path),dwFileAttributes,psfi,sizeofpsfi,flags);
    302         return 0;
    303 }
    304 
    305 
    306 /*************************************************************************
    307  * ExtractIconA                         [SHELL32.133]
    308  */
    309 HICON WINAPI ExtractIconA( HINSTANCE hInstance, LPCSTR lpszExeFileName,
    310         UINT nIconIndex )
    311 {
     316   return ret;
     317}
     318
     319/*************************************************************************
     320 * SHGetFileInfoW                           [SHELL32.255]
     321 */
     322
     323ODINFUNCTION5(DWORD, SHGetFileInfoW, LPCWSTR,      path,
     324                                     DWORD,        dwFileAttributes,
     325                                     SHFILEINFOW*, psfi,
     326                                     UINT,         sizeofpsfi,
     327                                     UINT,        flags)
     328{
     329  dprintf(("SHELL32:Shell32_main:SHGetFileInfoW not implemented\n"));
     330  return 0;
     331}
     332
     333
     334/*************************************************************************
     335 * ExtractIconA                                [SHELL32.133]
     336 */
     337
     338ODINFUNCTION3(HICON, ExtractIconA, HINSTANCE, hInstance,
     339                                   LPCSTR,    lpszExeFileName,
     340                                   UINT,      nIconIndex )
     341{
     342  dprintf(("SHELL32:Shell32_Main:ExtractIconA not implemented.\n"));
     343
    312344#if 0
    313345//@@@PH
     
    316348    if( handle )
    317349    {
    318         HICON* ptr = (HICON*)GlobalLock(handle);
    319         HICON  hIcon = *ptr;
    320 
    321         GlobalFree(handle);
    322         return hIcon;
     350   HICON* ptr = (HICON*)GlobalLock(handle);
     351   HICON  hIcon = *ptr;
     352
     353   GlobalFree(handle);
     354   return hIcon;
    323355    }
    324356#endif
     
    327359
    328360/*************************************************************************
    329  * ExtractIconW                         [SHELL32.180]
    330  */
    331 HICON WINAPI ExtractIconW( HINSTANCE hInstance, LPCWSTR lpszExeFileName,
    332         UINT nIconIndex )
     361 * ExtractIconW                                [SHELL32.180]
     362 */
     363
     364ODINFUNCTION3(HICON, ExtractIconW, HINSTANCE, hInstance,
     365                                   LPCWSTR,   lpszExeFileName,
     366                                   UINT,      nIconIndex )
    333367{ LPSTR  exefn;
    334368  HICON  ret;
    335   TRACE_(shell)("\n");
    336369
    337370  exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
    338371  ret = ExtractIconA(hInstance,exefn,nIconIndex);
    339372
    340         HeapFree(GetProcessHeap(),0,exefn);
    341         return ret;
    342 }
    343 
    344 /*************************************************************************
    345  * FindExecutableA                      [SHELL32.184]
    346  */
    347 HINSTANCE WINAPI FindExecutableA( LPCSTR lpFile, LPCSTR lpDirectory,
    348                                       LPSTR lpResult )
     373  HeapFree(GetProcessHeap(),0,exefn);
     374  return ret;
     375}
     376
     377/*************************************************************************
     378 * FindExecutableA                             [SHELL32.184]
     379 */
     380
     381ODINFUNCTION3(HINSTANCE, FindExecutableA, LPCSTR, lpFile,
     382                                          LPCSTR, lpDirectory,
     383                                          LPSTR,  lpResult )
    349384{ HINSTANCE retval=31;    /* default - 'No association was found' */
    350385    char old_dir[1024];
    351386
    352   TRACE_(shell)("File %s, Dir %s\n",
    353                 (lpFile != NULL?lpFile:"-"),
    354                  (lpDirectory != NULL?lpDirectory:"-"));
     387  dprintf(("File %s, Dir %s\n",
     388      (lpFile != NULL?lpFile:"-"),
     389       (lpDirectory != NULL?lpDirectory:"-")));
    355390
    356391    lpResult[0]='\0'; /* Start off with an empty return string */
     
    359394    if (( lpFile == NULL ) || ( lpResult == NULL ))
    360395  { /* FIXME - should throw a warning, perhaps! */
    361         return 2; /* File not found. Close enough, I guess. */
     396   return 2; /* File not found. Close enough, I guess. */
    362397    }
    363398
     
    369404    retval = SHELL_FindExecutable( lpFile, "open", lpResult );
    370405
    371   TRACE_(shell)("returning %s\n", lpResult);
     406  dprintf(("returning %s\n", lpResult));
    372407  if (lpDirectory)
    373408    SetCurrentDirectoryA( old_dir );
     
    376411
    377412/*************************************************************************
    378  * FindExecutableW                      [SHELL32.219]
    379  */
    380 HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory,
    381                                      LPWSTR lpResult)
    382 {
    383   FIXME_(shell)("(%p,%p,%p): stub\n", lpFile, lpDirectory, lpResult);
     413 * FindExecutableW                             [SHELL32.219]
     414 */
     415ODINFUNCTION3(HINSTANCE, FindExecutableW, LPCWSTR, lpFile,
     416                                          LPCWSTR, lpDirectory,
     417                                          LPWSTR,  lpResult )
     418{
     419  dprintf(("FindExecutableW not implemented.\n"));
    384420  return 31;    /* default - 'No association was found' */
    385421}
     
    391427} ABOUT_INFO;
    392428
    393 #define         IDC_STATIC_TEXT         100
    394 #define         IDC_LISTBOX             99
    395 #define         IDC_WINE_TEXT           98
    396 
    397 #define         DROP_FIELD_TOP          (-15)
    398 #define         DROP_FIELD_HEIGHT       15
     429#define     IDC_STATIC_TEXT                 100
     430#define     IDC_LISTBOX                     99
     431#define     IDC_WINE_TEXT                   98
     432
     433#define     DROP_FIELD_TOP                  (-15)
     434#define     DROP_FIELD_HEIGHT            15
    399435
    400436static BOOL __get_dropline( HWND hWnd, LPRECT lprect )
     
    402438    if( hWndCtl )
    403439  { GetWindowRect( hWndCtl, lprect );
    404         MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
    405         lprect->bottom = (lprect->top += DROP_FIELD_TOP);
    406         return TRUE;
     440   MapWindowPoints( 0, hWnd, (LPPOINT)lprect, 2 );
     441   lprect->bottom = (lprect->top += DROP_FIELD_TOP);
     442   return TRUE;
    407443    }
    408444    return FALSE;
     
    410446
    411447/*************************************************************************
    412  * SHAppBarMessage32                    [SHELL32.207]
    413  */
    414 UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
    415 {
    416         FIXME_(shell)("(0x%08lx,%p hwnd=0x%08x): stub\n", msg, data, data->hWnd);
    417 
    418         switch (msg)
    419         { case ABM_GETSTATE:
    420                 return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
    421           case ABM_GETTASKBARPOS:
    422                 /* fake a taskbar on the bottom of the desktop */
    423                 { RECT rec;
    424                   GetWindowRect(GetDesktopWindow(), &rec);
    425                   rec.left = 0;
    426                   rec.top = rec.bottom - 2;
    427                 }
    428                 return TRUE;
    429           case ABM_ACTIVATE:
    430           case ABM_GETAUTOHIDEBAR:
    431           case ABM_NEW:
    432           case ABM_QUERYPOS:
    433           case ABM_REMOVE:
    434           case ABM_SETAUTOHIDEBAR:
    435           case ABM_SETPOS:
    436           case ABM_WINDOWPOSCHANGED:
    437                 return FALSE;
    438         }
    439         return 0;
    440 }
    441 
    442 /*************************************************************************
    443  * SHHelpShortcuts_RunDLL               [SHELL32.224]
    444  *
    445  */
    446 DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
    447 { FIXME_(exec)("(%lx, %lx, %lx, %lx) empty stub!\n",
    448         dwArg1, dwArg2, dwArg3, dwArg4);
    449 
     448 * SHAppBarMessage32                           [SHELL32.207]
     449 */
     450
     451ODINFUNCTION2(UINT, SHAppBarMessage, DWORD,       msg,
     452                                     PAPPBARDATA, data)
     453{
     454  dprintf(("SHELL32:Shell32_Main:SHAppBarMessage not implemented.\n"));
     455
     456   switch (msg)
     457   { case ABM_GETSTATE:
     458      return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
     459     case ABM_GETTASKBARPOS:
     460      /* fake a taskbar on the bottom of the desktop */
     461      { RECT rec;
     462        GetWindowRect(GetDesktopWindow(), &rec);
     463        rec.left = 0;
     464        rec.top = rec.bottom - 2;
     465      }
     466      return TRUE;
     467     case ABM_ACTIVATE:
     468     case ABM_GETAUTOHIDEBAR:
     469     case ABM_NEW:
     470     case ABM_QUERYPOS:
     471     case ABM_REMOVE:
     472     case ABM_SETAUTOHIDEBAR:
     473     case ABM_SETPOS:
     474     case ABM_WINDOWPOSCHANGED:
     475      return FALSE;
     476   }
     477   return 0;
     478}
     479
     480/*************************************************************************
     481 * SHHelpShortcuts_RunDLL                   [SHELL32.224]
     482 *
     483 */
     484
     485ODINFUNCTION4(DWORD, SHHelpShortcuts_RunDLL, DWORD, dwArg1,
     486                                             DWORD, dwArg2,
     487                                             DWORD, dwArg3,
     488                                             DWORD, dwArg4)
     489{
     490  dprintf(("SHELL32:Shell32_Main:SHHelpShortcuts_RunDLL not implemented.\n"));
    450491  return 0;
    451492}
    452493
    453494/*************************************************************************
    454  * SHLoadInProc                         [SHELL32.225]
    455  *
    456  */
    457 
    458 DWORD WINAPI SHLoadInProc (DWORD dwArg1)
    459 { FIXME_(shell)("(%lx) empty stub!\n", dwArg1);
    460     return 0;
    461 }
    462 
    463 
    464 
    465 /*************************************************************************
    466  * ShellExecuteA                        [SHELL32.245]
    467  */
    468 
    469 HINSTANCE WINAPI ShellExecuteA( HWND hWnd, LPCSTR lpOperation,
    470                                     LPCSTR lpFile, LPCSTR lpParameters,
    471                                     LPCSTR lpDirectory, INT iShowCmd )
     495 * SHLoadInProc                                [SHELL32.225]
     496 *
     497 */
     498
     499ODINFUNCTION1(DWORD, SHLoadInProc, DWORD, dwArg1)
     500{
     501  dprintf(("SHELL32:Shell32_Main:SHLoadInProc not implemented.\n"));
     502  return 0;
     503}
     504
     505
     506
     507/*************************************************************************
     508 * ShellExecuteA                            [SHELL32.245]
     509 */
     510
     511ODINFUNCTION6(HINSTANCE, ShellExecuteA, HWND,   hWnd,
     512                                        LPCSTR, lpOperation,
     513                                        LPCSTR, lpFile,
     514                                        LPCSTR, lpParameters,
     515                                        LPCSTR, lpDirectory,
     516                                        INT,    iShowCmd )
    472517{   HINSTANCE retval=31;
    473518    char old_dir[1024];
    474519    char cmd[256];
    475 
    476     TRACE_(shell)("(%04x,'%s','%s','%s','%s',%x)\n",
    477                 hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>",
    478                 lpParameters ? lpParameters : "<null>",
    479                 lpDirectory ? lpDirectory : "<null>", iShowCmd);
    480520
    481521    if (lpFile==NULL) return 0; /* should not happen */
     
    498538        }
    499539
    500         TRACE_(shell)("starting %s\n",cmd);
     540        dprintf(("starting %s\n",cmd));
    501541        retval = WinExec( cmd, iShowCmd );
    502542    }
     
    508548
    509549/*************************************************************************
    510  * ShellExecuteW                        [SHELL32.294]
     550 * ShellExecuteW                            [SHELL32.294]
    511551 * from shellapi.h
    512552 * WINSHELLAPI HINSTANCE APIENTRY ShellExecuteW(HWND hwnd, LPCWSTR lpOperation,
    513553 * LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd);
    514554 */
    515 HINSTANCE WINAPI
    516 ShellExecuteW(
    517        HWND hwnd,
    518        LPCWSTR lpOperation,
    519        LPCWSTR lpFile,
    520        LPCWSTR lpParameters,
    521        LPCWSTR lpDirectory,
    522        INT nShowCmd) {
    523 
    524        FIXME_(shell)(": stub\n");
    525        return 0;
    526 }
    527 
    528 /*************************************************************************
    529  * AboutDlgProc32                       (internal)
     555
     556ODINFUNCTION6(HINSTANCE, ShellExecuteW, HWND,    hWnd,
     557                                        LPCWSTR, lpOperation,
     558                                        LPCWSTR, lpFile,
     559                                        LPCWSTR, lpParameters,
     560                                        LPCWSTR, lpDirectory,
     561                                        INT,     iShowCmd )
     562{
     563  dprintf(("SHELL32:Shell32_Main:ShellExecuteW not implemented\n"));
     564  return 0;
     565}
     566
     567
     568/*************************************************************************
     569 * AboutDlgProc32                           (internal)
    530570 */
    531571
     
    561601    case WM_PAINT:
    562602      { RECT rect;
    563             PAINTSTRUCT ps;
    564             HDC hDC = BeginPaint( hWnd, &ps );
    565 
    566             if( __get_dropline( hWnd, &rect ) ) {
    567                 SelectObject( hDC, GetStockObject( BLACK_PEN ) );
    568                 MoveToEx( hDC, rect.left, rect.top, NULL );
    569                 LineTo( hDC, rect.right, rect.bottom );
    570             }
    571             EndPaint( hWnd, &ps );
    572         }
    573         break;
     603       PAINTSTRUCT ps;
     604       HDC hDC = BeginPaint( hWnd, &ps );
     605
     606       if( __get_dropline( hWnd, &rect ) ) {
     607           SelectObject( hDC, GetStockObject( BLACK_PEN ) );
     608           MoveToEx( hDC, rect.left, rect.top, NULL );
     609      LineTo( hDC, rect.right, rect.bottom );
     610       }
     611       EndPaint( hWnd, &ps );
     612   }
     613   break;
    574614
    575615#if 0
    576616// @@@PH turned off
    577617    case WM_LBTRACKPOINT:
    578         hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
    579         if( (INT)GetKeyState( VK_CONTROL ) < 0 )
     618   hWndCtl = GetDlgItem(hWnd, IDC_LISTBOX);
     619   if( (INT)GetKeyState( VK_CONTROL ) < 0 )
    580620      { if( DragDetect( hWndCtl, *((LPPOINT)&lParam) ) )
    581621        { INT idx = SendMessageA( hWndCtl, LB_GETCURSEL, 0, 0 );
    582                 if( idx != -1 )
     622      if( idx != -1 )
    583623          { INT length = SendMessageA( hWndCtl, LB_GETTEXTLEN, (WPARAM)idx, 0 );
    584                     HGLOBAL hMemObj = GlobalAlloc( GMEM_MOVEABLE, length + 1 );
    585                     char* pstr = (char*)GlobalLock( hMemObj );
    586 
    587                     if( pstr )
     624          HGLOBAL hMemObj = GlobalAlloc( GMEM_MOVEABLE, length + 1 );
     625          char* pstr = (char*)GlobalLock( hMemObj );
     626
     627          if( pstr )
    588628            { HCURSOR hCursor = LoadCursorA( 0, (LPCSTR)OCR_DRAGOBJECT );
    589                         SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
    590                         SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
    591                         UpdateWindow( hWndCtl );
     629         SendMessageA( hWndCtl, LB_GETTEXT, (WPARAM)idx, (LPARAM)pstr );
     630         SendMessageA( hWndCtl, LB_DELETESTRING, (WPARAM)idx, 0 );
     631         UpdateWindow( hWndCtl );
    592632   //@@@PH DragObject16 experimentally replaced by DragObject
    593                         if( !DragObject(hWnd, hWnd, DRAGOBJ_DATA, hMemObj, hCursor) )
    594                             SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
    595                     }
     633         if( !DragObject(hWnd, hWnd, DRAGOBJ_DATA, hMemObj, hCursor) )
     634             SendMessageA( hWndCtl, LB_ADDSTRING, (WPARAM)-1, (LPARAM)pstr );
     635          }
    596636            if( hMemObj )
    597637              GlobalFree( hMemObj );
    598                 }
    599             }
    600         }
    601         break;
     638      }
     639       }
     640   }
     641   break;
    602642
    603643    case WM_QUERYDROPOBJECT:
    604         if( wParam == 0 )
     644   if( wParam == 0 )
    605645      { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
    606             if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
     646       if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
    607647        { RECT rect;
    608                 if( __get_dropline( hWnd, &rect ) )
     648      if( __get_dropline( hWnd, &rect ) )
    609649          { POINT pt;
    610             pt.x=lpDragInfo->pt.x;
    611             pt.x=lpDragInfo->pt.y;
    612                     rect.bottom += DROP_FIELD_HEIGHT;
    613                     if( PtInRect( &rect, pt ) )
     650       pt.x=lpDragInfo->pt.x;
     651       pt.x=lpDragInfo->pt.y;
     652          rect.bottom += DROP_FIELD_HEIGHT;
     653          if( PtInRect( &rect, pt ) )
    614654            { SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
    615                         return TRUE;
    616                     }
    617                 }
    618             }
    619         }
    620         break;
     655         return TRUE;
     656          }
     657      }
     658       }
     659   }
     660   break;
    621661
    622662    case WM_DROPOBJECT:
    623         if( wParam == hWnd )
     663   if( wParam == hWnd )
    624664      { LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
    625             if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
     665       if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
    626666        { char* pstr = (char*)GlobalLock( (HGLOBAL)(lpDragInfo->hList) );
    627                 if( pstr )
     667      if( pstr )
    628668          { static char __appendix_str[] = " with";
    629669
    630                     hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
    631                     SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
    632                     if( !strncmp( Template, "WINE", 4 ) )
    633                         SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
    634                     else
     670          hWndCtl = GetDlgItem( hWnd, IDC_WINE_TEXT );
     671          SendMessageA( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
     672          if( !strncmp( Template, "WINE", 4 ) )
     673         SetWindowTextA( GetDlgItem(hWnd, IDC_STATIC_TEXT), Template );
     674          else
    635675          { char* pch = Template + strlen(Template) - strlen(__appendix_str);
    636                         *pch = '\0';
    637                         SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
    638                                         (WPARAM)-1, (LPARAM)Template );
    639                     }
    640 
    641                     strcpy( Template, pstr );
    642                     strcat( Template, __appendix_str );
    643                     SetWindowTextA( hWndCtl, Template );
    644                     SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
    645                     return TRUE;
    646                 }
    647             }
    648         }
    649         break;
     676         *pch = '\0';
     677         SendMessageA( GetDlgItem(hWnd, IDC_LISTBOX), LB_ADDSTRING,
     678               (WPARAM)-1, (LPARAM)Template );
     679          }
     680
     681          strcpy( Template, pstr );
     682          strcat( Template, __appendix_str );
     683          SetWindowTextA( hWndCtl, Template );
     684          SetWindowLongA( hWnd, DWL_MSGRESULT, 1 );
     685          return TRUE;
     686      }
     687       }
     688   }
     689   break;
    650690#endif
    651691
     
    666706
    667707/*************************************************************************
    668  * ShellAboutA                          [SHELL32.243]
    669  */
    670 INT WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
    671                              HICON hIcon )
     708 * ShellAboutA                              [SHELL32.243]
     709 */
     710
     711ODINFUNCTION4(INT,ShellAboutA, HWND,   hWnd,
     712                               LPCSTR, szApp,
     713                               LPCSTR, szOtherStuff,
     714                               HICON,  hIcon )
    672715{   ABOUT_INFO info;
    673716    HRSRC hRes;
    674717    LPVOID dlgTemplate;
    675 
    676     TRACE_(shell)("\n");
    677718
    678719    if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
     
    691732
    692733/*************************************************************************
    693  * ShellAboutW                          [SHELL32.244]
    694  */
    695 INT WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
    696                              HICON hIcon )
     734 * ShellAboutW                              [SHELL32.244]
     735 */
     736ODINFUNCTION4(INT,ShellAboutW, HWND,    hWnd,
     737                               LPCWSTR, szApp,
     738                               LPCWSTR, szOtherStuff,
     739                               HICON,   hIcon )
    697740{   INT ret;
    698741    ABOUT_INFO info;
    699742    HRSRC hRes;
    700743    LPVOID dlgTemplate;
    701 
    702     TRACE_(shell)("\n");
    703744
    704745    if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_ABOUT_MSGBOX", RT_DIALOGA)))
     
    719760
    720761/*************************************************************************
    721  * Shell_NotifyIcon                     [SHELL32.297]
    722  *      FIXME
    723  *      This function is supposed to deal with the systray.
    724  *      Any ideas on how this is to be implimented?
    725  */
    726 BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid )
    727 {   TRACE_(shell)("\n");
    728     return FALSE;
    729 }
    730 
    731 /*************************************************************************
    732  * Shell_NotifyIcon                     [SHELL32.?]
    733  *      FIXME
    734  *      This function is supposed to deal with the systray.
    735  *      Any ideas on how this is to be implimented?
    736  */
    737 BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW pnid )
    738 {   TRACE_(shell)("\n");
    739     return FALSE;
    740 }
    741 
    742 
    743 /*************************************************************************
    744  * Shell_NotifyIcon                     [SHELL32.296]
    745  *      FIXME
    746  *      This function is supposed to deal with the systray.
    747  *      Any ideas on how this is to be implimented?
    748  */
    749 BOOL WINAPI Shell_NotifyIcon(   DWORD dwMessage, PNOTIFYICONDATAA pnid )
    750 {   TRACE_(shell)("\n");
     762 * Shell_NotifyIcon                            [SHELL32.297]
     763 * FIXME
     764 * This function is supposed to deal with the systray.
     765 * Any ideas on how this is to be implimented?
     766 */
     767
     768ODINFUNCTION2(BOOL, Shell_NotifyIconA, DWORD,            dwMessage,
     769                                       PNOTIFYICONDATAA, pnid )
     770{
     771  dprintf(("SHELL32:Shell32_Main:Shell_NotifyIconA not implemented\n"));
     772  return FALSE;
     773}
     774
     775/*************************************************************************
     776 * Shell_NotifyIcon                            [SHELL32.?]
     777 * FIXME
     778 * This function is supposed to deal with the systray.
     779 * Any ideas on how this is to be implimented?
     780 */
     781
     782ODINFUNCTION2(BOOL, Shell_NotifyIconW, DWORD,            dwMessage,
     783                                       PNOTIFYICONDATAW, pnid )
     784{
     785  dprintf(("SHELL32:Shell32_Main:Shell_NotifyIconA not implemented\n"));
     786  return FALSE;
     787}
     788
     789
     790/*************************************************************************
     791 * Shell_NotifyIcon                            [SHELL32.296]
     792 * FIXME
     793 * This function is supposed to deal with the systray.
     794 * Any ideas on how this is to be implimented?
     795 */
     796
     797BOOL WINAPI Shell_NotifyIcon(DWORD dwMessage, PNOTIFYICONDATAA pnid )
     798{
    751799  if (VERSION_OsIsUnicode())
    752800    return(Shell_NotifyIconW(dwMessage,(PNOTIFYICONDATAW)pnid));
     
    758806 * FreeIconList
    759807 */
    760 void WINAPI FreeIconList( DWORD dw )
    761 { FIXME_(shell)("(%lx): stub\n",dw);
     808
     809ODINPROCEDURE1(FreeIconList,DWORD,dw)
     810{
     811  dprintf(("SHELL32:Shell32_Main:FreeIconList not implemented.\n"));
    762812}
    763813
     
    778828 */
    779829
    780 HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
    781 {
    782         if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
    783         { WARN_(shell)("wrong DLLVERSIONINFO size from app");
    784           return E_INVALIDARG;
    785         }
    786 
    787         pdvi->dwMajorVersion = 4;
    788         pdvi->dwMinorVersion = 72;
    789         pdvi->dwBuildNumber = 3110;
    790         pdvi->dwPlatformID = 1;
    791 
    792         TRACE_(shell)("%lu.%lu.%lu.%lu\n",
    793            pdvi->dwMajorVersion, pdvi->dwMinorVersion,
    794            pdvi->dwBuildNumber, pdvi->dwPlatformID);
    795 
    796         return S_OK;
     830ODINFUNCTION1(HRESULT, SHELL32_DllGetVersion, DLLVERSIONINFO*, pdvi)
     831{
     832   if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
     833   { dprintf(("wrong DLLVERSIONINFO size from app\n"));
     834     return E_INVALIDARG;
     835   }
     836
     837   pdvi->dwMajorVersion = 4;
     838   pdvi->dwMinorVersion = 72;
     839   pdvi->dwBuildNumber = 3110;
     840   pdvi->dwPlatformID = 1;
     841
     842   dprintf(("%lu.%lu.%lu.%lu\n",
     843      pdvi->dwMajorVersion, pdvi->dwMinorVersion,
     844      pdvi->dwBuildNumber, pdvi->dwPlatformID));
     845
     846   return S_OK;
    797847}
    798848/*************************************************************************
     
    801851 *
    802852 */
    803 void    (WINAPI* pDLLInitComctl)(LPVOID);
    804 INT     (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
    805 INT     (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
     853void  (WINAPI* pDLLInitComctl)(LPVOID);
     854INT   (WINAPI* pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
     855INT   (WINAPI* pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
    806856HIMAGELIST (WINAPI * pImageList_Create) (INT,INT,UINT,INT,INT);
    807 BOOL    (WINAPI* pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
    808 HICON   (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT, UINT);
    809 INT     (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
     857BOOL  (WINAPI* pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
     858HICON (WINAPI * pImageList_GetIcon) (HIMAGELIST, INT, UINT);
     859INT   (WINAPI* pImageList_GetImageCount)(HIMAGELIST);
    810860COLORREF (WINAPI *pImageList_SetBkColor)(HIMAGELIST, COLORREF);
    811861
    812 LPVOID  (WINAPI* pCOMCTL32_Alloc) (INT);
    813 BOOL    (WINAPI* pCOMCTL32_Free) (LPVOID);
    814 
    815 HDPA    (WINAPI* pDPA_Create) (INT);
    816 INT     (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
    817 BOOL    (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
    818 LPVOID  (WINAPI* pDPA_GetPtr) (const HDPA, INT);
    819 BOOL    (WINAPI* pDPA_Destroy) (const HDPA);
    820 INT     (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
    821 LPVOID  (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
     862LPVOID   (WINAPI* pCOMCTL32_Alloc) (INT);
     863BOOL  (WINAPI* pCOMCTL32_Free) (LPVOID);
     864
     865HDPA  (WINAPI* pDPA_Create) (INT);
     866INT   (WINAPI* pDPA_InsertPtr) (const HDPA, INT, LPVOID);
     867BOOL  (WINAPI* pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
     868LPVOID   (WINAPI* pDPA_GetPtr) (const HDPA, INT);
     869BOOL  (WINAPI* pDPA_Destroy) (const HDPA);
     870INT   (WINAPI *pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
     871LPVOID   (WINAPI *pDPA_DeletePtr) (const HDPA hdpa, INT i);
    822872
    823873/* user32 */
     
    832882HRESULT (WINAPI* pRevokeDragDrop)(HWND hwnd);
    833883
    834 static HINSTANCE        hComctl32;
    835 static HINSTANCE        hOle32;
    836 static INT              shell32_RefCount = 0;
    837 
    838 INT             shell32_ObjCount = 0;
    839 HINSTANCE       shell32_hInstance = 0;
    840 HIMAGELIST      ShellSmallIconList = 0;
    841 HIMAGELIST      ShellBigIconList = 0;
     884static HINSTANCE  hComctl32;
     885static HINSTANCE  hOle32;
     886static INT     shell32_RefCount = 0;
     887
     888INT      shell32_ObjCount = 0;
     889HINSTANCE   shell32_hInstance = 0;
     890HIMAGELIST  ShellSmallIconList = 0;
     891HIMAGELIST  ShellBigIconList = 0;
    842892
    843893/*************************************************************************
     
    853903{
    854904  *pAddr = (void*)GetProcAddress(hModule,lpstrName);
    855 }
    856 
    857 
    858 BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
    859 {
    860         HMODULE hUser32;
    861 
    862         TRACE_(shell)("0x%x 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
    863 
    864         switch (fdwReason)
    865         {
    866           case DLL_PROCESS_ATTACH:
    867             shell32_RefCount++;
    868             if (shell32_hInstance)
    869             {
    870               ERR_(shell)("shell32.dll instantiated twice in one address space!\n");
    871             }
    872 
    873             shell32_hInstance = hinstDLL;
    874 
    875             hComctl32 = LoadLibraryA("COMCTL32.DLL");   
    876             hOle32 = LoadLibraryA("OLE32.DLL");
    877             hUser32 = GetModuleHandleA("USER32");
    878 
    879             if (!hComctl32 || !hUser32 || !hOle32)
    880             {
    881               ERR_(shell)("P A N I C SHELL32 loading failed\n");
    882               return FALSE;
    883             }
    884 
    885             /* comctl32 */
    886             Shell32ProcLoadHelper((LPVOID*)&pDLLInitComctl,hComctl32,"InitCommonControlsEx");
    887             Shell32ProcLoadHelper((LPVOID*)&pImageList_Create,hComctl32,"ImageList_Create");
    888             Shell32ProcLoadHelper((LPVOID*)&pImageList_AddIcon,hComctl32,"ImageList_AddIcon");
    889             Shell32ProcLoadHelper((LPVOID*)&pImageList_ReplaceIcon,hComctl32,"ImageList_ReplaceIcon");
    890             Shell32ProcLoadHelper((LPVOID*)&pImageList_GetIcon,hComctl32,"ImageList_GetIcon");
    891             Shell32ProcLoadHelper((LPVOID*)&pImageList_GetImageCount,hComctl32,"ImageList_GetImageCount");
    892             Shell32ProcLoadHelper((LPVOID*)&pImageList_Draw,hComctl32,"ImageList_Draw");
    893             Shell32ProcLoadHelper((LPVOID*)&pImageList_SetBkColor,hComctl32,"ImageList_SetBkColor");
    894             Shell32ProcLoadHelper((LPVOID*)&pCOMCTL32_Alloc,hComctl32, (LPCSTR)71L);
    895             Shell32ProcLoadHelper((LPVOID*)&pCOMCTL32_Free,hComctl32, (LPCSTR)73L);
    896             Shell32ProcLoadHelper((LPVOID*)&pDPA_Create,hComctl32, (LPCSTR)328L);
    897             Shell32ProcLoadHelper((LPVOID*)&pDPA_Destroy,hComctl32, (LPCSTR)329L);
    898             Shell32ProcLoadHelper((LPVOID*)&pDPA_GetPtr,hComctl32, (LPCSTR)332L);
    899             Shell32ProcLoadHelper((LPVOID*)&pDPA_InsertPtr,hComctl32, (LPCSTR)334L);
    900             Shell32ProcLoadHelper((LPVOID*)&pDPA_DeletePtr,hComctl32, (LPCSTR)336L);
    901             Shell32ProcLoadHelper((LPVOID*)&pDPA_Sort,hComctl32, (LPCSTR)338L);
    902             Shell32ProcLoadHelper((LPVOID*)&pDPA_Search,hComctl32, (LPCSTR)339L);
    903             /* user32 */
    904             Shell32ProcLoadHelper((LPVOID*)&pLookupIconIdFromDirectoryEx,hUser32,"LookupIconIdFromDirectoryEx");
    905             Shell32ProcLoadHelper((LPVOID*)&pCreateIconFromResourceEx,hUser32,"CreateIconFromResourceEx");
    906             /* ole2 */
    907             Shell32ProcLoadHelper((LPVOID*)&pOleInitialize,hOle32,"OleInitialize");
    908             Shell32ProcLoadHelper((LPVOID*)&pOleUninitialize,hOle32,"OleUninitialize");
    909             Shell32ProcLoadHelper((LPVOID*)&pDoDragDrop,hOle32,"DoDragDrop");
    910             Shell32ProcLoadHelper((LPVOID*)&pRegisterDragDrop,hOle32,"RegisterDragDrop");
    911             Shell32ProcLoadHelper((LPVOID*)&pRevokeDragDrop,hOle32,"RevokeDragDrop");
    912 
    913             /* initialize the common controls */
    914             if (pDLLInitComctl)
    915             {
    916               pDLLInitComctl(NULL);
    917             }
    918 
    919             SIC_Initialize();
    920 
    921             break;
    922 
    923           case DLL_THREAD_ATTACH:
    924             shell32_RefCount++;
    925             break;
    926 
    927           case DLL_THREAD_DETACH:
    928             shell32_RefCount--;
    929             break;
    930 
    931           case DLL_PROCESS_DETACH:
    932             shell32_RefCount--;
    933 
    934             pOleUninitialize();
    935             FreeLibrary(hOle32);
    936             FreeLibrary(hComctl32);
    937 
    938             if ( !shell32_RefCount )
    939             {
    940               shell32_hInstance = 0;
    941 
    942               if (pdesktopfolder)
    943               {
    944                 IShellFolder_Release(pdesktopfolder);
    945                 pdesktopfolder = NULL;
    946               }
    947 
    948               SIC_Destroy();
    949 
    950               /* this one is here to check if AddRef/Release is balanced */
    951               if (shell32_ObjCount)
    952               {
    953                 WARN_(shell)("leaving with %u objects left (memory leak)\n", shell32_ObjCount);
    954               }
    955             }
    956             TRACE_(shell)("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount);
    957             break;
    958         }
    959         return TRUE;
    960 }
     905
     906  if (!pAddr)
     907     dprintf(("Shell32: Shell32ProcLoadHelper(%08xh,%08xh,%s) failed!\n",
     908              pAddr,
     909              hModule,
     910              lpstrName));
     911}
     912
     913
     914ODINFUNCTION3(BOOL, Shell32LibMain, HINSTANCE, hinstDLL,
     915                                    DWORD,     fdwReason,
     916                                    LPVOID,    fImpLoad)
     917{
     918   HMODULE  hUser32;
     919
     920   switch (fdwReason)
     921   {
     922     case DLL_PROCESS_ATTACH:
     923       shell32_RefCount++;
     924       if (shell32_hInstance)
     925       {
     926         dprintf(("shell32.dll instantiated twice in one address space!\n"));
     927       }
     928
     929       shell32_hInstance = hinstDLL;
     930
     931       hComctl32 = LoadLibraryA("COMCTL32.DLL");
     932       hOle32 = LoadLibraryA("OLE32.DLL");
     933       hUser32 = GetModuleHandleA("USER32");
     934
     935       if (!hComctl32 || !hUser32 || !hOle32)
     936       {
     937         dprintf(("P A N I C SHELL32 loading failed\n"));
     938         return FALSE;
     939       }
     940
     941       /* comctl32 */
     942       Shell32ProcLoadHelper((LPVOID*)&pDLLInitComctl,hComctl32,"InitCommonControlsEx");
     943       Shell32ProcLoadHelper((LPVOID*)&pImageList_Create,hComctl32,"ImageList_Create");
     944       Shell32ProcLoadHelper((LPVOID*)&pImageList_AddIcon,hComctl32,"ImageList_AddIcon");
     945       Shell32ProcLoadHelper((LPVOID*)&pImageList_ReplaceIcon,hComctl32,"ImageList_ReplaceIcon");
     946       Shell32ProcLoadHelper((LPVOID*)&pImageList_GetIcon,hComctl32,"ImageList_GetIcon");
     947       Shell32ProcLoadHelper((LPVOID*)&pImageList_GetImageCount,hComctl32,"ImageList_GetImageCount");
     948       Shell32ProcLoadHelper((LPVOID*)&pImageList_Draw,hComctl32,"ImageList_Draw");
     949       Shell32ProcLoadHelper((LPVOID*)&pImageList_SetBkColor,hComctl32,"ImageList_SetBkColor");
     950       Shell32ProcLoadHelper((LPVOID*)&pCOMCTL32_Alloc,hComctl32, (LPCSTR)71L);
     951       Shell32ProcLoadHelper((LPVOID*)&pCOMCTL32_Free,hComctl32, (LPCSTR)73L);
     952       Shell32ProcLoadHelper((LPVOID*)&pDPA_Create,hComctl32, (LPCSTR)328L);
     953       Shell32ProcLoadHelper((LPVOID*)&pDPA_Destroy,hComctl32, (LPCSTR)329L);
     954       Shell32ProcLoadHelper((LPVOID*)&pDPA_GetPtr,hComctl32, (LPCSTR)332L);
     955       Shell32ProcLoadHelper((LPVOID*)&pDPA_InsertPtr,hComctl32, (LPCSTR)334L);
     956       Shell32ProcLoadHelper((LPVOID*)&pDPA_DeletePtr,hComctl32, (LPCSTR)336L);
     957       Shell32ProcLoadHelper((LPVOID*)&pDPA_Sort,hComctl32, (LPCSTR)338L);
     958       Shell32ProcLoadHelper((LPVOID*)&pDPA_Search,hComctl32, (LPCSTR)339L);
     959       /* user32 */
     960       Shell32ProcLoadHelper((LPVOID*)&pLookupIconIdFromDirectoryEx,hUser32,"LookupIconIdFromDirectoryEx");
     961       Shell32ProcLoadHelper((LPVOID*)&pCreateIconFromResourceEx,hUser32,"CreateIconFromResourceEx");
     962       /* ole2 */
     963       Shell32ProcLoadHelper((LPVOID*)&pOleInitialize,hOle32,"OleInitialize");
     964       Shell32ProcLoadHelper((LPVOID*)&pOleUninitialize,hOle32,"OleUninitialize");
     965       Shell32ProcLoadHelper((LPVOID*)&pDoDragDrop,hOle32,"DoDragDrop");
     966       Shell32ProcLoadHelper((LPVOID*)&pRegisterDragDrop,hOle32,"RegisterDragDrop");
     967       Shell32ProcLoadHelper((LPVOID*)&pRevokeDragDrop,hOle32,"RevokeDragDrop");
     968
     969       /* initialize the common controls */
     970       if (pDLLInitComctl)
     971       {
     972         pDLLInitComctl(NULL);
     973       }
     974
     975       SIC_Initialize();
     976
     977       break;
     978
     979     case DLL_THREAD_ATTACH:
     980       shell32_RefCount++;
     981       break;
     982
     983     case DLL_THREAD_DETACH:
     984       shell32_RefCount--;
     985       break;
     986
     987     case DLL_PROCESS_DETACH:
     988       shell32_RefCount--;
     989
     990       pOleUninitialize();
     991       FreeLibrary(hOle32);
     992       FreeLibrary(hComctl32);
     993
     994       if ( !shell32_RefCount )
     995       {
     996         shell32_hInstance = 0;
     997
     998         if (pdesktopfolder)
     999         {
     1000           IShellFolder_Release(pdesktopfolder);
     1001           pdesktopfolder = NULL;
     1002         }
     1003
     1004         SIC_Destroy();
     1005
     1006         /* this one is here to check if AddRef/Release is balanced */
     1007         if (shell32_ObjCount)
     1008         {
     1009           dprintf(("leaving with %u objects left (memory leak)\n", shell32_ObjCount));
     1010         }
     1011       }
     1012       dprintf(("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount));
     1013       break;
     1014   }
     1015   return TRUE;
     1016}
Note: See TracChangeset for help on using the changeset viewer.