ホーム › System.WindowsProgramming › OpenINFEngineA
OpenINFEngineA
関数INF処理エンジンを開いてハンドルを取得する(ANSI版)。
シグネチャ
// ADVPACK.dll (ANSI / -A)
#include <windows.h>
HRESULT OpenINFEngineA(
LPCSTR pszInfFilename,
LPCSTR pszInstallSection,
DWORD dwFlags,
void** phInf,
void* pvReserved
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszInfFilename | LPCSTR | in |
| pszInstallSection | LPCSTR | in |
| dwFlags | DWORD | in |
| phInf | void** | inout |
| pvReserved | void* | inout |
戻り値の型: HRESULT
各言語での呼び出し定義
// ADVPACK.dll (ANSI / -A)
#include <windows.h>
HRESULT OpenINFEngineA(
LPCSTR pszInfFilename,
LPCSTR pszInstallSection,
DWORD dwFlags,
void** phInf,
void* pvReserved
);[DllImport("ADVPACK.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern int OpenINFEngineA(
[MarshalAs(UnmanagedType.LPStr)] string pszInfFilename, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string pszInstallSection, // LPCSTR
uint dwFlags, // DWORD
IntPtr phInf, // void** in/out
IntPtr pvReserved // void* in/out
);<DllImport("ADVPACK.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function OpenINFEngineA(
<MarshalAs(UnmanagedType.LPStr)> pszInfFilename As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> pszInstallSection As String, ' LPCSTR
dwFlags As UInteger, ' DWORD
phInf As IntPtr, ' void** in/out
pvReserved As IntPtr ' void* in/out
) As Integer
End Function' pszInfFilename : LPCSTR
' pszInstallSection : LPCSTR
' dwFlags : DWORD
' phInf : void** in/out
' pvReserved : void* in/out
Declare PtrSafe Function OpenINFEngineA Lib "advpack" ( _
ByVal pszInfFilename As String, _
ByVal pszInstallSection As String, _
ByVal dwFlags As Long, _
ByVal phInf As LongPtr, _
ByVal pvReserved As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OpenINFEngineA = ctypes.windll.advpack.OpenINFEngineA
OpenINFEngineA.restype = ctypes.c_int
OpenINFEngineA.argtypes = [
wintypes.LPCSTR, # pszInfFilename : LPCSTR
wintypes.LPCSTR, # pszInstallSection : LPCSTR
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_void_p, # phInf : void** in/out
ctypes.POINTER(None), # pvReserved : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVPACK.dll')
OpenINFEngineA = Fiddle::Function.new(
lib['OpenINFEngineA'],
[
Fiddle::TYPE_VOIDP, # pszInfFilename : LPCSTR
Fiddle::TYPE_VOIDP, # pszInstallSection : LPCSTR
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # phInf : void** in/out
Fiddle::TYPE_VOIDP, # pvReserved : void* in/out
],
Fiddle::TYPE_INT)#[link(name = "advpack")]
extern "system" {
fn OpenINFEngineA(
pszInfFilename: *const u8, // LPCSTR
pszInstallSection: *const u8, // LPCSTR
dwFlags: u32, // DWORD
phInf: *mut *mut (), // void** in/out
pvReserved: *mut () // void* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Ansi)]
public static extern int OpenINFEngineA([MarshalAs(UnmanagedType.LPStr)] string pszInfFilename, [MarshalAs(UnmanagedType.LPStr)] string pszInstallSection, uint dwFlags, IntPtr phInf, IntPtr pvReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_OpenINFEngineA' -Namespace Win32 -PassThru
# $api::OpenINFEngineA(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)#uselib "ADVPACK.dll"
#func global OpenINFEngineA "OpenINFEngineA" sptr, sptr, sptr, sptr, sptr
; OpenINFEngineA pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved ; 戻り値は stat
; pszInfFilename : LPCSTR -> "sptr"
; pszInstallSection : LPCSTR -> "sptr"
; dwFlags : DWORD -> "sptr"
; phInf : void** in/out -> "sptr"
; pvReserved : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVPACK.dll"
#cfunc global OpenINFEngineA "OpenINFEngineA" str, str, int, sptr, sptr
; res = OpenINFEngineA(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
; pszInfFilename : LPCSTR -> "str"
; pszInstallSection : LPCSTR -> "str"
; dwFlags : DWORD -> "int"
; phInf : void** in/out -> "sptr"
; pvReserved : void* in/out -> "sptr"; HRESULT OpenINFEngineA(LPCSTR pszInfFilename, LPCSTR pszInstallSection, DWORD dwFlags, void** phInf, void* pvReserved)
#uselib "ADVPACK.dll"
#cfunc global OpenINFEngineA "OpenINFEngineA" str, str, int, intptr, intptr
; res = OpenINFEngineA(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
; pszInfFilename : LPCSTR -> "str"
; pszInstallSection : LPCSTR -> "str"
; dwFlags : DWORD -> "int"
; phInf : void** in/out -> "intptr"
; pvReserved : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advpack = windows.NewLazySystemDLL("ADVPACK.dll")
procOpenINFEngineA = advpack.NewProc("OpenINFEngineA")
)
// pszInfFilename (LPCSTR), pszInstallSection (LPCSTR), dwFlags (DWORD), phInf (void** in/out), pvReserved (void* in/out)
r1, _, err := procOpenINFEngineA.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszInfFilename))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszInstallSection))),
uintptr(dwFlags),
uintptr(phInf),
uintptr(pvReserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction OpenINFEngineA(
pszInfFilename: PAnsiChar; // LPCSTR
pszInstallSection: PAnsiChar; // LPCSTR
dwFlags: DWORD; // DWORD
phInf: Pointer; // void** in/out
pvReserved: Pointer // void* in/out
): Integer; stdcall;
external 'ADVPACK.dll' name 'OpenINFEngineA';result := DllCall("ADVPACK\OpenINFEngineA"
, "AStr", pszInfFilename ; LPCSTR
, "AStr", pszInstallSection ; LPCSTR
, "UInt", dwFlags ; DWORD
, "Ptr", phInf ; void** in/out
, "Ptr", pvReserved ; void* in/out
, "Int") ; return: HRESULT●OpenINFEngineA(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved) = DLL("ADVPACK.dll", "int OpenINFEngineA(char*, char*, dword, void*, void*)")
# 呼び出し: OpenINFEngineA(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
# pszInfFilename : LPCSTR -> "char*"
# pszInstallSection : LPCSTR -> "char*"
# dwFlags : DWORD -> "dword"
# phInf : void** in/out -> "void*"
# pvReserved : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。