mirror of
https://github.com/HyperDbg/HyperDbg.git
synced 2026-10-19 10:04:01 +00:00
add return for uin, uout, ucpuid exported functions
This commit is contained in:
parent
3f0e70c575
commit
ffa170a964
6 changed files with 47 additions and 46 deletions
|
|
@ -29,4 +29,5 @@ Just so you know – the attributions listed on this credits page are acknowledg
|
|||
- unrustled.jimmies for helping us debug and fix issues, and his contributions in HyperDbg
|
||||
- Hari Mishal ([@harimishal1](https://github.com/harimishal1)) for his works on the hypertrace project for supporting Last Branch Record (LBR)
|
||||
- Masoud Rahimi Jafari ([@masoudrahimi01](https://github.com/masoudrahimi01)) for his works on the hypertrace project for supporting Intel Processor Trace (PT)
|
||||
- Abolfazl Hassani ([@FallinBinary](https://github.com/FallinBinary)) for his contributions in HyperDbg
|
||||
- Abolfazl Hassani ([@FallinBinary](https://github.com/FallinBinary)) for his contributions in HyperDbg
|
||||
- Hossein Shirdel ([@nikzad66](https://github.com/nikzad66)) for his contributions in HyperDbg
|
||||
|
|
@ -46,7 +46,7 @@ CommandUserCpuidHelp()
|
|||
* @param FunctionId
|
||||
* @param SubFunctionId
|
||||
* @param CpuidRequest
|
||||
*
|
||||
*
|
||||
* @return VOID
|
||||
*/
|
||||
VOID
|
||||
|
|
@ -2071,10 +2071,10 @@ CommandShowUserCpuidMessage(UINT32 FunctionId,
|
|||
*
|
||||
* @param FunctionId
|
||||
* @param SubFunctionId
|
||||
*
|
||||
* @return VOID
|
||||
*
|
||||
* @return BOOLEAN
|
||||
*/
|
||||
VOID
|
||||
BOOLEAN
|
||||
CommandCpuidRequestCpuid(UINT32 FunctionId, UINT32 SubFunctionId)
|
||||
{
|
||||
BOOL Status;
|
||||
|
|
@ -2089,15 +2089,14 @@ CommandCpuidRequestCpuid(UINT32 FunctionId, UINT32 SubFunctionId)
|
|||
//
|
||||
// It's on a debugger mode
|
||||
//
|
||||
KdSendUserCpuidPacketToDebuggee(FunctionId, SubFunctionId);
|
||||
return;
|
||||
return KdSendUserCpuidPacketToDebuggee(FunctionId, SubFunctionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// It's on a local debugging mode
|
||||
//
|
||||
AssertShowMessageReturnStmt(g_IsKdModuleLoaded, g_DeviceHandle, ASSERT_MESSAGE_KD_NOT_LOADED, ASSERT_MESSAGE_DRIVER_NOT_LOADED, AssertReturn);
|
||||
AssertShowMessageReturnStmt(g_IsKdModuleLoaded, g_DeviceHandle, ASSERT_MESSAGE_KD_NOT_LOADED, ASSERT_MESSAGE_DRIVER_NOT_LOADED, AssertReturnFalse);
|
||||
|
||||
//
|
||||
// By the way, we don't need to send an input buffer
|
||||
|
|
@ -2120,17 +2119,19 @@ CommandCpuidRequestCpuid(UINT32 FunctionId, UINT32 SubFunctionId)
|
|||
if (!Status)
|
||||
{
|
||||
ShowMessages("ioctl failed with code 0x%x\n", PlatformGetLastError());
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CpuidRequest->KernelStatus == DEBUGGER_OPERATION_WAS_SUCCESSFUL)
|
||||
{
|
||||
CommandShowUserCpuidMessage(FunctionId, SubFunctionId, CpuidRequest);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ShowMessages("Receiving CPUID result was not successful :(\n");
|
||||
ShowMessages("Receiving CPUID result was not successful\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ CommandShowUserInMessage(USHORT UserChosenRegister,
|
|||
RegisterName = "EAX";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ShowMessages(" Port: 0x%04X (%d)\n", PortAddress, PortAddress);
|
||||
ShowMessages(" Register: %s\n", RegisterName);
|
||||
ShowMessages(" Result: 0x%08X\n", Data);
|
||||
|
|
@ -73,33 +73,32 @@ CommandShowUserInMessage(USHORT UserChosenRegister,
|
|||
|
||||
/**
|
||||
* @brief uin command handler
|
||||
*
|
||||
*
|
||||
* @param InRequest
|
||||
*
|
||||
* @return VOID
|
||||
*
|
||||
* @return BOOLEAN
|
||||
*/
|
||||
VOID
|
||||
BOOLEAN
|
||||
CommandUserInRequest(DEBUGGER_USER_IN_REQUEST_RESPONSE InRequest)
|
||||
{
|
||||
BOOL Status;
|
||||
ULONG ReturnedLength;
|
||||
USHORT UserChosenRegister = InRequest.UserChosenRegister;
|
||||
USHORT PortAddress = InRequest.PortAddress;
|
||||
BOOL Status;
|
||||
ULONG ReturnedLength;
|
||||
USHORT UserChosenRegister = InRequest.UserChosenRegister;
|
||||
USHORT PortAddress = InRequest.PortAddress;
|
||||
|
||||
if (g_IsSerialConnectedToRemoteDebuggee)
|
||||
{
|
||||
//
|
||||
// It's on a debugger mode
|
||||
//
|
||||
KdSendUserInPacketToDebuggee(InRequest);
|
||||
return;
|
||||
return KdSendUserInPacketToDebuggee(InRequest);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// It's on a local debugging mode
|
||||
//
|
||||
AssertShowMessageReturnStmt(g_IsKdModuleLoaded, g_DeviceHandle, ASSERT_MESSAGE_KD_NOT_LOADED, ASSERT_MESSAGE_DRIVER_NOT_LOADED, AssertReturn);
|
||||
AssertShowMessageReturnStmt(g_IsKdModuleLoaded, g_DeviceHandle, ASSERT_MESSAGE_KD_NOT_LOADED, ASSERT_MESSAGE_DRIVER_NOT_LOADED, AssertReturnFalse);
|
||||
|
||||
//
|
||||
// By the way, we don't need to send an input buffer
|
||||
|
|
@ -122,7 +121,7 @@ CommandUserInRequest(DEBUGGER_USER_IN_REQUEST_RESPONSE InRequest)
|
|||
if (!Status)
|
||||
{
|
||||
ShowMessages("ioctl failed with code 0x%x\n", PlatformGetLastError());
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (InRequest.KernelStatus == DEBUGGER_OPERATION_WAS_SUCCESSFUL)
|
||||
|
|
@ -135,11 +134,13 @@ CommandUserInRequest(DEBUGGER_USER_IN_REQUEST_RESPONSE InRequest)
|
|||
//
|
||||
ULONG Data = InRequest.Data;
|
||||
CommandShowUserInMessage(UserChosenRegister, PortAddress, Data);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowMessages("Receiving IN instruction result was not successful :(\n");
|
||||
ShowMessages("Receiving IN instruction result was not successful\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -230,7 +231,6 @@ CommandUserIn(vector<CommandToken> CommandTokens, string Command)
|
|||
SetPort = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -74,12 +74,12 @@ CommandShowUserOutMessage(USHORT UserChosenRegister,
|
|||
|
||||
/**
|
||||
* @brief uout command handler
|
||||
*
|
||||
*
|
||||
* @param OutRequest
|
||||
*
|
||||
* @return VOID
|
||||
*
|
||||
* @return BOOLEAN
|
||||
*/
|
||||
VOID
|
||||
BOOLEAN
|
||||
CommandUserOutRequest(DEBUGGER_USER_OUT_REQUEST_RESPONSE OutRequest)
|
||||
{
|
||||
BOOL Status;
|
||||
|
|
@ -93,15 +93,14 @@ CommandUserOutRequest(DEBUGGER_USER_OUT_REQUEST_RESPONSE OutRequest)
|
|||
//
|
||||
// It's on a debugger mode
|
||||
//
|
||||
KdSendUserOutPacketToDebuggee(OutRequest);
|
||||
return;
|
||||
return KdSendUserOutPacketToDebuggee(OutRequest);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// It's on a local debugging mode
|
||||
//
|
||||
AssertShowMessageReturnStmt(g_IsKdModuleLoaded, g_DeviceHandle, ASSERT_MESSAGE_KD_NOT_LOADED, ASSERT_MESSAGE_DRIVER_NOT_LOADED, AssertReturn);
|
||||
AssertShowMessageReturnStmt(g_IsKdModuleLoaded, g_DeviceHandle, ASSERT_MESSAGE_KD_NOT_LOADED, ASSERT_MESSAGE_DRIVER_NOT_LOADED, AssertReturnFalse);
|
||||
|
||||
//
|
||||
// By the way, we don't need to send an input buffer
|
||||
|
|
@ -124,17 +123,21 @@ CommandUserOutRequest(DEBUGGER_USER_OUT_REQUEST_RESPONSE OutRequest)
|
|||
if (!Status)
|
||||
{
|
||||
ShowMessages("ioctl failed with code 0x%x\n", PlatformGetLastError());
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (OutRequest.KernelStatus == DEBUGGER_OPERATION_WAS_SUCCESSFUL)
|
||||
{
|
||||
CommandShowUserOutMessage(UserChosenRegister, PortAddress, Value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ShowMessages("Receiving OUT instruction result was not successful :(\n");
|
||||
ShowMessages("Receiving OUT instruction result was not successful\n");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1056,9 +1056,7 @@ hyperdbg_u_request_cpuid(UINT32 FunctionId, UINT32 SubFunctionId)
|
|||
BOOLEAN
|
||||
hyperdebg_u_in_instruction(DEBUGGER_USER_IN_REQUEST_RESPONSE InRequest)
|
||||
{
|
||||
CommandUserInRequest(InRequest);
|
||||
|
||||
return TRUE;
|
||||
return CommandUserInRequest(InRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1071,7 +1069,5 @@ hyperdebg_u_in_instruction(DEBUGGER_USER_IN_REQUEST_RESPONSE InRequest)
|
|||
BOOLEAN
|
||||
hyperdebg_u_out_instruction(DEBUGGER_USER_OUT_REQUEST_RESPONSE OutRequest)
|
||||
{
|
||||
CommandUserOutRequest(OutRequest);
|
||||
|
||||
return TRUE;
|
||||
return CommandUserOutRequest(OutRequest);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ CommandEventsClearAllEventsAndResetTags();
|
|||
VOID
|
||||
CommandFlushRequestFlush();
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
CommandCpuidRequestCpuid(UINT32 FunctionId, UINT32 SubFunctionId);
|
||||
|
||||
VOID
|
||||
|
|
@ -231,17 +231,17 @@ CommandShowUserCpuidMessage(UINT32 FunctionId,
|
|||
UINT32 SubFunctionId,
|
||||
PDEBUGGER_CPUID_REQUEST_RESPONSE CpuidRequest);
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
CommandUserInRequest(DEBUGGER_USER_IN_REQUEST_RESPONSE InRequest);
|
||||
|
||||
BOOLEAN
|
||||
CommandUserOutRequest(DEBUGGER_USER_OUT_REQUEST_RESPONSE OutRequest);
|
||||
|
||||
VOID
|
||||
CommandShowUserInMessage(USHORT UserChosenRegister,
|
||||
USHORT PortAddress,
|
||||
ULONG Data);
|
||||
|
||||
VOID
|
||||
CommandUserOutRequest(DEBUGGER_USER_OUT_REQUEST_RESPONSE OutRequest);
|
||||
|
||||
VOID
|
||||
CommandShowUserOutMessage(USHORT UserChosenRegister,
|
||||
USHORT PortAddress,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue