1 /* 2 * Shell basics 3 * 4 * Copyright 1998 Marcus Meissner 5 * Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de> 6 * Copyright 2017 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 21 */ 22 23 #include <wine/config.h> 24 25 #define WIN32_NO_STATUS 26 #define _INC_WINDOWS 27 #define COBJMACROS 28 29 #include <windef.h> 30 #include <winbase.h> 31 #include <shellapi.h> 32 #include <shlobj.h> 33 #include <shlwapi.h> 34 #include <strsafe.h> 35 #include <winnls.h> 36 37 #include "undocshell.h" 38 #include "pidl.h" 39 #include "shell32_main.h" 40 #include "shresdef.h" 41 42 #include <wine/debug.h> 43 #include <wine/unicode.h> 44 45 #include <reactos/version.h> 46 #include <reactos/buildno.h> 47 48 WINE_DEFAULT_DEBUG_CHANNEL(shell); 49 50 const char * const SHELL_Authors[] = { "Copyright 1993-"COPYRIGHT_YEAR" WINE team", "Copyright 1998-"COPYRIGHT_YEAR" ReactOS Team", 0 }; 51 52 /************************************************************************* 53 * CommandLineToArgvW [SHELL32.@] 54 * 55 * We must interpret the quotes in the command line to rebuild the argv 56 * array correctly: 57 * - arguments are separated by spaces or tabs 58 * - quotes serve as optional argument delimiters 59 * '"a b"' -> 'a b' 60 * - escaped quotes must be converted back to '"' 61 * '\"' -> '"' 62 * - consecutive backslashes preceding a quote see their number halved with 63 * the remainder escaping the quote: 64 * 2n backslashes + quote -> n backslashes + quote as an argument delimiter 65 * 2n+1 backslashes + quote -> n backslashes + literal quote 66 * - backslashes that are not followed by a quote are copied literally: 67 * 'a\b' -> 'a\b' 68 * 'a\\b' -> 'a\\b' 69 * - in quoted strings, consecutive quotes see their number divided by three 70 * with the remainder modulo 3 deciding whether to close the string or not. 71 * Note that the opening quote must be counted in the consecutive quotes, 72 * that's the (1+) below: 73 * (1+) 3n quotes -> n quotes 74 * (1+) 3n+1 quotes -> n quotes plus closes the quoted string 75 * (1+) 3n+2 quotes -> n+1 quotes plus closes the quoted string 76 * - in unquoted strings, the first quote opens the quoted string and the 77 * remaining consecutive quotes follow the above rule. 78 */ 79 LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) 80 { 81 DWORD argc; 82 LPWSTR *argv; 83 LPCWSTR s; 84 LPWSTR d; 85 LPWSTR cmdline; 86 int qcount,bcount; 87 88 if(!numargs) 89 { 90 SetLastError(ERROR_INVALID_PARAMETER); 91 return NULL; 92 } 93 94 if (*lpCmdline==0) 95 { 96 /* Return the path to the executable */ 97 DWORD len, deslen=MAX_PATH, size; 98 99 size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR); 100 for (;;) 101 { 102 if (!(argv = LocalAlloc(LMEM_FIXED, size))) return NULL; 103 len = GetModuleFileNameW(0, (LPWSTR)(argv+2), deslen); 104 if (!len) 105 { 106 LocalFree(argv); 107 return NULL; 108 } 109 if (len < deslen) break; 110 deslen*=2; 111 size = sizeof(LPWSTR)*2 + deslen*sizeof(WCHAR); 112 LocalFree( argv ); 113 } 114 argv[0]=(LPWSTR)(argv+2); 115 argv[1]=NULL; 116 *numargs=1; 117 118 return argv; 119 } 120 121 /* --- First count the arguments */ 122 argc=1; 123 s=lpCmdline; 124 /* The first argument, the executable path, follows special rules */ 125 if (*s=='"') 126 { 127 /* The executable path ends at the next quote, no matter what */ 128 s++; 129 while (*s) 130 if (*s++=='"') 131 break; 132 } 133 else 134 { 135 /* The executable path ends at the next space, no matter what */ 136 while (*s && !isspace(*s)) 137 s++; 138 } 139 /* skip to the first argument, if any */ 140 while (isblank(*s)) 141 s++; 142 if (*s) 143 argc++; 144 145 /* Analyze the remaining arguments */ 146 qcount=bcount=0; 147 while (*s) 148 { 149 if (isblank(*s) && qcount==0) 150 { 151 /* skip to the next argument and count it if any */ 152 while (isblank(*s)) 153 s++; 154 if (*s) 155 argc++; 156 bcount=0; 157 } 158 else if (*s=='\\') 159 { 160 /* '\', count them */ 161 bcount++; 162 s++; 163 } 164 else if (*s=='"') 165 { 166 /* '"' */ 167 if ((bcount & 1)==0) 168 qcount++; /* unescaped '"' */ 169 s++; 170 bcount=0; 171 /* consecutive quotes, see comment in copying code below */ 172 while (*s=='"') 173 { 174 qcount++; 175 s++; 176 } 177 qcount=qcount % 3; 178 if (qcount==2) 179 qcount=0; 180 } 181 else 182 { 183 /* a regular character */ 184 bcount=0; 185 s++; 186 } 187 } 188 189 /* Allocate in a single lump, the string array, and the strings that go 190 * with it. This way the caller can make a single LocalFree() call to free 191 * both, as per MSDN. 192 */ 193 argv=LocalAlloc(LMEM_FIXED, (argc+1)*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR)); 194 if (!argv) 195 return NULL; 196 cmdline=(LPWSTR)(argv+argc+1); 197 strcpyW(cmdline, lpCmdline); 198 199 /* --- Then split and copy the arguments */ 200 argv[0]=d=cmdline; 201 argc=1; 202 /* The first argument, the executable path, follows special rules */ 203 if (*d=='"') 204 { 205 /* The executable path ends at the next quote, no matter what */ 206 s=d+1; 207 while (*s) 208 { 209 if (*s=='"') 210 { 211 s++; 212 break; 213 } 214 *d++=*s++; 215 } 216 } 217 else 218 { 219 /* The executable path ends at the next space, no matter what */ 220 while (*d && !isspace(*d)) 221 d++; 222 s=d; 223 if (*s) 224 s++; 225 } 226 /* close the executable path */ 227 *d++=0; 228 /* skip to the first argument and initialize it if any */ 229 while (isblank(*s)) 230 s++; 231 232 if (!*s) 233 { 234 /* There are no parameters so we are all done */ 235 argv[argc]=NULL; 236 *numargs=argc; 237 return argv; 238 } 239 240 /* Split and copy the remaining arguments */ 241 argv[argc++]=d; 242 qcount=bcount=0; 243 while (*s) 244 { 245 if (isblank(*s) && qcount==0) 246 { 247 /* close the argument */ 248 *d++=0; 249 bcount=0; 250 251 /* skip to the next one and initialize it if any */ 252 do { 253 s++; 254 } while (isblank(*s)); 255 if (*s) 256 argv[argc++]=d; 257 } 258 else if (*s=='\\') 259 { 260 *d++=*s++; 261 bcount++; 262 } 263 else if (*s=='"') 264 { 265 if ((bcount & 1)==0) 266 { 267 /* Preceded by an even number of '\', this is half that 268 * number of '\', plus a quote which we erase. 269 */ 270 d-=bcount/2; 271 qcount++; 272 } 273 else 274 { 275 /* Preceded by an odd number of '\', this is half that 276 * number of '\' followed by a '"' 277 */ 278 d=d-bcount/2-1; 279 *d++='"'; 280 } 281 s++; 282 bcount=0; 283 /* Now count the number of consecutive quotes. Note that qcount 284 * already takes into account the opening quote if any, as well as 285 * the quote that lead us here. 286 */ 287 while (*s=='"') 288 { 289 if (++qcount==3) 290 { 291 *d++='"'; 292 qcount=0; 293 } 294 s++; 295 } 296 if (qcount==2) 297 qcount=0; 298 } 299 else 300 { 301 /* a regular character */ 302 *d++=*s++; 303 bcount=0; 304 } 305 } 306 *d='\0'; 307 argv[argc]=NULL; 308 *numargs=argc; 309 310 return argv; 311 } 312 313 static DWORD shgfi_get_exe_type(LPCWSTR szFullPath) 314 { 315 BOOL status = FALSE; 316 HANDLE hfile; 317 DWORD BinaryType; 318 IMAGE_DOS_HEADER mz_header; 319 IMAGE_NT_HEADERS nt; 320 DWORD len; 321 char magic[4]; 322 323 status = GetBinaryTypeW (szFullPath, &BinaryType); 324 if (!status) 325 return 0; 326 if (BinaryType == SCS_DOS_BINARY || BinaryType == SCS_PIF_BINARY) 327 return 0x4d5a; 328 329 hfile = CreateFileW( szFullPath, GENERIC_READ, FILE_SHARE_READ, 330 NULL, OPEN_EXISTING, 0, 0 ); 331 if ( hfile == INVALID_HANDLE_VALUE ) 332 return 0; 333 334 /* 335 * The next section is adapted from MODULE_GetBinaryType, as we need 336 * to examine the image header to get OS and version information. We 337 * know from calling GetBinaryTypeA that the image is valid and either 338 * an NE or PE, so much error handling can be omitted. 339 * Seek to the start of the file and read the header information. 340 */ 341 342 SetFilePointer( hfile, 0, NULL, SEEK_SET ); 343 ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL ); 344 345 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ); 346 ReadFile( hfile, magic, sizeof(magic), &len, NULL ); 347 if ( *(DWORD*)magic == IMAGE_NT_SIGNATURE ) 348 { 349 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ); 350 ReadFile( hfile, &nt, sizeof(nt), &len, NULL ); 351 CloseHandle( hfile ); 352 /* DLL files are not executable and should return 0 */ 353 if (nt.FileHeader.Characteristics & IMAGE_FILE_DLL) 354 return 0; 355 if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) 356 { 357 return IMAGE_NT_SIGNATURE | 358 (nt.OptionalHeader.MajorSubsystemVersion << 24) | 359 (nt.OptionalHeader.MinorSubsystemVersion << 16); 360 } 361 return IMAGE_NT_SIGNATURE; 362 } 363 else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE ) 364 { 365 IMAGE_OS2_HEADER ne; 366 SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET ); 367 ReadFile( hfile, &ne, sizeof(ne), &len, NULL ); 368 CloseHandle( hfile ); 369 if (ne.ne_exetyp == 2) 370 return IMAGE_OS2_SIGNATURE | (ne.ne_expver << 16); 371 return 0; 372 } 373 CloseHandle( hfile ); 374 return 0; 375 } 376 377 /************************************************************************* 378 * SHELL_IsShortcut [internal] 379 * 380 * Decide if an item id list points to a shell shortcut 381 */ 382 BOOL SHELL_IsShortcut(LPCITEMIDLIST pidlLast) 383 { 384 WCHAR szTemp[MAX_PATH]; 385 HKEY keyCls; 386 BOOL ret = FALSE; 387 388 if (_ILGetExtension(pidlLast, szTemp, _countof(szTemp)) && 389 HCR_MapTypeToValueW(szTemp, szTemp, _countof(szTemp), TRUE)) 390 { 391 if (ERROR_SUCCESS == RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_QUERY_VALUE, &keyCls)) 392 { 393 if (ERROR_SUCCESS == RegQueryValueExW(keyCls, L"IsShortcut", NULL, NULL, NULL, NULL)) 394 ret = TRUE; 395 396 RegCloseKey(keyCls); 397 } 398 } 399 400 return ret; 401 } 402 403 #define SHGFI_KNOWN_FLAGS \ 404 (SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SHELLICONSIZE | SHGFI_PIDL | \ 405 SHGFI_USEFILEATTRIBUTES | SHGFI_ADDOVERLAYS | SHGFI_OVERLAYINDEX | \ 406 SHGFI_ICON | SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_ATTRIBUTES | \ 407 SHGFI_ICONLOCATION | SHGFI_EXETYPE | SHGFI_SYSICONINDEX | \ 408 SHGFI_LINKOVERLAY | SHGFI_SELECTED | SHGFI_ATTR_SPECIFIED) 409 410 /************************************************************************* 411 * SHGetFileInfoW [SHELL32.@] 412 * 413 */ 414 DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, 415 SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags ) 416 { 417 WCHAR szLocation[MAX_PATH], szFullPath[MAX_PATH]; 418 int iIndex; 419 DWORD_PTR ret = TRUE; 420 DWORD dwAttributes = 0; 421 IShellFolder * psfParent = NULL; 422 IExtractIconW * pei = NULL; 423 LPITEMIDLIST pidlLast = NULL, pidl = NULL; 424 HRESULT hr = S_OK; 425 BOOL IconNotYetLoaded=TRUE; 426 UINT uGilFlags = 0; 427 HIMAGELIST big_icons, small_icons; 428 429 TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n", 430 (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes, 431 psfi, psfi ? psfi->dwAttributes : 0, sizeofpsfi, flags); 432 433 if (!path) 434 return FALSE; 435 436 /* windows initializes these values regardless of the flags */ 437 if (psfi != NULL) 438 { 439 psfi->szDisplayName[0] = '\0'; 440 psfi->szTypeName[0] = '\0'; 441 psfi->hIcon = NULL; 442 } 443 444 if (!(flags & SHGFI_PIDL)) 445 { 446 /* SHGetFileInfo should work with absolute and relative paths */ 447 if (PathIsRelativeW(path)) 448 { 449 GetCurrentDirectoryW(MAX_PATH, szLocation); 450 PathCombineW(szFullPath, szLocation, path); 451 } 452 else 453 { 454 lstrcpynW(szFullPath, path, MAX_PATH); 455 } 456 } 457 else 458 { 459 SHGetPathFromIDListW((LPITEMIDLIST)path, szFullPath); 460 } 461 462 if (flags & SHGFI_EXETYPE) 463 { 464 if (!(flags & SHGFI_SYSICONINDEX)) 465 { 466 if (flags & SHGFI_USEFILEATTRIBUTES) 467 { 468 return TRUE; 469 } 470 else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES) 471 { 472 return shgfi_get_exe_type(szFullPath); 473 } 474 } 475 } 476 477 /* 478 * psfi is NULL normally to query EXE type. If it is NULL, none of the 479 * below makes sense anyway. Windows allows this and just returns FALSE 480 */ 481 if (psfi == NULL) 482 return FALSE; 483 484 /* 485 * translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES 486 * is not specified. 487 * The pidl functions fail on not existing file names 488 */ 489 490 if (flags & SHGFI_PIDL) 491 { 492 pidl = ILClone((LPCITEMIDLIST)path); 493 } 494 else if (!(flags & SHGFI_USEFILEATTRIBUTES)) 495 { 496 hr = SHILCreateFromPathW(szFullPath, &pidl, &dwAttributes); 497 } 498 499 if ((flags & SHGFI_PIDL) || !(flags & SHGFI_USEFILEATTRIBUTES)) 500 { 501 /* get the parent shellfolder */ 502 if (pidl) 503 { 504 hr = SHBindToParent( pidl, &IID_IShellFolder, (LPVOID*)&psfParent, 505 (LPCITEMIDLIST*)&pidlLast ); 506 if (SUCCEEDED(hr)) 507 pidlLast = ILClone(pidlLast); 508 else 509 hr = S_OK; 510 ILFree(pidl); 511 } 512 else 513 { 514 ERR("pidl is null!\n"); 515 return FALSE; 516 } 517 } 518 519 /* get the attributes of the child */ 520 if (SUCCEEDED(hr) && (flags & SHGFI_ATTRIBUTES)) 521 { 522 if (!(flags & SHGFI_ATTR_SPECIFIED)) 523 { 524 psfi->dwAttributes = 0xffffffff; 525 } 526 if (psfParent) 527 { 528 IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast, 529 &(psfi->dwAttributes)); 530 } 531 } 532 533 if (flags & SHGFI_USEFILEATTRIBUTES) 534 { 535 if (flags & SHGFI_ICON) 536 { 537 psfi->dwAttributes = 0; 538 } 539 } 540 541 /* get the displayname */ 542 if (SUCCEEDED(hr) && (flags & SHGFI_DISPLAYNAME)) 543 { 544 if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL)) 545 { 546 lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath)); 547 } 548 else if (psfParent) 549 { 550 STRRET str; 551 hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast, 552 SHGDN_INFOLDER, &str); 553 StrRetToStrNW (psfi->szDisplayName, MAX_PATH, &str, pidlLast); 554 } 555 } 556 557 /* get the type name */ 558 if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME)) 559 { 560 if (!(flags & SHGFI_USEFILEATTRIBUTES) || (flags & SHGFI_PIDL)) 561 { 562 _ILGetFileType(pidlLast, psfi->szTypeName, _countof(psfi->szTypeName)); 563 } 564 else 565 { 566 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 567 strcatW (psfi->szTypeName, L"Folder"); 568 else 569 { 570 WCHAR sTemp[64]; 571 572 lstrcpyW(sTemp,PathFindExtensionW(szFullPath)); 573 if (sTemp[0] == 0 || (sTemp[0] == '.' && sTemp[1] == 0)) 574 { 575 /* "name" or "name." => "File" */ 576 lstrcpynW (psfi->szTypeName, L"File", 64); 577 } 578 else if (!( HCR_MapTypeToValueW(sTemp, sTemp, 64, TRUE) && 579 HCR_MapTypeToValueW(sTemp, psfi->szTypeName, 80, FALSE ))) 580 { 581 if (sTemp[0]) 582 { 583 lstrcpynW (psfi->szTypeName, sTemp, 64); 584 strcatW (psfi->szTypeName, L" file"); 585 } 586 else 587 { 588 lstrcpynW (psfi->szTypeName, L"File", 64); 589 } 590 } 591 } 592 } 593 } 594 595 /* ### icons ###*/ 596 597 Shell_GetImageLists( &big_icons, &small_icons ); 598 599 if (flags & SHGFI_OPENICON) 600 uGilFlags |= GIL_OPENICON; 601 602 if (flags & SHGFI_LINKOVERLAY) 603 uGilFlags |= GIL_FORSHORTCUT; 604 else if ((flags&SHGFI_ADDOVERLAYS) || 605 (flags&(SHGFI_ICON|SHGFI_SMALLICON))==SHGFI_ICON) 606 { 607 if (SHELL_IsShortcut(pidlLast)) 608 uGilFlags |= GIL_FORSHORTCUT; 609 } 610 611 if (flags & SHGFI_OVERLAYINDEX) 612 FIXME("SHGFI_OVERLAYINDEX unhandled\n"); 613 614 if (flags & SHGFI_SELECTED) 615 FIXME("set icon to selected, stub\n"); 616 617 if (flags & SHGFI_SHELLICONSIZE) 618 FIXME("set icon to shell size, stub\n"); 619 620 /* get the iconlocation */ 621 if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION )) 622 { 623 UINT uDummy,uFlags; 624 625 if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL)) 626 { 627 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 628 { 629 lstrcpyW(psfi->szDisplayName, swShell32Name); 630 psfi->iIcon = -IDI_SHELL_FOLDER; 631 } 632 else 633 { 634 WCHAR* szExt; 635 WCHAR sTemp [MAX_PATH]; 636 637 szExt = PathFindExtensionW(szFullPath); 638 TRACE("szExt=%s\n", debugstr_w(szExt)); 639 if ( szExt && 640 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && 641 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon)) 642 { 643 if (lstrcmpW(L"%1", sTemp)) 644 strcpyW(psfi->szDisplayName, sTemp); 645 else 646 { 647 /* the icon is in the file */ 648 strcpyW(psfi->szDisplayName, szFullPath); 649 } 650 } 651 else 652 ret = FALSE; 653 } 654 } 655 else if (psfParent) 656 { 657 hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1, 658 (LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW, 659 &uDummy, (LPVOID*)&pei); 660 if (SUCCEEDED(hr)) 661 { 662 hr = IExtractIconW_GetIconLocation(pei, uGilFlags, 663 szLocation, MAX_PATH, &iIndex, &uFlags); 664 665 if (uFlags & GIL_NOTFILENAME) 666 ret = FALSE; 667 else 668 { 669 lstrcpyW (psfi->szDisplayName, szLocation); 670 psfi->iIcon = iIndex; 671 } 672 IExtractIconW_Release(pei); 673 } 674 } 675 } 676 677 /* get icon index (or load icon)*/ 678 if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX))) 679 { 680 if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL)) 681 { 682 WCHAR sTemp [MAX_PATH]; 683 WCHAR * szExt; 684 int icon_idx=0; 685 686 lstrcpynW(sTemp, szFullPath, MAX_PATH); 687 688 if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 689 psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER, 0); 690 else 691 { 692 psfi->iIcon = 0; 693 szExt = PathFindExtensionW(sTemp); 694 if ( szExt && 695 HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && 696 HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx)) 697 { 698 if (!lstrcmpW(L"%1",sTemp)) /* icon is in the file */ 699 strcpyW(sTemp, szFullPath); 700 701 if (flags & SHGFI_SYSICONINDEX) 702 { 703 psfi->iIcon = SIC_GetIconIndex(sTemp,icon_idx,0); 704 if (psfi->iIcon == -1) 705 psfi->iIcon = 0; 706 } 707 else 708 { 709 UINT ret; 710 if (flags & SHGFI_SMALLICON) 711 ret = PrivateExtractIconsW( sTemp,icon_idx, 712 GetSystemMetrics( SM_CXSMICON ), 713 GetSystemMetrics( SM_CYSMICON ), 714 &psfi->hIcon, 0, 1, 0); 715 else 716 ret = PrivateExtractIconsW( sTemp, icon_idx, 717 GetSystemMetrics( SM_CXICON), 718 GetSystemMetrics( SM_CYICON), 719 &psfi->hIcon, 0, 1, 0); 720 if (ret != 0 && ret != (UINT)-1) 721 { 722 IconNotYetLoaded=FALSE; 723 psfi->iIcon = icon_idx; 724 } 725 } 726 } 727 } 728 } 729 else if (psfParent) 730 { 731 if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON), 732 uGilFlags, &(psfi->iIcon)))) 733 { 734 ret = FALSE; 735 } 736 } 737 if (ret && (flags & SHGFI_SYSICONINDEX)) 738 { 739 if (flags & SHGFI_SMALLICON) 740 ret = (DWORD_PTR)small_icons; 741 else 742 ret = (DWORD_PTR)big_icons; 743 } 744 } 745 746 /* icon handle */ 747 if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded) 748 { 749 if (flags & SHGFI_SMALLICON) 750 psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL); 751 else 752 psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL); 753 } 754 755 if (flags & ~SHGFI_KNOWN_FLAGS) 756 FIXME("unknown flags %08x\n", flags & ~SHGFI_KNOWN_FLAGS); 757 758 if (psfParent) 759 IShellFolder_Release(psfParent); 760 761 if (hr != S_OK) 762 ret = FALSE; 763 764 SHFree(pidlLast); 765 766 TRACE ("icon=%p index=0x%08x attr=0x%08x name=%s type=%s ret=0x%08lx\n", 767 psfi->hIcon, psfi->iIcon, psfi->dwAttributes, 768 debugstr_w(psfi->szDisplayName), debugstr_w(psfi->szTypeName), ret); 769 770 return ret; 771 } 772 773 /************************************************************************* 774 * SHGetFileInfoA [SHELL32.@] 775 * 776 * Note: 777 * MSVBVM60.__vbaNew2 expects this function to return a value in range 778 * 1 .. 0x7fff when the function succeeds and flags does not contain 779 * SHGFI_EXETYPE or SHGFI_SYSICONINDEX (see bug 7701) 780 */ 781 DWORD_PTR WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, 782 SHFILEINFOA *psfi, UINT sizeofpsfi, 783 UINT flags ) 784 { 785 INT len; 786 LPWSTR temppath = NULL; 787 LPCWSTR pathW; 788 DWORD_PTR ret; 789 SHFILEINFOW temppsfi; 790 791 if (flags & SHGFI_PIDL) 792 { 793 /* path contains a pidl */ 794 pathW = (LPCWSTR)path; 795 } 796 else 797 { 798 len = MultiByteToWideChar(CP_ACP, 0, path, -1, NULL, 0); 799 temppath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); 800 MultiByteToWideChar(CP_ACP, 0, path, -1, temppath, len); 801 pathW = temppath; 802 } 803 804 if (psfi) 805 { 806 temppsfi.hIcon = psfi->hIcon; 807 temppsfi.iIcon = psfi->iIcon; 808 temppsfi.dwAttributes = psfi->dwAttributes; 809 810 ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags); 811 psfi->hIcon = temppsfi.hIcon; 812 psfi->iIcon = temppsfi.iIcon; 813 psfi->dwAttributes = temppsfi.dwAttributes; 814 815 WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1, 816 psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL); 817 818 WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1, 819 psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL); 820 } 821 else 822 ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, 0, flags); 823 824 HeapFree(GetProcessHeap(), 0, temppath); 825 826 return ret; 827 } 828 829 /************************************************************************* 830 * DuplicateIcon [SHELL32.@] 831 */ 832 HICON WINAPI DuplicateIcon( HINSTANCE hInstance, HICON hIcon) 833 { 834 ICONINFO IconInfo; 835 HICON hDupIcon = 0; 836 837 TRACE("%p %p\n", hInstance, hIcon); 838 839 if (GetIconInfo(hIcon, &IconInfo)) 840 { 841 hDupIcon = CreateIconIndirect(&IconInfo); 842 843 /* clean up hbmMask and hbmColor */ 844 DeleteObject(IconInfo.hbmMask); 845 DeleteObject(IconInfo.hbmColor); 846 } 847 848 return hDupIcon; 849 } 850 851 /************************************************************************* 852 * ExtractIconA [SHELL32.@] 853 */ 854 HICON WINAPI ExtractIconA(HINSTANCE hInstance, LPCSTR lpszFile, UINT nIconIndex) 855 { 856 HICON ret; 857 INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0); 858 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); 859 860 TRACE("%p %s %d\n", hInstance, lpszFile, nIconIndex); 861 862 MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, lpwstrFile, len); 863 ret = ExtractIconW(hInstance, lpwstrFile, nIconIndex); 864 HeapFree(GetProcessHeap(), 0, lpwstrFile); 865 866 return ret; 867 } 868 869 /************************************************************************* 870 * ExtractIconW [SHELL32.@] 871 */ 872 HICON WINAPI ExtractIconW(HINSTANCE hInstance, LPCWSTR lpszFile, UINT nIconIndex) 873 { 874 HICON hIcon = NULL; 875 UINT ret; 876 UINT cx = GetSystemMetrics(SM_CXICON), cy = GetSystemMetrics(SM_CYICON); 877 878 TRACE("%p %s %d\n", hInstance, debugstr_w(lpszFile), nIconIndex); 879 880 if (nIconIndex == (UINT)-1) 881 { 882 ret = PrivateExtractIconsW(lpszFile, 0, cx, cy, NULL, NULL, 0, LR_DEFAULTCOLOR); 883 if (ret != (UINT)-1 && ret) 884 return (HICON)(UINT_PTR)ret; 885 return NULL; 886 } 887 else 888 ret = PrivateExtractIconsW(lpszFile, nIconIndex, cx, cy, &hIcon, NULL, 1, LR_DEFAULTCOLOR); 889 890 if (ret == (UINT)-1) 891 return (HICON)1; 892 else if (ret > 0 && hIcon) 893 return hIcon; 894 895 return NULL; 896 } 897 898 /************************************************************************* 899 * Printer_LoadIconsW [SHELL32.205] 900 */ 901 VOID WINAPI Printer_LoadIconsW(LPCWSTR wsPrinterName, HICON * pLargeIcon, HICON * pSmallIcon) 902 { 903 INT iconindex=IDI_SHELL_PRINTERS_FOLDER; 904 905 TRACE("(%s, %p, %p)\n", debugstr_w(wsPrinterName), pLargeIcon, pSmallIcon); 906 907 /* We should check if wsPrinterName is 908 1. the Default Printer or not 909 2. connected or not 910 3. a Local Printer or a Network-Printer 911 and use different Icons 912 */ 913 if((wsPrinterName != NULL) && (wsPrinterName[0] != 0)) 914 { 915 FIXME("(select Icon by PrinterName %s not implemented)\n", debugstr_w(wsPrinterName)); 916 } 917 918 if(pLargeIcon != NULL) 919 *pLargeIcon = LoadImageW(shell32_hInstance, 920 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON, 921 0, 0, LR_DEFAULTCOLOR|LR_DEFAULTSIZE); 922 923 if(pSmallIcon != NULL) 924 *pSmallIcon = LoadImageW(shell32_hInstance, 925 (LPCWSTR) MAKEINTRESOURCE(iconindex), IMAGE_ICON, 926 16, 16, LR_DEFAULTCOLOR); 927 } 928 929 /************************************************************************* 930 * Printers_RegisterWindowW [SHELL32.213] 931 * used by "printui.dll": 932 * find the Window of the given Type for the specific Printer and 933 * return the already existent hwnd or open a new window 934 */ 935 BOOL WINAPI Printers_RegisterWindowW(LPCWSTR wsPrinter, DWORD dwType, 936 HANDLE * phClassPidl, HWND * phwnd) 937 { 938 FIXME("(%s, %x, %p (%p), %p (%p)) stub!\n", debugstr_w(wsPrinter), dwType, 939 phClassPidl, (phClassPidl != NULL) ? *(phClassPidl) : NULL, 940 phwnd, (phwnd != NULL) ? *(phwnd) : NULL); 941 942 return FALSE; 943 } 944 945 /************************************************************************* 946 * Printers_UnregisterWindow [SHELL32.214] 947 */ 948 VOID WINAPI Printers_UnregisterWindow(HANDLE hClassPidl, HWND hwnd) 949 { 950 FIXME("(%p, %p) stub!\n", hClassPidl, hwnd); 951 } 952 953 /*************************************************************************/ 954 955 typedef struct 956 { 957 LPCWSTR szApp; 958 #ifdef __REACTOS__ 959 LPCWSTR szOSVersion; 960 #endif 961 LPCWSTR szOtherStuff; 962 HICON hIcon; 963 } ABOUT_INFO; 964 965 /************************************************************************* 966 * SHHelpShortcuts_RunDLLA [SHELL32.@] 967 * 968 */ 969 DWORD WINAPI SHHelpShortcuts_RunDLLA(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4) 970 { 971 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4); 972 return 0; 973 } 974 975 /************************************************************************* 976 * SHHelpShortcuts_RunDLLA [SHELL32.@] 977 * 978 */ 979 DWORD WINAPI SHHelpShortcuts_RunDLLW(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4) 980 { 981 FIXME("(%x, %x, %x, %x) stub!\n", dwArg1, dwArg2, dwArg3, dwArg4); 982 return 0; 983 } 984 985 /************************************************************************* 986 * SHLoadInProc [SHELL32.@] 987 * Create an instance of specified object class from within 988 * the shell process and release it immediately 989 */ 990 HRESULT WINAPI SHLoadInProc (REFCLSID rclsid) 991 { 992 void *ptr = NULL; 993 994 TRACE("%s\n", debugstr_guid(rclsid)); 995 996 CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown,&ptr); 997 if(ptr) 998 { 999 IUnknown * pUnk = ptr; 1000 IUnknown_Release(pUnk); 1001 return S_OK; 1002 } 1003 return DISP_E_MEMBERNOTFOUND; 1004 } 1005 1006 static VOID SetRegTextData(HWND hWnd, HKEY hKey, LPCWSTR Value, UINT uID) 1007 { 1008 DWORD dwBufferSize; 1009 DWORD dwType; 1010 LPWSTR lpBuffer; 1011 1012 if( RegQueryValueExW(hKey, Value, NULL, &dwType, NULL, &dwBufferSize) == ERROR_SUCCESS ) 1013 { 1014 if(dwType == REG_SZ) 1015 { 1016 lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, dwBufferSize); 1017 1018 if(lpBuffer) 1019 { 1020 if( RegQueryValueExW(hKey, Value, NULL, &dwType, (LPBYTE)lpBuffer, &dwBufferSize) == ERROR_SUCCESS ) 1021 { 1022 SetDlgItemTextW(hWnd, uID, lpBuffer); 1023 } 1024 1025 HeapFree(GetProcessHeap(), 0, lpBuffer); 1026 } 1027 } 1028 } 1029 } 1030 1031 INT_PTR CALLBACK AboutAuthorsDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) 1032 { 1033 switch(msg) 1034 { 1035 case WM_INITDIALOG: 1036 { 1037 const char* const *pstr = SHELL_Authors; 1038 1039 // Add the authors to the list 1040 SendDlgItemMessageW( hWnd, IDC_ABOUT_AUTHORS_LISTBOX, WM_SETREDRAW, FALSE, 0 ); 1041 1042 while (*pstr) 1043 { 1044 WCHAR name[64]; 1045 1046 /* authors list is in utf-8 format */ 1047 MultiByteToWideChar( CP_UTF8, 0, *pstr, -1, name, sizeof(name)/sizeof(WCHAR) ); 1048 SendDlgItemMessageW( hWnd, IDC_ABOUT_AUTHORS_LISTBOX, LB_ADDSTRING, (WPARAM)-1, (LPARAM)name ); 1049 pstr++; 1050 } 1051 1052 SendDlgItemMessageW( hWnd, IDC_ABOUT_AUTHORS_LISTBOX, WM_SETREDRAW, TRUE, 0 ); 1053 1054 return TRUE; 1055 } 1056 } 1057 1058 return FALSE; 1059 } 1060 /************************************************************************* 1061 * AboutDlgProc (internal) 1062 */ 1063 static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) 1064 { 1065 #ifdef __REACTOS__ 1066 1067 static DWORD cxLogoBmp; 1068 static DWORD cyLogoBmp, cyLineBmp; 1069 static HBITMAP hLogoBmp, hLineBmp; 1070 static HWND hWndAuthors; 1071 1072 switch (msg) 1073 { 1074 case WM_INITDIALOG: 1075 { 1076 ABOUT_INFO *info = (ABOUT_INFO *)lParam; 1077 1078 if (info) 1079 { 1080 HKEY hRegKey; 1081 MEMORYSTATUSEX MemStat; 1082 WCHAR szAppTitle[512]; 1083 WCHAR szAppTitleTemplate[512]; 1084 WCHAR szAuthorsText[20]; 1085 1086 // Preload the ROS bitmap 1087 hLogoBmp = (HBITMAP)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDB_REACTOS), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); 1088 hLineBmp = (HBITMAP)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDB_LINEBAR), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); 1089 1090 if (hLogoBmp && hLineBmp) 1091 { 1092 BITMAP bmpLogo; 1093 1094 GetObject(hLogoBmp, sizeof(BITMAP), &bmpLogo); 1095 1096 cxLogoBmp = bmpLogo.bmWidth; 1097 cyLogoBmp = bmpLogo.bmHeight; 1098 1099 GetObject(hLineBmp, sizeof(BITMAP), &bmpLogo); 1100 cyLineBmp = bmpLogo.bmHeight; 1101 } 1102 1103 // Set App-specific stuff (icon, app name, szOtherStuff string) 1104 SendDlgItemMessageW(hWnd, IDC_ABOUT_ICON, STM_SETICON, (WPARAM)info->hIcon, 0); 1105 1106 GetWindowTextW(hWnd, szAppTitleTemplate, ARRAY_SIZE(szAppTitleTemplate)); 1107 swprintf(szAppTitle, szAppTitleTemplate, info->szApp); 1108 SetWindowTextW(hWnd, szAppTitle); 1109 1110 SetDlgItemTextW(hWnd, IDC_ABOUT_APPNAME, info->szApp); 1111 SetDlgItemTextW(hWnd, IDC_ABOUT_VERSION, info->szOSVersion); 1112 SetDlgItemTextW(hWnd, IDC_ABOUT_OTHERSTUFF, info->szOtherStuff); 1113 1114 // Set the registered user and organization name 1115 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 1116 0, KEY_QUERY_VALUE, &hRegKey) == ERROR_SUCCESS) 1117 { 1118 SetRegTextData(hWnd, hRegKey, L"RegisteredOwner", IDC_ABOUT_REG_USERNAME); 1119 SetRegTextData(hWnd, hRegKey, L"RegisteredOrganization", IDC_ABOUT_REG_ORGNAME); 1120 1121 if (GetWindowTextLengthW(GetDlgItem(hWnd, IDC_ABOUT_REG_USERNAME)) == 0 && 1122 GetWindowTextLengthW(GetDlgItem(hWnd, IDC_ABOUT_REG_ORGNAME)) == 0) 1123 { 1124 ShowWindow(GetDlgItem(hWnd, IDC_ABOUT_REG_TO), SW_HIDE); 1125 } 1126 1127 RegCloseKey(hRegKey); 1128 } 1129 1130 // Set the value for the installed physical memory 1131 MemStat.dwLength = sizeof(MemStat); 1132 if (GlobalMemoryStatusEx(&MemStat)) 1133 { 1134 WCHAR szBuf[12]; 1135 1136 if (MemStat.ullTotalPhys > 1024 * 1024 * 1024) 1137 { 1138 double dTotalPhys; 1139 WCHAR szDecimalSeparator[4]; 1140 WCHAR szUnits[3]; 1141 1142 // We're dealing with GBs or more 1143 MemStat.ullTotalPhys /= 1024 * 1024; 1144 1145 if (MemStat.ullTotalPhys > 1024 * 1024) 1146 { 1147 // We're dealing with TBs or more 1148 MemStat.ullTotalPhys /= 1024; 1149 1150 if (MemStat.ullTotalPhys > 1024 * 1024) 1151 { 1152 // We're dealing with PBs or more 1153 MemStat.ullTotalPhys /= 1024; 1154 1155 dTotalPhys = (double)MemStat.ullTotalPhys / 1024; 1156 wcscpy(szUnits, L"PB"); 1157 } 1158 else 1159 { 1160 dTotalPhys = (double)MemStat.ullTotalPhys / 1024; 1161 wcscpy(szUnits, L"TB"); 1162 } 1163 } 1164 else 1165 { 1166 dTotalPhys = (double)MemStat.ullTotalPhys / 1024; 1167 wcscpy(szUnits, L"GB"); 1168 } 1169 1170 // We need the decimal point of the current locale to display the RAM size correctly 1171 if (GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, 1172 szDecimalSeparator, 1173 ARRAY_SIZE(szDecimalSeparator)) > 0) 1174 { 1175 UCHAR uDecimals; 1176 UINT uIntegral; 1177 1178 uIntegral = (UINT)dTotalPhys; 1179 uDecimals = (UCHAR)((UINT)(dTotalPhys * 100) - uIntegral * 100); 1180 1181 // Display the RAM size with 2 decimals 1182 swprintf(szBuf, L"%u%s%02u %s", uIntegral, szDecimalSeparator, uDecimals, szUnits); 1183 } 1184 } 1185 else 1186 { 1187 // We're dealing with MBs, don't show any decimals 1188 swprintf(szBuf, L"%u MB", (UINT)MemStat.ullTotalPhys / 1024 / 1024); 1189 } 1190 1191 SetDlgItemTextW(hWnd, IDC_ABOUT_PHYSMEM, szBuf); 1192 } 1193 1194 // Add the Authors dialog 1195 hWndAuthors = CreateDialogW(shell32_hInstance, MAKEINTRESOURCEW(IDD_ABOUT_AUTHORS), hWnd, AboutAuthorsDlgProc); 1196 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText)); 1197 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText); 1198 } 1199 1200 return TRUE; 1201 } 1202 1203 case WM_PAINT: 1204 { 1205 if (hLogoBmp && hLineBmp) 1206 { 1207 PAINTSTRUCT ps; 1208 HDC hdc; 1209 HDC hdcMem; 1210 HGDIOBJ hOldObj; 1211 1212 hdc = BeginPaint(hWnd, &ps); 1213 hdcMem = CreateCompatibleDC(hdc); 1214 1215 if (hdcMem) 1216 { 1217 hOldObj = SelectObject(hdcMem, hLogoBmp); 1218 BitBlt(hdc, 0, 0, cxLogoBmp, cyLogoBmp, hdcMem, 0, 0, SRCCOPY); 1219 1220 SelectObject(hdcMem, hLineBmp); 1221 BitBlt(hdc, 0, cyLogoBmp, cxLogoBmp, cyLineBmp, hdcMem, 0, 0, SRCCOPY); 1222 1223 SelectObject(hdcMem, hOldObj); 1224 DeleteDC(hdcMem); 1225 } 1226 1227 EndPaint(hWnd, &ps); 1228 } 1229 break; 1230 } 1231 1232 case WM_COMMAND: 1233 { 1234 switch(wParam) 1235 { 1236 case IDOK: 1237 case IDCANCEL: 1238 EndDialog(hWnd, TRUE); 1239 return TRUE; 1240 1241 case IDC_ABOUT_AUTHORS: 1242 { 1243 static BOOL bShowingAuthors = FALSE; 1244 WCHAR szAuthorsText[20]; 1245 1246 if (bShowingAuthors) 1247 { 1248 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_AUTHORS, szAuthorsText, ARRAY_SIZE(szAuthorsText)); 1249 ShowWindow(hWndAuthors, SW_HIDE); 1250 } 1251 else 1252 { 1253 LoadStringW(shell32_hInstance, IDS_SHELL_ABOUT_BACK, szAuthorsText, ARRAY_SIZE(szAuthorsText)); 1254 ShowWindow(hWndAuthors, SW_SHOW); 1255 } 1256 1257 SetDlgItemTextW(hWnd, IDC_ABOUT_AUTHORS, szAuthorsText); 1258 bShowingAuthors = !bShowingAuthors; 1259 return TRUE; 1260 } 1261 } 1262 break; 1263 } 1264 1265 case WM_CLOSE: 1266 EndDialog(hWnd, TRUE); 1267 break; 1268 } 1269 1270 #endif // __REACTOS__ 1271 1272 return 0; 1273 } 1274 1275 1276 /************************************************************************* 1277 * ShellAboutA [SHELL32.288] 1278 */ 1279 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon ) 1280 { 1281 BOOL ret; 1282 LPWSTR appW = NULL, otherW = NULL; 1283 int len; 1284 1285 if (szApp) 1286 { 1287 len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0); 1288 appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); 1289 MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len); 1290 } 1291 if (szOtherStuff) 1292 { 1293 len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0); 1294 otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); 1295 MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len); 1296 } 1297 1298 ret = ShellAboutW(hWnd, appW, otherW, hIcon); 1299 1300 HeapFree(GetProcessHeap(), 0, otherW); 1301 HeapFree(GetProcessHeap(), 0, appW); 1302 return ret; 1303 } 1304 1305 1306 /************************************************************************* 1307 * ShellAboutW [SHELL32.289] 1308 */ 1309 BOOL WINAPI ShellAboutW( HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, 1310 HICON hIcon ) 1311 { 1312 ABOUT_INFO info; 1313 HRSRC hRes; 1314 DLGTEMPLATE *DlgTemplate; 1315 BOOL bRet; 1316 #ifdef __REACTOS__ 1317 WCHAR szVersionString[256]; 1318 WCHAR szFormat[256]; 1319 #endif 1320 1321 TRACE("\n"); 1322 1323 // DialogBoxIndirectParamW will be called with the hInstance of the calling application, so we have to preload the dialog template 1324 hRes = FindResourceW(shell32_hInstance, MAKEINTRESOURCEW(IDD_ABOUT), (LPWSTR)RT_DIALOG); 1325 if(!hRes) 1326 return FALSE; 1327 1328 DlgTemplate = (DLGTEMPLATE *)LoadResource(shell32_hInstance, hRes); 1329 if(!DlgTemplate) 1330 return FALSE; 1331 1332 #ifdef __REACTOS__ 1333 /* Output the version OS kernel strings */ 1334 LoadStringW(shell32_hInstance, IDS_ABOUT_VERSION_STRING, szFormat, _countof(szFormat)); 1335 StringCchPrintfW(szVersionString, _countof(szVersionString), szFormat, KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR); 1336 #endif 1337 1338 info.szApp = szApp; 1339 #ifdef __REACTOS__ 1340 info.szOSVersion = szVersionString; 1341 #endif 1342 info.szOtherStuff = szOtherStuff; 1343 info.hIcon = hIcon ? hIcon : LoadIconW( 0, (LPWSTR)IDI_WINLOGO ); 1344 1345 bRet = DialogBoxIndirectParamW((HINSTANCE)GetWindowLongPtrW( hWnd, GWLP_HINSTANCE ), 1346 DlgTemplate, hWnd, AboutDlgProc, (LPARAM)&info ); 1347 return bRet; 1348 } 1349 1350 /************************************************************************* 1351 * FreeIconList (SHELL32.@) 1352 */ 1353 void WINAPI FreeIconList( DWORD dw ) 1354 { 1355 FIXME("%x: stub\n",dw); 1356 } 1357 1358 /************************************************************************* 1359 * SHLoadNonloadedIconOverlayIdentifiers (SHELL32.@) 1360 */ 1361 HRESULT WINAPI SHLoadNonloadedIconOverlayIdentifiers( VOID ) 1362 { 1363 FIXME("stub\n"); 1364 return S_OK; 1365 } 1366