Skip to content

Commit

Permalink
Merge pull request #23 from JayFoxRox/more-ke
Browse files Browse the repository at this point in the history
Support more kernel functions
  • Loading branch information
JayFoxRox authored Oct 6, 2018
2 parents 22c887f + b15ca8a commit 20ff733
Showing 1 changed file with 130 additions and 0 deletions.
130 changes: 130 additions & 0 deletions xboxpy/ke.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,46 @@
FALSE = 0x00000000
TRUE = 0x00000001 # FIXME: Check if these are correct!

HalHaltRoutine = 0
HalRebootRoutine = 1
HalQuickRebootRoutine = 2
HalKdRebootRoutine = 3
HalFatalErrorRebootRoutine = 4

def AvSendTVEncoderOption(RegisterBase, Option, Param, Result):
#IN PVOID RegisterBase,
#IN ULONG Option,
#IN ULONG Param,
#OUT PULONG Result
call_stdcall(2, "<IIII", RegisterBase, Option, Param, Result)

def HalReadSMBusValue(SlaveAddress, CommandCode, ReadWordValue, DataValue):
#IN UCHAR SlaveAddress,
#IN UCHAR CommandCode,
#IN BOOLEAN ReadWordValue,
#OUT ULONG *DataValue
return call_stdcall(45, "<IIII", SlaveAddress, CommandCode, ReadWordValue, DataValue)

def HalReadWritePCISpace(BusNumber, SlotNumber, RegisterNumber, Buffer, Length, WritePCISpace):
#IN ULONG BusNumber,
#IN ULONG SlotNumber,
#IN ULONG RegisterNumber,
#IN PVOID Buffer,
#IN ULONG Length,
#IN BOOLEAN WritePCISpace
call_stdcall(46, "<IIIIII", BusNumber, SlotNumber, RegisterNumber, Buffer, Length, WritePCISpace)

def HalReturnToFirmware(Routine):
#FIRMWARE_REENTRY Routine
call_stdcall(49, "<I", Routine)

def HalWriteSMBusValue(SlaveAddress, CommandCode, WriteWordValue, DataValue):
#IN UCHAR SlaveAddress,
#IN UCHAR CommandCode,
#IN BOOLEAN WriteWordValue,
#IN ULONG DataValue
return call_stdcall(50, "<IIII", SlaveAddress, CommandCode, WriteWordValue, DataValue)

def IoDeviceObjectType():
return pe.resolve_export(70)

Expand All @@ -40,6 +73,9 @@ def IoSynchronousDeviceIoControlRequest(IoControlCode, DeviceObject, InputBuffer
def KeTickCount():
return pe.resolve_export(156)

def LaunchDataPage():
return pe.resolve_export(164)

def MmAllocateContiguousMemory(NumberOfBytes):
return call_stdcall(165, "<I", NumberOfBytes)

Expand All @@ -52,6 +88,29 @@ def MmFreeContiguousMemory(BaseAddress):
def MmGetPhysicalAddress(BaseAddress):
return call_stdcall(173, "<I", BaseAddress)

def MmMapIoSpace(PhysicalAddress, NumberOfBytes, Protect):
#IN ULONG_PTR PhysicalAddress,
#IN SIZE_T NumberOfBytes,
#IN ULONG Protect
return call_stdcall(177, "<III", PhysicalAddress, NumberOfBytes, Protect)

def MmPersistContiguousMemory(BaseAddress, NumberOfBytes, Persist):
#IN PVOID BaseAddress,
#IN SIZE_T NumberOfBytes,
#IN BOOLEAN Persist
return call_stdcall(178, "<III", BaseAddress, NumberOfBytes, Persist)

def MmSetAddressProtect(BaseAddress, NumberOfBytes, NewProtect):
#IN PVOID BaseAddress,
#IN ULONG NumberOfBytes,
#IN ULONG NewProtect
call_stdcall(182, "<III", BaseAddress, NumberOfBytes, NewProtect)

def MmUnmapIoSpace(BaseAddress, NumberOfBytes):
#IN PVOID BaseAddress,
#IN SIZE_T NumberOfBytes,
return call_stdcall(183, "<II", BaseAddress, NumberOfBytes)

def ObReferenceObjectByName(ObjectName, Attributes, ObjectType, ParseContext, Object):
#IN POBJECT_STRING ObjectName,
#IN ULONG Attributes,
Expand All @@ -74,6 +133,77 @@ def XboxHDKey():
def XboxSignatureKey():
return pe.resolve_export(325)

def XeImageFileName():
return pe.resolve_export(326)

def READ_PORT_BUFFER_UCHAR(Port, Buffer, Count):
#PUCHAR Port,
#PUCHAR Buffer,
#ULONG Count
call_stdcall(329, "<III", Port, Buffer, Count)

def READ_PORT_BUFFER_USHORT(Port, Buffer, Count):
#PUSHORT Port,
#PUSHORT Buffer,
#ULONG Count
call_stdcall(330, "<III", Port, Buffer, Count)

def READ_PORT_BUFFER_ULONG(Port, Buffer, Count):
#PULONG Port,
#PULONG Buffer,
#ULONG Count
call_stdcall(331, "<III", Port, Buffer, Count)

def WRITE_PORT_BUFFER_UCHAR(Port, Buffer, Count):
#IN PUCHAR Port,
#IN PUCHAR Buffer,
#IN ULONG Count
call_stdcall(332, "<III", Port, Buffer, Count)

def WRITE_PORT_BUFFER_USHORT(Port, Buffer, Count):
#IN PUSHORT Port,
#IN PUSHORT Buffer,
#IN ULONG Count
call_stdcall(333, "<III", Port, Buffer, Count)

def WRITE_PORT_BUFFER_ULONG(Port, Buffer, Count):
#IN PULONG Port,
#IN PULONG Buffer,
#IN ULONG Count
call_stdcall(334, "<III", Port, Buffer, Count)

def XcHMAC(pbKey, dwKeyLength, pbInput, dwInputLength, pbInput2, dwInputLength2, pbDigest):
#IN PUCHAR pbKey,
#IN ULONG dwKeyLength,
#IN PUCHAR pbInput,
#IN ULONG dwInputLength,
#IN PUCHAR pbInput2,
#IN ULONG dwInputLength2,
#OUT PUCHAR pbDigest
call_stdcall(340, "<IIIIIII", pbKey, dwKeyLength, pbInput, dwInputLength, pbInput2, dwInputLength2, pbDigest)


def XcDESKeyParity(pbKey, dwKeyLength):
#IN OUT PUCHAR pbKey,
#IN ULONG dwKeyLength
call_stdcall(346, "<II", pbKey, dwKeyLength)

def XcKeyTable(dwCipher, pbKeyTable, pbKey):
#IN ULONG dwCipher,
#OUT PUCHAR pbKeyTable,
#IN PUCHAR pbKey
call_stdcall(347, "<III", dwCipher, pbKeyTable, pbKey)

def XcBlockCryptCBC(dwCipher, dwInputLength, pbOutput, pbInput, pbKeyTable, dwOp, pbFeedback):
#IN ULONG dwCipher,
#IN ULONG dwInputLength,
#OUT PUCHAR pbOutput,
#IN PUCHAR pbInput,
#IN PUCHAR pbKeyTable,
#IN ULONG dwOp,
#IN PUCHAR pbFeedback
call_stdcall(349, "<IIIIIII", dwCipher, dwInputLength, pbOutput, pbInput, pbKeyTable, dwOp, pbFeedback)

def XboxLANKey():
return pe.resolve_export(353)

Expand Down

0 comments on commit 20ff733

Please sign in to comment.