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

RtwqSetDeadline2

関数
作業キューに締め切りと事前締め切り時刻を設定する。
DLLRTWorkQ.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT RtwqSetDeadline2(
    DWORD workQueueId,
    LONGLONG deadlineInHNS,
    LONGLONG preDeadlineInHNS,
    HANDLE* pRequest
);

パラメーター

名前方向
workQueueIdDWORDin
deadlineInHNSLONGLONGin
preDeadlineInHNSLONGLONGin
pRequestHANDLE*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT RtwqSetDeadline2(
    DWORD workQueueId,
    LONGLONG deadlineInHNS,
    LONGLONG preDeadlineInHNS,
    HANDLE* pRequest
);
[DllImport("RTWorkQ.dll", ExactSpelling = true)]
static extern int RtwqSetDeadline2(
    uint workQueueId,   // DWORD
    long deadlineInHNS,   // LONGLONG
    long preDeadlineInHNS,   // LONGLONG
    IntPtr pRequest   // HANDLE* out
);
<DllImport("RTWorkQ.dll", ExactSpelling:=True)>
Public Shared Function RtwqSetDeadline2(
    workQueueId As UInteger,   ' DWORD
    deadlineInHNS As Long,   ' LONGLONG
    preDeadlineInHNS As Long,   ' LONGLONG
    pRequest As IntPtr   ' HANDLE* out
) As Integer
End Function
' workQueueId : DWORD
' deadlineInHNS : LONGLONG
' preDeadlineInHNS : LONGLONG
' pRequest : HANDLE* out
Declare PtrSafe Function RtwqSetDeadline2 Lib "rtworkq" ( _
    ByVal workQueueId As Long, _
    ByVal deadlineInHNS As LongLong, _
    ByVal preDeadlineInHNS As LongLong, _
    ByVal pRequest As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RtwqSetDeadline2 = ctypes.windll.rtworkq.RtwqSetDeadline2
RtwqSetDeadline2.restype = ctypes.c_int
RtwqSetDeadline2.argtypes = [
    wintypes.DWORD,  # workQueueId : DWORD
    ctypes.c_longlong,  # deadlineInHNS : LONGLONG
    ctypes.c_longlong,  # preDeadlineInHNS : LONGLONG
    ctypes.c_void_p,  # pRequest : HANDLE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RTWorkQ.dll')
RtwqSetDeadline2 = Fiddle::Function.new(
  lib['RtwqSetDeadline2'],
  [
    -Fiddle::TYPE_INT,  # workQueueId : DWORD
    Fiddle::TYPE_LONG_LONG,  # deadlineInHNS : LONGLONG
    Fiddle::TYPE_LONG_LONG,  # preDeadlineInHNS : LONGLONG
    Fiddle::TYPE_VOIDP,  # pRequest : HANDLE* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "rtworkq")]
extern "system" {
    fn RtwqSetDeadline2(
        workQueueId: u32,  // DWORD
        deadlineInHNS: i64,  // LONGLONG
        preDeadlineInHNS: i64,  // LONGLONG
        pRequest: *mut *mut core::ffi::c_void  // HANDLE* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RTWorkQ.dll")]
public static extern int RtwqSetDeadline2(uint workQueueId, long deadlineInHNS, long preDeadlineInHNS, IntPtr pRequest);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RTWorkQ_RtwqSetDeadline2' -Namespace Win32 -PassThru
# $api::RtwqSetDeadline2(workQueueId, deadlineInHNS, preDeadlineInHNS, pRequest)
#uselib "RTWorkQ.dll"
#func global RtwqSetDeadline2 "RtwqSetDeadline2" sptr, sptr, sptr, sptr
; RtwqSetDeadline2 workQueueId, deadlineInHNS, preDeadlineInHNS, pRequest   ; 戻り値は stat
; workQueueId : DWORD -> "sptr"
; deadlineInHNS : LONGLONG -> "sptr"
; preDeadlineInHNS : LONGLONG -> "sptr"
; pRequest : HANDLE* out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RTWorkQ.dll"
#cfunc global RtwqSetDeadline2 "RtwqSetDeadline2" int, int64, int64, sptr
; res = RtwqSetDeadline2(workQueueId, deadlineInHNS, preDeadlineInHNS, pRequest)
; workQueueId : DWORD -> "int"
; deadlineInHNS : LONGLONG -> "int64"
; preDeadlineInHNS : LONGLONG -> "int64"
; pRequest : HANDLE* out -> "sptr"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT RtwqSetDeadline2(DWORD workQueueId, LONGLONG deadlineInHNS, LONGLONG preDeadlineInHNS, HANDLE* pRequest)
#uselib "RTWorkQ.dll"
#cfunc global RtwqSetDeadline2 "RtwqSetDeadline2" int, int64, int64, intptr
; res = RtwqSetDeadline2(workQueueId, deadlineInHNS, preDeadlineInHNS, pRequest)
; workQueueId : DWORD -> "int"
; deadlineInHNS : LONGLONG -> "int64"
; preDeadlineInHNS : LONGLONG -> "int64"
; pRequest : HANDLE* out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rtworkq = windows.NewLazySystemDLL("RTWorkQ.dll")
	procRtwqSetDeadline2 = rtworkq.NewProc("RtwqSetDeadline2")
)

// workQueueId (DWORD), deadlineInHNS (LONGLONG), preDeadlineInHNS (LONGLONG), pRequest (HANDLE* out)
r1, _, err := procRtwqSetDeadline2.Call(
	uintptr(workQueueId),
	uintptr(deadlineInHNS),
	uintptr(preDeadlineInHNS),
	uintptr(pRequest),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RtwqSetDeadline2(
  workQueueId: DWORD;   // DWORD
  deadlineInHNS: Int64;   // LONGLONG
  preDeadlineInHNS: Int64;   // LONGLONG
  pRequest: Pointer   // HANDLE* out
): Integer; stdcall;
  external 'RTWorkQ.dll' name 'RtwqSetDeadline2';
result := DllCall("RTWorkQ\RtwqSetDeadline2"
    , "UInt", workQueueId   ; DWORD
    , "Int64", deadlineInHNS   ; LONGLONG
    , "Int64", preDeadlineInHNS   ; LONGLONG
    , "Ptr", pRequest   ; HANDLE* out
    , "Int")   ; return: HRESULT
●RtwqSetDeadline2(workQueueId, deadlineInHNS, preDeadlineInHNS, pRequest) = DLL("RTWorkQ.dll", "int RtwqSetDeadline2(dword, int64, int64, void*)")
# 呼び出し: RtwqSetDeadline2(workQueueId, deadlineInHNS, preDeadlineInHNS, pRequest)
# workQueueId : DWORD -> "dword"
# deadlineInHNS : LONGLONG -> "int64"
# preDeadlineInHNS : LONGLONG -> "int64"
# pRequest : HANDLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。