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

InternetGetPerSiteCookieDecisionA

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

シグネチャ

// WININET.dll  (ANSI / -A)
#include <windows.h>

BOOL InternetGetPerSiteCookieDecisionA(
    LPCSTR pchHostName,
    DWORD* pResult
);

パラメーター

名前方向
pchHostNameLPCSTRin
pResultDWORD*out

戻り値の型: BOOL

各言語での呼び出し定義

// WININET.dll  (ANSI / -A)
#include <windows.h>

BOOL InternetGetPerSiteCookieDecisionA(
    LPCSTR pchHostName,
    DWORD* pResult
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool InternetGetPerSiteCookieDecisionA(
    [MarshalAs(UnmanagedType.LPStr)] string pchHostName,   // LPCSTR
    out uint pResult   // DWORD* out
);
<DllImport("WININET.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function InternetGetPerSiteCookieDecisionA(
    <MarshalAs(UnmanagedType.LPStr)> pchHostName As String,   ' LPCSTR
    <Out> ByRef pResult As UInteger   ' DWORD* out
) As Boolean
End Function
' pchHostName : LPCSTR
' pResult : DWORD* out
Declare PtrSafe Function InternetGetPerSiteCookieDecisionA Lib "wininet" ( _
    ByVal pchHostName As String, _
    ByRef pResult As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

lib = Fiddle.dlopen('WININET.dll')
InternetGetPerSiteCookieDecisionA = Fiddle::Function.new(
  lib['InternetGetPerSiteCookieDecisionA'],
  [
    Fiddle::TYPE_VOIDP,  # pchHostName : LPCSTR
    Fiddle::TYPE_VOIDP,  # pResult : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wininet")]
extern "system" {
    fn InternetGetPerSiteCookieDecisionA(
        pchHostName: *const u8,  // LPCSTR
        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.Ansi)]
public static extern bool InternetGetPerSiteCookieDecisionA([MarshalAs(UnmanagedType.LPStr)] string pchHostName, out uint pResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_InternetGetPerSiteCookieDecisionA' -Namespace Win32 -PassThru
# $api::InternetGetPerSiteCookieDecisionA(pchHostName, pResult)
#uselib "WININET.dll"
#func global InternetGetPerSiteCookieDecisionA "InternetGetPerSiteCookieDecisionA" sptr, sptr
; InternetGetPerSiteCookieDecisionA pchHostName, varptr(pResult)   ; 戻り値は stat
; pchHostName : LPCSTR -> "sptr"
; pResult : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WININET.dll"
#cfunc global InternetGetPerSiteCookieDecisionA "InternetGetPerSiteCookieDecisionA" str, var
; res = InternetGetPerSiteCookieDecisionA(pchHostName, pResult)
; pchHostName : LPCSTR -> "str"
; pResult : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL InternetGetPerSiteCookieDecisionA(LPCSTR pchHostName, DWORD* pResult)
#uselib "WININET.dll"
#cfunc global InternetGetPerSiteCookieDecisionA "InternetGetPerSiteCookieDecisionA" str, var
; res = InternetGetPerSiteCookieDecisionA(pchHostName, pResult)
; pchHostName : LPCSTR -> "str"
; pResult : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procInternetGetPerSiteCookieDecisionA = wininet.NewProc("InternetGetPerSiteCookieDecisionA")
)

// pchHostName (LPCSTR), pResult (DWORD* out)
r1, _, err := procInternetGetPerSiteCookieDecisionA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(pchHostName))),
	uintptr(pResult),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function InternetGetPerSiteCookieDecisionA(
  pchHostName: PAnsiChar;   // LPCSTR
  pResult: Pointer   // DWORD* out
): BOOL; stdcall;
  external 'WININET.dll' name 'InternetGetPerSiteCookieDecisionA';
result := DllCall("WININET\InternetGetPerSiteCookieDecisionA"
    , "AStr", pchHostName   ; LPCSTR
    , "Ptr", pResult   ; DWORD* out
    , "Int")   ; return: BOOL
●InternetGetPerSiteCookieDecisionA(pchHostName, pResult) = DLL("WININET.dll", "bool InternetGetPerSiteCookieDecisionA(char*, void*)")
# 呼び出し: InternetGetPerSiteCookieDecisionA(pchHostName, pResult)
# pchHostName : LPCSTR -> "char*"
# pResult : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。