Win32 API 日本語リファレンス
ホームNetworking.WinInet › InternetGetPerSiteCookieDecisionW

InternetGetPerSiteCookieDecisionW

関数
サイト別のCookie許可設定を取得する(Unicode版)。
DLLWININET.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// WININET.dll  (Unicode / -W)
#include <windows.h>

BOOL InternetGetPerSiteCookieDecisionW(
    LPCWSTR pchHostName,
    DWORD* pResult
);

パラメーター

名前方向
pchHostNameLPCWSTRin
pResultDWORD*out

戻り値の型: BOOL

各言語での呼び出し定義

// WININET.dll  (Unicode / -W)
#include <windows.h>

BOOL InternetGetPerSiteCookieDecisionW(
    LPCWSTR pchHostName,
    DWORD* pResult
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool InternetGetPerSiteCookieDecisionW(
    [MarshalAs(UnmanagedType.LPWStr)] string pchHostName,   // LPCWSTR
    out uint pResult   // DWORD* out
);
<DllImport("WININET.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function InternetGetPerSiteCookieDecisionW(
    <MarshalAs(UnmanagedType.LPWStr)> pchHostName As String,   ' LPCWSTR
    <Out> ByRef pResult As UInteger   ' DWORD* out
) As Boolean
End Function
' pchHostName : LPCWSTR
' pResult : DWORD* out
Declare PtrSafe Function InternetGetPerSiteCookieDecisionW Lib "wininet" ( _
    ByVal pchHostName As LongPtr, _
    ByRef pResult As Long) 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

InternetGetPerSiteCookieDecisionW = ctypes.windll.wininet.InternetGetPerSiteCookieDecisionW
InternetGetPerSiteCookieDecisionW.restype = wintypes.BOOL
InternetGetPerSiteCookieDecisionW.argtypes = [
    wintypes.LPCWSTR,  # pchHostName : LPCWSTR
    ctypes.POINTER(wintypes.DWORD),  # pResult : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
InternetGetPerSiteCookieDecisionW = Fiddle::Function.new(
  lib['InternetGetPerSiteCookieDecisionW'],
  [
    Fiddle::TYPE_VOIDP,  # pchHostName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pResult : DWORD* out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "wininet")]
extern "system" {
    fn InternetGetPerSiteCookieDecisionW(
        pchHostName: *const u16,  // LPCWSTR
        pResult: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Unicode)]
public static extern bool InternetGetPerSiteCookieDecisionW([MarshalAs(UnmanagedType.LPWStr)] string pchHostName, out uint pResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_InternetGetPerSiteCookieDecisionW' -Namespace Win32 -PassThru
# $api::InternetGetPerSiteCookieDecisionW(pchHostName, pResult)
#uselib "WININET.dll"
#func global InternetGetPerSiteCookieDecisionW "InternetGetPerSiteCookieDecisionW" wptr, wptr
; InternetGetPerSiteCookieDecisionW pchHostName, varptr(pResult)   ; 戻り値は stat
; pchHostName : LPCWSTR -> "wptr"
; pResult : DWORD* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WININET.dll"
#cfunc global InternetGetPerSiteCookieDecisionW "InternetGetPerSiteCookieDecisionW" wstr, var
; res = InternetGetPerSiteCookieDecisionW(pchHostName, pResult)
; pchHostName : LPCWSTR -> "wstr"
; pResult : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL InternetGetPerSiteCookieDecisionW(LPCWSTR pchHostName, DWORD* pResult)
#uselib "WININET.dll"
#cfunc global InternetGetPerSiteCookieDecisionW "InternetGetPerSiteCookieDecisionW" wstr, var
; res = InternetGetPerSiteCookieDecisionW(pchHostName, pResult)
; pchHostName : LPCWSTR -> "wstr"
; pResult : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procInternetGetPerSiteCookieDecisionW = wininet.NewProc("InternetGetPerSiteCookieDecisionW")
)

// pchHostName (LPCWSTR), pResult (DWORD* out)
r1, _, err := procInternetGetPerSiteCookieDecisionW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pchHostName))),
	uintptr(pResult),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function InternetGetPerSiteCookieDecisionW(
  pchHostName: PWideChar;   // LPCWSTR
  pResult: Pointer   // DWORD* out
): BOOL; stdcall;
  external 'WININET.dll' name 'InternetGetPerSiteCookieDecisionW';
result := DllCall("WININET\InternetGetPerSiteCookieDecisionW"
    , "WStr", pchHostName   ; LPCWSTR
    , "Ptr", pResult   ; DWORD* out
    , "Int")   ; return: BOOL
●InternetGetPerSiteCookieDecisionW(pchHostName, pResult) = DLL("WININET.dll", "bool InternetGetPerSiteCookieDecisionW(char*, void*)")
# 呼び出し: InternetGetPerSiteCookieDecisionW(pchHostName, pResult)
# pchHostName : LPCWSTR -> "char*"
# pResult : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。