- Timestamp:
- Oct 19, 1999, 12:23:27 PM (26 years ago)
- 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 sandervlExp $ */1 /* $Id: misc.cpp,v 1.6 1999-10-19 10:23:26 phaller Exp $ */ 2 2 3 3 /* … … 16 16 17 17 #include <odin.h> 18 #include <odinwrap.h> 19 #include <os2sel.h> 20 18 21 #include <wchar.h> 19 22 #include <wcstr.h> … … 30 33 #include <heapstring.h> 31 34 35 32 36 /***************************************************************************** 33 37 * Types & Defines * 34 38 *****************************************************************************/ 35 39 36 37 /***************************************************************************** 38 * Name : HICON WIN32API ExtractAssociatedIconExA 40 ODINDEBUGCHANNEL(SHELL32-MISC) 41 42 43 /***************************************************************************** 44 * Name : ExtractAssociatedIconExA 39 45 * Purpose : Return icon for given file (either from file itself or from associated 40 46 * executable) and patch parameters if needed. … … 48 54 *****************************************************************************/ 49 55 50 HICON WIN32API ExtractAssociatedIconExA(HINSTANCE hInst, 51 LPSTR lpIconPath, 52 LPWORD lpiIcon) 56 ODINFUNCTION3(HICON, ExtractAssociatedIconExA, 57 HINSTANCE, hInst, 58 LPSTR, lpIconPath, 59 LPWORD, lpiIcon) 53 60 { 54 61 dprintf(("SHELL32: undoc ExtractAssociatedIconExA\n")); … … 58 65 59 66 /***************************************************************************** 60 * Name : HICON WIN32APIExtractAssociatedIconW67 * Name : ExtractAssociatedIconW 61 68 * Purpose : Return icon for given file (either from file itself or from associated 62 69 * executable) and patch parameters if needed. … … 70 77 *****************************************************************************/ 71 78 72 HICON WIN32API ExtractAssociatedIconW(HINSTANCE hInst, 73 LPWSTR lpIconPath, 74 LPWORD lpiIcon) 79 ODINFUNCTION3(HICON, ExtractAssociatedIconW, 80 HINSTANCE, hInst, 81 LPWSTR, lpIconPath, 82 LPWORD, lpiIcon) 75 83 { 76 84 LPSTR lpIconPathAscii = UnicodeToAsciiString(lpIconPath); 77 85 HICON hIcon; 78 79 dprintf(("SHELL32: ExtractAssociatedIconW(%08xh,%s,%08xh)\n",80 hInst,81 lpIconPathAscii,82 lpiIcon));83 86 84 87 hIcon = ExtractAssociatedIconA(hInst, … … 92 95 93 96 /***************************************************************************** 94 * Name : HICON WIN32APIExtractAssociatedIconExW97 * Name : ExtractAssociatedIconExW 95 98 * Purpose : Return icon for given file (either from file itself or from associated 96 99 * executable) and patch parameters if needed. … … 104 107 *****************************************************************************/ 105 108 106 HICON WIN32API ExtractAssociatedIconExW(HINSTANCE hInst, 107 LPWSTR lpIconPath, 108 LPWORD lpiIcon) 109 ODINFUNCTION3(HICON, ExtractAssociatedIconExW, 110 HINSTANCE, hInst, 111 LPWSTR, lpIconPath, 112 LPWORD, lpiIcon) 109 113 { 110 114 dprintf(("SHELL32: undoc ExtractAssociatedIconExW\n")); … … 126 130 *****************************************************************************/ 127 131 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 132 ODINFUNCTION4(BOOL, OleStrToStrN, 133 LPSTR, lpMulti, 134 INT, nMulti, 135 LPCWSTR, lpWide, 136 INT, nWide) 137 { 139 138 return WideCharToMultiByte (0, 140 139 0, … … 160 159 *****************************************************************************/ 161 160 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 161 ODINFUNCTION4(BOOL, StrToOleStrN, 162 LPWSTR, lpWide, 163 INT, nWide, 164 LPCSTR, lpMulti, 165 INT, nMulti) 166 { 173 167 return MultiByteToWideChar (0, 174 168 0, … … 192 186 *****************************************************************************/ 193 187 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 188 ODINFUNCTION4(HRESULT, StrRetToStrN, 189 LPVOID, dest, 190 DWORD, len, 191 LPSTRRET, src, 192 LPITEMIDLIST, pidl) 193 { 205 194 switch (src->uType) 206 195 { … … 262 251 *****************************************************************************/ 263 252 264 HRESULT WIN32API SHELL32_654 (DWORD x, 265 DWORD y) 253 ODINFUNCTION2(HRESULT, SHELL32_654, 254 DWORD, x, 255 DWORD, y) 266 256 { 267 257 dprintf(("SHELL32: SHELL32_654(%08xh,%08xh) not implemented.\n", … … 284 274 *****************************************************************************/ 285 275 286 int WIN32API StrToOleStr (LPWSTR lpWideCharStr, 287 LPCSTR lpMultiByteString) 288 { 289 dprintf(("SHELL32: StrToOleStr(%08xh,%08xh)\n", 290 lpWideCharStr, 291 lpMultiByteString)); 292 276 ODINFUNCTION2(int, StrToOleStr, 277 LPWSTR, lpWideCharStr, 278 LPCSTR, lpMultiByteString) 279 { 293 280 return MultiByteToWideChar(0, 294 281 0, … … 312 299 *****************************************************************************/ 313 300 314 LPWSTR WIN32API StrCpyNW(LPWSTR lpString1,LPWSTR lpString2,int iMaxLength) 301 ODINFUNCTION3(LPWSTR, StrCpyNW, 302 LPWSTR, lpString1, 303 LPWSTR, lpString2, 304 int, iMaxLength) 315 305 { 316 306 dprintf(("SHELL32: undoc StrCpyNW\n")); … … 331 321 *****************************************************************************/ 332 322 333 LPWSTR WIN32API StrNCpyW(LPWSTR lpString1,LPWSTR lpString2) 323 ODINFUNCTION2(LPWSTR, StrNCpyW, 324 LPWSTR, lpString1, 325 LPWSTR, lpString2) 334 326 { 335 327 dprintf(("SHELL32: undoc StrNCpyW\n")); … … 351 343 *****************************************************************************/ 352 344 353 void WIN32API InternalExtractIconListA(VOID)345 ODINFUNCTION1(DWORD, InternalExtractIconListA, DWORD, dwArg1) 354 346 { 355 347 dprintf(("SHELL32: undoc InternalExtractIconListA \n")); 348 return 0; 356 349 } 357 350 … … 368 361 *****************************************************************************/ 369 362 370 void WIN32API InternalExtractIconListW(VOID)363 ODINFUNCTION1(DWORD, InternalExtractIconListW, DWORD, dwArg1) 371 364 { 372 365 dprintf(("SHELL32: undoc InternalExtractIconListW\n")); 366 return 0; 373 367 } 374 368 … … 385 379 *****************************************************************************/ 386 380 387 void WIN32API ExtractIconResInfoA(VOID)381 ODINFUNCTION1(DWORD, ExtractIconResInfoA, DWORD, dwArg1) 388 382 { 389 383 dprintf(("SHELL32: undoc ExtractIconResInfoA\n")); 384 return 0; 390 385 } 391 386 … … 402 397 *****************************************************************************/ 403 398 404 void WIN32API ExtractIconResInfoW(VOID)399 ODINFUNCTION1(DWORD, ExtractIconResInfoW, DWORD, dwArg1) 405 400 { 406 401 dprintf(("SHELL32: undoc ExtractIconResInfoW\n")); 402 return 0; 407 403 } 408 404 … … 442 438 *****************************************************************************/ 443 439 444 void WIN32API CheckEscapesA(DWORD x1,DWORD x2) 440 ODINPROCEDURE2(CheckEscapesA, 441 DWORD, x1, 442 DWORD, x2) 445 443 { 446 444 dprintf(("SHELL32: undoc CheckEscapesA\n")); … … 459 457 *****************************************************************************/ 460 458 461 void WIN32API CheckEscapesW(DWORD x1,DWORD x2) 459 ODINPROCEDURE2(CheckEscapesW, 460 DWORD, x1, 461 DWORD, x2) 462 462 { 463 463 dprintf(("SHELL32: undoc CheckEscapesW\n")); … … 476 476 *****************************************************************************/ 477 477 478 DWORD WIN32API DuplicateIcon(DWORD x1) 478 ODINFUNCTION1(DWORD, DuplicateIcon, 479 DWORD, x1) 479 480 { 480 481 dprintf(("SHELL32: undoc DuplicateIcon\n")); … … 482 483 return 0; 483 484 } 485 -
trunk/src/shell32/sh.cpp
r1214 r1353 1 /* $Id: sh.cpp,v 1. 9 1999-10-09 11:13:20 sandervlExp $ */1 /* $Id: sh.cpp,v 1.10 1999-10-19 10:23:26 phaller Exp $ */ 2 2 3 3 /* … … 11 11 * Includes * 12 12 *****************************************************************************/ 13 14 #include <odin.h> 15 #include <odinwrap.h> 16 #include <os2sel.h> 13 17 14 18 #include <os2win.h> … … 33 37 *****************************************************************************/ 34 38 39 ODINDEBUGCHANNEL(SHELL32-SH) 40 41 35 42 #define LPSHELLVIEWDATA LPVOID 36 43 #define LPUNKNOWN LPVOID … … 54 61 *****************************************************************************/ 55 62 56 LPITEMIDLIST WIN32API SHBrowseForFolder(LPBROWSEINFOA lpbi) 57 { 58 dprintf(("SHELL32: SHBrowseForFolder(%08xh) not implemented.\n", 59 lpbi));63 ODINFUNCTION1(LPITEMIDLIST, SHBrowseForFolder, 64 LPBROWSEINFOA, lpbi) 65 { 66 dprintf(("SHELL32: SHBrowseForFolder not implemented.\n")); 60 67 61 68 //@@@PH automatically decide between A and W … … 77 84 *****************************************************************************/ 78 85 79 LPITEMIDLIST WIN32API SHBrowseForFolderW(LPBROWSEINFOA lpbi) 80 { 81 dprintf(("SHELL32: SHBrowseForFolderW(%08xh) not implemented.\n", 82 lpbi));86 ODINFUNCTION1(LPITEMIDLIST, SHBrowseForFolderW, 87 LPBROWSEINFOA, lpbi) 88 { 89 dprintf(("SHELL32: SHBrowseForFolderW not implemented.\n")); 83 90 84 91 return(NULL); … … 98 105 *****************************************************************************/ 99 106 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)); 107 ODINFUNCTION3(DWORD, SHEmptyRecycleBinA, 108 DWORD, x1, 109 DWORD, x2, 110 DWORD, x3) 111 { 112 dprintf(("SHELL32: SHEmptyRecycleBinA not implemented.\n")); 108 113 109 114 return 0; … … 123 128 *****************************************************************************/ 124 129 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)); 130 ODINFUNCTION3(DWORD, SHEmptyRecycleBinW, 131 DWORD, x1, 132 DWORD, x2, 133 DWORD, x3) 134 { 135 dprintf(("SHELL32: SHEmptyRecycleBinW not implemented.\n")); 133 136 134 137 return 0; … … 148 151 *****************************************************************************/ 149 152 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)); 153 ODINFUNCTION4(DWORD, SHFormatDrive, 154 DWORD, x1, 155 DWORD, x2, 156 DWORD, x3, 157 DWORD, x4) 158 { 159 dprintf(("SHELL32: SHFormatDrive not implemented.\n")); 160 160 161 161 return 0; … … 175 175 *****************************************************************************/ 176 176 177 DWORD WIN32API SHFreeNameMappings(DWORD x1) 178 { 179 dprintf(("SHELL32: SHFreeNameMappings(%08xh) not implemented.\n", 180 x1));177 ODINFUNCTION1(DWORD, SHFreeNameMappings, 178 DWORD, x1) 179 { 180 dprintf(("SHELL32: SHFreeNameMappings not implemented.\n")); 181 181 182 182 return 0; … … 196 196 *****************************************************************************/ 197 197 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)); 198 ODINFUNCTION5(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")); 210 206 211 207 return 0; … … 225 221 *****************************************************************************/ 226 222 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)); 223 ODINFUNCTION4(DWORD, SHHelpShortcuts_RunDLLA, 224 DWORD, x1, 225 DWORD, x2, 226 DWORD, x3, 227 DWORD, x4) 228 { 229 dprintf(("SHELL32: SHHelpShortcuts_RunDLLA not implemented.\n")); 237 230 238 231 return(0); … … 252 245 *****************************************************************************/ 253 246 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)); 247 ODINFUNCTION4(DWORD, SHHelpShortcuts_RunDLLW, 248 DWORD, x1, 249 DWORD, x2, 250 DWORD, x3, 251 DWORD, x4) 252 { 253 dprintf(("SHELL32: SHHelpShortcuts_RunDLLW not implemented.\n")); 264 254 265 255 return(0); … … 279 269 *****************************************************************************/ 280 270 281 DWORD WIN32API SHQueryRecycleBinA(DWORD x1, 282 DWORD x2) 283 { 284 dprintf(("SHELL32: SHQueryRecycleBinA(%08xh,%08xh) not implemented.\n", 285 x1, 286 x2)); 271 ODINFUNCTION2(DWORD, SHQueryRecycleBinA, 272 DWORD, x1, 273 DWORD, x2) 274 { 275 dprintf(("SHELL32: SHQueryRecycleBinA not implemented.\n")); 287 276 288 277 return(0); … … 302 291 *****************************************************************************/ 303 292 304 DWORD WIN32API SHQueryRecycleBinW(DWORD x1, 305 DWORD x2) 306 { 307 dprintf(("SHELL32: SHQueryRecycleBinW(%08xh,%08xh) not implemented.\n", 308 x1, 309 x2)); 293 ODINFUNCTION2(DWORD, SHQueryRecycleBinW, 294 DWORD, x1, 295 DWORD, x2) 296 { 297 dprintf(("SHELL32: SHQueryRecycleBinW not implemented.\n")); 310 298 311 299 return(0); … … 325 313 *****************************************************************************/ 326 314 327 DWORD WIN32API SHUpdateRecycleBinIcon(void)315 ODINFUNCTION0(DWORD, SHUpdateRecycleBinIcon) 328 316 { 329 317 dprintf(("SHELL32: SHUpdateRecycleBinIcon() not implemented.\n")); … … 345 333 *****************************************************************************/ 346 334 347 HRESULT WIN32API SHRegDeleteKeyW (HKEY hkey, 348 LPWSTR lpszKey) 349 { 350 dprintf(("SHELL32: SHRegDeleteKeyW(%08xh,%08xh)\n", 351 hkey, 352 lpszKey)); 353 335 ODINFUNCTION2(HRESULT, SHRegDeleteKeyW, 336 HKEY, hkey, 337 LPWSTR, lpszKey) 338 { 354 339 return RegDeleteKeyW(hkey, 355 340 lpszKey); … … 369 354 *****************************************************************************/ 370 355 371 HRESULT WIN32API SHRegDeleteKeyA (HKEY hkey, 372 LPSTR lpszKey) 373 { 374 dprintf(("SHELL32: SHRegDeleteKeyA(%08xh,%s)\n", 375 hkey, 376 lpszKey)); 377 356 ODINFUNCTION2(HRESULT, SHRegDeleteKeyA, 357 HKEY, hkey, 358 LPSTR, lpszKey) 359 { 378 360 return RegDeleteKeyA(hkey, 379 361 lpszKey); 380 362 } 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 2 3 /* 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 4 10 * 5 11 * 1998 Marcus Meissner 6 12 */ 13 14 15 /***************************************************************************** 16 * Includes * 17 *****************************************************************************/ 18 19 #include <odin.h> 20 #include <odinwrap.h> 21 #include <os2sel.h> 22 7 23 #include <assert.h> 8 24 #include <stdlib.h> … … 10 26 //#include <unistd.h> 11 27 #include <ctype.h> 12 13 #include <odin.h>14 28 15 29 #define ICOM_CINTERFACE 1 … … 38 52 #include <misc.h> 39 53 40 DECLARE_DEBUG_CHANNEL(exec) 41 DECLARE_DEBUG_CHANNEL(shell) 54 55 /***************************************************************************** 56 * Implementation * 57 *****************************************************************************/ 58 59 ODINDEBUGCHANNEL(SHELL32-SHELL) 60 42 61 43 62 /* .ICO file ICONDIR definitions */ … … 47 66 typedef struct 48 67 { 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 */ 51 70 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? */ 57 76 } icoICONDIRENTRY, *LPicoICONDIRENTRY; 58 77 59 78 typedef struct 60 79 { 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? */ 64 83 icoICONDIRENTRY idEntries[1]; /* An entry for each image (idCount of 'em) */ 65 84 } icoICONDIR, *LPicoICONDIR; … … 67 86 #include "poppack.h" 68 87 69 static const char* lpstrMsgWndCreated= "OTHERWINDOWCREATED";70 static const char* lpstrMsgWndDestroyed= "OTHERWINDOWDESTROYED";71 static const char* 72 73 static HWND16 74 static HHOOK 75 static UINT16 76 static UINT16 77 static UINT16 78 HINSTANCE16 88 static const char* lpstrMsgWndCreated = "OTHERWINDOWCREATED"; 89 static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED"; 90 static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW"; 91 92 static HWND16 SHELL_hWnd = 0; 93 static HHOOK SHELL_hHook = 0; 94 static UINT16 uMsgWndCreated = 0; 95 static UINT16 uMsgWndDestroyed = 0; 96 static UINT16 uMsgShellActivate = 0; 97 HINSTANCE16 SHELL_hInstance = 0; 79 98 HINSTANCE SHELL_hInstance32; 80 99 static int SHELL_Attach = 0; … … 82 101 83 102 /************************************************************************* 84 * DragAcceptFiles32 [SHELL32.54] 85 */ 86 void WINAPI DragAcceptFiles(HWND hWnd, BOOL b) 103 * DragAcceptFiles32 [SHELL32.54] 104 */ 105 106 ODINPROCEDURE2(DragAcceptFiles, HWND, hWnd, 107 BOOL, b) 87 108 { 88 109 LONG exstyle; 89 110 90 91 111 if( !IsWindow(hWnd) ) 92 112 return; 93 113 exstyle = GetWindowLongA(hWnd,GWL_EXSTYLE); 94 114 if (b)exstyle |= WS_EX_ACCEPTFILES; 95 else 115 else exstyle &= ~WS_EX_ACCEPTFILES; 96 116 SetWindowLongA(hWnd,GWL_EXSTYLE,exstyle); 97 117 } 98 118 99 119 /************************************************************************* 100 * SHELL_DragQueryFile[internal]120 * SHELL_DragQueryFile [internal] 101 121 * 102 122 */ 103 123 static UINT SHELL_DragQueryFile(LPSTR lpDrop, LPWSTR lpwDrop, UINT lFile, 104 124 LPSTR lpszFile, LPWSTR lpszwFile, UINT lLength) 105 125 { 106 126 UINT i; … … 109 129 if (lpDrop) { 110 130 while (i++ < lFile) { 111 112 113 131 while (*lpDrop++); /* skip filename */ 132 if (!*lpDrop) 133 return (lFile == 0xFFFFFFFF) ? i : 0; 114 134 } 115 135 } 116 136 if (lpwDrop) { 117 137 while (i++ < lFile) { 118 119 120 138 while (*lpwDrop++); /* skip filename */ 139 if (!*lpwDrop) 140 return (lFile == 0xFFFFFFFF) ? i : 0; 121 141 } 122 142 } … … 140 160 141 161 /************************************************************************* 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 165 ODINFUNCTION4(UINT, DragQueryFileA, HDROP, hDrop, 166 UINT, lFile, 167 LPSTR, lpszFile, 168 UINT, lLength) 146 169 { /* hDrop is a global memory block allocated with GMEM_SHARE 147 170 * with DROPFILESTRUCT as a header and filenames following … … 151 174 LPSTR lpCurrent; 152 175 UINT i; 153 154 TRACE_(shell)("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszFile,lLength);155 176 156 177 lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); … … 165 186 166 187 /************************************************************************* 167 * DragQueryFile32W [shell32.133] 168 */ 169 UINT WINAPI DragQueryFileW(HDROP hDrop, UINT lFile, LPWSTR lpszwFile, 170 UINT lLength) 188 * DragQueryFile32W [shell32.133] 189 */ 190 ODINFUNCTION4(UINT, DragQueryFileW, HDROP, hDrop, 191 UINT, lFile, 192 LPWSTR, lpszwFile, 193 UINT, lLength) 171 194 { 172 195 LPDROPFILESTRUCT lpDropFileStruct; 173 196 LPWSTR lpwCurrent; 174 197 UINT i; 175 176 TRACE_(shell)("(%08x, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);177 198 178 199 lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); … … 202 223 *****************************************************************************/ 203 224 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 225 ODINFUNCTION4(UINT, DragQueryFileAorW, 226 HDROP, hDrop, 227 UINT, iFile, 228 LPTSTR, lpszFile, 229 UINT, cch) 230 { 215 231 // @@@PH maybe they want automatic determination here 216 232 if (VERSION_OsIsUnicode()) … … 222 238 223 239 /************************************************************************* 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 */ 242 ODINPROCEDURE1(DragFinish, HDROP, h) 243 { 244 GlobalFree((HGLOBAL)h); 245 } 246 247 248 /************************************************************************* 249 * DragQueryPoint32 [SHELL32.135] 250 */ 251 ODINFUNCTION2(BOOL, DragQueryPoint, 252 HDROP, hDrop, 253 POINT*, p) 236 254 { 237 255 LPDROPFILESTRUCT lpDropFileStruct; 238 256 BOOL bRet; 239 TRACE_(shell)("\n"); 257 240 258 lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop); 241 259 … … 248 266 249 267 /************************************************************************* 250 * 268 * SHELL_FindExecutable [Internal] 251 269 * 252 270 * Utility for code sharing between FindExecutable and ShellExecute … … 267 285 char xlpFile[256]; /* result of SearchPath */ 268 286 269 TRACE_(shell)("%s\n", (lpFile != NULL?lpFile:"-") ); 287 dprintf(("SHELL32:SHELL:SHELL_FindExecutable(%s,%s,%08xh)\n", 288 lpFile, 289 lpOperation, 290 lpResult)); 270 291 271 292 lpResult[0]='\0'; /* Start off with an empty return string */ … … 273 294 /* trap NULL parameters on entry */ 274 295 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)); 277 298 return 2; /* File not found. Close enough, I guess. */ 278 299 } 279 300 280 301 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")); 282 303 lpFile = xlpFile; 283 304 } … … 285 306 /* First thing we need is the file's extension */ 286 307 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)); 290 312 291 313 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")); 293 315 return 31; /* no association */ 294 316 } … … 297 319 lstrcpynA( tmpext, extension, 5 ); 298 320 CharLowerA( tmpext ); 299 TRACE_(shell)("%s file\n", tmpext); 321 322 323 dprintf(("SHELL32:SHELL:SHELL_FindExecutable(%s file)\n", tmpext)); 300 324 301 325 /* Three places to check: */ … … 311 335 * got a lot more to worry about than running a program... */ 312 336 if ( GetProfileStringA("windows", "programs", "exe pif bat com", 313 337 buffer, sizeof(buffer)) > 0 ) 314 338 { for (i=0;i<strlen(buffer); i++) buffer[i]=tolower(buffer[i]); 315 339 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 } 335 360 336 361 /* Check registry */ … … 338 363 &filetypelen ) == ERROR_SUCCESS ) 339 364 { 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, 349 375 &commandlen ) == ERROR_SUCCESS ) 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 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 } 367 393 } 368 394 else /* Check win.ini */ 369 395 { 370 371 372 396 /* Toss the leading dot */ 397 extension++; 398 if ( GetProfileStringA( "extensions", extension, "", command, 373 399 sizeof(command)) > 0) 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 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)); 395 421 return retval; 396 422 } … … 398 424 399 425 /************************************************************************* 400 * 426 * SHELL_GetResourceTable 401 427 */ 402 428 static 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 ? */ 413 441 if (mz_header.e_cblp == 1) 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 { IMAGE_OS2_HEADERne_header;433 LPBYTEpTypeInfo = (LPBYTE)-1;434 435 436 437 438 439 440 441 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; 442 470 443 471 //@@@PH no NE support 444 472 #if 0 445 446 447 448 449 450 451 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 } 455 483 #endif 456 484 457 458 459 460 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] 466 494 * 467 495 * Return icon for given file (either from file itself or from associated 468 496 * executable) and patch parameters if needed. 469 497 */ 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 } 498 ODINFUNCTION3(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.1 5 1999-10-09 11:13:21 sandervlExp $1 ; $Id: shell32.def,v 1.16 1999-10-19 10:23:27 phaller Exp $ 2 2 3 3 ;Created by BLAST for IBM's compiler … … 200 200 ExtractIconExA = _ExtractIconExA@20 @190 201 201 ExtractIconExW = _ExtractIconExW@20 @191 202 ExtractIconResInfoA = _ExtractIconResInfoA@ 0@192203 ExtractIconResInfoW = _ExtractIconResInfoW@ 0@193202 ExtractIconResInfoA = _ExtractIconResInfoA@4 @192 203 ExtractIconResInfoW = _ExtractIconResInfoW@4 @193 204 204 ExtractIconW = _ExtractIconW@12 @194 205 205 SHFree = _SHFree@4 @195 … … 229 229 FindExecutableW = _FindExecutableW@12 @219 230 230 FreeIconList = _FreeIconList@4 @220 231 InternalExtractIconListA = _InternalExtractIconListA@ 0@221232 InternalExtractIconListW = _InternalExtractIconListW@ 0@222231 InternalExtractIconListA = _InternalExtractIconListA@4 @221 232 InternalExtractIconListW = _InternalExtractIconListW@4 @222 233 233 ; OpenAs_RunDLL = _OpenAs_RunDLL@? @223 234 234 ; 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 2 3 /* 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> 9 24 10 25 #include <stdlib.h> 11 26 #include <string.h> 12 #include <odin.h>13 27 14 28 #define ICOM_CINTERFACE 1 … … 33 47 #include <misc.h> 34 48 35 DEFAULT_DEBUG_CHANNEL(shell) 49 50 /***************************************************************************** 51 * Implementation * 52 *****************************************************************************/ 53 54 ODINDEBUGCHANNEL(SHELL32-SHELLOLE) 55 36 56 37 57 DWORD WINAPI SHCLSIDFromStringA (LPSTR clsid, CLSID *id); … … 43 63 * exported by ordinal 44 64 */ 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 66 ODINFUNCTION5(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; 83 108 } 84 109 … … 86 111 * SHELL32_DllGetClassObject [SHELL32.128] 87 112 */ 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 114 ODINFUNCTION3(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; 122 154 } 123 155 124 156 /************************************************************************* 125 * SHCLSIDFromString 157 * SHCLSIDFromString [SHELL32.147] 126 158 * 127 159 * NOTES 128 160 * exported by ordinal 129 161 */ 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 } 162 ODINFUNCTION2(DWORD, SHCLSIDFromStringA, LPSTR, clsid, 163 CLSID*, id) 164 { 165 return CLSIDFromStringA(clsid, id); 166 } 167 168 169 ODINFUNCTION2(DWORD, SHCLSIDFromStringW, LPWSTR, clsid, 170 CLSID*, id) 171 { 172 return CLSIDFromString(clsid, id); 173 } 174 175 176 ODINFUNCTION2(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 146 184 147 185 /************************************************************************* 148 * SHGetMalloc[SHELL32.220]186 * SHGetMalloc [SHELL32.220] 149 187 * returns the interface to shell malloc. 150 188 * … … 155 193 * heap (ProcessHeap). 156 194 */ 157 DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) 158 { 159 TRACE("(%p)\n", lpmal); 160 return CoGetMalloc(0,lpmal); 161 } 195 196 ODINFUNCTION1(DWORD, SHGetMalloc, LPMALLOC*, lpmal) 197 { 198 return CoGetMalloc(0,lpmal); 199 } 200 162 201 163 202 /************************************************************************* 164 * SHGetDesktopFolder 203 * SHGetDesktopFolder [SHELL32.216] 165 204 */ 166 205 LPSHELLFOLDER pdesktopfolder=NULL; 167 206 168 DWORD WINAPI SHGetDesktopFolder(IShellFolder **psf)169 { 170 HRESULThres = S_OK;171 172 TRACE_(shell)("%p->(%p)\n",psf,*psf);173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 TRACE_(shell)("-- %p->(%p)\n",psf, *psf);194 207 ODINFUNCTION1(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; 195 234 } 196 235 … … 204 243 ICOM_VTABLE(IClassFactory)* lpvtbl; 205 244 DWORD ref; 206 CLSID 245 CLSID *rclsid; 207 246 } IClassFactoryImpl; 208 247 … … 215 254 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) 216 255 { 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; 238 278 } 239 279 /****************************************************************************** … … 242 282 static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface) 243 283 { 244 245 TRACE("(%p)->(count=%lu)\n",This,This->ref);246 247 248 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); 249 289 } 250 290 /****************************************************************************** … … 253 293 static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface) 254 294 { 255 256 TRACE("(%p)->(count=%lu)\n",This,This->ref);257 258 259 260 { TRACE("-- destroying IClassFactory(%p)\n",This);261 262 263 264 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; 265 305 } 266 306 /****************************************************************************** … … 270 310 LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) 271 311 { 272 273 274 275 charxriid[50];276 277 278 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 ERR("unknown IID requested\n\tIID:\t%s\n",xriid);298 299 300 301 302 303 304 305 306 307 308 309 TRACE("-- Object created: (%p)->%p\n",This,*ppObject);310 311 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; 312 352 } 313 353 /****************************************************************************** … … 316 356 static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) 317 357 { 318 319 TRACE("%p->(0x%x), not implemented\n",This, fLock);320 358 ICOM_THIS(IClassFactoryImpl,iface); 359 dprintf(("SHELL32: IClassFactory_fnLockServer %p->(0x%x), not implemented\n",This, fLock)); 360 return E_NOTIMPL; 321 361 } 322 362 … … 337 377 LPCLASSFACTORY IClassFactory_Constructor(REFCLSID rclsid) 338 378 { 339 340 341 342 343 344 345 346 TRACE("(%p)->()\n",lpclf);347 348 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; 349 389 } 350 390 … … 366 406 ICOM_VTABLE(IClassFactory)* lpvtbl; 367 407 DWORD ref; 368 CLSID 369 LPFNCREATEINSTANCE 370 const IID * 371 UINT * 408 CLSID *rclsid; 409 LPFNCREATEINSTANCE lpfnCI; 410 const IID * riidInst; 411 UINT * pcRefDll; /* pointer to refcounter in external dll (ugrrr...) */ 372 412 } IDefClFImpl; 373 413 … … 380 420 LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj) 381 421 { 382 383 charxriid[50];384 385 TRACE("(%p)->(\n\tIID:\t%s)\n",This,xriid);386 387 388 389 390 391 392 393 394 395 396 397 { IUnknown_AddRef((LPUNKNOWN)*ppvObj); 398 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);399 400 401 TRACE("-- Interface: %s E_NOINTERFACE\n", xriid);402 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; 403 443 } 404 444 /****************************************************************************** … … 407 447 static ULONG WINAPI IDefClF_fnAddRef(LPCLASSFACTORY iface) 408 448 { 409 410 TRACE("(%p)->(count=%lu)\n",This,This->ref);411 412 413 414 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); 415 455 } 416 456 /****************************************************************************** … … 419 459 static ULONG WINAPI IDefClF_fnRelease(LPCLASSFACTORY iface) 420 460 { 421 422 TRACE("(%p)->(count=%lu)\n",This,This->ref);423 424 425 426 427 428 429 430 431 TRACE("-- destroying IClassFactory(%p)\n",This);432 433 434 435 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; 436 476 } 437 477 /****************************************************************************** … … 441 481 LPCLASSFACTORY iface, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject) 442 482 { 443 444 charxriid[50];445 446 447 TRACE("%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnkOuter,xriid,ppvObject);448 449 450 451 452 453 454 455 456 457 458 459 460 461 ERR("unknown IID requested\n\tIID:\t%s\n",xriid);462 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; 463 503 } 464 504 /****************************************************************************** … … 467 507 static HRESULT WINAPI IDefClF_fnLockServer(LPCLASSFACTORY iface, BOOL fLock) 468 508 { 469 470 TRACE("%p->(0x%x), not implemented\n",This, fLock);471 509 ICOM_THIS(IDefClFImpl,iface); 510 dprintf(("SHELL32: IDefClF_fnLockServer %p->(0x%x), not implemented\n",This, fLock)); 511 return E_NOTIMPL; 472 512 } 473 513 … … 488 528 IClassFactory * IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, UINT * pcRefDll, REFIID riidInst) 489 529 { 490 491 charxriidInst[50];492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 TRACE("(%p)\n\tIID:\t%s\n",lpclf, xriidInst);507 508 509 } 510 511 512 /****************************************************************************** 513 * SHCreateDefClassObject 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 524 525 526 527 TRACE("\n\tIID:\t%s %p %p %p \n\tIIDIns:\t%s\n",528 xriid, ppv, lpfnCI, pcRefDll, xriidInst);529 530 531 532 533 534 535 536 537 538 539 540 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 556 ODINFUNCTION5(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.