ホーム › Devices.DeviceAndDriverInstallation › INFCONTEXT
INFCONTEXT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Inf | void* | 8/4 | +0 | +0 | INFファイル全体を表す内部ハンドルへのポインタ。SetupAPIが管理する。 |
| CurrentInf | void* | 8/4 | +8 | +4 | 現在対象としているINF(付加INFを含む)への内部ポインタ。 |
| Section | DWORD | 4 | +16 | +8 | INF内のセクションを示す内部インデックス値。 |
| Line | DWORD | 4 | +20 | +12 | セクション内の行を示す内部インデックス値。 |
各言語での定義
#include <windows.h>
// INFCONTEXT (x64 24 / x86 16 バイト)
#pragma pack(push, 1)
typedef struct INFCONTEXT {
void* Inf;
void* CurrentInf;
DWORD Section;
DWORD Line;
} INFCONTEXT;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct INFCONTEXT
{
public IntPtr Inf;
public IntPtr CurrentInf;
public uint Section;
public uint Line;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure INFCONTEXT
Public Inf As IntPtr
Public CurrentInf As IntPtr
Public Section As UInteger
Public Line As UInteger
End Structureimport ctypes
from ctypes import wintypes
class INFCONTEXT(ctypes.Structure):
_pack_ = 1
_fields_ = [
("Inf", ctypes.c_void_p),
("CurrentInf", ctypes.c_void_p),
("Section", wintypes.DWORD),
("Line", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct INFCONTEXT {
pub Inf: *mut core::ffi::c_void,
pub CurrentInf: *mut core::ffi::c_void,
pub Section: u32,
pub Line: u32,
}import "golang.org/x/sys/windows"
type INFCONTEXT struct {
Inf uintptr
CurrentInf uintptr
Section uint32
Line uint32
}type
INFCONTEXT = packed record
Inf: Pointer;
CurrentInf: Pointer;
Section: DWORD;
Line: DWORD;
end;const INFCONTEXT = extern struct {
Inf: ?*anyopaque,
CurrentInf: ?*anyopaque,
Section: u32,
Line: u32,
};type
INFCONTEXT {.packed.} = object
Inf: pointer
CurrentInf: pointer
Section: uint32
Line: uint32align(1)
struct INFCONTEXT
{
void* Inf;
void* CurrentInf;
uint Section;
uint Line;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; INFCONTEXT サイズ: 16 バイト(x86)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Inf : void* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; CurrentInf : void* (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Section : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Line : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; INFCONTEXT サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Inf : void* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; CurrentInf : void* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Section : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Line : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global INFCONTEXT, pack=1
#field intptr Inf
#field intptr CurrentInf
#field int Section
#field int Line
#endstruct
stdim st, INFCONTEXT ; NSTRUCT 変数を確保
st->Section = 100
mes "Section=" + st->Section