# merged: PE: corkami imports.exe - json output
NAME=PE: corkami imports.exe - open
FILE=bins/pe/imports.exe
CMDS=<<EOF
ii
is
?v sym.imp.msvcrt.dll_printf
?e --
iij~{}   
EOF
EXPECT=<<EOF
nth vaddr      bind type lib          name
------------------------------------------
1   0x004010c0 NONE FUNC kernel32.dll ExitProcess
1   0x004010c8 NONE FUNC msvcrt.dll   printf
nth paddr      vaddr      bind type size lib          name            demangled
-------------------------------------------------------------------------------
1   0x000002c0 0x004010c0 NONE FUNC 0    kernel32.dll imp.ExitProcess
1   0x000002c8 0x004010c8 NONE FUNC 0    msvcrt.dll   imp.printf
0x4010c8
--
[
  {
    "ordinal": 1,
    "bind": "NONE",
    "type": "FUNC",
    "sig": true,
    "name": "ExitProcess",
    "libname": "kernel32.dll",
    "plt": 4198592
  },
  {
    "ordinal": 1,
    "bind": "NONE",
    "type": "FUNC",
    "sig": true,
    "name": "printf",
    "libname": "msvcrt.dll",
    "plt": 4198600
  }
]
EOF
RUN

NAME=PE import descriptors sharing one thunk table are bounded by the file size
FILE=bins/pe/import-shared-thunks.exe
TIMEOUT=10
CMDS=<<EOF
ii~?
EOF
EXPECT=<<EOF
3202
EOF
EXPECT_ERR=<<EOF
WARN: PE import descriptors list more thunks than the file holds
WARN: PE import descriptors list more thunks than the file holds
EOF
RUN

NAME=PE: ordinal databases are only taken from dir.binsdb
FILE=bins/pe/ordinal-traversal.exe
CMDS=<<EOF
ii~wsock32[4,5]
ir~wsock32[4]
EOF
EXPECT=<<EOF
../dll/wsock32.dll Ordinal_1
../dll/wsock32.dll_Ordinal_1
EOF
RUN
