CheckGamingPrivilegeWithUIForUser
関数指定ユーザーのゲーム権限をUI付きで確認する。
シグネチャ
// api-ms-win-gaming-tcui-l1-1-2.dll
#include <windows.h>
HRESULT CheckGamingPrivilegeWithUIForUser(
IInspectable* user,
DWORD privilegeId,
HSTRING scope,
HSTRING policy,
HSTRING friendlyMessage, // optional
GameUICompletionRoutine completionRoutine,
void* context // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| user | IInspectable* | in | 操作主体のユーザーを表すIInspectableインターフェイスポインタ。 |
| privilegeId | DWORD | in | 確認する特権のID。 |
| scope | HSTRING | in | 特権チェックのスコープを表すHSTRING。NULL可。 |
| policy | HSTRING | in | 適用するポリシーを表すHSTRING。NULL可。 |
| friendlyMessage | HSTRING | inoptional | 特権が無い場合にUIへ表示する説明文を表すHSTRING。 |
| completionRoutine | GameUICompletionRoutine | in | チェック完了時に呼ばれるコールバック関数。 |
| context | void* | inoptional | コールバックへ渡されるユーザー定義コンテキスト。NULL可。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-gaming-tcui-l1-1-2.dll
#include <windows.h>
HRESULT CheckGamingPrivilegeWithUIForUser(
IInspectable* user,
DWORD privilegeId,
HSTRING scope,
HSTRING policy,
HSTRING friendlyMessage, // optional
GameUICompletionRoutine completionRoutine,
void* context // optional
);[DllImport("api-ms-win-gaming-tcui-l1-1-2.dll", ExactSpelling = true)]
static extern int CheckGamingPrivilegeWithUIForUser(
IntPtr user, // IInspectable*
uint privilegeId, // DWORD
IntPtr scope, // HSTRING
IntPtr policy, // HSTRING
IntPtr friendlyMessage, // HSTRING optional
IntPtr completionRoutine, // GameUICompletionRoutine
IntPtr context // void* optional
);<DllImport("api-ms-win-gaming-tcui-l1-1-2.dll", ExactSpelling:=True)>
Public Shared Function CheckGamingPrivilegeWithUIForUser(
user As IntPtr, ' IInspectable*
privilegeId As UInteger, ' DWORD
scope As IntPtr, ' HSTRING
policy As IntPtr, ' HSTRING
friendlyMessage As IntPtr, ' HSTRING optional
completionRoutine As IntPtr, ' GameUICompletionRoutine
context As IntPtr ' void* optional
) As Integer
End Function' user : IInspectable*
' privilegeId : DWORD
' scope : HSTRING
' policy : HSTRING
' friendlyMessage : HSTRING optional
' completionRoutine : GameUICompletionRoutine
' context : void* optional
Declare PtrSafe Function CheckGamingPrivilegeWithUIForUser Lib "api-ms-win-gaming-tcui-l1-1-2" ( _
ByVal user As LongPtr, _
ByVal privilegeId As Long, _
ByVal scope As LongPtr, _
ByVal policy As LongPtr, _
ByVal friendlyMessage As LongPtr, _
ByVal completionRoutine As LongPtr, _
ByVal context As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CheckGamingPrivilegeWithUIForUser = ctypes.windll.LoadLibrary("api-ms-win-gaming-tcui-l1-1-2.dll").CheckGamingPrivilegeWithUIForUser
CheckGamingPrivilegeWithUIForUser.restype = ctypes.c_int
CheckGamingPrivilegeWithUIForUser.argtypes = [
ctypes.c_void_p, # user : IInspectable*
wintypes.DWORD, # privilegeId : DWORD
wintypes.HANDLE, # scope : HSTRING
wintypes.HANDLE, # policy : HSTRING
wintypes.HANDLE, # friendlyMessage : HSTRING optional
ctypes.c_void_p, # completionRoutine : GameUICompletionRoutine
ctypes.POINTER(None), # context : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-gaming-tcui-l1-1-2.dll')
CheckGamingPrivilegeWithUIForUser = Fiddle::Function.new(
lib['CheckGamingPrivilegeWithUIForUser'],
[
Fiddle::TYPE_VOIDP, # user : IInspectable*
-Fiddle::TYPE_INT, # privilegeId : DWORD
Fiddle::TYPE_VOIDP, # scope : HSTRING
Fiddle::TYPE_VOIDP, # policy : HSTRING
Fiddle::TYPE_VOIDP, # friendlyMessage : HSTRING optional
Fiddle::TYPE_VOIDP, # completionRoutine : GameUICompletionRoutine
Fiddle::TYPE_VOIDP, # context : void* optional
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-gaming-tcui-l1-1-2")]
extern "system" {
fn CheckGamingPrivilegeWithUIForUser(
user: *mut core::ffi::c_void, // IInspectable*
privilegeId: u32, // DWORD
scope: *mut core::ffi::c_void, // HSTRING
policy: *mut core::ffi::c_void, // HSTRING
friendlyMessage: *mut core::ffi::c_void, // HSTRING optional
completionRoutine: *const core::ffi::c_void, // GameUICompletionRoutine
context: *mut () // void* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-gaming-tcui-l1-1-2.dll")]
public static extern int CheckGamingPrivilegeWithUIForUser(IntPtr user, uint privilegeId, IntPtr scope, IntPtr policy, IntPtr friendlyMessage, IntPtr completionRoutine, IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-gaming-tcui-l1-1-2_CheckGamingPrivilegeWithUIForUser' -Namespace Win32 -PassThru
# $api::CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)#uselib "api-ms-win-gaming-tcui-l1-1-2.dll"
#func global CheckGamingPrivilegeWithUIForUser "CheckGamingPrivilegeWithUIForUser" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CheckGamingPrivilegeWithUIForUser user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context ; 戻り値は stat
; user : IInspectable* -> "sptr"
; privilegeId : DWORD -> "sptr"
; scope : HSTRING -> "sptr"
; policy : HSTRING -> "sptr"
; friendlyMessage : HSTRING optional -> "sptr"
; completionRoutine : GameUICompletionRoutine -> "sptr"
; context : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-gaming-tcui-l1-1-2.dll"
#cfunc global CheckGamingPrivilegeWithUIForUser "CheckGamingPrivilegeWithUIForUser" sptr, int, sptr, sptr, sptr, sptr, sptr
; res = CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
; user : IInspectable* -> "sptr"
; privilegeId : DWORD -> "int"
; scope : HSTRING -> "sptr"
; policy : HSTRING -> "sptr"
; friendlyMessage : HSTRING optional -> "sptr"
; completionRoutine : GameUICompletionRoutine -> "sptr"
; context : void* optional -> "sptr"; HRESULT CheckGamingPrivilegeWithUIForUser(IInspectable* user, DWORD privilegeId, HSTRING scope, HSTRING policy, HSTRING friendlyMessage, GameUICompletionRoutine completionRoutine, void* context)
#uselib "api-ms-win-gaming-tcui-l1-1-2.dll"
#cfunc global CheckGamingPrivilegeWithUIForUser "CheckGamingPrivilegeWithUIForUser" intptr, int, intptr, intptr, intptr, intptr, intptr
; res = CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
; user : IInspectable* -> "intptr"
; privilegeId : DWORD -> "int"
; scope : HSTRING -> "intptr"
; policy : HSTRING -> "intptr"
; friendlyMessage : HSTRING optional -> "intptr"
; completionRoutine : GameUICompletionRoutine -> "intptr"
; context : void* optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_gaming_tcui_l1_1_2 = windows.NewLazySystemDLL("api-ms-win-gaming-tcui-l1-1-2.dll")
procCheckGamingPrivilegeWithUIForUser = api_ms_win_gaming_tcui_l1_1_2.NewProc("CheckGamingPrivilegeWithUIForUser")
)
// user (IInspectable*), privilegeId (DWORD), scope (HSTRING), policy (HSTRING), friendlyMessage (HSTRING optional), completionRoutine (GameUICompletionRoutine), context (void* optional)
r1, _, err := procCheckGamingPrivilegeWithUIForUser.Call(
uintptr(user),
uintptr(privilegeId),
uintptr(scope),
uintptr(policy),
uintptr(friendlyMessage),
uintptr(completionRoutine),
uintptr(context),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CheckGamingPrivilegeWithUIForUser(
user: Pointer; // IInspectable*
privilegeId: DWORD; // DWORD
scope: THandle; // HSTRING
policy: THandle; // HSTRING
friendlyMessage: THandle; // HSTRING optional
completionRoutine: Pointer; // GameUICompletionRoutine
context: Pointer // void* optional
): Integer; stdcall;
external 'api-ms-win-gaming-tcui-l1-1-2.dll' name 'CheckGamingPrivilegeWithUIForUser';result := DllCall("api-ms-win-gaming-tcui-l1-1-2\CheckGamingPrivilegeWithUIForUser"
, "Ptr", user ; IInspectable*
, "UInt", privilegeId ; DWORD
, "Ptr", scope ; HSTRING
, "Ptr", policy ; HSTRING
, "Ptr", friendlyMessage ; HSTRING optional
, "Ptr", completionRoutine ; GameUICompletionRoutine
, "Ptr", context ; void* optional
, "Int") ; return: HRESULT●CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context) = DLL("api-ms-win-gaming-tcui-l1-1-2.dll", "int CheckGamingPrivilegeWithUIForUser(void*, dword, void*, void*, void*, void*, void*)")
# 呼び出し: CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
# user : IInspectable* -> "void*"
# privilegeId : DWORD -> "dword"
# scope : HSTRING -> "void*"
# policy : HSTRING -> "void*"
# friendlyMessage : HSTRING optional -> "void*"
# completionRoutine : GameUICompletionRoutine -> "void*"
# context : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "api-ms-win-gaming-tcui-l1-1-2" fn CheckGamingPrivilegeWithUIForUser(
user: ?*anyopaque, // IInspectable*
privilegeId: u32, // DWORD
scope: ?*anyopaque, // HSTRING
policy: ?*anyopaque, // HSTRING
friendlyMessage: ?*anyopaque, // HSTRING optional
completionRoutine: ?*anyopaque, // GameUICompletionRoutine
context: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) i32;proc CheckGamingPrivilegeWithUIForUser(
user: pointer, # IInspectable*
privilegeId: uint32, # DWORD
scope: pointer, # HSTRING
policy: pointer, # HSTRING
friendlyMessage: pointer, # HSTRING optional
completionRoutine: pointer, # GameUICompletionRoutine
context: pointer # void* optional
): int32 {.importc: "CheckGamingPrivilegeWithUIForUser", stdcall, dynlib: "api-ms-win-gaming-tcui-l1-1-2.dll".}pragma(lib, "api-ms-win-gaming-tcui-l1-1-2");
extern(Windows)
int CheckGamingPrivilegeWithUIForUser(
void* user, // IInspectable*
uint privilegeId, // DWORD
void* scope, // HSTRING
void* policy, // HSTRING
void* friendlyMessage, // HSTRING optional
void* completionRoutine, // GameUICompletionRoutine
void* context // void* optional
);ccall((:CheckGamingPrivilegeWithUIForUser, "api-ms-win-gaming-tcui-l1-1-2.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
# user : IInspectable* -> Ptr{Cvoid}
# privilegeId : DWORD -> UInt32
# scope : HSTRING -> Ptr{Cvoid}
# policy : HSTRING -> Ptr{Cvoid}
# friendlyMessage : HSTRING optional -> Ptr{Cvoid}
# completionRoutine : GameUICompletionRoutine -> Ptr{Cvoid}
# context : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t CheckGamingPrivilegeWithUIForUser(
void* user,
uint32_t privilegeId,
void* scope,
void* policy,
void* friendlyMessage,
void* completionRoutine,
void* context);
]]
local api-ms-win-gaming-tcui-l1-1-2 = ffi.load("api-ms-win-gaming-tcui-l1-1-2")
-- api-ms-win-gaming-tcui-l1-1-2.CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
-- user : IInspectable*
-- privilegeId : DWORD
-- scope : HSTRING
-- policy : HSTRING
-- friendlyMessage : HSTRING optional
-- completionRoutine : GameUICompletionRoutine
-- context : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('api-ms-win-gaming-tcui-l1-1-2.dll');
const CheckGamingPrivilegeWithUIForUser = lib.func('__stdcall', 'CheckGamingPrivilegeWithUIForUser', 'int32_t', ['void *', 'uint32_t', 'void *', 'void *', 'void *', 'void *', 'void *']);
// CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
// user : IInspectable* -> 'void *'
// privilegeId : DWORD -> 'uint32_t'
// scope : HSTRING -> 'void *'
// policy : HSTRING -> 'void *'
// friendlyMessage : HSTRING optional -> 'void *'
// completionRoutine : GameUICompletionRoutine -> 'void *'
// context : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("api-ms-win-gaming-tcui-l1-1-2.dll", {
CheckGamingPrivilegeWithUIForUser: { parameters: ["pointer", "u32", "pointer", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
// user : IInspectable* -> "pointer"
// privilegeId : DWORD -> "u32"
// scope : HSTRING -> "pointer"
// policy : HSTRING -> "pointer"
// friendlyMessage : HSTRING optional -> "pointer"
// completionRoutine : GameUICompletionRoutine -> "pointer"
// context : void* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t CheckGamingPrivilegeWithUIForUser(
void* user,
uint32_t privilegeId,
void* scope,
void* policy,
void* friendlyMessage,
void* completionRoutine,
void* context);
C, "api-ms-win-gaming-tcui-l1-1-2.dll");
// $ffi->CheckGamingPrivilegeWithUIForUser(user, privilegeId, scope, policy, friendlyMessage, completionRoutine, context);
// user : IInspectable*
// privilegeId : DWORD
// scope : HSTRING
// policy : HSTRING
// friendlyMessage : HSTRING optional
// completionRoutine : GameUICompletionRoutine
// context : void* optional
// 構造体/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 Api-ms-win-gaming-tcui-l1-1-2 extends StdCallLibrary {
Api-ms-win-gaming-tcui-l1-1-2 INSTANCE = Native.load("api-ms-win-gaming-tcui-l1-1-2", Api-ms-win-gaming-tcui-l1-1-2.class);
int CheckGamingPrivilegeWithUIForUser(
Pointer user, // IInspectable*
int privilegeId, // DWORD
Pointer scope, // HSTRING
Pointer policy, // HSTRING
Pointer friendlyMessage, // HSTRING optional
Callback completionRoutine, // GameUICompletionRoutine
Pointer context // void* optional
);
}@[Link("api-ms-win-gaming-tcui-l1-1-2")]
lib Libapi-ms-win-gaming-tcui-l1-1-2
fun CheckGamingPrivilegeWithUIForUser = CheckGamingPrivilegeWithUIForUser(
user : Void*, # IInspectable*
privilegeId : UInt32, # DWORD
scope : Void*, # HSTRING
policy : Void*, # HSTRING
friendlyMessage : Void*, # HSTRING optional
completionRoutine : Void*, # GameUICompletionRoutine
context : Void* # void* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef CheckGamingPrivilegeWithUIForUserNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef CheckGamingPrivilegeWithUIForUserDart = int Function(Pointer<Void>, int, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final CheckGamingPrivilegeWithUIForUser = DynamicLibrary.open('api-ms-win-gaming-tcui-l1-1-2.dll')
.lookupFunction<CheckGamingPrivilegeWithUIForUserNative, CheckGamingPrivilegeWithUIForUserDart>('CheckGamingPrivilegeWithUIForUser');
// user : IInspectable* -> Pointer<Void>
// privilegeId : DWORD -> Uint32
// scope : HSTRING -> Pointer<Void>
// policy : HSTRING -> Pointer<Void>
// friendlyMessage : HSTRING optional -> Pointer<Void>
// completionRoutine : GameUICompletionRoutine -> Pointer<Void>
// context : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function CheckGamingPrivilegeWithUIForUser(
user: Pointer; // IInspectable*
privilegeId: DWORD; // DWORD
scope: THandle; // HSTRING
policy: THandle; // HSTRING
friendlyMessage: THandle; // HSTRING optional
completionRoutine: Pointer; // GameUICompletionRoutine
context: Pointer // void* optional
): Integer; stdcall;
external 'api-ms-win-gaming-tcui-l1-1-2.dll' name 'CheckGamingPrivilegeWithUIForUser';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "CheckGamingPrivilegeWithUIForUser"
c_CheckGamingPrivilegeWithUIForUser :: Ptr () -> Word32 -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> IO Int32
-- user : IInspectable* -> Ptr ()
-- privilegeId : DWORD -> Word32
-- scope : HSTRING -> Ptr ()
-- policy : HSTRING -> Ptr ()
-- friendlyMessage : HSTRING optional -> Ptr ()
-- completionRoutine : GameUICompletionRoutine -> Ptr ()
-- context : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let checkgamingprivilegewithuiforuser =
foreign "CheckGamingPrivilegeWithUIForUser"
((ptr void) @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* user : IInspectable* -> (ptr void) *)
(* privilegeId : DWORD -> uint32_t *)
(* scope : HSTRING -> (ptr void) *)
(* policy : HSTRING -> (ptr void) *)
(* friendlyMessage : HSTRING optional -> (ptr void) *)
(* completionRoutine : GameUICompletionRoutine -> (ptr void) *)
(* context : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library api-ms-win-gaming-tcui-l1-1-2 (t "api-ms-win-gaming-tcui-l1-1-2.dll"))
(cffi:use-foreign-library api-ms-win-gaming-tcui-l1-1-2)
(cffi:defcfun ("CheckGamingPrivilegeWithUIForUser" check-gaming-privilege-with-uifor-user :convention :stdcall) :int32
(user :pointer) ; IInspectable*
(privilege-id :uint32) ; DWORD
(scope :pointer) ; HSTRING
(policy :pointer) ; HSTRING
(friendly-message :pointer) ; HSTRING optional
(completion-routine :pointer) ; GameUICompletionRoutine
(context :pointer)) ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $CheckGamingPrivilegeWithUIForUser = Win32::API::More->new('api-ms-win-gaming-tcui-l1-1-2',
'int CheckGamingPrivilegeWithUIForUser(LPVOID user, DWORD privilegeId, HANDLE scope, HANDLE policy, HANDLE friendlyMessage, LPVOID completionRoutine, LPVOID context)');
# my $ret = $CheckGamingPrivilegeWithUIForUser->Call($user, $privilegeId, $scope, $policy, $friendlyMessage, $completionRoutine, $context);
# user : IInspectable* -> LPVOID
# privilegeId : DWORD -> DWORD
# scope : HSTRING -> HANDLE
# policy : HSTRING -> HANDLE
# friendlyMessage : HSTRING optional -> HANDLE
# completionRoutine : GameUICompletionRoutine -> LPVOID
# context : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。