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

COAUTHINFO

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

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

フィールド

フィールドサイズx64x86説明
dwAuthnSvcDWORD4+0+0使用する認証サービス(RPC_C_AUTHN_系)。
dwAuthzSvcDWORD4+4+4使用する承認サービス(RPC_C_AUTHZ_系)。
pwszServerPrincNameLPWSTR8/4+8+8サーバープリンシパル名文字列。NULL可。
dwAuthnLevelDWORD4+16+12認証レベル(RPC_C_AUTHN_LEVEL_系)。
dwImpersonationLevelDWORD4+20+16偽装レベル(RPC_C_IMP_LEVEL_系)。
pAuthIdentityDataCOAUTHIDENTITY*8/4+24+20認証に用いる資格情報(COAUTHIDENTITY)へのポインタ。NULL可。
dwCapabilitiesDWORD4+32+24認証機能フラグ(EOAC_系)。

各言語での定義

#include <windows.h>

// COAUTHINFO  (x64 40 / x86 28 バイト)
typedef struct COAUTHINFO {
    DWORD dwAuthnSvc;
    DWORD dwAuthzSvc;
    LPWSTR pwszServerPrincName;
    DWORD dwAuthnLevel;
    DWORD dwImpersonationLevel;
    COAUTHIDENTITY* pAuthIdentityData;
    DWORD dwCapabilities;
} COAUTHINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COAUTHINFO
{
    public uint dwAuthnSvc;
    public uint dwAuthzSvc;
    public IntPtr pwszServerPrincName;
    public uint dwAuthnLevel;
    public uint dwImpersonationLevel;
    public IntPtr pAuthIdentityData;
    public uint dwCapabilities;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COAUTHINFO
    Public dwAuthnSvc As UInteger
    Public dwAuthzSvc As UInteger
    Public pwszServerPrincName As IntPtr
    Public dwAuthnLevel As UInteger
    Public dwImpersonationLevel As UInteger
    Public pAuthIdentityData As IntPtr
    Public dwCapabilities As UInteger
End Structure
import ctypes
from ctypes import wintypes

class COAUTHINFO(ctypes.Structure):
    _fields_ = [
        ("dwAuthnSvc", wintypes.DWORD),
        ("dwAuthzSvc", wintypes.DWORD),
        ("pwszServerPrincName", ctypes.c_void_p),
        ("dwAuthnLevel", wintypes.DWORD),
        ("dwImpersonationLevel", wintypes.DWORD),
        ("pAuthIdentityData", ctypes.c_void_p),
        ("dwCapabilities", wintypes.DWORD),
    ]
#[repr(C)]
pub struct COAUTHINFO {
    pub dwAuthnSvc: u32,
    pub dwAuthzSvc: u32,
    pub pwszServerPrincName: *mut core::ffi::c_void,
    pub dwAuthnLevel: u32,
    pub dwImpersonationLevel: u32,
    pub pAuthIdentityData: *mut core::ffi::c_void,
    pub dwCapabilities: u32,
}
import "golang.org/x/sys/windows"

type COAUTHINFO struct {
	dwAuthnSvc uint32
	dwAuthzSvc uint32
	pwszServerPrincName uintptr
	dwAuthnLevel uint32
	dwImpersonationLevel uint32
	pAuthIdentityData uintptr
	dwCapabilities uint32
}
type
  COAUTHINFO = record
    dwAuthnSvc: DWORD;
    dwAuthzSvc: DWORD;
    pwszServerPrincName: Pointer;
    dwAuthnLevel: DWORD;
    dwImpersonationLevel: DWORD;
    pAuthIdentityData: Pointer;
    dwCapabilities: DWORD;
  end;
const COAUTHINFO = extern struct {
    dwAuthnSvc: u32,
    dwAuthzSvc: u32,
    pwszServerPrincName: ?*anyopaque,
    dwAuthnLevel: u32,
    dwImpersonationLevel: u32,
    pAuthIdentityData: ?*anyopaque,
    dwCapabilities: u32,
};
type
  COAUTHINFO {.bycopy.} = object
    dwAuthnSvc: uint32
    dwAuthzSvc: uint32
    pwszServerPrincName: pointer
    dwAuthnLevel: uint32
    dwImpersonationLevel: uint32
    pAuthIdentityData: pointer
    dwCapabilities: uint32
struct COAUTHINFO
{
    uint dwAuthnSvc;
    uint dwAuthzSvc;
    void* pwszServerPrincName;
    uint dwAuthnLevel;
    uint dwImpersonationLevel;
    void* pAuthIdentityData;
    uint dwCapabilities;
}

HSP用 定義

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

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

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