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

DOMAIN_PASSWORD_INFORMATION

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

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

フィールド

フィールドサイズx64x86説明
MinPasswordLengthWORD2+0+0パスワードの最小文字数。
PasswordHistoryLengthWORD2+2+2再使用を禁止するパスワード履歴の保持数。
PasswordPropertiesDOMAIN_PASSWORD_PROPERTIES4+4+4パスワードの複雑性等を制御するプロパティフラグ。
MaxPasswordAgeLONGLONG8+8+8パスワードの最大有効期間(100ナノ秒単位、負値)。
MinPasswordAgeLONGLONG8+16+16パスワードの最小有効期間(100ナノ秒単位、負値)。

各言語での定義

#include <windows.h>

// DOMAIN_PASSWORD_INFORMATION  (x64 24 / x86 24 バイト)
typedef struct DOMAIN_PASSWORD_INFORMATION {
    WORD MinPasswordLength;
    WORD PasswordHistoryLength;
    DOMAIN_PASSWORD_PROPERTIES PasswordProperties;
    LONGLONG MaxPasswordAge;
    LONGLONG MinPasswordAge;
} DOMAIN_PASSWORD_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOMAIN_PASSWORD_INFORMATION
{
    public ushort MinPasswordLength;
    public ushort PasswordHistoryLength;
    public uint PasswordProperties;
    public long MaxPasswordAge;
    public long MinPasswordAge;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOMAIN_PASSWORD_INFORMATION
    Public MinPasswordLength As UShort
    Public PasswordHistoryLength As UShort
    Public PasswordProperties As UInteger
    Public MaxPasswordAge As Long
    Public MinPasswordAge As Long
End Structure
import ctypes
from ctypes import wintypes

class DOMAIN_PASSWORD_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("MinPasswordLength", ctypes.c_ushort),
        ("PasswordHistoryLength", ctypes.c_ushort),
        ("PasswordProperties", wintypes.DWORD),
        ("MaxPasswordAge", ctypes.c_longlong),
        ("MinPasswordAge", ctypes.c_longlong),
    ]
#[repr(C)]
pub struct DOMAIN_PASSWORD_INFORMATION {
    pub MinPasswordLength: u16,
    pub PasswordHistoryLength: u16,
    pub PasswordProperties: u32,
    pub MaxPasswordAge: i64,
    pub MinPasswordAge: i64,
}
import "golang.org/x/sys/windows"

type DOMAIN_PASSWORD_INFORMATION struct {
	MinPasswordLength uint16
	PasswordHistoryLength uint16
	PasswordProperties uint32
	MaxPasswordAge int64
	MinPasswordAge int64
}
type
  DOMAIN_PASSWORD_INFORMATION = record
    MinPasswordLength: Word;
    PasswordHistoryLength: Word;
    PasswordProperties: DWORD;
    MaxPasswordAge: Int64;
    MinPasswordAge: Int64;
  end;
const DOMAIN_PASSWORD_INFORMATION = extern struct {
    MinPasswordLength: u16,
    PasswordHistoryLength: u16,
    PasswordProperties: u32,
    MaxPasswordAge: i64,
    MinPasswordAge: i64,
};
type
  DOMAIN_PASSWORD_INFORMATION {.bycopy.} = object
    MinPasswordLength: uint16
    PasswordHistoryLength: uint16
    PasswordProperties: uint32
    MaxPasswordAge: int64
    MinPasswordAge: int64
struct DOMAIN_PASSWORD_INFORMATION
{
    ushort MinPasswordLength;
    ushort PasswordHistoryLength;
    uint PasswordProperties;
    long MaxPasswordAge;
    long MinPasswordAge;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOMAIN_PASSWORD_INFORMATION サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; MinPasswordLength : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; PasswordHistoryLength : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; PasswordProperties : DOMAIN_PASSWORD_PROPERTIES (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; MaxPasswordAge : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; MinPasswordAge : LONGLONG (+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 DOMAIN_PASSWORD_INFORMATION
    #field short MinPasswordLength
    #field short PasswordHistoryLength
    #field int PasswordProperties
    #field int64 MaxPasswordAge
    #field int64 MinPasswordAge
#endstruct

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