Win32 API 日本語リファレンス
ホームSystem.StationsAndDesktops › USEROBJECTFLAGS

USEROBJECTFLAGS

構造体
サイズx64: 12 バイト / x86: 12 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
fInheritBOOL4+0+0オブジェクトハンドルを子プロセスへ継承させるか否かのフラグ。
fReservedBOOL4+4+4予約済みフィールド。
dwFlagsDWORD4+8+8オブジェクト固有のフラグのビット集合(デスクトップの DF_ALLOWOTHERACCOUNTHOOK 等)。

各言語での定義

#include <windows.h>

// USEROBJECTFLAGS  (x64 12 / x86 12 バイト)
typedef struct USEROBJECTFLAGS {
    BOOL fInherit;
    BOOL fReserved;
    DWORD dwFlags;
} USEROBJECTFLAGS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct USEROBJECTFLAGS
{
    [MarshalAs(UnmanagedType.Bool)] public bool fInherit;
    [MarshalAs(UnmanagedType.Bool)] public bool fReserved;
    public uint dwFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure USEROBJECTFLAGS
    <MarshalAs(UnmanagedType.Bool)> Public fInherit As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fReserved As Boolean
    Public dwFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class USEROBJECTFLAGS(ctypes.Structure):
    _fields_ = [
        ("fInherit", wintypes.BOOL),
        ("fReserved", wintypes.BOOL),
        ("dwFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct USEROBJECTFLAGS {
    pub fInherit: i32,
    pub fReserved: i32,
    pub dwFlags: u32,
}
import "golang.org/x/sys/windows"

type USEROBJECTFLAGS struct {
	fInherit int32
	fReserved int32
	dwFlags uint32
}
type
  USEROBJECTFLAGS = record
    fInherit: BOOL;
    fReserved: BOOL;
    dwFlags: DWORD;
  end;
const USEROBJECTFLAGS = extern struct {
    fInherit: i32,
    fReserved: i32,
    dwFlags: u32,
};
type
  USEROBJECTFLAGS {.bycopy.} = object
    fInherit: int32
    fReserved: int32
    dwFlags: uint32
struct USEROBJECTFLAGS
{
    int fInherit;
    int fReserved;
    uint dwFlags;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; USEROBJECTFLAGS サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; fInherit : BOOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; fReserved : BOOL (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFlags : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global USEROBJECTFLAGS
    #field bool fInherit
    #field bool fReserved
    #field int dwFlags
#endstruct

stdim st, USEROBJECTFLAGS        ; NSTRUCT 変数を確保
st->fInherit = 100
mes "fInherit=" + st->fInherit