ホーム › Networking.ActiveDirectory › DSBITEMW
DSBITEMW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbStruct | DWORD | 4 | +0 | +0 | 本構造体のバイトサイズを示す。 |
| pszADsPath | LPWSTR | 8/4 | +8 | +4 | 対象オブジェクトのADsパス文字列(Unicode)。 |
| pszClass | LPWSTR | 8/4 | +16 | +8 | 対象オブジェクトのクラス名文字列(Unicode)。 |
| dwMask | DWORD | 4 | +24 | +12 | 取得・設定する状態ビットを示すマスク。 |
| dwState | DWORD | 4 | +28 | +16 | 項目の現在の状態を示すビット値。 |
| dwStateMask | DWORD | 4 | +32 | +20 | dwStateのうち有効なビットを示すマスク。 |
| szDisplayName | WCHAR | 128 | +36 | +24 | 表示名を格納する固定長Unicode文字配列。 |
| szIconLocation | WCHAR | 520 | +164 | +152 | アイコンを含むファイルのパスを格納する固定長Unicode文字配列。 |
| iIconResID | INT | 4 | +684 | +672 | szIconLocation内のアイコンリソースID。 |
各言語での定義
#include <windows.h>
// DSBITEMW (x64 688 / x86 676 バイト)
typedef struct DSBITEMW {
DWORD cbStruct;
LPWSTR pszADsPath;
LPWSTR pszClass;
DWORD dwMask;
DWORD dwState;
DWORD dwStateMask;
WCHAR szDisplayName[64];
WCHAR szIconLocation[260];
INT iIconResID;
} DSBITEMW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSBITEMW
{
public uint cbStruct;
public IntPtr pszADsPath;
public IntPtr pszClass;
public uint dwMask;
public uint dwState;
public uint dwStateMask;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szIconLocation;
public int iIconResID;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSBITEMW
Public cbStruct As UInteger
Public pszADsPath As IntPtr
Public pszClass As IntPtr
Public dwMask As UInteger
Public dwState As UInteger
Public dwStateMask As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szDisplayName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szIconLocation As String
Public iIconResID As Integer
End Structureimport ctypes
from ctypes import wintypes
class DSBITEMW(ctypes.Structure):
_fields_ = [
("cbStruct", wintypes.DWORD),
("pszADsPath", ctypes.c_void_p),
("pszClass", ctypes.c_void_p),
("dwMask", wintypes.DWORD),
("dwState", wintypes.DWORD),
("dwStateMask", wintypes.DWORD),
("szDisplayName", ctypes.c_wchar * 64),
("szIconLocation", ctypes.c_wchar * 260),
("iIconResID", ctypes.c_int),
]#[repr(C)]
pub struct DSBITEMW {
pub cbStruct: u32,
pub pszADsPath: *mut core::ffi::c_void,
pub pszClass: *mut core::ffi::c_void,
pub dwMask: u32,
pub dwState: u32,
pub dwStateMask: u32,
pub szDisplayName: [u16; 64],
pub szIconLocation: [u16; 260],
pub iIconResID: i32,
}import "golang.org/x/sys/windows"
type DSBITEMW struct {
cbStruct uint32
pszADsPath uintptr
pszClass uintptr
dwMask uint32
dwState uint32
dwStateMask uint32
szDisplayName [64]uint16
szIconLocation [260]uint16
iIconResID int32
}type
DSBITEMW = record
cbStruct: DWORD;
pszADsPath: Pointer;
pszClass: Pointer;
dwMask: DWORD;
dwState: DWORD;
dwStateMask: DWORD;
szDisplayName: array[0..63] of WideChar;
szIconLocation: array[0..259] of WideChar;
iIconResID: Integer;
end;const DSBITEMW = extern struct {
cbStruct: u32,
pszADsPath: ?*anyopaque,
pszClass: ?*anyopaque,
dwMask: u32,
dwState: u32,
dwStateMask: u32,
szDisplayName: [64]u16,
szIconLocation: [260]u16,
iIconResID: i32,
};type
DSBITEMW {.bycopy.} = object
cbStruct: uint32
pszADsPath: pointer
pszClass: pointer
dwMask: uint32
dwState: uint32
dwStateMask: uint32
szDisplayName: array[64, uint16]
szIconLocation: array[260, uint16]
iIconResID: int32struct DSBITEMW
{
uint cbStruct;
void* pszADsPath;
void* pszClass;
uint dwMask;
uint dwState;
uint dwStateMask;
wchar[64] szDisplayName;
wchar[260] szIconLocation;
int iIconResID;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DSBITEMW サイズ: 676 バイト(x86)
dim st, 169 ; 4byte整数×169(構造体サイズ 676 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pszADsPath : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pszClass : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwMask : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwState : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwStateMask : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; szDisplayName : WCHAR (+24, 128byte) varptr(st)+24 を基点に操作(128byte:入れ子/配列)
; szIconLocation : WCHAR (+152, 520byte) varptr(st)+152 を基点に操作(520byte:入れ子/配列)
; iIconResID : INT (+672, 4byte) st.168 = 値 / 値 = st.168 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSBITEMW サイズ: 688 バイト(x64)
dim st, 172 ; 4byte整数×172(構造体サイズ 688 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pszADsPath : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pszClass : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwMask : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwState : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwStateMask : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; szDisplayName : WCHAR (+36, 128byte) varptr(st)+36 を基点に操作(128byte:入れ子/配列)
; szIconLocation : WCHAR (+164, 520byte) varptr(st)+164 を基点に操作(520byte:入れ子/配列)
; iIconResID : INT (+684, 4byte) st.171 = 値 / 値 = st.171 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSBITEMW
#field int cbStruct
#field intptr pszADsPath
#field intptr pszClass
#field int dwMask
#field int dwState
#field int dwStateMask
#field wchar szDisplayName 64
#field wchar szIconLocation 260
#field int iIconResID
#endstruct
stdim st, DSBITEMW ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct