def getDeviceName():
"""
Get Device Name from a driver.
@rtype: void
@returns: void
"""
ea = 0
while True:
ea = FindText(ea, SEARCH_NEXT | SEARCH_REGEX, 0, 0, "\\\\Device\\\\")
string = GetString(ea, -1, ASCSTR_UNICODE)
if string is None:
continue
else:
#Message("Find in %x\n" % ea)
Message("device is %s\n" % string)
break
def getDispatchAddress():
"""
Get Device Dispatch Address from a driver.
@rtype: int
@returns: Dispatch Address
"""
ea = 0
ea = FindText(ea, SEARCH_DOWN |SEARCH_NEXT | SEARCH_REGEX, 0, 0, "mov *dword *ptr *\\[[a-zA-Z]* *\\+ *70h\\],[a-zA-Z0-9_ ]*")
#ea = FindText(ea, SEARCH_NEXT | SEARCH_REGEX, 0, 0, "test *[a-zA-Z]*, +[a-zA-Z]*")
#Message("Find in %x\n" % ea)
if ea == BADADDR:
Message("Cann't find the Dispatch address")
address = BADADDR
else:
address = GetOperandValue(ea,1)
Message("Dispatch address is %x\n" % address)
return address