Skip to content
Snippets Groups Projects
Commit d5c0164b authored by Nguyen Anh Quynh's avatar Nguyen Anh Quynh Committed by GitHub
Browse files

Merge pull request #245 from mrexodia/x64_sym_resolver

added regression test for sym_resolver
parents 40c477a7 719be57a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# Test some issues with KS_OPT_SYM_RESOLVER
# Github issue: #244
# Author: Duncan (mrexodia)
from keystone import *
import regress
class TestX86(regress.RegressTest):
def runTest(self):
def sym_resolver(symbol, value):
# is this the missing symbol we want to handle?
if symbol == "ZwQueryInformationProcess":
# put value of this symbol in @value
value = 0x7FF98A050840
# we handled this symbol, so return true
print 'sym_resolver called!'
return True
# we did not handle this symbol, so return false
return False
# Initialize Keystone engine
ks = Ks(KS_ARCH_X86, KS_MODE_64)
ks.sym_resolver = sym_resolver
encoding, _ = ks.asm(b"call 0x7FF98A050840", 0x7FF98A081A38)
self.assertEqual(encoding, [ 0xE8, 0x03, 0xEE, 0xFC, 0xFF ])
encoding, _ = ks.asm(b"call ZwQueryInformationProcess", 0x7FF98A081A38)
self.assertEqual(encoding, [ 0xE8, 0x03, 0xEE, 0xFC, 0xFF ])
if __name__ == '__main__':
regress.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment