GetExpandedResourceExclusiveCpuCount
関数拡張リソースで使用可能な専有CPU数を取得する。
シグネチャ
// api-ms-win-gaming-expandedresources-l1-1-0.dll
#include <windows.h>
HRESULT GetExpandedResourceExclusiveCpuCount(
DWORD* exclusiveCpuCount
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| exclusiveCpuCount | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-gaming-expandedresources-l1-1-0.dll
#include <windows.h>
HRESULT GetExpandedResourceExclusiveCpuCount(
DWORD* exclusiveCpuCount
);[DllImport("api-ms-win-gaming-expandedresources-l1-1-0.dll", ExactSpelling = true)]
static extern int GetExpandedResourceExclusiveCpuCount(
out uint exclusiveCpuCount // DWORD* out
);<DllImport("api-ms-win-gaming-expandedresources-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function GetExpandedResourceExclusiveCpuCount(
<Out> ByRef exclusiveCpuCount As UInteger ' DWORD* out
) As Integer
End Function' exclusiveCpuCount : DWORD* out
Declare PtrSafe Function GetExpandedResourceExclusiveCpuCount Lib "api-ms-win-gaming-expandedresources-l1-1-0" ( _
ByRef exclusiveCpuCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetExpandedResourceExclusiveCpuCount = ctypes.windll.LoadLibrary("api-ms-win-gaming-expandedresources-l1-1-0.dll").GetExpandedResourceExclusiveCpuCount
GetExpandedResourceExclusiveCpuCount.restype = ctypes.c_int
GetExpandedResourceExclusiveCpuCount.argtypes = [
ctypes.POINTER(wintypes.DWORD), # exclusiveCpuCount : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-gaming-expandedresources-l1-1-0.dll')
GetExpandedResourceExclusiveCpuCount = Fiddle::Function.new(
lib['GetExpandedResourceExclusiveCpuCount'],
[
Fiddle::TYPE_VOIDP, # exclusiveCpuCount : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-gaming-expandedresources-l1-1-0")]
extern "system" {
fn GetExpandedResourceExclusiveCpuCount(
exclusiveCpuCount: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-gaming-expandedresources-l1-1-0.dll")]
public static extern int GetExpandedResourceExclusiveCpuCount(out uint exclusiveCpuCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-gaming-expandedresources-l1-1-0_GetExpandedResourceExclusiveCpuCount' -Namespace Win32 -PassThru
# $api::GetExpandedResourceExclusiveCpuCount(exclusiveCpuCount)#uselib "api-ms-win-gaming-expandedresources-l1-1-0.dll"
#func global GetExpandedResourceExclusiveCpuCount "GetExpandedResourceExclusiveCpuCount" sptr
; GetExpandedResourceExclusiveCpuCount varptr(exclusiveCpuCount) ; 戻り値は stat
; exclusiveCpuCount : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "api-ms-win-gaming-expandedresources-l1-1-0.dll" #cfunc global GetExpandedResourceExclusiveCpuCount "GetExpandedResourceExclusiveCpuCount" var ; res = GetExpandedResourceExclusiveCpuCount(exclusiveCpuCount) ; exclusiveCpuCount : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "api-ms-win-gaming-expandedresources-l1-1-0.dll" #cfunc global GetExpandedResourceExclusiveCpuCount "GetExpandedResourceExclusiveCpuCount" sptr ; res = GetExpandedResourceExclusiveCpuCount(varptr(exclusiveCpuCount)) ; exclusiveCpuCount : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetExpandedResourceExclusiveCpuCount(DWORD* exclusiveCpuCount) #uselib "api-ms-win-gaming-expandedresources-l1-1-0.dll" #cfunc global GetExpandedResourceExclusiveCpuCount "GetExpandedResourceExclusiveCpuCount" var ; res = GetExpandedResourceExclusiveCpuCount(exclusiveCpuCount) ; exclusiveCpuCount : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetExpandedResourceExclusiveCpuCount(DWORD* exclusiveCpuCount) #uselib "api-ms-win-gaming-expandedresources-l1-1-0.dll" #cfunc global GetExpandedResourceExclusiveCpuCount "GetExpandedResourceExclusiveCpuCount" intptr ; res = GetExpandedResourceExclusiveCpuCount(varptr(exclusiveCpuCount)) ; exclusiveCpuCount : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_gaming_expandedresources_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-gaming-expandedresources-l1-1-0.dll")
procGetExpandedResourceExclusiveCpuCount = api_ms_win_gaming_expandedresources_l1_1_0.NewProc("GetExpandedResourceExclusiveCpuCount")
)
// exclusiveCpuCount (DWORD* out)
r1, _, err := procGetExpandedResourceExclusiveCpuCount.Call(
uintptr(exclusiveCpuCount),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetExpandedResourceExclusiveCpuCount(
exclusiveCpuCount: Pointer // DWORD* out
): Integer; stdcall;
external 'api-ms-win-gaming-expandedresources-l1-1-0.dll' name 'GetExpandedResourceExclusiveCpuCount';result := DllCall("api-ms-win-gaming-expandedresources-l1-1-0\GetExpandedResourceExclusiveCpuCount"
, "Ptr", exclusiveCpuCount ; DWORD* out
, "Int") ; return: HRESULT●GetExpandedResourceExclusiveCpuCount(exclusiveCpuCount) = DLL("api-ms-win-gaming-expandedresources-l1-1-0.dll", "int GetExpandedResourceExclusiveCpuCount(void*)")
# 呼び出し: GetExpandedResourceExclusiveCpuCount(exclusiveCpuCount)
# exclusiveCpuCount : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。