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

DebugCreate

関数
デバッグエンジンのクライアントインターフェイスを作成する。
DLLdbgeng.dll呼出規約winapi

シグネチャ

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

HRESULT DebugCreate(
    const GUID* InterfaceId,
    void** Interface
);

パラメーター

名前方向
InterfaceIdGUID*in
Interfacevoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DebugCreate(
    const GUID* InterfaceId,
    void** Interface
);
[DllImport("dbgeng.dll", ExactSpelling = true)]
static extern int DebugCreate(
    ref Guid InterfaceId,   // GUID*
    IntPtr Interface   // void** out
);
<DllImport("dbgeng.dll", ExactSpelling:=True)>
Public Shared Function DebugCreate(
    ByRef InterfaceId As Guid,   ' GUID*
    [Interface] As IntPtr   ' void** out
) As Integer
End Function
' InterfaceId : GUID*
' Interface : void** out
Declare PtrSafe Function DebugCreate Lib "dbgeng" ( _
    ByVal InterfaceId As LongPtr, _
    ByVal Interface As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DebugCreate = ctypes.windll.dbgeng.DebugCreate
DebugCreate.restype = ctypes.c_int
DebugCreate.argtypes = [
    ctypes.c_void_p,  # InterfaceId : GUID*
    ctypes.c_void_p,  # Interface : void** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dbgeng = windows.NewLazySystemDLL("dbgeng.dll")
	procDebugCreate = dbgeng.NewProc("DebugCreate")
)

// InterfaceId (GUID*), Interface (void** out)
r1, _, err := procDebugCreate.Call(
	uintptr(InterfaceId),
	uintptr(Interface),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DebugCreate(
  InterfaceId: PGUID;   // GUID*
  Interface: Pointer   // void** out
): Integer; stdcall;
  external 'dbgeng.dll' name 'DebugCreate';
result := DllCall("dbgeng\DebugCreate"
    , "Ptr", InterfaceId   ; GUID*
    , "Ptr", Interface   ; void** out
    , "Int")   ; return: HRESULT
●DebugCreate(InterfaceId, Interface) = DLL("dbgeng.dll", "int DebugCreate(void*, void*)")
# 呼び出し: DebugCreate(InterfaceId, Interface)
# InterfaceId : GUID* -> "void*"
# Interface : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。