CheckGamingPrivilegeWithUI
関数UI付きでゲーム権限の有無を確認する。
シグネチャ
// api-ms-win-gaming-tcui-l1-1-1.dll
#include <windows.h>
HRESULT CheckGamingPrivilegeWithUI(
DWORD privilegeId,
HSTRING scope,
HSTRING policy,
HSTRING friendlyMessage, // optional
GameUICompletionRoutine completionRoutine,
void* context // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| privilegeId | DWORD | in |
| scope | HSTRING | in |
| policy | HSTRING | in |
| friendlyMessage | HSTRING | inoptional |
| completionRoutine | GameUICompletionRoutine | in |
| context | void* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-gaming-tcui-l1-1-1.dll
#include <windows.h>
HRESULT CheckGamingPrivilegeWithUI(
DWORD privilegeId,
HSTRING scope,
HSTRING policy,
HSTRING friendlyMessage, // optional
GameUICompletionRoutine completionRoutine,
void* context // optional
);[DllImport("api-ms-win-gaming-tcui-l1-1-1.dll", ExactSpelling = true)]
static extern int CheckGamingPrivilegeWithUI(
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-1.dll", ExactSpelling:=True)>
Public Shared Function CheckGamingPrivilegeWithUI(
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' privilegeId : DWORD
' scope : HSTRING
' policy : HSTRING
' friendlyMessage : HSTRING optional
' completionRoutine : GameUICompletionRoutine
' context : void* optional
Declare PtrSafe Function CheckGamingPrivilegeWithUI Lib "api-ms-win-gaming-tcui-l1-1-1" ( _
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
CheckGamingPrivilegeWithUI = ctypes.windll.LoadLibrary("api-ms-win-gaming-tcui-l1-1-1.dll").CheckGamingPrivilegeWithUI
CheckGamingPrivilegeWithUI.restype = ctypes.c_int
CheckGamingPrivilegeWithUI.argtypes = [
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-1.dll')
CheckGamingPrivilegeWithUI = Fiddle::Function.new(
lib['CheckGamingPrivilegeWithUI'],
[
-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-1")]
extern "system" {
fn CheckGamingPrivilegeWithUI(
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-1.dll")]
public static extern int CheckGamingPrivilegeWithUI(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-1_CheckGamingPrivilegeWithUI' -Namespace Win32 -PassThru
# $api::CheckGamingPrivilegeWithUI(privilegeId, scope, policy, friendlyMessage, completionRoutine, context)#uselib "api-ms-win-gaming-tcui-l1-1-1.dll"
#func global CheckGamingPrivilegeWithUI "CheckGamingPrivilegeWithUI" sptr, sptr, sptr, sptr, sptr, sptr
; CheckGamingPrivilegeWithUI privilegeId, scope, policy, friendlyMessage, completionRoutine, context ; 戻り値は stat
; 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-1.dll"
#cfunc global CheckGamingPrivilegeWithUI "CheckGamingPrivilegeWithUI" int, sptr, sptr, sptr, sptr, sptr
; res = CheckGamingPrivilegeWithUI(privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
; privilegeId : DWORD -> "int"
; scope : HSTRING -> "sptr"
; policy : HSTRING -> "sptr"
; friendlyMessage : HSTRING optional -> "sptr"
; completionRoutine : GameUICompletionRoutine -> "sptr"
; context : void* optional -> "sptr"; HRESULT CheckGamingPrivilegeWithUI(DWORD privilegeId, HSTRING scope, HSTRING policy, HSTRING friendlyMessage, GameUICompletionRoutine completionRoutine, void* context)
#uselib "api-ms-win-gaming-tcui-l1-1-1.dll"
#cfunc global CheckGamingPrivilegeWithUI "CheckGamingPrivilegeWithUI" int, intptr, intptr, intptr, intptr, intptr
; res = CheckGamingPrivilegeWithUI(privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
; 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_1 = windows.NewLazySystemDLL("api-ms-win-gaming-tcui-l1-1-1.dll")
procCheckGamingPrivilegeWithUI = api_ms_win_gaming_tcui_l1_1_1.NewProc("CheckGamingPrivilegeWithUI")
)
// privilegeId (DWORD), scope (HSTRING), policy (HSTRING), friendlyMessage (HSTRING optional), completionRoutine (GameUICompletionRoutine), context (void* optional)
r1, _, err := procCheckGamingPrivilegeWithUI.Call(
uintptr(privilegeId),
uintptr(scope),
uintptr(policy),
uintptr(friendlyMessage),
uintptr(completionRoutine),
uintptr(context),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction CheckGamingPrivilegeWithUI(
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-1.dll' name 'CheckGamingPrivilegeWithUI';result := DllCall("api-ms-win-gaming-tcui-l1-1-1\CheckGamingPrivilegeWithUI"
, "UInt", privilegeId ; DWORD
, "Ptr", scope ; HSTRING
, "Ptr", policy ; HSTRING
, "Ptr", friendlyMessage ; HSTRING optional
, "Ptr", completionRoutine ; GameUICompletionRoutine
, "Ptr", context ; void* optional
, "Int") ; return: HRESULT●CheckGamingPrivilegeWithUI(privilegeId, scope, policy, friendlyMessage, completionRoutine, context) = DLL("api-ms-win-gaming-tcui-l1-1-1.dll", "int CheckGamingPrivilegeWithUI(dword, void*, void*, void*, void*, void*)")
# 呼び出し: CheckGamingPrivilegeWithUI(privilegeId, scope, policy, friendlyMessage, completionRoutine, context)
# 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)。