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