Ignore:
Timestamp:
Apr 28, 2001, 3:33:49 PM (24 years ago)
Author:
sandervl
Message:

resync with latest wine

File:
1 edited

Legend:

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

    r4121 r5618  
    1 /* $Id: shell32_main.c,v 1.1 2000-08-30 13:52:54 sandervl Exp $ */
     1/* $Id: shell32_main.c,v 1.2 2001-04-28 13:33:45 sandervl Exp $ */
    22/*
    33 *                              Shell basics
     
    8989}
    9090
    91 /*************************************************************************
    92  * Control_RunDLL                       [SHELL32.12]
    93  *
    94  * Wild speculation in the following!
    95  *
    96  * http://premium.microsoft.com/msdn/library/techart/msdn193.htm
    97  */
    98 
    99 void WINAPI Control_RunDLL( HWND hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 )
    100 {
    101     FIXME("(0x%08x, %p, %s, 0x%08lx): stub\n", hwnd, code,
    102           debugstr_a(cmd), arg4);
    103 }
    10491
    10592/*************************************************************************
     
    130117        psfi->szTypeName[0] = '\0';
    131118        psfi->iIcon = 0;
     119
     120        if (flags & SHGFI_EXETYPE) {
     121          BOOL status = FALSE;
     122          HANDLE hfile;
     123          DWORD BinaryType;
     124          IMAGE_DOS_HEADER mz_header;
     125          IMAGE_NT_HEADERS nt;
     126          DWORD len;
     127          char magic[4];
     128
     129          if (flags != SHGFI_EXETYPE) return 0;
     130
     131          status = GetBinaryTypeA (path, &BinaryType);
     132          if (!status) return 0;
     133          if ((BinaryType == SCS_DOS_BINARY)
     134                || (BinaryType == SCS_PIF_BINARY)) return 0x4d5a;
     135
     136          hfile = CreateFileA( path, GENERIC_READ, FILE_SHARE_READ,
     137                NULL, OPEN_EXISTING, 0, 0 );
     138          if ( hfile == INVALID_HANDLE_VALUE ) return 0;
     139
     140        /* The next section is adapted from MODULE_GetBinaryType, as we need
     141         * to examine the image header to get OS and version information. We
     142         * know from calling GetBinaryTypeA that the image is valid and either
     143         * an NE or PE, so much error handling can be omitted.
     144         * Seek to the start of the file and read the header information.
     145         */
     146
     147          SetFilePointer( hfile, 0, NULL, SEEK_SET ); 
     148          ReadFile( hfile, &mz_header, sizeof(mz_header), &len, NULL );
     149
     150         SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
     151         ReadFile( hfile, magic, sizeof(magic), &len, NULL );
     152         if ( *(DWORD*)magic      == IMAGE_NT_SIGNATURE )
     153         {
     154             SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
     155             ReadFile( hfile, &nt, sizeof(nt), &len, NULL );
     156              CloseHandle( hfile );
     157              if (nt.OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
     158                 return IMAGE_NT_SIGNATURE
     159                        | (nt.OptionalHeader.MajorSubsystemVersion << 24)
     160                        | (nt.OptionalHeader.MinorSubsystemVersion << 16);
     161              }
     162              return IMAGE_NT_SIGNATURE;
     163          }
     164         else if ( *(WORD*)magic == IMAGE_OS2_SIGNATURE )
     165         {
     166             IMAGE_OS2_HEADER ne;
     167             SetFilePointer( hfile, mz_header.e_lfanew, NULL, SEEK_SET );
     168             ReadFile( hfile, &ne, sizeof(ne), &len, NULL );
     169              CloseHandle( hfile );
     170             if (ne.ne_exetyp == 2) return IMAGE_OS2_SIGNATURE
     171                        | (ne.ne_expver << 16);
     172              return 0;
     173          }
     174          CloseHandle( hfile );
     175          return 0;
     176      }
     177
    132178       
    133179        /* translate the path into a pidl only when SHGFI_USEFILEATTRIBUTES in not specified
     
    259305        /* icon handle */
    260306        if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
    261           psfi->hIcon = pImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
    262 
    263 
    264         if (flags & SHGFI_EXETYPE)
    265           FIXME("type of executable, stub\n");
     307          psfi->hIcon = ImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
    266308
    267309        if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
     
    280322#endif
    281323        return ret;
    282 }
    283 
     324}
    284325/*************************************************************************
    285326 * SHGetFileInfoW                       [SHELL32.@]
     
    289330                              SHFILEINFOW *psfi, UINT sizeofpsfi,
    290331                              UINT flags )
    291 {       FIXME("(%s,0x%lx,%p,0x%x,0x%x)\n",
    292               debugstr_w(path),dwFileAttributes,psfi,sizeofpsfi,flags);
    293         return 0;
     332{
     333        INT len;
     334        LPSTR temppath;
     335        DWORD ret;
     336        SHFILEINFOA temppsfi;
     337
     338        len = WideCharToMultiByte(CP_ACP, 0, path, -1, NULL, 0, NULL, NULL);
     339        temppath = HeapAlloc(GetProcessHeap(), 0, len);
     340        WideCharToMultiByte(CP_ACP, 0, path, -1, temppath, len, NULL, NULL);
     341
     342        WideCharToMultiByte(CP_ACP, 0, psfi->szDisplayName, -1, temppsfi.szDisplayName,
     343                            sizeof(temppsfi.szDisplayName), NULL, NULL);
     344        WideCharToMultiByte(CP_ACP, 0, psfi->szTypeName, -1, temppsfi.szTypeName,
     345                            sizeof(temppsfi.szTypeName), NULL, NULL);
     346
     347        ret = SHGetFileInfoA(temppath, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
     348
     349        HeapFree(GetProcessHeap(), 0, temppath);
     350       
     351        return ret;
    294352}
    295353
     
    808866 *
    809867 */
    810 void    (* WINAPI  pDLLInitComctl)(LPVOID);
    811 INT     (* WINAPI  pImageList_AddIcon) (HIMAGELIST himl, HICON hIcon);
    812 INT     (* WINAPI  pImageList_ReplaceIcon) (HIMAGELIST, INT, HICON);
    813 HIMAGELIST (* WINAPI  pImageList_Create) (INT,INT,UINT,INT,INT);
    814 BOOL    (* WINAPI  pImageList_Draw) (HIMAGELIST himl, int i, HDC hdcDest, int x, int y, UINT fStyle);
    815 HICON   (* WINAPI  pImageList_GetIcon) (HIMAGELIST, INT, UINT);
    816 INT     (* WINAPI  pImageList_GetImageCount)(HIMAGELIST);
    817 COLORREF (* WINAPI pImageList_SetBkColor)(HIMAGELIST, COLORREF);
     868void    (* WINAPI pDLLInitComctl)(LPVOID);
    818869
    819870LPVOID  (* WINAPI  pCOMCTL32_Alloc) (INT); 
    820871BOOL    (* WINAPI  pCOMCTL32_Free) (LPVOID); 
    821872
    822 HDPA    (* WINAPI  pDPA_Create) (INT); 
    823 INT     (* WINAPI  pDPA_InsertPtr) (const HDPA, INT, LPVOID);
    824 BOOL    (* WINAPI  pDPA_Sort) (const HDPA, PFNDPACOMPARE, LPARAM);
    825 LPVOID  (* WINAPI  pDPA_GetPtr) (const HDPA, INT);   
    826 BOOL    (* WINAPI  pDPA_Destroy) (const HDPA);
    827 INT     (* WINAPI pDPA_Search) (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
    828 LPVOID  (* WINAPI pDPA_DeletePtr) (const HDPA hdpa, INT i);
    829 
    830 /* user32 */
    831 HICON (* WINAPI pLookupIconIdFromDirectoryEx)(LPBYTE dir, BOOL bIcon, INT width, INT height, UINT cFlag);
    832 HICON (* WINAPI pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, DWORD dwVersion, INT width, INT height,UINT cFlag);
    833 
    834873static HINSTANCE        hComctl32;
    835874static INT              shell32_RefCount = 0;
     
    837876LONG            shell32_ObjCount = 0;
    838877HINSTANCE       shell32_hInstance = 0;
    839 HMODULE         huser32 = 0;
    840878HIMAGELIST      ShellSmallIconList = 0;
    841879HIMAGELIST      ShellBigIconList = 0;
     
    861899            shell32_hInstance = hinstDLL;
    862900            hComctl32 = GetModuleHandleA("COMCTL32.DLL");       
    863             if(!huser32) huser32 = GetModuleHandleA("USER32.DLL");
    864901            DisableThreadLibraryCalls(shell32_hInstance);
    865902
    866             if (!hComctl32 || !huser32)
     903            if (!hComctl32)
    867904            {
    868905              ERR("P A N I C SHELL32 loading failed\n");
     
    871908
    872909            /* comctl32 */
    873             pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
    874             pImageList_Create=(void*)GetProcAddress(hComctl32,"ImageList_Create");
    875             pImageList_AddIcon=(void*)GetProcAddress(hComctl32,"ImageList_AddIcon");
    876             pImageList_ReplaceIcon=(void*)GetProcAddress(hComctl32,"ImageList_ReplaceIcon");
    877             pImageList_GetIcon=(void*)GetProcAddress(hComctl32,"ImageList_GetIcon");
    878             pImageList_GetImageCount=(void*)GetProcAddress(hComctl32,"ImageList_GetImageCount");
    879             pImageList_Draw=(void*)GetProcAddress(hComctl32,"ImageList_Draw");
    880             pImageList_SetBkColor=(void*)GetProcAddress(hComctl32,"ImageList_SetBkColor");
    881910            pCOMCTL32_Alloc=(void*)GetProcAddress(hComctl32, (LPCSTR)71L);
    882911            pCOMCTL32_Free=(void*)GetProcAddress(hComctl32, (LPCSTR)73L);
    883             pDPA_Create=(void*)GetProcAddress(hComctl32, (LPCSTR)328L);
    884             pDPA_Destroy=(void*)GetProcAddress(hComctl32, (LPCSTR)329L);
    885             pDPA_GetPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)332L);
    886             pDPA_InsertPtr=(void*)GetProcAddress(hComctl32, (LPCSTR)334L);
    887             pDPA_DeletePtr=(void*)GetProcAddress(hComctl32, (LPCSTR)336L);
    888             pDPA_Sort=(void*)GetProcAddress(hComctl32, (LPCSTR)338L);
    889             pDPA_Search=(void*)GetProcAddress(hComctl32, (LPCSTR)339L);
    890             /* user32 */
    891             pLookupIconIdFromDirectoryEx=(void*)GetProcAddress(huser32,"LookupIconIdFromDirectoryEx");
    892             pCreateIconFromResourceEx=(void*)GetProcAddress(huser32,"CreateIconFromResourceEx");
    893912
    894913            /* initialize the common controls */
    895             if (pDLLInitComctl)
    896             {
    897               pDLLInitComctl(NULL);
    898             }
     914            InitCommonControlsEx(NULL);
    899915
    900916            SIC_Initialize();
Note: See TracChangeset for help on using the changeset viewer.