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

ENCRYPTION_PROTECTOR

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

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

フィールド

フィールドサイズx64x86説明
cbTotalLengthDWORD4+0+0本構造体全体のバイト長。
pUserSidSID*8/4+8+4プロテクター所有ユーザーのSIDへのポインタ。NULL可。
lpProtectorDescriptorLPWSTR8/4+16+8プロテクターを記述する文字列。Unicode。

各言語での定義

#include <windows.h>

// ENCRYPTION_PROTECTOR  (x64 24 / x86 12 バイト)
typedef struct ENCRYPTION_PROTECTOR {
    DWORD cbTotalLength;
    SID* pUserSid;
    LPWSTR lpProtectorDescriptor;
} ENCRYPTION_PROTECTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ENCRYPTION_PROTECTOR
{
    public uint cbTotalLength;
    public IntPtr pUserSid;
    public IntPtr lpProtectorDescriptor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ENCRYPTION_PROTECTOR
    Public cbTotalLength As UInteger
    Public pUserSid As IntPtr
    Public lpProtectorDescriptor As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class ENCRYPTION_PROTECTOR(ctypes.Structure):
    _fields_ = [
        ("cbTotalLength", wintypes.DWORD),
        ("pUserSid", ctypes.c_void_p),
        ("lpProtectorDescriptor", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct ENCRYPTION_PROTECTOR {
    pub cbTotalLength: u32,
    pub pUserSid: *mut core::ffi::c_void,
    pub lpProtectorDescriptor: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type ENCRYPTION_PROTECTOR struct {
	cbTotalLength uint32
	pUserSid uintptr
	lpProtectorDescriptor uintptr
}
type
  ENCRYPTION_PROTECTOR = record
    cbTotalLength: DWORD;
    pUserSid: Pointer;
    lpProtectorDescriptor: Pointer;
  end;
const ENCRYPTION_PROTECTOR = extern struct {
    cbTotalLength: u32,
    pUserSid: ?*anyopaque,
    lpProtectorDescriptor: ?*anyopaque,
};
type
  ENCRYPTION_PROTECTOR {.bycopy.} = object
    cbTotalLength: uint32
    pUserSid: pointer
    lpProtectorDescriptor: pointer
struct ENCRYPTION_PROTECTOR
{
    uint cbTotalLength;
    void* pUserSid;
    void* lpProtectorDescriptor;
}

HSP用 定義

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

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

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