ホーム › NetworkManagement.QoS › QOSQueryFlow
QOSQueryFlow
関数QoSフローのプロパティや状態を問い合わせる。
シグネチャ
// qwave.dll
#include <windows.h>
BOOL QOSQueryFlow(
HANDLE QOSHandle,
DWORD FlowId,
QOS_QUERY_FLOW Operation,
DWORD* Size,
void* Buffer,
DWORD Flags, // optional
OVERLAPPED* Overlapped // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| QOSHandle | HANDLE | in | QOSCreateHandleで取得したQoSハンドル。 |
| FlowId | DWORD | in | 問い合わせる対象のQoSフローのID。 |
| Operation | QOS_QUERY_FLOW | in | 取得する情報の種類を表す列挙値(帯域推定等)。 |
| Size | DWORD* | inout | 入力でBufferのバイト数、出力で必要/使用バイト数を格納するポインタ。 |
| Buffer | void* | out | 取得した情報を格納する出力バッファへのポインタ。 |
| Flags | DWORD | inoptional | 予約。0を指定する。 |
| Overlapped | OVERLAPPED* | outoptional | 非同期操作に使用するOVERLAPPED構造体へのポインタ。同期実行時はNULL可。 |
戻り値の型: BOOL
各言語での呼び出し定義
// qwave.dll
#include <windows.h>
BOOL QOSQueryFlow(
HANDLE QOSHandle,
DWORD FlowId,
QOS_QUERY_FLOW Operation,
DWORD* Size,
void* Buffer,
DWORD Flags, // optional
OVERLAPPED* Overlapped // optional
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("qwave.dll", ExactSpelling = true)]
static extern bool QOSQueryFlow(
IntPtr QOSHandle, // HANDLE
uint FlowId, // DWORD
int Operation, // QOS_QUERY_FLOW
ref uint Size, // DWORD* in/out
IntPtr Buffer, // void* out
uint Flags, // DWORD optional
IntPtr Overlapped // OVERLAPPED* optional, out
);<DllImport("qwave.dll", ExactSpelling:=True)>
Public Shared Function QOSQueryFlow(
QOSHandle As IntPtr, ' HANDLE
FlowId As UInteger, ' DWORD
Operation As Integer, ' QOS_QUERY_FLOW
ByRef Size As UInteger, ' DWORD* in/out
Buffer As IntPtr, ' void* out
Flags As UInteger, ' DWORD optional
Overlapped As IntPtr ' OVERLAPPED* optional, out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' QOSHandle : HANDLE
' FlowId : DWORD
' Operation : QOS_QUERY_FLOW
' Size : DWORD* in/out
' Buffer : void* out
' Flags : DWORD optional
' Overlapped : OVERLAPPED* optional, out
Declare PtrSafe Function QOSQueryFlow Lib "qwave" ( _
ByVal QOSHandle As LongPtr, _
ByVal FlowId As Long, _
ByVal Operation As Long, _
ByRef Size As Long, _
ByVal Buffer As LongPtr, _
ByVal Flags As Long, _
ByVal Overlapped As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
QOSQueryFlow = ctypes.windll.qwave.QOSQueryFlow
QOSQueryFlow.restype = wintypes.BOOL
QOSQueryFlow.argtypes = [
wintypes.HANDLE, # QOSHandle : HANDLE
wintypes.DWORD, # FlowId : DWORD
ctypes.c_int, # Operation : QOS_QUERY_FLOW
ctypes.POINTER(wintypes.DWORD), # Size : DWORD* in/out
ctypes.POINTER(None), # Buffer : void* out
wintypes.DWORD, # Flags : DWORD optional
ctypes.c_void_p, # Overlapped : OVERLAPPED* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('qwave.dll')
QOSQueryFlow = Fiddle::Function.new(
lib['QOSQueryFlow'],
[
Fiddle::TYPE_VOIDP, # QOSHandle : HANDLE
-Fiddle::TYPE_INT, # FlowId : DWORD
Fiddle::TYPE_INT, # Operation : QOS_QUERY_FLOW
Fiddle::TYPE_VOIDP, # Size : DWORD* in/out
Fiddle::TYPE_VOIDP, # Buffer : void* out
-Fiddle::TYPE_INT, # Flags : DWORD optional
Fiddle::TYPE_VOIDP, # Overlapped : OVERLAPPED* optional, out
],
Fiddle::TYPE_INT)#[link(name = "qwave")]
extern "system" {
fn QOSQueryFlow(
QOSHandle: *mut core::ffi::c_void, // HANDLE
FlowId: u32, // DWORD
Operation: i32, // QOS_QUERY_FLOW
Size: *mut u32, // DWORD* in/out
Buffer: *mut (), // void* out
Flags: u32, // DWORD optional
Overlapped: *mut OVERLAPPED // OVERLAPPED* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("qwave.dll")]
public static extern bool QOSQueryFlow(IntPtr QOSHandle, uint FlowId, int Operation, ref uint Size, IntPtr Buffer, uint Flags, IntPtr Overlapped);
"@
$api = Add-Type -MemberDefinition $sig -Name 'qwave_QOSQueryFlow' -Namespace Win32 -PassThru
# $api::QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped)#uselib "qwave.dll"
#func global QOSQueryFlow "QOSQueryFlow" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; QOSQueryFlow QOSHandle, FlowId, Operation, varptr(Size), Buffer, Flags, varptr(Overlapped) ; 戻り値は stat
; QOSHandle : HANDLE -> "sptr"
; FlowId : DWORD -> "sptr"
; Operation : QOS_QUERY_FLOW -> "sptr"
; Size : DWORD* in/out -> "sptr"
; Buffer : void* out -> "sptr"
; Flags : DWORD optional -> "sptr"
; Overlapped : OVERLAPPED* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "qwave.dll" #cfunc global QOSQueryFlow "QOSQueryFlow" sptr, int, int, var, sptr, int, var ; res = QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped) ; QOSHandle : HANDLE -> "sptr" ; FlowId : DWORD -> "int" ; Operation : QOS_QUERY_FLOW -> "int" ; Size : DWORD* in/out -> "var" ; Buffer : void* out -> "sptr" ; Flags : DWORD optional -> "int" ; Overlapped : OVERLAPPED* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "qwave.dll" #cfunc global QOSQueryFlow "QOSQueryFlow" sptr, int, int, sptr, sptr, int, sptr ; res = QOSQueryFlow(QOSHandle, FlowId, Operation, varptr(Size), Buffer, Flags, varptr(Overlapped)) ; QOSHandle : HANDLE -> "sptr" ; FlowId : DWORD -> "int" ; Operation : QOS_QUERY_FLOW -> "int" ; Size : DWORD* in/out -> "sptr" ; Buffer : void* out -> "sptr" ; Flags : DWORD optional -> "int" ; Overlapped : OVERLAPPED* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL QOSQueryFlow(HANDLE QOSHandle, DWORD FlowId, QOS_QUERY_FLOW Operation, DWORD* Size, void* Buffer, DWORD Flags, OVERLAPPED* Overlapped) #uselib "qwave.dll" #cfunc global QOSQueryFlow "QOSQueryFlow" intptr, int, int, var, intptr, int, var ; res = QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped) ; QOSHandle : HANDLE -> "intptr" ; FlowId : DWORD -> "int" ; Operation : QOS_QUERY_FLOW -> "int" ; Size : DWORD* in/out -> "var" ; Buffer : void* out -> "intptr" ; Flags : DWORD optional -> "int" ; Overlapped : OVERLAPPED* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL QOSQueryFlow(HANDLE QOSHandle, DWORD FlowId, QOS_QUERY_FLOW Operation, DWORD* Size, void* Buffer, DWORD Flags, OVERLAPPED* Overlapped) #uselib "qwave.dll" #cfunc global QOSQueryFlow "QOSQueryFlow" intptr, int, int, intptr, intptr, int, intptr ; res = QOSQueryFlow(QOSHandle, FlowId, Operation, varptr(Size), Buffer, Flags, varptr(Overlapped)) ; QOSHandle : HANDLE -> "intptr" ; FlowId : DWORD -> "int" ; Operation : QOS_QUERY_FLOW -> "int" ; Size : DWORD* in/out -> "intptr" ; Buffer : void* out -> "intptr" ; Flags : DWORD optional -> "int" ; Overlapped : OVERLAPPED* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
qwave = windows.NewLazySystemDLL("qwave.dll")
procQOSQueryFlow = qwave.NewProc("QOSQueryFlow")
)
// QOSHandle (HANDLE), FlowId (DWORD), Operation (QOS_QUERY_FLOW), Size (DWORD* in/out), Buffer (void* out), Flags (DWORD optional), Overlapped (OVERLAPPED* optional, out)
r1, _, err := procQOSQueryFlow.Call(
uintptr(QOSHandle),
uintptr(FlowId),
uintptr(Operation),
uintptr(Size),
uintptr(Buffer),
uintptr(Flags),
uintptr(Overlapped),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction QOSQueryFlow(
QOSHandle: THandle; // HANDLE
FlowId: DWORD; // DWORD
Operation: Integer; // QOS_QUERY_FLOW
Size: Pointer; // DWORD* in/out
Buffer: Pointer; // void* out
Flags: DWORD; // DWORD optional
Overlapped: Pointer // OVERLAPPED* optional, out
): BOOL; stdcall;
external 'qwave.dll' name 'QOSQueryFlow';result := DllCall("qwave\QOSQueryFlow"
, "Ptr", QOSHandle ; HANDLE
, "UInt", FlowId ; DWORD
, "Int", Operation ; QOS_QUERY_FLOW
, "Ptr", Size ; DWORD* in/out
, "Ptr", Buffer ; void* out
, "UInt", Flags ; DWORD optional
, "Ptr", Overlapped ; OVERLAPPED* optional, out
, "Int") ; return: BOOL●QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped) = DLL("qwave.dll", "bool QOSQueryFlow(void*, dword, int, void*, void*, dword, void*)")
# 呼び出し: QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped)
# QOSHandle : HANDLE -> "void*"
# FlowId : DWORD -> "dword"
# Operation : QOS_QUERY_FLOW -> "int"
# Size : DWORD* in/out -> "void*"
# Buffer : void* out -> "void*"
# Flags : DWORD optional -> "dword"
# Overlapped : OVERLAPPED* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "qwave" fn QOSQueryFlow(
QOSHandle: ?*anyopaque, // HANDLE
FlowId: u32, // DWORD
Operation: i32, // QOS_QUERY_FLOW
Size: [*c]u32, // DWORD* in/out
Buffer: ?*anyopaque, // void* out
Flags: u32, // DWORD optional
Overlapped: [*c]OVERLAPPED // OVERLAPPED* optional, out
) callconv(std.os.windows.WINAPI) i32;proc QOSQueryFlow(
QOSHandle: pointer, # HANDLE
FlowId: uint32, # DWORD
Operation: int32, # QOS_QUERY_FLOW
Size: ptr uint32, # DWORD* in/out
Buffer: pointer, # void* out
Flags: uint32, # DWORD optional
Overlapped: ptr OVERLAPPED # OVERLAPPED* optional, out
): int32 {.importc: "QOSQueryFlow", stdcall, dynlib: "qwave.dll".}pragma(lib, "qwave");
extern(Windows)
int QOSQueryFlow(
void* QOSHandle, // HANDLE
uint FlowId, // DWORD
int Operation, // QOS_QUERY_FLOW
uint* Size, // DWORD* in/out
void* Buffer, // void* out
uint Flags, // DWORD optional
OVERLAPPED* Overlapped // OVERLAPPED* optional, out
);ccall((:QOSQueryFlow, "qwave.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Int32, Ptr{UInt32}, Ptr{Cvoid}, UInt32, Ptr{OVERLAPPED}),
QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped)
# QOSHandle : HANDLE -> Ptr{Cvoid}
# FlowId : DWORD -> UInt32
# Operation : QOS_QUERY_FLOW -> Int32
# Size : DWORD* in/out -> Ptr{UInt32}
# Buffer : void* out -> Ptr{Cvoid}
# Flags : DWORD optional -> UInt32
# Overlapped : OVERLAPPED* optional, out -> Ptr{OVERLAPPED}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t QOSQueryFlow(
void* QOSHandle,
uint32_t FlowId,
int32_t Operation,
uint32_t* Size,
void* Buffer,
uint32_t Flags,
void* Overlapped);
]]
local qwave = ffi.load("qwave")
-- qwave.QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped)
-- QOSHandle : HANDLE
-- FlowId : DWORD
-- Operation : QOS_QUERY_FLOW
-- Size : DWORD* in/out
-- Buffer : void* out
-- Flags : DWORD optional
-- Overlapped : OVERLAPPED* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('qwave.dll');
const QOSQueryFlow = lib.func('__stdcall', 'QOSQueryFlow', 'int32_t', ['void *', 'uint32_t', 'int32_t', 'uint32_t *', 'void *', 'uint32_t', 'void *']);
// QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped)
// QOSHandle : HANDLE -> 'void *'
// FlowId : DWORD -> 'uint32_t'
// Operation : QOS_QUERY_FLOW -> 'int32_t'
// Size : DWORD* in/out -> 'uint32_t *'
// Buffer : void* out -> 'void *'
// Flags : DWORD optional -> 'uint32_t'
// Overlapped : OVERLAPPED* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("qwave.dll", {
QOSQueryFlow: { parameters: ["pointer", "u32", "i32", "pointer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped)
// QOSHandle : HANDLE -> "pointer"
// FlowId : DWORD -> "u32"
// Operation : QOS_QUERY_FLOW -> "i32"
// Size : DWORD* in/out -> "pointer"
// Buffer : void* out -> "pointer"
// Flags : DWORD optional -> "u32"
// Overlapped : OVERLAPPED* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t QOSQueryFlow(
void* QOSHandle,
uint32_t FlowId,
int32_t Operation,
uint32_t* Size,
void* Buffer,
uint32_t Flags,
void* Overlapped);
C, "qwave.dll");
// $ffi->QOSQueryFlow(QOSHandle, FlowId, Operation, Size, Buffer, Flags, Overlapped);
// QOSHandle : HANDLE
// FlowId : DWORD
// Operation : QOS_QUERY_FLOW
// Size : DWORD* in/out
// Buffer : void* out
// Flags : DWORD optional
// Overlapped : OVERLAPPED* optional, 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 Qwave extends StdCallLibrary {
Qwave INSTANCE = Native.load("qwave", Qwave.class);
boolean QOSQueryFlow(
Pointer QOSHandle, // HANDLE
int FlowId, // DWORD
int Operation, // QOS_QUERY_FLOW
IntByReference Size, // DWORD* in/out
Pointer Buffer, // void* out
int Flags, // DWORD optional
Pointer Overlapped // OVERLAPPED* optional, out
);
}@[Link("qwave")]
lib Libqwave
fun QOSQueryFlow = QOSQueryFlow(
QOSHandle : Void*, # HANDLE
FlowId : UInt32, # DWORD
Operation : Int32, # QOS_QUERY_FLOW
Size : UInt32*, # DWORD* in/out
Buffer : Void*, # void* out
Flags : UInt32, # DWORD optional
Overlapped : OVERLAPPED* # OVERLAPPED* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef QOSQueryFlowNative = Int32 Function(Pointer<Void>, Uint32, Int32, Pointer<Uint32>, Pointer<Void>, Uint32, Pointer<Void>);
typedef QOSQueryFlowDart = int Function(Pointer<Void>, int, int, Pointer<Uint32>, Pointer<Void>, int, Pointer<Void>);
final QOSQueryFlow = DynamicLibrary.open('qwave.dll')
.lookupFunction<QOSQueryFlowNative, QOSQueryFlowDart>('QOSQueryFlow');
// QOSHandle : HANDLE -> Pointer<Void>
// FlowId : DWORD -> Uint32
// Operation : QOS_QUERY_FLOW -> Int32
// Size : DWORD* in/out -> Pointer<Uint32>
// Buffer : void* out -> Pointer<Void>
// Flags : DWORD optional -> Uint32
// Overlapped : OVERLAPPED* optional, out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function QOSQueryFlow(
QOSHandle: THandle; // HANDLE
FlowId: DWORD; // DWORD
Operation: Integer; // QOS_QUERY_FLOW
Size: Pointer; // DWORD* in/out
Buffer: Pointer; // void* out
Flags: DWORD; // DWORD optional
Overlapped: Pointer // OVERLAPPED* optional, out
): BOOL; stdcall;
external 'qwave.dll' name 'QOSQueryFlow';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "QOSQueryFlow"
c_QOSQueryFlow :: Ptr () -> Word32 -> Int32 -> Ptr Word32 -> Ptr () -> Word32 -> Ptr () -> IO CInt
-- QOSHandle : HANDLE -> Ptr ()
-- FlowId : DWORD -> Word32
-- Operation : QOS_QUERY_FLOW -> Int32
-- Size : DWORD* in/out -> Ptr Word32
-- Buffer : void* out -> Ptr ()
-- Flags : DWORD optional -> Word32
-- Overlapped : OVERLAPPED* optional, out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let qosqueryflow =
foreign "QOSQueryFlow"
((ptr void) @-> uint32_t @-> int32_t @-> (ptr uint32_t) @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* QOSHandle : HANDLE -> (ptr void) *)
(* FlowId : DWORD -> uint32_t *)
(* Operation : QOS_QUERY_FLOW -> int32_t *)
(* Size : DWORD* in/out -> (ptr uint32_t) *)
(* Buffer : void* out -> (ptr void) *)
(* Flags : DWORD optional -> uint32_t *)
(* Overlapped : OVERLAPPED* optional, out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library qwave (t "qwave.dll"))
(cffi:use-foreign-library qwave)
(cffi:defcfun ("QOSQueryFlow" qosquery-flow :convention :stdcall) :int32
(qoshandle :pointer) ; HANDLE
(flow-id :uint32) ; DWORD
(operation :int32) ; QOS_QUERY_FLOW
(size :pointer) ; DWORD* in/out
(buffer :pointer) ; void* out
(flags :uint32) ; DWORD optional
(overlapped :pointer)) ; OVERLAPPED* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $QOSQueryFlow = Win32::API::More->new('qwave',
'BOOL QOSQueryFlow(HANDLE QOSHandle, DWORD FlowId, int Operation, LPVOID Size, LPVOID Buffer, DWORD Flags, LPVOID Overlapped)');
# my $ret = $QOSQueryFlow->Call($QOSHandle, $FlowId, $Operation, $Size, $Buffer, $Flags, $Overlapped);
# QOSHandle : HANDLE -> HANDLE
# FlowId : DWORD -> DWORD
# Operation : QOS_QUERY_FLOW -> int
# Size : DWORD* in/out -> LPVOID
# Buffer : void* out -> LPVOID
# Flags : DWORD optional -> DWORD
# Overlapped : OVERLAPPED* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。