ホーム › System.Kernel › RtlInterlockedPushListSListEx
RtlInterlockedPushListSListEx
関数複数エントリを単方向リストへアトミックに一括追加する。
シグネチャ
// ntdll.dll
#include <windows.h>
SLIST_ENTRY* RtlInterlockedPushListSListEx(
SLIST_HEADER* ListHead,
SLIST_ENTRY* List,
SLIST_ENTRY* ListEnd,
DWORD Count
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ListHead | SLIST_HEADER* | inout | 複数エントリを追加する対象のSリストヘッダへのポインタ。 |
| List | SLIST_ENTRY* | inout | 追加する連結リストの先頭エントリへのポインタ。 |
| ListEnd | SLIST_ENTRY* | inout | 追加する連結リストの末尾エントリへのポインタ。 |
| Count | DWORD | in | ListからListEndまでのエントリ数。 |
戻り値の型: SLIST_ENTRY*
各言語での呼び出し定義
// ntdll.dll
#include <windows.h>
SLIST_ENTRY* RtlInterlockedPushListSListEx(
SLIST_HEADER* ListHead,
SLIST_ENTRY* List,
SLIST_ENTRY* ListEnd,
DWORD Count
);[DllImport("ntdll.dll", ExactSpelling = true)]
static extern IntPtr RtlInterlockedPushListSListEx(
IntPtr ListHead, // SLIST_HEADER* in/out
IntPtr List, // SLIST_ENTRY* in/out
IntPtr ListEnd, // SLIST_ENTRY* in/out
uint Count // DWORD
);<DllImport("ntdll.dll", ExactSpelling:=True)>
Public Shared Function RtlInterlockedPushListSListEx(
ListHead As IntPtr, ' SLIST_HEADER* in/out
List As IntPtr, ' SLIST_ENTRY* in/out
ListEnd As IntPtr, ' SLIST_ENTRY* in/out
Count As UInteger ' DWORD
) As IntPtr
End Function' ListHead : SLIST_HEADER* in/out
' List : SLIST_ENTRY* in/out
' ListEnd : SLIST_ENTRY* in/out
' Count : DWORD
Declare PtrSafe Function RtlInterlockedPushListSListEx Lib "ntdll" ( _
ByVal ListHead As LongPtr, _
ByVal List As LongPtr, _
ByVal ListEnd As LongPtr, _
ByVal Count As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RtlInterlockedPushListSListEx = ctypes.windll.ntdll.RtlInterlockedPushListSListEx
RtlInterlockedPushListSListEx.restype = ctypes.c_void_p
RtlInterlockedPushListSListEx.argtypes = [
ctypes.c_void_p, # ListHead : SLIST_HEADER* in/out
ctypes.c_void_p, # List : SLIST_ENTRY* in/out
ctypes.c_void_p, # ListEnd : SLIST_ENTRY* in/out
wintypes.DWORD, # Count : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ntdll.dll')
RtlInterlockedPushListSListEx = Fiddle::Function.new(
lib['RtlInterlockedPushListSListEx'],
[
Fiddle::TYPE_VOIDP, # ListHead : SLIST_HEADER* in/out
Fiddle::TYPE_VOIDP, # List : SLIST_ENTRY* in/out
Fiddle::TYPE_VOIDP, # ListEnd : SLIST_ENTRY* in/out
-Fiddle::TYPE_INT, # Count : DWORD
],
Fiddle::TYPE_VOIDP)#[link(name = "ntdll")]
extern "system" {
fn RtlInterlockedPushListSListEx(
ListHead: *mut SLIST_HEADER, // SLIST_HEADER* in/out
List: *mut SLIST_ENTRY, // SLIST_ENTRY* in/out
ListEnd: *mut SLIST_ENTRY, // SLIST_ENTRY* in/out
Count: u32 // DWORD
) -> *mut SLIST_ENTRY;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ntdll.dll")]
public static extern IntPtr RtlInterlockedPushListSListEx(IntPtr ListHead, IntPtr List, IntPtr ListEnd, uint Count);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ntdll_RtlInterlockedPushListSListEx' -Namespace Win32 -PassThru
# $api::RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count)#uselib "ntdll.dll"
#func global RtlInterlockedPushListSListEx "RtlInterlockedPushListSListEx" sptr, sptr, sptr, sptr
; RtlInterlockedPushListSListEx varptr(ListHead), varptr(List), varptr(ListEnd), Count ; 戻り値は stat
; ListHead : SLIST_HEADER* in/out -> "sptr"
; List : SLIST_ENTRY* in/out -> "sptr"
; ListEnd : SLIST_ENTRY* in/out -> "sptr"
; Count : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ntdll.dll" #cfunc global RtlInterlockedPushListSListEx "RtlInterlockedPushListSListEx" var, var, var, int ; res = RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count) ; ListHead : SLIST_HEADER* in/out -> "var" ; List : SLIST_ENTRY* in/out -> "var" ; ListEnd : SLIST_ENTRY* in/out -> "var" ; Count : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ntdll.dll" #cfunc global RtlInterlockedPushListSListEx "RtlInterlockedPushListSListEx" sptr, sptr, sptr, int ; res = RtlInterlockedPushListSListEx(varptr(ListHead), varptr(List), varptr(ListEnd), Count) ; ListHead : SLIST_HEADER* in/out -> "sptr" ; List : SLIST_ENTRY* in/out -> "sptr" ; ListEnd : SLIST_ENTRY* in/out -> "sptr" ; Count : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; SLIST_ENTRY* RtlInterlockedPushListSListEx(SLIST_HEADER* ListHead, SLIST_ENTRY* List, SLIST_ENTRY* ListEnd, DWORD Count) #uselib "ntdll.dll" #cfunc global RtlInterlockedPushListSListEx "RtlInterlockedPushListSListEx" var, var, var, int ; res = RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count) ; ListHead : SLIST_HEADER* in/out -> "var" ; List : SLIST_ENTRY* in/out -> "var" ; ListEnd : SLIST_ENTRY* in/out -> "var" ; Count : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; SLIST_ENTRY* RtlInterlockedPushListSListEx(SLIST_HEADER* ListHead, SLIST_ENTRY* List, SLIST_ENTRY* ListEnd, DWORD Count) #uselib "ntdll.dll" #cfunc global RtlInterlockedPushListSListEx "RtlInterlockedPushListSListEx" intptr, intptr, intptr, int ; res = RtlInterlockedPushListSListEx(varptr(ListHead), varptr(List), varptr(ListEnd), Count) ; ListHead : SLIST_HEADER* in/out -> "intptr" ; List : SLIST_ENTRY* in/out -> "intptr" ; ListEnd : SLIST_ENTRY* in/out -> "intptr" ; Count : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ntdll = windows.NewLazySystemDLL("ntdll.dll")
procRtlInterlockedPushListSListEx = ntdll.NewProc("RtlInterlockedPushListSListEx")
)
// ListHead (SLIST_HEADER* in/out), List (SLIST_ENTRY* in/out), ListEnd (SLIST_ENTRY* in/out), Count (DWORD)
r1, _, err := procRtlInterlockedPushListSListEx.Call(
uintptr(ListHead),
uintptr(List),
uintptr(ListEnd),
uintptr(Count),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SLIST_ENTRY*function RtlInterlockedPushListSListEx(
ListHead: Pointer; // SLIST_HEADER* in/out
List: Pointer; // SLIST_ENTRY* in/out
ListEnd: Pointer; // SLIST_ENTRY* in/out
Count: DWORD // DWORD
): Pointer; stdcall;
external 'ntdll.dll' name 'RtlInterlockedPushListSListEx';result := DllCall("ntdll\RtlInterlockedPushListSListEx"
, "Ptr", ListHead ; SLIST_HEADER* in/out
, "Ptr", List ; SLIST_ENTRY* in/out
, "Ptr", ListEnd ; SLIST_ENTRY* in/out
, "UInt", Count ; DWORD
, "Ptr") ; return: SLIST_ENTRY*●RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count) = DLL("ntdll.dll", "void* RtlInterlockedPushListSListEx(void*, void*, void*, dword)")
# 呼び出し: RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count)
# ListHead : SLIST_HEADER* in/out -> "void*"
# List : SLIST_ENTRY* in/out -> "void*"
# ListEnd : SLIST_ENTRY* in/out -> "void*"
# Count : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "ntdll" fn RtlInterlockedPushListSListEx(
ListHead: [*c]SLIST_HEADER, // SLIST_HEADER* in/out
List: [*c]SLIST_ENTRY, // SLIST_ENTRY* in/out
ListEnd: [*c]SLIST_ENTRY, // SLIST_ENTRY* in/out
Count: u32 // DWORD
) callconv(std.os.windows.WINAPI) [*c]SLIST_ENTRY;proc RtlInterlockedPushListSListEx(
ListHead: ptr SLIST_HEADER, # SLIST_HEADER* in/out
List: ptr SLIST_ENTRY, # SLIST_ENTRY* in/out
ListEnd: ptr SLIST_ENTRY, # SLIST_ENTRY* in/out
Count: uint32 # DWORD
): ptr SLIST_ENTRY {.importc: "RtlInterlockedPushListSListEx", stdcall, dynlib: "ntdll.dll".}pragma(lib, "ntdll");
extern(Windows)
SLIST_ENTRY* RtlInterlockedPushListSListEx(
SLIST_HEADER* ListHead, // SLIST_HEADER* in/out
SLIST_ENTRY* List, // SLIST_ENTRY* in/out
SLIST_ENTRY* ListEnd, // SLIST_ENTRY* in/out
uint Count // DWORD
);ccall((:RtlInterlockedPushListSListEx, "ntdll.dll"), stdcall, Ptr{SLIST_ENTRY},
(Ptr{SLIST_HEADER}, Ptr{SLIST_ENTRY}, Ptr{SLIST_ENTRY}, UInt32),
ListHead, List, ListEnd, Count)
# ListHead : SLIST_HEADER* in/out -> Ptr{SLIST_HEADER}
# List : SLIST_ENTRY* in/out -> Ptr{SLIST_ENTRY}
# ListEnd : SLIST_ENTRY* in/out -> Ptr{SLIST_ENTRY}
# Count : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* RtlInterlockedPushListSListEx(
void* ListHead,
void* List,
void* ListEnd,
uint32_t Count);
]]
local ntdll = ffi.load("ntdll")
-- ntdll.RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count)
-- ListHead : SLIST_HEADER* in/out
-- List : SLIST_ENTRY* in/out
-- ListEnd : SLIST_ENTRY* in/out
-- Count : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('ntdll.dll');
const RtlInterlockedPushListSListEx = lib.func('__stdcall', 'RtlInterlockedPushListSListEx', 'void *', ['void *', 'void *', 'void *', 'uint32_t']);
// RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count)
// ListHead : SLIST_HEADER* in/out -> 'void *'
// List : SLIST_ENTRY* in/out -> 'void *'
// ListEnd : SLIST_ENTRY* in/out -> 'void *'
// Count : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ntdll.dll", {
RtlInterlockedPushListSListEx: { parameters: ["pointer", "pointer", "pointer", "u32"], result: "pointer" },
});
// lib.symbols.RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count)
// ListHead : SLIST_HEADER* in/out -> "pointer"
// List : SLIST_ENTRY* in/out -> "pointer"
// ListEnd : SLIST_ENTRY* in/out -> "pointer"
// Count : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* RtlInterlockedPushListSListEx(
void* ListHead,
void* List,
void* ListEnd,
uint32_t Count);
C, "ntdll.dll");
// $ffi->RtlInterlockedPushListSListEx(ListHead, List, ListEnd, Count);
// ListHead : SLIST_HEADER* in/out
// List : SLIST_ENTRY* in/out
// ListEnd : SLIST_ENTRY* in/out
// Count : DWORD
// 構造体/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 Ntdll extends StdCallLibrary {
Ntdll INSTANCE = Native.load("ntdll", Ntdll.class);
Pointer RtlInterlockedPushListSListEx(
Pointer ListHead, // SLIST_HEADER* in/out
Pointer List, // SLIST_ENTRY* in/out
Pointer ListEnd, // SLIST_ENTRY* in/out
int Count // DWORD
);
}@[Link("ntdll")]
lib Libntdll
fun RtlInterlockedPushListSListEx = RtlInterlockedPushListSListEx(
ListHead : SLIST_HEADER*, # SLIST_HEADER* in/out
List : SLIST_ENTRY*, # SLIST_ENTRY* in/out
ListEnd : SLIST_ENTRY*, # SLIST_ENTRY* in/out
Count : UInt32 # DWORD
) : SLIST_ENTRY*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RtlInterlockedPushListSListExNative = Pointer<Void> Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Uint32);
typedef RtlInterlockedPushListSListExDart = Pointer<Void> Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, int);
final RtlInterlockedPushListSListEx = DynamicLibrary.open('ntdll.dll')
.lookupFunction<RtlInterlockedPushListSListExNative, RtlInterlockedPushListSListExDart>('RtlInterlockedPushListSListEx');
// ListHead : SLIST_HEADER* in/out -> Pointer<Void>
// List : SLIST_ENTRY* in/out -> Pointer<Void>
// ListEnd : SLIST_ENTRY* in/out -> Pointer<Void>
// Count : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RtlInterlockedPushListSListEx(
ListHead: Pointer; // SLIST_HEADER* in/out
List: Pointer; // SLIST_ENTRY* in/out
ListEnd: Pointer; // SLIST_ENTRY* in/out
Count: DWORD // DWORD
): Pointer; stdcall;
external 'ntdll.dll' name 'RtlInterlockedPushListSListEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RtlInterlockedPushListSListEx"
c_RtlInterlockedPushListSListEx :: Ptr () -> Ptr () -> Ptr () -> Word32 -> IO (Ptr ())
-- ListHead : SLIST_HEADER* in/out -> Ptr ()
-- List : SLIST_ENTRY* in/out -> Ptr ()
-- ListEnd : SLIST_ENTRY* in/out -> Ptr ()
-- Count : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rtlinterlockedpushlistslistex =
foreign "RtlInterlockedPushListSListEx"
((ptr void) @-> (ptr void) @-> (ptr void) @-> uint32_t @-> returning (ptr void))
(* ListHead : SLIST_HEADER* in/out -> (ptr void) *)
(* List : SLIST_ENTRY* in/out -> (ptr void) *)
(* ListEnd : SLIST_ENTRY* in/out -> (ptr void) *)
(* Count : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library ntdll (t "ntdll.dll"))
(cffi:use-foreign-library ntdll)
(cffi:defcfun ("RtlInterlockedPushListSListEx" rtl-interlocked-push-list-slist-ex :convention :stdcall) :pointer
(list-head :pointer) ; SLIST_HEADER* in/out
(list :pointer) ; SLIST_ENTRY* in/out
(list-end :pointer) ; SLIST_ENTRY* in/out
(count :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RtlInterlockedPushListSListEx = Win32::API::More->new('ntdll',
'LPVOID RtlInterlockedPushListSListEx(LPVOID ListHead, LPVOID List, LPVOID ListEnd, DWORD Count)');
# my $ret = $RtlInterlockedPushListSListEx->Call($ListHead, $List, $ListEnd, $Count);
# ListHead : SLIST_HEADER* in/out -> LPVOID
# List : SLIST_ENTRY* in/out -> LPVOID
# ListEnd : SLIST_ENTRY* in/out -> LPVOID
# Count : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。