Win32 API 日本語リファレンス
ホームWeb.InternetExplorer › RatingAddToApprovedSites

RatingAddToApprovedSites

関数
コンテンツアドバイザの承認済みサイト一覧に指定URLを追加する。
DLLMSRATING.dll呼出規約winapi

シグネチャ

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

HRESULT RatingAddToApprovedSites(
    HWND hDlg,
    DWORD cbPasswordBlob,
    BYTE* pbPasswordBlob,
    LPCWSTR lpszUrl,
    BOOL fAlwaysNever,
    BOOL fSitePage,
    BOOL fApprovedSitesEnforced
);

パラメーター

名前方向説明
hDlgHWNDin確認ダイアログ等の親となるウィンドウのハンドルを指定する。
cbPasswordBlobDWORDinpbPasswordBlobのサイズをバイト単位で指定する。
pbPasswordBlobBYTE*inout監督者パスワードを格納したバイナリブロブへのポインタを指定する。
lpszUrlLPCWSTRin承認済みサイト一覧に追加するURLを指すワイド文字列を指定する。
fAlwaysNeverBOOLin常に許可(TRUE)か常に拒否(FALSE)かを指定するブール値。
fSitePageBOOLinサイト全体(TRUE)か特定ページのみ(FALSE)かを指定するブール値。
fApprovedSitesEnforcedBOOLin承認済みサイト制限を強制適用するかを指定するブール値。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RatingAddToApprovedSites(
    HWND hDlg,
    DWORD cbPasswordBlob,
    BYTE* pbPasswordBlob,
    LPCWSTR lpszUrl,
    BOOL fAlwaysNever,
    BOOL fSitePage,
    BOOL fApprovedSitesEnforced
);
[DllImport("MSRATING.dll", ExactSpelling = true)]
static extern int RatingAddToApprovedSites(
    IntPtr hDlg,   // HWND
    uint cbPasswordBlob,   // DWORD
    IntPtr pbPasswordBlob,   // BYTE* in/out
    [MarshalAs(UnmanagedType.LPWStr)] string lpszUrl,   // LPCWSTR
    bool fAlwaysNever,   // BOOL
    bool fSitePage,   // BOOL
    bool fApprovedSitesEnforced   // BOOL
);
<DllImport("MSRATING.dll", ExactSpelling:=True)>
Public Shared Function RatingAddToApprovedSites(
    hDlg As IntPtr,   ' HWND
    cbPasswordBlob As UInteger,   ' DWORD
    pbPasswordBlob As IntPtr,   ' BYTE* in/out
    <MarshalAs(UnmanagedType.LPWStr)> lpszUrl As String,   ' LPCWSTR
    fAlwaysNever As Boolean,   ' BOOL
    fSitePage As Boolean,   ' BOOL
    fApprovedSitesEnforced As Boolean   ' BOOL
) As Integer
End Function
' hDlg : HWND
' cbPasswordBlob : DWORD
' pbPasswordBlob : BYTE* in/out
' lpszUrl : LPCWSTR
' fAlwaysNever : BOOL
' fSitePage : BOOL
' fApprovedSitesEnforced : BOOL
Declare PtrSafe Function RatingAddToApprovedSites Lib "msrating" ( _
    ByVal hDlg As LongPtr, _
    ByVal cbPasswordBlob As Long, _
    ByVal pbPasswordBlob As LongPtr, _
    ByVal lpszUrl As LongPtr, _
    ByVal fAlwaysNever As Long, _
    ByVal fSitePage As Long, _
    ByVal fApprovedSitesEnforced As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RatingAddToApprovedSites = ctypes.windll.msrating.RatingAddToApprovedSites
RatingAddToApprovedSites.restype = ctypes.c_int
RatingAddToApprovedSites.argtypes = [
    wintypes.HANDLE,  # hDlg : HWND
    wintypes.DWORD,  # cbPasswordBlob : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # pbPasswordBlob : BYTE* in/out
    wintypes.LPCWSTR,  # lpszUrl : LPCWSTR
    wintypes.BOOL,  # fAlwaysNever : BOOL
    wintypes.BOOL,  # fSitePage : BOOL
    wintypes.BOOL,  # fApprovedSitesEnforced : BOOL
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MSRATING.dll')
RatingAddToApprovedSites = Fiddle::Function.new(
  lib['RatingAddToApprovedSites'],
  [
    Fiddle::TYPE_VOIDP,  # hDlg : HWND
    -Fiddle::TYPE_INT,  # cbPasswordBlob : DWORD
    Fiddle::TYPE_VOIDP,  # pbPasswordBlob : BYTE* in/out
    Fiddle::TYPE_VOIDP,  # lpszUrl : LPCWSTR
    Fiddle::TYPE_INT,  # fAlwaysNever : BOOL
    Fiddle::TYPE_INT,  # fSitePage : BOOL
    Fiddle::TYPE_INT,  # fApprovedSitesEnforced : BOOL
  ],
  Fiddle::TYPE_INT)
#[link(name = "msrating")]
extern "system" {
    fn RatingAddToApprovedSites(
        hDlg: *mut core::ffi::c_void,  // HWND
        cbPasswordBlob: u32,  // DWORD
        pbPasswordBlob: *mut u8,  // BYTE* in/out
        lpszUrl: *const u16,  // LPCWSTR
        fAlwaysNever: i32,  // BOOL
        fSitePage: i32,  // BOOL
        fApprovedSitesEnforced: i32  // BOOL
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MSRATING.dll")]
public static extern int RatingAddToApprovedSites(IntPtr hDlg, uint cbPasswordBlob, IntPtr pbPasswordBlob, [MarshalAs(UnmanagedType.LPWStr)] string lpszUrl, bool fAlwaysNever, bool fSitePage, bool fApprovedSitesEnforced);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSRATING_RatingAddToApprovedSites' -Namespace Win32 -PassThru
# $api::RatingAddToApprovedSites(hDlg, cbPasswordBlob, pbPasswordBlob, lpszUrl, fAlwaysNever, fSitePage, fApprovedSitesEnforced)
#uselib "MSRATING.dll"
#func global RatingAddToApprovedSites "RatingAddToApprovedSites" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; RatingAddToApprovedSites hDlg, cbPasswordBlob, varptr(pbPasswordBlob), lpszUrl, fAlwaysNever, fSitePage, fApprovedSitesEnforced   ; 戻り値は stat
; hDlg : HWND -> "sptr"
; cbPasswordBlob : DWORD -> "sptr"
; pbPasswordBlob : BYTE* in/out -> "sptr"
; lpszUrl : LPCWSTR -> "sptr"
; fAlwaysNever : BOOL -> "sptr"
; fSitePage : BOOL -> "sptr"
; fApprovedSitesEnforced : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MSRATING.dll"
#cfunc global RatingAddToApprovedSites "RatingAddToApprovedSites" sptr, int, var, wstr, int, int, int
; res = RatingAddToApprovedSites(hDlg, cbPasswordBlob, pbPasswordBlob, lpszUrl, fAlwaysNever, fSitePage, fApprovedSitesEnforced)
; hDlg : HWND -> "sptr"
; cbPasswordBlob : DWORD -> "int"
; pbPasswordBlob : BYTE* in/out -> "var"
; lpszUrl : LPCWSTR -> "wstr"
; fAlwaysNever : BOOL -> "int"
; fSitePage : BOOL -> "int"
; fApprovedSitesEnforced : BOOL -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT RatingAddToApprovedSites(HWND hDlg, DWORD cbPasswordBlob, BYTE* pbPasswordBlob, LPCWSTR lpszUrl, BOOL fAlwaysNever, BOOL fSitePage, BOOL fApprovedSitesEnforced)
#uselib "MSRATING.dll"
#cfunc global RatingAddToApprovedSites "RatingAddToApprovedSites" intptr, int, var, wstr, int, int, int
; res = RatingAddToApprovedSites(hDlg, cbPasswordBlob, pbPasswordBlob, lpszUrl, fAlwaysNever, fSitePage, fApprovedSitesEnforced)
; hDlg : HWND -> "intptr"
; cbPasswordBlob : DWORD -> "int"
; pbPasswordBlob : BYTE* in/out -> "var"
; lpszUrl : LPCWSTR -> "wstr"
; fAlwaysNever : BOOL -> "int"
; fSitePage : BOOL -> "int"
; fApprovedSitesEnforced : BOOL -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msrating = windows.NewLazySystemDLL("MSRATING.dll")
	procRatingAddToApprovedSites = msrating.NewProc("RatingAddToApprovedSites")
)

// hDlg (HWND), cbPasswordBlob (DWORD), pbPasswordBlob (BYTE* in/out), lpszUrl (LPCWSTR), fAlwaysNever (BOOL), fSitePage (BOOL), fApprovedSitesEnforced (BOOL)
r1, _, err := procRatingAddToApprovedSites.Call(
	uintptr(hDlg),
	uintptr(cbPasswordBlob),
	uintptr(pbPasswordBlob),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszUrl))),
	uintptr(fAlwaysNever),
	uintptr(fSitePage),
	uintptr(fApprovedSitesEnforced),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RatingAddToApprovedSites(
  hDlg: THandle;   // HWND
  cbPasswordBlob: DWORD;   // DWORD
  pbPasswordBlob: Pointer;   // BYTE* in/out
  lpszUrl: PWideChar;   // LPCWSTR
  fAlwaysNever: BOOL;   // BOOL
  fSitePage: BOOL;   // BOOL
  fApprovedSitesEnforced: BOOL   // BOOL
): Integer; stdcall;
  external 'MSRATING.dll' name 'RatingAddToApprovedSites';
result := DllCall("MSRATING\RatingAddToApprovedSites"
    , "Ptr", hDlg   ; HWND
    , "UInt", cbPasswordBlob   ; DWORD
    , "Ptr", pbPasswordBlob   ; BYTE* in/out
    , "WStr", lpszUrl   ; LPCWSTR
    , "Int", fAlwaysNever   ; BOOL
    , "Int", fSitePage   ; BOOL
    , "Int", fApprovedSitesEnforced   ; BOOL
    , "Int")   ; return: HRESULT
●RatingAddToApprovedSites(hDlg, cbPasswordBlob, pbPasswordBlob, lpszUrl, fAlwaysNever, fSitePage, fApprovedSitesEnforced) = DLL("MSRATING.dll", "int RatingAddToApprovedSites(void*, dword, void*, char*, bool, bool, bool)")
# 呼び出し: RatingAddToApprovedSites(hDlg, cbPasswordBlob, pbPasswordBlob, lpszUrl, fAlwaysNever, fSitePage, fApprovedSitesEnforced)
# hDlg : HWND -> "void*"
# cbPasswordBlob : DWORD -> "dword"
# pbPasswordBlob : BYTE* in/out -> "void*"
# lpszUrl : LPCWSTR -> "char*"
# fAlwaysNever : BOOL -> "bool"
# fSitePage : BOOL -> "bool"
# fApprovedSitesEnforced : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。