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

NapComponentRegistrationInfo

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

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

フィールド

フィールドサイズx64x86説明
idDWORD4+0+0NAPコンポーネントの登録IDを表す。
friendlyNameCountedString16/8+8+4コンポーネントの表示用フレンドリ名。
descriptionCountedString16/8+24+12コンポーネントの説明文字列。
versionCountedString16/8+40+20コンポーネントのバージョン文字列。
vendorNameCountedString16/8+56+28コンポーネントのベンダー名文字列。
infoClsidGUID16+72+36情報用COMオブジェクトのCLSID。
configClsidGUID16+88+52構成用COMオブジェクトのCLSID。
registrationDateFILETIME8+104+68コンポーネントが登録された日時をFILETIME形式で表す。
componentTypeDWORD4+112+76コンポーネントの種別(SHA/SHVなど)を表す。

各言語での定義

#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