Win32 API 日本語リファレンス
ホームStorage.DistributedFileSystem › DFS_GET_PKT_ENTRY_STATE_ARG

DFS_GET_PKT_ENTRY_STATE_ARG

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

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

フィールド

フィールドサイズx64x86説明
DfsEntryPathLenWORD2+0+0DFSエントリパス部分の長さ。バイト数で指定する。
ServerNameLenWORD2+2+2サーバー名部分の長さ。バイト数で指定する。
ShareNameLenWORD2+4+4共有名部分の長さ。バイト数で指定する。
LevelDWORD4+8+8取得する情報レベルを示す値。
BufferWCHAR2+12+12パス・サーバー名・共有名を連結して格納する可変長バッファ。

各言語での定義

#include <windows.h>

// DFS_GET_PKT_ENTRY_STATE_ARG  (x64 16 / x86 16 バイト)
typedef struct DFS_GET_PKT_ENTRY_STATE_ARG {
    WORD DfsEntryPathLen;
    WORD ServerNameLen;
    WORD ShareNameLen;
    DWORD Level;
    WCHAR Buffer[1];
} DFS_GET_PKT_ENTRY_STATE_ARG;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DFS_GET_PKT_ENTRY_STATE_ARG
{
    public ushort DfsEntryPathLen;
    public ushort ServerNameLen;
    public ushort ShareNameLen;
    public uint Level;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string Buffer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DFS_GET_PKT_ENTRY_STATE_ARG
    Public DfsEntryPathLen As UShort
    Public ServerNameLen As UShort
    Public ShareNameLen As UShort
    Public Level As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public Buffer As String
End Structure
import ctypes
from ctypes import wintypes

class DFS_GET_PKT_ENTRY_STATE_ARG(ctypes.Structure):
    _fields_ = [
        ("DfsEntryPathLen", ctypes.c_ushort),
        ("ServerNameLen", ctypes.c_ushort),
        ("ShareNameLen", ctypes.c_ushort),
        ("Level", wintypes.DWORD),
        ("Buffer", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct DFS_GET_PKT_ENTRY_STATE_ARG {
    pub DfsEntryPathLen: u16,
    pub ServerNameLen: u16,
    pub ShareNameLen: u16,
    pub Level: u32,
    pub Buffer: [u16; 1],
}
import "golang.org/x/sys/windows"

type DFS_GET_PKT_ENTRY_STATE_ARG struct {
	DfsEntryPathLen uint16
	ServerNameLen uint16
	ShareNameLen uint16
	Level uint32
	Buffer [1]uint16
}
type
  DFS_GET_PKT_ENTRY_STATE_ARG = record
    DfsEntryPathLen: Word;
    ServerNameLen: Word;
    ShareNameLen: Word;
    Level: DWORD;
    Buffer: array[0..0] of WideChar;
  end;
const DFS_GET_PKT_ENTRY_STATE_ARG = extern struct {
    DfsEntryPathLen: u16,
    ServerNameLen: u16,
    ShareNameLen: u16,
    Level: u32,
    Buffer: [1]u16,
};
type
  DFS_GET_PKT_ENTRY_STATE_ARG {.bycopy.} = object
    DfsEntryPathLen: uint16
    ServerNameLen: uint16
    ShareNameLen: uint16
    Level: uint32
    Buffer: array[1, uint16]
struct DFS_GET_PKT_ENTRY_STATE_ARG
{
    ushort DfsEntryPathLen;
    ushort ServerNameLen;
    ushort ShareNameLen;
    uint Level;
    wchar[1] Buffer;
}

HSP用 定義

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

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

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