ホーム › Storage.FileSystem › ReadLogNotification
ReadLogNotification
関数CLFSログ管理通知を読み取る。
シグネチャ
// clfsw32.dll
#include <windows.h>
BOOL ReadLogNotification(
HANDLE hLog,
CLFS_MGMT_NOTIFICATION* pNotification,
OVERLAPPED* lpOverlapped
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hLog | HANDLE | in | ログのハンドルです。 |
| pNotification | CLFS_MGMT_NOTIFICATION* | inout | 通知の種類を受け取ります。その種類にパラメーターが関連付けられている場合は、それらのパラメーターも受け取ります。 |
| lpOverlapped | OVERLAPPED* | inout | 非同期操作に必要な OVERLAPPED 構造体へのポインターです。非同期操作を使用しない場合、このパラメーターは NULL にできます。 |
戻り値の型: BOOL
公式ドキュメント
ログマネージャーから通知を取得します。通知が利用可能な場合は、キューに格納された通知を即座に取得します。それ以外の場合は、通知が生成されるまで要求は保留状態のままになります。
戻り値
関数が成功した場合、戻り値は 0 以外の値になります。
関数が失敗した場合、戻り値は 0 になります。拡張エラー情報を取得するには、 GetLastError を呼び出します。次のエラーコードが返される可能性があります:
解説(Remarks)
ログハンドルが FILE_FLAG_OVERLAPPED ファイルオプションを指定して作成されていない場合、ReadLogNotification の呼び出しが保留中の間は、そのログハンドルに対して操作を開始できません。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// clfsw32.dll
#include <windows.h>
BOOL ReadLogNotification(
HANDLE hLog,
CLFS_MGMT_NOTIFICATION* pNotification,
OVERLAPPED* lpOverlapped
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool ReadLogNotification(
IntPtr hLog, // HANDLE
IntPtr pNotification, // CLFS_MGMT_NOTIFICATION* in/out
IntPtr lpOverlapped // OVERLAPPED* in/out
);<DllImport("clfsw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function ReadLogNotification(
hLog As IntPtr, ' HANDLE
pNotification As IntPtr, ' CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped As IntPtr ' OVERLAPPED* in/out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hLog : HANDLE
' pNotification : CLFS_MGMT_NOTIFICATION* in/out
' lpOverlapped : OVERLAPPED* in/out
Declare PtrSafe Function ReadLogNotification Lib "clfsw32" ( _
ByVal hLog As LongPtr, _
ByVal pNotification As LongPtr, _
ByVal lpOverlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ReadLogNotification = ctypes.windll.clfsw32.ReadLogNotification
ReadLogNotification.restype = wintypes.BOOL
ReadLogNotification.argtypes = [
wintypes.HANDLE, # hLog : HANDLE
ctypes.c_void_p, # pNotification : CLFS_MGMT_NOTIFICATION* in/out
ctypes.c_void_p, # lpOverlapped : OVERLAPPED* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('clfsw32.dll')
ReadLogNotification = Fiddle::Function.new(
lib['ReadLogNotification'],
[
Fiddle::TYPE_VOIDP, # hLog : HANDLE
Fiddle::TYPE_VOIDP, # pNotification : CLFS_MGMT_NOTIFICATION* in/out
Fiddle::TYPE_VOIDP, # lpOverlapped : OVERLAPPED* in/out
],
Fiddle::TYPE_INT)#[link(name = "clfsw32")]
extern "system" {
fn ReadLogNotification(
hLog: *mut core::ffi::c_void, // HANDLE
pNotification: *mut CLFS_MGMT_NOTIFICATION, // CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped: *mut OVERLAPPED // OVERLAPPED* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true)]
public static extern bool ReadLogNotification(IntPtr hLog, IntPtr pNotification, IntPtr lpOverlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'clfsw32_ReadLogNotification' -Namespace Win32 -PassThru
# $api::ReadLogNotification(hLog, pNotification, lpOverlapped)#uselib "clfsw32.dll"
#func global ReadLogNotification "ReadLogNotification" sptr, sptr, sptr
; ReadLogNotification hLog, varptr(pNotification), varptr(lpOverlapped) ; 戻り値は stat
; hLog : HANDLE -> "sptr"
; pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "sptr"
; lpOverlapped : OVERLAPPED* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "clfsw32.dll" #cfunc global ReadLogNotification "ReadLogNotification" sptr, var, var ; res = ReadLogNotification(hLog, pNotification, lpOverlapped) ; hLog : HANDLE -> "sptr" ; pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "var" ; lpOverlapped : OVERLAPPED* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "clfsw32.dll" #cfunc global ReadLogNotification "ReadLogNotification" sptr, sptr, sptr ; res = ReadLogNotification(hLog, varptr(pNotification), varptr(lpOverlapped)) ; hLog : HANDLE -> "sptr" ; pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "sptr" ; lpOverlapped : OVERLAPPED* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL ReadLogNotification(HANDLE hLog, CLFS_MGMT_NOTIFICATION* pNotification, OVERLAPPED* lpOverlapped) #uselib "clfsw32.dll" #cfunc global ReadLogNotification "ReadLogNotification" intptr, var, var ; res = ReadLogNotification(hLog, pNotification, lpOverlapped) ; hLog : HANDLE -> "intptr" ; pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "var" ; lpOverlapped : OVERLAPPED* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ReadLogNotification(HANDLE hLog, CLFS_MGMT_NOTIFICATION* pNotification, OVERLAPPED* lpOverlapped) #uselib "clfsw32.dll" #cfunc global ReadLogNotification "ReadLogNotification" intptr, intptr, intptr ; res = ReadLogNotification(hLog, varptr(pNotification), varptr(lpOverlapped)) ; hLog : HANDLE -> "intptr" ; pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "intptr" ; lpOverlapped : OVERLAPPED* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clfsw32 = windows.NewLazySystemDLL("clfsw32.dll")
procReadLogNotification = clfsw32.NewProc("ReadLogNotification")
)
// hLog (HANDLE), pNotification (CLFS_MGMT_NOTIFICATION* in/out), lpOverlapped (OVERLAPPED* in/out)
r1, _, err := procReadLogNotification.Call(
uintptr(hLog),
uintptr(pNotification),
uintptr(lpOverlapped),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ReadLogNotification(
hLog: THandle; // HANDLE
pNotification: Pointer; // CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped: Pointer // OVERLAPPED* in/out
): BOOL; stdcall;
external 'clfsw32.dll' name 'ReadLogNotification';result := DllCall("clfsw32\ReadLogNotification"
, "Ptr", hLog ; HANDLE
, "Ptr", pNotification ; CLFS_MGMT_NOTIFICATION* in/out
, "Ptr", lpOverlapped ; OVERLAPPED* in/out
, "Int") ; return: BOOL●ReadLogNotification(hLog, pNotification, lpOverlapped) = DLL("clfsw32.dll", "bool ReadLogNotification(void*, void*, void*)")
# 呼び出し: ReadLogNotification(hLog, pNotification, lpOverlapped)
# hLog : HANDLE -> "void*"
# pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "void*"
# lpOverlapped : OVERLAPPED* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "clfsw32" fn ReadLogNotification(
hLog: ?*anyopaque, // HANDLE
pNotification: [*c]CLFS_MGMT_NOTIFICATION, // CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped: [*c]OVERLAPPED // OVERLAPPED* in/out
) callconv(std.os.windows.WINAPI) i32;proc ReadLogNotification(
hLog: pointer, # HANDLE
pNotification: ptr CLFS_MGMT_NOTIFICATION, # CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped: ptr OVERLAPPED # OVERLAPPED* in/out
): int32 {.importc: "ReadLogNotification", stdcall, dynlib: "clfsw32.dll".}pragma(lib, "clfsw32");
extern(Windows)
int ReadLogNotification(
void* hLog, // HANDLE
CLFS_MGMT_NOTIFICATION* pNotification, // CLFS_MGMT_NOTIFICATION* in/out
OVERLAPPED* lpOverlapped // OVERLAPPED* in/out
);ccall((:ReadLogNotification, "clfsw32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{CLFS_MGMT_NOTIFICATION}, Ptr{OVERLAPPED}),
hLog, pNotification, lpOverlapped)
# hLog : HANDLE -> Ptr{Cvoid}
# pNotification : CLFS_MGMT_NOTIFICATION* in/out -> Ptr{CLFS_MGMT_NOTIFICATION}
# lpOverlapped : OVERLAPPED* in/out -> Ptr{OVERLAPPED}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ReadLogNotification(
void* hLog,
void* pNotification,
void* lpOverlapped);
]]
local clfsw32 = ffi.load("clfsw32")
-- clfsw32.ReadLogNotification(hLog, pNotification, lpOverlapped)
-- hLog : HANDLE
-- pNotification : CLFS_MGMT_NOTIFICATION* in/out
-- lpOverlapped : OVERLAPPED* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('clfsw32.dll');
const ReadLogNotification = lib.func('__stdcall', 'ReadLogNotification', 'int32_t', ['void *', 'void *', 'void *']);
// ReadLogNotification(hLog, pNotification, lpOverlapped)
// hLog : HANDLE -> 'void *'
// pNotification : CLFS_MGMT_NOTIFICATION* in/out -> 'void *'
// lpOverlapped : OVERLAPPED* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("clfsw32.dll", {
ReadLogNotification: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.ReadLogNotification(hLog, pNotification, lpOverlapped)
// hLog : HANDLE -> "pointer"
// pNotification : CLFS_MGMT_NOTIFICATION* in/out -> "pointer"
// lpOverlapped : OVERLAPPED* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ReadLogNotification(
void* hLog,
void* pNotification,
void* lpOverlapped);
C, "clfsw32.dll");
// $ffi->ReadLogNotification(hLog, pNotification, lpOverlapped);
// hLog : HANDLE
// pNotification : CLFS_MGMT_NOTIFICATION* in/out
// lpOverlapped : OVERLAPPED* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Clfsw32 extends StdCallLibrary {
Clfsw32 INSTANCE = Native.load("clfsw32", Clfsw32.class);
boolean ReadLogNotification(
Pointer hLog, // HANDLE
Pointer pNotification, // CLFS_MGMT_NOTIFICATION* in/out
Pointer lpOverlapped // OVERLAPPED* in/out
);
}@[Link("clfsw32")]
lib Libclfsw32
fun ReadLogNotification = ReadLogNotification(
hLog : Void*, # HANDLE
pNotification : CLFS_MGMT_NOTIFICATION*, # CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped : OVERLAPPED* # OVERLAPPED* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ReadLogNotificationNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef ReadLogNotificationDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final ReadLogNotification = DynamicLibrary.open('clfsw32.dll')
.lookupFunction<ReadLogNotificationNative, ReadLogNotificationDart>('ReadLogNotification');
// hLog : HANDLE -> Pointer<Void>
// pNotification : CLFS_MGMT_NOTIFICATION* in/out -> Pointer<Void>
// lpOverlapped : OVERLAPPED* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ReadLogNotification(
hLog: THandle; // HANDLE
pNotification: Pointer; // CLFS_MGMT_NOTIFICATION* in/out
lpOverlapped: Pointer // OVERLAPPED* in/out
): BOOL; stdcall;
external 'clfsw32.dll' name 'ReadLogNotification';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ReadLogNotification"
c_ReadLogNotification :: Ptr () -> Ptr () -> Ptr () -> IO CInt
-- hLog : HANDLE -> Ptr ()
-- pNotification : CLFS_MGMT_NOTIFICATION* in/out -> Ptr ()
-- lpOverlapped : OVERLAPPED* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let readlognotification =
foreign "ReadLogNotification"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hLog : HANDLE -> (ptr void) *)
(* pNotification : CLFS_MGMT_NOTIFICATION* in/out -> (ptr void) *)
(* lpOverlapped : OVERLAPPED* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clfsw32 (t "clfsw32.dll"))
(cffi:use-foreign-library clfsw32)
(cffi:defcfun ("ReadLogNotification" read-log-notification :convention :stdcall) :int32
(h-log :pointer) ; HANDLE
(p-notification :pointer) ; CLFS_MGMT_NOTIFICATION* in/out
(lp-overlapped :pointer)) ; OVERLAPPED* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ReadLogNotification = Win32::API::More->new('clfsw32',
'BOOL ReadLogNotification(HANDLE hLog, LPVOID pNotification, LPVOID lpOverlapped)');
# my $ret = $ReadLogNotification->Call($hLog, $pNotification, $lpOverlapped);
# hLog : HANDLE -> HANDLE
# pNotification : CLFS_MGMT_NOTIFICATION* in/out -> LPVOID
# lpOverlapped : OVERLAPPED* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。