ホーム › NetworkManagement.Rras › MprInfoBlockFind
MprInfoBlockFind
関数情報ヘッダーから指定種別の情報ブロックを検索する。
シグネチャ
// MPRAPI.dll
#include <windows.h>
DWORD MprInfoBlockFind(
void* lpHeader,
DWORD dwInfoType,
DWORD* lpdwItemSize,
DWORD* lpdwItemCount,
BYTE** lplpItemData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpHeader | void* | in |
| dwInfoType | DWORD | in |
| lpdwItemSize | DWORD* | out |
| lpdwItemCount | DWORD* | out |
| lplpItemData | BYTE** | out |
戻り値の型: DWORD
各言語での呼び出し定義
// MPRAPI.dll
#include <windows.h>
DWORD MprInfoBlockFind(
void* lpHeader,
DWORD dwInfoType,
DWORD* lpdwItemSize,
DWORD* lpdwItemCount,
BYTE** lplpItemData
);[DllImport("MPRAPI.dll", ExactSpelling = true)]
static extern uint MprInfoBlockFind(
IntPtr lpHeader, // void*
uint dwInfoType, // DWORD
out uint lpdwItemSize, // DWORD* out
out uint lpdwItemCount, // DWORD* out
IntPtr lplpItemData // BYTE** out
);<DllImport("MPRAPI.dll", ExactSpelling:=True)>
Public Shared Function MprInfoBlockFind(
lpHeader As IntPtr, ' void*
dwInfoType As UInteger, ' DWORD
<Out> ByRef lpdwItemSize As UInteger, ' DWORD* out
<Out> ByRef lpdwItemCount As UInteger, ' DWORD* out
lplpItemData As IntPtr ' BYTE** out
) As UInteger
End Function' lpHeader : void*
' dwInfoType : DWORD
' lpdwItemSize : DWORD* out
' lpdwItemCount : DWORD* out
' lplpItemData : BYTE** out
Declare PtrSafe Function MprInfoBlockFind Lib "mprapi" ( _
ByVal lpHeader As LongPtr, _
ByVal dwInfoType As Long, _
ByRef lpdwItemSize As Long, _
ByRef lpdwItemCount As Long, _
ByVal lplpItemData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MprInfoBlockFind = ctypes.windll.mprapi.MprInfoBlockFind
MprInfoBlockFind.restype = wintypes.DWORD
MprInfoBlockFind.argtypes = [
ctypes.POINTER(None), # lpHeader : void*
wintypes.DWORD, # dwInfoType : DWORD
ctypes.POINTER(wintypes.DWORD), # lpdwItemSize : DWORD* out
ctypes.POINTER(wintypes.DWORD), # lpdwItemCount : DWORD* out
ctypes.c_void_p, # lplpItemData : BYTE** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MPRAPI.dll')
MprInfoBlockFind = Fiddle::Function.new(
lib['MprInfoBlockFind'],
[
Fiddle::TYPE_VOIDP, # lpHeader : void*
-Fiddle::TYPE_INT, # dwInfoType : DWORD
Fiddle::TYPE_VOIDP, # lpdwItemSize : DWORD* out
Fiddle::TYPE_VOIDP, # lpdwItemCount : DWORD* out
Fiddle::TYPE_VOIDP, # lplpItemData : BYTE** out
],
-Fiddle::TYPE_INT)#[link(name = "mprapi")]
extern "system" {
fn MprInfoBlockFind(
lpHeader: *mut (), // void*
dwInfoType: u32, // DWORD
lpdwItemSize: *mut u32, // DWORD* out
lpdwItemCount: *mut u32, // DWORD* out
lplpItemData: *mut *mut u8 // BYTE** out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MPRAPI.dll")]
public static extern uint MprInfoBlockFind(IntPtr lpHeader, uint dwInfoType, out uint lpdwItemSize, out uint lpdwItemCount, IntPtr lplpItemData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MPRAPI_MprInfoBlockFind' -Namespace Win32 -PassThru
# $api::MprInfoBlockFind(lpHeader, dwInfoType, lpdwItemSize, lpdwItemCount, lplpItemData)#uselib "MPRAPI.dll"
#func global MprInfoBlockFind "MprInfoBlockFind" sptr, sptr, sptr, sptr, sptr
; MprInfoBlockFind lpHeader, dwInfoType, varptr(lpdwItemSize), varptr(lpdwItemCount), varptr(lplpItemData) ; 戻り値は stat
; lpHeader : void* -> "sptr"
; dwInfoType : DWORD -> "sptr"
; lpdwItemSize : DWORD* out -> "sptr"
; lpdwItemCount : DWORD* out -> "sptr"
; lplpItemData : BYTE** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MPRAPI.dll" #cfunc global MprInfoBlockFind "MprInfoBlockFind" sptr, int, var, var, var ; res = MprInfoBlockFind(lpHeader, dwInfoType, lpdwItemSize, lpdwItemCount, lplpItemData) ; lpHeader : void* -> "sptr" ; dwInfoType : DWORD -> "int" ; lpdwItemSize : DWORD* out -> "var" ; lpdwItemCount : DWORD* out -> "var" ; lplpItemData : BYTE** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MPRAPI.dll" #cfunc global MprInfoBlockFind "MprInfoBlockFind" sptr, int, sptr, sptr, sptr ; res = MprInfoBlockFind(lpHeader, dwInfoType, varptr(lpdwItemSize), varptr(lpdwItemCount), varptr(lplpItemData)) ; lpHeader : void* -> "sptr" ; dwInfoType : DWORD -> "int" ; lpdwItemSize : DWORD* out -> "sptr" ; lpdwItemCount : DWORD* out -> "sptr" ; lplpItemData : BYTE** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD MprInfoBlockFind(void* lpHeader, DWORD dwInfoType, DWORD* lpdwItemSize, DWORD* lpdwItemCount, BYTE** lplpItemData) #uselib "MPRAPI.dll" #cfunc global MprInfoBlockFind "MprInfoBlockFind" intptr, int, var, var, var ; res = MprInfoBlockFind(lpHeader, dwInfoType, lpdwItemSize, lpdwItemCount, lplpItemData) ; lpHeader : void* -> "intptr" ; dwInfoType : DWORD -> "int" ; lpdwItemSize : DWORD* out -> "var" ; lpdwItemCount : DWORD* out -> "var" ; lplpItemData : BYTE** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD MprInfoBlockFind(void* lpHeader, DWORD dwInfoType, DWORD* lpdwItemSize, DWORD* lpdwItemCount, BYTE** lplpItemData) #uselib "MPRAPI.dll" #cfunc global MprInfoBlockFind "MprInfoBlockFind" intptr, int, intptr, intptr, intptr ; res = MprInfoBlockFind(lpHeader, dwInfoType, varptr(lpdwItemSize), varptr(lpdwItemCount), varptr(lplpItemData)) ; lpHeader : void* -> "intptr" ; dwInfoType : DWORD -> "int" ; lpdwItemSize : DWORD* out -> "intptr" ; lpdwItemCount : DWORD* out -> "intptr" ; lplpItemData : BYTE** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mprapi = windows.NewLazySystemDLL("MPRAPI.dll")
procMprInfoBlockFind = mprapi.NewProc("MprInfoBlockFind")
)
// lpHeader (void*), dwInfoType (DWORD), lpdwItemSize (DWORD* out), lpdwItemCount (DWORD* out), lplpItemData (BYTE** out)
r1, _, err := procMprInfoBlockFind.Call(
uintptr(lpHeader),
uintptr(dwInfoType),
uintptr(lpdwItemSize),
uintptr(lpdwItemCount),
uintptr(lplpItemData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction MprInfoBlockFind(
lpHeader: Pointer; // void*
dwInfoType: DWORD; // DWORD
lpdwItemSize: Pointer; // DWORD* out
lpdwItemCount: Pointer; // DWORD* out
lplpItemData: Pointer // BYTE** out
): DWORD; stdcall;
external 'MPRAPI.dll' name 'MprInfoBlockFind';result := DllCall("MPRAPI\MprInfoBlockFind"
, "Ptr", lpHeader ; void*
, "UInt", dwInfoType ; DWORD
, "Ptr", lpdwItemSize ; DWORD* out
, "Ptr", lpdwItemCount ; DWORD* out
, "Ptr", lplpItemData ; BYTE** out
, "UInt") ; return: DWORD●MprInfoBlockFind(lpHeader, dwInfoType, lpdwItemSize, lpdwItemCount, lplpItemData) = DLL("MPRAPI.dll", "dword MprInfoBlockFind(void*, dword, void*, void*, void*)")
# 呼び出し: MprInfoBlockFind(lpHeader, dwInfoType, lpdwItemSize, lpdwItemCount, lplpItemData)
# lpHeader : void* -> "void*"
# dwInfoType : DWORD -> "dword"
# lpdwItemSize : DWORD* out -> "void*"
# lpdwItemCount : DWORD* out -> "void*"
# lplpItemData : BYTE** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。