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

RtmGetEntityMethods

関数
指定エンティティがエクスポートするメソッドを取得する。
DLLrtm.dll呼出規約winapi対応OSwindowsserver2000

シグネチャ

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

DWORD RtmGetEntityMethods(
    INT_PTR RtmRegHandle,
    INT_PTR EntityHandle,
    DWORD* NumMethods,
    RTM_ENTITY_EXPORT_METHOD* ExptMethods
);

パラメーター

名前方向説明
RtmRegHandleINT_PTRinRtmRegisterEntityで取得したRTM登録ハンドル。
EntityHandleINT_PTRinメソッドを取得する対象エンティティのハンドル。
NumMethodsDWORD*inout入力で配列容量、出力で返されたメソッド数を示すポインタ。
ExptMethodsRTM_ENTITY_EXPORT_METHOD*inoutエンティティが公開するメソッド情報を受け取るRTM_ENTITY_EXPORT_METHOD配列。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD RtmGetEntityMethods(
    INT_PTR RtmRegHandle,
    INT_PTR EntityHandle,
    DWORD* NumMethods,
    RTM_ENTITY_EXPORT_METHOD* ExptMethods
);
[DllImport("rtm.dll", ExactSpelling = true)]
static extern uint RtmGetEntityMethods(
    IntPtr RtmRegHandle,   // INT_PTR
    IntPtr EntityHandle,   // INT_PTR
    ref uint NumMethods,   // DWORD* in/out
    IntPtr ExptMethods   // RTM_ENTITY_EXPORT_METHOD* in/out
);
<DllImport("rtm.dll", ExactSpelling:=True)>
Public Shared Function RtmGetEntityMethods(
    RtmRegHandle As IntPtr,   ' INT_PTR
    EntityHandle As IntPtr,   ' INT_PTR
    ByRef NumMethods As UInteger,   ' DWORD* in/out
    ExptMethods As IntPtr   ' RTM_ENTITY_EXPORT_METHOD* in/out
) As UInteger
End Function
' RtmRegHandle : INT_PTR
' EntityHandle : INT_PTR
' NumMethods : DWORD* in/out
' ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out
Declare PtrSafe Function RtmGetEntityMethods Lib "rtm" ( _
    ByVal RtmRegHandle As LongPtr, _
    ByVal EntityHandle As LongPtr, _
    ByRef NumMethods As Long, _
    ByVal ExptMethods As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RtmGetEntityMethods = ctypes.windll.rtm.RtmGetEntityMethods
RtmGetEntityMethods.restype = wintypes.DWORD
RtmGetEntityMethods.argtypes = [
    ctypes.c_ssize_t,  # RtmRegHandle : INT_PTR
    ctypes.c_ssize_t,  # EntityHandle : INT_PTR
    ctypes.POINTER(wintypes.DWORD),  # NumMethods : DWORD* in/out
    ctypes.c_void_p,  # ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('rtm.dll')
RtmGetEntityMethods = Fiddle::Function.new(
  lib['RtmGetEntityMethods'],
  [
    Fiddle::TYPE_INTPTR_T,  # RtmRegHandle : INT_PTR
    Fiddle::TYPE_INTPTR_T,  # EntityHandle : INT_PTR
    Fiddle::TYPE_VOIDP,  # NumMethods : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "rtm")]
extern "system" {
    fn RtmGetEntityMethods(
        RtmRegHandle: isize,  // INT_PTR
        EntityHandle: isize,  // INT_PTR
        NumMethods: *mut u32,  // DWORD* in/out
        ExptMethods: *mut *const core::ffi::c_void  // RTM_ENTITY_EXPORT_METHOD* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("rtm.dll")]
public static extern uint RtmGetEntityMethods(IntPtr RtmRegHandle, IntPtr EntityHandle, ref uint NumMethods, IntPtr ExptMethods);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtm_RtmGetEntityMethods' -Namespace Win32 -PassThru
# $api::RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
#uselib "rtm.dll"
#func global RtmGetEntityMethods "RtmGetEntityMethods" sptr, sptr, sptr, sptr
; RtmGetEntityMethods RtmRegHandle, EntityHandle, varptr(NumMethods), ExptMethods   ; 戻り値は stat
; RtmRegHandle : INT_PTR -> "sptr"
; EntityHandle : INT_PTR -> "sptr"
; NumMethods : DWORD* in/out -> "sptr"
; ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "rtm.dll"
#cfunc global RtmGetEntityMethods "RtmGetEntityMethods" sptr, sptr, var, sptr
; res = RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
; RtmRegHandle : INT_PTR -> "sptr"
; EntityHandle : INT_PTR -> "sptr"
; NumMethods : DWORD* in/out -> "var"
; ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD RtmGetEntityMethods(INT_PTR RtmRegHandle, INT_PTR EntityHandle, DWORD* NumMethods, RTM_ENTITY_EXPORT_METHOD* ExptMethods)
#uselib "rtm.dll"
#cfunc global RtmGetEntityMethods "RtmGetEntityMethods" intptr, intptr, var, intptr
; res = RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
; RtmRegHandle : INT_PTR -> "intptr"
; EntityHandle : INT_PTR -> "intptr"
; NumMethods : DWORD* in/out -> "var"
; ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rtm = windows.NewLazySystemDLL("rtm.dll")
	procRtmGetEntityMethods = rtm.NewProc("RtmGetEntityMethods")
)

// RtmRegHandle (INT_PTR), EntityHandle (INT_PTR), NumMethods (DWORD* in/out), ExptMethods (RTM_ENTITY_EXPORT_METHOD* in/out)
r1, _, err := procRtmGetEntityMethods.Call(
	uintptr(RtmRegHandle),
	uintptr(EntityHandle),
	uintptr(NumMethods),
	uintptr(ExptMethods),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function RtmGetEntityMethods(
  RtmRegHandle: NativeInt;   // INT_PTR
  EntityHandle: NativeInt;   // INT_PTR
  NumMethods: Pointer;   // DWORD* in/out
  ExptMethods: Pointer   // RTM_ENTITY_EXPORT_METHOD* in/out
): DWORD; stdcall;
  external 'rtm.dll' name 'RtmGetEntityMethods';
result := DllCall("rtm\RtmGetEntityMethods"
    , "Ptr", RtmRegHandle   ; INT_PTR
    , "Ptr", EntityHandle   ; INT_PTR
    , "Ptr", NumMethods   ; DWORD* in/out
    , "Ptr", ExptMethods   ; RTM_ENTITY_EXPORT_METHOD* in/out
    , "UInt")   ; return: DWORD
●RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods) = DLL("rtm.dll", "dword RtmGetEntityMethods(int, int, void*, void*)")
# 呼び出し: RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
# RtmRegHandle : INT_PTR -> "int"
# EntityHandle : INT_PTR -> "int"
# NumMethods : DWORD* in/out -> "void*"
# ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "rtm" fn RtmGetEntityMethods(
    RtmRegHandle: isize, // INT_PTR
    EntityHandle: isize, // INT_PTR
    NumMethods: [*c]u32, // DWORD* in/out
    ExptMethods: ?*anyopaque // RTM_ENTITY_EXPORT_METHOD* in/out
) callconv(std.os.windows.WINAPI) u32;
proc RtmGetEntityMethods(
    RtmRegHandle: int,  # INT_PTR
    EntityHandle: int,  # INT_PTR
    NumMethods: ptr uint32,  # DWORD* in/out
    ExptMethods: pointer  # RTM_ENTITY_EXPORT_METHOD* in/out
): uint32 {.importc: "RtmGetEntityMethods", stdcall, dynlib: "rtm.dll".}
pragma(lib, "rtm");
extern(Windows)
uint RtmGetEntityMethods(
    ptrdiff_t RtmRegHandle,   // INT_PTR
    ptrdiff_t EntityHandle,   // INT_PTR
    uint* NumMethods,   // DWORD* in/out
    void* ExptMethods   // RTM_ENTITY_EXPORT_METHOD* in/out
);
ccall((:RtmGetEntityMethods, "rtm.dll"), stdcall, UInt32,
      (Int, Int, Ptr{UInt32}, Ptr{Cvoid}),
      RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
# RtmRegHandle : INT_PTR -> Int
# EntityHandle : INT_PTR -> Int
# NumMethods : DWORD* in/out -> Ptr{UInt32}
# ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t RtmGetEntityMethods(
    intptr_t RtmRegHandle,
    intptr_t EntityHandle,
    uint32_t* NumMethods,
    void* ExptMethods);
]]
local rtm = ffi.load("rtm")
-- rtm.RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
-- RtmRegHandle : INT_PTR
-- EntityHandle : INT_PTR
-- NumMethods : DWORD* in/out
-- ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('rtm.dll');
const RtmGetEntityMethods = lib.func('__stdcall', 'RtmGetEntityMethods', 'uint32_t', ['intptr_t', 'intptr_t', 'uint32_t *', 'void *']);
// RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
// RtmRegHandle : INT_PTR -> 'intptr_t'
// EntityHandle : INT_PTR -> 'intptr_t'
// NumMethods : DWORD* in/out -> 'uint32_t *'
// ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。
const lib = Deno.dlopen("rtm.dll", {
  RtmGetEntityMethods: { parameters: ["isize", "isize", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods)
// RtmRegHandle : INT_PTR -> "isize"
// EntityHandle : INT_PTR -> "isize"
// NumMethods : DWORD* in/out -> "pointer"
// ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t RtmGetEntityMethods(
    intptr_t RtmRegHandle,
    intptr_t EntityHandle,
    uint32_t* NumMethods,
    void* ExptMethods);
C, "rtm.dll");
// $ffi->RtmGetEntityMethods(RtmRegHandle, EntityHandle, NumMethods, ExptMethods);
// RtmRegHandle : INT_PTR
// EntityHandle : INT_PTR
// NumMethods : DWORD* in/out
// ExptMethods : RTM_ENTITY_EXPORT_METHOD* 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 Rtm extends StdCallLibrary {
    Rtm INSTANCE = Native.load("rtm", Rtm.class);
    int RtmGetEntityMethods(
        long RtmRegHandle,   // INT_PTR
        long EntityHandle,   // INT_PTR
        IntByReference NumMethods,   // DWORD* in/out
        Callback ExptMethods   // RTM_ENTITY_EXPORT_METHOD* in/out
    );
}
@[Link("rtm")]
lib Librtm
  fun RtmGetEntityMethods = RtmGetEntityMethods(
    RtmRegHandle : LibC::SSizeT,   # INT_PTR
    EntityHandle : LibC::SSizeT,   # INT_PTR
    NumMethods : UInt32*,   # DWORD* in/out
    ExptMethods : Void*   # RTM_ENTITY_EXPORT_METHOD* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RtmGetEntityMethodsNative = Uint32 Function(IntPtr, IntPtr, Pointer<Uint32>, Pointer<Void>);
typedef RtmGetEntityMethodsDart = int Function(int, int, Pointer<Uint32>, Pointer<Void>);
final RtmGetEntityMethods = DynamicLibrary.open('rtm.dll')
    .lookupFunction<RtmGetEntityMethodsNative, RtmGetEntityMethodsDart>('RtmGetEntityMethods');
// RtmRegHandle : INT_PTR -> IntPtr
// EntityHandle : INT_PTR -> IntPtr
// NumMethods : DWORD* in/out -> Pointer<Uint32>
// ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RtmGetEntityMethods(
  RtmRegHandle: NativeInt;   // INT_PTR
  EntityHandle: NativeInt;   // INT_PTR
  NumMethods: Pointer;   // DWORD* in/out
  ExptMethods: Pointer   // RTM_ENTITY_EXPORT_METHOD* in/out
): DWORD; stdcall;
  external 'rtm.dll' name 'RtmGetEntityMethods';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RtmGetEntityMethods"
  c_RtmGetEntityMethods :: CIntPtr -> CIntPtr -> Ptr Word32 -> Ptr () -> IO Word32
-- RtmRegHandle : INT_PTR -> CIntPtr
-- EntityHandle : INT_PTR -> CIntPtr
-- NumMethods : DWORD* in/out -> Ptr Word32
-- ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let rtmgetentitymethods =
  foreign "RtmGetEntityMethods"
    (intptr_t @-> intptr_t @-> (ptr uint32_t) @-> (ptr void) @-> returning uint32_t)
(* RtmRegHandle : INT_PTR -> intptr_t *)
(* EntityHandle : INT_PTR -> intptr_t *)
(* NumMethods : DWORD* in/out -> (ptr uint32_t) *)
(* ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library rtm (t "rtm.dll"))
(cffi:use-foreign-library rtm)

(cffi:defcfun ("RtmGetEntityMethods" rtm-get-entity-methods :convention :stdcall) :uint32
  (rtm-reg-handle :int64)   ; INT_PTR
  (entity-handle :int64)   ; INT_PTR
  (num-methods :pointer)   ; DWORD* in/out
  (expt-methods :pointer))   ; RTM_ENTITY_EXPORT_METHOD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RtmGetEntityMethods = Win32::API::More->new('rtm',
    'DWORD RtmGetEntityMethods(LPARAM RtmRegHandle, LPARAM EntityHandle, LPVOID NumMethods, LPVOID ExptMethods)');
# my $ret = $RtmGetEntityMethods->Call($RtmRegHandle, $EntityHandle, $NumMethods, $ExptMethods);
# RtmRegHandle : INT_PTR -> LPARAM
# EntityHandle : INT_PTR -> LPARAM
# NumMethods : DWORD* in/out -> LPVOID
# ExptMethods : RTM_ENTITY_EXPORT_METHOD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。

関連項目

使用する型