Win32 API 日本語リファレンス
ホームSystem.Com.Urlmon › UrlMkGetSessionOption

UrlMkGetSessionOption

関数
URLモニカーセッションのオプション値を取得する。
DLLurlmon.dll呼出規約winapi

シグネチャ

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

HRESULT UrlMkGetSessionOption(
    DWORD dwOption,
    void* pBuffer,   // optional
    DWORD dwBufferLength,
    DWORD* pdwBufferLengthOut,
    DWORD dwReserved   // optional
);

パラメーター

名前方向
dwOptionDWORDin
pBuffervoid*outoptional
dwBufferLengthDWORDin
pdwBufferLengthOutDWORD*out
dwReservedDWORDoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT UrlMkGetSessionOption(
    DWORD dwOption,
    void* pBuffer,   // optional
    DWORD dwBufferLength,
    DWORD* pdwBufferLengthOut,
    DWORD dwReserved   // optional
);
[DllImport("urlmon.dll", ExactSpelling = true)]
static extern int UrlMkGetSessionOption(
    uint dwOption,   // DWORD
    IntPtr pBuffer,   // void* optional, out
    uint dwBufferLength,   // DWORD
    out uint pdwBufferLengthOut,   // DWORD* out
    uint dwReserved   // DWORD optional
);
<DllImport("urlmon.dll", ExactSpelling:=True)>
Public Shared Function UrlMkGetSessionOption(
    dwOption As UInteger,   ' DWORD
    pBuffer As IntPtr,   ' void* optional, out
    dwBufferLength As UInteger,   ' DWORD
    <Out> ByRef pdwBufferLengthOut As UInteger,   ' DWORD* out
    dwReserved As UInteger   ' DWORD optional
) As Integer
End Function
' dwOption : DWORD
' pBuffer : void* optional, out
' dwBufferLength : DWORD
' pdwBufferLengthOut : DWORD* out
' dwReserved : DWORD optional
Declare PtrSafe Function UrlMkGetSessionOption Lib "urlmon" ( _
    ByVal dwOption As Long, _
    ByVal pBuffer As LongPtr, _
    ByVal dwBufferLength As Long, _
    ByRef pdwBufferLengthOut As Long, _
    ByVal dwReserved As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

UrlMkGetSessionOption = ctypes.windll.urlmon.UrlMkGetSessionOption
UrlMkGetSessionOption.restype = ctypes.c_int
UrlMkGetSessionOption.argtypes = [
    wintypes.DWORD,  # dwOption : DWORD
    ctypes.POINTER(None),  # pBuffer : void* optional, out
    wintypes.DWORD,  # dwBufferLength : DWORD
    ctypes.POINTER(wintypes.DWORD),  # pdwBufferLengthOut : DWORD* out
    wintypes.DWORD,  # dwReserved : DWORD optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('urlmon.dll')
UrlMkGetSessionOption = Fiddle::Function.new(
  lib['UrlMkGetSessionOption'],
  [
    -Fiddle::TYPE_INT,  # dwOption : DWORD
    Fiddle::TYPE_VOIDP,  # pBuffer : void* optional, out
    -Fiddle::TYPE_INT,  # dwBufferLength : DWORD
    Fiddle::TYPE_VOIDP,  # pdwBufferLengthOut : DWORD* out
    -Fiddle::TYPE_INT,  # dwReserved : DWORD optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "urlmon")]
extern "system" {
    fn UrlMkGetSessionOption(
        dwOption: u32,  // DWORD
        pBuffer: *mut (),  // void* optional, out
        dwBufferLength: u32,  // DWORD
        pdwBufferLengthOut: *mut u32,  // DWORD* out
        dwReserved: u32  // DWORD optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("urlmon.dll")]
public static extern int UrlMkGetSessionOption(uint dwOption, IntPtr pBuffer, uint dwBufferLength, out uint pdwBufferLengthOut, uint dwReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'urlmon_UrlMkGetSessionOption' -Namespace Win32 -PassThru
# $api::UrlMkGetSessionOption(dwOption, pBuffer, dwBufferLength, pdwBufferLengthOut, dwReserved)
#uselib "urlmon.dll"
#func global UrlMkGetSessionOption "UrlMkGetSessionOption" sptr, sptr, sptr, sptr, sptr
; UrlMkGetSessionOption dwOption, pBuffer, dwBufferLength, varptr(pdwBufferLengthOut), dwReserved   ; 戻り値は stat
; dwOption : DWORD -> "sptr"
; pBuffer : void* optional, out -> "sptr"
; dwBufferLength : DWORD -> "sptr"
; pdwBufferLengthOut : DWORD* out -> "sptr"
; dwReserved : DWORD optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "urlmon.dll"
#cfunc global UrlMkGetSessionOption "UrlMkGetSessionOption" int, sptr, int, var, int
; res = UrlMkGetSessionOption(dwOption, pBuffer, dwBufferLength, pdwBufferLengthOut, dwReserved)
; dwOption : DWORD -> "int"
; pBuffer : void* optional, out -> "sptr"
; dwBufferLength : DWORD -> "int"
; pdwBufferLengthOut : DWORD* out -> "var"
; dwReserved : DWORD optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT UrlMkGetSessionOption(DWORD dwOption, void* pBuffer, DWORD dwBufferLength, DWORD* pdwBufferLengthOut, DWORD dwReserved)
#uselib "urlmon.dll"
#cfunc global UrlMkGetSessionOption "UrlMkGetSessionOption" int, intptr, int, var, int
; res = UrlMkGetSessionOption(dwOption, pBuffer, dwBufferLength, pdwBufferLengthOut, dwReserved)
; dwOption : DWORD -> "int"
; pBuffer : void* optional, out -> "intptr"
; dwBufferLength : DWORD -> "int"
; pdwBufferLengthOut : DWORD* out -> "var"
; dwReserved : DWORD optional -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	urlmon = windows.NewLazySystemDLL("urlmon.dll")
	procUrlMkGetSessionOption = urlmon.NewProc("UrlMkGetSessionOption")
)

// dwOption (DWORD), pBuffer (void* optional, out), dwBufferLength (DWORD), pdwBufferLengthOut (DWORD* out), dwReserved (DWORD optional)
r1, _, err := procUrlMkGetSessionOption.Call(
	uintptr(dwOption),
	uintptr(pBuffer),
	uintptr(dwBufferLength),
	uintptr(pdwBufferLengthOut),
	uintptr(dwReserved),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function UrlMkGetSessionOption(
  dwOption: DWORD;   // DWORD
  pBuffer: Pointer;   // void* optional, out
  dwBufferLength: DWORD;   // DWORD
  pdwBufferLengthOut: Pointer;   // DWORD* out
  dwReserved: DWORD   // DWORD optional
): Integer; stdcall;
  external 'urlmon.dll' name 'UrlMkGetSessionOption';
result := DllCall("urlmon\UrlMkGetSessionOption"
    , "UInt", dwOption   ; DWORD
    , "Ptr", pBuffer   ; void* optional, out
    , "UInt", dwBufferLength   ; DWORD
    , "Ptr", pdwBufferLengthOut   ; DWORD* out
    , "UInt", dwReserved   ; DWORD optional
    , "Int")   ; return: HRESULT
●UrlMkGetSessionOption(dwOption, pBuffer, dwBufferLength, pdwBufferLengthOut, dwReserved) = DLL("urlmon.dll", "int UrlMkGetSessionOption(dword, void*, dword, void*, dword)")
# 呼び出し: UrlMkGetSessionOption(dwOption, pBuffer, dwBufferLength, pdwBufferLengthOut, dwReserved)
# dwOption : DWORD -> "dword"
# pBuffer : void* optional, out -> "void*"
# dwBufferLength : DWORD -> "dword"
# pdwBufferLengthOut : DWORD* out -> "void*"
# dwReserved : DWORD optional -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。