Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › OpenINFEngineW

OpenINFEngineW

関数
INF処理エンジンを開いてハンドルを取得する(Unicode版)。
DLLADVPACK.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT OpenINFEngineW(
    LPCWSTR pszInfFilename,
    LPCWSTR pszInstallSection,
    DWORD dwFlags,
    void** phInf,
    void* pvReserved
);

パラメーター

名前方向
pszInfFilenameLPCWSTRin
pszInstallSectionLPCWSTRin
dwFlagsDWORDin
phInfvoid**inout
pvReservedvoid*inout

戻り値の型: HRESULT

各言語での呼び出し定義

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT OpenINFEngineW(
    LPCWSTR pszInfFilename,
    LPCWSTR pszInstallSection,
    DWORD dwFlags,
    void** phInf,
    void* pvReserved
);
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int OpenINFEngineW(
    [MarshalAs(UnmanagedType.LPWStr)] string pszInfFilename,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pszInstallSection,   // LPCWSTR
    uint dwFlags,   // DWORD
    IntPtr phInf,   // void** in/out
    IntPtr pvReserved   // void* in/out
);
<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function OpenINFEngineW(
    <MarshalAs(UnmanagedType.LPWStr)> pszInfFilename As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pszInstallSection As String,   ' LPCWSTR
    dwFlags As UInteger,   ' DWORD
    phInf As IntPtr,   ' void** in/out
    pvReserved As IntPtr   ' void* in/out
) As Integer
End Function
' pszInfFilename : LPCWSTR
' pszInstallSection : LPCWSTR
' dwFlags : DWORD
' phInf : void** in/out
' pvReserved : void* in/out
Declare PtrSafe Function OpenINFEngineW Lib "advpack" ( _
    ByVal pszInfFilename As LongPtr, _
    ByVal pszInstallSection As LongPtr, _
    ByVal dwFlags As Long, _
    ByVal phInf As LongPtr, _
    ByVal pvReserved As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

OpenINFEngineW = ctypes.windll.advpack.OpenINFEngineW
OpenINFEngineW.restype = ctypes.c_int
OpenINFEngineW.argtypes = [
    wintypes.LPCWSTR,  # pszInfFilename : LPCWSTR
    wintypes.LPCWSTR,  # pszInstallSection : LPCWSTR
    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')
OpenINFEngineW = Fiddle::Function.new(
  lib['OpenINFEngineW'],
  [
    Fiddle::TYPE_VOIDP,  # pszInfFilename : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pszInstallSection : LPCWSTR
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # phInf : void** in/out
    Fiddle::TYPE_VOIDP,  # pvReserved : void* in/out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "advpack")]
extern "system" {
    fn OpenINFEngineW(
        pszInfFilename: *const u16,  // LPCWSTR
        pszInstallSection: *const u16,  // LPCWSTR
        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.Unicode)]
public static extern int OpenINFEngineW([MarshalAs(UnmanagedType.LPWStr)] string pszInfFilename, [MarshalAs(UnmanagedType.LPWStr)] string pszInstallSection, uint dwFlags, IntPtr phInf, IntPtr pvReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_OpenINFEngineW' -Namespace Win32 -PassThru
# $api::OpenINFEngineW(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
#uselib "ADVPACK.dll"
#func global OpenINFEngineW "OpenINFEngineW" wptr, wptr, wptr, wptr, wptr
; OpenINFEngineW pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved   ; 戻り値は stat
; pszInfFilename : LPCWSTR -> "wptr"
; pszInstallSection : LPCWSTR -> "wptr"
; dwFlags : DWORD -> "wptr"
; phInf : void** in/out -> "wptr"
; pvReserved : void* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVPACK.dll"
#cfunc global OpenINFEngineW "OpenINFEngineW" wstr, wstr, int, sptr, sptr
; res = OpenINFEngineW(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
; pszInfFilename : LPCWSTR -> "wstr"
; pszInstallSection : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
; phInf : void** in/out -> "sptr"
; pvReserved : void* in/out -> "sptr"
; HRESULT OpenINFEngineW(LPCWSTR pszInfFilename, LPCWSTR pszInstallSection, DWORD dwFlags, void** phInf, void* pvReserved)
#uselib "ADVPACK.dll"
#cfunc global OpenINFEngineW "OpenINFEngineW" wstr, wstr, int, intptr, intptr
; res = OpenINFEngineW(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
; pszInfFilename : LPCWSTR -> "wstr"
; pszInstallSection : LPCWSTR -> "wstr"
; 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")
	procOpenINFEngineW = advpack.NewProc("OpenINFEngineW")
)

// pszInfFilename (LPCWSTR), pszInstallSection (LPCWSTR), dwFlags (DWORD), phInf (void** in/out), pvReserved (void* in/out)
r1, _, err := procOpenINFEngineW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszInfFilename))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszInstallSection))),
	uintptr(dwFlags),
	uintptr(phInf),
	uintptr(pvReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function OpenINFEngineW(
  pszInfFilename: PWideChar;   // LPCWSTR
  pszInstallSection: PWideChar;   // LPCWSTR
  dwFlags: DWORD;   // DWORD
  phInf: Pointer;   // void** in/out
  pvReserved: Pointer   // void* in/out
): Integer; stdcall;
  external 'ADVPACK.dll' name 'OpenINFEngineW';
result := DllCall("ADVPACK\OpenINFEngineW"
    , "WStr", pszInfFilename   ; LPCWSTR
    , "WStr", pszInstallSection   ; LPCWSTR
    , "UInt", dwFlags   ; DWORD
    , "Ptr", phInf   ; void** in/out
    , "Ptr", pvReserved   ; void* in/out
    , "Int")   ; return: HRESULT
●OpenINFEngineW(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved) = DLL("ADVPACK.dll", "int OpenINFEngineW(char*, char*, dword, void*, void*)")
# 呼び出し: OpenINFEngineW(pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved)
# pszInfFilename : LPCWSTR -> "char*"
# pszInstallSection : LPCWSTR -> "char*"
# dwFlags : DWORD -> "dword"
# phInf : void** in/out -> "void*"
# pvReserved : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。