.Net中的几个小工具

 1、ILDasm
 能够将.Net下的DLL文件导出成.il文件,将生成的il文件用记事本打开,就会发现全是IL中间语言。
 2、ILAsm
 编译IL代码生成DLL或者EXE,下面来看看ILAsm的help:
ilasm


Usage: ilasm [Options] <sourcefile> [Options]

Options:
/NOLOGO         Don't type the logo
/QUIET          Don't report assembly progress
/NOAUTOINHERIT  Disable inheriting from System.Object by default
/DLL            Compile to .dll
/EXE            Compile to .exe (default)
/PDB            Create the PDB file without enabling debug info tracking
/APPCONTAINER   Create an AppContainer exe or dll
/DEBUG          Disable JIT optimization, create PDB file, use sequence points from PDB
/DEBUG=IMPL     Disable JIT optimization, create PDB file, use implicit sequence points
/DEBUG=OPT      Enable JIT optimization, create PDB file, use implicit sequence points
/OPTIMIZE       Optimize long instructions to short
/FOLD           Fold the identical method bodies into one
/CLOCK          Measure and report compilation times
/RESOURCE=<res_file>    Link the specified resource file (*.res)
                        into resulting .exe or .dll
/OUTPUT=<targetfile>    Compile to file with specified name
                        (user must provide extension, if any)
/KEY=<keyfile>      Compile with strong signature
                        (<keyfile> contains private key)
/KEY=@<keysource>   Compile with strong signature
                        (<keysource> is the private key source name)
/INCLUDE=<path>     Set path to search for #include'd files
/SUBSYSTEM=<int>    Set Subsystem value in the NT Optional header
/SSVER=<int>.<int>  Set Subsystem version number in the NT Optional header
/FLAGS=<int>        Set CLR ImageFlags value in the CLR header
/ALIGNMENT=<int>    Set FileAlignment value in the NT Optional header
/BASE=<int>     Set ImageBase value in the NT Optional header (max 2GB for 32-bit images)
/STACK=<int>    Set SizeOfStackReserve value in the NT Optional header
/MDV=<version_string>   Set Metadata version string
/MSV=<int>.<int>   Set Metadata stream version (<major>.<minor>)
/PE64           Create a 64bit image (PE32+)
/HIGHENTROPYVA  Set High Entropy Virtual Address capable PE32+ images (default for /APPCONTAINER)
/NOCORSTUB      Suppress generation of CORExeMain stub
/STRIPRELOC     Indicate that no base relocations are needed
/ITANIUM        Target processor: Intel Itanium
/X64            Target processor: 64bit AMD processor
/ARM            Target processor: ARM processor
/32BITPREFERRED Create a 32BitPreferred image (PE32)
/ENC=<file>     Create Edit-and-Continue deltas from specified source file

Key may be '-' or '/'
Options are recognized by first 3 characters
Default source file extension is .il

Target defaults:
/PE64      => /PE64 /ITANIUM
/ITANIUM   => /PE64 /ITANIUM
/X64       => /PE64 /X64
    如果我们想修改某个.NET下的DLL或者EXE,可以先用ILDASM将对应的文件转换成IL中间语言,然后再做修改,修改完,再用ILAsm生成新的DLL或者EXE。
    可以用PEVerify来做相应的校验:
PEVerify

Microsoft(R) .NET Framework PE Verifier。版本  4.0.30319.0
版权所有(C) Microsoft Corporation。保留所有权利。

用法: PEverify <映像文件> [选项]


选项:
/IL           只验证 PE 结构和 IL
/MD           只验证 PE 结构和元数据
/TRANSPARENT  仅验证透明方法
/UNIQUE       忽略重复的错误代码
/HRESULT      以十六进制格式显示错误代码
/CLOCK        计量并报告验证时间
/IGNORE=<十六进制代码>[,<十六进制代码>...]  忽略指定的错误代码
/IGNORE=@<文件名>                忽略 <文件名> 中指定的错误代码
/QUIET        只显示文件和状态。不显示所有错误。
/VERBOSE      在 IL 验证错误消息中显示附加信息。
/NOLOGO       不显示产品版本和版权信息。

注意: 默认情况下,将会验证 MD,然后在没有错误的情况下,将验证 IL。
      如果指定了 /MD /IL 选项,那么即使存在 MD 验证错误
      也仍会验证 IL。
    以上命令均为VS2015 studio自带的,通过VS2015开发人员命令 打开即可使用相应的功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值