Win32 API 日本語リファレンス
ホームSecurity.NetworkAccessProtection › NapComponentRegistrationInfo

NapComponentRegistrationInfo

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

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

フィールド

フィールドサイズx64x86説明
idDWORD4+0+0コンポーネントの一意の識別子を格納する NapComponentId 値です。
friendlyNameCountedString16/8+8+4コンポーネントのフレンドリ名 (人間が読める名前) を格納する CountedString 構造体です。
descriptionCountedString16/8+24+12コンポーネントの説明を格納する CountedString 構造体です。
versionCountedString16/8+40+20コンポーネントのバージョンを格納する CountedString 構造体です。
vendorNameCountedString16/8+56+28コンポーネントのベンダー名を格納する CountedString 構造体です。
infoClsidGUID16+72+36

INapComponentInfo インターフェイスを実装する COM オブジェクトの CLSID です。このインターフェイスは、NAP コンポーネントに関するより詳細でローカライズされた情報を取得するために使用されます。

現在のところ、強制クライアントは有効な infoClsid を指定する必要はありません。

configClsidGUID16+88+52

INapComponentConfig インターフェイスを実装する COM オブジェクトの CLSID です。このインターフェイスは、カスタマイズされたユーザーインターフェイスを起動し、SHV の構成設定を取得および設定するために使用されます。

現在のところ、SHA および強制クライアントは有効な configClsid を指定する必要はありません。

registrationDateFILETIME8+104+68登録情報の日付を格納する FILETIME 構造体です。
componentTypeDWORD4+112+76

コンポーネントの種類を定義する値です。

強制クライアントの場合、この値は ComponentTypeEnforcementClientSoH または ComponentTypeEnforcementClientRp のいずれかでなければなりません。

現在のところ、componentType は SHA および SHV では無視されるため、0x00000000 に設定してください。

公式ドキュメント

メモ Network Access Protection プラットフォームは、Windows 10 以降では利用できません
NapComponentRegistrationInfo 構造体は、SHA、SHV、強制クライアントなどの登録済み NAP コンポーネントを定義します。

解説(Remarks)

この登録情報はローカライズされておらず、米国英語でのみ提供されます。

登録用の API を通じて NAP コンポーネントを登録する場合、registrationDate フィールドは無視されます。

登録済みの NAP コンポーネントに関する情報を取得する際、有効な infoClsidconfigClsidregistrationDate が存在しない場合、それらは 0 に設定されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// CountedString  (x64 16 / x86 8 バイト)
typedef struct CountedString {
    WORD length;
    LPWSTR string;
} CountedString;

// FILETIME  (x64 8 / x86 8 バイト)
typedef struct FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;

// NapComponentRegistrationInfo  (x64 120 / x86 80 バイト)
typedef struct NapComponentRegistrationInfo {
    DWORD id;
    CountedString friendlyName;
    CountedString description;
    CountedString version;
    CountedString vendorName;
    GUID infoClsid;
    GUID configClsid;
    FILETIME registrationDate;
    DWORD componentType;
} NapComponentRegistrationInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CountedString
{
    public ushort length;
    public IntPtr string;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
    public uint dwLowDateTime;
    public uint dwHighDateTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NapComponentRegistrationInfo
{
    public uint id;
    public CountedString friendlyName;
    public CountedString description;
    public CountedString version;
    public CountedString vendorName;
    public Guid infoClsid;
    public Guid configClsid;
    public FILETIME registrationDate;
    public uint componentType;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CountedString
    Public length As UShort
    Public string As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
    Public dwLowDateTime As UInteger
    Public dwHighDateTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NapComponentRegistrationInfo
    Public id As UInteger
    Public friendlyName As CountedString
    Public description As CountedString
    Public version As CountedString
    Public vendorName As CountedString
    Public infoClsid As Guid
    Public configClsid As Guid
    Public registrationDate As FILETIME
    Public componentType As UInteger
End Structure
import ctypes
from ctypes import wintypes

class CountedString(ctypes.Structure):
    _fields_ = [
        ("length", ctypes.c_ushort),
        ("string", ctypes.c_void_p),
    ]

class FILETIME(ctypes.Structure):
    _fields_ = [
        ("dwLowDateTime", wintypes.DWORD),
        ("dwHighDateTime", wintypes.DWORD),
    ]

class NapComponentRegistrationInfo(ctypes.Structure):
    _fields_ = [
        ("id", wintypes.DWORD),
        ("friendlyName", CountedString),
        ("description", CountedString),
        ("version", CountedString),
        ("vendorName", CountedString),
        ("infoClsid", GUID),
        ("configClsid", GUID),
        ("registrationDate", FILETIME),
        ("componentType", wintypes.DWORD),
    ]
#[repr(C)]
pub struct CountedString {
    pub length: u16,
    pub string: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct FILETIME {
    pub dwLowDateTime: u32,
    pub dwHighDateTime: u32,
}

#[repr(C)]
pub struct NapComponentRegistrationInfo {
    pub id: u32,
    pub friendlyName: CountedString,
    pub description: CountedString,
    pub version: CountedString,
    pub vendorName: CountedString,
    pub infoClsid: GUID,
    pub configClsid: GUID,
    pub registrationDate: FILETIME,
    pub componentType: u32,
}
import "golang.org/x/sys/windows"

type CountedString struct {
	length uint16
	string uintptr
}

type FILETIME struct {
	dwLowDateTime uint32
	dwHighDateTime uint32
}

type NapComponentRegistrationInfo struct {
	id uint32
	friendlyName CountedString
	description CountedString
	version CountedString
	vendorName CountedString
	infoClsid windows.GUID
	configClsid windows.GUID
	registrationDate FILETIME
	componentType uint32
}
type
  CountedString = record
    length: Word;
    string: Pointer;
  end;

  FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;

  NapComponentRegistrationInfo = record
    id: DWORD;
    friendlyName: CountedString;
    description: CountedString;
    version: CountedString;
    vendorName: CountedString;
    infoClsid: TGUID;
    configClsid: TGUID;
    registrationDate: FILETIME;
    componentType: DWORD;
  end;
const CountedString = extern struct {
    length: u16,
    string: ?*anyopaque,
};

const FILETIME = extern struct {
    dwLowDateTime: u32,
    dwHighDateTime: u32,
};

const NapComponentRegistrationInfo = extern struct {
    id: u32,
    friendlyName: CountedString,
    description: CountedString,
    version: CountedString,
    vendorName: CountedString,
    infoClsid: GUID,
    configClsid: GUID,
    registrationDate: FILETIME,
    componentType: u32,
};
type
  CountedString {.bycopy.} = object
    length: uint16
    string: pointer

  FILETIME {.bycopy.} = object
    dwLowDateTime: uint32
    dwHighDateTime: uint32

  NapComponentRegistrationInfo {.bycopy.} = object
    id: uint32
    friendlyName: CountedString
    description: CountedString
    version: CountedString
    vendorName: CountedString
    infoClsid: GUID
    configClsid: GUID
    registrationDate: FILETIME
    componentType: uint32
struct CountedString
{
    ushort length;
    void* string;
}

struct FILETIME
{
    uint dwLowDateTime;
    uint dwHighDateTime;
}

struct NapComponentRegistrationInfo
{
    uint id;
    CountedString friendlyName;
    CountedString description;
    CountedString version;
    CountedString vendorName;
    GUID infoClsid;
    GUID configClsid;
    FILETIME registrationDate;
    uint componentType;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NapComponentRegistrationInfo サイズ: 80 バイト(x86)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; id : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; friendlyName : CountedString (+4, 8byte)  varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; description : CountedString (+12, 8byte)  varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; version : CountedString (+20, 8byte)  varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; vendorName : CountedString (+28, 8byte)  varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; infoClsid : GUID (+36, 16byte)  varptr(st)+36 を基点に操作(16byte:入れ子/配列)
; configClsid : GUID (+52, 16byte)  varptr(st)+52 を基点に操作(16byte:入れ子/配列)
; registrationDate : FILETIME (+68, 8byte)  varptr(st)+68 を基点に操作(8byte:入れ子/配列)
; componentType : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NapComponentRegistrationInfo サイズ: 120 バイト(x64)
dim st, 30    ; 4byte整数×30(構造体サイズ 120 / 4 切り上げ)
; id : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; friendlyName : CountedString (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; description : CountedString (+24, 16byte)  varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; version : CountedString (+40, 16byte)  varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; vendorName : CountedString (+56, 16byte)  varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; infoClsid : GUID (+72, 16byte)  varptr(st)+72 を基点に操作(16byte:入れ子/配列)
; configClsid : GUID (+88, 16byte)  varptr(st)+88 を基点に操作(16byte:入れ子/配列)
; registrationDate : FILETIME (+104, 8byte)  varptr(st)+104 を基点に操作(8byte:入れ子/配列)
; componentType : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CountedString
    #field short length
    #field intptr string
#endstruct

#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global FILETIME
    #field int dwLowDateTime
    #field int dwHighDateTime
#endstruct

#defstruct global NapComponentRegistrationInfo
    #field int id
    #field CountedString friendlyName
    #field CountedString description
    #field CountedString version
    #field CountedString vendorName
    #field GUID infoClsid
    #field GUID configClsid
    #field FILETIME registrationDate
    #field int componentType
#endstruct

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