ホーム › System.JobObjects › QueryIoRateControlInformationJobObject
QueryIoRateControlInformationJobObject
関数ジョブのI/Oレート制御情報を照会する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
DWORD QueryIoRateControlInformationJobObject(
HANDLE hJob, // optional
LPCWSTR VolumeName, // optional
JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks,
DWORD* InfoBlockCount
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hJob | HANDLE | inoptional |
| VolumeName | LPCWSTR | inoptional |
| InfoBlocks | JOBOBJECT_IO_RATE_CONTROL_INFORMATION** | out |
| InfoBlockCount | DWORD* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
DWORD QueryIoRateControlInformationJobObject(
HANDLE hJob, // optional
LPCWSTR VolumeName, // optional
JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks,
DWORD* InfoBlockCount
);[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern uint QueryIoRateControlInformationJobObject(
IntPtr hJob, // HANDLE optional
[MarshalAs(UnmanagedType.LPWStr)] string VolumeName, // LPCWSTR optional
IntPtr InfoBlocks, // JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
out uint InfoBlockCount // DWORD* out
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function QueryIoRateControlInformationJobObject(
hJob As IntPtr, ' HANDLE optional
<MarshalAs(UnmanagedType.LPWStr)> VolumeName As String, ' LPCWSTR optional
InfoBlocks As IntPtr, ' JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
<Out> ByRef InfoBlockCount As UInteger ' DWORD* out
) As UInteger
End Function' hJob : HANDLE optional
' VolumeName : LPCWSTR optional
' InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
' InfoBlockCount : DWORD* out
Declare PtrSafe Function QueryIoRateControlInformationJobObject Lib "kernel32" ( _
ByVal hJob As LongPtr, _
ByVal VolumeName As LongPtr, _
ByVal InfoBlocks As LongPtr, _
ByRef InfoBlockCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
QueryIoRateControlInformationJobObject = ctypes.windll.kernel32.QueryIoRateControlInformationJobObject
QueryIoRateControlInformationJobObject.restype = wintypes.DWORD
QueryIoRateControlInformationJobObject.argtypes = [
wintypes.HANDLE, # hJob : HANDLE optional
wintypes.LPCWSTR, # VolumeName : LPCWSTR optional
ctypes.c_void_p, # InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
ctypes.POINTER(wintypes.DWORD), # InfoBlockCount : DWORD* out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
QueryIoRateControlInformationJobObject = Fiddle::Function.new(
lib['QueryIoRateControlInformationJobObject'],
[
Fiddle::TYPE_VOIDP, # hJob : HANDLE optional
Fiddle::TYPE_VOIDP, # VolumeName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
Fiddle::TYPE_VOIDP, # InfoBlockCount : DWORD* out
],
-Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn QueryIoRateControlInformationJobObject(
hJob: *mut core::ffi::c_void, // HANDLE optional
VolumeName: *const u16, // LPCWSTR optional
InfoBlocks: *mut *mut JOBOBJECT_IO_RATE_CONTROL_INFORMATION, // JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
InfoBlockCount: *mut u32 // DWORD* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern uint QueryIoRateControlInformationJobObject(IntPtr hJob, [MarshalAs(UnmanagedType.LPWStr)] string VolumeName, IntPtr InfoBlocks, out uint InfoBlockCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_QueryIoRateControlInformationJobObject' -Namespace Win32 -PassThru
# $api::QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount)#uselib "KERNEL32.dll"
#func global QueryIoRateControlInformationJobObject "QueryIoRateControlInformationJobObject" sptr, sptr, sptr, sptr
; QueryIoRateControlInformationJobObject hJob, VolumeName, varptr(InfoBlocks), varptr(InfoBlockCount) ; 戻り値は stat
; hJob : HANDLE optional -> "sptr"
; VolumeName : LPCWSTR optional -> "sptr"
; InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "sptr"
; InfoBlockCount : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global QueryIoRateControlInformationJobObject "QueryIoRateControlInformationJobObject" sptr, wstr, var, var ; res = QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount) ; hJob : HANDLE optional -> "sptr" ; VolumeName : LPCWSTR optional -> "wstr" ; InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "var" ; InfoBlockCount : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global QueryIoRateControlInformationJobObject "QueryIoRateControlInformationJobObject" sptr, wstr, sptr, sptr ; res = QueryIoRateControlInformationJobObject(hJob, VolumeName, varptr(InfoBlocks), varptr(InfoBlockCount)) ; hJob : HANDLE optional -> "sptr" ; VolumeName : LPCWSTR optional -> "wstr" ; InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "sptr" ; InfoBlockCount : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD QueryIoRateControlInformationJobObject(HANDLE hJob, LPCWSTR VolumeName, JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks, DWORD* InfoBlockCount) #uselib "KERNEL32.dll" #cfunc global QueryIoRateControlInformationJobObject "QueryIoRateControlInformationJobObject" intptr, wstr, var, var ; res = QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount) ; hJob : HANDLE optional -> "intptr" ; VolumeName : LPCWSTR optional -> "wstr" ; InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "var" ; InfoBlockCount : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD QueryIoRateControlInformationJobObject(HANDLE hJob, LPCWSTR VolumeName, JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks, DWORD* InfoBlockCount) #uselib "KERNEL32.dll" #cfunc global QueryIoRateControlInformationJobObject "QueryIoRateControlInformationJobObject" intptr, wstr, intptr, intptr ; res = QueryIoRateControlInformationJobObject(hJob, VolumeName, varptr(InfoBlocks), varptr(InfoBlockCount)) ; hJob : HANDLE optional -> "intptr" ; VolumeName : LPCWSTR optional -> "wstr" ; InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "intptr" ; InfoBlockCount : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procQueryIoRateControlInformationJobObject = kernel32.NewProc("QueryIoRateControlInformationJobObject")
)
// hJob (HANDLE optional), VolumeName (LPCWSTR optional), InfoBlocks (JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out), InfoBlockCount (DWORD* out)
r1, _, err := procQueryIoRateControlInformationJobObject.Call(
uintptr(hJob),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(VolumeName))),
uintptr(InfoBlocks),
uintptr(InfoBlockCount),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction QueryIoRateControlInformationJobObject(
hJob: THandle; // HANDLE optional
VolumeName: PWideChar; // LPCWSTR optional
InfoBlocks: Pointer; // JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
InfoBlockCount: Pointer // DWORD* out
): DWORD; stdcall;
external 'KERNEL32.dll' name 'QueryIoRateControlInformationJobObject';result := DllCall("KERNEL32\QueryIoRateControlInformationJobObject"
, "Ptr", hJob ; HANDLE optional
, "WStr", VolumeName ; LPCWSTR optional
, "Ptr", InfoBlocks ; JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
, "Ptr", InfoBlockCount ; DWORD* out
, "UInt") ; return: DWORD●QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount) = DLL("KERNEL32.dll", "dword QueryIoRateControlInformationJobObject(void*, char*, void*, void*)")
# 呼び出し: QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount)
# hJob : HANDLE optional -> "void*"
# VolumeName : LPCWSTR optional -> "char*"
# InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "void*"
# InfoBlockCount : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。