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