ホーム › Networking.WinInet › HttpIsHostHstsEnabled
HttpIsHostHstsEnabled
関数指定URLのホストでHSTSが有効かを判定する。
シグネチャ
// WININET.dll
#include <windows.h>
DWORD HttpIsHostHstsEnabled(
LPCWSTR pcwszUrl,
BOOL* pfIsHsts
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pcwszUrl | LPCWSTR | in |
| pfIsHsts | BOOL* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// WININET.dll
#include <windows.h>
DWORD HttpIsHostHstsEnabled(
LPCWSTR pcwszUrl,
BOOL* pfIsHsts
);[DllImport("WININET.dll", ExactSpelling = true)]
static extern uint HttpIsHostHstsEnabled(
[MarshalAs(UnmanagedType.LPWStr)] string pcwszUrl, // LPCWSTR
out int pfIsHsts // BOOL* out
);<DllImport("WININET.dll", ExactSpelling:=True)>
Public Shared Function HttpIsHostHstsEnabled(
<MarshalAs(UnmanagedType.LPWStr)> pcwszUrl As String, ' LPCWSTR
<Out> ByRef pfIsHsts As Integer ' BOOL* out
) As UInteger
End Function' pcwszUrl : LPCWSTR
' pfIsHsts : BOOL* out
Declare PtrSafe Function HttpIsHostHstsEnabled Lib "wininet" ( _
ByVal pcwszUrl As LongPtr, _
ByRef pfIsHsts As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HttpIsHostHstsEnabled = ctypes.windll.wininet.HttpIsHostHstsEnabled
HttpIsHostHstsEnabled.restype = wintypes.DWORD
HttpIsHostHstsEnabled.argtypes = [
wintypes.LPCWSTR, # pcwszUrl : LPCWSTR
ctypes.c_void_p, # pfIsHsts : BOOL* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
HttpIsHostHstsEnabled = Fiddle::Function.new(
lib['HttpIsHostHstsEnabled'],
[
Fiddle::TYPE_VOIDP, # pcwszUrl : LPCWSTR
Fiddle::TYPE_VOIDP, # pfIsHsts : BOOL* out
],
-Fiddle::TYPE_INT)#[link(name = "wininet")]
extern "system" {
fn HttpIsHostHstsEnabled(
pcwszUrl: *const u16, // LPCWSTR
pfIsHsts: *mut i32 // BOOL* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WININET.dll")]
public static extern uint HttpIsHostHstsEnabled([MarshalAs(UnmanagedType.LPWStr)] string pcwszUrl, out int pfIsHsts);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_HttpIsHostHstsEnabled' -Namespace Win32 -PassThru
# $api::HttpIsHostHstsEnabled(pcwszUrl, pfIsHsts)#uselib "WININET.dll"
#func global HttpIsHostHstsEnabled "HttpIsHostHstsEnabled" sptr, sptr
; HttpIsHostHstsEnabled pcwszUrl, pfIsHsts ; 戻り値は stat
; pcwszUrl : LPCWSTR -> "sptr"
; pfIsHsts : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global HttpIsHostHstsEnabled "HttpIsHostHstsEnabled" wstr, int
; res = HttpIsHostHstsEnabled(pcwszUrl, pfIsHsts)
; pcwszUrl : LPCWSTR -> "wstr"
; pfIsHsts : BOOL* out -> "int"; DWORD HttpIsHostHstsEnabled(LPCWSTR pcwszUrl, BOOL* pfIsHsts)
#uselib "WININET.dll"
#cfunc global HttpIsHostHstsEnabled "HttpIsHostHstsEnabled" wstr, int
; res = HttpIsHostHstsEnabled(pcwszUrl, pfIsHsts)
; pcwszUrl : LPCWSTR -> "wstr"
; pfIsHsts : BOOL* out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procHttpIsHostHstsEnabled = wininet.NewProc("HttpIsHostHstsEnabled")
)
// pcwszUrl (LPCWSTR), pfIsHsts (BOOL* out)
r1, _, err := procHttpIsHostHstsEnabled.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcwszUrl))),
uintptr(pfIsHsts),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction HttpIsHostHstsEnabled(
pcwszUrl: PWideChar; // LPCWSTR
pfIsHsts: Pointer // BOOL* out
): DWORD; stdcall;
external 'WININET.dll' name 'HttpIsHostHstsEnabled';result := DllCall("WININET\HttpIsHostHstsEnabled"
, "WStr", pcwszUrl ; LPCWSTR
, "Ptr", pfIsHsts ; BOOL* out
, "UInt") ; return: DWORD●HttpIsHostHstsEnabled(pcwszUrl, pfIsHsts) = DLL("WININET.dll", "dword HttpIsHostHstsEnabled(char*, void*)")
# 呼び出し: HttpIsHostHstsEnabled(pcwszUrl, pfIsHsts)
# pcwszUrl : LPCWSTR -> "char*"
# pfIsHsts : BOOL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。