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