首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >体育档案-少了什么?

体育档案-少了什么?
EN

Stack Overflow用户
提问于 2014-02-05 18:31:26
回答 2查看 1.5K关注 0票数 2

我正在尝试生成PE格式的可执行文件- Windows 7,64位,最初是一个用于测试的最小文件,它只执行以下操作

代码语言:javascript
运行
复制
mov eax, 42
ret

我有一个dumpbin似乎很满意并且包含了所有字段的明显的有效值,我可以说这些字段都是实际使用的,但是当我尝试运行它时,Win32说“不是一个有效的应用程序”。dumpbin输出紧随其后;有人能从中看出我缺少的是什么吗?

代码语言:javascript
运行
复制
Dump of file a.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
            8664 machine (x64)
               1 number of sections
               0 time date stamp Thu Jan 01 00:00:00 1970
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
              22 characteristics
                   Executable
                   Application can handle large (>2GB) addresses

OPTIONAL HEADER VALUES
             20B magic # (PE32+)
            2.05 linker version
               0 size of code
               0 size of initialized data
               0 size of uninitialized data
            1000 entry point (0000000140001000)
               0 base of code
       140000000 image base (0000000140000000 to 0000000140000FFF)
            1000 section alignment
             200 file alignment
            0.00 operating system version
            0.00 image version
            4.00 subsystem version
               0 Win32 version
            1000 size of image
             200 size of headers
               0 checksum
               3 subsystem (Windows CUI)
            8100 DLL characteristics
                   NX compatible
                   Terminal Server Aware
          100000 size of stack reserve
            1000 size of stack commit
          100000 size of heap reserve
            1000 size of heap commit
               0 loader flags
              10 number of directories
               0 [       0] RVA [size] of Export Directory
               0 [       0] RVA [size] of Import Directory
               0 [       0] RVA [size] of Resource Directory
               0 [       0] RVA [size] of Exception Directory
               0 [       0] RVA [size] of Certificates Directory
               0 [       0] RVA [size] of Base Relocation Directory
               0 [       0] RVA [size] of Debug Directory
               0 [       0] RVA [size] of Architecture Directory
               0 [       0] RVA [size] of Global Pointer Directory
               0 [       0] RVA [size] of Thread Storage Directory
               0 [       0] RVA [size] of Load Configuration Directory
               0 [       0] RVA [size] of Bound Import Directory
               0 [       0] RVA [size] of Import Address Table Directory
               0 [       0] RVA [size] of Delay Import Directory
               0 [       0] RVA [size] of COM Descriptor Directory
               0 [       0] RVA [size] of Reserved Directory


SECTION HEADER #1
   .text name
       6 virtual size
    1000 virtual address (0000000140001000 to 0000000140001005)
     200 size of raw data
     200 file pointer to raw data (00000200 to 000003FF)
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         Execute Read

RAW DATA #1
  0000000140001000: B8 2A 00 00 00 C3                                ©*...+

  Summary

        1000 .text
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-02-07 13:01:56

您的“图像大小”仅覆盖标题区域;.text部分和入口点位于其外部。将其设置为至少1006,该文件应该可以工作。

我是怎么找到的

  1. 做了一个最小的C程序: int条目(){返回42;}
  2. 没有库并使用自定义条目编译它: cl test.cpp /link /nodefaultlib /entry:entry /subsystem:console
  3. 开始编辑标题以匹配您的清单,并在每次更改后运行exe。一旦我将SizeOfImage更改为1000,我就得到了“非有效的Win32应用程序”消息。
票数 5
EN

Stack Overflow用户

发布于 2014-02-05 18:38:10

我看不出你的垃圾桶输出,但是有一个很好的实用工具,CFF探索者,你可以用它来检查PE文件的几乎每一个细节。它是交互式的,显示了各种表,而且您还可以动态编辑大多数值,以便对其进行实验。

我发现在过去,将值与compare中的PE规范进行比较比使用dumpbin更容易。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21585549

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档