Win32 API 日本語リファレンス
ホームNetworking.ActiveDirectory › ADS_VLV

ADS_VLV

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

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

フィールド

フィールドサイズx64x86説明
dwBeforeCountDWORD4+0+0ターゲット項目より前に返す項目数を指定する。仮想リストビューの前方範囲。
dwAfterCountDWORD4+4+4ターゲット項目より後に返す項目数を指定する。仮想リストビューの後方範囲。
dwOffsetDWORD4+8+8リスト内のターゲット項目の位置を示すオフセット。1始まりの序数。
dwContentCountDWORD4+12+12リスト全体の推定項目総数。サーバから返される推定値である。
pszTargetLPWSTR8/4+16+16検索対象の開始位置を示すターゲット文字列。オフセット指定時は無視される。
dwContextIDLengthDWORD4+24+20lpContextIDが指すコンテキストIDのバイト長を示す。
lpContextIDBYTE*8/4+32+24サーバが返すコンテキストID。次回検索で再利用する不透明なバイト列へのポインタ。

各言語での定義

#include <windows.h>

// ADS_VLV  (x64 40 / x86 28 バイト)
typedef struct ADS_VLV {
    DWORD dwBeforeCount;
    DWORD dwAfterCount;
    DWORD dwOffset;
    DWORD dwContentCount;
    LPWSTR pszTarget;
    DWORD dwContextIDLength;
    BYTE* lpContextID;
} ADS_VLV;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADS_VLV
{
    public uint dwBeforeCount;
    public uint dwAfterCount;
    public uint dwOffset;
    public uint dwContentCount;
    public IntPtr pszTarget;
    public uint dwContextIDLength;
    public IntPtr lpContextID;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADS_VLV
    Public dwBeforeCount As UInteger
    Public dwAfterCount As UInteger
    Public dwOffset As UInteger
    Public dwContentCount As UInteger
    Public pszTarget As IntPtr
    Public dwContextIDLength As UInteger
    Public lpContextID As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class ADS_VLV(ctypes.Structure):
    _fields_ = [
        ("dwBeforeCount", wintypes.DWORD),
        ("dwAfterCount", wintypes.DWORD),
        ("dwOffset", wintypes.DWORD),
        ("dwContentCount", wintypes.DWORD),
        ("pszTarget", ctypes.c_void_p),
        ("dwContextIDLength", wintypes.DWORD),
        ("lpContextID", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct ADS_VLV {
    pub dwBeforeCount: u32,
    pub dwAfterCount: u32,
    pub dwOffset: u32,
    pub dwContentCount: u32,
    pub pszTarget: *mut core::ffi::c_void,
    pub dwContextIDLength: u32,
    pub lpContextID: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type ADS_VLV struct {
	dwBeforeCount uint32
	dwAfterCount uint32
	dwOffset uint32
	dwContentCount uint32
	pszTarget uintptr
	dwContextIDLength uint32
	lpContextID uintptr
}
type
  ADS_VLV = record
    dwBeforeCount: DWORD;
    dwAfterCount: DWORD;
    dwOffset: DWORD;
    dwContentCount: DWORD;
    pszTarget: Pointer;
    dwContextIDLength: DWORD;
    lpContextID: Pointer;
  end;
const ADS_VLV = extern struct {
    dwBeforeCount: u32,
    dwAfterCount: u32,
    dwOffset: u32,
    dwContentCount: u32,
    pszTarget: ?*anyopaque,
    dwContextIDLength: u32,
    lpContextID: ?*anyopaque,
};
type
  ADS_VLV {.bycopy.} = object
    dwBeforeCount: uint32
    dwAfterCount: uint32
    dwOffset: uint32
    dwContentCount: uint32
    pszTarget: pointer
    dwContextIDLength: uint32
    lpContextID: pointer
struct ADS_VLV
{
    uint dwBeforeCount;
    uint dwAfterCount;
    uint dwOffset;
    uint dwContentCount;
    void* pszTarget;
    uint dwContextIDLength;
    void* lpContextID;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ADS_VLV サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; dwBeforeCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwAfterCount : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwOffset : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwContentCount : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pszTarget : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwContextIDLength : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; lpContextID : BYTE* (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ADS_VLV サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwBeforeCount : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwAfterCount : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwOffset : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwContentCount : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pszTarget : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; dwContextIDLength : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; lpContextID : BYTE* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ADS_VLV
    #field int dwBeforeCount
    #field int dwAfterCount
    #field int dwOffset
    #field int dwContentCount
    #field intptr pszTarget
    #field int dwContextIDLength
    #field intptr lpContextID
#endstruct

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