Skip to content

Commit

Permalink
Update PE relocation tests
Browse files Browse the repository at this point in the history
* Removed a.exe and b.exe tests, as they don't contain base relocations
  and swapped them with good tests
* Corrected the olds tests

1. Need to add MDMP
2. Need to implement PE relocs patching to get the other tests to work
  • Loading branch information
Roeegg2 committed Nov 13, 2024
1 parent b9a2881 commit 0040b1d
Show file tree
Hide file tree
Showing 6 changed files with 1,362 additions and 202 deletions.
2 changes: 1 addition & 1 deletion test/db/analysis/x86_32
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ s 0x00402ade
pd 4~printf
EOF
EXPECT=<<EOF
0x00402ae8 call dword [sym.imp.msvcrt.dll_printf] ; 0x402d48 ; esp=0x177ff8 ; eip=0x2d08 reloc.msvcrt.dll_printf
0x00402ae8 call dword [sym.imp.msvcrt.dll_printf] ; 0x402d48 ; esp=0x177ff8 ; eip=0x2d08
; int printf(" - RT_MANIFEST resource located\n")
EOF
RUN
Expand Down
2 changes: 1 addition & 1 deletion test/db/analysis/x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ EXPECT=<<EOF
| 0x14000b568 4533c9 xor r9d, r9d ; LPSECURITY_ATTRIBUTES lpSecurityAttributes
| 0x14000b56b 4489442420 mov dword [dwCreationDisposition], r8d ; DWORD dwCreationDisposition
| 0x14000b570 ba00000040 mov edx, 0x40000000 ; DWORD dwDesiredAccess
| 0x14000b575 ff158d1c0000 call qword [sym.imp.KERNEL32.dll_CreateFileW] ; [sym.imp.KERNEL32.dll_CreateFileW:8]=0x1579e reloc.KERNEL32.dll_CreateFileW ; HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
| 0x14000b575 ff158d1c0000 call qword [sym.imp.KERNEL32.dll_CreateFileW] ; [0x14000d208:8]=0x1579e ; HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
| 0x14000b57b 4889057eb400. mov qword [0x140016a00], rax ; [0x140016a00:8]=-2
| 0x14000b582 4883c448 add rsp, 0x48
\ 0x14000b586 c3 ret
Expand Down
8 changes: 4 additions & 4 deletions test/db/cmd/cmd_pd
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,8 @@ e asm.cmt.right=false
pd 1 @ 0x004010fa
EOF
EXPECT=<<EOF
0x004010fa 8b3500204000 mov esi, dword [sym.imp.KERNEL32.dll_GetLastError] ; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
0x004010fa 8b3500204000 mov esi, dword [sym.imp.KERNEL32.dll_GetLastError] ; [0x402000:4]=0x29f4
; [0x402000:4]=0x29f4
0x004010fa 8b3500204000 mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
EOF
RUN
Expand All @@ -879,8 +879,8 @@ e asm.cmt.right=false
pd 1 @ 0x004010fa
EOF
EXPECT=<<EOF
0x004010fa 8b3500204000 mov esi, dword [ptr_GetLastError] ; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
; [0x402000:4]=0x29f4 reloc.KERNEL32.dll_GetLastError
0x004010fa 8b3500204000 mov esi, dword [ptr_GetLastError] ; [0x402000:4]=0x29f4
; [0x402000:4]=0x29f4
0x004010fa 8b3500204000 mov esi, dword [ptr_GetLastError]
EOF
RUN
Expand Down
8 changes: 3 additions & 5 deletions test/db/formats/pe/imports_tinyW7
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ ir
ii
EOF
EXPECT=<<EOF
vaddr paddr type name
-------------------------------------------------
0x8000011c 0x00000248 SET_32 kernel32_FindAtomW
0x800004f4 0x00000234 SET_32 msvcrt_Ordinal_1268
vaddr paddr type name
----------------------
nth vaddr bind type lib name
------------------------------------------------
284 ---------- NONE FUNC kernel32 FindAtomW
284 0x00401048 NONE FUNC kernel32 Ordinal_284
1268 0x00401034 NONE FUNC msvcrt Ordinal_1268
EOF
RUN
Loading

0 comments on commit 0040b1d

Please sign in to comment.