定义数据结构的 Sourcer 语法是什么?

逆向工程 反汇编者
2021-06-21 23:55:40

我正在使用 V Communications 的 Sourcer 大约 2000 年的第 8 版。他们不再支持它。我早就丢失了手册。

当您发现要反汇编的代码时,您可以编辑一个定义文件。在该文件的数据部分,您可以使用 DS 命令创建数据结构。我不记得语法了。

2个回答

我也想看 Sourcer 手册。在部分答案中,安装包含一个文件 SAMPLE2.DEF,其中包含以下文本:

          ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
              SAMPLE2 DEFINITION FILE
          ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄

 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ Section 1: CONTROL INFORMATION   ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

uP               = 8088


 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ Section 2: RANGE DEFINITION      ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

 ════ Segments ══════════════════════════

  begin   ....   end   ..   default  ..    seg ...  seg   
 seg:off  ..   off  ..   ds  ..   es  ...   type . size  
 -------   ...  ---- ..   ---- ----  .. ----- . -----  
none


 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ Section 3: REFERENCE DEFINITIONS ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

 ════ Subroutines ═══════════════════════  
  seg:off ..  type & options  ..   label     ..      comments  
  ------- ..  --------------   ..  -------------- --------------



 ════ Locations ═════════════════════════  
  seg:off ..  type & options  ..   label     ......      comments  
  ------- ..  --------------  ..   -------------- .. --------------



 ════ Data Items ════════════════════════  
  seg:off ..  type & options  ..   label     ......      comments  
  ------- ...  --------------  ..   -------------- .. --------------

对于定义数据结构,使用与所有其他引用相同的格式

seg:off ds,<options> label,comment

定义您的结构,详细说明 DS 下面的每个项目一行 without seg:offset

SR 通常会创建一个<infile.SDF>带有 sdf 扩展名的文件(sourcer default definition file)
复制粘贴该文件,<infile.def>然后开始修改它以满足需要。

c:\> sr foo.com (define your prefs for assembler etc here and press g)  
c:\> ren foo.sdf foo.def  
c:\> edit foo.def  

seg_a:3127   da, r 0D                  ; data_137  
seg_a:3157   da, r 55    somesymbol   ;  
seg_a:31AC   ds, r 0020  MyStruct     ;// struct defined here (Array of 0x20 structs)  
             dd, c 4     int blah     ; member 1  // need foo.rem file for comments  
             dw          short foo    ; memeber 2  
             dw          short yaa    ; member 3  
             da, r 6     pathname     ; member 4  
             dd          magic        ; member 5  
seg_a:3BB0   da, r 29                 ; data_185  

alt+f alt+ s   

c:\> sr foo.def   

输出(评论来自 foo.rem 文件(您的安装中将有一个示例文件 testyn.rem 复制粘贴重命名 foo.rem 并在需要评论时编辑该文件)

C:\>grep -i -A 20 "This is mystruct" Foo.LST  

3BC5:31AC  B9F9 0008            int             dd      8B9F9h
; This is mystruct    
;  defined as    
;  typeded struct _MYSTR    
;  {    
;  ulong    
;  short    
;  short    
;  char[06]    
;  ulong    
;  }Mystr, *PMystr;
3BC5:31B0  45E8                 short           dw      45E8h
3BC5:31B2  E8F5                 short           dw      0E8F5h
3BC5:31B4  10 FC E8 C6 EC E8    pathname        db      10h, 'ⁿΦ╞∞Φ'
3BC5:31BA  DB84 B800            magic           dd      0B800DB84h
3BC5:31BE  0006 36E8            int1            dd      36E80006h
3BC5:31C2  E8F0                 short1          dw      0E8F0h
3BC5:31C4  F5A7                 short1          dw      0F5A7h
3BC5:31C6  B9 08 00             pathname1       db      '╣', 8, 0
3BC5:31C9  E8 2C F5                             db      'Φ,⌡'
3BC5:31CC  61E8 B9FA            magic1          dd      0B9FA61E8h
3BC5:31D0  0008 23E8            int2            dd      23E80008h

C:\>