ホーム › System.Diagnostics.Debug.Extensions › DebugCreateEx
DebugCreateEx
関数オプション指定でデバッグエンジンインターフェイスを作成する。
シグネチャ
// dbgeng.dll
#include <windows.h>
HRESULT DebugCreateEx(
const GUID* InterfaceId,
DWORD DbgEngOptions,
void** Interface
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| InterfaceId | GUID* | in | 作成するデバッグクライアントインターフェイスのIID(GUID)へのポインタ。 |
| DbgEngOptions | DWORD | in | DbgEngの動作を制御するオプションフラグ。 |
| Interface | void** | out | 取得したインターフェイスポインタを受け取る出力ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// dbgeng.dll
#include <windows.h>
HRESULT DebugCreateEx(
const GUID* InterfaceId,
DWORD DbgEngOptions,
void** Interface
);[DllImport("dbgeng.dll", ExactSpelling = true)]
static extern int DebugCreateEx(
ref Guid InterfaceId, // GUID*
uint DbgEngOptions, // DWORD
IntPtr Interface // void** out
);<DllImport("dbgeng.dll", ExactSpelling:=True)>
Public Shared Function DebugCreateEx(
ByRef InterfaceId As Guid, ' GUID*
DbgEngOptions As UInteger, ' DWORD
[Interface] As IntPtr ' void** out
) As Integer
End Function' InterfaceId : GUID*
' DbgEngOptions : DWORD
' Interface : void** out
Declare PtrSafe Function DebugCreateEx Lib "dbgeng" ( _
ByVal InterfaceId As LongPtr, _
ByVal DbgEngOptions As Long, _
ByVal Interface As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DebugCreateEx = ctypes.windll.dbgeng.DebugCreateEx
DebugCreateEx.restype = ctypes.c_int
DebugCreateEx.argtypes = [
ctypes.c_void_p, # InterfaceId : GUID*
wintypes.DWORD, # DbgEngOptions : DWORD
ctypes.c_void_p, # Interface : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dbgeng.dll')
DebugCreateEx = Fiddle::Function.new(
lib['DebugCreateEx'],
[
Fiddle::TYPE_VOIDP, # InterfaceId : GUID*
-Fiddle::TYPE_INT, # DbgEngOptions : DWORD
Fiddle::TYPE_VOIDP, # Interface : void** out
],
Fiddle::TYPE_INT)#[link(name = "dbgeng")]
extern "system" {
fn DebugCreateEx(
InterfaceId: *const GUID, // GUID*
DbgEngOptions: u32, // DWORD
Interface: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dbgeng.dll")]
public static extern int DebugCreateEx(ref Guid InterfaceId, uint DbgEngOptions, IntPtr Interface);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbgeng_DebugCreateEx' -Namespace Win32 -PassThru
# $api::DebugCreateEx(InterfaceId, DbgEngOptions, Interface)#uselib "dbgeng.dll"
#func global DebugCreateEx "DebugCreateEx" sptr, sptr, sptr
; DebugCreateEx varptr(InterfaceId), DbgEngOptions, Interface ; 戻り値は stat
; InterfaceId : GUID* -> "sptr"
; DbgEngOptions : DWORD -> "sptr"
; Interface : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dbgeng.dll" #cfunc global DebugCreateEx "DebugCreateEx" var, int, sptr ; res = DebugCreateEx(InterfaceId, DbgEngOptions, Interface) ; InterfaceId : GUID* -> "var" ; DbgEngOptions : DWORD -> "int" ; Interface : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dbgeng.dll" #cfunc global DebugCreateEx "DebugCreateEx" sptr, int, sptr ; res = DebugCreateEx(varptr(InterfaceId), DbgEngOptions, Interface) ; InterfaceId : GUID* -> "sptr" ; DbgEngOptions : DWORD -> "int" ; Interface : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DebugCreateEx(GUID* InterfaceId, DWORD DbgEngOptions, void** Interface) #uselib "dbgeng.dll" #cfunc global DebugCreateEx "DebugCreateEx" var, int, intptr ; res = DebugCreateEx(InterfaceId, DbgEngOptions, Interface) ; InterfaceId : GUID* -> "var" ; DbgEngOptions : DWORD -> "int" ; Interface : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DebugCreateEx(GUID* InterfaceId, DWORD DbgEngOptions, void** Interface) #uselib "dbgeng.dll" #cfunc global DebugCreateEx "DebugCreateEx" intptr, int, intptr ; res = DebugCreateEx(varptr(InterfaceId), DbgEngOptions, Interface) ; InterfaceId : GUID* -> "intptr" ; DbgEngOptions : DWORD -> "int" ; Interface : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dbgeng = windows.NewLazySystemDLL("dbgeng.dll")
procDebugCreateEx = dbgeng.NewProc("DebugCreateEx")
)
// InterfaceId (GUID*), DbgEngOptions (DWORD), Interface (void** out)
r1, _, err := procDebugCreateEx.Call(
uintptr(InterfaceId),
uintptr(DbgEngOptions),
uintptr(Interface),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DebugCreateEx(
InterfaceId: PGUID; // GUID*
DbgEngOptions: DWORD; // DWORD
Interface: Pointer // void** out
): Integer; stdcall;
external 'dbgeng.dll' name 'DebugCreateEx';result := DllCall("dbgeng\DebugCreateEx"
, "Ptr", InterfaceId ; GUID*
, "UInt", DbgEngOptions ; DWORD
, "Ptr", Interface ; void** out
, "Int") ; return: HRESULT●DebugCreateEx(InterfaceId, DbgEngOptions, Interface) = DLL("dbgeng.dll", "int DebugCreateEx(void*, dword, void*)")
# 呼び出し: DebugCreateEx(InterfaceId, DbgEngOptions, Interface)
# InterfaceId : GUID* -> "void*"
# DbgEngOptions : DWORD -> "dword"
# Interface : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dbgeng" fn DebugCreateEx(
InterfaceId: [*c]GUID, // GUID*
DbgEngOptions: u32, // DWORD
Interface: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) i32;proc DebugCreateEx(
InterfaceId: ptr GUID, # GUID*
DbgEngOptions: uint32, # DWORD
Interface: pointer # void** out
): int32 {.importc: "DebugCreateEx", stdcall, dynlib: "dbgeng.dll".}pragma(lib, "dbgeng");
extern(Windows)
int DebugCreateEx(
GUID* InterfaceId, // GUID*
uint DbgEngOptions, // DWORD
void** Interface // void** out
);ccall((:DebugCreateEx, "dbgeng.dll"), stdcall, Int32,
(Ptr{GUID}, UInt32, Ptr{Cvoid}),
InterfaceId, DbgEngOptions, Interface)
# InterfaceId : GUID* -> Ptr{GUID}
# DbgEngOptions : DWORD -> UInt32
# Interface : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DebugCreateEx(
void* InterfaceId,
uint32_t DbgEngOptions,
void** Interface);
]]
local dbgeng = ffi.load("dbgeng")
-- dbgeng.DebugCreateEx(InterfaceId, DbgEngOptions, Interface)
-- InterfaceId : GUID*
-- DbgEngOptions : DWORD
-- Interface : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('dbgeng.dll');
const DebugCreateEx = lib.func('__stdcall', 'DebugCreateEx', 'int32_t', ['void *', 'uint32_t', 'void *']);
// DebugCreateEx(InterfaceId, DbgEngOptions, Interface)
// InterfaceId : GUID* -> 'void *'
// DbgEngOptions : DWORD -> 'uint32_t'
// Interface : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("dbgeng.dll", {
DebugCreateEx: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.DebugCreateEx(InterfaceId, DbgEngOptions, Interface)
// InterfaceId : GUID* -> "pointer"
// DbgEngOptions : DWORD -> "u32"
// Interface : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DebugCreateEx(
void* InterfaceId,
uint32_t DbgEngOptions,
void** Interface);
C, "dbgeng.dll");
// $ffi->DebugCreateEx(InterfaceId, DbgEngOptions, Interface);
// InterfaceId : GUID*
// DbgEngOptions : DWORD
// Interface : void** 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 Dbgeng extends StdCallLibrary {
Dbgeng INSTANCE = Native.load("dbgeng", Dbgeng.class);
int DebugCreateEx(
Pointer InterfaceId, // GUID*
int DbgEngOptions, // DWORD
Pointer Interface // void** out
);
}@[Link("dbgeng")]
lib Libdbgeng
fun DebugCreateEx = DebugCreateEx(
InterfaceId : GUID*, # GUID*
DbgEngOptions : UInt32, # DWORD
Interface : Void** # void** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DebugCreateExNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef DebugCreateExDart = int Function(Pointer<Void>, int, Pointer<Void>);
final DebugCreateEx = DynamicLibrary.open('dbgeng.dll')
.lookupFunction<DebugCreateExNative, DebugCreateExDart>('DebugCreateEx');
// InterfaceId : GUID* -> Pointer<Void>
// DbgEngOptions : DWORD -> Uint32
// Interface : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DebugCreateEx(
InterfaceId: PGUID; // GUID*
DbgEngOptions: DWORD; // DWORD
Interface: Pointer // void** out
): Integer; stdcall;
external 'dbgeng.dll' name 'DebugCreateEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DebugCreateEx"
c_DebugCreateEx :: Ptr () -> Word32 -> Ptr () -> IO Int32
-- InterfaceId : GUID* -> Ptr ()
-- DbgEngOptions : DWORD -> Word32
-- Interface : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let debugcreateex =
foreign "DebugCreateEx"
((ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* InterfaceId : GUID* -> (ptr void) *)
(* DbgEngOptions : DWORD -> uint32_t *)
(* Interface : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dbgeng (t "dbgeng.dll"))
(cffi:use-foreign-library dbgeng)
(cffi:defcfun ("DebugCreateEx" debug-create-ex :convention :stdcall) :int32
(interface-id :pointer) ; GUID*
(dbg-eng-options :uint32) ; DWORD
(interface :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DebugCreateEx = Win32::API::More->new('dbgeng',
'int DebugCreateEx(LPVOID InterfaceId, DWORD DbgEngOptions, LPVOID Interface)');
# my $ret = $DebugCreateEx->Call($InterfaceId, $DbgEngOptions, $Interface);
# InterfaceId : GUID* -> LPVOID
# DbgEngOptions : DWORD -> DWORD
# Interface : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f DebugCreate — デバッグエンジンのクライアントインターフェイスを作成する。