Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Nov 15, 2024
1 parent bd347e9 commit 512a121
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 1,038 deletions.
12 changes: 6 additions & 6 deletions sdk/bindgen/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
53 changes: 52 additions & 1 deletion sdk/bindgen/bug/1.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -35,4 +83,7 @@ func main() {
fmt.Println("PBOOLEAN值:", *pb)
fmt.Println("CHECK_VMX_OPERATION返回值:", checkVMXOperation())
}
*/
*/



42 changes: 41 additions & 1 deletion sdk/bindgen/bug/tmp/bug.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions sdk/bindgen/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
}
80 changes: 0 additions & 80 deletions sdk/commands_enum_gen.go

This file was deleted.

Loading

0 comments on commit 512a121

Please sign in to comment.