How to tell if a windows PE file is a console subsystem or a windows subsystem programmatically?

北城以北 提交于 2020-01-10 03:16:08

问题


Basically I need a program that will sort windows .exe's from the console counterparts.

A file scanner:

SortExe(file exe) 
{
 if (IsPeWindows(exe)) 
    {
      AddToList1(exe); 
    }
 else if (IsPeConsole())
    {
    AddToList2(exe); 
    }
 }

How do I implement IsPeWindows or IsPeConsole() ?

I do not particularly mind what language solutions come in so long as it's one of c, c++, c# or visual basic.


回答1:


Pass SHGFI_EXETYPE to SHGetFileInfo() & examine the hi/loword of the return value as explained in the link.



来源:https://stackoverflow.com/questions/7739571/how-to-tell-if-a-windows-pe-file-is-a-console-subsystem-or-a-windows-subsystem-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!