QueryObject consults the specified object information class and returns a pointer to the structure containing object information.
(obj windows.Handle, class int32)
| 103 | // QueryObject consults the specified object information class and returns |
| 104 | // a pointer to the structure containing object information. |
| 105 | func 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 | } |
no test coverage detected