Win32 API 日本語リファレンス
ホームNetworkManagement.QoS › QOSQueryFlow

QOSQueryFlow

関数
QoSフローのプロパティや状態を問い合わせる。
DLLqwave.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// 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
);

パラメーター

名前方向
QOSHandleHANDLEin
FlowIdDWORDin
OperationQOS_QUERY_FLOWin
SizeDWORD*inout
Buffervoid*out
FlagsDWORDinoptional
OverlappedOVERLAPPED*outoptional

戻り値の型: 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 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // BOOL
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';
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)。