ホーム › System.EventLog › OpenBackupEventLogW
OpenBackupEventLogW
関数バックアップ済みイベントログを開く(Unicode版)。
シグネチャ
// ADVAPI32.dll (Unicode / -W)
#include <windows.h>
HANDLE OpenBackupEventLogW(
LPCWSTR lpUNCServerName, // optional
LPCWSTR lpFileName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpUNCServerName | LPCWSTR | inoptional |
| lpFileName | LPCWSTR | in |
戻り値の型: HANDLE
各言語での呼び出し定義
// ADVAPI32.dll (Unicode / -W)
#include <windows.h>
HANDLE OpenBackupEventLogW(
LPCWSTR lpUNCServerName, // optional
LPCWSTR lpFileName
);[DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern IntPtr OpenBackupEventLogW(
[MarshalAs(UnmanagedType.LPWStr)] string lpUNCServerName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string lpFileName // LPCWSTR
);<DllImport("ADVAPI32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function OpenBackupEventLogW(
<MarshalAs(UnmanagedType.LPWStr)> lpUNCServerName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> lpFileName As String ' LPCWSTR
) As IntPtr
End Function' lpUNCServerName : LPCWSTR optional
' lpFileName : LPCWSTR
Declare PtrSafe Function OpenBackupEventLogW Lib "advapi32" ( _
ByVal lpUNCServerName As LongPtr, _
ByVal lpFileName As LongPtr) As LongPtr
' 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
OpenBackupEventLogW = ctypes.windll.advapi32.OpenBackupEventLogW
OpenBackupEventLogW.restype = ctypes.c_void_p
OpenBackupEventLogW.argtypes = [
wintypes.LPCWSTR, # lpUNCServerName : LPCWSTR optional
wintypes.LPCWSTR, # lpFileName : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
OpenBackupEventLogW = Fiddle::Function.new(
lib['OpenBackupEventLogW'],
[
Fiddle::TYPE_VOIDP, # lpUNCServerName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # lpFileName : LPCWSTR
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "advapi32")]
extern "system" {
fn OpenBackupEventLogW(
lpUNCServerName: *const u16, // LPCWSTR optional
lpFileName: *const u16 // LPCWSTR
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVAPI32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr OpenBackupEventLogW([MarshalAs(UnmanagedType.LPWStr)] string lpUNCServerName, [MarshalAs(UnmanagedType.LPWStr)] string lpFileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_OpenBackupEventLogW' -Namespace Win32 -PassThru
# $api::OpenBackupEventLogW(lpUNCServerName, lpFileName)#uselib "ADVAPI32.dll"
#func global OpenBackupEventLogW "OpenBackupEventLogW" wptr, wptr
; OpenBackupEventLogW lpUNCServerName, lpFileName ; 戻り値は stat
; lpUNCServerName : LPCWSTR optional -> "wptr"
; lpFileName : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVAPI32.dll"
#cfunc global OpenBackupEventLogW "OpenBackupEventLogW" wstr, wstr
; res = OpenBackupEventLogW(lpUNCServerName, lpFileName)
; lpUNCServerName : LPCWSTR optional -> "wstr"
; lpFileName : LPCWSTR -> "wstr"; HANDLE OpenBackupEventLogW(LPCWSTR lpUNCServerName, LPCWSTR lpFileName)
#uselib "ADVAPI32.dll"
#cfunc global OpenBackupEventLogW "OpenBackupEventLogW" wstr, wstr
; res = OpenBackupEventLogW(lpUNCServerName, lpFileName)
; lpUNCServerName : LPCWSTR optional -> "wstr"
; lpFileName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procOpenBackupEventLogW = advapi32.NewProc("OpenBackupEventLogW")
)
// lpUNCServerName (LPCWSTR optional), lpFileName (LPCWSTR)
r1, _, err := procOpenBackupEventLogW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpUNCServerName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpFileName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction OpenBackupEventLogW(
lpUNCServerName: PWideChar; // LPCWSTR optional
lpFileName: PWideChar // LPCWSTR
): THandle; stdcall;
external 'ADVAPI32.dll' name 'OpenBackupEventLogW';result := DllCall("ADVAPI32\OpenBackupEventLogW"
, "WStr", lpUNCServerName ; LPCWSTR optional
, "WStr", lpFileName ; LPCWSTR
, "Ptr") ; return: HANDLE●OpenBackupEventLogW(lpUNCServerName, lpFileName) = DLL("ADVAPI32.dll", "void* OpenBackupEventLogW(char*, char*)")
# 呼び出し: OpenBackupEventLogW(lpUNCServerName, lpFileName)
# lpUNCServerName : LPCWSTR optional -> "char*"
# lpFileName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。