ホーム › NetworkManagement.NetManagement › TraceDumpExW
TraceDumpExW
関数バイト配列を16進ダンプ形式でトレース出力する(Unicode版)。
シグネチャ
// rtutils.dll (Unicode / -W)
#include <windows.h>
DWORD TraceDumpExW(
DWORD dwTraceID,
DWORD dwFlags,
BYTE* lpbBytes,
DWORD dwByteCount,
DWORD dwGroupSize,
BOOL bAddressPrefix,
LPCWSTR lpszPrefix
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwTraceID | DWORD | in |
| dwFlags | DWORD | in |
| lpbBytes | BYTE* | inout |
| dwByteCount | DWORD | in |
| dwGroupSize | DWORD | in |
| bAddressPrefix | BOOL | in |
| lpszPrefix | LPCWSTR | in |
戻り値の型: DWORD
各言語での呼び出し定義
// rtutils.dll (Unicode / -W)
#include <windows.h>
DWORD TraceDumpExW(
DWORD dwTraceID,
DWORD dwFlags,
BYTE* lpbBytes,
DWORD dwByteCount,
DWORD dwGroupSize,
BOOL bAddressPrefix,
LPCWSTR lpszPrefix
);[DllImport("rtutils.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint TraceDumpExW(
uint dwTraceID, // DWORD
uint dwFlags, // DWORD
IntPtr lpbBytes, // BYTE* in/out
uint dwByteCount, // DWORD
uint dwGroupSize, // DWORD
bool bAddressPrefix, // BOOL
[MarshalAs(UnmanagedType.LPWStr)] string lpszPrefix // LPCWSTR
);<DllImport("rtutils.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function TraceDumpExW(
dwTraceID As UInteger, ' DWORD
dwFlags As UInteger, ' DWORD
lpbBytes As IntPtr, ' BYTE* in/out
dwByteCount As UInteger, ' DWORD
dwGroupSize As UInteger, ' DWORD
bAddressPrefix As Boolean, ' BOOL
<MarshalAs(UnmanagedType.LPWStr)> lpszPrefix As String ' LPCWSTR
) As UInteger
End Function' dwTraceID : DWORD
' dwFlags : DWORD
' lpbBytes : BYTE* in/out
' dwByteCount : DWORD
' dwGroupSize : DWORD
' bAddressPrefix : BOOL
' lpszPrefix : LPCWSTR
Declare PtrSafe Function TraceDumpExW Lib "rtutils" ( _
ByVal dwTraceID As Long, _
ByVal dwFlags As Long, _
ByVal lpbBytes As LongPtr, _
ByVal dwByteCount As Long, _
ByVal dwGroupSize As Long, _
ByVal bAddressPrefix As Long, _
ByVal lpszPrefix As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
TraceDumpExW = ctypes.windll.rtutils.TraceDumpExW
TraceDumpExW.restype = wintypes.DWORD
TraceDumpExW.argtypes = [
wintypes.DWORD, # dwTraceID : DWORD
wintypes.DWORD, # dwFlags : DWORD
ctypes.POINTER(ctypes.c_ubyte), # lpbBytes : BYTE* in/out
wintypes.DWORD, # dwByteCount : DWORD
wintypes.DWORD, # dwGroupSize : DWORD
wintypes.BOOL, # bAddressPrefix : BOOL
wintypes.LPCWSTR, # lpszPrefix : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('rtutils.dll')
TraceDumpExW = Fiddle::Function.new(
lib['TraceDumpExW'],
[
-Fiddle::TYPE_INT, # dwTraceID : DWORD
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # lpbBytes : BYTE* in/out
-Fiddle::TYPE_INT, # dwByteCount : DWORD
-Fiddle::TYPE_INT, # dwGroupSize : DWORD
Fiddle::TYPE_INT, # bAddressPrefix : BOOL
Fiddle::TYPE_VOIDP, # lpszPrefix : LPCWSTR
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "rtutils")]
extern "system" {
fn TraceDumpExW(
dwTraceID: u32, // DWORD
dwFlags: u32, // DWORD
lpbBytes: *mut u8, // BYTE* in/out
dwByteCount: u32, // DWORD
dwGroupSize: u32, // DWORD
bAddressPrefix: i32, // BOOL
lpszPrefix: *const u16 // LPCWSTR
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("rtutils.dll", CharSet = CharSet.Unicode)]
public static extern uint TraceDumpExW(uint dwTraceID, uint dwFlags, IntPtr lpbBytes, uint dwByteCount, uint dwGroupSize, bool bAddressPrefix, [MarshalAs(UnmanagedType.LPWStr)] string lpszPrefix);
"@
$api = Add-Type -MemberDefinition $sig -Name 'rtutils_TraceDumpExW' -Namespace Win32 -PassThru
# $api::TraceDumpExW(dwTraceID, dwFlags, lpbBytes, dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix)#uselib "rtutils.dll"
#func global TraceDumpExW "TraceDumpExW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; TraceDumpExW dwTraceID, dwFlags, varptr(lpbBytes), dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix ; 戻り値は stat
; dwTraceID : DWORD -> "wptr"
; dwFlags : DWORD -> "wptr"
; lpbBytes : BYTE* in/out -> "wptr"
; dwByteCount : DWORD -> "wptr"
; dwGroupSize : DWORD -> "wptr"
; bAddressPrefix : BOOL -> "wptr"
; lpszPrefix : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "rtutils.dll" #cfunc global TraceDumpExW "TraceDumpExW" int, int, var, int, int, int, wstr ; res = TraceDumpExW(dwTraceID, dwFlags, lpbBytes, dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix) ; dwTraceID : DWORD -> "int" ; dwFlags : DWORD -> "int" ; lpbBytes : BYTE* in/out -> "var" ; dwByteCount : DWORD -> "int" ; dwGroupSize : DWORD -> "int" ; bAddressPrefix : BOOL -> "int" ; lpszPrefix : LPCWSTR -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "rtutils.dll" #cfunc global TraceDumpExW "TraceDumpExW" int, int, sptr, int, int, int, wstr ; res = TraceDumpExW(dwTraceID, dwFlags, varptr(lpbBytes), dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix) ; dwTraceID : DWORD -> "int" ; dwFlags : DWORD -> "int" ; lpbBytes : BYTE* in/out -> "sptr" ; dwByteCount : DWORD -> "int" ; dwGroupSize : DWORD -> "int" ; bAddressPrefix : BOOL -> "int" ; lpszPrefix : LPCWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD TraceDumpExW(DWORD dwTraceID, DWORD dwFlags, BYTE* lpbBytes, DWORD dwByteCount, DWORD dwGroupSize, BOOL bAddressPrefix, LPCWSTR lpszPrefix) #uselib "rtutils.dll" #cfunc global TraceDumpExW "TraceDumpExW" int, int, var, int, int, int, wstr ; res = TraceDumpExW(dwTraceID, dwFlags, lpbBytes, dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix) ; dwTraceID : DWORD -> "int" ; dwFlags : DWORD -> "int" ; lpbBytes : BYTE* in/out -> "var" ; dwByteCount : DWORD -> "int" ; dwGroupSize : DWORD -> "int" ; bAddressPrefix : BOOL -> "int" ; lpszPrefix : LPCWSTR -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD TraceDumpExW(DWORD dwTraceID, DWORD dwFlags, BYTE* lpbBytes, DWORD dwByteCount, DWORD dwGroupSize, BOOL bAddressPrefix, LPCWSTR lpszPrefix) #uselib "rtutils.dll" #cfunc global TraceDumpExW "TraceDumpExW" int, int, intptr, int, int, int, wstr ; res = TraceDumpExW(dwTraceID, dwFlags, varptr(lpbBytes), dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix) ; dwTraceID : DWORD -> "int" ; dwFlags : DWORD -> "int" ; lpbBytes : BYTE* in/out -> "intptr" ; dwByteCount : DWORD -> "int" ; dwGroupSize : DWORD -> "int" ; bAddressPrefix : BOOL -> "int" ; lpszPrefix : LPCWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rtutils = windows.NewLazySystemDLL("rtutils.dll")
procTraceDumpExW = rtutils.NewProc("TraceDumpExW")
)
// dwTraceID (DWORD), dwFlags (DWORD), lpbBytes (BYTE* in/out), dwByteCount (DWORD), dwGroupSize (DWORD), bAddressPrefix (BOOL), lpszPrefix (LPCWSTR)
r1, _, err := procTraceDumpExW.Call(
uintptr(dwTraceID),
uintptr(dwFlags),
uintptr(lpbBytes),
uintptr(dwByteCount),
uintptr(dwGroupSize),
uintptr(bAddressPrefix),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszPrefix))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction TraceDumpExW(
dwTraceID: DWORD; // DWORD
dwFlags: DWORD; // DWORD
lpbBytes: Pointer; // BYTE* in/out
dwByteCount: DWORD; // DWORD
dwGroupSize: DWORD; // DWORD
bAddressPrefix: BOOL; // BOOL
lpszPrefix: PWideChar // LPCWSTR
): DWORD; stdcall;
external 'rtutils.dll' name 'TraceDumpExW';result := DllCall("rtutils\TraceDumpExW"
, "UInt", dwTraceID ; DWORD
, "UInt", dwFlags ; DWORD
, "Ptr", lpbBytes ; BYTE* in/out
, "UInt", dwByteCount ; DWORD
, "UInt", dwGroupSize ; DWORD
, "Int", bAddressPrefix ; BOOL
, "WStr", lpszPrefix ; LPCWSTR
, "UInt") ; return: DWORD●TraceDumpExW(dwTraceID, dwFlags, lpbBytes, dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix) = DLL("rtutils.dll", "dword TraceDumpExW(dword, dword, void*, dword, dword, bool, char*)")
# 呼び出し: TraceDumpExW(dwTraceID, dwFlags, lpbBytes, dwByteCount, dwGroupSize, bAddressPrefix, lpszPrefix)
# dwTraceID : DWORD -> "dword"
# dwFlags : DWORD -> "dword"
# lpbBytes : BYTE* in/out -> "void*"
# dwByteCount : DWORD -> "dword"
# dwGroupSize : DWORD -> "dword"
# bAddressPrefix : BOOL -> "bool"
# lpszPrefix : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。