Skip to content

Commit

Permalink
fmt CTL_CODE
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Jun 22, 2024
1 parent 8aa2b53 commit 021ae8e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 70 deletions.
8 changes: 5 additions & 3 deletions ux/sdk/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,14 @@ func TestBindMacros(t *testing.T) {
p.Value = strings.TrimSuffix(p.Value, "U")
p.Value = strings.TrimSuffix(p.Value, "ull")

if strings.HasPrefix(p.Value, "CTL_CODE") {
p.Value = "IoctlsKind(" + p.Value + ")"
}
if p.Key == "DEBUGGER_OPERATION_WAS_SUCCESSFUL" || strings.HasPrefix(p.Key, "DEBUGGER_ERROR") {
p.Key += " ErrorCodes"
}
if strings.HasPrefix(p.Key, "IOCTL_") {
// p.Key += " IoctlsKind"
p.Value = "IoctlsKind(" + p.Value + ")"
}

if p.Value[0] == '(' && p.Value[len(p.Value)-1] == ')' {
p.Value = p.Value[1 : len(p.Value)-1]
}
Expand Down
34 changes: 0 additions & 34 deletions ux/sdk/tmp/Ioctls.h.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,6 @@ const (

type IoctlsKind uint32

//var (
// IOCTL_REGISTER_EVENT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_RETURN_IRP_PENDING_PACKETS_AND_DISALLOW_IOCTL = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_TERMINATE_VMX = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_READ_MEMORY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_READ_OR_WRITE_MSR = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_REGISTER_EVENT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x806, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_ADD_ACTION_TO_EVENT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_HIDE_AND_UNHIDE_TO_TRANSPARENT_THE_DEBUGGER = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x808, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_VA2PA_AND_PA2VA_COMMANDS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_EDIT_MEMORY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80a, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_SEARCH_MEMORY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80b, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_MODIFY_EVENTS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80c, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_FLUSH_LOGGING_BUFFERS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80d, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80e, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_DEBUGGER_PRINT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80f, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_PREPARE_DEBUGGEE = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x810, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_PAUSE_PACKET_RECEIVED = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x811, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_SEND_SIGNAL_EXECUTION_IN_DEBUGGEE_FINISHED = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x812, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_SEND_USERMODE_MESSAGES_TO_DEBUGGER = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x813, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_SEND_GENERAL_BUFFER_FROM_DEBUGGEE_TO_DEBUGGER = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x814, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_SEND_GET_KERNEL_SIDE_TEST_INFORMATION = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x815, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_PERFROM_KERNEL_SIDE_TESTS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x816, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_RESERVE_PRE_ALLOCATED_POOLS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x817, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_SEND_USER_DEBUGGER_COMMANDS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x818, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_GET_DETAIL_OF_ACTIVE_THREADS_AND_PROCESSES = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x819, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_GET_USER_MODE_MODULE_DETAILS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81a, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_QUERY_COUNT_OF_ACTIVE_PROCESSES_OR_THREADS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81b, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_GET_LIST_OF_THREADS_AND_PROCESSES = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81c, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_QUERY_CURRENT_PROCESS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81d, METHOD_BUFFERED, FILE_ANY_ACCESS))
// IOCTL_QUERY_CURRENT_THREAD = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81e, METHOD_BUFFERED, FILE_ANY_ACCESS))
//)

func (e IoctlsKind) String() string {
switch e {
case IOCTL_REGISTER_EVENT:
Expand Down
66 changes: 33 additions & 33 deletions ux/sdk/tmp/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,38 +195,38 @@ var (
DEBUGGER_ERROR_INVALID_PHYSICAL_ADDRESS ErrorCodes = 0xc0000052
DEFAULT_INITIAL_DEBUGGEE_TO_DEBUGGER_OFFSET = 0x200
DEFAULT_INITIAL_DEBUGGER_TO_DEBUGGEE_OFFSET = 0x0
IOCTL_REGISTER_EVENT = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_RETURN_IRP_PENDING_PACKETS_AND_DISALLOW_IOCTL = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_TERMINATE_VMX = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_READ_MEMORY = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_READ_OR_WRITE_MSR = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_REGISTER_EVENT = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x806, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_ADD_ACTION_TO_EVENT = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_HIDE_AND_UNHIDE_TO_TRANSPARENT_THE_DEBUGGER = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x808, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_VA2PA_AND_PA2VA_COMMANDS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_EDIT_MEMORY = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80a, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_SEARCH_MEMORY = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80b, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_MODIFY_EVENTS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80c, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_FLUSH_LOGGING_BUFFERS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80d, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80e, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_PRINT = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80f, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_PREPARE_DEBUGGEE = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x810, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_PAUSE_PACKET_RECEIVED = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x811, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_SEND_SIGNAL_EXECUTION_IN_DEBUGGEE_FINISHED = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x812, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_SEND_USERMODE_MESSAGES_TO_DEBUGGER = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x813, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_SEND_GENERAL_BUFFER_FROM_DEBUGGEE_TO_DEBUGGER = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x814, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_PERFROM_KERNEL_SIDE_TESTS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x815, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_RESERVE_PRE_ALLOCATED_POOLS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x816, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_SEND_USER_DEBUGGER_COMMANDS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x817, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_GET_DETAIL_OF_ACTIVE_THREADS_AND_PROCESSES = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x818, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_GET_USER_MODE_MODULE_DETAILS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x819, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_QUERY_COUNT_OF_ACTIVE_PROCESSES_OR_THREADS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81a, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_GET_LIST_OF_THREADS_AND_PROCESSES = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81b, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_QUERY_CURRENT_PROCESS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81c, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_QUERY_CURRENT_THREAD = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81d, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_REQUEST_REV_MACHINE_SERVICE = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81e, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_DEBUGGER_BRING_PAGES_IN = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81f, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_PREACTIVATE_FUNCTIONALITY = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x820, METHOD_BUFFERED, FILE_ANY_ACCESS)
IOCTL_REGISTER_EVENT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_RETURN_IRP_PENDING_PACKETS_AND_DISALLOW_IOCTL = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_TERMINATE_VMX = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_READ_MEMORY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_READ_OR_WRITE_MSR = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_READ_PAGE_TABLE_ENTRIES_DETAILS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_REGISTER_EVENT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x806, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_ADD_ACTION_TO_EVENT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_HIDE_AND_UNHIDE_TO_TRANSPARENT_THE_DEBUGGER = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x808, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_VA2PA_AND_PA2VA_COMMANDS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_EDIT_MEMORY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80a, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_SEARCH_MEMORY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80b, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_MODIFY_EVENTS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80c, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_FLUSH_LOGGING_BUFFERS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80d, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_ATTACH_DETACH_USER_MODE_PROCESS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80e, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_PRINT = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80f, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_PREPARE_DEBUGGEE = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x810, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_PAUSE_PACKET_RECEIVED = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x811, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_SEND_SIGNAL_EXECUTION_IN_DEBUGGEE_FINISHED = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x812, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_SEND_USERMODE_MESSAGES_TO_DEBUGGER = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x813, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_SEND_GENERAL_BUFFER_FROM_DEBUGGEE_TO_DEBUGGER = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x814, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_PERFROM_KERNEL_SIDE_TESTS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x815, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_RESERVE_PRE_ALLOCATED_POOLS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x816, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_SEND_USER_DEBUGGER_COMMANDS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x817, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_GET_DETAIL_OF_ACTIVE_THREADS_AND_PROCESSES = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x818, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_GET_USER_MODE_MODULE_DETAILS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x819, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_QUERY_COUNT_OF_ACTIVE_PROCESSES_OR_THREADS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81a, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_GET_LIST_OF_THREADS_AND_PROCESSES = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81b, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_QUERY_CURRENT_PROCESS = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81c, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_QUERY_CURRENT_THREAD = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81d, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_REQUEST_REV_MACHINE_SERVICE = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81e, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_DEBUGGER_BRING_PAGES_IN = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x81f, METHOD_BUFFERED, FILE_ANY_ACCESS))
IOCTL_PREACTIVATE_FUNCTIONALITY = IoctlsKind(CTL_CODE(FILE_DEVICE_UNKNOWN, 0x820, METHOD_BUFFERED, FILE_ANY_ACCESS))
DEBUGGER_REMOTE_TRACKING_DEFAULT_COUNT_OF_STEPPING = 0xffffffff
)

0 comments on commit 021ae8e

Please sign in to comment.