SymSrvIsStoreW
関数シグネチャ
// dbghelp.dll (Unicode / -W)
#include <windows.h>
BOOL SymSrvIsStoreW(
HANDLE hProcess, // optional
LPCWSTR path
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hProcess | HANDLE | inoptional | 以前に SymInitialize 関数に渡したプロセスのハンドル。このパラメーターを NULL に設定した場合、関数はストアが存在するかどうかのみを判定します。それ以外の場合、関数はストアが存在するかどうかに加えて、指定したプロセスハンドルに対応するプロセスエントリがストアに含まれているかどうかを判定します。 |
| path | LPCWSTR | in | シンボルストアへのパス。このパスには、既定のシンボルストア (例: SRV*) を指定したり、HTTP または HTTPS のシンボルサーバーを指したり、ストアへの UNC パス、絶対パス、または相対パスを指定したりできます。 |
戻り値の型: BOOL
公式ドキュメント
SymSrvIsStoreW (Unicode) 関数 (dbghelp.h) は、指定されたパスがシンボルストアを指しているかどうかを判定します。
戻り値
パスがシンボルストアを指している場合、関数は TRUE を返します。それ以外の場合は FALSE を返します。拡張エラー情報を取得するには、GetLastError 関数を呼び出します。
解説(Remarks)
パスが既定のシンボルストア (例: SRV*)、または HTTP もしくは HTTPS のシンボルサーバーを指している場合、関数はストアが存在するものとみなします。
クライアントコンピューターとサーバーの間にプロキシコンピューターが存在する場合、プロキシ上の SymSrv.dll のバージョンは、クライアント上のバージョンより古くてはなりません。
この関数を含むすべての DbgHelp 関数はシングルスレッドです。そのため、複数のスレッドからこの関数を呼び出すと、予期しない動作やメモリ破損が発生する可能性が高くなります。これを回避するには、複数のスレッドからこの関数への同時呼び出しをすべて同期する必要があります。
この関数の Unicode バージョンを呼び出すには、DBGHELP_TRANSLATE_TCHAR を定義します。
dbghelp.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして SymSrvIsStore を定義します。エンコーディング非依存のエイリアスの使用を、エンコーディング非依存でないコードと混在させると、コンパイルエラーや実行時エラーを引き起こす不一致が生じる可能性があります。詳細については、関数プロトタイプの規則を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// dbghelp.dll (Unicode / -W)
#include <windows.h>
BOOL SymSrvIsStoreW(
HANDLE hProcess, // optional
LPCWSTR path
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SymSrvIsStoreW(
IntPtr hProcess, // HANDLE optional
[MarshalAs(UnmanagedType.LPWStr)] string path // LPCWSTR
);<DllImport("dbghelp.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymSrvIsStoreW(
hProcess As IntPtr, ' HANDLE optional
<MarshalAs(UnmanagedType.LPWStr)> path As String ' LPCWSTR
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hProcess : HANDLE optional
' path : LPCWSTR
Declare PtrSafe Function SymSrvIsStoreW Lib "dbghelp" ( _
ByVal hProcess As LongPtr, _
ByVal path As LongPtr) As Long
' 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
SymSrvIsStoreW = ctypes.windll.dbghelp.SymSrvIsStoreW
SymSrvIsStoreW.restype = wintypes.BOOL
SymSrvIsStoreW.argtypes = [
wintypes.HANDLE, # hProcess : HANDLE optional
wintypes.LPCWSTR, # path : LPCWSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dbghelp.dll')
SymSrvIsStoreW = Fiddle::Function.new(
lib['SymSrvIsStoreW'],
[
Fiddle::TYPE_VOIDP, # hProcess : HANDLE optional
Fiddle::TYPE_VOIDP, # path : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "dbghelp")]
extern "system" {
fn SymSrvIsStoreW(
hProcess: *mut core::ffi::c_void, // HANDLE optional
path: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SymSrvIsStoreW(IntPtr hProcess, [MarshalAs(UnmanagedType.LPWStr)] string path);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymSrvIsStoreW' -Namespace Win32 -PassThru
# $api::SymSrvIsStoreW(hProcess, path)#uselib "dbghelp.dll"
#func global SymSrvIsStoreW "SymSrvIsStoreW" wptr, wptr
; SymSrvIsStoreW hProcess, path ; 戻り値は stat
; hProcess : HANDLE optional -> "wptr"
; path : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "dbghelp.dll"
#cfunc global SymSrvIsStoreW "SymSrvIsStoreW" sptr, wstr
; res = SymSrvIsStoreW(hProcess, path)
; hProcess : HANDLE optional -> "sptr"
; path : LPCWSTR -> "wstr"; BOOL SymSrvIsStoreW(HANDLE hProcess, LPCWSTR path)
#uselib "dbghelp.dll"
#cfunc global SymSrvIsStoreW "SymSrvIsStoreW" intptr, wstr
; res = SymSrvIsStoreW(hProcess, path)
; hProcess : HANDLE optional -> "intptr"
; path : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
procSymSrvIsStoreW = dbghelp.NewProc("SymSrvIsStoreW")
)
// hProcess (HANDLE optional), path (LPCWSTR)
r1, _, err := procSymSrvIsStoreW.Call(
uintptr(hProcess),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(path))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SymSrvIsStoreW(
hProcess: THandle; // HANDLE optional
path: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'dbghelp.dll' name 'SymSrvIsStoreW';result := DllCall("dbghelp\SymSrvIsStoreW"
, "Ptr", hProcess ; HANDLE optional
, "WStr", path ; LPCWSTR
, "Int") ; return: BOOL●SymSrvIsStoreW(hProcess, path) = DLL("dbghelp.dll", "bool SymSrvIsStoreW(void*, char*)")
# 呼び出し: SymSrvIsStoreW(hProcess, path)
# hProcess : HANDLE optional -> "void*"
# path : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "dbghelp" fn SymSrvIsStoreW(
hProcess: ?*anyopaque, // HANDLE optional
path: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc SymSrvIsStoreW(
hProcess: pointer, # HANDLE optional
path: WideCString # LPCWSTR
): int32 {.importc: "SymSrvIsStoreW", stdcall, dynlib: "dbghelp.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "dbghelp");
extern(Windows)
int SymSrvIsStoreW(
void* hProcess, // HANDLE optional
const(wchar)* path // LPCWSTR
);ccall((:SymSrvIsStoreW, "dbghelp.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring),
hProcess, path)
# hProcess : HANDLE optional -> Ptr{Cvoid}
# path : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t SymSrvIsStoreW(
void* hProcess,
const uint16_t* path);
]]
local dbghelp = ffi.load("dbghelp")
-- dbghelp.SymSrvIsStoreW(hProcess, path)
-- hProcess : HANDLE optional
-- path : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。const koffi = require('koffi');
const lib = koffi.load('dbghelp.dll');
const SymSrvIsStoreW = lib.func('__stdcall', 'SymSrvIsStoreW', 'int32_t', ['void *', 'str16']);
// SymSrvIsStoreW(hProcess, path)
// hProcess : HANDLE optional -> 'void *'
// path : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("dbghelp.dll", {
SymSrvIsStoreW: { parameters: ["pointer", "buffer"], result: "i32" },
});
// lib.symbols.SymSrvIsStoreW(hProcess, path)
// hProcess : HANDLE optional -> "pointer"
// path : LPCWSTR -> "buffer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t SymSrvIsStoreW(
void* hProcess,
const uint16_t* path);
C, "dbghelp.dll");
// $ffi->SymSrvIsStoreW(hProcess, path);
// hProcess : HANDLE optional
// path : LPCWSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Dbghelp extends StdCallLibrary {
Dbghelp INSTANCE = Native.load("dbghelp", Dbghelp.class, W32APIOptions.UNICODE_OPTIONS);
boolean SymSrvIsStoreW(
Pointer hProcess, // HANDLE optional
WString path // LPCWSTR
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("dbghelp")]
lib Libdbghelp
fun SymSrvIsStoreW = SymSrvIsStoreW(
hProcess : Void*, # HANDLE optional
path : UInt16* # LPCWSTR
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef SymSrvIsStoreWNative = Int32 Function(Pointer<Void>, Pointer<Utf16>);
typedef SymSrvIsStoreWDart = int Function(Pointer<Void>, Pointer<Utf16>);
final SymSrvIsStoreW = DynamicLibrary.open('dbghelp.dll')
.lookupFunction<SymSrvIsStoreWNative, SymSrvIsStoreWDart>('SymSrvIsStoreW');
// hProcess : HANDLE optional -> Pointer<Void>
// path : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function SymSrvIsStoreW(
hProcess: THandle; // HANDLE optional
path: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'dbghelp.dll' name 'SymSrvIsStoreW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "SymSrvIsStoreW"
c_SymSrvIsStoreW :: Ptr () -> CWString -> IO CInt
-- hProcess : HANDLE optional -> Ptr ()
-- path : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let symsrvisstorew =
foreign "SymSrvIsStoreW"
((ptr void) @-> (ptr uint16_t) @-> returning int32_t)
(* hProcess : HANDLE optional -> (ptr void) *)
(* path : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dbghelp (t "dbghelp.dll"))
(cffi:use-foreign-library dbghelp)
(cffi:defcfun ("SymSrvIsStoreW" sym-srv-is-store-w :convention :stdcall) :int32
(h-process :pointer) ; HANDLE optional
(path (:string :encoding :utf-16le))) ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $SymSrvIsStoreW = Win32::API::More->new('dbghelp',
'BOOL SymSrvIsStoreW(HANDLE hProcess, LPCWSTR path)');
# my $ret = $SymSrvIsStoreW->Call($hProcess, $path);
# hProcess : HANDLE optional -> HANDLE
# path : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。