Changeset 1479 for trunk/dll/defview.c


Ignore:
Timestamp:
Nov 15, 2009, 11:40:25 PM (16 years ago)
Author:
Gregg Young
Message:

Work around MMIO's failure to recognize MPG files as media. Reorder file type checks to eliminate problem with MMIO identifying exes etc as media. Check for zero byte file and let user decide to open in an editor or abort (also prevents MMIO misidentification). Tickets 70, 405, 409, 410

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/defview.c

    r1402 r1479  
    2222  05 Jan 09 GKY Use TestBinary so that text veiwer isn't used for hex files by default
    2323  08 Mar 09 GKY Additional strings move to PCSZs
     24  15 Nov 09 GKY Add check for attempt to open zero byte file and reorder file type checks
     25                to place exes before MMPM check (avoids MMPM trying to play them)
     26  15 Nov 09 GKY Work around MMIO's falure to identify MPG files as media
    2427
    2528***********************************************************************/
     
    7275  HMODULE MMIOModHandle = NULLHANDLE;
    7376  PMMIOIDENTIFYFILE pMMIOIdentifyFile = NULL;
    74   PMMIOGETINFO pMMIOGetInfo = NULL;
    75   PMMIOCLOSE pMMIOClose = NULL;
    76   PMMIOOPEN pMMIOOpen = NULL;
    77   MMIOINFO mmioinfo;
    78   HMMIO hmmio;
     77  //PMMIOGETINFO pMMIOGetInfo = NULL;
     78  //PMMIOCLOSE pMMIOClose = NULL;
     79  //PMMIOOPEN pMMIOOpen = NULL;
     80  //MMIOINFO mmioinfo;
     81  //HMMIO hmmio;
    7982  FOURCC fccStorageSystem = 0;
    8083  MMFORMATINFO mmFormatInfo;
    81   APIRET rc, rc1;
     84  APIRET rc; // rc1;
    8285  HWND hwnd = HWND_DESKTOP;
    8386  char *p;
     
    101104      return played;
    102105    }
    103     if (DosQueryProcAddr(MMIOModHandle,
     106    /* This code seems to serve no purpose GKY 11-15-09
     107     if (DosQueryProcAddr(MMIOModHandle,
    104108                         0,
    105109                         "mmioGetInfo", (PFN *) & pMMIOGetInfo)) {
     
    121125      no_mmos2 = TRUE;
    122126      return played;
    123     }
     127    }*/
    124128  }
    125129
    126130  /* attempt to identify the file using MMPM/2 */
    127   memset( &mmioinfo, '\0', sizeof(MMIOINFO) );
     131  //memset( &mmioinfo, '\0', sizeof(MMIOINFO) );
    128132  /*Eliminate non multimedia files*/
    129   hmmio = pMMIOOpen(filename,
     133  /*hmmio = pMMIOOpen(filename,
    130134                    &mmioinfo,
    131135                    MMIO_READ);
     
    153157          return played;
    154158  }
    155   rc1 = pMMIOGetInfo(hmmio, &mmioinfo, 0L);
     159  rc1 = pMMIOGetInfo(hmmio, &mmioinfo, 0L);*/
    156160  memset(&mmFormatInfo, 0, sizeof(MMFORMATINFO));
    157161  mmFormatInfo.ulStructLen = sizeof(MMFORMATINFO);
    158162  rc = pMMIOIdentifyFile(filename,
    159                          &mmioinfo,
     163                         0L, //&mmioinfo,
    160164                         &mmFormatInfo,
    161165                         &fccStorageSystem, 0L,
    162166                         MMIO_FORCE_IDENTIFY_FF);
    163167  /* free module handle */
    164   rc1 = pMMIOClose(hmmio, 0L);
     168  //rc1 = pMMIOClose(hmmio, 0L);
    165169  DosFreeModule(MMIOModHandle);
    166170
    167171  /* if identified and not FOURCC_DOS */
    168   if (!rc && mmFormatInfo.fccIOProc != FOURCC_DOS) {
     172  p = strrchr(filename, '.'); //Added to save mp3, ogg & flac which fail above test
     173  if (!p)
     174    p = ".";
     175  if (!rc && (mmFormatInfo.fccIOProc != FOURCC_DOS || !stricmp(p, PCSZ_DOTMPG) ||
     176              !stricmp(p, PCSZ_DOTMPEG))) {  // MPG are identified as FOURCC_DOS
    169177    if (mmFormatInfo.ulMediaType == MMIO_MEDIATYPE_IMAGE &&
    170178        (mmFormatInfo.ulFlags & MMIO_CANREADTRANSLATED)) {
     
    175183            OpenObject(filename, Default, hwnd);  //Image fails to display these
    176184          else       // is an image that can be translated
    177             RunFM2Util("IMAGE.EXE", filename);
     185            RunFM2Util(PCSZ_IMAGEEXE, filename);
    178186          played = TRUE;
    179187    }
     
    311319                          hwndParent, hwndFrame, filename, 4, NULL);
    312320    if (!hwndArc) {
    313       if (!fCheckMM || !ShowMultimedia(filename)) {
    314         if (!IsExecutable(filename) || !ExecFile(hwnd, filename)) {
    315           p = strrchr(filename, '.');
    316           if (!p)
    317             p = ".";
    318           if (stricmp(p, ".INI") || !StartIniEditor(hwndParent, filename, 4)) {
    319             if (stricmp(p, PCSZ_DOTHLP) || !ViewHelp(filename)) {
     321      if (!IsExecutable(filename) || !ExecFile(hwnd, filename)) {
     322        p = strrchr(filename, '.');
     323        if (!p)
     324          p = ".";
     325        if (stricmp(p, ".INI") || !StartIniEditor(hwndParent, filename, 4)) {
     326          if (stricmp(p, PCSZ_DOTHLP) || !ViewHelp(filename)) {
     327            if (!fCheckMM || !stricmp(p, ".DLL") || !ShowMultimedia(filename)) {
    320328            ViewIt:
    321329              if (TestBinary(filename)) {
Note: See TracChangeset for help on using the changeset viewer.