Changeset 1353 for trunk/src


Ignore:
Timestamp:
Oct 19, 1999, 12:23:27 PM (26 years ago)
Author:
phaller
Message:

Fix: debug info

Location:
trunk/src/shell32
Files:
5 edited

Legend:

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

    r1214 r1353  
    1 /* $Id: misc.cpp,v 1.5 1999-10-09 11:13:19 sandervl Exp $ */
     1/* $Id: misc.cpp,v 1.6 1999-10-19 10:23:26 phaller Exp $ */
    22
    33/*
     
    1616
    1717#include <odin.h>
     18#include <odinwrap.h>
     19#include <os2sel.h>
     20
    1821#include <wchar.h>
    1922#include <wcstr.h>
     
    3033#include <heapstring.h>
    3134
     35
    3236/*****************************************************************************
    3337 * Types & Defines                                                           *
    3438 *****************************************************************************/
    3539
    36 
    37 /*****************************************************************************
    38  * Name      : HICON WIN32API ExtractAssociatedIconExA
     40ODINDEBUGCHANNEL(SHELL32-MISC)
     41
     42
     43/*****************************************************************************
     44 * Name      : ExtractAssociatedIconExA
    3945 * Purpose   : Return icon for given file (either from file itself or from associated
    4046 *             executable) and patch parameters if needed.
     
    4854 *****************************************************************************/
    4955
    50 HICON WIN32API ExtractAssociatedIconExA(HINSTANCE hInst,
    51                                       LPSTR     lpIconPath,
    52                                       LPWORD    lpiIcon)
     56ODINFUNCTION3(HICON,     ExtractAssociatedIconExA,
     57              HINSTANCE, hInst,
     58              LPSTR,     lpIconPath,
     59              LPWORD,    lpiIcon)
    5360{
    5461  dprintf(("SHELL32: undoc ExtractAssociatedIconExA\n"));
     
    5865
    5966/*****************************************************************************
    60  * Name      : HICON WIN32API ExtractAssociatedIconW
     67 * Name      : ExtractAssociatedIconW
    6168 * Purpose   : Return icon for given file (either from file itself or from associated
    6269 *             executable) and patch parameters if needed.
     
    7077 *****************************************************************************/
    7178
    72 HICON WIN32API ExtractAssociatedIconW(HINSTANCE hInst,
    73                                       LPWSTR    lpIconPath,
    74                                       LPWORD    lpiIcon)
     79ODINFUNCTION3(HICON,     ExtractAssociatedIconW,
     80              HINSTANCE, hInst,
     81              LPWSTR,    lpIconPath,
     82              LPWORD,    lpiIcon)
    7583{
    7684  LPSTR lpIconPathAscii = UnicodeToAsciiString(lpIconPath);
    7785  HICON hIcon;
    78 
    79   dprintf(("SHELL32: ExtractAssociatedIconW(%08xh,%s,%08xh)\n",
    80            hInst,
    81            lpIconPathAscii,
    82            lpiIcon));
    8386
    8487  hIcon = ExtractAssociatedIconA(hInst,
     
    9295
    9396/*****************************************************************************
    94  * Name      : HICON WIN32API ExtractAssociatedIconExW
     97 * Name      : ExtractAssociatedIconExW
    9598 * Purpose   : Return icon for given file (either from file itself or from associated
    9699 *             executable) and patch parameters if needed.
     
    104107 *****************************************************************************/
    105108
    106 HICON WIN32API ExtractAssociatedIconExW(HINSTANCE hInst,
    107                                       LPWSTR     lpIconPath,
    108                                       LPWORD    lpiIcon)
     109ODINFUNCTION3(HICON,     ExtractAssociatedIconExW,
     110              HINSTANCE, hInst,
     111              LPWSTR,    lpIconPath,
     112              LPWORD,    lpiIcon)
    109113{
    110114  dprintf(("SHELL32: undoc ExtractAssociatedIconExW\n"));
     
    126130 *****************************************************************************/
    127131
    128 BOOL WIN32API OleStrToStrN (LPSTR   lpMulti,
    129                             INT     nMulti,
    130                             LPCWSTR lpWide,
    131                             INT     nWide)
    132 {
    133   dprintf(("SHELL32: OleStrToStrN(%08xh,%08xh,%08xh,%08xh)\n",
    134            lpMulti,
    135            nMulti,
    136            lpWide,
    137            nWide));
    138 
     132ODINFUNCTION4(BOOL,    OleStrToStrN,
     133              LPSTR,   lpMulti,
     134              INT,     nMulti,
     135              LPCWSTR, lpWide,
     136              INT,     nWide)
     137{
    139138  return WideCharToMultiByte (0,
    140139                              0,
     
    160159 *****************************************************************************/
    161160
    162 BOOL WIN32API StrToOleStrN (LPWSTR lpWide,
    163                             INT    nWide,
    164                             LPCSTR lpMulti,
    165                             INT    nMulti)
    166 {
    167   dprintf(("SHELL32: StrToOleStrN(%08xh,%08xh,%08xh,%08xh)\n",
    168            lpWide,
    169            nWide,
    170            lpMulti,
    171            nMulti));
    172 
     161ODINFUNCTION4(BOOL,   StrToOleStrN,
     162              LPWSTR, lpWide,
     163              INT,    nWide,
     164              LPCSTR, lpMulti,
     165              INT,    nMulti)
     166{
    173167  return MultiByteToWideChar (0,
    174168                              0,
     
    192186 *****************************************************************************/
    193187
    194 HRESULT WIN32API StrRetToStrN (LPVOID       dest,
    195                                DWORD        len,
    196                                LPSTRRET     src,
    197                                LPITEMIDLIST pidl)
    198 {
    199   dprintf(("SHELL32: StrRetToStrN(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    200            dest,
    201            len,
    202            src,
    203            pidl));
    204 
     188ODINFUNCTION4(HRESULT,      StrRetToStrN,
     189              LPVOID,       dest,
     190              DWORD,        len,
     191              LPSTRRET,     src,
     192              LPITEMIDLIST, pidl)
     193{
    205194  switch (src->uType)
    206195  {
     
    262251 *****************************************************************************/
    263252
    264 HRESULT WIN32API SHELL32_654 (DWORD x,
    265                               DWORD y)
     253ODINFUNCTION2(HRESULT, SHELL32_654,
     254              DWORD,   x,
     255              DWORD,   y)
    266256{
    267257  dprintf(("SHELL32: SHELL32_654(%08xh,%08xh) not implemented.\n",
     
    284274 *****************************************************************************/
    285275
    286 int WIN32API StrToOleStr (LPWSTR lpWideCharStr,
    287                           LPCSTR lpMultiByteString)
    288 {
    289   dprintf(("SHELL32: StrToOleStr(%08xh,%08xh)\n",
    290            lpWideCharStr,
    291            lpMultiByteString));
    292 
     276ODINFUNCTION2(int,    StrToOleStr,
     277              LPWSTR, lpWideCharStr,
     278              LPCSTR, lpMultiByteString)
     279{
    293280  return MultiByteToWideChar(0,
    294281                             0,
     
    312299 *****************************************************************************/
    313300
    314 LPWSTR WIN32API StrCpyNW(LPWSTR lpString1,LPWSTR lpString2,int iMaxLength)
     301ODINFUNCTION3(LPWSTR, StrCpyNW,
     302              LPWSTR, lpString1,
     303              LPWSTR, lpString2,
     304              int,    iMaxLength)
    315305{
    316306  dprintf(("SHELL32: undoc StrCpyNW\n"));
     
    331321 *****************************************************************************/
    332322
    333 LPWSTR WIN32API StrNCpyW(LPWSTR lpString1,LPWSTR lpString2)
     323ODINFUNCTION2(LPWSTR, StrNCpyW,
     324              LPWSTR, lpString1,
     325              LPWSTR, lpString2)
    334326{
    335327  dprintf(("SHELL32: undoc StrNCpyW\n"));
     
    351343 *****************************************************************************/
    352344
    353 void WIN32API InternalExtractIconListA(VOID)
     345ODINFUNCTION1(DWORD, InternalExtractIconListA, DWORD, dwArg1)
    354346{
    355347  dprintf(("SHELL32: undoc InternalExtractIconListA \n"));
     348  return 0;
    356349}
    357350
     
    368361 *****************************************************************************/
    369362
    370 void WIN32API InternalExtractIconListW(VOID)
     363ODINFUNCTION1(DWORD, InternalExtractIconListW, DWORD, dwArg1)
    371364{
    372365  dprintf(("SHELL32: undoc InternalExtractIconListW\n"));
     366  return 0;
    373367}
    374368
     
    385379 *****************************************************************************/
    386380
    387 void WIN32API ExtractIconResInfoA(VOID)
     381ODINFUNCTION1(DWORD, ExtractIconResInfoA, DWORD, dwArg1)
    388382{
    389383  dprintf(("SHELL32: undoc ExtractIconResInfoA\n"));
     384  return 0;
    390385}
    391386
     
    402397 *****************************************************************************/
    403398
    404 void WIN32API ExtractIconResInfoW(VOID)
     399ODINFUNCTION1(DWORD, ExtractIconResInfoW, DWORD, dwArg1)
    405400{
    406401  dprintf(("SHELL32: undoc ExtractIconResInfoW\n"));
     402  return 0;
    407403}
    408404
     
    442438 *****************************************************************************/
    443439
    444 void WIN32API CheckEscapesA(DWORD x1,DWORD x2)
     440ODINPROCEDURE2(CheckEscapesA,
     441               DWORD, x1,
     442               DWORD, x2)
    445443{
    446444  dprintf(("SHELL32: undoc CheckEscapesA\n"));
     
    459457 *****************************************************************************/
    460458
    461 void WIN32API CheckEscapesW(DWORD x1,DWORD x2)
     459ODINPROCEDURE2(CheckEscapesW,
     460               DWORD, x1,
     461               DWORD, x2)
    462462{
    463463  dprintf(("SHELL32: undoc CheckEscapesW\n"));
     
    476476 *****************************************************************************/
    477477
    478 DWORD WIN32API DuplicateIcon(DWORD x1)
     478ODINFUNCTION1(DWORD, DuplicateIcon,
     479              DWORD, x1)
    479480{
    480481  dprintf(("SHELL32: undoc DuplicateIcon\n"));
     
    482483  return 0;
    483484}
     485
  • trunk/src/shell32/sh.cpp

    r1214 r1353  
    1 /* $Id: sh.cpp,v 1.9 1999-10-09 11:13:20 sandervl Exp $ */
     1/* $Id: sh.cpp,v 1.10 1999-10-19 10:23:26 phaller Exp $ */
    22
    33/*
     
    1111 * Includes                                                                  *
    1212 *****************************************************************************/
     13
     14#include <odin.h>
     15#include <odinwrap.h>
     16#include <os2sel.h>
    1317
    1418#include <os2win.h>
     
    3337 *****************************************************************************/
    3438
     39ODINDEBUGCHANNEL(SHELL32-SH)
     40
     41
    3542#define LPSHELLVIEWDATA  LPVOID
    3643#define LPUNKNOWN        LPVOID
     
    5461 *****************************************************************************/
    5562
    56 LPITEMIDLIST WIN32API SHBrowseForFolder(LPBROWSEINFOA lpbi)
    57 {
    58   dprintf(("SHELL32: SHBrowseForFolder(%08xh) not implemented.\n",
    59            lpbi));
     63ODINFUNCTION1(LPITEMIDLIST, SHBrowseForFolder,
     64              LPBROWSEINFOA, lpbi)
     65{
     66  dprintf(("SHELL32: SHBrowseForFolder not implemented.\n"));
    6067
    6168  //@@@PH automatically decide between A and W
     
    7784 *****************************************************************************/
    7885
    79 LPITEMIDLIST WIN32API SHBrowseForFolderW(LPBROWSEINFOA lpbi)
    80 {
    81   dprintf(("SHELL32: SHBrowseForFolderW(%08xh) not implemented.\n",
    82            lpbi));
     86ODINFUNCTION1(LPITEMIDLIST, SHBrowseForFolderW,
     87              LPBROWSEINFOA, lpbi)
     88{
     89  dprintf(("SHELL32: SHBrowseForFolderW not implemented.\n"));
    8390
    8491  return(NULL);
     
    98105 *****************************************************************************/
    99106
    100 DWORD WIN32API SHEmptyRecycleBinA(DWORD x1,
    101                                   DWORD x2,
    102                                   DWORD x3)
    103 {
    104   dprintf(("SHELL32: SHEmptyRecycleBinA(%08xh,%08xh,%08xh) not implemented.\n",
    105            x1,
    106            x2,
    107            x3));
     107ODINFUNCTION3(DWORD, SHEmptyRecycleBinA,
     108              DWORD, x1,
     109              DWORD, x2,
     110              DWORD, x3)
     111{
     112  dprintf(("SHELL32: SHEmptyRecycleBinA not implemented.\n"));
    108113
    109114  return 0;
     
    123128 *****************************************************************************/
    124129
    125 DWORD WIN32API SHEmptyRecycleBinW(DWORD x1,
    126                                   DWORD x2,
    127                                   DWORD x3)
    128 {
    129   dprintf(("SHELL32: SHEmptyRecycleBinW(%08xh,%08xh,%08xh) not implemented.\n",
    130            x1,
    131            x2,
    132            x3));
     130ODINFUNCTION3(DWORD, SHEmptyRecycleBinW,
     131              DWORD, x1,
     132              DWORD, x2,
     133              DWORD, x3)
     134{
     135  dprintf(("SHELL32: SHEmptyRecycleBinW not implemented.\n"));
    133136
    134137  return 0;
     
    148151 *****************************************************************************/
    149152
    150 DWORD WIN32API SHFormatDrive(DWORD x1,
    151                              DWORD x2,
    152                              DWORD x3,
    153                              DWORD x4)
    154 {
    155   dprintf(("SHELL32: SHFormatDrive(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    156            x1,
    157            x2,
    158            x3,
    159            x4));
     153ODINFUNCTION4(DWORD, SHFormatDrive,
     154              DWORD, x1,
     155              DWORD, x2,
     156              DWORD, x3,
     157              DWORD, x4)
     158{
     159  dprintf(("SHELL32: SHFormatDrive not implemented.\n"));
    160160
    161161  return 0;
     
    175175 *****************************************************************************/
    176176
    177 DWORD WIN32API SHFreeNameMappings(DWORD x1)
    178 {
    179   dprintf(("SHELL32: SHFreeNameMappings(%08xh) not implemented.\n",
    180            x1));
     177ODINFUNCTION1(DWORD, SHFreeNameMappings,
     178              DWORD, x1)
     179{
     180  dprintf(("SHELL32: SHFreeNameMappings not implemented.\n"));
    181181
    182182  return 0;
     
    196196 *****************************************************************************/
    197197
    198 DWORD WIN32API SHGetNewLinkInfo(DWORD x1,
    199                                 DWORD x2,
    200                                 DWORD x3,
    201                                 DWORD x4,
    202                                 DWORD x5)
    203 {
    204   dprintf(("SHELL32: SHGetNewLinkInfo(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    205            x1,
    206            x2,
    207            x3,
    208            x4,
    209            x5));
     198ODINFUNCTION5(DWORD, SHGetNewLinkInfo,
     199              DWORD, x1,
     200              DWORD, x2,
     201              DWORD, x3,
     202              DWORD, x4,
     203              DWORD, x5)
     204{
     205  dprintf(("SHELL32: SHGetNewLinkInfo not implemented.\n"));
    210206
    211207  return 0;
     
    225221 *****************************************************************************/
    226222
    227 DWORD WIN32API SHHelpShortcuts_RunDLLA(DWORD x1,
    228                                        DWORD x2,
    229                                        DWORD x3,
    230                                        DWORD x4)
    231 {
    232   dprintf(("SHELL32: SHHelpShortcuts_RunDLLA(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    233            x1,
    234            x2,
    235            x3,
    236            x4));
     223ODINFUNCTION4(DWORD, SHHelpShortcuts_RunDLLA,
     224              DWORD, x1,
     225              DWORD, x2,
     226              DWORD, x3,
     227              DWORD, x4)
     228{
     229  dprintf(("SHELL32: SHHelpShortcuts_RunDLLA not implemented.\n"));
    237230
    238231  return(0);
     
    252245 *****************************************************************************/
    253246
    254 DWORD WIN32API SHHelpShortcuts_RunDLLW(DWORD x1,
    255                                        DWORD x2,
    256                                        DWORD x3,
    257                                        DWORD x4)
    258 {
    259   dprintf(("SHELL32: SHHelpShortcuts_RunDLLW(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    260            x1,
    261            x2,
    262            x3,
    263            x4));
     247ODINFUNCTION4(DWORD, SHHelpShortcuts_RunDLLW,
     248              DWORD, x1,
     249              DWORD, x2,
     250              DWORD, x3,
     251              DWORD, x4)
     252{
     253  dprintf(("SHELL32: SHHelpShortcuts_RunDLLW not implemented.\n"));
    264254
    265255  return(0);
     
    279269 *****************************************************************************/
    280270
    281 DWORD WIN32API SHQueryRecycleBinA(DWORD x1,
    282                                   DWORD x2)
    283 {
    284   dprintf(("SHELL32: SHQueryRecycleBinA(%08xh,%08xh) not implemented.\n",
    285            x1,
    286            x2));
     271ODINFUNCTION2(DWORD, SHQueryRecycleBinA,
     272              DWORD, x1,
     273              DWORD, x2)
     274{
     275  dprintf(("SHELL32: SHQueryRecycleBinA not implemented.\n"));
    287276
    288277  return(0);
     
    302291 *****************************************************************************/
    303292
    304 DWORD WIN32API SHQueryRecycleBinW(DWORD x1,
    305                                   DWORD x2)
    306 {
    307   dprintf(("SHELL32: SHQueryRecycleBinW(%08xh,%08xh) not implemented.\n",
    308            x1,
    309            x2));
     293ODINFUNCTION2(DWORD, SHQueryRecycleBinW,
     294              DWORD, x1,
     295              DWORD, x2)
     296{
     297  dprintf(("SHELL32: SHQueryRecycleBinW not implemented.\n"));
    310298
    311299  return(0);
     
    325313 *****************************************************************************/
    326314
    327 DWORD WIN32API SHUpdateRecycleBinIcon(void)
     315ODINFUNCTION0(DWORD, SHUpdateRecycleBinIcon)
    328316{
    329317  dprintf(("SHELL32: SHUpdateRecycleBinIcon() not implemented.\n"));
     
    345333 *****************************************************************************/
    346334
    347 HRESULT WIN32API SHRegDeleteKeyW (HKEY   hkey,
    348                                   LPWSTR lpszKey)
    349 {
    350   dprintf(("SHELL32: SHRegDeleteKeyW(%08xh,%08xh)\n",
    351            hkey,
    352            lpszKey));
    353 
     335ODINFUNCTION2(HRESULT, SHRegDeleteKeyW,
     336              HKEY,    hkey,
     337              LPWSTR,  lpszKey)
     338{
    354339  return RegDeleteKeyW(hkey,
    355340                       lpszKey);
     
    369354 *****************************************************************************/
    370355
    371 HRESULT WIN32API SHRegDeleteKeyA (HKEY  hkey,
    372                                   LPSTR lpszKey)
    373 {
    374   dprintf(("SHELL32: SHRegDeleteKeyA(%08xh,%s)\n",
    375            hkey,
    376            lpszKey));
    377 
     356ODINFUNCTION2(HRESULT, SHRegDeleteKeyA,
     357              HKEY,    hkey,
     358              LPSTR,   lpszKey)
     359{
    378360  return RegDeleteKeyA(hkey,
    379361                       lpszKey);
    380362}
     363
  • trunk/src/shell32/shell.cpp

    r1215 r1353  
    1 /* $Id: shell.cpp,v 1.2 1999-10-09 11:17:01 sandervl Exp $ */
     1/* $Id: shell.cpp,v 1.3 1999-10-19 10:23:27 phaller Exp $ */
     2
    23/*
    3  *                              Shell Library Functions
     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 Library Functions
    410 *
    511 *  1998 Marcus Meissner
    612 */
     13
     14
     15/*****************************************************************************
     16 * Includes                                                                  *
     17 *****************************************************************************/
     18
     19#include <odin.h>
     20#include <odinwrap.h>
     21#include <os2sel.h>
     22
    723#include <assert.h>
    824#include <stdlib.h>
     
    1026//#include <unistd.h>
    1127#include <ctype.h>
    12 
    13 #include <odin.h>
    1428
    1529#define ICOM_CINTERFACE 1
     
    3852#include <misc.h>
    3953
    40 DECLARE_DEBUG_CHANNEL(exec)
    41 DECLARE_DEBUG_CHANNEL(shell)
     54
     55/*****************************************************************************
     56 * Implementation                                                            *
     57 *****************************************************************************/
     58
     59ODINDEBUGCHANNEL(SHELL32-SHELL)
     60
    4261
    4362/* .ICO file ICONDIR definitions */
     
    4766typedef struct
    4867{
    49     BYTE        bWidth;          /* Width, in pixels, of the image      */
    50     BYTE        bHeight;         /* Height, in pixels, of the image     */
     68    BYTE        bWidth;          /* Width, in pixels, of the image  */
     69    BYTE        bHeight;         /* Height, in pixels, of the image */
    5170    BYTE        bColorCount;     /* Number of colors in image (0 if >=8bpp) */
    52     BYTE        bReserved;       /* Reserved ( must be 0)               */
    53     WORD        wPlanes;         /* Color Planes                        */
    54     WORD        wBitCount;       /* Bits per pixel                      */
    55     DWORD       dwBytesInRes;    /* How many bytes in this resource?    */
    56     DWORD       dwImageOffset;   /* Where in the file is this image?    */
     71    BYTE        bReserved;       /* Reserved ( must be 0)     */
     72    WORD        wPlanes;         /* Color Planes        */
     73    WORD        wBitCount;       /* Bits per pixel         */
     74    DWORD       dwBytesInRes;    /* How many bytes in this resource?   */
     75    DWORD       dwImageOffset;   /* Where in the file is this image?   */
    5776} icoICONDIRENTRY, *LPicoICONDIRENTRY;
    5877
    5978typedef struct
    6079{
    61     WORD            idReserved;   /* Reserved (must be 0)               */
    62     WORD            idType;       /* Resource Type (1 for icons)        */
    63     WORD            idCount;      /* How many images?                   */
     80    WORD            idReserved;   /* Reserved (must be 0)     */
     81    WORD            idType;       /* Resource Type (1 for icons) */
     82    WORD            idCount;      /* How many images?         */
    6483    icoICONDIRENTRY idEntries[1]; /* An entry for each image (idCount of 'em) */
    6584} icoICONDIR, *LPicoICONDIR;
     
    6786#include "poppack.h"
    6887
    69 static const char*      lpstrMsgWndCreated = "OTHERWINDOWCREATED";
    70 static const char*      lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
    71 static const char*      lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
    72 
    73 static HWND16   SHELL_hWnd = 0;
    74 static HHOOK    SHELL_hHook = 0;
    75 static UINT16   uMsgWndCreated = 0;
    76 static UINT16   uMsgWndDestroyed = 0;
    77 static UINT16   uMsgShellActivate = 0;
    78 HINSTANCE16     SHELL_hInstance = 0;
     88static const char* lpstrMsgWndCreated    = "OTHERWINDOWCREATED";
     89static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
     90static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
     91
     92static HWND16  SHELL_hWnd = 0;
     93static HHOOK   SHELL_hHook = 0;
     94static UINT16  uMsgWndCreated = 0;
     95static UINT16  uMsgWndDestroyed = 0;
     96static UINT16  uMsgShellActivate = 0;
     97HINSTANCE16 SHELL_hInstance = 0;
    7998HINSTANCE SHELL_hInstance32;
    8099static int SHELL_Attach = 0;
     
    82101
    83102/*************************************************************************
    84  *                              DragAcceptFiles32               [SHELL32.54]
    85  */
    86 void WINAPI DragAcceptFiles(HWND hWnd, BOOL b)
     103 *          DragAcceptFiles32               [SHELL32.54]
     104 */
     105
     106ODINPROCEDURE2(DragAcceptFiles, HWND, hWnd,
     107                                BOOL, b)
    87108{
    88109  LONG exstyle;
    89110
    90 
    91111  if( !IsWindow(hWnd) )
    92         return;
     112   return;
    93113  exstyle = GetWindowLongA(hWnd,GWL_EXSTYLE);
    94114  if (b)exstyle |= WS_EX_ACCEPTFILES;
    95   else  exstyle &= ~WS_EX_ACCEPTFILES;
     115  else   exstyle &= ~WS_EX_ACCEPTFILES;
    96116  SetWindowLongA(hWnd,GWL_EXSTYLE,exstyle);
    97117}
    98118
    99119/*************************************************************************
    100  *                              SHELL_DragQueryFile     [internal]
     120 *          SHELL_DragQueryFile          [internal]
    101121 *
    102122 */
    103123static UINT SHELL_DragQueryFile(LPSTR lpDrop, LPWSTR lpwDrop, UINT lFile,
    104                                   LPSTR lpszFile, LPWSTR lpszwFile, UINT lLength)
     124              LPSTR lpszFile, LPWSTR lpszwFile, UINT lLength)
    105125{
    106126    UINT i;
     
    109129    if (lpDrop) {
    110130    while (i++ < lFile) {
    111         while (*lpDrop++); /* skip filename */
    112         if (!*lpDrop)
    113           return (lFile == 0xFFFFFFFF) ? i : 0;
     131   while (*lpDrop++); /* skip filename */
     132   if (!*lpDrop)
     133     return (lFile == 0xFFFFFFFF) ? i : 0;
    114134      }
    115135    }
    116136    if (lpwDrop) {
    117137      while (i++ < lFile) {
    118         while (*lpwDrop++); /* skip filename */
    119         if (!*lpwDrop)
    120           return (lFile == 0xFFFFFFFF) ? i : 0;
     138   while (*lpwDrop++); /* skip filename */
     139   if (!*lpwDrop)
     140     return (lFile == 0xFFFFFFFF) ? i : 0;
    121141      }
    122142    }
     
    140160
    141161/*************************************************************************
    142  *                              DragQueryFile32A        [SHELL32.81] [shell32.82]
    143  */
    144 UINT WINAPI DragQueryFileA(HDROP hDrop, UINT lFile, LPSTR lpszFile,
    145                               UINT lLength)
     162 *          DragQueryFile32A             [SHELL32.81] [shell32.82]
     163 */
     164
     165ODINFUNCTION4(UINT, DragQueryFileA, HDROP, hDrop,
     166                                    UINT,  lFile,
     167                                    LPSTR, lpszFile,
     168                                    UINT,  lLength)
    146169{ /* hDrop is a global memory block allocated with GMEM_SHARE
    147170     * with DROPFILESTRUCT as a header and filenames following
     
    151174    LPSTR lpCurrent;
    152175    UINT i;
    153 
    154     TRACE_(shell)("(%08x, %x, %p, %u)\n",       hDrop,lFile,lpszFile,lLength);
    155176
    156177    lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
     
    165186
    166187/*************************************************************************
    167  *                              DragQueryFile32W        [shell32.133]
    168  */
    169 UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile,
    170                               UINT lLength)
     188 *          DragQueryFile32W             [shell32.133]
     189 */
     190ODINFUNCTION4(UINT, DragQueryFileW, HDROP,  hDrop,
     191                                    UINT,   lFile,
     192                                    LPWSTR, lpszwFile,
     193                                    UINT,   lLength)
    171194{
    172195    LPDROPFILESTRUCT lpDropFileStruct;
    173196    LPWSTR lpwCurrent;
    174197    UINT i;
    175 
    176     TRACE_(shell)("(%08x, %x, %p, %u)\n",       hDrop,lFile,lpszwFile,lLength);
    177198
    178199    lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
     
    202223 *****************************************************************************/
    203224
    204 UINT WIN32API DragQueryFileAorW(HDROP  hDrop,
    205                                 UINT   iFile,
    206                                 LPTSTR lpszFile,
    207                                 UINT   cch)
    208 {
    209   dprintf(("SHELL32: DragQueryFileAorW(%08xh,%08xh,%s,%08xh).\n",
    210            hDrop,
    211            iFile,
    212            lpszFile,
    213            cch));
    214 
     225ODINFUNCTION4(UINT,   DragQueryFileAorW,
     226              HDROP,  hDrop,
     227              UINT,   iFile,
     228              LPTSTR, lpszFile,
     229              UINT,   cch)
     230{
    215231  // @@@PH maybe they want automatic determination here
    216232  if (VERSION_OsIsUnicode())
     
    222238
    223239/*************************************************************************
    224  *                              DragFinish32            [SHELL32.80]
    225  */
    226 void WINAPI DragFinish(HDROP h)
    227 { TRACE_(shell)("\n");
    228     GlobalFree((HGLOBAL)h);
    229 }
    230 
    231 
    232 /*************************************************************************
    233  *                              DragQueryPoint32                [SHELL32.135]
    234  */
    235 BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p)
     240 *          DragFinish32                    [SHELL32.80]
     241 */
     242ODINPROCEDURE1(DragFinish, HDROP, h)
     243{
     244  GlobalFree((HGLOBAL)h);
     245}
     246
     247
     248/*************************************************************************
     249 *          DragQueryPoint32                [SHELL32.135]
     250 */
     251ODINFUNCTION2(BOOL,   DragQueryPoint,
     252              HDROP,  hDrop,
     253              POINT*, p)
    236254{
    237255  LPDROPFILESTRUCT lpDropFileStruct;
    238256  BOOL             bRet;
    239   TRACE_(shell)("\n");
     257
    240258  lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
    241259
     
    248266
    249267/*************************************************************************
    250  *      SHELL_FindExecutable [Internal]
     268 * SHELL_FindExecutable [Internal]
    251269 *
    252270 * Utility for code sharing between FindExecutable and ShellExecute
     
    267285    char xlpFile[256];      /* result of SearchPath */
    268286
    269   TRACE_(shell)("%s\n", (lpFile != NULL?lpFile:"-") );
     287    dprintf(("SHELL32:SHELL:SHELL_FindExecutable(%s,%s,%08xh)\n",
     288             lpFile,
     289             lpOperation,
     290             lpResult));
    270291
    271292    lpResult[0]='\0'; /* Start off with an empty return string */
     
    273294    /* trap NULL parameters on entry */
    274295    if (( lpFile == NULL ) || ( lpResult == NULL ) || ( lpOperation == NULL ))
    275   { WARN_(exec)("(lpFile=%s,lpResult=%s,lpOperation=%s): NULL parameter\n",
    276            lpFile, lpOperation, lpResult);
     296  { dprintf(("SHELL32:SHELL:SHELL_FindExecutable(lpFile=%s,lpResult=%s,lpOperation=%s): NULL parameter\n",
     297           lpFile, lpOperation, lpResult));
    277298        return 2; /* File not found. Close enough, I guess. */
    278299    }
    279300
    280301    if (SearchPathA( NULL, lpFile,".exe",sizeof(xlpFile),xlpFile,NULL))
    281   { TRACE_(shell)("SearchPath32A returned non-zero\n");
     302  {  dprintf(("SHELL32:SHELL:SHELL_FindExecutable(SearchPath32A returned non-zero\n"));
    282303        lpFile = xlpFile;
    283304    }
     
    285306    /* First thing we need is the file's extension */
    286307    extension = strrchr( xlpFile, '.' ); /* Assume last "." is the one; */
    287                                         /* File->Run in progman uses */
    288                                         /* .\FILE.EXE :( */
    289   TRACE_(shell)("xlpFile=%s,extension=%s\n", xlpFile, extension);
     308               /* File->Run in progman uses */
     309               /* .\FILE.EXE :( */
     310    dprintf(("SHELL32:SHELL:SHELL_FindExecutable(xlpFile=%s,extension=%s)\n",
     311             xlpFile, extension));
    290312
    291313    if ((extension == NULL) || (extension == &xlpFile[strlen(xlpFile)]))
    292   { WARN_(shell)("Returning 31 - No association\n");
     314  { dprintf(("SHELL32:SHELL:SHELL_FindExecutable Returning 31 - No association\n"));
    293315        return 31; /* no association */
    294316    }
     
    297319    lstrcpynA( tmpext, extension, 5 );
    298320    CharLowerA( tmpext );
    299   TRACE_(shell)("%s file\n", tmpext);
     321
     322
     323    dprintf(("SHELL32:SHELL:SHELL_FindExecutable(%s file)\n", tmpext));
    300324
    301325    /* Three places to check: */
     
    311335     * got a lot more to worry about than running a program... */
    312336    if ( GetProfileStringA("windows", "programs", "exe pif bat com",
    313                                                   buffer, sizeof(buffer)) > 0 )
     337                    buffer, sizeof(buffer)) > 0 )
    314338  { for (i=0;i<strlen(buffer); i++) buffer[i]=tolower(buffer[i]);
    315339
    316                 tok = strtok(buffer, " \t"); /* ? */
    317                 while( tok!= NULL)
    318                   {
    319                         if (strcmp(tok, &tmpext[1])==0) /* have to skip the leading "." */
    320                           {
    321                                 strcpy(lpResult, xlpFile);
    322                                 /* Need to perhaps check that the file has a path
    323                                  * attached */
    324         TRACE_(shell)("found %s\n", lpResult);
    325                                 return 33;
    326 
    327                 /* Greater than 32 to indicate success FIXME According to the
    328                  * docs, I should be returning a handle for the
    329                  * executable. Does this mean I'm supposed to open the
    330                  * executable file or something? More RTFM, I guess... */
    331                           }
    332                         tok=strtok(NULL, " \t");
    333                   }
    334           }
     340      tok = strtok(buffer, " \t"); /* ? */
     341      while( tok!= NULL)
     342        {
     343         if (strcmp(tok, &tmpext[1])==0) /* have to skip the leading "." */
     344           {
     345            strcpy(lpResult, xlpFile);
     346            /* Need to perhaps check that the file has a path
     347             * attached */
     348            dprintf(("SHELL32:SHELL:SHELL_FindExecutable found %s\n",
     349                     lpResult));
     350            return 33;
     351
     352      /* Greater than 32 to indicate success FIXME According to the
     353       * docs, I should be returning a handle for the
     354       * executable. Does this mean I'm supposed to open the
     355       * executable file or something? More RTFM, I guess... */
     356           }
     357         tok=strtok(NULL, " \t");
     358        }
     359     }
    335360
    336361    /* Check registry */
     
    338363                         &filetypelen ) == ERROR_SUCCESS )
    339364    {
    340         filetype[filetypelen]='\0';
    341   TRACE_(shell)("File type: %s\n", filetype);
    342 
    343         /* Looking for ...buffer\shell\lpOperation\command */
    344         strcat( filetype, "\\shell\\" );
    345         strcat( filetype, lpOperation );
    346         strcat( filetype, "\\command" );
    347        
    348         if (RegQueryValueA( HKEY_CLASSES_ROOT, filetype, command,
     365   filetype[filetypelen]='\0';
     366    dprintf(("SHELL32:SHELL:SHELL_FindExecutable(File type: %s)\n",
     367             filetype));
     368
     369   /* Looking for ...buffer\shell\lpOperation\command */
     370   strcat( filetype, "\\shell\\" );
     371   strcat( filetype, lpOperation );
     372   strcat( filetype, "\\command" );
     373
     374   if (RegQueryValueA( HKEY_CLASSES_ROOT, filetype, command,
    349375                             &commandlen ) == ERROR_SUCCESS )
    350         {
    351             /* Is there a replace() function anywhere? */
    352             command[commandlen]='\0';
    353             strcpy( lpResult, command );
    354             tok=strstr( lpResult, "%1" );
    355             if (tok != NULL)
    356             {
    357                 tok[0]='\0'; /* truncate string at the percent */
    358                 strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
    359                 tok=strstr( command, "%1" );
    360                 if ((tok!=NULL) && (strlen(tok)>2))
    361                 {
    362                     strcat( lpResult, &tok[2] );
    363                 }
    364             }
    365             retval=33; /* FIXME see above */
    366         }
     376   {
     377       /* Is there a replace() function anywhere? */
     378       command[commandlen]='\0';
     379       strcpy( lpResult, command );
     380       tok=strstr( lpResult, "%1" );
     381       if (tok != NULL)
     382       {
     383      tok[0]='\0'; /* truncate string at the percent */
     384      strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
     385      tok=strstr( command, "%1" );
     386      if ((tok!=NULL) && (strlen(tok)>2))
     387      {
     388          strcat( lpResult, &tok[2] );
     389      }
     390       }
     391       retval=33; /* FIXME see above */
     392   }
    367393    }
    368394    else /* Check win.ini */
    369395    {
    370         /* Toss the leading dot */
    371         extension++;
    372         if ( GetProfileStringA( "extensions", extension, "", command,
     396   /* Toss the leading dot */
     397   extension++;
     398   if ( GetProfileStringA( "extensions", extension, "", command,
    373399                                  sizeof(command)) > 0)
    374           {
    375                 if (strlen(command)!=0)
    376                   {
    377                         strcpy( lpResult, command );
    378                         tok=strstr( lpResult, "^" ); /* should be ^.extension? */
    379                         if (tok != NULL)
    380                           {
    381                                 tok[0]='\0';
    382                                 strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
    383                                 tok=strstr( command, "^" ); /* see above */
    384                                 if ((tok != NULL) && (strlen(tok)>5))
    385                                   {
    386                                         strcat( lpResult, &tok[5]);
    387                                   }
    388                           }
    389                         retval=33; /* FIXME - see above */
    390                   }
    391           }
    392         }
    393 
    394     TRACE_(shell)("returning %s\n", lpResult);
     400     {
     401      if (strlen(command)!=0)
     402        {
     403         strcpy( lpResult, command );
     404         tok=strstr( lpResult, "^" ); /* should be ^.extension? */
     405         if (tok != NULL)
     406           {
     407            tok[0]='\0';
     408            strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
     409            tok=strstr( command, "^" ); /* see above */
     410            if ((tok != NULL) && (strlen(tok)>5))
     411              {
     412               strcat( lpResult, &tok[5]);
     413              }
     414           }
     415         retval=33; /* FIXME - see above */
     416        }
     417     }
     418   }
     419
     420    dprintf(("SHELL32:SHELL:SHELL_FindExecutable (returning %s)\n", lpResult));
    395421    return retval;
    396422}
     
    398424
    399425/*************************************************************************
    400  *                              SHELL_GetResourceTable
     426 *          SHELL_GetResourceTable
    401427 */
    402428static DWORD SHELL_GetResourceTable(HFILE hFile,LPBYTE *retptr)
    403 {       IMAGE_DOS_HEADER        mz_header;
    404         char                    magic[4];
    405         int                     size;
    406 
    407         TRACE_(shell)("\n");
    408 
    409         *retptr = NULL;
    410         _llseek( hFile, 0, SEEK_SET );
    411         if ((_lread(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) || (mz_header.e_magic != IMAGE_DOS_SIGNATURE))
    412         { /* .ICO file ? */
     429{  IMAGE_DOS_HEADER                      mz_header;
     430   char        magic[4];
     431   int         size;
     432
     433   dprintf(("SHELL32:Shell:SHELL_GetResourceTable(%08xh,%08xh)\n",
     434            hFile,
     435            retptr));
     436
     437   *retptr = NULL;
     438   _llseek( hFile, 0, SEEK_SET );
     439   if ((_lread(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) || (mz_header.e_magic != IMAGE_DOS_SIGNATURE))
     440   { /* .ICO file ? */
    413441          if (mz_header.e_cblp == 1)
    414           { /* ICONHEADER.idType, must be 1 */
    415             *retptr = (LPBYTE)-1;
    416             return 1;
    417           }
    418           else
    419             return 0; /* failed */
    420         }
    421         _llseek( hFile, mz_header.e_lfanew, SEEK_SET );
    422 
    423         if (_lread( hFile, magic, sizeof(magic) ) != sizeof(magic))
    424           return 0;
    425 
    426         _llseek( hFile, mz_header.e_lfanew, SEEK_SET);
    427 
    428         if (*(DWORD*)magic  == IMAGE_NT_SIGNATURE)
    429           return IMAGE_NT_SIGNATURE;
    430 
    431         if (*(WORD*)magic == IMAGE_OS2_SIGNATURE)
    432         { IMAGE_OS2_HEADER      ne_header;
    433           LPBYTE                pTypeInfo = (LPBYTE)-1;
    434 
    435           if (_lread(hFile,&ne_header,sizeof(ne_header))!=sizeof(ne_header))
    436             return 0;
    437 
    438           if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE)
    439             return 0;
    440 
    441           size = ne_header.rname_tab_offset - ne_header.resource_tab_offset;
     442     { /* ICONHEADER.idType, must be 1 */
     443       *retptr = (LPBYTE)-1;
     444       return 1;
     445     }
     446     else
     447       return 0; /* failed */
     448   }
     449   _llseek( hFile, mz_header.e_lfanew, SEEK_SET );
     450
     451   if (_lread( hFile, magic, sizeof(magic) ) != sizeof(magic))
     452     return 0;
     453
     454   _llseek( hFile, mz_header.e_lfanew, SEEK_SET);
     455
     456   if (*(DWORD*)magic  == IMAGE_NT_SIGNATURE)
     457     return IMAGE_NT_SIGNATURE;
     458
     459   if (*(WORD*)magic == IMAGE_OS2_SIGNATURE)
     460   { IMAGE_OS2_HEADER                    ne_header;
     461     LPBYTE    pTypeInfo = (LPBYTE)-1;
     462
     463     if (_lread(hFile,&ne_header,sizeof(ne_header))!=sizeof(ne_header))
     464       return 0;
     465
     466     if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE)
     467       return 0;
     468
     469     size = ne_header.rname_tab_offset - ne_header.resource_tab_offset;
    442470
    443471//@@@PH no NE support
    444472#if 0
    445           if( size > sizeof(NE_TYPEINFO) )
    446           { pTypeInfo = (BYTE*)HeapAlloc( GetProcessHeap(), 0, size);
    447             if( pTypeInfo )
    448             { _llseek(hFile, mz_header.e_lfanew+ne_header.resource_tab_offset, SEEK_SET);
    449               if( _lread( hFile, (char*)pTypeInfo, size) != size )
    450               { HeapFree( GetProcessHeap(), 0, pTypeInfo);
    451                 pTypeInfo = NULL;
    452               }
    453             }
    454           }
     473     if( size > sizeof(NE_TYPEINFO) )
     474     { pTypeInfo = (BYTE*)HeapAlloc( GetProcessHeap(), 0, size);
     475       if( pTypeInfo )
     476       { _llseek(hFile, mz_header.e_lfanew+ne_header.resource_tab_offset, SEEK_SET);
     477         if( _lread( hFile, (char*)pTypeInfo, size) != size )
     478         { HeapFree( GetProcessHeap(), 0, pTypeInfo);
     479      pTypeInfo = NULL;
     480         }
     481       }
     482     }
    455483#endif
    456484
    457           *retptr = pTypeInfo;
    458           return IMAGE_OS2_SIGNATURE;
    459         }
    460         return 0; /* failed */
    461 }
    462 
    463 
    464 /*************************************************************************
    465  *                              ExtractAssociatedIcon   [SHELL.36]
     485     *retptr = pTypeInfo;
     486     return IMAGE_OS2_SIGNATURE;
     487   }
     488   return 0; /* failed */
     489}
     490
     491
     492/*************************************************************************
     493 *          ExtractAssociatedIcon        [SHELL.36]
    466494 *
    467495 * Return icon for given file (either from file itself or from associated
    468496 * executable) and patch parameters if needed.
    469497 */
    470 HICON WINAPI ExtractAssociatedIconA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD lpiIcon)
    471 {       TRACE_(shell)("\n");
    472         HICON hIcon;
    473 
    474         hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
    475 
    476         if( hIcon < 2 )
    477         { if( hIcon == 1 ) /* no icons found in given file */
    478           { char  tempPath[0x104];
    479             UINT16  uRet = FindExecutableA(lpIconPath,NULL,tempPath);
    480 
    481             if( uRet > 32 && tempPath[0] )
    482             { strcpy(lpIconPath,tempPath);
    483               hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
    484               if( hIcon > 2 )
    485                 return hIcon;
    486             }
    487             else hIcon = 0;
    488           }
    489 
    490           if( hIcon == 1 )
    491             *lpiIcon = 2;   /* MSDOS icon - we found .exe but no icons in it */
    492           else
    493             *lpiIcon = 6;   /* generic icon - found nothing */
    494 
    495           GetModuleFileNameA(hInst, lpIconPath, 0x80);
    496           hIcon = LoadIconA( hInst, (LPCSTR)*lpiIcon);
    497         }
    498         return hIcon;
    499 }
     498ODINFUNCTION3(HICON,     ExtractAssociatedIconA,
     499              HINSTANCE, hInst,
     500              LPSTR,     lpIconPath,
     501              LPWORD,    lpiIcon)
     502{
     503   HICON hIcon;
     504
     505   hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
     506
     507   if( hIcon < 2 )
     508   { if( hIcon == 1 ) /* no icons found in given file */
     509     { char  tempPath[0x104];
     510       UINT16  uRet = FindExecutableA(lpIconPath,NULL,tempPath);
     511
     512       if( uRet > 32 && tempPath[0] )
     513       { strcpy(lpIconPath,tempPath);
     514         hIcon = ExtractIconA(hInst, lpIconPath, *lpiIcon);
     515         if( hIcon > 2 )
     516           return hIcon;
     517       }
     518       else hIcon = 0;
     519     }
     520
     521     if( hIcon == 1 )
     522       *lpiIcon = 2;   /* MSDOS icon - we found .exe but no icons in it */
     523     else
     524       *lpiIcon = 6;   /* generic icon - found nothing */
     525
     526     GetModuleFileNameA(hInst, lpIconPath, 0x80);
     527     hIcon = LoadIconA( hInst, (LPCSTR)*lpiIcon);
     528   }
     529   return hIcon;
     530}
     531
  • trunk/src/shell32/shell32.def

    r1214 r1353  
    1 ; $Id: shell32.def,v 1.15 1999-10-09 11:13:21 sandervl Exp $
     1; $Id: shell32.def,v 1.16 1999-10-19 10:23:27 phaller Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    200200    ExtractIconExA                    = _ExtractIconExA@20                    @190
    201201    ExtractIconExW                    = _ExtractIconExW@20                    @191
    202     ExtractIconResInfoA               = _ExtractIconResInfoA@0                @192
    203     ExtractIconResInfoW               = _ExtractIconResInfoW@0                @193
     202    ExtractIconResInfoA               = _ExtractIconResInfoA@4                @192
     203    ExtractIconResInfoW               = _ExtractIconResInfoW@4                @193
    204204    ExtractIconW                      = _ExtractIconW@12                      @194
    205205    SHFree                            = _SHFree@4                             @195
     
    229229    FindExecutableW                   = _FindExecutableW@12                   @219
    230230    FreeIconList                      = _FreeIconList@4                       @220
    231     InternalExtractIconListA          = _InternalExtractIconListA@0           @221
    232     InternalExtractIconListW          = _InternalExtractIconListW@0           @222
     231    InternalExtractIconListA          = _InternalExtractIconListA@4           @221
     232    InternalExtractIconListW          = _InternalExtractIconListW@4           @222
    233233;   OpenAs_RunDLL                     = _OpenAs_RunDLL@?                      @223
    234234;   OpenAs_RunDLLA                    = _OpenAs_RunDLLA@?                     @224
  • trunk/src/shell32/shellole.cpp

    r1215 r1353  
    1 /* $Id: shellole.cpp,v 1.2 1999-10-09 11:17:05 sandervl Exp $ */
     1/* $Id: shellole.cpp,v 1.3 1999-10-19 10:23:27 phaller Exp $ */
     2
    23/*
    3  *      handling of SHELL32.DLL OLE-Objects
    4  *
    5  *      Copyright 1997  Marcus Meissner
    6  *      Copyright 1998  Juergen Schmied  <juergen.schmied@metronet.de>
    7  *
    8  */
     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 * handling of SHELL32.DLL OLE-Objects
     10 *
     11 * Copyright 1997 Marcus Meissner
     12 * Copyright 1998 Juergen Schmied  <juergen.schmied@metronet.de>
     13 *
     14 */
     15
     16
     17/*****************************************************************************
     18 * Includes                                                                  *
     19 *****************************************************************************/
     20
     21#include <odin.h>
     22#include <odinwrap.h>
     23#include <os2sel.h>
    924
    1025#include <stdlib.h>
    1126#include <string.h>
    12 #include <odin.h>
    1327
    1428#define ICOM_CINTERFACE 1
     
    3347#include <misc.h>
    3448
    35 DEFAULT_DEBUG_CHANNEL(shell)
     49
     50/*****************************************************************************
     51 * Implementation                                                            *
     52 *****************************************************************************/
     53
     54ODINDEBUGCHANNEL(SHELL32-SHELLOLE)
     55
    3656
    3757DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id);
     
    4363 *     exported by ordinal
    4464 */
    45 LRESULT WINAPI SHCoCreateInstance(
    46         LPSTR aclsid,
    47         REFCLSID clsid,
    48         IUnknown * unknownouter,
    49         REFIID refiid,
    50         LPVOID *ppv)
    51 {
    52         char    xclsid[48], xiid[48], xuout[48];
    53         DWORD   hres;
    54         IID     iid;
    55         CLSID * myclsid = (CLSID*)clsid;
    56        
    57         WINE_StringFromCLSID(refiid,xiid);
    58 
    59         if (!clsid)
    60         {
    61           if (!aclsid) return REGDB_E_CLASSNOTREG;
    62           SHCLSIDFromStringA(aclsid, &iid);
    63           myclsid = &iid;
    64         }
    65 
    66         WINE_StringFromCLSID(myclsid,xclsid);
    67         WINE_StringFromCLSID(refiid,xiid);
    68         if (unknownouter)
    69                 WINE_StringFromCLSID((const CLSID*)unknownouter,xuout);
    70        
    71         TRACE("(%p,\n\tCLSID:\t%s\n\tUOUT:\t%s\n\tIID:\t%s,%p)\n",
    72                 aclsid,xclsid,unknownouter?xuout:"nil",xiid,ppv);
    73 
    74         hres = CoCreateInstance(myclsid, NULL, CLSCTX_INPROC_SERVER, refiid, ppv);
    75 
    76         if(hres!=S_OK)
    77         {
    78           ERR("failed (0x%08lx) to create \n\tCLSID:\t%s\n\tIID:\t%s\n", hres, xclsid, xiid);
    79           ERR("you might need to import the winedefault.reg\n");
    80         }
    81 
    82         return hres;
     65
     66ODINFUNCTION5(LRESULT, SHCoCreateInstance, LPSTR,     aclsid,
     67                                           REFCLSID,  clsid,
     68                                           IUnknown*, unknownouter,
     69                                           REFIID,    refiid,
     70                                           LPVOID*,   ppv)
     71{
     72   char  xclsid[48], xiid[48], xuout[48];
     73   DWORD hres;
     74   IID   iid;
     75   CLSID * myclsid = (CLSID*)clsid;
     76
     77   WINE_StringFromCLSID(refiid,xiid);
     78
     79   if (!clsid)
     80   {
     81     if (!aclsid) return REGDB_E_CLASSNOTREG;
     82     SHCLSIDFromStringA(aclsid, &iid);
     83     myclsid = &iid;
     84   }
     85
     86   WINE_StringFromCLSID(myclsid,xclsid);
     87   WINE_StringFromCLSID(refiid,xiid);
     88   if (unknownouter)
     89      WINE_StringFromCLSID((const CLSID*)unknownouter,xuout);
     90
     91   dprintf(("SHELL32:SHCoCreateInstance (%p,CLSID:%s UOUT:%s IID:%s,%p)\n",
     92            aclsid,
     93            xclsid,
     94            unknownouter?xuout:"nil",xiid,ppv));
     95
     96   hres = CoCreateInstance(myclsid, NULL, CLSCTX_INPROC_SERVER, refiid, ppv);
     97
     98   if(hres!=S_OK)
     99   {
     100     dprintf(("SHELL32:SHCoCreateInstance failed (0x%08lx) to create CLSID:%s IID:%s\n",
     101              hres,
     102              xclsid,
     103              xiid));
     104     dprintf(("SHELL32:SHCoCreateInstance you might need to import the winedefault.reg\n"));
     105   }
     106
     107   return hres;
    83108}
    84109
     
    86111 * SHELL32_DllGetClassObject   [SHELL32.128]
    87112 */
    88 HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
    89 {       HRESULT hres = E_OUTOFMEMORY;
    90         LPCLASSFACTORY lpclf;
    91 
    92         char xclsid[50],xiid[50];
    93         WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
    94         WINE_StringFromCLSID((LPCLSID)iid,xiid);
    95         TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n",xclsid,xiid);
    96        
    97         *ppv = NULL;
    98 
    99         if(IsEqualCLSID(rclsid, &CLSID_PaperBin))
    100         {
    101           ERR("paper bin not implemented\n");
    102           return CLASS_E_CLASSNOTAVAILABLE;
    103         }
    104         if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)||
    105            IsEqualCLSID(rclsid, &CLSID_ShellLink))
    106         {
    107           lpclf = IClassFactory_Constructor( rclsid );
    108 
    109           if(lpclf)
    110           {
    111             hres = IClassFactory_QueryInterface(lpclf,iid, ppv);
    112             IClassFactory_Release(lpclf);
    113           }
    114         }
    115         else
    116         {
    117           WARN("-- CLSID not found\n");
    118           hres = CLASS_E_CLASSNOTAVAILABLE;
    119         }
    120         TRACE("-- pointer to class factory: %p\n",*ppv);
    121         return hres;
     113
     114ODINFUNCTION3(HRESULT, SHELL32_DllGetClassObject, REFCLSID, rclsid,
     115                                                  REFIID,   iid,
     116                                                  LPVOID*,  ppv)
     117{
     118   HRESULT  hres = E_OUTOFMEMORY;
     119   LPCLASSFACTORY lpclf;
     120
     121   char xclsid[50],xiid[50];
     122   WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
     123   WINE_StringFromCLSID((LPCLSID)iid,xiid);
     124   dprintf(("SHELL32:SHELL32_DllGetClassObject CLSID:%s, IID:%s\n",
     125            xclsid,
     126            xiid));
     127
     128   *ppv = NULL;
     129
     130   if(IsEqualCLSID(rclsid, &CLSID_PaperBin))
     131   {
     132     dprintf(("SHELL32:SHELL32_DllGetClassObject paper bin not implemented\n"));
     133     return CLASS_E_CLASSNOTAVAILABLE;
     134   }
     135   if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)||
     136      IsEqualCLSID(rclsid, &CLSID_ShellLink))
     137   {
     138     lpclf = IClassFactory_Constructor( rclsid );
     139
     140     if(lpclf)
     141     {
     142       hres = IClassFactory_QueryInterface(lpclf,iid, ppv);
     143       IClassFactory_Release(lpclf);
     144     }
     145   }
     146   else
     147   {
     148     dprintf(("SHELL32:SHELL32_DllGetClassObject -- CLSID not found\n"));
     149     hres = CLASS_E_CLASSNOTAVAILABLE;
     150   }
     151   dprintf(("SHELL32:SHELL32_DllGetClassObject -- pointer to class factory: %p\n",
     152            *ppv));
     153   return hres;
    122154}
    123155
    124156/*************************************************************************
    125  * SHCLSIDFromString                            [SHELL32.147]
     157 * SHCLSIDFromString                              [SHELL32.147]
    126158 *
    127159 * NOTES
    128160 *     exported by ordinal
    129161 */
    130 DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id)
    131 {
    132         TRACE("(%p(%s) %p)\n", clsid, clsid, id);
    133         return CLSIDFromStringA(clsid, id);
    134 }
    135 DWORD WINAPI SHCLSIDFromStringW (LPWSTR clsid, CLSID *id)
    136 {
    137         TRACE("(%p(%s) %p)\n", clsid, debugstr_w(clsid), id);
    138         return CLSIDFromString(clsid, id);
    139 }
    140 DWORD WINAPI SHCLSIDFromStringAW (LPVOID clsid, CLSID *id)
    141 {
    142         if (VERSION_OsIsUnicode())
    143           return SHCLSIDFromStringW ((LPWSTR)clsid, id);
    144         return SHCLSIDFromStringA ((LPSTR)clsid, id);
    145 }
     162ODINFUNCTION2(DWORD, SHCLSIDFromStringA, LPSTR,  clsid,
     163                                         CLSID*, id)
     164{
     165   return CLSIDFromStringA(clsid, id);
     166}
     167
     168
     169ODINFUNCTION2(DWORD, SHCLSIDFromStringW, LPWSTR, clsid,
     170                                         CLSID*, id)
     171{
     172   return CLSIDFromString(clsid, id);
     173}
     174
     175
     176ODINFUNCTION2(DWORD, SHCLSIDFromStringAW, LPVOID, clsid,
     177                                          CLSID*, id)
     178{
     179   if (VERSION_OsIsUnicode())
     180     return SHCLSIDFromStringW ((LPWSTR)clsid, id);
     181   return SHCLSIDFromStringA ((LPSTR)clsid, id);
     182}
     183
    146184
    147185/*************************************************************************
    148  *                       SHGetMalloc                    [SHELL32.220]
     186 *        SHGetMalloc                          [SHELL32.220]
    149187 * returns the interface to shell malloc.
    150188 *
     
    155193 * heap (ProcessHeap).
    156194 */
    157 DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal)
    158 {
    159         TRACE("(%p)\n", lpmal);
    160         return CoGetMalloc(0,lpmal);
    161 }
     195
     196ODINFUNCTION1(DWORD, SHGetMalloc, LPMALLOC*, lpmal)
     197{
     198  return CoGetMalloc(0,lpmal);
     199}
     200
    162201
    163202/*************************************************************************
    164  * SHGetDesktopFolder                   [SHELL32.216]
     203 * SHGetDesktopFolder                          [SHELL32.216]
    165204 */
    166205LPSHELLFOLDER pdesktopfolder=NULL;
    167206
    168 DWORD WINAPI SHGetDesktopFolder(IShellFolder **psf)
    169 {
    170         HRESULT hres = S_OK;
    171         LPCLASSFACTORY lpclf;
    172         TRACE_(shell)("%p->(%p)\n",psf,*psf);
    173 
    174         *psf=NULL;
    175 
    176         if (!pdesktopfolder)
    177         {
    178           lpclf = IClassFactory_Constructor(&CLSID_ShellDesktop);
    179           if(lpclf)
    180           {
    181             hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (LPVOID*)&pdesktopfolder);
    182             IClassFactory_Release(lpclf);
    183           }
    184         }
    185        
    186         if (pdesktopfolder)
    187         {
    188           /* even if we create the folder, add a ref so the application canŽt destroy the folder*/
    189           IShellFolder_AddRef(pdesktopfolder);
    190           *psf = pdesktopfolder;
    191         }
    192 
    193         TRACE_(shell)("-- %p->(%p)\n",psf, *psf);
    194         return hres;
     207ODINFUNCTION1(DWORD, SHGetDesktopFolder, IShellFolder**, psf)
     208{
     209   HRESULT  hres = S_OK;
     210   LPCLASSFACTORY lpclf;
     211   dprintf(("SHELL32: SHGetDesktopFolder %p->(%p)\n",psf,*psf));
     212
     213   *psf=NULL;
     214
     215   if (!pdesktopfolder)
     216   {
     217     lpclf = IClassFactory_Constructor(&CLSID_ShellDesktop);
     218     if(lpclf)
     219     {
     220       hres = IClassFactory_CreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (LPVOID*)&pdesktopfolder);
     221       IClassFactory_Release(lpclf);
     222     }
     223   }
     224
     225   if (pdesktopfolder)
     226   {
     227     /* even if we create the folder, add a ref so the application canŽt destroy the folder*/
     228     IShellFolder_AddRef(pdesktopfolder);
     229     *psf = pdesktopfolder;
     230   }
     231
     232   dprintf(("SHELL32: SHGetDesktopFolder-- %p->(%p)\n",psf, *psf));
     233   return hres;
    195234}
    196235
     
    204243    ICOM_VTABLE(IClassFactory)* lpvtbl;
    205244    DWORD                       ref;
    206     CLSID                       *rclsid;
     245    CLSID         *rclsid;
    207246} IClassFactoryImpl;
    208247
     
    215254  LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
    216255{
    217         ICOM_THIS(IClassFactoryImpl,iface);
    218         char    xriid[50];
    219         WINE_StringFromCLSID((LPCLSID)riid,xriid);
    220         TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
    221 
    222         *ppvObj = NULL;
    223 
    224         if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    225         { *ppvObj = This;
    226         }
    227         else if(IsEqualIID(riid, &IID_IClassFactory))  /*IClassFactory*/
    228         { *ppvObj = (IClassFactory*)This;
    229         }
    230 
    231         if(*ppvObj)
    232         { IUnknown_AddRef((LPUNKNOWN)*ppvObj);         
    233           TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
    234           return S_OK;
    235         }
    236         TRACE("-- Interface: %s E_NOINTERFACE\n", xriid);
    237         return E_NOINTERFACE;
     256   ICOM_THIS(IClassFactoryImpl,iface);
     257   char  xriid[50];
     258   WINE_StringFromCLSID((LPCLSID)riid,xriid);
     259
     260   dprintf(("SHELL32: IClassFactory_fnQueryInterface (%p)->(\n\tIID:\t%s)\n",This,xriid));
     261
     262   *ppvObj = NULL;
     263
     264   if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
     265   { *ppvObj = This;
     266   }
     267   else if(IsEqualIID(riid, &IID_IClassFactory))  /*IClassFactory*/
     268   { *ppvObj = (IClassFactory*)This;
     269   }
     270
     271   if(*ppvObj)
     272   { IUnknown_AddRef((LPUNKNOWN)*ppvObj);
     273     dprintf(("SHELL32: IClassFactory_fnQueryInterface -- Interface: (%p)->(%p)\n",ppvObj,*ppvObj));
     274     return S_OK;
     275   }
     276   dprintf(("SHELL32: IClassFactory_fnQueryInterface -- Interface: %s E_NOINTERFACE\n", xriid));
     277   return E_NOINTERFACE;
    238278}
    239279/******************************************************************************
     
    242282static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
    243283{
    244         ICOM_THIS(IClassFactoryImpl,iface);
    245         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    246 
    247         shell32_ObjCount++;
    248         return ++(This->ref);
     284   ICOM_THIS(IClassFactoryImpl,iface);
     285   dprintf(("SHELL32: IClassFactory_fnAddRef (%p)->(count=%lu)\n",This,This->ref));
     286
     287   shell32_ObjCount++;
     288   return ++(This->ref);
    249289}
    250290/******************************************************************************
     
    253293static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
    254294{
    255         ICOM_THIS(IClassFactoryImpl,iface);
    256         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    257 
    258         shell32_ObjCount--;
    259         if (!--(This->ref))
    260         { TRACE("-- destroying IClassFactory(%p)\n",This);
    261                 HeapFree(GetProcessHeap(),0,This);
    262                 return 0;
    263         }
    264         return This->ref;
     295   ICOM_THIS(IClassFactoryImpl,iface);
     296   dprintf(("SHELL32: IClassFactory_fnRelease (%p)->(count=%lu)\n",This,This->ref));
     297
     298   shell32_ObjCount--;
     299   if (!--(This->ref))
     300   { dprintf(("SHELL32: IClassFactory_fnRelease -- destroying IClassFactory(%p)\n",This));
     301      HeapFree(GetProcessHeap(),0,This);
     302      return 0;
     303   }
     304   return This->ref;
    265305}
    266306/******************************************************************************
     
    270310  LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
    271311{
    272         ICOM_THIS(IClassFactoryImpl,iface);
    273         IUnknown *pObj = NULL;
    274         HRESULT hres;
    275         char    xriid[50];
    276 
    277         WINE_StringFromCLSID((LPCLSID)riid,xriid);
    278         TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
    279 
    280         *ppObject = NULL;
    281                
    282         if(pUnknown)
    283         {
    284           return(CLASS_E_NOAGGREGATION);
    285         }
    286 
    287         if (IsEqualCLSID(This->rclsid, &CLSID_ShellDesktop))
    288         {
    289           pObj = (IUnknown *)ISF_Desktop_Constructor();
    290         }
    291         else if (IsEqualCLSID(This->rclsid, &CLSID_ShellLink))
    292         {
    293           pObj = (IUnknown *)IShellLink_Constructor(FALSE);
    294         }
    295         else
    296         {
    297           ERR("unknown IID requested\n\tIID:\t%s\n",xriid);
    298           return(E_NOINTERFACE);
    299         }
    300        
    301         if (!pObj)
    302         {
    303           return(E_OUTOFMEMORY);
    304         }
    305        
    306         hres = IUnknown_QueryInterface(pObj,riid, ppObject);
    307         IUnknown_Release(pObj);
    308 
    309         TRACE("-- Object created: (%p)->%p\n",This,*ppObject);
    310 
    311         return hres;
     312   ICOM_THIS(IClassFactoryImpl,iface);
     313   IUnknown *pObj = NULL;
     314   HRESULT hres;
     315   char  xriid[50];
     316
     317   WINE_StringFromCLSID((LPCLSID)riid,xriid);
     318   dprintf(("SHELL32: IClassFactory_fnCreateInstance %p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject));
     319
     320   *ppObject = NULL;
     321
     322   if(pUnknown)
     323   {
     324     return(CLASS_E_NOAGGREGATION);
     325   }
     326
     327   if (IsEqualCLSID(This->rclsid, &CLSID_ShellDesktop))
     328   {
     329     pObj = (IUnknown *)ISF_Desktop_Constructor();
     330   }
     331   else if (IsEqualCLSID(This->rclsid, &CLSID_ShellLink))
     332   {
     333     pObj = (IUnknown *)IShellLink_Constructor(FALSE);
     334   }
     335   else
     336   {
     337     dprintf(("SHELL32: IClassFactory_fnCreateInstance unknown IID requested\n\tIID:\t%s\n",xriid));
     338     return(E_NOINTERFACE);
     339   }
     340
     341   if (!pObj)
     342   {
     343     return(E_OUTOFMEMORY);
     344   }
     345
     346   hres = IUnknown_QueryInterface(pObj,riid, ppObject);
     347   IUnknown_Release(pObj);
     348
     349   dprintf(("SHELL32: IClassFactory_fnCreateInstance -- Object created: (%p)->%p\n",This,*ppObject));
     350
     351   return hres;
    312352}
    313353/******************************************************************************
     
    316356static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
    317357{
    318         ICOM_THIS(IClassFactoryImpl,iface);
    319         TRACE("%p->(0x%x), not implemented\n",This, fLock);
    320         return E_NOTIMPL;
     358   ICOM_THIS(IClassFactoryImpl,iface);
     359   dprintf(("SHELL32: IClassFactory_fnLockServer %p->(0x%x), not implemented\n",This, fLock));
     360   return E_NOTIMPL;
    321361}
    322362
     
    337377LPCLASSFACTORY IClassFactory_Constructor(REFCLSID rclsid)
    338378{
    339         IClassFactoryImpl* lpclf;
    340 
    341         lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
    342         lpclf->ref = 1;
    343         lpclf->lpvtbl = &clfvt;
    344         lpclf->rclsid = (CLSID*)rclsid;
    345 
    346         TRACE("(%p)->()\n",lpclf);
    347         shell32_ObjCount++;
    348         return (LPCLASSFACTORY)lpclf;
     379   IClassFactoryImpl* lpclf;
     380
     381   lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
     382   lpclf->ref = 1;
     383   lpclf->lpvtbl = &clfvt;
     384   lpclf->rclsid = (CLSID*)rclsid;
     385
     386   dprintf(("SHELL32: IClassFactory_Constructor (%p)->()\n",lpclf));
     387   shell32_ObjCount++;
     388   return (LPCLASSFACTORY)lpclf;
    349389}
    350390
     
    366406    ICOM_VTABLE(IClassFactory)* lpvtbl;
    367407    DWORD                       ref;
    368     CLSID                       *rclsid;
    369     LPFNCREATEINSTANCE          lpfnCI;
    370     const IID *                 riidInst;
    371     UINT *                      pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */
     408    CLSID         *rclsid;
     409    LPFNCREATEINSTANCE                      lpfnCI;
     410    const IID *                             riidInst;
     411    UINT *        pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */
    372412} IDefClFImpl;
    373413
     
    380420  LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
    381421{
    382         ICOM_THIS(IDefClFImpl,iface);
    383         char    xriid[50];
    384         WINE_StringFromCLSID((LPCLSID)riid,xriid);
    385         TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);
    386 
    387         *ppvObj = NULL;
    388 
    389         if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    390         { *ppvObj = This;
    391         }
    392         else if(IsEqualIID(riid, &IID_IClassFactory))  /*IClassFactory*/
    393         { *ppvObj = (IClassFactory*)This;
    394         }
    395 
    396         if(*ppvObj)
    397         { IUnknown_AddRef((LPUNKNOWN)*ppvObj);         
    398           TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
    399           return S_OK;
    400         }
    401         TRACE("-- Interface: %s E_NOINTERFACE\n", xriid);
    402         return E_NOINTERFACE;
     422   ICOM_THIS(IDefClFImpl,iface);
     423   char  xriid[50];
     424   WINE_StringFromCLSID((LPCLSID)riid,xriid);
     425   dprintf(("SHELL32: IDefClF_fnQueryInterface (%p)->(\n\tIID:\t%s)\n",This,xriid));
     426
     427   *ppvObj = NULL;
     428
     429   if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
     430   { *ppvObj = This;
     431   }
     432   else if(IsEqualIID(riid, &IID_IClassFactory))  /*IClassFactory*/
     433   { *ppvObj = (IClassFactory*)This;
     434   }
     435
     436   if(*ppvObj)
     437   { IUnknown_AddRef((LPUNKNOWN)*ppvObj);
     438     dprintf(("SHELL32: IDefClF_fnQueryInterface -- Interface: (%p)->(%p)\n",ppvObj,*ppvObj));
     439     return S_OK;
     440   }
     441   dprintf(("SHELL32: IDefClF_fnQueryInterface -- Interface: %s E_NOINTERFACE\n", xriid));
     442   return E_NOINTERFACE;
    403443}
    404444/******************************************************************************
     
    407447static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface)
    408448{
    409         ICOM_THIS(IDefClFImpl,iface);
    410         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    411 
    412         shell32_ObjCount++;
    413 
    414         return ++(This->ref);
     449   ICOM_THIS(IDefClFImpl,iface);
     450   dprintf(("SHELL32: IDefClF_fnAddRef (%p)->(count=%lu)\n",This,This->ref));
     451
     452   shell32_ObjCount++;
     453
     454   return ++(This->ref);
    415455}
    416456/******************************************************************************
     
    419459static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface)
    420460{
    421         ICOM_THIS(IDefClFImpl,iface);
    422         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    423 
    424         shell32_ObjCount--;
    425 
    426         if (!--(This->ref))
    427         {
    428           if (This->pcRefDll)
    429             (*This->pcRefDll)--;
    430 
    431           TRACE("-- destroying IClassFactory(%p)\n",This);
    432           HeapFree(GetProcessHeap(),0,This);
    433           return 0;
    434         }
    435         return This->ref;
     461   ICOM_THIS(IDefClFImpl,iface);
     462   dprintf(("SHELL32: IDefClF_fnRelease (%p)->(count=%lu)\n",This,This->ref));
     463
     464   shell32_ObjCount--;
     465
     466   if (!--(This->ref))
     467   {
     468     if (This->pcRefDll)
     469       (*This->pcRefDll)--;
     470
     471     dprintf(("SHELL32: IDefClF_fn -- destroying IClassFactory(%p)\n",This));
     472     HeapFree(GetProcessHeap(),0,This);
     473     return 0;
     474   }
     475   return This->ref;
    436476}
    437477/******************************************************************************
     
    441481  LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
    442482{
    443         ICOM_THIS(IDefClFImpl,iface);
    444         char    xriid[50];
    445 
    446         WINE_StringFromCLSID((LPCLSID)riid,xriid);
    447         TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnkOuter,xriid,ppvObject);
    448 
    449         *ppvObject = NULL;
    450                
    451         if(pUnkOuter)
    452           return(CLASS_E_NOAGGREGATION);
    453 
    454         if ( This->riidInst==NULL ||
    455              IsEqualCLSID(riid, This->riidInst) ||
    456              IsEqualCLSID(riid, &IID_IUnknown) )
    457         {
    458           return This->lpfnCI(pUnkOuter, riid, ppvObject);
    459         }
    460 
    461         ERR("unknown IID requested\n\tIID:\t%s\n",xriid);
    462         return E_NOINTERFACE;
     483   ICOM_THIS(IDefClFImpl,iface);
     484   char  xriid[50];
     485
     486   WINE_StringFromCLSID((LPCLSID)riid,xriid);
     487   dprintf(("SHELL32: IDefClF_fnCreateInterface %p->(%p,\n\tIID:\t%s,%p)\n",This,pUnkOuter,xriid,ppvObject));
     488
     489   *ppvObject = NULL;
     490
     491   if(pUnkOuter)
     492     return(CLASS_E_NOAGGREGATION);
     493
     494   if ( This->riidInst==NULL ||
     495        IsEqualCLSID(riid, This->riidInst) ||
     496        IsEqualCLSID(riid, &IID_IUnknown) )
     497   {
     498     return This->lpfnCI(pUnkOuter, riid, ppvObject);
     499   }
     500
     501   dprintf(("SHELL32: IDefClF_fn unknown IID requested\n\tIID:\t%s\n",xriid));
     502   return E_NOINTERFACE;
    463503}
    464504/******************************************************************************
     
    467507static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
    468508{
    469         ICOM_THIS(IDefClFImpl,iface);
    470         TRACE("%p->(0x%x), not implemented\n",This, fLock);
    471         return E_NOTIMPL;
     509   ICOM_THIS(IDefClFImpl,iface);
     510   dprintf(("SHELL32: IDefClF_fnLockServer %p->(0x%x), not implemented\n",This, fLock));
     511   return E_NOTIMPL;
    472512}
    473513
     
    488528IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, UINT * pcRefDll, REFIID riidInst)
    489529{
    490         IDefClFImpl* lpclf;
    491         char    xriidInst[50];
    492 
    493         WINE_StringFromCLSID((LPCLSID)riidInst,xriidInst);
    494 
    495         lpclf = (IDefClFImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
    496         lpclf->ref = 1;
    497         lpclf->lpvtbl = &dclfvt;
    498         lpclf->lpfnCI = lpfnCI;
    499         lpclf->pcRefDll = pcRefDll;
    500 
    501         if (pcRefDll)
    502           (*pcRefDll)++;
    503 
    504         lpclf->riidInst = riidInst;
    505 
    506         TRACE("(%p)\n\tIID:\t%s\n",lpclf, xriidInst);
    507         shell32_ObjCount++;
    508         return (LPCLASSFACTORY)lpclf;
    509 }
    510 
    511 
    512 /******************************************************************************
    513  * SHCreateDefClassObject                       [SHELL32.70]
    514  */
    515 HRESULT WINAPI SHCreateDefClassObject(
    516         REFIID  riid,                           
    517         LPVOID* ppv,   
    518         LPFNCREATEINSTANCE lpfnCI,      /* create instance callback entry */
    519         UINT    *pcRefDll,              /* ref count of the dll */
    520         REFIID  riidInst)               /* optional interface to the instance */
    521 {
    522 
    523         char xriid[50],xriidInst[50];
    524         WINE_StringFromCLSID((LPCLSID)riid,xriid);
    525         WINE_StringFromCLSID((LPCLSID)riidInst,xriidInst);
    526 
    527         TRACE("\n\tIID:\t%s %p %p %p \n\tIIDIns:\t%s\n",
    528         xriid, ppv, lpfnCI, pcRefDll, xriidInst);
    529 
    530         if ( IsEqualCLSID(riid, &IID_IClassFactory) )
    531         {
    532           IClassFactory * pcf = IDefClF_fnConstructor(lpfnCI, pcRefDll, riidInst);
    533           if (pcf)
    534           {
    535             *ppv = pcf;
    536             return NOERROR;
    537           }
    538           return E_OUTOFMEMORY;
    539         }
    540         return E_NOINTERFACE;
    541 }
    542 
     530   IDefClFImpl* lpclf;
     531   char  xriidInst[50];
     532
     533   WINE_StringFromCLSID((LPCLSID)riidInst,xriidInst);
     534
     535   lpclf = (IDefClFImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
     536   lpclf->ref = 1;
     537   lpclf->lpvtbl = &dclfvt;
     538   lpclf->lpfnCI = lpfnCI;
     539   lpclf->pcRefDll = pcRefDll;
     540
     541   if (pcRefDll)
     542     (*pcRefDll)++;
     543
     544   lpclf->riidInst = riidInst;
     545
     546   dprintf(("SHELL32: IDefClF_fnConstructor (%p)\n\tIID:\t%s\n",lpclf, xriidInst));
     547   shell32_ObjCount++;
     548   return (LPCLASSFACTORY)lpclf;
     549}
     550
     551
     552/******************************************************************************
     553 * SHCreateDefClassObject                      [SHELL32.70]
     554 */
     555
     556ODINFUNCTION5(HRESULT, SHCreateDefClassObject, REFIID,            riid,
     557                                               LPVOID*,           ppv,
     558                                               LPFNCREATEINSTANCE,lpfnCI,
     559                                               UINT*,             pcRefDll,
     560                                               REFIID,            riidInst)
     561{
     562
     563   char xriid[50],xriidInst[50];
     564   WINE_StringFromCLSID((LPCLSID)riid,xriid);
     565   WINE_StringFromCLSID((LPCLSID)riidInst,xriidInst);
     566
     567   dprintf(("SHELL32: SHCreateDefClassObject \n\tIID:\t%s %p %p %p \n\tIIDIns:\t%s\n",
     568   xriid, ppv, lpfnCI, pcRefDll, xriidInst));
     569
     570   if ( IsEqualCLSID(riid, &IID_IClassFactory) )
     571   {
     572     IClassFactory * pcf = IDefClF_fnConstructor(lpfnCI, pcRefDll, riidInst);
     573     if (pcf)
     574     {
     575       *ppv = pcf;
     576       return NOERROR;
     577     }
     578     return E_OUTOFMEMORY;
     579   }
     580   return E_NOINTERFACE;
     581}
     582
Note: See TracChangeset for help on using the changeset viewer.