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

SymSetExtendedOption

関数
シンボルハンドラの拡張オプションの値を設定する。
DLLdbghelp.dll呼出規約winapi

シグネチャ

// dbghelp.dll
#include <windows.h>

BOOL SymSetExtendedOption(
    IMAGEHLP_EXTENDED_OPTIONS option,
    BOOL value
);

パラメーター

名前方向説明
optionIMAGEHLP_EXTENDED_OPTIONSin

オン/オフを切り替える拡張シンボルオプション。有効な値は次のとおりです。

Value Meaning
SYMOPT_EX_DISABLEACCESSTIMEUPDATE
0
TRUE に設定すると、読み込まれたシンボルの最終アクセス時刻を明示的に更新する動作を無効にします。既定では、DbgHelp は使用されたシンボルファイルの最終アクセス時刻を更新し、最近最も使用されていない (LRU) 方式でシンボルキャッシュを維持できるようにします。
valueBOOLin指定したオプションに設定する値。TRUE または FALSE のいずれかです。

戻り値の型: BOOL

公式ドキュメント

指定された拡張シンボルオプションのオン/オフを切り替えます。

戻り値

指定された拡張オプションの以前の値。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// dbghelp.dll
#include <windows.h>

BOOL SymSetExtendedOption(
    IMAGEHLP_EXTENDED_OPTIONS option,
    BOOL value
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", ExactSpelling = true)]
static extern bool SymSetExtendedOption(
    int option,   // IMAGEHLP_EXTENDED_OPTIONS
    bool value   // BOOL
);
<DllImport("dbghelp.dll", ExactSpelling:=True)>
Public Shared Function SymSetExtendedOption(
    [option] As Integer,   ' IMAGEHLP_EXTENDED_OPTIONS
    value As Boolean   ' BOOL
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' option : IMAGEHLP_EXTENDED_OPTIONS
' value : BOOL
Declare PtrSafe Function SymSetExtendedOption Lib "dbghelp" ( _
    ByVal option As Long, _
    ByVal value As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SymSetExtendedOption = ctypes.windll.dbghelp.SymSetExtendedOption
SymSetExtendedOption.restype = wintypes.BOOL
SymSetExtendedOption.argtypes = [
    ctypes.c_int,  # option : IMAGEHLP_EXTENDED_OPTIONS
    wintypes.BOOL,  # value : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('dbghelp.dll')
SymSetExtendedOption = Fiddle::Function.new(
  lib['SymSetExtendedOption'],
  [
    Fiddle::TYPE_INT,  # option : IMAGEHLP_EXTENDED_OPTIONS
    Fiddle::TYPE_INT,  # value : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "dbghelp")]
extern "system" {
    fn SymSetExtendedOption(
        option: i32,  // IMAGEHLP_EXTENDED_OPTIONS
        value: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll")]
public static extern bool SymSetExtendedOption(int option, bool value);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymSetExtendedOption' -Namespace Win32 -PassThru
# $api::SymSetExtendedOption(option, value)
#uselib "dbghelp.dll"
#func global SymSetExtendedOption "SymSetExtendedOption" sptr, sptr
; SymSetExtendedOption option, value   ; 戻り値は stat
; option : IMAGEHLP_EXTENDED_OPTIONS -> "sptr"
; value : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "dbghelp.dll"
#cfunc global SymSetExtendedOption "SymSetExtendedOption" int, int
; res = SymSetExtendedOption(option, value)
; option : IMAGEHLP_EXTENDED_OPTIONS -> "int"
; value : BOOL -> "int"
; BOOL SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value)
#uselib "dbghelp.dll"
#cfunc global SymSetExtendedOption "SymSetExtendedOption" int, int
; res = SymSetExtendedOption(option, value)
; option : IMAGEHLP_EXTENDED_OPTIONS -> "int"
; value : BOOL -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
	procSymSetExtendedOption = dbghelp.NewProc("SymSetExtendedOption")
)

// option (IMAGEHLP_EXTENDED_OPTIONS), value (BOOL)
r1, _, err := procSymSetExtendedOption.Call(
	uintptr(option),
	uintptr(value),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SymSetExtendedOption(
  option: Integer;   // IMAGEHLP_EXTENDED_OPTIONS
  value: BOOL   // BOOL
): BOOL; stdcall;
  external 'dbghelp.dll' name 'SymSetExtendedOption';
result := DllCall("dbghelp\SymSetExtendedOption"
    , "Int", option   ; IMAGEHLP_EXTENDED_OPTIONS
    , "Int", value   ; BOOL
    , "Int")   ; return: BOOL
●SymSetExtendedOption(option, value) = DLL("dbghelp.dll", "bool SymSetExtendedOption(int, bool)")
# 呼び出し: SymSetExtendedOption(option, value)
# option : IMAGEHLP_EXTENDED_OPTIONS -> "int"
# value : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "dbghelp" fn SymSetExtendedOption(
    option: i32, // IMAGEHLP_EXTENDED_OPTIONS
    value: i32 // BOOL
) callconv(std.os.windows.WINAPI) i32;
proc SymSetExtendedOption(
    option: int32,  # IMAGEHLP_EXTENDED_OPTIONS
    value: int32  # BOOL
): int32 {.importc: "SymSetExtendedOption", stdcall, dynlib: "dbghelp.dll".}
pragma(lib, "dbghelp");
extern(Windows)
int SymSetExtendedOption(
    int option,   // IMAGEHLP_EXTENDED_OPTIONS
    int value   // BOOL
);
ccall((:SymSetExtendedOption, "dbghelp.dll"), stdcall, Int32,
      (Int32, Int32),
      option, value)
# option : IMAGEHLP_EXTENDED_OPTIONS -> Int32
# value : BOOL -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t SymSetExtendedOption(
    int32_t option,
    int32_t value);
]]
local dbghelp = ffi.load("dbghelp")
-- dbghelp.SymSetExtendedOption(option, value)
-- option : IMAGEHLP_EXTENDED_OPTIONS
-- value : BOOL
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('dbghelp.dll');
const SymSetExtendedOption = lib.func('__stdcall', 'SymSetExtendedOption', 'int32_t', ['int32_t', 'int32_t']);
// SymSetExtendedOption(option, value)
// option : IMAGEHLP_EXTENDED_OPTIONS -> 'int32_t'
// value : BOOL -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("dbghelp.dll", {
  SymSetExtendedOption: { parameters: ["i32", "i32"], result: "i32" },
});
// lib.symbols.SymSetExtendedOption(option, value)
// option : IMAGEHLP_EXTENDED_OPTIONS -> "i32"
// value : BOOL -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t SymSetExtendedOption(
    int32_t option,
    int32_t value);
C, "dbghelp.dll");
// $ffi->SymSetExtendedOption(option, value);
// option : IMAGEHLP_EXTENDED_OPTIONS
// value : BOOL
// 構造体/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);
    boolean SymSetExtendedOption(
        int option,   // IMAGEHLP_EXTENDED_OPTIONS
        boolean value   // BOOL
    );
}
@[Link("dbghelp")]
lib Libdbghelp
  fun SymSetExtendedOption = SymSetExtendedOption(
    option : Int32,   # IMAGEHLP_EXTENDED_OPTIONS
    value : Int32   # BOOL
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SymSetExtendedOptionNative = Int32 Function(Int32, Int32);
typedef SymSetExtendedOptionDart = int Function(int, int);
final SymSetExtendedOption = DynamicLibrary.open('dbghelp.dll')
    .lookupFunction<SymSetExtendedOptionNative, SymSetExtendedOptionDart>('SymSetExtendedOption');
// option : IMAGEHLP_EXTENDED_OPTIONS -> Int32
// value : BOOL -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function SymSetExtendedOption(
  option: Integer;   // IMAGEHLP_EXTENDED_OPTIONS
  value: BOOL   // BOOL
): BOOL; stdcall;
  external 'dbghelp.dll' name 'SymSetExtendedOption';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SymSetExtendedOption"
  c_SymSetExtendedOption :: Int32 -> CInt -> IO CInt
-- option : IMAGEHLP_EXTENDED_OPTIONS -> Int32
-- value : BOOL -> CInt
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let symsetextendedoption =
  foreign "SymSetExtendedOption"
    (int32_t @-> int32_t @-> returning int32_t)
(* option : IMAGEHLP_EXTENDED_OPTIONS -> int32_t *)
(* value : BOOL -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library dbghelp (t "dbghelp.dll"))
(cffi:use-foreign-library dbghelp)

(cffi:defcfun ("SymSetExtendedOption" sym-set-extended-option :convention :stdcall) :int32
  (option :int32)   ; IMAGEHLP_EXTENDED_OPTIONS
  (value :int32))   ; BOOL
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SymSetExtendedOption = Win32::API::More->new('dbghelp',
    'BOOL SymSetExtendedOption(int option, BOOL value)');
# my $ret = $SymSetExtendedOption->Call($option, $value);
# option : IMAGEHLP_EXTENDED_OPTIONS -> int
# value : BOOL -> BOOL
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型