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