diff --git a/sdk/bindgen/bind_test.go b/sdk/bindgen/bind_test.go index 1e524c66b..121588dd5 100644 --- a/sdk/bindgen/bind_test.go +++ b/sdk/bindgen/bind_test.go @@ -48,8 +48,8 @@ func TestBindMacros(t *testing.T) { mylog.Trace("number of macros", macros.Len()) var ( - enumDebuggers = stream.NewOrderedMap("", false) - enumIoctls = stream.NewOrderedMap("", false) + enumDebuggers = stream.NewOrderedMap("", "") + enumIoctls = stream.NewOrderedMap("", "") ) for _, p := range macros.List() { @@ -131,9 +131,9 @@ func TestBindMacros(t *testing.T) { if found { key = after } - enumDebuggers.Set(key, true) + enumDebuggers.Set(key, key) case strings.HasPrefix(p.Key, "IOCTL_"): - enumIoctls.Set(key, true) + enumIoctls.Set(key, key) } g.P(stream.ToCamelUpper(key, false) + "=" + value) @@ -155,8 +155,8 @@ const ( stream.WriteGoFile("../vars.go", g.Buffer) - stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes("debuggerError", enumDebuggers.Keys(), nil) - stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes("ioctl", enumIoctls.Keys(), nil) + stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes("debuggerError", enumDebuggers) + stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes("ioctl", enumIoctls) for _, p := range macros.List() { return diff --git a/sdk/bindgen/bug/1.h b/sdk/bindgen/bug/1.h index a21b0229a..01fddca4f 100644 --- a/sdk/bindgen/bug/1.h +++ b/sdk/bindgen/bug/1.h @@ -1,3 +1,51 @@ + +typedef unsigned char uint8_t; // 无符号8位整数 +typedef unsigned short uint16_t; // 无符号16位整数 +typedef unsigned int uint32_t; // 无符号32位整数 +typedef unsigned long long uint64_t; // 无符号64位整数 +typedef signed char int8_t; // 有符号8位整数 +typedef signed short int16_t; // 有符号16位整数 +typedef signed int int32_t; // 有符号32位整数 +typedef signed long long int64_t; // 有符号64位整数 +typedef int bool; // 使用 typedef 定义 bool 类型 + +typedef int* intptr_t; + +typedef unsigned char uint8_t; // 无符号8位整数 +typedef unsigned short uint16_t; // 无符号16位整数 +typedef unsigned int uint32_t; // 无符号32位整数 +typedef unsigned long long uint64_t; // 无符号64位整数 +typedef signed char int8_t; // 有符号8位整数 +typedef signed short int16_t; // 有符号16位整数 +typedef signed int int32_t; // 有符号32位整数 +typedef signed long long int64_t; // 有符号64位整数 +typedef int bool; // 使用 typedef 定义 bool 类型 + +typedef int* intptr_t; + +typedef unsigned char uint8_t; // 无符号8位整数 +typedef unsigned short uint16_t; // 无符号16位整数 +typedef unsigned int uint32_t; // 无符号32位整数 +typedef unsigned long long uint64_t; // 无符号64位整数 +typedef signed char int8_t; // 有符号8位整数 +typedef signed short int16_t; // 有符号16位整数 +typedef signed int int32_t; // 有符号32位整数 +typedef signed long long int64_t; // 有符号64位整数 +typedef int bool; // 使用 typedef 定义 bool 类型 + +typedef int* intptr_t; + +typedef unsigned char uint8_t; // 无符号8位整数 +typedef unsigned short uint16_t; // 无符号16位整数 +typedef unsigned int uint32_t; // 无符号32位整数 +typedef unsigned long long uint64_t; // 无符号64位整数 +typedef signed char int8_t; // 有符号8位整数 +typedef signed short int16_t; // 有符号16位整数 +typedef signed int int32_t; // 有符号32位整数 +typedef signed long long int64_t; // 有符号64位整数 +typedef int bool; // 使用 typedef 定义 bool 类型 + +typedef int* intptr_t; //typedef unsigned char UCHAR; //typedef UCHAR BOOLEAN; // winnt //typedef BOOLEAN * PBOOLEAN; // winnt @@ -35,4 +83,7 @@ func main() { fmt.Println("PBOOLEAN值:", *pb) fmt.Println("CHECK_VMX_OPERATION返回值:", checkVMXOperation()) } -*/ \ No newline at end of file +*/ + + + diff --git a/sdk/bindgen/bug/tmp/bug.go b/sdk/bindgen/bug/tmp/bug.go index c3692c285..ff7521908 100644 --- a/sdk/bindgen/bug/tmp/bug.go +++ b/sdk/bindgen/bug/tmp/bug.go @@ -18,7 +18,47 @@ type ( SizeT = uint64 _BuiltinMsVaList = *byte _BuiltinVaList = *byte - CheckVmxOperation = unsafe.Pointer + Uint8T = uint8 + Uint16T = uint16 + Uint32T = uint32 + Uint64T = uint64 + Int8T = int8 + Int16T = int16 + Int32T = int32 + Int64T = int64 + Bool = int32 + IntptrT = *int32 + // type Uint8T = uint8 + // type Uint16T = uint16 + // type Uint32T = uint32 + // type Uint64T = uint64 + // type Int8T = int8 + // type Int16T = int16 + // type Int32T = int32 + // type Int64T = int64 + // type Bool = int32 + // type IntptrT = *int32 + // type Uint8T = uint8 + // type Uint16T = uint16 + // type Uint32T = uint32 + // type Uint64T = uint64 + // type Int8T = int8 + // type Int16T = int16 + // type Int32T = int32 + // type Int64T = int64 + // type Bool = int32 + // type IntptrT = *int32 + // type Uint8T = uint8 + // type Uint16T = uint16 + // type Uint32T = uint32 + // type Uint64T = uint64 + // type Int8T = int8 + // type Int16T = int16 + // type Int32T = int32 + // type Int64T = int64 + // type Bool = int32 + // type IntptrT = *int32 + CheckVmxOperation = unsafe.Pointer ) // Gengo init function. diff --git a/sdk/bindgen/command_test.go b/sdk/bindgen/command_test.go index 37d57aded..d7c84bb5c 100644 --- a/sdk/bindgen/command_test.go +++ b/sdk/bindgen/command_test.go @@ -70,13 +70,13 @@ func TestUnmarshalCommandJson(t *testing.T) { } func TestCommandGenerate(t *testing.T) { - t.Skip("not well") - stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes("commands", []string{ - "debugging", - "extension", - "hwdbg", - "meta", - }, nil) + // t.Skip("not well") + m := stream.NewOrderedMap("", "") + m.Set("debugging", "debugging") + m.Set("extension", "extension") + m.Set("hwdbg", "hwdbg") + m.Set("meta", "meta") + stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes("commands", m) commandGenerate("DebuggingCommands", "D:\\fork\\HyperDbg\\hyperdbg\\libhyperdbg\\code\\debugger\\commands\\debugging-commands") commandGenerate("ExtensionCommands", "D:\\fork\\HyperDbg\\hyperdbg\\libhyperdbg\\code\\debugger\\commands\\extension-commands") @@ -108,9 +108,9 @@ func commandGenerate(kindName, path string) { return err }) - keys := make([]string, 0) + m := stream.NewOrderedMap("", "") for _, command := range commands { - keys = append(keys, command.FullName) // todo this must be use Cmd,then it will return the right command + m.Set(command.FullName, command.FullName) // todo this must be use Cmd,then it will return the right command } - stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes(kindName, keys, nil) + stream.NewGeneratedFile().SetPackageName("sdk").SetFilePath("../").EnumTypes(kindName, m) } diff --git a/sdk/commands_enum_gen.go b/sdk/commands_enum_gen.go deleted file mode 100644 index 05661c2ce..000000000 --- a/sdk/commands_enum_gen.go +++ /dev/null @@ -1,80 +0,0 @@ -package sdk - -import ( - "strings" - - "golang.org/x/exp/constraints" -) - -// Code generated by GeneratedFile enum - DO NOT EDIT. - -type CommandsKind byte - -const ( - DebuggingKind CommandsKind = iota - ExtensionKind - HwdbgKind - MetaKind - InvalidCommandsKind -) - -func ConvertInteger2CommandsKind[T constraints.Integer](v T) CommandsKind { - return CommandsKind(v) -} - -func (k CommandsKind) AssertKind(kinds string) CommandsKind { - for _, kind := range k.Kinds() { - if strings.ToLower(kinds) == strings.ToLower(kind.String()) { - return kind - } - } - return InvalidCommandsKind -} - -func (k CommandsKind) String() string { - switch k { - case DebuggingKind: - return "Debugging" - case ExtensionKind: - return "Extension" - case HwdbgKind: - return "Hwdbg" - case MetaKind: - return "Meta" - default: - return "InvalidCommandsKind" - } -} - -func (k CommandsKind) Keys() []string { - return []string{ - "Debugging", - "Extension", - "Hwdbg", - "Meta", - } -} - -func (k CommandsKind) Kinds() []CommandsKind { - return []CommandsKind{ - DebuggingKind, - ExtensionKind, - HwdbgKind, - MetaKind, - } -} - -func (k CommandsKind) SvgFileName() string { - switch k { - case DebuggingKind: - return "Debugging" - case ExtensionKind: - return "Extension" - case HwdbgKind: - return "Hwdbg" - case MetaKind: - return "Meta" - default: - return "InvalidCommandsKind" - } -} diff --git a/sdk/debuggerError_enum_gen.go b/sdk/debuggerError_enum_gen.go deleted file mode 100644 index 196bd68fb..000000000 --- a/sdk/debuggerError_enum_gen.go +++ /dev/null @@ -1,633 +0,0 @@ -package sdk - -import ( - "strings" - - "golang.org/x/exp/constraints" -) - -// Code generated by GeneratedFile enum - DO NOT EDIT. - -type DebuggerErrorKind byte - -const ( - TagNotExistsKind DebuggerErrorKind = iota - InvalidActionTypeKind - ActionBufferSizeIsZeroKind - EventTypeIsInvalidKind - UnableToCreateEventKind - InvalidAddressKind - InvalidCoreIdKind - ExceptionIndexExceedFirst32EntriesKind - InterruptIndexIsNotValidKind - UnableToHideOrUnhideDebuggerKind - DebuggerAlreadyUhideKind - EditMemoryStatusInvalidParameterKind - EditMemoryStatusInvalidAddressBasedOnCurrentProcessKind - EditMemoryStatusInvalidAddressBasedOnOtherProcessKind - ModifyEventsInvalidTagKind - ModifyEventsInvalidTypeOfActionKind - SteppingInvalidParameterKind - SteppingsEitherThreadNotFoundOrDisabledKind - PreparingDebuggeeInvalidBaudrateKind - PreparingDebuggeeInvalidSerialPortKind - PreparingDebuggeeInvalidCoreInRemoteDebuggeKind - PreparingDebuggeeUnableToSwitchToNewProcessKind - PreparingDebuggeeToRunScriptKind - InvalidRegisterNumberKind - MaximumBreakpointWithoutContinueKind - BreakpointAlreadyExistsOnTheAddressKind - BreakpointIdNotFoundKind - BreakpointAlreadyDisabledKind - BreakpointAlreadyEnabledKind - MemoryTypeInvalidKind - InvalidProcessIdKind - EventIsNotAppliedKind - DetailsOrSwitchProcessInvalidParameterKind - DetailsOrSwitchThreadInvalidParameterKind - MaximumBreakpointForASinglePageIsHitKind - PreAllocatedBufferIsEmptyKind - EptCouldNotSplitTheLargePageTo4KbPagesKind - EptFailedToGetPml1EntryOfTargetAddressKind - EptMultipleHooksInASinglePageKind - CouldNotBuildTheEptHookKind - CouldNotFindAllocationTypeKind - InvalidTestQueryIndexKind - UnableToAttachToTargetUserModeProcessKind - UnableToRemoveHooksEntrypointNotReachedKind - UnableToRemoveHooksKind - FunctionsForInitializingPebAddressesAreNotInitializedKind - UnableToDetect32BitOr64BitProcessKind - UnableToKillTheProcessKind - InvalidThreadDebuggingTokenKind - UnableToPauseTheProcessThreadsKind - UnableToAttachToAnAlreadyAttachedProcessKind - TheUserDebuggerNotAttachedToTheProcessKind - UnableToDetachAsThereArePausedThreadsKind - UnableToSwitchProcessIdOrThreadIdIsInvalidKind - UnableToSwitchThereIsNoThreadOnTheProcessKind - UnableToGetModulesOfTheProcessKind - UnableToGetCallstackKind - UnableToQueryCountOfProcessesOrThreadsKind - UsingShortCircuitingEventWithPostEventModeIsForbiddednKind - UnknownTestQueryReceivedKind - ReadingMemoryInvalidParameterKind - TheTrapFlagListIsFullKind - UnableToKillTheProcessDoesNotExistsKind - ModeExecutionIsInvalidKind - ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootModeKind - InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionalsKind - InstantEventRegularPreallocatedBufferNotFoundKind - InstantEventBigPreallocatedBufferNotFoundKind - UnableToCreateActionCannotAllocateBufferKind - InstantEventActionRegularPreallocatedBufferNotFoundKind - InstantEventActionBigPreallocatedBufferNotFoundKind - InstantEventPreallocatedBufferIsNotEnoughForActionBufferKind - InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStackKind - InstantEventRegularRequestedSafeBufferNotFoundKind - InstantEventBigRequestedSafeBufferNotFoundKind - InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBufferKind - UnableToAllocateRequestedSafeBufferKind - CouldNotFindPreactivationTypeKind - TheModeExecTrapIsNotInitializedKind - TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFullKind - NotAllCoresAreLockedForApplyingInstantEventKind - TargetSwitchingCoreIsNotLockedKind - InvalidPhysicalAddressKind - InvalidDebuggerErrorKind -) - -func ConvertInteger2DebuggerErrorKind[T constraints.Integer](v T) DebuggerErrorKind { - return DebuggerErrorKind(v) -} - -func (k DebuggerErrorKind) AssertKind(kinds string) DebuggerErrorKind { - for _, kind := range k.Kinds() { - if strings.ToLower(kinds) == strings.ToLower(kind.String()) { - return kind - } - } - return InvalidDebuggerErrorKind -} - -func (k DebuggerErrorKind) String() string { - switch k { - case TagNotExistsKind: - return "TagNotExists" - case InvalidActionTypeKind: - return "InvalidActionType" - case ActionBufferSizeIsZeroKind: - return "ActionBufferSizeIsZero" - case EventTypeIsInvalidKind: - return "EventTypeIsInvalid" - case UnableToCreateEventKind: - return "UnableToCreateEvent" - case InvalidAddressKind: - return "InvalidAddress" - case InvalidCoreIdKind: - return "InvalidCoreId" - case ExceptionIndexExceedFirst32EntriesKind: - return "ExceptionIndexExceedFirst32Entries" - case InterruptIndexIsNotValidKind: - return "InterruptIndexIsNotValid" - case UnableToHideOrUnhideDebuggerKind: - return "UnableToHideOrUnhideDebugger" - case DebuggerAlreadyUhideKind: - return "DebuggerAlreadyUhide" - case EditMemoryStatusInvalidParameterKind: - return "EditMemoryStatusInvalidParameter" - case EditMemoryStatusInvalidAddressBasedOnCurrentProcessKind: - return "EditMemoryStatusInvalidAddressBasedOnCurrentProcess" - case EditMemoryStatusInvalidAddressBasedOnOtherProcessKind: - return "EditMemoryStatusInvalidAddressBasedOnOtherProcess" - case ModifyEventsInvalidTagKind: - return "ModifyEventsInvalidTag" - case ModifyEventsInvalidTypeOfActionKind: - return "ModifyEventsInvalidTypeOfAction" - case SteppingInvalidParameterKind: - return "SteppingInvalidParameter" - case SteppingsEitherThreadNotFoundOrDisabledKind: - return "SteppingsEitherThreadNotFoundOrDisabled" - case PreparingDebuggeeInvalidBaudrateKind: - return "PreparingDebuggeeInvalidBaudrate" - case PreparingDebuggeeInvalidSerialPortKind: - return "PreparingDebuggeeInvalidSerialPort" - case PreparingDebuggeeInvalidCoreInRemoteDebuggeKind: - return "PreparingDebuggeeInvalidCoreInRemoteDebugge" - case PreparingDebuggeeUnableToSwitchToNewProcessKind: - return "PreparingDebuggeeUnableToSwitchToNewProcess" - case PreparingDebuggeeToRunScriptKind: - return "PreparingDebuggeeToRunScript" - case InvalidRegisterNumberKind: - return "InvalidRegisterNumber" - case MaximumBreakpointWithoutContinueKind: - return "MaximumBreakpointWithoutContinue" - case BreakpointAlreadyExistsOnTheAddressKind: - return "BreakpointAlreadyExistsOnTheAddress" - case BreakpointIdNotFoundKind: - return "BreakpointIdNotFound" - case BreakpointAlreadyDisabledKind: - return "BreakpointAlreadyDisabled" - case BreakpointAlreadyEnabledKind: - return "BreakpointAlreadyEnabled" - case MemoryTypeInvalidKind: - return "MemoryTypeInvalid" - case InvalidProcessIdKind: - return "InvalidProcessId" - case EventIsNotAppliedKind: - return "EventIsNotApplied" - case DetailsOrSwitchProcessInvalidParameterKind: - return "DetailsOrSwitchProcessInvalidParameter" - case DetailsOrSwitchThreadInvalidParameterKind: - return "DetailsOrSwitchThreadInvalidParameter" - case MaximumBreakpointForASinglePageIsHitKind: - return "MaximumBreakpointForASinglePageIsHit" - case PreAllocatedBufferIsEmptyKind: - return "PreAllocatedBufferIsEmpty" - case EptCouldNotSplitTheLargePageTo4KbPagesKind: - return "EptCouldNotSplitTheLargePageTo4KbPages" - case EptFailedToGetPml1EntryOfTargetAddressKind: - return "EptFailedToGetPml1EntryOfTargetAddress" - case EptMultipleHooksInASinglePageKind: - return "EptMultipleHooksInASinglePage" - case CouldNotBuildTheEptHookKind: - return "CouldNotBuildTheEptHook" - case CouldNotFindAllocationTypeKind: - return "CouldNotFindAllocationType" - case InvalidTestQueryIndexKind: - return "InvalidTestQueryIndex" - case UnableToAttachToTargetUserModeProcessKind: - return "UnableToAttachToTargetUserModeProcess" - case UnableToRemoveHooksEntrypointNotReachedKind: - return "UnableToRemoveHooksEntrypointNotReached" - case UnableToRemoveHooksKind: - return "UnableToRemoveHooks" - case FunctionsForInitializingPebAddressesAreNotInitializedKind: - return "FunctionsForInitializingPebAddressesAreNotInitialized" - case UnableToDetect32BitOr64BitProcessKind: - return "UnableToDetect32BitOr64BitProcess" - case UnableToKillTheProcessKind: - return "UnableToKillTheProcess" - case InvalidThreadDebuggingTokenKind: - return "InvalidThreadDebuggingToken" - case UnableToPauseTheProcessThreadsKind: - return "UnableToPauseTheProcessThreads" - case UnableToAttachToAnAlreadyAttachedProcessKind: - return "UnableToAttachToAnAlreadyAttachedProcess" - case TheUserDebuggerNotAttachedToTheProcessKind: - return "TheUserDebuggerNotAttachedToTheProcess" - case UnableToDetachAsThereArePausedThreadsKind: - return "UnableToDetachAsThereArePausedThreads" - case UnableToSwitchProcessIdOrThreadIdIsInvalidKind: - return "UnableToSwitchProcessIdOrThreadIdIsInvalid" - case UnableToSwitchThereIsNoThreadOnTheProcessKind: - return "UnableToSwitchThereIsNoThreadOnTheProcess" - case UnableToGetModulesOfTheProcessKind: - return "UnableToGetModulesOfTheProcess" - case UnableToGetCallstackKind: - return "UnableToGetCallstack" - case UnableToQueryCountOfProcessesOrThreadsKind: - return "UnableToQueryCountOfProcessesOrThreads" - case UsingShortCircuitingEventWithPostEventModeIsForbiddednKind: - return "UsingShortCircuitingEventWithPostEventModeIsForbiddedn" - case UnknownTestQueryReceivedKind: - return "UnknownTestQueryReceived" - case ReadingMemoryInvalidParameterKind: - return "ReadingMemoryInvalidParameter" - case TheTrapFlagListIsFullKind: - return "TheTrapFlagListIsFull" - case UnableToKillTheProcessDoesNotExistsKind: - return "UnableToKillTheProcessDoesNotExists" - case ModeExecutionIsInvalidKind: - return "ModeExecutionIsInvalid" - case ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootModeKind: - return "ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootMode" - case InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionalsKind: - return "InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionals" - case InstantEventRegularPreallocatedBufferNotFoundKind: - return "InstantEventRegularPreallocatedBufferNotFound" - case InstantEventBigPreallocatedBufferNotFoundKind: - return "InstantEventBigPreallocatedBufferNotFound" - case UnableToCreateActionCannotAllocateBufferKind: - return "UnableToCreateActionCannotAllocateBuffer" - case InstantEventActionRegularPreallocatedBufferNotFoundKind: - return "InstantEventActionRegularPreallocatedBufferNotFound" - case InstantEventActionBigPreallocatedBufferNotFoundKind: - return "InstantEventActionBigPreallocatedBufferNotFound" - case InstantEventPreallocatedBufferIsNotEnoughForActionBufferKind: - return "InstantEventPreallocatedBufferIsNotEnoughForActionBuffer" - case InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStackKind: - return "InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStack" - case InstantEventRegularRequestedSafeBufferNotFoundKind: - return "InstantEventRegularRequestedSafeBufferNotFound" - case InstantEventBigRequestedSafeBufferNotFoundKind: - return "InstantEventBigRequestedSafeBufferNotFound" - case InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBufferKind: - return "InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBuffer" - case UnableToAllocateRequestedSafeBufferKind: - return "UnableToAllocateRequestedSafeBuffer" - case CouldNotFindPreactivationTypeKind: - return "CouldNotFindPreactivationType" - case TheModeExecTrapIsNotInitializedKind: - return "TheModeExecTrapIsNotInitialized" - case TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFullKind: - return "TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFull" - case NotAllCoresAreLockedForApplyingInstantEventKind: - return "NotAllCoresAreLockedForApplyingInstantEvent" - case TargetSwitchingCoreIsNotLockedKind: - return "TargetSwitchingCoreIsNotLocked" - case InvalidPhysicalAddressKind: - return "InvalidPhysicalAddress" - default: - return "InvalidDebuggerErrorKind" - } -} - -func (k DebuggerErrorKind) Keys() []string { - return []string{ - "TagNotExists", - "InvalidActionType", - "ActionBufferSizeIsZero", - "EventTypeIsInvalid", - "UnableToCreateEvent", - "InvalidAddress", - "InvalidCoreId", - "ExceptionIndexExceedFirst32Entries", - "InterruptIndexIsNotValid", - "UnableToHideOrUnhideDebugger", - "DebuggerAlreadyUhide", - "EditMemoryStatusInvalidParameter", - "EditMemoryStatusInvalidAddressBasedOnCurrentProcess", - "EditMemoryStatusInvalidAddressBasedOnOtherProcess", - "ModifyEventsInvalidTag", - "ModifyEventsInvalidTypeOfAction", - "SteppingInvalidParameter", - "SteppingsEitherThreadNotFoundOrDisabled", - "PreparingDebuggeeInvalidBaudrate", - "PreparingDebuggeeInvalidSerialPort", - "PreparingDebuggeeInvalidCoreInRemoteDebugge", - "PreparingDebuggeeUnableToSwitchToNewProcess", - "PreparingDebuggeeToRunScript", - "InvalidRegisterNumber", - "MaximumBreakpointWithoutContinue", - "BreakpointAlreadyExistsOnTheAddress", - "BreakpointIdNotFound", - "BreakpointAlreadyDisabled", - "BreakpointAlreadyEnabled", - "MemoryTypeInvalid", - "InvalidProcessId", - "EventIsNotApplied", - "DetailsOrSwitchProcessInvalidParameter", - "DetailsOrSwitchThreadInvalidParameter", - "MaximumBreakpointForASinglePageIsHit", - "PreAllocatedBufferIsEmpty", - "EptCouldNotSplitTheLargePageTo4KbPages", - "EptFailedToGetPml1EntryOfTargetAddress", - "EptMultipleHooksInASinglePage", - "CouldNotBuildTheEptHook", - "CouldNotFindAllocationType", - "InvalidTestQueryIndex", - "UnableToAttachToTargetUserModeProcess", - "UnableToRemoveHooksEntrypointNotReached", - "UnableToRemoveHooks", - "FunctionsForInitializingPebAddressesAreNotInitialized", - "UnableToDetect32BitOr64BitProcess", - "UnableToKillTheProcess", - "InvalidThreadDebuggingToken", - "UnableToPauseTheProcessThreads", - "UnableToAttachToAnAlreadyAttachedProcess", - "TheUserDebuggerNotAttachedToTheProcess", - "UnableToDetachAsThereArePausedThreads", - "UnableToSwitchProcessIdOrThreadIdIsInvalid", - "UnableToSwitchThereIsNoThreadOnTheProcess", - "UnableToGetModulesOfTheProcess", - "UnableToGetCallstack", - "UnableToQueryCountOfProcessesOrThreads", - "UsingShortCircuitingEventWithPostEventModeIsForbiddedn", - "UnknownTestQueryReceived", - "ReadingMemoryInvalidParameter", - "TheTrapFlagListIsFull", - "UnableToKillTheProcessDoesNotExists", - "ModeExecutionIsInvalid", - "ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootMode", - "InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionals", - "InstantEventRegularPreallocatedBufferNotFound", - "InstantEventBigPreallocatedBufferNotFound", - "UnableToCreateActionCannotAllocateBuffer", - "InstantEventActionRegularPreallocatedBufferNotFound", - "InstantEventActionBigPreallocatedBufferNotFound", - "InstantEventPreallocatedBufferIsNotEnoughForActionBuffer", - "InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStack", - "InstantEventRegularRequestedSafeBufferNotFound", - "InstantEventBigRequestedSafeBufferNotFound", - "InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBuffer", - "UnableToAllocateRequestedSafeBuffer", - "CouldNotFindPreactivationType", - "TheModeExecTrapIsNotInitialized", - "TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFull", - "NotAllCoresAreLockedForApplyingInstantEvent", - "TargetSwitchingCoreIsNotLocked", - "InvalidPhysicalAddress", - } -} - -func (k DebuggerErrorKind) Kinds() []DebuggerErrorKind { - return []DebuggerErrorKind{ - TagNotExistsKind, - InvalidActionTypeKind, - ActionBufferSizeIsZeroKind, - EventTypeIsInvalidKind, - UnableToCreateEventKind, - InvalidAddressKind, - InvalidCoreIdKind, - ExceptionIndexExceedFirst32EntriesKind, - InterruptIndexIsNotValidKind, - UnableToHideOrUnhideDebuggerKind, - DebuggerAlreadyUhideKind, - EditMemoryStatusInvalidParameterKind, - EditMemoryStatusInvalidAddressBasedOnCurrentProcessKind, - EditMemoryStatusInvalidAddressBasedOnOtherProcessKind, - ModifyEventsInvalidTagKind, - ModifyEventsInvalidTypeOfActionKind, - SteppingInvalidParameterKind, - SteppingsEitherThreadNotFoundOrDisabledKind, - PreparingDebuggeeInvalidBaudrateKind, - PreparingDebuggeeInvalidSerialPortKind, - PreparingDebuggeeInvalidCoreInRemoteDebuggeKind, - PreparingDebuggeeUnableToSwitchToNewProcessKind, - PreparingDebuggeeToRunScriptKind, - InvalidRegisterNumberKind, - MaximumBreakpointWithoutContinueKind, - BreakpointAlreadyExistsOnTheAddressKind, - BreakpointIdNotFoundKind, - BreakpointAlreadyDisabledKind, - BreakpointAlreadyEnabledKind, - MemoryTypeInvalidKind, - InvalidProcessIdKind, - EventIsNotAppliedKind, - DetailsOrSwitchProcessInvalidParameterKind, - DetailsOrSwitchThreadInvalidParameterKind, - MaximumBreakpointForASinglePageIsHitKind, - PreAllocatedBufferIsEmptyKind, - EptCouldNotSplitTheLargePageTo4KbPagesKind, - EptFailedToGetPml1EntryOfTargetAddressKind, - EptMultipleHooksInASinglePageKind, - CouldNotBuildTheEptHookKind, - CouldNotFindAllocationTypeKind, - InvalidTestQueryIndexKind, - UnableToAttachToTargetUserModeProcessKind, - UnableToRemoveHooksEntrypointNotReachedKind, - UnableToRemoveHooksKind, - FunctionsForInitializingPebAddressesAreNotInitializedKind, - UnableToDetect32BitOr64BitProcessKind, - UnableToKillTheProcessKind, - InvalidThreadDebuggingTokenKind, - UnableToPauseTheProcessThreadsKind, - UnableToAttachToAnAlreadyAttachedProcessKind, - TheUserDebuggerNotAttachedToTheProcessKind, - UnableToDetachAsThereArePausedThreadsKind, - UnableToSwitchProcessIdOrThreadIdIsInvalidKind, - UnableToSwitchThereIsNoThreadOnTheProcessKind, - UnableToGetModulesOfTheProcessKind, - UnableToGetCallstackKind, - UnableToQueryCountOfProcessesOrThreadsKind, - UsingShortCircuitingEventWithPostEventModeIsForbiddednKind, - UnknownTestQueryReceivedKind, - ReadingMemoryInvalidParameterKind, - TheTrapFlagListIsFullKind, - UnableToKillTheProcessDoesNotExistsKind, - ModeExecutionIsInvalidKind, - ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootModeKind, - InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionalsKind, - InstantEventRegularPreallocatedBufferNotFoundKind, - InstantEventBigPreallocatedBufferNotFoundKind, - UnableToCreateActionCannotAllocateBufferKind, - InstantEventActionRegularPreallocatedBufferNotFoundKind, - InstantEventActionBigPreallocatedBufferNotFoundKind, - InstantEventPreallocatedBufferIsNotEnoughForActionBufferKind, - InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStackKind, - InstantEventRegularRequestedSafeBufferNotFoundKind, - InstantEventBigRequestedSafeBufferNotFoundKind, - InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBufferKind, - UnableToAllocateRequestedSafeBufferKind, - CouldNotFindPreactivationTypeKind, - TheModeExecTrapIsNotInitializedKind, - TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFullKind, - NotAllCoresAreLockedForApplyingInstantEventKind, - TargetSwitchingCoreIsNotLockedKind, - InvalidPhysicalAddressKind, - } -} - -func (k DebuggerErrorKind) PngFileName() string { - switch k { - case TagNotExistsKind: - return "TagNotExists" - case InvalidActionTypeKind: - return "InvalidActionType" - case ActionBufferSizeIsZeroKind: - return "ActionBufferSizeIsZero" - case EventTypeIsInvalidKind: - return "EventTypeIsInvalid" - case UnableToCreateEventKind: - return "UnableToCreateEvent" - case InvalidAddressKind: - return "InvalidAddress" - case InvalidCoreIdKind: - return "InvalidCoreId" - case ExceptionIndexExceedFirst32EntriesKind: - return "ExceptionIndexExceedFirst32Entries" - case InterruptIndexIsNotValidKind: - return "InterruptIndexIsNotValid" - case UnableToHideOrUnhideDebuggerKind: - return "UnableToHideOrUnhideDebugger" - case DebuggerAlreadyUhideKind: - return "DebuggerAlreadyUhide" - case EditMemoryStatusInvalidParameterKind: - return "EditMemoryStatusInvalidParameter" - case EditMemoryStatusInvalidAddressBasedOnCurrentProcessKind: - return "EditMemoryStatusInvalidAddressBasedOnCurrentProcess" - case EditMemoryStatusInvalidAddressBasedOnOtherProcessKind: - return "EditMemoryStatusInvalidAddressBasedOnOtherProcess" - case ModifyEventsInvalidTagKind: - return "ModifyEventsInvalidTag" - case ModifyEventsInvalidTypeOfActionKind: - return "ModifyEventsInvalidTypeOfAction" - case SteppingInvalidParameterKind: - return "SteppingInvalidParameter" - case SteppingsEitherThreadNotFoundOrDisabledKind: - return "SteppingsEitherThreadNotFoundOrDisabled" - case PreparingDebuggeeInvalidBaudrateKind: - return "PreparingDebuggeeInvalidBaudrate" - case PreparingDebuggeeInvalidSerialPortKind: - return "PreparingDebuggeeInvalidSerialPort" - case PreparingDebuggeeInvalidCoreInRemoteDebuggeKind: - return "PreparingDebuggeeInvalidCoreInRemoteDebugge" - case PreparingDebuggeeUnableToSwitchToNewProcessKind: - return "PreparingDebuggeeUnableToSwitchToNewProcess" - case PreparingDebuggeeToRunScriptKind: - return "PreparingDebuggeeToRunScript" - case InvalidRegisterNumberKind: - return "InvalidRegisterNumber" - case MaximumBreakpointWithoutContinueKind: - return "MaximumBreakpointWithoutContinue" - case BreakpointAlreadyExistsOnTheAddressKind: - return "BreakpointAlreadyExistsOnTheAddress" - case BreakpointIdNotFoundKind: - return "BreakpointIdNotFound" - case BreakpointAlreadyDisabledKind: - return "BreakpointAlreadyDisabled" - case BreakpointAlreadyEnabledKind: - return "BreakpointAlreadyEnabled" - case MemoryTypeInvalidKind: - return "MemoryTypeInvalid" - case InvalidProcessIdKind: - return "InvalidProcessId" - case EventIsNotAppliedKind: - return "EventIsNotApplied" - case DetailsOrSwitchProcessInvalidParameterKind: - return "DetailsOrSwitchProcessInvalidParameter" - case DetailsOrSwitchThreadInvalidParameterKind: - return "DetailsOrSwitchThreadInvalidParameter" - case MaximumBreakpointForASinglePageIsHitKind: - return "MaximumBreakpointForASinglePageIsHit" - case PreAllocatedBufferIsEmptyKind: - return "PreAllocatedBufferIsEmpty" - case EptCouldNotSplitTheLargePageTo4KbPagesKind: - return "EptCouldNotSplitTheLargePageTo4KbPages" - case EptFailedToGetPml1EntryOfTargetAddressKind: - return "EptFailedToGetPml1EntryOfTargetAddress" - case EptMultipleHooksInASinglePageKind: - return "EptMultipleHooksInASinglePage" - case CouldNotBuildTheEptHookKind: - return "CouldNotBuildTheEptHook" - case CouldNotFindAllocationTypeKind: - return "CouldNotFindAllocationType" - case InvalidTestQueryIndexKind: - return "InvalidTestQueryIndex" - case UnableToAttachToTargetUserModeProcessKind: - return "UnableToAttachToTargetUserModeProcess" - case UnableToRemoveHooksEntrypointNotReachedKind: - return "UnableToRemoveHooksEntrypointNotReached" - case UnableToRemoveHooksKind: - return "UnableToRemoveHooks" - case FunctionsForInitializingPebAddressesAreNotInitializedKind: - return "FunctionsForInitializingPebAddressesAreNotInitialized" - case UnableToDetect32BitOr64BitProcessKind: - return "UnableToDetect32BitOr64BitProcess" - case UnableToKillTheProcessKind: - return "UnableToKillTheProcess" - case InvalidThreadDebuggingTokenKind: - return "InvalidThreadDebuggingToken" - case UnableToPauseTheProcessThreadsKind: - return "UnableToPauseTheProcessThreads" - case UnableToAttachToAnAlreadyAttachedProcessKind: - return "UnableToAttachToAnAlreadyAttachedProcess" - case TheUserDebuggerNotAttachedToTheProcessKind: - return "TheUserDebuggerNotAttachedToTheProcess" - case UnableToDetachAsThereArePausedThreadsKind: - return "UnableToDetachAsThereArePausedThreads" - case UnableToSwitchProcessIdOrThreadIdIsInvalidKind: - return "UnableToSwitchProcessIdOrThreadIdIsInvalid" - case UnableToSwitchThereIsNoThreadOnTheProcessKind: - return "UnableToSwitchThereIsNoThreadOnTheProcess" - case UnableToGetModulesOfTheProcessKind: - return "UnableToGetModulesOfTheProcess" - case UnableToGetCallstackKind: - return "UnableToGetCallstack" - case UnableToQueryCountOfProcessesOrThreadsKind: - return "UnableToQueryCountOfProcessesOrThreads" - case UsingShortCircuitingEventWithPostEventModeIsForbiddednKind: - return "UsingShortCircuitingEventWithPostEventModeIsForbiddedn" - case UnknownTestQueryReceivedKind: - return "UnknownTestQueryReceived" - case ReadingMemoryInvalidParameterKind: - return "ReadingMemoryInvalidParameter" - case TheTrapFlagListIsFullKind: - return "TheTrapFlagListIsFull" - case UnableToKillTheProcessDoesNotExistsKind: - return "UnableToKillTheProcessDoesNotExists" - case ModeExecutionIsInvalidKind: - return "ModeExecutionIsInvalid" - case ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootModeKind: - return "ProcessIdCannotBeSpecifiedWhileApplyingEventFromVmxRootMode" - case InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionalsKind: - return "InstantEventPreallocatedBufferIsNotEnoughForEventAndConditionals" - case InstantEventRegularPreallocatedBufferNotFoundKind: - return "InstantEventRegularPreallocatedBufferNotFound" - case InstantEventBigPreallocatedBufferNotFoundKind: - return "InstantEventBigPreallocatedBufferNotFound" - case UnableToCreateActionCannotAllocateBufferKind: - return "UnableToCreateActionCannotAllocateBuffer" - case InstantEventActionRegularPreallocatedBufferNotFoundKind: - return "InstantEventActionRegularPreallocatedBufferNotFound" - case InstantEventActionBigPreallocatedBufferNotFoundKind: - return "InstantEventActionBigPreallocatedBufferNotFound" - case InstantEventPreallocatedBufferIsNotEnoughForActionBufferKind: - return "InstantEventPreallocatedBufferIsNotEnoughForActionBuffer" - case InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStackKind: - return "InstantEventRequestedOptionalBufferIsBiggerThanDebuggersSendReceiveStack" - case InstantEventRegularRequestedSafeBufferNotFoundKind: - return "InstantEventRegularRequestedSafeBufferNotFound" - case InstantEventBigRequestedSafeBufferNotFoundKind: - return "InstantEventBigRequestedSafeBufferNotFound" - case InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBufferKind: - return "InstantEventPreallocatedBufferIsNotEnoughForRequestedSafeBuffer" - case UnableToAllocateRequestedSafeBufferKind: - return "UnableToAllocateRequestedSafeBuffer" - case CouldNotFindPreactivationTypeKind: - return "CouldNotFindPreactivationType" - case TheModeExecTrapIsNotInitializedKind: - return "TheModeExecTrapIsNotInitialized" - case TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFullKind: - return "TheTargetEventIsDisabledButCannotBeClearedPrirityBufferIsFull" - case NotAllCoresAreLockedForApplyingInstantEventKind: - return "NotAllCoresAreLockedForApplyingInstantEvent" - case TargetSwitchingCoreIsNotLockedKind: - return "TargetSwitchingCoreIsNotLocked" - case InvalidPhysicalAddressKind: - return "InvalidPhysicalAddress" - default: - return "InvalidDebuggerErrorKind" - } -} diff --git a/sdk/ioctl_enum_gen.go b/sdk/ioctl_enum_gen.go deleted file mode 100644 index a5fea1de2..000000000 --- a/sdk/ioctl_enum_gen.go +++ /dev/null @@ -1,283 +0,0 @@ -package sdk - -import ( - "strings" - - "golang.org/x/exp/constraints" -) - -// Code generated by GeneratedFile enum - DO NOT EDIT. - -type IoctlKind byte - -const ( - IoctlRegisterEventKind IoctlKind = iota - IoctlReturnIrpPendingPacketsAndDisallowIoctlKind - IoctlTerminateVmxKind - IoctlDebuggerReadMemoryKind - IoctlDebuggerReadOrWriteMsrKind - IoctlDebuggerReadPageTableEntriesDetailsKind - IoctlDebuggerRegisterEventKind - IoctlDebuggerAddActionToEventKind - IoctlDebuggerHideAndUnhideToTransparentTheDebuggerKind - IoctlDebuggerVa2PaAndPa2VaCommandsKind - IoctlDebuggerEditMemoryKind - IoctlDebuggerSearchMemoryKind - IoctlDebuggerModifyEventsKind - IoctlDebuggerFlushLoggingBuffersKind - IoctlDebuggerAttachDetachUserModeProcessKind - IoctlDebuggerPrintKind - IoctlPrepareDebuggeeKind - IoctlPausePacketReceivedKind - IoctlSendSignalExecutionInDebuggeeFinishedKind - IoctlSendUsermodeMessagesToDebuggerKind - IoctlSendGeneralBufferFromDebuggeeToDebuggerKind - IoctlPerfromKernelSideTestsKind - IoctlReservePreAllocatedPoolsKind - IoctlSendUserDebuggerCommandsKind - IoctlGetDetailOfActiveThreadsAndProcessesKind - IoctlGetUserModeModuleDetailsKind - IoctlQueryCountOfActiveProcessesOrThreadsKind - IoctlGetListOfThreadsAndProcessesKind - IoctlQueryCurrentProcessKind - IoctlQueryCurrentThreadKind - IoctlRequestRevMachineServiceKind - IoctlDebuggerBringPagesInKind - IoctlPreactivateFunctionalityKind - InvalidIoctlKind -) - -func ConvertInteger2IoctlKind[T constraints.Integer](v T) IoctlKind { - return IoctlKind(v) -} - -func (k IoctlKind) AssertKind(kinds string) IoctlKind { - for _, kind := range k.Kinds() { - if strings.ToLower(kinds) == strings.ToLower(kind.String()) { - return kind - } - } - return InvalidIoctlKind -} - -func (k IoctlKind) String() string { - switch k { - case IoctlRegisterEventKind: - return "IoctlRegisterEvent" - case IoctlReturnIrpPendingPacketsAndDisallowIoctlKind: - return "IoctlReturnIrpPendingPacketsAndDisallowIoctl" - case IoctlTerminateVmxKind: - return "IoctlTerminateVmx" - case IoctlDebuggerReadMemoryKind: - return "IoctlDebuggerReadMemory" - case IoctlDebuggerReadOrWriteMsrKind: - return "IoctlDebuggerReadOrWriteMsr" - case IoctlDebuggerReadPageTableEntriesDetailsKind: - return "IoctlDebuggerReadPageTableEntriesDetails" - case IoctlDebuggerRegisterEventKind: - return "IoctlDebuggerRegisterEvent" - case IoctlDebuggerAddActionToEventKind: - return "IoctlDebuggerAddActionToEvent" - case IoctlDebuggerHideAndUnhideToTransparentTheDebuggerKind: - return "IoctlDebuggerHideAndUnhideToTransparentTheDebugger" - case IoctlDebuggerVa2PaAndPa2VaCommandsKind: - return "IoctlDebuggerVa2PaAndPa2VaCommands" - case IoctlDebuggerEditMemoryKind: - return "IoctlDebuggerEditMemory" - case IoctlDebuggerSearchMemoryKind: - return "IoctlDebuggerSearchMemory" - case IoctlDebuggerModifyEventsKind: - return "IoctlDebuggerModifyEvents" - case IoctlDebuggerFlushLoggingBuffersKind: - return "IoctlDebuggerFlushLoggingBuffers" - case IoctlDebuggerAttachDetachUserModeProcessKind: - return "IoctlDebuggerAttachDetachUserModeProcess" - case IoctlDebuggerPrintKind: - return "IoctlDebuggerPrint" - case IoctlPrepareDebuggeeKind: - return "IoctlPrepareDebuggee" - case IoctlPausePacketReceivedKind: - return "IoctlPausePacketReceived" - case IoctlSendSignalExecutionInDebuggeeFinishedKind: - return "IoctlSendSignalExecutionInDebuggeeFinished" - case IoctlSendUsermodeMessagesToDebuggerKind: - return "IoctlSendUsermodeMessagesToDebugger" - case IoctlSendGeneralBufferFromDebuggeeToDebuggerKind: - return "IoctlSendGeneralBufferFromDebuggeeToDebugger" - case IoctlPerfromKernelSideTestsKind: - return "IoctlPerfromKernelSideTests" - case IoctlReservePreAllocatedPoolsKind: - return "IoctlReservePreAllocatedPools" - case IoctlSendUserDebuggerCommandsKind: - return "IoctlSendUserDebuggerCommands" - case IoctlGetDetailOfActiveThreadsAndProcessesKind: - return "IoctlGetDetailOfActiveThreadsAndProcesses" - case IoctlGetUserModeModuleDetailsKind: - return "IoctlGetUserModeModuleDetails" - case IoctlQueryCountOfActiveProcessesOrThreadsKind: - return "IoctlQueryCountOfActiveProcessesOrThreads" - case IoctlGetListOfThreadsAndProcessesKind: - return "IoctlGetListOfThreadsAndProcesses" - case IoctlQueryCurrentProcessKind: - return "IoctlQueryCurrentProcess" - case IoctlQueryCurrentThreadKind: - return "IoctlQueryCurrentThread" - case IoctlRequestRevMachineServiceKind: - return "IoctlRequestRevMachineService" - case IoctlDebuggerBringPagesInKind: - return "IoctlDebuggerBringPagesIn" - case IoctlPreactivateFunctionalityKind: - return "IoctlPreactivateFunctionality" - default: - return "InvalidIoctlKind" - } -} - -func (k IoctlKind) Keys() []string { - return []string{ - "IoctlRegisterEvent", - "IoctlReturnIrpPendingPacketsAndDisallowIoctl", - "IoctlTerminateVmx", - "IoctlDebuggerReadMemory", - "IoctlDebuggerReadOrWriteMsr", - "IoctlDebuggerReadPageTableEntriesDetails", - "IoctlDebuggerRegisterEvent", - "IoctlDebuggerAddActionToEvent", - "IoctlDebuggerHideAndUnhideToTransparentTheDebugger", - "IoctlDebuggerVa2PaAndPa2VaCommands", - "IoctlDebuggerEditMemory", - "IoctlDebuggerSearchMemory", - "IoctlDebuggerModifyEvents", - "IoctlDebuggerFlushLoggingBuffers", - "IoctlDebuggerAttachDetachUserModeProcess", - "IoctlDebuggerPrint", - "IoctlPrepareDebuggee", - "IoctlPausePacketReceived", - "IoctlSendSignalExecutionInDebuggeeFinished", - "IoctlSendUsermodeMessagesToDebugger", - "IoctlSendGeneralBufferFromDebuggeeToDebugger", - "IoctlPerfromKernelSideTests", - "IoctlReservePreAllocatedPools", - "IoctlSendUserDebuggerCommands", - "IoctlGetDetailOfActiveThreadsAndProcesses", - "IoctlGetUserModeModuleDetails", - "IoctlQueryCountOfActiveProcessesOrThreads", - "IoctlGetListOfThreadsAndProcesses", - "IoctlQueryCurrentProcess", - "IoctlQueryCurrentThread", - "IoctlRequestRevMachineService", - "IoctlDebuggerBringPagesIn", - "IoctlPreactivateFunctionality", - } -} - -func (k IoctlKind) Kinds() []IoctlKind { - return []IoctlKind{ - IoctlRegisterEventKind, - IoctlReturnIrpPendingPacketsAndDisallowIoctlKind, - IoctlTerminateVmxKind, - IoctlDebuggerReadMemoryKind, - IoctlDebuggerReadOrWriteMsrKind, - IoctlDebuggerReadPageTableEntriesDetailsKind, - IoctlDebuggerRegisterEventKind, - IoctlDebuggerAddActionToEventKind, - IoctlDebuggerHideAndUnhideToTransparentTheDebuggerKind, - IoctlDebuggerVa2PaAndPa2VaCommandsKind, - IoctlDebuggerEditMemoryKind, - IoctlDebuggerSearchMemoryKind, - IoctlDebuggerModifyEventsKind, - IoctlDebuggerFlushLoggingBuffersKind, - IoctlDebuggerAttachDetachUserModeProcessKind, - IoctlDebuggerPrintKind, - IoctlPrepareDebuggeeKind, - IoctlPausePacketReceivedKind, - IoctlSendSignalExecutionInDebuggeeFinishedKind, - IoctlSendUsermodeMessagesToDebuggerKind, - IoctlSendGeneralBufferFromDebuggeeToDebuggerKind, - IoctlPerfromKernelSideTestsKind, - IoctlReservePreAllocatedPoolsKind, - IoctlSendUserDebuggerCommandsKind, - IoctlGetDetailOfActiveThreadsAndProcessesKind, - IoctlGetUserModeModuleDetailsKind, - IoctlQueryCountOfActiveProcessesOrThreadsKind, - IoctlGetListOfThreadsAndProcessesKind, - IoctlQueryCurrentProcessKind, - IoctlQueryCurrentThreadKind, - IoctlRequestRevMachineServiceKind, - IoctlDebuggerBringPagesInKind, - IoctlPreactivateFunctionalityKind, - } -} - -func (k IoctlKind) PngFileName() string { - switch k { - case IoctlRegisterEventKind: - return "IoctlRegisterEvent" - case IoctlReturnIrpPendingPacketsAndDisallowIoctlKind: - return "IoctlReturnIrpPendingPacketsAndDisallowIoctl" - case IoctlTerminateVmxKind: - return "IoctlTerminateVmx" - case IoctlDebuggerReadMemoryKind: - return "IoctlDebuggerReadMemory" - case IoctlDebuggerReadOrWriteMsrKind: - return "IoctlDebuggerReadOrWriteMsr" - case IoctlDebuggerReadPageTableEntriesDetailsKind: - return "IoctlDebuggerReadPageTableEntriesDetails" - case IoctlDebuggerRegisterEventKind: - return "IoctlDebuggerRegisterEvent" - case IoctlDebuggerAddActionToEventKind: - return "IoctlDebuggerAddActionToEvent" - case IoctlDebuggerHideAndUnhideToTransparentTheDebuggerKind: - return "IoctlDebuggerHideAndUnhideToTransparentTheDebugger" - case IoctlDebuggerVa2PaAndPa2VaCommandsKind: - return "IoctlDebuggerVa2PaAndPa2VaCommands" - case IoctlDebuggerEditMemoryKind: - return "IoctlDebuggerEditMemory" - case IoctlDebuggerSearchMemoryKind: - return "IoctlDebuggerSearchMemory" - case IoctlDebuggerModifyEventsKind: - return "IoctlDebuggerModifyEvents" - case IoctlDebuggerFlushLoggingBuffersKind: - return "IoctlDebuggerFlushLoggingBuffers" - case IoctlDebuggerAttachDetachUserModeProcessKind: - return "IoctlDebuggerAttachDetachUserModeProcess" - case IoctlDebuggerPrintKind: - return "IoctlDebuggerPrint" - case IoctlPrepareDebuggeeKind: - return "IoctlPrepareDebuggee" - case IoctlPausePacketReceivedKind: - return "IoctlPausePacketReceived" - case IoctlSendSignalExecutionInDebuggeeFinishedKind: - return "IoctlSendSignalExecutionInDebuggeeFinished" - case IoctlSendUsermodeMessagesToDebuggerKind: - return "IoctlSendUsermodeMessagesToDebugger" - case IoctlSendGeneralBufferFromDebuggeeToDebuggerKind: - return "IoctlSendGeneralBufferFromDebuggeeToDebugger" - case IoctlPerfromKernelSideTestsKind: - return "IoctlPerfromKernelSideTests" - case IoctlReservePreAllocatedPoolsKind: - return "IoctlReservePreAllocatedPools" - case IoctlSendUserDebuggerCommandsKind: - return "IoctlSendUserDebuggerCommands" - case IoctlGetDetailOfActiveThreadsAndProcessesKind: - return "IoctlGetDetailOfActiveThreadsAndProcesses" - case IoctlGetUserModeModuleDetailsKind: - return "IoctlGetUserModeModuleDetails" - case IoctlQueryCountOfActiveProcessesOrThreadsKind: - return "IoctlQueryCountOfActiveProcessesOrThreads" - case IoctlGetListOfThreadsAndProcessesKind: - return "IoctlGetListOfThreadsAndProcesses" - case IoctlQueryCurrentProcessKind: - return "IoctlQueryCurrentProcess" - case IoctlQueryCurrentThreadKind: - return "IoctlQueryCurrentThread" - case IoctlRequestRevMachineServiceKind: - return "IoctlRequestRevMachineService" - case IoctlDebuggerBringPagesInKind: - return "IoctlDebuggerBringPagesIn" - case IoctlPreactivateFunctionalityKind: - return "IoctlPreactivateFunctionality" - default: - return "InvalidIoctlKind" - } -} diff --git a/sdk/util.go b/sdk/util.go index 5c05154ae..091efaf7a 100644 --- a/sdk/util.go +++ b/sdk/util.go @@ -5,35 +5,14 @@ import ( "path/filepath" "strings" "syscall" - "testing" "unsafe" - "github.com/ddkwork/golibrary/stream" - - "github.com/ddkwork/golibrary/assert" - "github.com/ddkwork/app/ms/hardwareIndo" "github.com/ddkwork/golibrary/mylog" + "github.com/ddkwork/golibrary/stream" "github.com/ddkwork/golibrary/stream/bitfield" ) -func LOWORD(l uint32) uint16 { return uint16(l) } -func LOBYTE(l uint32) uint8 { return byte(l) } -func HIWORD(l uint32) uint16 { return uint16(l >> 16) } -func HIBYTE(l uint32) uint8 { return byte(l >> 24) } - -func TestSizeof(t *testing.T) { - // assert.Equal(t, 11, binary.Size(DEBUGGER_REMOTE_PACKET{})) -} - -func TestHIBYTE(t *testing.T) { - v := uint32(0x11223344) - assert.Equal(t, byte(0x11), HIBYTE(v)) - assert.Equal(t, uint16(0x1122), HIWORD(v)) - assert.Equal(t, byte(0x44), LOBYTE(v)) - assert.Equal(t, uint16(0x3344), LOWORD(v)) -} - func VmxSupportDetection() (ok bool) { hard := hardwareIndo.New() if !hard.CpuInfo.Get() { diff --git a/sdk/vars.go b/sdk/vars.go index 63fde6ef0..ee6d46ba4 100644 --- a/sdk/vars.go +++ b/sdk/vars.go @@ -231,8 +231,8 @@ var ( DebuggerRemoteTrackingDefaultCountOfStepping = 0xffffffff ) -func CTL_CODE(deviceType, function, method, access uint32) IoctlKind { - return IoctlKind(((deviceType) << 16) | ((access) << 14) | ((function) << 2) | (method)) +func CTL_CODE(deviceType, function, method, access uint32) IoctlType { + return IoctlType(((deviceType) << 16) | ((access) << 14) | ((function) << 2) | (method)) } const (