ホーム › Networking.ActiveDirectory › DSQUERYPARAMS
DSQUERYPARAMS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbStruct | DWORD | 4 | +0 | +0 | 本構造体のバイトサイズを示す。 |
| dwFlags | DWORD | 4 | +4 | +4 | クエリの動作を制御するフラグ。 |
| hInstance | HINSTANCE | 8/4 | +8 | +8 | 列見出しリソースを含むモジュールのインスタンスハンドル。 |
| offsetQuery | INT | 4 | +16 | +12 | 構造体先頭からLDAPクエリ文字列までのバイトオフセット。 |
| iColumns | INT | 4 | +20 | +16 | aColumns配列に含まれる列定義の個数。 |
| dwReserved | DWORD | 4 | +24 | +20 | 予約フィールド。0を設定する。 |
| aColumns | DSCOLUMN | 24 | +28 | +24 | 結果表示の列を定義するDSCOLUMNの可変長配列。 |
各言語での定義
#include <windows.h>
// DSCOLUMN (x64 24 / x86 24 バイト)
typedef struct DSCOLUMN {
DWORD dwFlags;
INT fmt;
INT cx;
INT idsName;
INT offsetProperty;
DWORD dwReserved;
} DSCOLUMN;
// DSQUERYPARAMS (x64 56 / x86 48 バイト)
typedef struct DSQUERYPARAMS {
DWORD cbStruct;
DWORD dwFlags;
HINSTANCE hInstance;
INT offsetQuery;
INT iColumns;
DWORD dwReserved;
DSCOLUMN aColumns[1];
} DSQUERYPARAMS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSCOLUMN
{
public uint dwFlags;
public int fmt;
public int cx;
public int idsName;
public int offsetProperty;
public uint dwReserved;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSQUERYPARAMS
{
public uint cbStruct;
public uint dwFlags;
public IntPtr hInstance;
public int offsetQuery;
public int iColumns;
public uint dwReserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DSCOLUMN[] aColumns;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSCOLUMN
Public dwFlags As UInteger
Public fmt As Integer
Public cx As Integer
Public idsName As Integer
Public offsetProperty As Integer
Public dwReserved As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSQUERYPARAMS
Public cbStruct As UInteger
Public dwFlags As UInteger
Public hInstance As IntPtr
Public offsetQuery As Integer
Public iColumns As Integer
Public dwReserved As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aColumns() As DSCOLUMN
End Structureimport ctypes
from ctypes import wintypes
class DSCOLUMN(ctypes.Structure):
_fields_ = [
("dwFlags", wintypes.DWORD),
("fmt", ctypes.c_int),
("cx", ctypes.c_int),
("idsName", ctypes.c_int),
("offsetProperty", ctypes.c_int),
("dwReserved", wintypes.DWORD),
]
class DSQUERYPARAMS(ctypes.Structure):
_fields_ = [
("cbStruct", wintypes.DWORD),
("dwFlags", wintypes.DWORD),
("hInstance", ctypes.c_void_p),
("offsetQuery", ctypes.c_int),
("iColumns", ctypes.c_int),
("dwReserved", wintypes.DWORD),
("aColumns", DSCOLUMN * 1),
]#[repr(C)]
pub struct DSCOLUMN {
pub dwFlags: u32,
pub fmt: i32,
pub cx: i32,
pub idsName: i32,
pub offsetProperty: i32,
pub dwReserved: u32,
}
#[repr(C)]
pub struct DSQUERYPARAMS {
pub cbStruct: u32,
pub dwFlags: u32,
pub hInstance: *mut core::ffi::c_void,
pub offsetQuery: i32,
pub iColumns: i32,
pub dwReserved: u32,
pub aColumns: [DSCOLUMN; 1],
}import "golang.org/x/sys/windows"
type DSCOLUMN struct {
dwFlags uint32
fmt int32
cx int32
idsName int32
offsetProperty int32
dwReserved uint32
}
type DSQUERYPARAMS struct {
cbStruct uint32
dwFlags uint32
hInstance uintptr
offsetQuery int32
iColumns int32
dwReserved uint32
aColumns [1]DSCOLUMN
}type
DSCOLUMN = record
dwFlags: DWORD;
fmt: Integer;
cx: Integer;
idsName: Integer;
offsetProperty: Integer;
dwReserved: DWORD;
end;
DSQUERYPARAMS = record
cbStruct: DWORD;
dwFlags: DWORD;
hInstance: Pointer;
offsetQuery: Integer;
iColumns: Integer;
dwReserved: DWORD;
aColumns: array[0..0] of DSCOLUMN;
end;const DSCOLUMN = extern struct {
dwFlags: u32,
fmt: i32,
cx: i32,
idsName: i32,
offsetProperty: i32,
dwReserved: u32,
};
const DSQUERYPARAMS = extern struct {
cbStruct: u32,
dwFlags: u32,
hInstance: ?*anyopaque,
offsetQuery: i32,
iColumns: i32,
dwReserved: u32,
aColumns: [1]DSCOLUMN,
};type
DSCOLUMN {.bycopy.} = object
dwFlags: uint32
fmt: int32
cx: int32
idsName: int32
offsetProperty: int32
dwReserved: uint32
DSQUERYPARAMS {.bycopy.} = object
cbStruct: uint32
dwFlags: uint32
hInstance: pointer
offsetQuery: int32
iColumns: int32
dwReserved: uint32
aColumns: array[1, DSCOLUMN]struct DSCOLUMN
{
uint dwFlags;
int fmt;
int cx;
int idsName;
int offsetProperty;
uint dwReserved;
}
struct DSQUERYPARAMS
{
uint cbStruct;
uint dwFlags;
void* hInstance;
int offsetQuery;
int iColumns;
uint dwReserved;
DSCOLUMN[1] aColumns;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DSQUERYPARAMS サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hInstance : HINSTANCE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; offsetQuery : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; iColumns : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwReserved : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; aColumns : DSCOLUMN (+24, 24byte) varptr(st)+24 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSQUERYPARAMS サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hInstance : HINSTANCE (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; offsetQuery : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; iColumns : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwReserved : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; aColumns : DSCOLUMN (+28, 24byte) varptr(st)+28 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DSCOLUMN
#field int dwFlags
#field int fmt
#field int cx
#field int idsName
#field int offsetProperty
#field int dwReserved
#endstruct
#defstruct global DSQUERYPARAMS
#field int cbStruct
#field int dwFlags
#field intptr hInstance
#field int offsetQuery
#field int iColumns
#field int dwReserved
#field DSCOLUMN aColumns 1
#endstruct
stdim st, DSQUERYPARAMS ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct