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

SymSrvGetSupplementW

関数
シンボルサーバーから補足ファイルを取得する(Unicode版)。
DLLdbghelp.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり

シグネチャ

// dbghelp.dll  (Unicode / -W)
#include <windows.h>

LPWSTR SymSrvGetSupplementW(
    HANDLE hProcess,
    LPCWSTR SymPath,   // optional
    LPCWSTR Node,
    LPCWSTR File
);

パラメーター

名前方向
hProcessHANDLEin
SymPathLPCWSTRinoptional
NodeLPCWSTRin
FileLPCWSTRin

戻り値の型: LPWSTR

各言語での呼び出し定義

// dbghelp.dll  (Unicode / -W)
#include <windows.h>

LPWSTR SymSrvGetSupplementW(
    HANDLE hProcess,
    LPCWSTR SymPath,   // optional
    LPCWSTR Node,
    LPCWSTR File
);
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern IntPtr SymSrvGetSupplementW(
    IntPtr hProcess,   // HANDLE
    [MarshalAs(UnmanagedType.LPWStr)] string SymPath,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string Node,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string File   // LPCWSTR
);
<DllImport("dbghelp.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymSrvGetSupplementW(
    hProcess As IntPtr,   ' HANDLE
    <MarshalAs(UnmanagedType.LPWStr)> SymPath As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> Node As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> File As String   ' LPCWSTR
) As IntPtr
End Function
' hProcess : HANDLE
' SymPath : LPCWSTR optional
' Node : LPCWSTR
' File : LPCWSTR
Declare PtrSafe Function SymSrvGetSupplementW Lib "dbghelp" ( _
    ByVal hProcess As LongPtr, _
    ByVal SymPath As LongPtr, _
    ByVal Node As LongPtr, _
    ByVal File As LongPtr) As LongPtr
' 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

SymSrvGetSupplementW = ctypes.windll.dbghelp.SymSrvGetSupplementW
SymSrvGetSupplementW.restype = wintypes.LPWSTR
SymSrvGetSupplementW.argtypes = [
    wintypes.HANDLE,  # hProcess : HANDLE
    wintypes.LPCWSTR,  # SymPath : LPCWSTR optional
    wintypes.LPCWSTR,  # Node : LPCWSTR
    wintypes.LPCWSTR,  # File : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dbghelp.dll')
SymSrvGetSupplementW = Fiddle::Function.new(
  lib['SymSrvGetSupplementW'],
  [
    Fiddle::TYPE_VOIDP,  # hProcess : HANDLE
    Fiddle::TYPE_VOIDP,  # SymPath : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # Node : LPCWSTR
    Fiddle::TYPE_VOIDP,  # File : LPCWSTR
  ],
  Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "dbghelp")]
extern "system" {
    fn SymSrvGetSupplementW(
        hProcess: *mut core::ffi::c_void,  // HANDLE
        SymPath: *const u16,  // LPCWSTR optional
        Node: *const u16,  // LPCWSTR
        File: *const u16  // LPCWSTR
    ) -> *mut u16;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr SymSrvGetSupplementW(IntPtr hProcess, [MarshalAs(UnmanagedType.LPWStr)] string SymPath, [MarshalAs(UnmanagedType.LPWStr)] string Node, [MarshalAs(UnmanagedType.LPWStr)] string File);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymSrvGetSupplementW' -Namespace Win32 -PassThru
# $api::SymSrvGetSupplementW(hProcess, SymPath, Node, File)
#uselib "dbghelp.dll"
#func global SymSrvGetSupplementW "SymSrvGetSupplementW" wptr, wptr, wptr, wptr
; SymSrvGetSupplementW hProcess, SymPath, Node, File   ; 戻り値は stat
; hProcess : HANDLE -> "wptr"
; SymPath : LPCWSTR optional -> "wptr"
; Node : LPCWSTR -> "wptr"
; File : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dbghelp.dll"
#cfunc global SymSrvGetSupplementW "SymSrvGetSupplementW" sptr, wstr, wstr, wstr
; res = SymSrvGetSupplementW(hProcess, SymPath, Node, File)
; hProcess : HANDLE -> "sptr"
; SymPath : LPCWSTR optional -> "wstr"
; Node : LPCWSTR -> "wstr"
; File : LPCWSTR -> "wstr"
; LPWSTR SymSrvGetSupplementW(HANDLE hProcess, LPCWSTR SymPath, LPCWSTR Node, LPCWSTR File)
#uselib "dbghelp.dll"
#cfunc global SymSrvGetSupplementW "SymSrvGetSupplementW" intptr, wstr, wstr, wstr
; res = SymSrvGetSupplementW(hProcess, SymPath, Node, File)
; hProcess : HANDLE -> "intptr"
; SymPath : LPCWSTR optional -> "wstr"
; Node : LPCWSTR -> "wstr"
; File : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
	procSymSrvGetSupplementW = dbghelp.NewProc("SymSrvGetSupplementW")
)

// hProcess (HANDLE), SymPath (LPCWSTR optional), Node (LPCWSTR), File (LPCWSTR)
r1, _, err := procSymSrvGetSupplementW.Call(
	uintptr(hProcess),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SymPath))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Node))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(File))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LPWSTR
function SymSrvGetSupplementW(
  hProcess: THandle;   // HANDLE
  SymPath: PWideChar;   // LPCWSTR optional
  Node: PWideChar;   // LPCWSTR
  File: PWideChar   // LPCWSTR
): PWideChar; stdcall;
  external 'dbghelp.dll' name 'SymSrvGetSupplementW';
result := DllCall("dbghelp\SymSrvGetSupplementW"
    , "Ptr", hProcess   ; HANDLE
    , "WStr", SymPath   ; LPCWSTR optional
    , "WStr", Node   ; LPCWSTR
    , "WStr", File   ; LPCWSTR
    , "Ptr")   ; return: LPWSTR
●SymSrvGetSupplementW(hProcess, SymPath, Node, File) = DLL("dbghelp.dll", "char* SymSrvGetSupplementW(void*, char*, char*, char*)")
# 呼び出し: SymSrvGetSupplementW(hProcess, SymPath, Node, File)
# hProcess : HANDLE -> "void*"
# SymPath : LPCWSTR optional -> "char*"
# Node : LPCWSTR -> "char*"
# File : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。