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

DebugConnectWide

関数
リモートデバッグセッションに接続しエンジンを取得する(Unicode)。
DLLdbgeng.dll呼出規約winapi

シグネチャ

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

HRESULT DebugConnectWide(
    LPCWSTR RemoteOptions,
    const GUID* InterfaceId,
    void** Interface
);

パラメーター

名前方向
RemoteOptionsLPCWSTRin
InterfaceIdGUID*in
Interfacevoid**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DebugConnectWide(
    LPCWSTR RemoteOptions,
    const GUID* InterfaceId,
    void** Interface
);
[DllImport("dbgeng.dll", ExactSpelling = true)]
static extern int DebugConnectWide(
    [MarshalAs(UnmanagedType.LPWStr)] string RemoteOptions,   // LPCWSTR
    ref Guid InterfaceId,   // GUID*
    IntPtr Interface   // void** out
);
<DllImport("dbgeng.dll", ExactSpelling:=True)>
Public Shared Function DebugConnectWide(
    <MarshalAs(UnmanagedType.LPWStr)> RemoteOptions As String,   ' LPCWSTR
    ByRef InterfaceId As Guid,   ' GUID*
    [Interface] As IntPtr   ' void** out
) As Integer
End Function
' RemoteOptions : LPCWSTR
' InterfaceId : GUID*
' Interface : void** out
Declare PtrSafe Function DebugConnectWide Lib "dbgeng" ( _
    ByVal RemoteOptions As LongPtr, _
    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

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

lib = Fiddle.dlopen('dbgeng.dll')
DebugConnectWide = Fiddle::Function.new(
  lib['DebugConnectWide'],
  [
    Fiddle::TYPE_VOIDP,  # RemoteOptions : LPCWSTR
    Fiddle::TYPE_VOIDP,  # InterfaceId : GUID*
    Fiddle::TYPE_VOIDP,  # Interface : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "dbgeng")]
extern "system" {
    fn DebugConnectWide(
        RemoteOptions: *const u16,  // LPCWSTR
        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 DebugConnectWide([MarshalAs(UnmanagedType.LPWStr)] string RemoteOptions, ref Guid InterfaceId, IntPtr Interface);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbgeng_DebugConnectWide' -Namespace Win32 -PassThru
# $api::DebugConnectWide(RemoteOptions, InterfaceId, Interface)
#uselib "dbgeng.dll"
#func global DebugConnectWide "DebugConnectWide" sptr, sptr, sptr
; DebugConnectWide RemoteOptions, varptr(InterfaceId), Interface   ; 戻り値は stat
; RemoteOptions : LPCWSTR -> "sptr"
; InterfaceId : GUID* -> "sptr"
; Interface : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "dbgeng.dll"
#cfunc global DebugConnectWide "DebugConnectWide" wstr, var, sptr
; res = DebugConnectWide(RemoteOptions, InterfaceId, Interface)
; RemoteOptions : LPCWSTR -> "wstr"
; InterfaceId : GUID* -> "var"
; Interface : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT DebugConnectWide(LPCWSTR RemoteOptions, GUID* InterfaceId, void** Interface)
#uselib "dbgeng.dll"
#cfunc global DebugConnectWide "DebugConnectWide" wstr, var, intptr
; res = DebugConnectWide(RemoteOptions, InterfaceId, Interface)
; RemoteOptions : LPCWSTR -> "wstr"
; InterfaceId : GUID* -> "var"
; Interface : void** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dbgeng = windows.NewLazySystemDLL("dbgeng.dll")
	procDebugConnectWide = dbgeng.NewProc("DebugConnectWide")
)

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