ホーム › System.AddressBook › ScRelocNotifications
ScRelocNotifications
関数移動された通知配列内のポインタを再配置する。
シグネチャ
// MAPI32.dll
#include <windows.h>
INT ScRelocNotifications(
INT cNotification,
NOTIFICATION* lpNotifications,
void* lpvBaseOld,
void* lpvBaseNew,
DWORD* lpcb
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| cNotification | INT | in | 再配置する通知の件数を示す整数。 |
| lpNotifications | NOTIFICATION* | inout | ポインタを修正する対象のNOTIFICATION構造体配列へのポインタ。 |
| lpvBaseOld | void* | inout | 移動前の基準アドレスへのポインタ。内部ポインタの旧基点を表す。 |
| lpvBaseNew | void* | inout | 移動後の基準アドレスへのポインタ。内部ポインタの新基点を表す。 |
| lpcb | DWORD* | inout | 処理したバイト数を返すDWORDポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
INT ScRelocNotifications(
INT cNotification,
NOTIFICATION* lpNotifications,
void* lpvBaseOld,
void* lpvBaseNew,
DWORD* lpcb
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int ScRelocNotifications(
int cNotification, // INT
IntPtr lpNotifications, // NOTIFICATION* in/out
IntPtr lpvBaseOld, // void* in/out
IntPtr lpvBaseNew, // void* in/out
ref uint lpcb // DWORD* in/out
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function ScRelocNotifications(
cNotification As Integer, ' INT
lpNotifications As IntPtr, ' NOTIFICATION* in/out
lpvBaseOld As IntPtr, ' void* in/out
lpvBaseNew As IntPtr, ' void* in/out
ByRef lpcb As UInteger ' DWORD* in/out
) As Integer
End Function' cNotification : INT
' lpNotifications : NOTIFICATION* in/out
' lpvBaseOld : void* in/out
' lpvBaseNew : void* in/out
' lpcb : DWORD* in/out
Declare PtrSafe Function ScRelocNotifications Lib "mapi32" ( _
ByVal cNotification As Long, _
ByVal lpNotifications As LongPtr, _
ByVal lpvBaseOld As LongPtr, _
ByVal lpvBaseNew As LongPtr, _
ByRef lpcb As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScRelocNotifications = ctypes.windll.mapi32.ScRelocNotifications
ScRelocNotifications.restype = ctypes.c_int
ScRelocNotifications.argtypes = [
ctypes.c_int, # cNotification : INT
ctypes.c_void_p, # lpNotifications : NOTIFICATION* in/out
ctypes.POINTER(None), # lpvBaseOld : void* in/out
ctypes.POINTER(None), # lpvBaseNew : void* in/out
ctypes.POINTER(wintypes.DWORD), # lpcb : DWORD* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
ScRelocNotifications = Fiddle::Function.new(
lib['ScRelocNotifications'],
[
Fiddle::TYPE_INT, # cNotification : INT
Fiddle::TYPE_VOIDP, # lpNotifications : NOTIFICATION* in/out
Fiddle::TYPE_VOIDP, # lpvBaseOld : void* in/out
Fiddle::TYPE_VOIDP, # lpvBaseNew : void* in/out
Fiddle::TYPE_VOIDP, # lpcb : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn ScRelocNotifications(
cNotification: i32, // INT
lpNotifications: *mut NOTIFICATION, // NOTIFICATION* in/out
lpvBaseOld: *mut (), // void* in/out
lpvBaseNew: *mut (), // void* in/out
lpcb: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int ScRelocNotifications(int cNotification, IntPtr lpNotifications, IntPtr lpvBaseOld, IntPtr lpvBaseNew, ref uint lpcb);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_ScRelocNotifications' -Namespace Win32 -PassThru
# $api::ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb)#uselib "MAPI32.dll"
#func global ScRelocNotifications "ScRelocNotifications" sptr, sptr, sptr, sptr, sptr
; ScRelocNotifications cNotification, varptr(lpNotifications), lpvBaseOld, lpvBaseNew, varptr(lpcb) ; 戻り値は stat
; cNotification : INT -> "sptr"
; lpNotifications : NOTIFICATION* in/out -> "sptr"
; lpvBaseOld : void* in/out -> "sptr"
; lpvBaseNew : void* in/out -> "sptr"
; lpcb : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MAPI32.dll" #cfunc global ScRelocNotifications "ScRelocNotifications" int, var, sptr, sptr, var ; res = ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb) ; cNotification : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "var" ; lpvBaseOld : void* in/out -> "sptr" ; lpvBaseNew : void* in/out -> "sptr" ; lpcb : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MAPI32.dll" #cfunc global ScRelocNotifications "ScRelocNotifications" int, sptr, sptr, sptr, sptr ; res = ScRelocNotifications(cNotification, varptr(lpNotifications), lpvBaseOld, lpvBaseNew, varptr(lpcb)) ; cNotification : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "sptr" ; lpvBaseOld : void* in/out -> "sptr" ; lpvBaseNew : void* in/out -> "sptr" ; lpcb : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ScRelocNotifications(INT cNotification, NOTIFICATION* lpNotifications, void* lpvBaseOld, void* lpvBaseNew, DWORD* lpcb) #uselib "MAPI32.dll" #cfunc global ScRelocNotifications "ScRelocNotifications" int, var, intptr, intptr, var ; res = ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb) ; cNotification : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "var" ; lpvBaseOld : void* in/out -> "intptr" ; lpvBaseNew : void* in/out -> "intptr" ; lpcb : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ScRelocNotifications(INT cNotification, NOTIFICATION* lpNotifications, void* lpvBaseOld, void* lpvBaseNew, DWORD* lpcb) #uselib "MAPI32.dll" #cfunc global ScRelocNotifications "ScRelocNotifications" int, intptr, intptr, intptr, intptr ; res = ScRelocNotifications(cNotification, varptr(lpNotifications), lpvBaseOld, lpvBaseNew, varptr(lpcb)) ; cNotification : INT -> "int" ; lpNotifications : NOTIFICATION* in/out -> "intptr" ; lpvBaseOld : void* in/out -> "intptr" ; lpvBaseNew : void* in/out -> "intptr" ; lpcb : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procScRelocNotifications = mapi32.NewProc("ScRelocNotifications")
)
// cNotification (INT), lpNotifications (NOTIFICATION* in/out), lpvBaseOld (void* in/out), lpvBaseNew (void* in/out), lpcb (DWORD* in/out)
r1, _, err := procScRelocNotifications.Call(
uintptr(cNotification),
uintptr(lpNotifications),
uintptr(lpvBaseOld),
uintptr(lpvBaseNew),
uintptr(lpcb),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ScRelocNotifications(
cNotification: Integer; // INT
lpNotifications: Pointer; // NOTIFICATION* in/out
lpvBaseOld: Pointer; // void* in/out
lpvBaseNew: Pointer; // void* in/out
lpcb: Pointer // DWORD* in/out
): Integer; stdcall;
external 'MAPI32.dll' name 'ScRelocNotifications';result := DllCall("MAPI32\ScRelocNotifications"
, "Int", cNotification ; INT
, "Ptr", lpNotifications ; NOTIFICATION* in/out
, "Ptr", lpvBaseOld ; void* in/out
, "Ptr", lpvBaseNew ; void* in/out
, "Ptr", lpcb ; DWORD* in/out
, "Int") ; return: INT●ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb) = DLL("MAPI32.dll", "int ScRelocNotifications(int, void*, void*, void*, void*)")
# 呼び出し: ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb)
# cNotification : INT -> "int"
# lpNotifications : NOTIFICATION* in/out -> "void*"
# lpvBaseOld : void* in/out -> "void*"
# lpvBaseNew : void* in/out -> "void*"
# lpcb : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "mapi32" fn ScRelocNotifications(
cNotification: i32, // INT
lpNotifications: [*c]NOTIFICATION, // NOTIFICATION* in/out
lpvBaseOld: ?*anyopaque, // void* in/out
lpvBaseNew: ?*anyopaque, // void* in/out
lpcb: [*c]u32 // DWORD* in/out
) callconv(std.os.windows.WINAPI) i32;proc ScRelocNotifications(
cNotification: int32, # INT
lpNotifications: ptr NOTIFICATION, # NOTIFICATION* in/out
lpvBaseOld: pointer, # void* in/out
lpvBaseNew: pointer, # void* in/out
lpcb: ptr uint32 # DWORD* in/out
): int32 {.importc: "ScRelocNotifications", stdcall, dynlib: "MAPI32.dll".}pragma(lib, "mapi32");
extern(Windows)
int ScRelocNotifications(
int cNotification, // INT
NOTIFICATION* lpNotifications, // NOTIFICATION* in/out
void* lpvBaseOld, // void* in/out
void* lpvBaseNew, // void* in/out
uint* lpcb // DWORD* in/out
);ccall((:ScRelocNotifications, "MAPI32.dll"), stdcall, Int32,
(Int32, Ptr{NOTIFICATION}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{UInt32}),
cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb)
# cNotification : INT -> Int32
# lpNotifications : NOTIFICATION* in/out -> Ptr{NOTIFICATION}
# lpvBaseOld : void* in/out -> Ptr{Cvoid}
# lpvBaseNew : void* in/out -> Ptr{Cvoid}
# lpcb : DWORD* in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ScRelocNotifications(
int32_t cNotification,
void* lpNotifications,
void* lpvBaseOld,
void* lpvBaseNew,
uint32_t* lpcb);
]]
local mapi32 = ffi.load("mapi32")
-- mapi32.ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb)
-- cNotification : INT
-- lpNotifications : NOTIFICATION* in/out
-- lpvBaseOld : void* in/out
-- lpvBaseNew : void* in/out
-- lpcb : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MAPI32.dll');
const ScRelocNotifications = lib.func('__stdcall', 'ScRelocNotifications', 'int32_t', ['int32_t', 'void *', 'void *', 'void *', 'uint32_t *']);
// ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb)
// cNotification : INT -> 'int32_t'
// lpNotifications : NOTIFICATION* in/out -> 'void *'
// lpvBaseOld : void* in/out -> 'void *'
// lpvBaseNew : void* in/out -> 'void *'
// lpcb : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MAPI32.dll", {
ScRelocNotifications: { parameters: ["i32", "pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb)
// cNotification : INT -> "i32"
// lpNotifications : NOTIFICATION* in/out -> "pointer"
// lpvBaseOld : void* in/out -> "pointer"
// lpvBaseNew : void* in/out -> "pointer"
// lpcb : DWORD* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ScRelocNotifications(
int32_t cNotification,
void* lpNotifications,
void* lpvBaseOld,
void* lpvBaseNew,
uint32_t* lpcb);
C, "MAPI32.dll");
// $ffi->ScRelocNotifications(cNotification, lpNotifications, lpvBaseOld, lpvBaseNew, lpcb);
// cNotification : INT
// lpNotifications : NOTIFICATION* in/out
// lpvBaseOld : void* in/out
// lpvBaseNew : void* in/out
// lpcb : DWORD* 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 Mapi32 extends StdCallLibrary {
Mapi32 INSTANCE = Native.load("mapi32", Mapi32.class);
int ScRelocNotifications(
int cNotification, // INT
Pointer lpNotifications, // NOTIFICATION* in/out
Pointer lpvBaseOld, // void* in/out
Pointer lpvBaseNew, // void* in/out
IntByReference lpcb // DWORD* in/out
);
}@[Link("mapi32")]
lib LibMAPI32
fun ScRelocNotifications = ScRelocNotifications(
cNotification : Int32, # INT
lpNotifications : NOTIFICATION*, # NOTIFICATION* in/out
lpvBaseOld : Void*, # void* in/out
lpvBaseNew : Void*, # void* in/out
lpcb : UInt32* # DWORD* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ScRelocNotificationsNative = Int32 Function(Int32, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
typedef ScRelocNotificationsDart = int Function(int, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Uint32>);
final ScRelocNotifications = DynamicLibrary.open('MAPI32.dll')
.lookupFunction<ScRelocNotificationsNative, ScRelocNotificationsDart>('ScRelocNotifications');
// cNotification : INT -> Int32
// lpNotifications : NOTIFICATION* in/out -> Pointer<Void>
// lpvBaseOld : void* in/out -> Pointer<Void>
// lpvBaseNew : void* in/out -> Pointer<Void>
// lpcb : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ScRelocNotifications(
cNotification: Integer; // INT
lpNotifications: Pointer; // NOTIFICATION* in/out
lpvBaseOld: Pointer; // void* in/out
lpvBaseNew: Pointer; // void* in/out
lpcb: Pointer // DWORD* in/out
): Integer; stdcall;
external 'MAPI32.dll' name 'ScRelocNotifications';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ScRelocNotifications"
c_ScRelocNotifications :: Int32 -> Ptr () -> Ptr () -> Ptr () -> Ptr Word32 -> IO Int32
-- cNotification : INT -> Int32
-- lpNotifications : NOTIFICATION* in/out -> Ptr ()
-- lpvBaseOld : void* in/out -> Ptr ()
-- lpvBaseNew : void* in/out -> Ptr ()
-- lpcb : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let screlocnotifications =
foreign "ScRelocNotifications"
(int32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> returning int32_t)
(* cNotification : INT -> int32_t *)
(* lpNotifications : NOTIFICATION* in/out -> (ptr void) *)
(* lpvBaseOld : void* in/out -> (ptr void) *)
(* lpvBaseNew : void* in/out -> (ptr void) *)
(* lpcb : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mapi32 (t "MAPI32.dll"))
(cffi:use-foreign-library mapi32)
(cffi:defcfun ("ScRelocNotifications" sc-reloc-notifications :convention :stdcall) :int32
(c-notification :int32) ; INT
(lp-notifications :pointer) ; NOTIFICATION* in/out
(lpv-base-old :pointer) ; void* in/out
(lpv-base-new :pointer) ; void* in/out
(lpcb :pointer)) ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ScRelocNotifications = Win32::API::More->new('MAPI32',
'int ScRelocNotifications(int cNotification, LPVOID lpNotifications, LPVOID lpvBaseOld, LPVOID lpvBaseNew, LPVOID lpcb)');
# my $ret = $ScRelocNotifications->Call($cNotification, $lpNotifications, $lpvBaseOld, $lpvBaseNew, $lpcb);
# cNotification : INT -> int
# lpNotifications : NOTIFICATION* in/out -> LPVOID
# lpvBaseOld : void* in/out -> LPVOID
# lpvBaseNew : void* in/out -> LPVOID
# lpcb : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型