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

SymSrvStoreFile

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

シグネチャ

// dbghelp.dll  (ANSI / -A)
#include <windows.h>

LPSTR SymSrvStoreFile(
    HANDLE hProcess,
    LPCSTR SrvPath,   // optional
    LPCSTR File,
    SYM_SRV_STORE_FILE_FLAGS Flags
);

パラメーター

名前方向
hProcessHANDLEin
SrvPathLPCSTRinoptional
FileLPCSTRin
FlagsSYM_SRV_STORE_FILE_FLAGSin

戻り値の型: LPSTR

各言語での呼び出し定義

// dbghelp.dll  (ANSI / -A)
#include <windows.h>

LPSTR SymSrvStoreFile(
    HANDLE hProcess,
    LPCSTR SrvPath,   // optional
    LPCSTR File,
    SYM_SRV_STORE_FILE_FLAGS Flags
);
[DllImport("dbghelp.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr SymSrvStoreFile(
    IntPtr hProcess,   // HANDLE
    [MarshalAs(UnmanagedType.LPStr)] string SrvPath,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string File,   // LPCSTR
    uint Flags   // SYM_SRV_STORE_FILE_FLAGS
);
<DllImport("dbghelp.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymSrvStoreFile(
    hProcess As IntPtr,   ' HANDLE
    <MarshalAs(UnmanagedType.LPStr)> SrvPath As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> File As String,   ' LPCSTR
    Flags As UInteger   ' SYM_SRV_STORE_FILE_FLAGS
) As IntPtr
End Function
' hProcess : HANDLE
' SrvPath : LPCSTR optional
' File : LPCSTR
' Flags : SYM_SRV_STORE_FILE_FLAGS
Declare PtrSafe Function SymSrvStoreFile Lib "dbghelp" ( _
    ByVal hProcess As LongPtr, _
    ByVal SrvPath As String, _
    ByVal File As String, _
    ByVal Flags As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SymSrvStoreFile = ctypes.windll.dbghelp.SymSrvStoreFile
SymSrvStoreFile.restype = wintypes.LPSTR
SymSrvStoreFile.argtypes = [
    wintypes.HANDLE,  # hProcess : HANDLE
    wintypes.LPCSTR,  # SrvPath : LPCSTR optional
    wintypes.LPCSTR,  # File : LPCSTR
    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')
SymSrvStoreFile = Fiddle::Function.new(
  lib['SymSrvStoreFile'],
  [
    Fiddle::TYPE_VOIDP,  # hProcess : HANDLE
    Fiddle::TYPE_VOIDP,  # SrvPath : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # File : LPCSTR
    -Fiddle::TYPE_INT,  # Flags : SYM_SRV_STORE_FILE_FLAGS
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "dbghelp")]
extern "system" {
    fn SymSrvStoreFile(
        hProcess: *mut core::ffi::c_void,  // HANDLE
        SrvPath: *const u8,  // LPCSTR optional
        File: *const u8,  // LPCSTR
        Flags: u32  // SYM_SRV_STORE_FILE_FLAGS
    ) -> *mut u8;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("dbghelp.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr SymSrvStoreFile(IntPtr hProcess, [MarshalAs(UnmanagedType.LPStr)] string SrvPath, [MarshalAs(UnmanagedType.LPStr)] string File, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymSrvStoreFile' -Namespace Win32 -PassThru
# $api::SymSrvStoreFile(hProcess, SrvPath, File, Flags)
#uselib "dbghelp.dll"
#func global SymSrvStoreFile "SymSrvStoreFile" sptr, sptr, sptr, sptr
; SymSrvStoreFile hProcess, SrvPath, File, Flags   ; 戻り値は stat
; hProcess : HANDLE -> "sptr"
; SrvPath : LPCSTR optional -> "sptr"
; File : LPCSTR -> "sptr"
; Flags : SYM_SRV_STORE_FILE_FLAGS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dbghelp.dll"
#cfunc global SymSrvStoreFile "SymSrvStoreFile" sptr, str, str, int
; res = SymSrvStoreFile(hProcess, SrvPath, File, Flags)
; hProcess : HANDLE -> "sptr"
; SrvPath : LPCSTR optional -> "str"
; File : LPCSTR -> "str"
; Flags : SYM_SRV_STORE_FILE_FLAGS -> "int"
; LPSTR SymSrvStoreFile(HANDLE hProcess, LPCSTR SrvPath, LPCSTR File, SYM_SRV_STORE_FILE_FLAGS Flags)
#uselib "dbghelp.dll"
#cfunc global SymSrvStoreFile "SymSrvStoreFile" intptr, str, str, int
; res = SymSrvStoreFile(hProcess, SrvPath, File, Flags)
; hProcess : HANDLE -> "intptr"
; SrvPath : LPCSTR optional -> "str"
; File : LPCSTR -> "str"
; Flags : SYM_SRV_STORE_FILE_FLAGS -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
	procSymSrvStoreFile = dbghelp.NewProc("SymSrvStoreFile")
)

// hProcess (HANDLE), SrvPath (LPCSTR optional), File (LPCSTR), Flags (SYM_SRV_STORE_FILE_FLAGS)
r1, _, err := procSymSrvStoreFile.Call(
	uintptr(hProcess),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(SrvPath))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(File))),
	uintptr(Flags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // LPSTR
function SymSrvStoreFile(
  hProcess: THandle;   // HANDLE
  SrvPath: PAnsiChar;   // LPCSTR optional
  File: PAnsiChar;   // LPCSTR
  Flags: DWORD   // SYM_SRV_STORE_FILE_FLAGS
): PAnsiChar; stdcall;
  external 'dbghelp.dll' name 'SymSrvStoreFile';
result := DllCall("dbghelp\SymSrvStoreFile"
    , "Ptr", hProcess   ; HANDLE
    , "AStr", SrvPath   ; LPCSTR optional
    , "AStr", File   ; LPCSTR
    , "UInt", Flags   ; SYM_SRV_STORE_FILE_FLAGS
    , "Ptr")   ; return: LPSTR
●SymSrvStoreFile(hProcess, SrvPath, File, Flags) = DLL("dbghelp.dll", "char* SymSrvStoreFile(void*, char*, char*, dword)")
# 呼び出し: SymSrvStoreFile(hProcess, SrvPath, File, Flags)
# hProcess : HANDLE -> "void*"
# SrvPath : LPCSTR optional -> "char*"
# File : LPCSTR -> "char*"
# Flags : SYM_SRV_STORE_FILE_FLAGS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。