How to tell if a file is an EXE or a DLL?

 void DumpFile(LPWSTR filename)
{
HANDLE hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, ); HANDLE hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, , , NULL); LPVOID lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, , , ); PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)lpFileBase; PIMAGE_NT_HEADERS pNTHeader = (PIMAGE_NT_HEADERS)((DWORD)pDosHeader + (DWORD)pDosHeader->e_lfanew); if ((pNTHeader->FileHeader.Characteristics & IMAGE_FILE_DLL))
printf("dll");
if ((pNTHeader->FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE))
printf("exe");
else
printf("????"); UnmapViewOfFile(lpFileBase);
CloseHandle(hFileMapping);
CloseHandle(hFile);
}

How to tell if a file is an EXE or a DLL?的更多相关文章

  1. 安装SQL2008时遇到"未能加载文件或"file:///d:microsoft..sql.chainer.packagedata.dll"或它的某个依赖项

    安装SQL2008时遇到"未能加载文件或"file:///d:microsoft..sql.chainer.packagedata.dll"或它的某个依赖项,如下图所示 ...

  2. Qt Creator编译时:cannot open file 'debug\QtGuiEx.exe' File not found

    Qt Creator编译时:cannot open file 'debug\QtGuiEx.exe' File not found 利用Qt Creator编译工程时,出现如题目所示的错误,其中红色部 ...

  3. IIS中发布后出现Could not load file or assembly'System.Data.SQLite.dll' or one of its depedencies

    [问题]在我本机的开发环境c#连接sqlite3没有问题,可是release版本移植到其他的机器就提示Could not load file or assembly'System.Data.SQLit ...

  4. How to update WPF browser application manifest and xbap file with ‘mage.exe’

    老外参考文章1 老外参考文章2 I created a WPF browser application MyApp then published it by ClickOnce in VS2008. ...

  5. Could not load file or assembly "\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies.

     Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Repor ...

  6. Could not load file or assembly system.data.sqlite.dll or one for it's depedencies

    最近做一个winform项目,因为数据库用的表很少,所以用的是轻量级数据库sqlite.sqlite的优点很多,但是他要分两个版本,32位或者64位,不能同时兼容. 我遇到的问题是,我在开发端用的是. ...

  7. 错误 Metadata file 'C:\Common\bin\Debug\Common.dll' could not be found

    一个通用方法de类库/总是报这个错误/很明显就是没有成功生成程序集... 但是就是找不到哪里的错误!!!! 如果是代码写错的话,可能会直接提示在哪个文件中哪行代码写错了,然后dll生成不了,但是这个错 ...

  8. Could not load file or assembly'System.Data.SQLite.dll' or one of its depedencies

    安装对应的 Microsoft Visual C++ 2010 Redistributable Package (x86)   If your download does not start afte ...

  9. QT cannot open output file debug\OpencvTest.exe: Permission denied

    问题:调试运行QT的时候遇到这个问题,发现时是由于没有正常关闭程序所致,导致后台有之前运行的程序在跑(电脑环境win7 64 Qt5.2.1 opencv2.4.6). 目前解决办法:手动关闭已在运行 ...

随机推荐

  1. KNN实现手写数字识别

    KNN实现手写数字识别 博客上显示这个没有Jupyter的好看,想看Jupyter Notebook的请戳KNN实现手写数字识别.ipynb 1 - 导入模块 import numpy as np i ...

  2. hibernate介绍及环境搭建

    1.前言 hibernate与mybatis的位置一样,都是属于DAO层的框架,代替我们原来的JDBC操作数据库,属于ORM(object relationg mapping. 对象关系映射)框架.O ...

  3. springboot整合Thymeleaf模板引擎

    引入依赖 需要引入Spring Boot的Thymeleaf启动器依赖. <dependency> <groupId>org.springframework.boot</ ...

  4. springcloud中的负载均衡策略

    IRule 这是所有负载均衡策略的父接口,里边的核心方法就是choose方法,用来选择一个服务实例. AbstractLoadBalancerRule AbstractLoadBalancerRule ...

  5. centos7 部署 docker、shipyard

    =============================================== 2019/4/9_第3次修改                       ccb_warlock 更新说 ...

  6. ecplise里的run as里只有run configurations是怎么回事?

    一.没有main方法 二.main方法所在的类不是在与文件名同名的类中

  7. Ueditor百度编辑器中的 setContent()方法的使用

    百度编辑器Ueditor所提供的setContent()方法作用是:设置或者改变编辑器里面的文字内容或html内容 函数说明:setContent(string,boolean); 参数string ...

  8. 【测试工具】http协议调试利器fiddler使用教程

    转自:http协议调试利器fiddler使用教程http://bbs.phpchina.com/thread-207418-1-1.html Fiddler真乃神器!它和市面上常见的很多web调试器. ...

  9. docker容器重启故障

    问题 强杀docker进程后,重启docker.docker中的容器无法启动并报错,报错内容如下 docker restart ae1f7b2c2f15 Error response from dae ...

  10. nginx静态资源缓存策略配置

    1. 问题-背景 以前也经常用nginx,但用的不深,通常是简单的设置个location用来做反向代理.直到今天给客户做项目碰到缓存问题:客户有个app,只是用原生做了个壳,里面的内容都是用h5写的, ...