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

FIND_BY_SID_OUTPUT

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

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

フィールド

フィールドサイズx64x86説明
NextEntryOffsetDWORD4+0+0次のエントリへのオフセット。0は最終エントリを示す。
FileIndexDWORD4+4+4ファイルのインデックス。
FileNameLengthDWORD4+8+8FileNameのバイト長。
FileNameWCHAR2+12+12ファイル名。ワイド文字配列。先頭要素。

各言語での定義

#include <windows.h>

// FIND_BY_SID_OUTPUT  (x64 16 / x86 16 バイト)
typedef struct FIND_BY_SID_OUTPUT {
    DWORD NextEntryOffset;
    DWORD FileIndex;
    DWORD FileNameLength;
    WCHAR FileName[1];
} FIND_BY_SID_OUTPUT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FIND_BY_SID_OUTPUT
{
    public uint NextEntryOffset;
    public uint FileIndex;
    public uint FileNameLength;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string FileName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FIND_BY_SID_OUTPUT
    Public NextEntryOffset As UInteger
    Public FileIndex As UInteger
    Public FileNameLength As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public FileName As String
End Structure
import ctypes
from ctypes import wintypes

class FIND_BY_SID_OUTPUT(ctypes.Structure):
    _fields_ = [
        ("NextEntryOffset", wintypes.DWORD),
        ("FileIndex", wintypes.DWORD),
        ("FileNameLength", wintypes.DWORD),
        ("FileName", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct FIND_BY_SID_OUTPUT {
    pub NextEntryOffset: u32,
    pub FileIndex: u32,
    pub FileNameLength: u32,
    pub FileName: [u16; 1],
}
import "golang.org/x/sys/windows"

type FIND_BY_SID_OUTPUT struct {
	NextEntryOffset uint32
	FileIndex uint32
	FileNameLength uint32
	FileName [1]uint16
}
type
  FIND_BY_SID_OUTPUT = record
    NextEntryOffset: DWORD;
    FileIndex: DWORD;
    FileNameLength: DWORD;
    FileName: array[0..0] of WideChar;
  end;
const FIND_BY_SID_OUTPUT = extern struct {
    NextEntryOffset: u32,
    FileIndex: u32,
    FileNameLength: u32,
    FileName: [1]u16,
};
type
  FIND_BY_SID_OUTPUT {.bycopy.} = object
    NextEntryOffset: uint32
    FileIndex: uint32
    FileNameLength: uint32
    FileName: array[1, uint16]
struct FIND_BY_SID_OUTPUT
{
    uint NextEntryOffset;
    uint FileIndex;
    uint FileNameLength;
    wchar[1] FileName;
}

HSP用 定義

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

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

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