ホーム › System.WindowsProgramming › PUBLIC_OBJECT_BASIC_INFORMATION
PUBLIC_OBJECT_BASIC_INFORMATION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Attributes | DWORD | 4 | +0 | +0 | オブジェクトの属性を示すフラグ。 |
| GrantedAccess | DWORD | 4 | +4 | +4 | オブジェクトに対して付与されたアクセス権マスク。 |
| HandleCount | DWORD | 4 | +8 | +8 | オブジェクトを参照しているハンドル数。 |
| PointerCount | DWORD | 4 | +12 | +12 | オブジェクトへの参照(ポインタ)数。 |
| Reserved | DWORD | 40 | +16 | +16 | 予約DWORD配列。 |
各言語での定義
#include <windows.h>
// PUBLIC_OBJECT_BASIC_INFORMATION (x64 56 / x86 56 バイト)
typedef struct PUBLIC_OBJECT_BASIC_INFORMATION {
DWORD Attributes;
DWORD GrantedAccess;
DWORD HandleCount;
DWORD PointerCount;
DWORD Reserved[10];
} PUBLIC_OBJECT_BASIC_INFORMATION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PUBLIC_OBJECT_BASIC_INFORMATION
{
public uint Attributes;
public uint GrantedAccess;
public uint HandleCount;
public uint PointerCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] Reserved;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PUBLIC_OBJECT_BASIC_INFORMATION
Public Attributes As UInteger
Public GrantedAccess As UInteger
Public HandleCount As UInteger
Public PointerCount As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Public Reserved() As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PUBLIC_OBJECT_BASIC_INFORMATION(ctypes.Structure):
_fields_ = [
("Attributes", wintypes.DWORD),
("GrantedAccess", wintypes.DWORD),
("HandleCount", wintypes.DWORD),
("PointerCount", wintypes.DWORD),
("Reserved", wintypes.DWORD * 10),
]#[repr(C)]
pub struct PUBLIC_OBJECT_BASIC_INFORMATION {
pub Attributes: u32,
pub GrantedAccess: u32,
pub HandleCount: u32,
pub PointerCount: u32,
pub Reserved: [u32; 10],
}import "golang.org/x/sys/windows"
type PUBLIC_OBJECT_BASIC_INFORMATION struct {
Attributes uint32
GrantedAccess uint32
HandleCount uint32
PointerCount uint32
Reserved [10]uint32
}type
PUBLIC_OBJECT_BASIC_INFORMATION = record
Attributes: DWORD;
GrantedAccess: DWORD;
HandleCount: DWORD;
PointerCount: DWORD;
Reserved: array[0..9] of DWORD;
end;const PUBLIC_OBJECT_BASIC_INFORMATION = extern struct {
Attributes: u32,
GrantedAccess: u32,
HandleCount: u32,
PointerCount: u32,
Reserved: [10]u32,
};type
PUBLIC_OBJECT_BASIC_INFORMATION {.bycopy.} = object
Attributes: uint32
GrantedAccess: uint32
HandleCount: uint32
PointerCount: uint32
Reserved: array[10, uint32]struct PUBLIC_OBJECT_BASIC_INFORMATION
{
uint Attributes;
uint GrantedAccess;
uint HandleCount;
uint PointerCount;
uint[10] Reserved;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PUBLIC_OBJECT_BASIC_INFORMATION サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Attributes : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; GrantedAccess : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; HandleCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; PointerCount : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Reserved : DWORD (+16, 40byte) varptr(st)+16 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PUBLIC_OBJECT_BASIC_INFORMATION
#field int Attributes
#field int GrantedAccess
#field int HandleCount
#field int PointerCount
#field int Reserved 10
#endstruct
stdim st, PUBLIC_OBJECT_BASIC_INFORMATION ; NSTRUCT 変数を確保
st->Attributes = 100
mes "Attributes=" + st->Attributes