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

RatingCheckUserAccessW

関数
ユーザのURLへのアクセス可否を評価で確認する(Unicode版)。
DLLMSRATING.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

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

HRESULT RatingCheckUserAccessW(
    LPCWSTR pszUsername,   // optional
    LPCWSTR pszURL,   // optional
    LPCWSTR pszRatingInfo,   // optional
    BYTE* pData,   // optional
    DWORD cbData,
    void** ppRatingDetails   // optional
);

パラメーター

名前方向説明
pszUsernameLPCWSTRinoptionalアクセス可否を判定する対象ユーザー名を指すワイド文字列を指定する。NULL可。
pszURLLPCWSTRinoptional評価対象となるコンテンツのURLを指すワイド文字列を指定する。
pszRatingInfoLPCWSTRinoptionalコンテンツの評価(レーティング)情報を指すワイド文字列を指定する。NULL可。
pDataBYTE*inoptional評価ラベル等の追加データを格納したバッファへのポインタを指定する。NULL可。
cbDataDWORDinpDataのサイズをバイト単位で指定する。
ppRatingDetailsvoid**outoptionalアクセス拒否時の評価詳細情報を受け取るポインタを指定する。後でRatingFreeDetailsで解放する。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RatingCheckUserAccessW(
    LPCWSTR pszUsername,   // optional
    LPCWSTR pszURL,   // optional
    LPCWSTR pszRatingInfo,   // optional
    BYTE* pData,   // optional
    DWORD cbData,
    void** ppRatingDetails   // optional
);
[DllImport("MSRATING.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RatingCheckUserAccessW(
    [MarshalAs(UnmanagedType.LPWStr)] string pszUsername,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string pszURL,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string pszRatingInfo,   // LPCWSTR optional
    IntPtr pData,   // BYTE* optional
    uint cbData,   // DWORD
    IntPtr ppRatingDetails   // void** optional, out
);
<DllImport("MSRATING.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RatingCheckUserAccessW(
    <MarshalAs(UnmanagedType.LPWStr)> pszUsername As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> pszURL As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> pszRatingInfo As String,   ' LPCWSTR optional
    pData As IntPtr,   ' BYTE* optional
    cbData As UInteger,   ' DWORD
    ppRatingDetails As IntPtr   ' void** optional, out
) As Integer
End Function
' pszUsername : LPCWSTR optional
' pszURL : LPCWSTR optional
' pszRatingInfo : LPCWSTR optional
' pData : BYTE* optional
' cbData : DWORD
' ppRatingDetails : void** optional, out
Declare PtrSafe Function RatingCheckUserAccessW Lib "msrating" ( _
    ByVal pszUsername As LongPtr, _
    ByVal pszURL As LongPtr, _
    ByVal pszRatingInfo As LongPtr, _
    ByVal pData As LongPtr, _
    ByVal cbData As Long, _
    ByVal ppRatingDetails As LongPtr) 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

RatingCheckUserAccessW = ctypes.windll.msrating.RatingCheckUserAccessW
RatingCheckUserAccessW.restype = ctypes.c_int
RatingCheckUserAccessW.argtypes = [
    wintypes.LPCWSTR,  # pszUsername : LPCWSTR optional
    wintypes.LPCWSTR,  # pszURL : LPCWSTR optional
    wintypes.LPCWSTR,  # pszRatingInfo : LPCWSTR optional
    ctypes.POINTER(ctypes.c_ubyte),  # pData : BYTE* optional
    wintypes.DWORD,  # cbData : DWORD
    ctypes.c_void_p,  # ppRatingDetails : void** optional, out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	msrating = windows.NewLazySystemDLL("MSRATING.dll")
	procRatingCheckUserAccessW = msrating.NewProc("RatingCheckUserAccessW")
)

// pszUsername (LPCWSTR optional), pszURL (LPCWSTR optional), pszRatingInfo (LPCWSTR optional), pData (BYTE* optional), cbData (DWORD), ppRatingDetails (void** optional, out)
r1, _, err := procRatingCheckUserAccessW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszUsername))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszURL))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszRatingInfo))),
	uintptr(pData),
	uintptr(cbData),
	uintptr(ppRatingDetails),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RatingCheckUserAccessW(
  pszUsername: PWideChar;   // LPCWSTR optional
  pszURL: PWideChar;   // LPCWSTR optional
  pszRatingInfo: PWideChar;   // LPCWSTR optional
  pData: Pointer;   // BYTE* optional
  cbData: DWORD;   // DWORD
  ppRatingDetails: Pointer   // void** optional, out
): Integer; stdcall;
  external 'MSRATING.dll' name 'RatingCheckUserAccessW';
result := DllCall("MSRATING\RatingCheckUserAccessW"
    , "WStr", pszUsername   ; LPCWSTR optional
    , "WStr", pszURL   ; LPCWSTR optional
    , "WStr", pszRatingInfo   ; LPCWSTR optional
    , "Ptr", pData   ; BYTE* optional
    , "UInt", cbData   ; DWORD
    , "Ptr", ppRatingDetails   ; void** optional, out
    , "Int")   ; return: HRESULT
●RatingCheckUserAccessW(pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails) = DLL("MSRATING.dll", "int RatingCheckUserAccessW(char*, char*, char*, void*, dword, void*)")
# 呼び出し: RatingCheckUserAccessW(pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails)
# pszUsername : LPCWSTR optional -> "char*"
# pszURL : LPCWSTR optional -> "char*"
# pszRatingInfo : LPCWSTR optional -> "char*"
# pData : BYTE* optional -> "void*"
# cbData : DWORD -> "dword"
# ppRatingDetails : void** optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "msrating" fn RatingCheckUserAccessW(
    pszUsername: [*c]const u16, // LPCWSTR optional
    pszURL: [*c]const u16, // LPCWSTR optional
    pszRatingInfo: [*c]const u16, // LPCWSTR optional
    pData: [*c]u8, // BYTE* optional
    cbData: u32, // DWORD
    ppRatingDetails: ?*anyopaque // void** optional, out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc RatingCheckUserAccessW(
    pszUsername: WideCString,  # LPCWSTR optional
    pszURL: WideCString,  # LPCWSTR optional
    pszRatingInfo: WideCString,  # LPCWSTR optional
    pData: ptr uint8,  # BYTE* optional
    cbData: uint32,  # DWORD
    ppRatingDetails: pointer  # void** optional, out
): int32 {.importc: "RatingCheckUserAccessW", stdcall, dynlib: "MSRATING.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "msrating");
extern(Windows)
int RatingCheckUserAccessW(
    const(wchar)* pszUsername,   // LPCWSTR optional
    const(wchar)* pszURL,   // LPCWSTR optional
    const(wchar)* pszRatingInfo,   // LPCWSTR optional
    ubyte* pData,   // BYTE* optional
    uint cbData,   // DWORD
    void** ppRatingDetails   // void** optional, out
);
ccall((:RatingCheckUserAccessW, "MSRATING.dll"), stdcall, Int32,
      (Cwstring, Cwstring, Cwstring, Ptr{UInt8}, UInt32, Ptr{Cvoid}),
      pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails)
# pszUsername : LPCWSTR optional -> Cwstring
# pszURL : LPCWSTR optional -> Cwstring
# pszRatingInfo : LPCWSTR optional -> Cwstring
# pData : BYTE* optional -> Ptr{UInt8}
# cbData : DWORD -> UInt32
# ppRatingDetails : void** optional, out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t RatingCheckUserAccessW(
    const uint16_t* pszUsername,
    const uint16_t* pszURL,
    const uint16_t* pszRatingInfo,
    uint8_t* pData,
    uint32_t cbData,
    void** ppRatingDetails);
]]
local msrating = ffi.load("msrating")
-- msrating.RatingCheckUserAccessW(pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails)
-- pszUsername : LPCWSTR optional
-- pszURL : LPCWSTR optional
-- pszRatingInfo : LPCWSTR optional
-- pData : BYTE* optional
-- cbData : DWORD
-- ppRatingDetails : void** optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('MSRATING.dll');
const RatingCheckUserAccessW = lib.func('__stdcall', 'RatingCheckUserAccessW', 'int32_t', ['str16', 'str16', 'str16', 'uint8_t *', 'uint32_t', 'void *']);
// RatingCheckUserAccessW(pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails)
// pszUsername : LPCWSTR optional -> 'str16'
// pszURL : LPCWSTR optional -> 'str16'
// pszRatingInfo : LPCWSTR optional -> 'str16'
// pData : BYTE* optional -> 'uint8_t *'
// cbData : DWORD -> 'uint32_t'
// ppRatingDetails : void** optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MSRATING.dll", {
  RatingCheckUserAccessW: { parameters: ["buffer", "buffer", "buffer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.RatingCheckUserAccessW(pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails)
// pszUsername : LPCWSTR optional -> "buffer"
// pszURL : LPCWSTR optional -> "buffer"
// pszRatingInfo : LPCWSTR optional -> "buffer"
// pData : BYTE* optional -> "pointer"
// cbData : DWORD -> "u32"
// ppRatingDetails : void** optional, out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RatingCheckUserAccessW(
    const uint16_t* pszUsername,
    const uint16_t* pszURL,
    const uint16_t* pszRatingInfo,
    uint8_t* pData,
    uint32_t cbData,
    void** ppRatingDetails);
C, "MSRATING.dll");
// $ffi->RatingCheckUserAccessW(pszUsername, pszURL, pszRatingInfo, pData, cbData, ppRatingDetails);
// pszUsername : LPCWSTR optional
// pszURL : LPCWSTR optional
// pszRatingInfo : LPCWSTR optional
// pData : BYTE* optional
// cbData : DWORD
// ppRatingDetails : void** optional, out
// 構造体/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 Msrating extends StdCallLibrary {
    Msrating INSTANCE = Native.load("msrating", Msrating.class, W32APIOptions.UNICODE_OPTIONS);
    int RatingCheckUserAccessW(
        WString pszUsername,   // LPCWSTR optional
        WString pszURL,   // LPCWSTR optional
        WString pszRatingInfo,   // LPCWSTR optional
        byte[] pData,   // BYTE* optional
        int cbData,   // DWORD
        Pointer ppRatingDetails   // void** optional, out
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("msrating")]
lib LibMSRATING
  fun RatingCheckUserAccessW = RatingCheckUserAccessW(
    pszUsername : UInt16*,   # LPCWSTR optional
    pszURL : UInt16*,   # LPCWSTR optional
    pszRatingInfo : UInt16*,   # LPCWSTR optional
    pData : UInt8*,   # BYTE* optional
    cbData : UInt32,   # DWORD
    ppRatingDetails : Void**   # void** optional, out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RatingCheckUserAccessWNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Uint8>, Uint32, Pointer<Void>);
typedef RatingCheckUserAccessWDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Uint8>, int, Pointer<Void>);
final RatingCheckUserAccessW = DynamicLibrary.open('MSRATING.dll')
    .lookupFunction<RatingCheckUserAccessWNative, RatingCheckUserAccessWDart>('RatingCheckUserAccessW');
// pszUsername : LPCWSTR optional -> Pointer<Utf16>
// pszURL : LPCWSTR optional -> Pointer<Utf16>
// pszRatingInfo : LPCWSTR optional -> Pointer<Utf16>
// pData : BYTE* optional -> Pointer<Uint8>
// cbData : DWORD -> Uint32
// ppRatingDetails : void** optional, out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RatingCheckUserAccessW(
  pszUsername: PWideChar;   // LPCWSTR optional
  pszURL: PWideChar;   // LPCWSTR optional
  pszRatingInfo: PWideChar;   // LPCWSTR optional
  pData: Pointer;   // BYTE* optional
  cbData: DWORD;   // DWORD
  ppRatingDetails: Pointer   // void** optional, out
): Integer; stdcall;
  external 'MSRATING.dll' name 'RatingCheckUserAccessW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RatingCheckUserAccessW"
  c_RatingCheckUserAccessW :: CWString -> CWString -> CWString -> Ptr Word8 -> Word32 -> Ptr () -> IO Int32
-- pszUsername : LPCWSTR optional -> CWString
-- pszURL : LPCWSTR optional -> CWString
-- pszRatingInfo : LPCWSTR optional -> CWString
-- pData : BYTE* optional -> Ptr Word8
-- cbData : DWORD -> Word32
-- ppRatingDetails : void** optional, out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let ratingcheckuseraccessw =
  foreign "RatingCheckUserAccessW"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint8_t) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* pszUsername : LPCWSTR optional -> (ptr uint16_t) *)
(* pszURL : LPCWSTR optional -> (ptr uint16_t) *)
(* pszRatingInfo : LPCWSTR optional -> (ptr uint16_t) *)
(* pData : BYTE* optional -> (ptr uint8_t) *)
(* cbData : DWORD -> uint32_t *)
(* ppRatingDetails : void** optional, out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msrating (t "MSRATING.dll"))
(cffi:use-foreign-library msrating)

(cffi:defcfun ("RatingCheckUserAccessW" rating-check-user-access-w :convention :stdcall) :int32
  (psz-username (:string :encoding :utf-16le))   ; LPCWSTR optional
  (psz-url (:string :encoding :utf-16le))   ; LPCWSTR optional
  (psz-rating-info (:string :encoding :utf-16le))   ; LPCWSTR optional
  (p-data :pointer)   ; BYTE* optional
  (cb-data :uint32)   ; DWORD
  (pp-rating-details :pointer))   ; void** optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RatingCheckUserAccessW = Win32::API::More->new('MSRATING',
    'int RatingCheckUserAccessW(LPCWSTR pszUsername, LPCWSTR pszURL, LPCWSTR pszRatingInfo, LPVOID pData, DWORD cbData, LPVOID ppRatingDetails)');
# my $ret = $RatingCheckUserAccessW->Call($pszUsername, $pszURL, $pszRatingInfo, $pData, $cbData, $ppRatingDetails);
# pszUsername : LPCWSTR optional -> LPCWSTR
# pszURL : LPCWSTR optional -> LPCWSTR
# pszRatingInfo : LPCWSTR optional -> LPCWSTR
# pData : BYTE* optional -> LPVOID
# cbData : DWORD -> DWORD
# ppRatingDetails : void** optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。