ホーム › Networking.ActiveDirectory › ReallocADsStr
ReallocADsStr
関数ADSI用文字列を新しい値で再確保する。
シグネチャ
// ACTIVEDS.dll
#include <windows.h>
BOOL ReallocADsStr(
LPWSTR* ppStr,
LPWSTR pStr
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ppStr | LPWSTR* | inout |
| pStr | LPWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// ACTIVEDS.dll
#include <windows.h>
BOOL ReallocADsStr(
LPWSTR* ppStr,
LPWSTR pStr
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ACTIVEDS.dll", ExactSpelling = true)]
static extern bool ReallocADsStr(
IntPtr ppStr, // LPWSTR* in/out
[MarshalAs(UnmanagedType.LPWStr)] string pStr // LPWSTR
);<DllImport("ACTIVEDS.dll", ExactSpelling:=True)>
Public Shared Function ReallocADsStr(
ppStr As IntPtr, ' LPWSTR* in/out
<MarshalAs(UnmanagedType.LPWStr)> pStr As String ' LPWSTR
) As Boolean
End Function' ppStr : LPWSTR* in/out
' pStr : LPWSTR
Declare PtrSafe Function ReallocADsStr Lib "activeds" ( _
ByVal ppStr As LongPtr, _
ByVal pStr As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ReallocADsStr = ctypes.windll.activeds.ReallocADsStr
ReallocADsStr.restype = wintypes.BOOL
ReallocADsStr.argtypes = [
ctypes.c_void_p, # ppStr : LPWSTR* in/out
wintypes.LPCWSTR, # pStr : LPWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ACTIVEDS.dll')
ReallocADsStr = Fiddle::Function.new(
lib['ReallocADsStr'],
[
Fiddle::TYPE_VOIDP, # ppStr : LPWSTR* in/out
Fiddle::TYPE_VOIDP, # pStr : LPWSTR
],
Fiddle::TYPE_INT)#[link(name = "activeds")]
extern "system" {
fn ReallocADsStr(
ppStr: *mut *mut u16, // LPWSTR* in/out
pStr: *mut u16 // LPWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ACTIVEDS.dll")]
public static extern bool ReallocADsStr(IntPtr ppStr, [MarshalAs(UnmanagedType.LPWStr)] string pStr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ACTIVEDS_ReallocADsStr' -Namespace Win32 -PassThru
# $api::ReallocADsStr(ppStr, pStr)#uselib "ACTIVEDS.dll"
#func global ReallocADsStr "ReallocADsStr" sptr, sptr
; ReallocADsStr varptr(ppStr), pStr ; 戻り値は stat
; ppStr : LPWSTR* in/out -> "sptr"
; pStr : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ACTIVEDS.dll" #cfunc global ReallocADsStr "ReallocADsStr" var, wstr ; res = ReallocADsStr(ppStr, pStr) ; ppStr : LPWSTR* in/out -> "var" ; pStr : LPWSTR -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ACTIVEDS.dll" #cfunc global ReallocADsStr "ReallocADsStr" sptr, wstr ; res = ReallocADsStr(varptr(ppStr), pStr) ; ppStr : LPWSTR* in/out -> "sptr" ; pStr : LPWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL ReallocADsStr(LPWSTR* ppStr, LPWSTR pStr) #uselib "ACTIVEDS.dll" #cfunc global ReallocADsStr "ReallocADsStr" var, wstr ; res = ReallocADsStr(ppStr, pStr) ; ppStr : LPWSTR* in/out -> "var" ; pStr : LPWSTR -> "wstr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL ReallocADsStr(LPWSTR* ppStr, LPWSTR pStr) #uselib "ACTIVEDS.dll" #cfunc global ReallocADsStr "ReallocADsStr" intptr, wstr ; res = ReallocADsStr(varptr(ppStr), pStr) ; ppStr : LPWSTR* in/out -> "intptr" ; pStr : LPWSTR -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
activeds = windows.NewLazySystemDLL("ACTIVEDS.dll")
procReallocADsStr = activeds.NewProc("ReallocADsStr")
)
// ppStr (LPWSTR* in/out), pStr (LPWSTR)
r1, _, err := procReallocADsStr.Call(
uintptr(ppStr),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pStr))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ReallocADsStr(
ppStr: PPWideChar; // LPWSTR* in/out
pStr: PWideChar // LPWSTR
): BOOL; stdcall;
external 'ACTIVEDS.dll' name 'ReallocADsStr';result := DllCall("ACTIVEDS\ReallocADsStr"
, "Ptr", ppStr ; LPWSTR* in/out
, "WStr", pStr ; LPWSTR
, "Int") ; return: BOOL●ReallocADsStr(ppStr, pStr) = DLL("ACTIVEDS.dll", "bool ReallocADsStr(void*, char*)")
# 呼び出し: ReallocADsStr(ppStr, pStr)
# ppStr : LPWSTR* in/out -> "void*"
# pStr : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。