Win32 API 日本語リファレンス
ホームDevices.WebServicesOnDevices › WSDAttachLinkedMemory

WSDAttachLinkedMemory

関数
連結メモリの子ブロックを指定した親に付け替える。
DLLwsdapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void WSDAttachLinkedMemory(
    void* pParent,
    void* pChild
);

パラメーター

名前方向説明
pParentvoid*inout連結先となる親メモリブロックへのポインタ。
pChildvoid*inout親へ連結する子メモリブロックへのポインタ。

戻り値の型: void

各言語での呼び出し定義

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

void WSDAttachLinkedMemory(
    void* pParent,
    void* pChild
);
[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern void WSDAttachLinkedMemory(
    IntPtr pParent,   // void* in/out
    IntPtr pChild   // void* in/out
);
<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Sub WSDAttachLinkedMemory(
    pParent As IntPtr,   ' void* in/out
    pChild As IntPtr   ' void* in/out
)
End Sub
' pParent : void* in/out
' pChild : void* in/out
Declare PtrSafe Sub WSDAttachLinkedMemory Lib "wsdapi" ( _
    ByVal pParent As LongPtr, _
    ByVal pChild As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WSDAttachLinkedMemory = ctypes.windll.wsdapi.WSDAttachLinkedMemory
WSDAttachLinkedMemory.restype = None
WSDAttachLinkedMemory.argtypes = [
    ctypes.POINTER(None),  # pParent : void* in/out
    ctypes.POINTER(None),  # pChild : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsdapi.dll')
WSDAttachLinkedMemory = Fiddle::Function.new(
  lib['WSDAttachLinkedMemory'],
  [
    Fiddle::TYPE_VOIDP,  # pParent : void* in/out
    Fiddle::TYPE_VOIDP,  # pChild : void* in/out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "wsdapi")]
extern "system" {
    fn WSDAttachLinkedMemory(
        pParent: *mut (),  // void* in/out
        pChild: *mut ()  // void* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsdapi.dll")]
public static extern void WSDAttachLinkedMemory(IntPtr pParent, IntPtr pChild);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDAttachLinkedMemory' -Namespace Win32 -PassThru
# $api::WSDAttachLinkedMemory(pParent, pChild)
#uselib "wsdapi.dll"
#func global WSDAttachLinkedMemory "WSDAttachLinkedMemory" sptr, sptr
; WSDAttachLinkedMemory pParent, pChild
; pParent : void* in/out -> "sptr"
; pChild : void* in/out -> "sptr"
#uselib "wsdapi.dll"
#func global WSDAttachLinkedMemory "WSDAttachLinkedMemory" sptr, sptr
; WSDAttachLinkedMemory pParent, pChild
; pParent : void* in/out -> "sptr"
; pChild : void* in/out -> "sptr"
; void WSDAttachLinkedMemory(void* pParent, void* pChild)
#uselib "wsdapi.dll"
#func global WSDAttachLinkedMemory "WSDAttachLinkedMemory" intptr, intptr
; WSDAttachLinkedMemory pParent, pChild
; pParent : void* in/out -> "intptr"
; pChild : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
	procWSDAttachLinkedMemory = wsdapi.NewProc("WSDAttachLinkedMemory")
)

// pParent (void* in/out), pChild (void* in/out)
r1, _, err := procWSDAttachLinkedMemory.Call(
	uintptr(pParent),
	uintptr(pChild),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure WSDAttachLinkedMemory(
  pParent: Pointer;   // void* in/out
  pChild: Pointer   // void* in/out
); stdcall;
  external 'wsdapi.dll' name 'WSDAttachLinkedMemory';
result := DllCall("wsdapi\WSDAttachLinkedMemory"
    , "Ptr", pParent   ; void* in/out
    , "Ptr", pChild   ; void* in/out
    , "Int")   ; return: void
●WSDAttachLinkedMemory(pParent, pChild) = DLL("wsdapi.dll", "int WSDAttachLinkedMemory(void*, void*)")
# 呼び出し: WSDAttachLinkedMemory(pParent, pChild)
# pParent : void* in/out -> "void*"
# pChild : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef WSDAttachLinkedMemoryNative = Void Function(Pointer<Void>, Pointer<Void>);
typedef WSDAttachLinkedMemoryDart = void Function(Pointer<Void>, Pointer<Void>);
final WSDAttachLinkedMemory = DynamicLibrary.open('wsdapi.dll')
    .lookupFunction<WSDAttachLinkedMemoryNative, WSDAttachLinkedMemoryDart>('WSDAttachLinkedMemory');
// pParent : void* in/out -> Pointer<Void>
// pChild : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure WSDAttachLinkedMemory(
  pParent: Pointer;   // void* in/out
  pChild: Pointer   // void* in/out
); stdcall;
  external 'wsdapi.dll' name 'WSDAttachLinkedMemory';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WSDAttachLinkedMemory"
  c_WSDAttachLinkedMemory :: Ptr () -> Ptr () -> IO ()
-- pParent : void* in/out -> Ptr ()
-- pChild : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wsdattachlinkedmemory =
  foreign "WSDAttachLinkedMemory"
    ((ptr void) @-> (ptr void) @-> returning void)
(* pParent : void* in/out -> (ptr void) *)
(* pChild : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wsdapi (t "wsdapi.dll"))
(cffi:use-foreign-library wsdapi)

(cffi:defcfun ("WSDAttachLinkedMemory" wsdattach-linked-memory :convention :stdcall) :void
  (p-parent :pointer)   ; void* in/out
  (p-child :pointer))   ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WSDAttachLinkedMemory = Win32::API::More->new('wsdapi',
    'void WSDAttachLinkedMemory(LPVOID pParent, LPVOID pChild)');
# my $ret = $WSDAttachLinkedMemory->Call($pParent, $pChild);
# pParent : void* in/out -> LPVOID
# pChild : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。