Corinna Vinschen wrote: >> Do you think this idea is worth pursuing? > > Sounds like a good idea to me. I'm just wondering, is there really > no easy Win32 function to fetch this information, along the lines > of the GetBinaryType function?
Well, there's SHGetFileInfo with the SHGFI_EXETYPE flag, but it doesn't do exactly what we'd want. It returns 0 Nonexecutable file or an error condition. LOWORD = NE or PE and HIWORD = Windows version Microsoft Windows application. LOWORD = MZ and HIWORD = 0 Windows 95, Windows 98: Microsoft MS-DOS .exe, .com, or .bat file Microsoft Windows NT, Windows 2000, Windows XP: MS-DOS .exe or .com file LOWORD = PE and HIWORD = 0 Windows 95, Windows 98: Microsoft Win32 console application Windows NT, Windows 2000, Windows XP: Win32 console application or .bat file I guess the only case that means "Windows GUI" is NE|PE,0 -- everything else is "Windows CUI" or other, and we'd want to employ run's console-hiding code for those other cases. I'd need to use explicitly the *W version on cyg-1.7 -- but I'm not ready to audit the entire program for long-path compliance yet (I'll do that after forking the codebase for 1.7 as "run-1.2.x", and refactoring a bit). I'll think about it some more. Using stdio to access the innards of the file isn't that hard, and lets me rely on cygwin to handle long path name issues -- but means that the mingw version won't be LFN compliant. -- Chuck -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple