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

InternetShowSecurityInfoByURL

関数
指定URLのセキュリティ情報ダイアログを表示する。
DLLWININET.dll文字セットANSI (-A)呼出規約winapi

シグネチャ

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

BOOL InternetShowSecurityInfoByURL(
    LPSTR lpszURL,
    HWND hwndParent
);

パラメーター

名前方向説明
lpszURLLPSTRinセキュリティ情報を表示する対象URLを指す文字列。
hwndParentHWNDin表示ダイアログの親ウィンドウのハンドル。

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL InternetShowSecurityInfoByURL(
    LPSTR lpszURL,
    HWND hwndParent
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool InternetShowSecurityInfoByURL(
    [MarshalAs(UnmanagedType.LPStr)] string lpszURL,   // LPSTR
    IntPtr hwndParent   // HWND
);
<DllImport("WININET.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function InternetShowSecurityInfoByURL(
    <MarshalAs(UnmanagedType.LPStr)> lpszURL As String,   ' LPSTR
    hwndParent As IntPtr   ' HWND
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' lpszURL : LPSTR
' hwndParent : HWND
Declare PtrSafe Function InternetShowSecurityInfoByURL Lib "wininet" ( _
    ByVal lpszURL As String, _
    ByVal hwndParent As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

InternetShowSecurityInfoByURL = ctypes.windll.wininet.InternetShowSecurityInfoByURL
InternetShowSecurityInfoByURL.restype = wintypes.BOOL
InternetShowSecurityInfoByURL.argtypes = [
    wintypes.LPCSTR,  # lpszURL : LPSTR
    wintypes.HANDLE,  # hwndParent : HWND
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WININET.dll')
InternetShowSecurityInfoByURL = Fiddle::Function.new(
  lib['InternetShowSecurityInfoByURL'],
  [
    Fiddle::TYPE_VOIDP,  # lpszURL : LPSTR
    Fiddle::TYPE_VOIDP,  # hwndParent : HWND
  ],
  Fiddle::TYPE_INT)
#[link(name = "wininet")]
extern "system" {
    fn InternetShowSecurityInfoByURL(
        lpszURL: *mut u8,  // LPSTR
        hwndParent: *mut core::ffi::c_void  // HWND
    ) -> 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 InternetShowSecurityInfoByURL([MarshalAs(UnmanagedType.LPStr)] string lpszURL, IntPtr hwndParent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_InternetShowSecurityInfoByURL' -Namespace Win32 -PassThru
# $api::InternetShowSecurityInfoByURL(lpszURL, hwndParent)
#uselib "WININET.dll"
#func global InternetShowSecurityInfoByURL "InternetShowSecurityInfoByURL" sptr, sptr
; InternetShowSecurityInfoByURL lpszURL, hwndParent   ; 戻り値は stat
; lpszURL : LPSTR -> "sptr"
; hwndParent : HWND -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WININET.dll"
#cfunc global InternetShowSecurityInfoByURL "InternetShowSecurityInfoByURL" str, sptr
; res = InternetShowSecurityInfoByURL(lpszURL, hwndParent)
; lpszURL : LPSTR -> "str"
; hwndParent : HWND -> "sptr"
; BOOL InternetShowSecurityInfoByURL(LPSTR lpszURL, HWND hwndParent)
#uselib "WININET.dll"
#cfunc global InternetShowSecurityInfoByURL "InternetShowSecurityInfoByURL" str, intptr
; res = InternetShowSecurityInfoByURL(lpszURL, hwndParent)
; lpszURL : LPSTR -> "str"
; hwndParent : HWND -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wininet = windows.NewLazySystemDLL("WININET.dll")
	procInternetShowSecurityInfoByURL = wininet.NewProc("InternetShowSecurityInfoByURL")
)

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

extern "wininet" fn InternetShowSecurityInfoByURL(
    lpszURL: [*c]const u8, // LPSTR
    hwndParent: ?*anyopaque // HWND
) callconv(std.os.windows.WINAPI) i32;
proc InternetShowSecurityInfoByURL(
    lpszURL: cstring,  # LPSTR
    hwndParent: pointer  # HWND
): int32 {.importc: "InternetShowSecurityInfoByURL", stdcall, dynlib: "WININET.dll".}
pragma(lib, "wininet");
extern(Windows)
int InternetShowSecurityInfoByURL(
    const(char)* lpszURL,   // LPSTR
    void* hwndParent   // HWND
);
ccall((:InternetShowSecurityInfoByURL, "WININET.dll"), stdcall, Int32,
      (Cstring, Ptr{Cvoid}),
      lpszURL, hwndParent)
# lpszURL : LPSTR -> Cstring
# hwndParent : HWND -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t InternetShowSecurityInfoByURL(
    const char* lpszURL,
    void* hwndParent);
]]
local wininet = ffi.load("wininet")
-- wininet.InternetShowSecurityInfoByURL(lpszURL, hwndParent)
-- lpszURL : LPSTR
-- hwndParent : HWND
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('WININET.dll');
const InternetShowSecurityInfoByURL = lib.func('__stdcall', 'InternetShowSecurityInfoByURL', 'int32_t', ['str', 'void *']);
// InternetShowSecurityInfoByURL(lpszURL, hwndParent)
// lpszURL : LPSTR -> 'str'
// hwndParent : HWND -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("WININET.dll", {
  InternetShowSecurityInfoByURL: { parameters: ["buffer", "pointer"], result: "i32" },
});
// lib.symbols.InternetShowSecurityInfoByURL(lpszURL, hwndParent)
// lpszURL : LPSTR -> "buffer"
// hwndParent : HWND -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t InternetShowSecurityInfoByURL(
    const char* lpszURL,
    void* hwndParent);
C, "WININET.dll");
// $ffi->InternetShowSecurityInfoByURL(lpszURL, hwndParent);
// lpszURL : LPSTR
// hwndParent : HWND
// 構造体/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 Wininet extends StdCallLibrary {
    Wininet INSTANCE = Native.load("wininet", Wininet.class, W32APIOptions.ASCII_OPTIONS);
    boolean InternetShowSecurityInfoByURL(
        String lpszURL,   // LPSTR
        Pointer hwndParent   // HWND
    );
}
@[Link("wininet")]
lib LibWININET
  fun InternetShowSecurityInfoByURL = InternetShowSecurityInfoByURL(
    lpszURL : UInt8*,   # LPSTR
    hwndParent : Void*   # HWND
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef InternetShowSecurityInfoByURLNative = Int32 Function(Pointer<Utf8>, Pointer<Void>);
typedef InternetShowSecurityInfoByURLDart = int Function(Pointer<Utf8>, Pointer<Void>);
final InternetShowSecurityInfoByURL = DynamicLibrary.open('WININET.dll')
    .lookupFunction<InternetShowSecurityInfoByURLNative, InternetShowSecurityInfoByURLDart>('InternetShowSecurityInfoByURL');
// lpszURL : LPSTR -> Pointer<Utf8>
// hwndParent : HWND -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function InternetShowSecurityInfoByURL(
  lpszURL: PAnsiChar;   // LPSTR
  hwndParent: THandle   // HWND
): BOOL; stdcall;
  external 'WININET.dll' name 'InternetShowSecurityInfoByURL';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "InternetShowSecurityInfoByURL"
  c_InternetShowSecurityInfoByURL :: CString -> Ptr () -> IO CInt
-- lpszURL : LPSTR -> CString
-- hwndParent : HWND -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let internetshowsecurityinfobyurl =
  foreign "InternetShowSecurityInfoByURL"
    (string @-> (ptr void) @-> returning int32_t)
(* lpszURL : LPSTR -> string *)
(* hwndParent : HWND -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wininet (t "WININET.dll"))
(cffi:use-foreign-library wininet)

(cffi:defcfun ("InternetShowSecurityInfoByURL" internet-show-security-info-by-url :convention :stdcall) :int32
  (lpsz-url :string)   ; LPSTR
  (hwnd-parent :pointer))   ; HWND
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $InternetShowSecurityInfoByURL = Win32::API::More->new('WININET',
    'BOOL InternetShowSecurityInfoByURL(LPCSTR lpszURL, HANDLE hwndParent)');
# my $ret = $InternetShowSecurityInfoByURL->Call($lpszURL, $hwndParent);
# lpszURL : LPSTR -> LPCSTR
# hwndParent : HWND -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

文字セット違い