MCPcopy Index your code
hub / github.com/rabbitstack/fibratus / QueryObject

Function QueryObject

pkg/sys/object.go:105–122  ·  view source on GitHub ↗

QueryObject consults the specified object information class and returns a pointer to the structure containing object information.

(obj windows.Handle, class int32)

Source from the content-addressed store, hash-verified

103// QueryObject consults the specified object information class and returns
104// a pointer to the structure containing object information.
105func QueryObject[C any](obj windows.Handle, class int32) (*C, error) {
106 var c C
107 var s uint32
108 n := make([]byte, unsafe.Sizeof(c))
109 err := NtQueryObject(obj, class, unsafe.Pointer(&n[0]), uint32(len(n)), &s)
110 if err != nil {
111 if err == windows.STATUS_INFO_LENGTH_MISMATCH || err == windows.STATUS_BUFFER_TOO_SMALL || err == windows.STATUS_BUFFER_OVERFLOW {
112 n = make([]byte, s)
113 err := NtQueryObject(obj, class, unsafe.Pointer(&n[0]), uint32(len(n)), &s)
114 if err != nil {
115 return nil, err
116 }
117 return (*C)(unsafe.Pointer(&n[0])), nil
118 }
119 return nil, err
120 }
121 return (*C)(unsafe.Pointer(&n[0])), nil
122}

Callers 3

QueryObjectTypeFunction · 0.92
QueryObjectNameFunction · 0.92
findObjectTypesFunction · 0.92

Calls 1

NtQueryObjectFunction · 0.85

Tested by

no test coverage detected