func (i *Inspector) LookupHandleType(handle SystemHandle) (handleType string, err error) {
	handleType, knownType := i.typeMapping[handle.ObjectTypeIndex]
	if knownType {
		return handleType, nil
	}
	var h windows.Handle
	// duplicate handle if it's not from our own process
	if handle.UniqueProcessID != ownpid {
		h, err = i.duplicateHandle(handle)
		if err != nil {
			return "", fmt.Errorf("could not duplicate handle: %w", err)
		}
		defer windows.CloseHandle(h)
	} else {
		h = windows.Handle(handle.HandleValue)
	}
	handleType, err = i.ntQueryObject(h, typeInformationClass)
	i.typeMapping[handle.ObjectTypeIndex] = handleType
	if err != nil {
		return "", fmt.Errorf("could not query handle type: %w", err)
	}
	return
}
// LookupHandleType returns the type name for the handle. If possible, a cached type
// is used; otherwise, the handle is duplicated and its type is looked up.
LookupHandleType returns the type name for the handle. If possible, a cached type
is used; otherwise, the handle is duplicated and its type is looked up.
// LookupHandleType returns the type name for the handle . If possible a cached type // is used ; otherwise the handle is duplicated and its type is looked up .
func (i *Inspector) LookupHandleType(handle SystemHandle) (handleType string, err error) {
	handleType, knownType := i.typeMapping[handle.ObjectTypeIndex]
	if knownType {
		return handleType, nil
	}
	var h windows.Handle
	if handle.UniqueProcessID != ownpid {
		h, err = i.duplicateHandle(handle)
		if err != nil {
			return "", fmt.Errorf("could not duplicate handle: %w", err)
		}
		defer windows.CloseHandle(h)
	} else {
		h = windows.Handle(handle.HandleValue)
	}
	handleType, err = i.ntQueryObject(h, typeInformationClass)
	i.typeMapping[handle.ObjectTypeIndex] = handleType
	if err != nil {
		return "", fmt.Errorf("could not query handle type: %w", err)
	}
	return
}
func ( i * Inspector ) LookupHandleType ( handle SystemHandle ) ( handleType string , err error ) { handleType , knownType := i . typeMapping [ handle . ObjectTypeIndex ] if knownType { return handleType , nil } var h windows . Handle if handle . UniqueProcessID != ownpid { h , err = i . duplicateHandle ( handle ) if err != nil { return " " , fmt . Errorf ( " " , err ) } defer windows . CloseHandle ( h ) } else { h = windows . Handle ( handle . HandleValue ) } handleType , err = i . ntQueryObject ( h , typeInformationClass ) i . typeMapping [ handle . ObjectTypeIndex ] = handleType if err != nil { return " " , fmt . Errorf ( " " , err ) } return }
LookupHandleType returns the type name for the handle.
LookupHandleType returns the type name for the handle .
// duplicate handle if it's not from our own process