Mercurial > hg > xemacs-beta
comparison src/process-nt.c @ 298:70ad99077275 r21-0b47
Import from CVS: tag r21-0b47
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:39:40 +0200 |
parents | c9fe270a4101 |
children | afd57c14dfc8 |
comparison
equal
deleted
inserted
replaced
297:deca3c1083ac | 298:70ad99077275 |
---|---|
436 | 436 |
437 /* Find out whether the application is windowed or not */ | 437 /* Find out whether the application is windowed or not */ |
438 { | 438 { |
439 /* SHGetFileInfo tends to return ERROR_FILE_NOT_FOUND on most | 439 /* SHGetFileInfo tends to return ERROR_FILE_NOT_FOUND on most |
440 errors. This leads to bogus error message. */ | 440 errors. This leads to bogus error message. */ |
441 DWORD image_type = SHGetFileInfo ((char *)XSTRING_DATA (program), 0,NULL, | 441 DWORD image_type; |
442 0, SHGFI_EXETYPE); | 442 char *p = strrchr ((char *)XSTRING_DATA (program), '.'); |
443 if (p != NULL && | |
444 (stricmp (p, ".exe") == 0 || | |
445 stricmp (p, ".com") == 0 || | |
446 stricmp (p, ".bat") == 0 || | |
447 stricmp (p, ".cmd") == 0)) | |
448 { | |
449 image_type = SHGetFileInfo ((char *)XSTRING_DATA (program), 0,NULL, | |
450 0, SHGFI_EXETYPE); | |
451 } | |
452 else | |
453 { | |
454 char progname[MAX_PATH]; | |
455 sprintf (progname, "%s.exe", (char *)XSTRING_DATA (program)); | |
456 image_type = SHGetFileInfo (progname, 0, NULL, 0, SHGFI_EXETYPE); | |
457 } | |
443 if (image_type == 0) | 458 if (image_type == 0) |
444 signal_cannot_launch (program, (GetLastError () == ERROR_FILE_NOT_FOUND | 459 signal_cannot_launch (program, (GetLastError () == ERROR_FILE_NOT_FOUND |
445 ? ERROR_BAD_FORMAT : GetLastError ())); | 460 ? ERROR_BAD_FORMAT : GetLastError ())); |
446 windowed = HIWORD (image_type) != 0; | 461 windowed = HIWORD (image_type) != 0; |
447 } | 462 } |