Win32 API 日本語リファレンス
ホームSystem.JobObjects › QueryIoRateControlInformationJobObject

QueryIoRateControlInformationJobObject

関数
ジョブのI/Oレート制御情報を照会する。
DLLKERNEL32.dll呼出規約winapiSetLastErrorあり対応OSWindows 10 以降

シグネチャ

// KERNEL32.dll
#include <windows.h>

DWORD QueryIoRateControlInformationJobObject(
    HANDLE hJob,   // optional
    LPCWSTR VolumeName,   // optional
    JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks,
    DWORD* InfoBlockCount
);

パラメーター

名前方向説明
hJobHANDLEinoptionalI/Oレート制御情報を取得する対象ジョブのハンドル。NULL可(現在のジョブを参照)。
VolumeNameLPCWSTRinoptional情報を取得する対象ボリュームの名前(Unicode)。NULLで全ボリューム分を取得する。
InfoBlocksJOBOBJECT_IO_RATE_CONTROL_INFORMATION**out取得した制御情報ブロック配列を受け取るポインタのアドレス。FreeMemoryJobObjectで解放する。
InfoBlockCountDWORD*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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // DWORD
function 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)。
const std = @import("std");

extern "kernel32" fn QueryIoRateControlInformationJobObject(
    hJob: ?*anyopaque, // HANDLE optional
    VolumeName: [*c]const u16, // LPCWSTR optional
    InfoBlocks: [*c][*c]JOBOBJECT_IO_RATE_CONTROL_INFORMATION, // JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
    InfoBlockCount: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) u32;
proc QueryIoRateControlInformationJobObject(
    hJob: pointer,  # HANDLE optional
    VolumeName: WideCString,  # LPCWSTR optional
    InfoBlocks: ptr JOBOBJECT_IO_RATE_CONTROL_INFORMATION,  # JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
    InfoBlockCount: ptr uint32  # DWORD* out
): uint32 {.importc: "QueryIoRateControlInformationJobObject", stdcall, dynlib: "KERNEL32.dll".}
pragma(lib, "kernel32");
extern(Windows)
uint QueryIoRateControlInformationJobObject(
    void* hJob,   // HANDLE optional
    const(wchar)* VolumeName,   // LPCWSTR optional
    JOBOBJECT_IO_RATE_CONTROL_INFORMATION** InfoBlocks,   // JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
    uint* InfoBlockCount   // DWORD* out
);
ccall((:QueryIoRateControlInformationJobObject, "KERNEL32.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Cwstring, Ptr{JOBOBJECT_IO_RATE_CONTROL_INFORMATION}, Ptr{UInt32}),
      hJob, VolumeName, InfoBlocks, InfoBlockCount)
# hJob : HANDLE optional -> Ptr{Cvoid}
# VolumeName : LPCWSTR optional -> Cwstring
# InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> Ptr{JOBOBJECT_IO_RATE_CONTROL_INFORMATION}
# InfoBlockCount : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t QueryIoRateControlInformationJobObject(
    void* hJob,
    const uint16_t* VolumeName,
    void* InfoBlocks,
    uint32_t* InfoBlockCount);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount)
-- hJob : HANDLE optional
-- VolumeName : LPCWSTR optional
-- InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
-- InfoBlockCount : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const QueryIoRateControlInformationJobObject = lib.func('__stdcall', 'QueryIoRateControlInformationJobObject', 'uint32_t', ['void *', 'str16', 'void *', 'uint32_t *']);
// QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount)
// hJob : HANDLE optional -> 'void *'
// VolumeName : LPCWSTR optional -> 'str16'
// InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> 'void *'
// InfoBlockCount : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("KERNEL32.dll", {
  QueryIoRateControlInformationJobObject: { parameters: ["pointer", "buffer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount)
// hJob : HANDLE optional -> "pointer"
// VolumeName : LPCWSTR optional -> "buffer"
// InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> "pointer"
// InfoBlockCount : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t QueryIoRateControlInformationJobObject(
    void* hJob,
    const uint16_t* VolumeName,
    void* InfoBlocks,
    uint32_t* InfoBlockCount);
C, "KERNEL32.dll");
// $ffi->QueryIoRateControlInformationJobObject(hJob, VolumeName, InfoBlocks, InfoBlockCount);
// hJob : HANDLE optional
// VolumeName : LPCWSTR optional
// InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
// InfoBlockCount : DWORD* 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 Kernel32 extends StdCallLibrary {
    Kernel32 INSTANCE = Native.load("kernel32", Kernel32.class);
    int QueryIoRateControlInformationJobObject(
        Pointer hJob,   // HANDLE optional
        WString VolumeName,   // LPCWSTR optional
        Pointer InfoBlocks,   // JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
        IntByReference InfoBlockCount   // DWORD* out
    );
}
@[Link("kernel32")]
lib LibKERNEL32
  fun QueryIoRateControlInformationJobObject = QueryIoRateControlInformationJobObject(
    hJob : Void*,   # HANDLE optional
    VolumeName : UInt16*,   # LPCWSTR optional
    InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION**,   # JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
    InfoBlockCount : UInt32*   # DWORD* out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef QueryIoRateControlInformationJobObjectNative = Uint32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Pointer<Uint32>);
typedef QueryIoRateControlInformationJobObjectDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Pointer<Uint32>);
final QueryIoRateControlInformationJobObject = DynamicLibrary.open('KERNEL32.dll')
    .lookupFunction<QueryIoRateControlInformationJobObjectNative, QueryIoRateControlInformationJobObjectDart>('QueryIoRateControlInformationJobObject');
// hJob : HANDLE optional -> Pointer<Void>
// VolumeName : LPCWSTR optional -> Pointer<Utf16>
// InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> Pointer<Void>
// InfoBlockCount : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function 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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "QueryIoRateControlInformationJobObject"
  c_QueryIoRateControlInformationJobObject :: Ptr () -> CWString -> Ptr () -> Ptr Word32 -> IO Word32
-- hJob : HANDLE optional -> Ptr ()
-- VolumeName : LPCWSTR optional -> CWString
-- InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> Ptr ()
-- InfoBlockCount : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let queryioratecontrolinformationjobobject =
  foreign "QueryIoRateControlInformationJobObject"
    ((ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr uint32_t) @-> returning uint32_t)
(* hJob : HANDLE optional -> (ptr void) *)
(* VolumeName : LPCWSTR optional -> (ptr uint16_t) *)
(* InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> (ptr void) *)
(* InfoBlockCount : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)

(cffi:defcfun ("QueryIoRateControlInformationJobObject" query-io-rate-control-information-job-object :convention :stdcall) :uint32
  (h-job :pointer)   ; HANDLE optional
  (volume-name (:string :encoding :utf-16le))   ; LPCWSTR optional
  (info-blocks :pointer)   ; JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out
  (info-block-count :pointer))   ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $QueryIoRateControlInformationJobObject = Win32::API::More->new('KERNEL32',
    'DWORD QueryIoRateControlInformationJobObject(HANDLE hJob, LPCWSTR VolumeName, LPVOID InfoBlocks, LPVOID InfoBlockCount)');
# my $ret = $QueryIoRateControlInformationJobObject->Call($hJob, $VolumeName, $InfoBlocks, $InfoBlockCount);
# hJob : HANDLE optional -> HANDLE
# VolumeName : LPCWSTR optional -> LPCWSTR
# InfoBlocks : JOBOBJECT_IO_RATE_CONTROL_INFORMATION** out -> LPVOID
# InfoBlockCount : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型