Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › LSA_TRANSLATED_SID

LSA_TRANSLATED_SID

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

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

フィールド

フィールドサイズx64x86説明
UseSID_NAME_USE4+0+0SIDの用途種別(ユーザー/グループ等)を示す列挙値。
RelativeIdDWORD4+4+4ドメインSIDに対する相対識別子(RID)。
DomainIndexINT4+8+8対応するドメインの参照リスト内インデックス。負値は未解決を表す。

各言語での定義

#include <windows.h>

// LSA_TRANSLATED_SID  (x64 12 / x86 12 バイト)
typedef struct LSA_TRANSLATED_SID {
    SID_NAME_USE Use;
    DWORD RelativeId;
    INT DomainIndex;
} LSA_TRANSLATED_SID;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LSA_TRANSLATED_SID
{
    public int Use;
    public uint RelativeId;
    public int DomainIndex;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LSA_TRANSLATED_SID
    Public Use As Integer
    Public RelativeId As UInteger
    Public DomainIndex As Integer
End Structure
import ctypes
from ctypes import wintypes

class LSA_TRANSLATED_SID(ctypes.Structure):
    _fields_ = [
        ("Use", ctypes.c_int),
        ("RelativeId", wintypes.DWORD),
        ("DomainIndex", ctypes.c_int),
    ]
#[repr(C)]
pub struct LSA_TRANSLATED_SID {
    pub Use: i32,
    pub RelativeId: u32,
    pub DomainIndex: i32,
}
import "golang.org/x/sys/windows"

type LSA_TRANSLATED_SID struct {
	Use int32
	RelativeId uint32
	DomainIndex int32
}
type
  LSA_TRANSLATED_SID = record
    Use: Integer;
    RelativeId: DWORD;
    DomainIndex: Integer;
  end;
const LSA_TRANSLATED_SID = extern struct {
    Use: i32,
    RelativeId: u32,
    DomainIndex: i32,
};
type
  LSA_TRANSLATED_SID {.bycopy.} = object
    Use: int32
    RelativeId: uint32
    DomainIndex: int32
struct LSA_TRANSLATED_SID
{
    int Use;
    uint RelativeId;
    int DomainIndex;
}

HSP用 定義

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

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

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