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

SymSrvStoreSupplementW

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

シグネチャ

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

LPWSTR SymSrvStoreSupplementW(
    HANDLE hProcess,
    LPCWSTR SymPath,   // optional
    LPCWSTR Node,
    LPCWSTR File,
    DWORD Flags
);

パラメーター

名前方向
hProcessHANDLEin
SymPathLPCWSTRinoptional
NodeLPCWSTRin
FileLPCWSTRin
FlagsDWORDin

戻り値の型: LPWSTR

各言語での呼び出し定義

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

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

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

lib = Fiddle.dlopen('dbghelp.dll')
SymSrvStoreSupplementW = Fiddle::Function.new(
  lib['SymSrvStoreSupplementW'],
  [
    Fiddle::TYPE_VOIDP,  # hProcess : HANDLE
    Fiddle::TYPE_VOIDP,  # SymPath : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # Node : LPCWSTR
    Fiddle::TYPE_VOIDP,  # File : LPCWSTR
    -Fiddle::TYPE_INT,  # Flags : DWORD
  ],
  Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "dbghelp")]
extern "system" {
    fn SymSrvStoreSupplementW(
        hProcess: *mut core::ffi::c_void,  // HANDLE
        SymPath: *const u16,  // LPCWSTR optional
        Node: *const u16,  // LPCWSTR
        File: *const u16,  // LPCWSTR
        Flags: u32  // DWORD
    ) -> *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 SymSrvStoreSupplementW(IntPtr hProcess, [MarshalAs(UnmanagedType.LPWStr)] string SymPath, [MarshalAs(UnmanagedType.LPWStr)] string Node, [MarshalAs(UnmanagedType.LPWStr)] string File, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymSrvStoreSupplementW' -Namespace Win32 -PassThru
# $api::SymSrvStoreSupplementW(hProcess, SymPath, Node, File, Flags)
#uselib "dbghelp.dll"
#func global SymSrvStoreSupplementW "SymSrvStoreSupplementW" wptr, wptr, wptr, wptr, wptr
; SymSrvStoreSupplementW hProcess, SymPath, Node, File, Flags   ; 戻り値は stat
; hProcess : HANDLE -> "wptr"
; SymPath : LPCWSTR optional -> "wptr"
; Node : LPCWSTR -> "wptr"
; File : LPCWSTR -> "wptr"
; Flags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dbghelp.dll"
#cfunc global SymSrvStoreSupplementW "SymSrvStoreSupplementW" sptr, wstr, wstr, wstr, int
; res = SymSrvStoreSupplementW(hProcess, SymPath, Node, File, Flags)
; hProcess : HANDLE -> "sptr"
; SymPath : LPCWSTR optional -> "wstr"
; Node : LPCWSTR -> "wstr"
; File : LPCWSTR -> "wstr"
; Flags : DWORD -> "int"
; LPWSTR SymSrvStoreSupplementW(HANDLE hProcess, LPCWSTR SymPath, LPCWSTR Node, LPCWSTR File, DWORD Flags)
#uselib "dbghelp.dll"
#cfunc global SymSrvStoreSupplementW "SymSrvStoreSupplementW" intptr, wstr, wstr, wstr, int
; res = SymSrvStoreSupplementW(hProcess, SymPath, Node, File, Flags)
; hProcess : HANDLE -> "intptr"
; SymPath : LPCWSTR optional -> "wstr"
; Node : LPCWSTR -> "wstr"
; File : LPCWSTR -> "wstr"
; Flags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
	procSymSrvStoreSupplementW = dbghelp.NewProc("SymSrvStoreSupplementW")
)

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