ホーム › System.Diagnostics.Debug › SymSrvStoreFileW
SymSrvStoreFileW
関数シンボルサーバーにファイルを格納する(Unicode版)。
シグネチャ
// dbghelp.dll (Unicode / -W)
#include <windows.h>
LPWSTR SymSrvStoreFileW(
HANDLE hProcess,
LPCWSTR SrvPath, // optional
LPCWSTR File,
SYM_SRV_STORE_FILE_FLAGS Flags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProcess | HANDLE | in |
| SrvPath | LPCWSTR | inoptional |
| File | LPCWSTR | in |
| Flags | SYM_SRV_STORE_FILE_FLAGS | in |
戻り値の型: LPWSTR
各言語での呼び出し定義
// dbghelp.dll (Unicode / -W)
#include <windows.h>
LPWSTR SymSrvStoreFileW(
HANDLE hProcess,
LPCWSTR SrvPath, // optional
LPCWSTR File,
SYM_SRV_STORE_FILE_FLAGS Flags
);[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern IntPtr SymSrvStoreFileW(
IntPtr hProcess, // HANDLE
[MarshalAs(UnmanagedType.LPWStr)] string SrvPath, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string File, // LPCWSTR
uint Flags // SYM_SRV_STORE_FILE_FLAGS
);<DllImport("dbghelp.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymSrvStoreFileW(
hProcess As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPWStr)> SrvPath As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> File As String, ' LPCWSTR
Flags As UInteger ' SYM_SRV_STORE_FILE_FLAGS
) As IntPtr
End Function' hProcess : HANDLE
' SrvPath : LPCWSTR optional
' File : LPCWSTR
' Flags : SYM_SRV_STORE_FILE_FLAGS
Declare PtrSafe Function SymSrvStoreFileW Lib "dbghelp" ( _
ByVal hProcess As LongPtr, _
ByVal SrvPath 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
SymSrvStoreFileW = ctypes.windll.dbghelp.SymSrvStoreFileW
SymSrvStoreFileW.restype = wintypes.LPWSTR
SymSrvStoreFileW.argtypes = [
wintypes.HANDLE, # hProcess : HANDLE
wintypes.LPCWSTR, # SrvPath : LPCWSTR optional
wintypes.LPCWSTR, # File : LPCWSTR
wintypes.DWORD, # Flags : SYM_SRV_STORE_FILE_FLAGS
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dbghelp.dll')
SymSrvStoreFileW = Fiddle::Function.new(
lib['SymSrvStoreFileW'],
[
Fiddle::TYPE_VOIDP, # hProcess : HANDLE
Fiddle::TYPE_VOIDP, # SrvPath : LPCWSTR optional
Fiddle::TYPE_VOIDP, # File : LPCWSTR
-Fiddle::TYPE_INT, # Flags : SYM_SRV_STORE_FILE_FLAGS
],
Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "dbghelp")]
extern "system" {
fn SymSrvStoreFileW(
hProcess: *mut core::ffi::c_void, // HANDLE
SrvPath: *const u16, // LPCWSTR optional
File: *const u16, // LPCWSTR
Flags: u32 // SYM_SRV_STORE_FILE_FLAGS
) -> *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 SymSrvStoreFileW(IntPtr hProcess, [MarshalAs(UnmanagedType.LPWStr)] string SrvPath, [MarshalAs(UnmanagedType.LPWStr)] string File, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymSrvStoreFileW' -Namespace Win32 -PassThru
# $api::SymSrvStoreFileW(hProcess, SrvPath, File, Flags)#uselib "dbghelp.dll"
#func global SymSrvStoreFileW "SymSrvStoreFileW" wptr, wptr, wptr, wptr
; SymSrvStoreFileW hProcess, SrvPath, File, Flags ; 戻り値は stat
; hProcess : HANDLE -> "wptr"
; SrvPath : LPCWSTR optional -> "wptr"
; File : LPCWSTR -> "wptr"
; Flags : SYM_SRV_STORE_FILE_FLAGS -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "dbghelp.dll"
#cfunc global SymSrvStoreFileW "SymSrvStoreFileW" sptr, wstr, wstr, int
; res = SymSrvStoreFileW(hProcess, SrvPath, File, Flags)
; hProcess : HANDLE -> "sptr"
; SrvPath : LPCWSTR optional -> "wstr"
; File : LPCWSTR -> "wstr"
; Flags : SYM_SRV_STORE_FILE_FLAGS -> "int"; LPWSTR SymSrvStoreFileW(HANDLE hProcess, LPCWSTR SrvPath, LPCWSTR File, SYM_SRV_STORE_FILE_FLAGS Flags)
#uselib "dbghelp.dll"
#cfunc global SymSrvStoreFileW "SymSrvStoreFileW" intptr, wstr, wstr, int
; res = SymSrvStoreFileW(hProcess, SrvPath, File, Flags)
; hProcess : HANDLE -> "intptr"
; SrvPath : LPCWSTR optional -> "wstr"
; File : LPCWSTR -> "wstr"
; Flags : SYM_SRV_STORE_FILE_FLAGS -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
procSymSrvStoreFileW = dbghelp.NewProc("SymSrvStoreFileW")
)
// hProcess (HANDLE), SrvPath (LPCWSTR optional), File (LPCWSTR), Flags (SYM_SRV_STORE_FILE_FLAGS)
r1, _, err := procSymSrvStoreFileW.Call(
uintptr(hProcess),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(SrvPath))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(File))),
uintptr(Flags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // LPWSTRfunction SymSrvStoreFileW(
hProcess: THandle; // HANDLE
SrvPath: PWideChar; // LPCWSTR optional
File: PWideChar; // LPCWSTR
Flags: DWORD // SYM_SRV_STORE_FILE_FLAGS
): PWideChar; stdcall;
external 'dbghelp.dll' name 'SymSrvStoreFileW';result := DllCall("dbghelp\SymSrvStoreFileW"
, "Ptr", hProcess ; HANDLE
, "WStr", SrvPath ; LPCWSTR optional
, "WStr", File ; LPCWSTR
, "UInt", Flags ; SYM_SRV_STORE_FILE_FLAGS
, "Ptr") ; return: LPWSTR●SymSrvStoreFileW(hProcess, SrvPath, File, Flags) = DLL("dbghelp.dll", "char* SymSrvStoreFileW(void*, char*, char*, dword)")
# 呼び出し: SymSrvStoreFileW(hProcess, SrvPath, File, Flags)
# hProcess : HANDLE -> "void*"
# SrvPath : LPCWSTR optional -> "char*"
# File : LPCWSTR -> "char*"
# Flags : SYM_SRV_STORE_FILE_FLAGS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。