Changeset 92 for trunk/dll/defview.c
- Timestamp:
- May 21, 2004, 5:16:36 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/defview.c
r2 r92 1 2 /*********************************************************************** 3 4 $Id$ 5 6 Copyright (c) 1993-98 M. Kimes 7 Copyright (c) 2003 Steven H.Levine 8 9 Archive containers 10 11 Revisions 20 Nov 03 SHL - ShowMultimedia: try to convince fmplay to not play exes (Gregg Young) 12 13 ***********************************************************************/ 14 1 15 #define INCL_DOS 2 16 #define INCL_WIN … … 16 30 17 31 18 BOOL ShowMultimedia (CHAR *filename) { 19 20 static BOOL unavailable = FALSE; 21 BOOL ret = FALSE; 32 BOOL ShowMultimedia (CHAR *filename) 33 { 34 35 static BOOL no_mmos2 = FALSE; 36 BOOL played = FALSE; 22 37 CHAR loaderror[CCHMAXPATH]; 23 HMODULE MMIOModHandle = (HMODULE)0;24 PMMIOIDENTIFYFILE MMIOIdentifyFile = (PMMIOIDENTIFYFILE)0;25 FOURCC fccStorageSystem = (FOURCC)0;38 HMODULE MMIOModHandle = NULLHANDLE; 39 PMMIOIDENTIFYFILE pMMIOIdentifyFile = NULL; 40 FOURCC fccStorageSystem = 0; 26 41 MMFORMATINFO mmFormatInfo; 27 42 APIRET rc; 28 43 29 if (unavailable||30 !filename ||31 !*filename)32 return ret;44 if (no_mmos2 || 45 !filename || 46 !*filename) 47 return played; 33 48 34 49 /* load MMPM/2, if available. */ 35 50 *loaderror = 0; 36 51 rc = DosLoadModule(loaderror, 37 38 39 40 if (rc) {41 unavailable= TRUE;42 return ret;52 sizeof(loaderror), 53 "MMIO", 54 &MMIOModHandle); 55 if (rc) { 56 no_mmos2 = TRUE; 57 return played; 43 58 } 44 59 else { 45 if (DosQueryProcAddr(MMIOModHandle,46 47 48 (PFN *)&MMIOIdentifyFile)) {60 if (DosQueryProcAddr(MMIOModHandle, 61 0, 62 "mmioIdentifyFile", 63 (PFN *)&pMMIOIdentifyFile)) { 49 64 DosFreeModule(MMIOModHandle); 50 unavailable= TRUE;51 return ret;65 no_mmos2 = TRUE; 66 return played; 52 67 } 53 68 } … … 56 71 memset(&mmFormatInfo,0,sizeof(MMFORMATINFO)); 57 72 mmFormatInfo.ulStructLen = sizeof(MMFORMATINFO); 58 rc = MMIOIdentifyFile(filename,59 60 61 62 63 73 rc = pMMIOIdentifyFile(filename, 74 0L, 75 &mmFormatInfo, 76 &fccStorageSystem, 77 0L, 78 MMIO_FORCE_IDENTIFY_FF); 64 79 /* free module handle */ 65 80 DosFreeModule(MMIOModHandle); 66 81 67 /* check returns from MMPM/2's identification process*/68 if (rc != MMIO_ERROR&&69 mmFormatInfo.fccIOProc != FOURCC_DOS) {70 if (mmFormatInfo.ulMediaType == MMIO_MEDIATYPE_IMAGE &&71 (mmFormatInfo.ulFlags & MMIO_CANREADTRANSLATED) != 0) {72 /* is an image */82 /* if identified and not FOURCC_DOS */ 83 if (!rc && 84 mmFormatInfo.fccIOProc != FOURCC_DOS) { 85 if (mmFormatInfo.ulMediaType == MMIO_MEDIATYPE_IMAGE && 86 (mmFormatInfo.ulFlags & MMIO_CANREADTRANSLATED)) { 87 /* is an image that can be translated */ 73 88 runemf2(SEPARATE | WINDOWED, 74 HWND_DESKTOP, 75 NULL, 76 NULL, 77 "%sIMAGE.EXE \"%s\"", 78 (fAddUtils) ? "UTILS\\" : NullStr, 79 filename); 80 ret = TRUE; 81 } 82 else { 83 if(mmFormatInfo.ulMediaType != MMIO_MEDIATYPE_IMAGE) 84 /* is a multimedia file (WAV, MID, AVI, etc.) */ 85 runemf2(SEPARATE | WINDOWED, 86 HWND_DESKTOP, 87 NULL, 88 NULL, 89 "%sFM2PLAY.EXE \"%s\"", 90 (fAddUtils) ? "UTILS\\" : NullStr, 91 filename); 92 ret = TRUE; 93 } 94 } 95 96 return ret; 89 HWND_DESKTOP, 90 NULL, 91 NULL, 92 "%sIMAGE.EXE \"%s\"", 93 (fAddUtils) ? "UTILS\\" : NullStr, 94 filename); 95 played = TRUE; 96 } 97 else if (mmFormatInfo.ulMediaType != MMIO_MEDIATYPE_IMAGE) { 98 /* is a multimedia file (WAV, MID, AVI, etc.) */ 99 runemf2(SEPARATE | WINDOWED, 100 HWND_DESKTOP, 101 NULL, 102 NULL, 103 "%sFM2PLAY.EXE \"%s\"", 104 (fAddUtils) ? "UTILS\\" : NullStr, 105 filename); 106 played = TRUE; 107 } 108 } 109 110 return played; 97 111 } 98 112 99 113 100 114 VOID DefaultViewKeys (HWND hwnd,HWND hwndFrame,HWND hwndParent, 101 115 SWP *swp,CHAR *filename) { 102 116 103 117 if((shiftstate & (KC_CTRL | KC_SHIFT)) == 104 118 (KC_CTRL | KC_SHIFT)) 105 119 DefaultView(hwnd, 106 107 108 109 110 120 hwndFrame, 121 hwndParent, 122 swp, 123 4, 124 filename); 111 125 else if(shiftstate & KC_CTRL) 112 126 DefaultView(hwnd, 113 114 115 116 117 127 hwndFrame, 128 hwndParent, 129 swp, 130 2, 131 filename); 118 132 else if(shiftstate & KC_SHIFT) 119 133 DefaultView(hwnd, 120 121 122 123 124 134 hwndFrame, 135 hwndParent, 136 swp, 137 1, 138 filename); 125 139 else 126 140 DefaultView(hwnd, 127 128 129 130 131 141 hwndFrame, 142 hwndParent, 143 swp, 144 0, 145 filename); 132 146 } 133 147 134 148 135 149 VOID DefaultView (HWND hwnd,HWND hwndFrame,HWND hwndParent,SWP *swp, 136 150 ULONG flags,CHAR *filename) { 137 151 138 152 /* … … 166 180 if(flags & 2) { /* open default WPS view of file */ 167 181 OpenObject(filename, 168 169 182 Default, 183 hwnd); 170 184 return; 171 185 } … … 173 187 if(flags & 4) { /* open WPS settings notebook for file */ 174 188 OpenObject(filename, 175 176 189 Settings, 190 hwnd); 177 191 return; 178 192 } … … 185 199 if(!IsFullName(filename)) { 186 200 if(!DosQueryPathInfo(filename, 187 188 189 190 201 FIL_QUERYFULLNAME, 202 fullname, 203 sizeof(fullname))) 204 filename = fullname; 191 205 } 192 206 if(IsFullName(filename) && 193 207 !(driveflags[toupper(*filename) - 'A'] & DRIVE_INVALID)) { 194 208 if(!IsRoot(filename)) { 195 196 197 198 199 200 201 202 209 dummy[0] = filename; 210 dummy[1] = NULL; 211 WinDlgBox(HWND_DESKTOP, 212 HWND_DESKTOP, 213 FileInfoProc, 214 FM3ModHandle, 215 FLE_FRAME, 216 (PVOID)dummy); 203 217 } 204 218 else 205 206 207 208 209 210 219 WinDlgBox(HWND_DESKTOP, 220 HWND_DESKTOP, 221 DrvInfoProc, 222 FM3ModHandle, 223 INFO_FRAME, 224 (PVOID)filename); 211 225 } 212 226 return; … … 223 237 switch(type) { 224 238 case IDM_EDITBINARY: 225 226 227 228 229 230 231 232 233 239 if(*bined) { 240 ExecOnList((HWND)0, 241 bined, 242 WINDOWED | SEPARATE, 243 NULL, 244 dummy, 245 NULL); 246 break; 247 } 234 248 /* else intentional fallthru */ 235 249 case IDM_EDITTEXT: 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 250 if(*editor) 251 ExecOnList((HWND)0, 252 editor, 253 WINDOWED | SEPARATE, 254 NULL, 255 dummy, 256 NULL); 257 else { 258 type = (type == IDM_EDITTEXT) ? 8 : 259 (type == IDM_EDITBINARY) ? 16 : 260 0; 261 type |= 4; 262 StartMLEEditor(hwndParent, 263 type, 264 filename, 265 hwndFrame); 266 } 267 break; 254 268 } 255 269 return; … … 257 271 258 272 if(ExecAssociation(hwnd, 259 273 filename) == -1) { 260 274 hwndArc = StartArcCnr((fExternalArcboxes || !swp || 261 262 263 264 265 266 267 275 strcmp(realappname,FM3Str)) ? 276 HWND_DESKTOP : 277 hwndParent, 278 hwndFrame, 279 filename, 280 4, 281 NULL); 268 282 if(!hwndArc) { 269 283 if(!fCheckMM || 270 271 272 273 274 275 276 277 278 279 280 281 284 !ShowMultimedia(filename)) { 285 if(!IsExecutable(filename) || 286 !ExecFile(hwnd,filename)) { 287 p = strrchr(filename,'.'); 288 if(!p) 289 p = "."; 290 if(stricmp(p,".INI") || 291 !StartIniEditor(hwndParent, 292 filename, 293 4)) { 294 if(stricmp(p,".HLP") || 295 !ViewHelp(filename)) { 282 296 ViewIt: 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 297 if(*viewer) { 298 dummy[0] = filename; 299 dummy[1] = NULL; 300 ExecOnList(hwnd, 301 viewer, 302 WINDOWED | SEPARATE | 303 ((fViewChild) ? CHILD : 0), 304 NULL, 305 dummy, 306 NULL); 307 } 308 else 309 StartMLEEditor(hwndParent, 310 5, 311 filename, 312 hwndFrame); 313 } 314 } 315 } 302 316 } 303 317 } 304 318 else { 305 319 if((swp && 306 307 308 309 310 311 312 313 314 315 316 320 !fExternalArcboxes && 321 !strcmp(realappname,FM3Str)) && 322 !ParentIsDesktop(hwnd,hwndParent)) 323 WinSetWindowPos(hwndArc, 324 HWND_TOP, 325 swp->x, 326 swp->y, 327 swp->cx, 328 swp->cy, 329 SWP_MOVE | SWP_SIZE | SWP_SHOW | 330 SWP_ZORDER | SWP_ACTIVATE); 317 331 } 318 332 }
Note:
See TracChangeset
for help on using the changeset viewer.