Win32 API 日本語リファレンス
ホームStorage.FileSystem › GetNotificationResourceManagerAsync

GetNotificationResourceManagerAsync

関数
KTMリソースマネージャーから通知を非同期で取得する。
DLLktmw32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// ktmw32.dll
#include <windows.h>

BOOL GetNotificationResourceManagerAsync(
    HANDLE ResourceManagerHandle,
    TRANSACTION_NOTIFICATION* TransactionNotification,
    DWORD TransactionNotificationLength,
    DWORD* ReturnLength,
    OVERLAPPED* lpOverlapped
);

パラメーター

名前方向
ResourceManagerHandleHANDLEin
TransactionNotificationTRANSACTION_NOTIFICATION*inout
TransactionNotificationLengthDWORDin
ReturnLengthDWORD*inout
lpOverlappedOVERLAPPED*inout

戻り値の型: BOOL

各言語での呼び出し定義

// ktmw32.dll
#include <windows.h>

BOOL GetNotificationResourceManagerAsync(
    HANDLE ResourceManagerHandle,
    TRANSACTION_NOTIFICATION* TransactionNotification,
    DWORD TransactionNotificationLength,
    DWORD* ReturnLength,
    OVERLAPPED* lpOverlapped
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ktmw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetNotificationResourceManagerAsync(
    IntPtr ResourceManagerHandle,   // HANDLE
    IntPtr TransactionNotification,   // TRANSACTION_NOTIFICATION* in/out
    uint TransactionNotificationLength,   // DWORD
    ref uint ReturnLength,   // DWORD* in/out
    IntPtr lpOverlapped   // OVERLAPPED* in/out
);
<DllImport("ktmw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetNotificationResourceManagerAsync(
    ResourceManagerHandle As IntPtr,   ' HANDLE
    TransactionNotification As IntPtr,   ' TRANSACTION_NOTIFICATION* in/out
    TransactionNotificationLength As UInteger,   ' DWORD
    ByRef ReturnLength As UInteger,   ' DWORD* in/out
    lpOverlapped As IntPtr   ' OVERLAPPED* in/out
) As Boolean
End Function
' ResourceManagerHandle : HANDLE
' TransactionNotification : TRANSACTION_NOTIFICATION* in/out
' TransactionNotificationLength : DWORD
' ReturnLength : DWORD* in/out
' lpOverlapped : OVERLAPPED* in/out
Declare PtrSafe Function GetNotificationResourceManagerAsync Lib "ktmw32" ( _
    ByVal ResourceManagerHandle As LongPtr, _
    ByVal TransactionNotification As LongPtr, _
    ByVal TransactionNotificationLength As Long, _
    ByRef ReturnLength As Long, _
    ByVal lpOverlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetNotificationResourceManagerAsync = ctypes.windll.ktmw32.GetNotificationResourceManagerAsync
GetNotificationResourceManagerAsync.restype = wintypes.BOOL
GetNotificationResourceManagerAsync.argtypes = [
    wintypes.HANDLE,  # ResourceManagerHandle : HANDLE
    ctypes.c_void_p,  # TransactionNotification : TRANSACTION_NOTIFICATION* in/out
    wintypes.DWORD,  # TransactionNotificationLength : DWORD
    ctypes.POINTER(wintypes.DWORD),  # ReturnLength : DWORD* 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('ktmw32.dll')
GetNotificationResourceManagerAsync = Fiddle::Function.new(
  lib['GetNotificationResourceManagerAsync'],
  [
    Fiddle::TYPE_VOIDP,  # ResourceManagerHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # TransactionNotification : TRANSACTION_NOTIFICATION* in/out
    -Fiddle::TYPE_INT,  # TransactionNotificationLength : DWORD
    Fiddle::TYPE_VOIDP,  # ReturnLength : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # lpOverlapped : OVERLAPPED* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ktmw32")]
extern "system" {
    fn GetNotificationResourceManagerAsync(
        ResourceManagerHandle: *mut core::ffi::c_void,  // HANDLE
        TransactionNotification: *mut TRANSACTION_NOTIFICATION,  // TRANSACTION_NOTIFICATION* in/out
        TransactionNotificationLength: u32,  // DWORD
        ReturnLength: *mut u32,  // DWORD* 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("ktmw32.dll", SetLastError = true)]
public static extern bool GetNotificationResourceManagerAsync(IntPtr ResourceManagerHandle, IntPtr TransactionNotification, uint TransactionNotificationLength, ref uint ReturnLength, IntPtr lpOverlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ktmw32_GetNotificationResourceManagerAsync' -Namespace Win32 -PassThru
# $api::GetNotificationResourceManagerAsync(ResourceManagerHandle, TransactionNotification, TransactionNotificationLength, ReturnLength, lpOverlapped)
#uselib "ktmw32.dll"
#func global GetNotificationResourceManagerAsync "GetNotificationResourceManagerAsync" sptr, sptr, sptr, sptr, sptr
; GetNotificationResourceManagerAsync ResourceManagerHandle, varptr(TransactionNotification), TransactionNotificationLength, varptr(ReturnLength), varptr(lpOverlapped)   ; 戻り値は stat
; ResourceManagerHandle : HANDLE -> "sptr"
; TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "sptr"
; TransactionNotificationLength : DWORD -> "sptr"
; ReturnLength : DWORD* in/out -> "sptr"
; lpOverlapped : OVERLAPPED* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ktmw32.dll"
#cfunc global GetNotificationResourceManagerAsync "GetNotificationResourceManagerAsync" sptr, var, int, var, var
; res = GetNotificationResourceManagerAsync(ResourceManagerHandle, TransactionNotification, TransactionNotificationLength, ReturnLength, lpOverlapped)
; ResourceManagerHandle : HANDLE -> "sptr"
; TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "var"
; TransactionNotificationLength : DWORD -> "int"
; ReturnLength : DWORD* in/out -> "var"
; lpOverlapped : OVERLAPPED* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetNotificationResourceManagerAsync(HANDLE ResourceManagerHandle, TRANSACTION_NOTIFICATION* TransactionNotification, DWORD TransactionNotificationLength, DWORD* ReturnLength, OVERLAPPED* lpOverlapped)
#uselib "ktmw32.dll"
#cfunc global GetNotificationResourceManagerAsync "GetNotificationResourceManagerAsync" intptr, var, int, var, var
; res = GetNotificationResourceManagerAsync(ResourceManagerHandle, TransactionNotification, TransactionNotificationLength, ReturnLength, lpOverlapped)
; ResourceManagerHandle : HANDLE -> "intptr"
; TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "var"
; TransactionNotificationLength : DWORD -> "int"
; ReturnLength : DWORD* in/out -> "var"
; lpOverlapped : OVERLAPPED* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ktmw32 = windows.NewLazySystemDLL("ktmw32.dll")
	procGetNotificationResourceManagerAsync = ktmw32.NewProc("GetNotificationResourceManagerAsync")
)

// ResourceManagerHandle (HANDLE), TransactionNotification (TRANSACTION_NOTIFICATION* in/out), TransactionNotificationLength (DWORD), ReturnLength (DWORD* in/out), lpOverlapped (OVERLAPPED* in/out)
r1, _, err := procGetNotificationResourceManagerAsync.Call(
	uintptr(ResourceManagerHandle),
	uintptr(TransactionNotification),
	uintptr(TransactionNotificationLength),
	uintptr(ReturnLength),
	uintptr(lpOverlapped),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetNotificationResourceManagerAsync(
  ResourceManagerHandle: THandle;   // HANDLE
  TransactionNotification: Pointer;   // TRANSACTION_NOTIFICATION* in/out
  TransactionNotificationLength: DWORD;   // DWORD
  ReturnLength: Pointer;   // DWORD* in/out
  lpOverlapped: Pointer   // OVERLAPPED* in/out
): BOOL; stdcall;
  external 'ktmw32.dll' name 'GetNotificationResourceManagerAsync';
result := DllCall("ktmw32\GetNotificationResourceManagerAsync"
    , "Ptr", ResourceManagerHandle   ; HANDLE
    , "Ptr", TransactionNotification   ; TRANSACTION_NOTIFICATION* in/out
    , "UInt", TransactionNotificationLength   ; DWORD
    , "Ptr", ReturnLength   ; DWORD* in/out
    , "Ptr", lpOverlapped   ; OVERLAPPED* in/out
    , "Int")   ; return: BOOL
●GetNotificationResourceManagerAsync(ResourceManagerHandle, TransactionNotification, TransactionNotificationLength, ReturnLength, lpOverlapped) = DLL("ktmw32.dll", "bool GetNotificationResourceManagerAsync(void*, void*, dword, void*, void*)")
# 呼び出し: GetNotificationResourceManagerAsync(ResourceManagerHandle, TransactionNotification, TransactionNotificationLength, ReturnLength, lpOverlapped)
# ResourceManagerHandle : HANDLE -> "void*"
# TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "void*"
# TransactionNotificationLength : DWORD -> "dword"
# ReturnLength : DWORD* in/out -> "void*"
# lpOverlapped : OVERLAPPED* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。