ホーム › System.Ioctl › FIND_BY_SID_DATA
FIND_BY_SID_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Restart | DWORD | 4 | +0 | +0 | 列挙を最初から再開するかどうかを示す値。 |
| Sid | SID | 12 | +4 | +4 | 検索条件とするセキュリティ識別子(SID)。 |
各言語での定義
#include <windows.h>
// SID_IDENTIFIER_AUTHORITY (x64 6 / x86 6 バイト)
typedef struct SID_IDENTIFIER_AUTHORITY {
BYTE Value[6];
} SID_IDENTIFIER_AUTHORITY;
// SID (x64 12 / x86 12 バイト)
typedef struct SID {
BYTE Revision;
BYTE SubAuthorityCount;
SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
DWORD SubAuthority[1];
} SID;
// FIND_BY_SID_DATA (x64 16 / x86 16 バイト)
typedef struct FIND_BY_SID_DATA {
DWORD Restart;
SID Sid;
} FIND_BY_SID_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SID_IDENTIFIER_AUTHORITY
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Value;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SID
{
public byte Revision;
public byte SubAuthorityCount;
public SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] SubAuthority;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FIND_BY_SID_DATA
{
public uint Restart;
public SID Sid;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SID_IDENTIFIER_AUTHORITY
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public Value() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SID
Public Revision As Byte
Public SubAuthorityCount As Byte
Public IdentifierAuthority As SID_IDENTIFIER_AUTHORITY
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public SubAuthority() As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FIND_BY_SID_DATA
Public Restart As UInteger
Public Sid As SID
End Structureimport ctypes
from ctypes import wintypes
class SID_IDENTIFIER_AUTHORITY(ctypes.Structure):
_fields_ = [
("Value", ctypes.c_ubyte * 6),
]
class SID(ctypes.Structure):
_fields_ = [
("Revision", ctypes.c_ubyte),
("SubAuthorityCount", ctypes.c_ubyte),
("IdentifierAuthority", SID_IDENTIFIER_AUTHORITY),
("SubAuthority", wintypes.DWORD * 1),
]
class FIND_BY_SID_DATA(ctypes.Structure):
_fields_ = [
("Restart", wintypes.DWORD),
("Sid", SID),
]#[repr(C)]
pub struct SID_IDENTIFIER_AUTHORITY {
pub Value: [u8; 6],
}
#[repr(C)]
pub struct SID {
pub Revision: u8,
pub SubAuthorityCount: u8,
pub IdentifierAuthority: SID_IDENTIFIER_AUTHORITY,
pub SubAuthority: [u32; 1],
}
#[repr(C)]
pub struct FIND_BY_SID_DATA {
pub Restart: u32,
pub Sid: SID,
}import "golang.org/x/sys/windows"
type SID_IDENTIFIER_AUTHORITY struct {
Value [6]byte
}
type SID struct {
Revision byte
SubAuthorityCount byte
IdentifierAuthority SID_IDENTIFIER_AUTHORITY
SubAuthority [1]uint32
}
type FIND_BY_SID_DATA struct {
Restart uint32
Sid SID
}type
SID_IDENTIFIER_AUTHORITY = record
Value: array[0..5] of Byte;
end;
SID = record
Revision: Byte;
SubAuthorityCount: Byte;
IdentifierAuthority: SID_IDENTIFIER_AUTHORITY;
SubAuthority: array[0..0] of DWORD;
end;
FIND_BY_SID_DATA = record
Restart: DWORD;
Sid: SID;
end;const SID_IDENTIFIER_AUTHORITY = extern struct {
Value: [6]u8,
};
const SID = extern struct {
Revision: u8,
SubAuthorityCount: u8,
IdentifierAuthority: SID_IDENTIFIER_AUTHORITY,
SubAuthority: [1]u32,
};
const FIND_BY_SID_DATA = extern struct {
Restart: u32,
Sid: SID,
};type
SID_IDENTIFIER_AUTHORITY {.bycopy.} = object
Value: array[6, uint8]
SID {.bycopy.} = object
Revision: uint8
SubAuthorityCount: uint8
IdentifierAuthority: SID_IDENTIFIER_AUTHORITY
SubAuthority: array[1, uint32]
FIND_BY_SID_DATA {.bycopy.} = object
Restart: uint32
Sid: SIDstruct SID_IDENTIFIER_AUTHORITY
{
ubyte[6] Value;
}
struct SID
{
ubyte Revision;
ubyte SubAuthorityCount;
SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
uint[1] SubAuthority;
}
struct FIND_BY_SID_DATA
{
uint Restart;
SID Sid;
}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_DATA サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Restart : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Sid : SID (+4, 12byte) varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SID_IDENTIFIER_AUTHORITY
#field byte Value 6
#endstruct
#defstruct global SID
#field byte Revision
#field byte SubAuthorityCount
#field SID_IDENTIFIER_AUTHORITY IdentifierAuthority
#field int SubAuthority 1
#endstruct
#defstruct global FIND_BY_SID_DATA
#field int Restart
#field SID Sid
#endstruct
stdim st, FIND_BY_SID_DATA ; NSTRUCT 変数を確保
st->Restart = 100
mes "Restart=" + st->Restart