Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug.Extensions › DebugCreateEx

DebugCreateEx

関数
オプション指定でデバッグエンジンインターフェイスを作成する。
DLLdbgeng.dll呼出規約winapi

シグネチャ

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

HRESULT DebugCreateEx(
    const GUID* InterfaceId,
    DWORD DbgEngOptions,
    void** Interface
);

パラメーター

名前方向
InterfaceIdGUID*in
DbgEngOptionsDWORDin
Interfacevoid**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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // HRESULT
function 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)。