ホーム › System.Com › COAUTHIDENTITY
COAUTHIDENTITY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| User | WORD* | 8/4 | +0 | +0 | ユーザー名を格納する文字配列へのポインタ。 |
| UserLength | DWORD | 4 | +8 | +4 | Userの文字数(終端を除く)。 |
| Domain | WORD* | 8/4 | +16 | +8 | ドメイン名を格納する文字配列へのポインタ。 |
| DomainLength | DWORD | 4 | +24 | +12 | Domainの文字数。 |
| Password | WORD* | 8/4 | +32 | +16 | パスワードを格納する文字配列へのポインタ。 |
| PasswordLength | DWORD | 4 | +40 | +20 | Passwordの文字数。 |
| Flags | DWORD | 4 | +44 | +24 | 文字列がANSIかUnicodeかを示すフラグ(SEC_WINNT_AUTH_IDENTITY_系)。 |
各言語での定義
#include <windows.h>
// COAUTHIDENTITY (x64 48 / x86 28 バイト)
typedef struct COAUTHIDENTITY {
WORD* User;
DWORD UserLength;
WORD* Domain;
DWORD DomainLength;
WORD* Password;
DWORD PasswordLength;
DWORD Flags;
} COAUTHIDENTITY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COAUTHIDENTITY
{
public IntPtr User;
public uint UserLength;
public IntPtr Domain;
public uint DomainLength;
public IntPtr Password;
public uint PasswordLength;
public uint Flags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COAUTHIDENTITY
Public User As IntPtr
Public UserLength As UInteger
Public Domain As IntPtr
Public DomainLength As UInteger
Public Password As IntPtr
Public PasswordLength As UInteger
Public Flags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class COAUTHIDENTITY(ctypes.Structure):
_fields_ = [
("User", ctypes.c_void_p),
("UserLength", wintypes.DWORD),
("Domain", ctypes.c_void_p),
("DomainLength", wintypes.DWORD),
("Password", ctypes.c_void_p),
("PasswordLength", wintypes.DWORD),
("Flags", wintypes.DWORD),
]#[repr(C)]
pub struct COAUTHIDENTITY {
pub User: *mut core::ffi::c_void,
pub UserLength: u32,
pub Domain: *mut core::ffi::c_void,
pub DomainLength: u32,
pub Password: *mut core::ffi::c_void,
pub PasswordLength: u32,
pub Flags: u32,
}import "golang.org/x/sys/windows"
type COAUTHIDENTITY struct {
User uintptr
UserLength uint32
Domain uintptr
DomainLength uint32
Password uintptr
PasswordLength uint32
Flags uint32
}type
COAUTHIDENTITY = record
User: Pointer;
UserLength: DWORD;
Domain: Pointer;
DomainLength: DWORD;
Password: Pointer;
PasswordLength: DWORD;
Flags: DWORD;
end;const COAUTHIDENTITY = extern struct {
User: ?*anyopaque,
UserLength: u32,
Domain: ?*anyopaque,
DomainLength: u32,
Password: ?*anyopaque,
PasswordLength: u32,
Flags: u32,
};type
COAUTHIDENTITY {.bycopy.} = object
User: pointer
UserLength: uint32
Domain: pointer
DomainLength: uint32
Password: pointer
PasswordLength: uint32
Flags: uint32struct COAUTHIDENTITY
{
void* User;
uint UserLength;
void* Domain;
uint DomainLength;
void* Password;
uint PasswordLength;
uint Flags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; COAUTHIDENTITY サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; User : WORD* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; UserLength : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Domain : WORD* (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; DomainLength : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Password : WORD* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; PasswordLength : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; Flags : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COAUTHIDENTITY サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; User : WORD* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; UserLength : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Domain : WORD* (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; DomainLength : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Password : WORD* (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; PasswordLength : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; Flags : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global COAUTHIDENTITY
#field intptr User
#field int UserLength
#field intptr Domain
#field int DomainLength
#field intptr Password
#field int PasswordLength
#field int Flags
#endstruct
stdim st, COAUTHIDENTITY ; NSTRUCT 変数を確保
st->UserLength = 100
mes "UserLength=" + st->UserLength