Win32 API 日本語リファレンス
ホームNetworkManagement.Rras › RtmBlockMethods

RtmBlockMethods

関数
指定対象に対するメソッド呼び出しをブロックまたは解除する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmBlockMethods(
    INT_PTR RtmRegHandle,
    HANDLE TargetHandle,
    BYTE TargetType,
    DWORD BlockingFlag
);

パラメーター

名前方向
RtmRegHandleINT_PTRin
TargetHandleHANDLEin
TargetTypeBYTEin
BlockingFlagDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RtmBlockMethods(
    INT_PTR RtmRegHandle,
    HANDLE TargetHandle,
    BYTE TargetType,
    DWORD BlockingFlag
);
[DllImport("rtm.dll", ExactSpelling = true)]
static extern uint RtmBlockMethods(
    IntPtr RtmRegHandle,   // INT_PTR
    IntPtr TargetHandle,   // HANDLE
    byte TargetType,   // BYTE
    uint BlockingFlag   // DWORD
);
<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function RtmBlockMethods(
    RtmRegHandle As IntPtr,   ' INT_PTR
    TargetHandle As IntPtr,   ' HANDLE
    TargetType As Byte,   ' BYTE
    BlockingFlag As UInteger   ' DWORD
) As UInteger
End Function
' RtmRegHandle : INT_PTR
' TargetHandle : HANDLE
' TargetType : BYTE
' BlockingFlag : DWORD
Declare PtrSafe Function RtmBlockMethods Lib "rtm" ( _
    ByVal RtmRegHandle As LongPtr, _
    ByVal TargetHandle As LongPtr, _
    ByVal TargetType As Byte, _
    ByVal BlockingFlag As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RtmBlockMethods = ctypes.windll.rtm.RtmBlockMethods
RtmBlockMethods.restype = wintypes.DWORD
RtmBlockMethods.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    wintypes.HANDLE,  # TargetHandle : HANDLE
    ctypes.c_ubyte,  # TargetType : BYTE
    wintypes.DWORD,  # BlockingFlag : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('rtm.dll')
RtmBlockMethods = Fiddle::Function.new(
  lib['RtmBlockMethods'],
  [
    Fiddle::TYPE_INTPTR_T,  # RtmRegHandle : INT_PTR
    Fiddle::TYPE_VOIDP,  # TargetHandle : HANDLE
    -Fiddle::TYPE_CHAR,  # TargetType : BYTE
    -Fiddle::TYPE_INT,  # BlockingFlag : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "rtm")]
extern "system" {
    fn RtmBlockMethods(
        RtmRegHandle: isize,  // INT_PTR
        TargetHandle: *mut core::ffi::c_void,  // HANDLE
        TargetType: u8,  // BYTE
        BlockingFlag: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("rtm.dll")]
public static extern uint RtmBlockMethods(IntPtr RtmRegHandle, IntPtr TargetHandle, byte TargetType, uint BlockingFlag);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtm_RtmBlockMethods' -Namespace Win32 -PassThru
# $api::RtmBlockMethods(RtmRegHandle, TargetHandle, TargetType, BlockingFlag)
#uselib "rtm.dll"
#func global RtmBlockMethods "RtmBlockMethods" sptr, sptr, sptr, sptr
; RtmBlockMethods RtmRegHandle, TargetHandle, TargetType, BlockingFlag   ; 戻り値は stat
; RtmRegHandle : INT_PTR -> "sptr"
; TargetHandle : HANDLE -> "sptr"
; TargetType : BYTE -> "sptr"
; BlockingFlag : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "rtm.dll"
#cfunc global RtmBlockMethods "RtmBlockMethods" sptr, sptr, int, int
; res = RtmBlockMethods(RtmRegHandle, TargetHandle, TargetType, BlockingFlag)
; RtmRegHandle : INT_PTR -> "sptr"
; TargetHandle : HANDLE -> "sptr"
; TargetType : BYTE -> "int"
; BlockingFlag : DWORD -> "int"
; DWORD RtmBlockMethods(INT_PTR RtmRegHandle, HANDLE TargetHandle, BYTE TargetType, DWORD BlockingFlag)
#uselib "rtm.dll"
#cfunc global RtmBlockMethods "RtmBlockMethods" intptr, intptr, int, int
; res = RtmBlockMethods(RtmRegHandle, TargetHandle, TargetType, BlockingFlag)
; RtmRegHandle : INT_PTR -> "intptr"
; TargetHandle : HANDLE -> "intptr"
; TargetType : BYTE -> "int"
; BlockingFlag : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmBlockMethods = rtm.NewProc("RtmBlockMethods")
)

// RtmRegHandle (INT_PTR), TargetHandle (HANDLE), TargetType (BYTE), BlockingFlag (DWORD)
r1, _, err := procRtmBlockMethods.Call(
	uintptr(RtmRegHandle),
	uintptr(TargetHandle),
	uintptr(TargetType),
	uintptr(BlockingFlag),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function RtmBlockMethods(
  RtmRegHandle: NativeInt;   // INT_PTR
  TargetHandle: THandle;   // HANDLE
  TargetType: Byte;   // BYTE
  BlockingFlag: DWORD   // DWORD
): DWORD; stdcall;
  external 'rtm.dll' name 'RtmBlockMethods';
result := DllCall("rtm\RtmBlockMethods"
    , "Ptr", RtmRegHandle   ; INT_PTR
    , "Ptr", TargetHandle   ; HANDLE
    , "UChar", TargetType   ; BYTE
    , "UInt", BlockingFlag   ; DWORD
    , "UInt")   ; return: DWORD
●RtmBlockMethods(RtmRegHandle, TargetHandle, TargetType, BlockingFlag) = DLL("rtm.dll", "dword RtmBlockMethods(int, void*, byte, dword)")
# 呼び出し: RtmBlockMethods(RtmRegHandle, TargetHandle, TargetType, BlockingFlag)
# RtmRegHandle : INT_PTR -> "int"
# TargetHandle : HANDLE -> "void*"
# TargetType : BYTE -> "byte"
# BlockingFlag : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。