ホーム › System.Diagnostics.Debug › SymMatchFileName
SymMatchFileName
関数ファイル名がパターンに一致するか比較照合する。
シグネチャ
// dbghelp.dll (ANSI / -A)
#include <windows.h>
BOOL SymMatchFileName(
LPCSTR FileName,
LPCSTR Match,
LPSTR* FileNameStop, // optional
LPSTR* MatchStop // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FileName | LPCSTR | in |
| Match | LPCSTR | in |
| FileNameStop | LPSTR* | outoptional |
| MatchStop | LPSTR* | outoptional |
戻り値の型: BOOL
各言語での呼び出し定義
// dbghelp.dll (ANSI / -A)
#include <windows.h>
BOOL SymMatchFileName(
LPCSTR FileName,
LPCSTR Match,
LPSTR* FileNameStop, // optional
LPSTR* MatchStop // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SymMatchFileName(
[MarshalAs(UnmanagedType.LPStr)] string FileName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string Match, // LPCSTR
IntPtr FileNameStop, // LPSTR* optional, out
IntPtr MatchStop // LPSTR* optional, out
);<DllImport("dbghelp.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymMatchFileName(
<MarshalAs(UnmanagedType.LPStr)> FileName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> Match As String, ' LPCSTR
FileNameStop As IntPtr, ' LPSTR* optional, out
MatchStop As IntPtr ' LPSTR* optional, out
) As Boolean
End Function' FileName : LPCSTR
' Match : LPCSTR
' FileNameStop : LPSTR* optional, out
' MatchStop : LPSTR* optional, out
Declare PtrSafe Function SymMatchFileName Lib "dbghelp" ( _
ByVal FileName As String, _
ByVal Match As String, _
ByVal FileNameStop As LongPtr, _
ByVal MatchStop As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SymMatchFileName = ctypes.windll.dbghelp.SymMatchFileName
SymMatchFileName.restype = wintypes.BOOL
SymMatchFileName.argtypes = [
wintypes.LPCSTR, # FileName : LPCSTR
wintypes.LPCSTR, # Match : LPCSTR
ctypes.c_void_p, # FileNameStop : LPSTR* optional, out
ctypes.c_void_p, # MatchStop : LPSTR* optional, out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dbghelp.dll')
SymMatchFileName = Fiddle::Function.new(
lib['SymMatchFileName'],
[
Fiddle::TYPE_VOIDP, # FileName : LPCSTR
Fiddle::TYPE_VOIDP, # Match : LPCSTR
Fiddle::TYPE_VOIDP, # FileNameStop : LPSTR* optional, out
Fiddle::TYPE_VOIDP, # MatchStop : LPSTR* optional, out
],
Fiddle::TYPE_INT)#[link(name = "dbghelp")]
extern "system" {
fn SymMatchFileName(
FileName: *const u8, // LPCSTR
Match: *const u8, // LPCSTR
FileNameStop: *mut *mut u8, // LPSTR* optional, out
MatchStop: *mut *mut u8 // LPSTR* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool SymMatchFileName([MarshalAs(UnmanagedType.LPStr)] string FileName, [MarshalAs(UnmanagedType.LPStr)] string Match, IntPtr FileNameStop, IntPtr MatchStop);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymMatchFileName' -Namespace Win32 -PassThru
# $api::SymMatchFileName(FileName, Match, FileNameStop, MatchStop)#uselib "dbghelp.dll"
#func global SymMatchFileName "SymMatchFileName" sptr, sptr, sptr, sptr
; SymMatchFileName FileName, Match, varptr(FileNameStop), varptr(MatchStop) ; 戻り値は stat
; FileName : LPCSTR -> "sptr"
; Match : LPCSTR -> "sptr"
; FileNameStop : LPSTR* optional, out -> "sptr"
; MatchStop : LPSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dbghelp.dll" #cfunc global SymMatchFileName "SymMatchFileName" str, str, var, var ; res = SymMatchFileName(FileName, Match, FileNameStop, MatchStop) ; FileName : LPCSTR -> "str" ; Match : LPCSTR -> "str" ; FileNameStop : LPSTR* optional, out -> "var" ; MatchStop : LPSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dbghelp.dll" #cfunc global SymMatchFileName "SymMatchFileName" str, str, sptr, sptr ; res = SymMatchFileName(FileName, Match, varptr(FileNameStop), varptr(MatchStop)) ; FileName : LPCSTR -> "str" ; Match : LPCSTR -> "str" ; FileNameStop : LPSTR* optional, out -> "sptr" ; MatchStop : LPSTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SymMatchFileName(LPCSTR FileName, LPCSTR Match, LPSTR* FileNameStop, LPSTR* MatchStop) #uselib "dbghelp.dll" #cfunc global SymMatchFileName "SymMatchFileName" str, str, var, var ; res = SymMatchFileName(FileName, Match, FileNameStop, MatchStop) ; FileName : LPCSTR -> "str" ; Match : LPCSTR -> "str" ; FileNameStop : LPSTR* optional, out -> "var" ; MatchStop : LPSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SymMatchFileName(LPCSTR FileName, LPCSTR Match, LPSTR* FileNameStop, LPSTR* MatchStop) #uselib "dbghelp.dll" #cfunc global SymMatchFileName "SymMatchFileName" str, str, intptr, intptr ; res = SymMatchFileName(FileName, Match, varptr(FileNameStop), varptr(MatchStop)) ; FileName : LPCSTR -> "str" ; Match : LPCSTR -> "str" ; FileNameStop : LPSTR* optional, out -> "intptr" ; MatchStop : LPSTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
procSymMatchFileName = dbghelp.NewProc("SymMatchFileName")
)
// FileName (LPCSTR), Match (LPCSTR), FileNameStop (LPSTR* optional, out), MatchStop (LPSTR* optional, out)
r1, _, err := procSymMatchFileName.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(FileName))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(Match))),
uintptr(FileNameStop),
uintptr(MatchStop),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SymMatchFileName(
FileName: PAnsiChar; // LPCSTR
Match: PAnsiChar; // LPCSTR
FileNameStop: PPAnsiChar; // LPSTR* optional, out
MatchStop: PPAnsiChar // LPSTR* optional, out
): BOOL; stdcall;
external 'dbghelp.dll' name 'SymMatchFileName';result := DllCall("dbghelp\SymMatchFileName"
, "AStr", FileName ; LPCSTR
, "AStr", Match ; LPCSTR
, "Ptr", FileNameStop ; LPSTR* optional, out
, "Ptr", MatchStop ; LPSTR* optional, out
, "Int") ; return: BOOL●SymMatchFileName(FileName, Match, FileNameStop, MatchStop) = DLL("dbghelp.dll", "bool SymMatchFileName(char*, char*, void*, void*)")
# 呼び出し: SymMatchFileName(FileName, Match, FileNameStop, MatchStop)
# FileName : LPCSTR -> "char*"
# Match : LPCSTR -> "char*"
# FileNameStop : LPSTR* optional, out -> "void*"
# MatchStop : LPSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。