Win32 API 日本語リファレンス
ホームNetworking.ActiveDirectory › FreeADsStr

FreeADsStr

関数
AllocADsStrで確保した文字列を解放する。
DLLACTIVEDS.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

BOOL FreeADsStr(
    LPWSTR pStr
);

パラメーター

名前方向
pStrLPWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL FreeADsStr(
    LPWSTR pStr
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ACTIVEDS.dll", ExactSpelling = true)]
static extern bool FreeADsStr(
    [MarshalAs(UnmanagedType.LPWStr)] string pStr   // LPWSTR
);
<DllImport("ACTIVEDS.dll", ExactSpelling:=True)>
Public Shared Function FreeADsStr(
    <MarshalAs(UnmanagedType.LPWStr)> pStr As String   ' LPWSTR
) As Boolean
End Function
' pStr : LPWSTR
Declare PtrSafe Function FreeADsStr Lib "activeds" ( _
    ByVal pStr As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FreeADsStr = ctypes.windll.activeds.FreeADsStr
FreeADsStr.restype = wintypes.BOOL
FreeADsStr.argtypes = [
    wintypes.LPCWSTR,  # pStr : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ACTIVEDS.dll')
FreeADsStr = Fiddle::Function.new(
  lib['FreeADsStr'],
  [
    Fiddle::TYPE_VOIDP,  # pStr : LPWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "activeds")]
extern "system" {
    fn FreeADsStr(
        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 FreeADsStr([MarshalAs(UnmanagedType.LPWStr)] string pStr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ACTIVEDS_FreeADsStr' -Namespace Win32 -PassThru
# $api::FreeADsStr(pStr)
#uselib "ACTIVEDS.dll"
#func global FreeADsStr "FreeADsStr" sptr
; FreeADsStr pStr   ; 戻り値は stat
; pStr : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ACTIVEDS.dll"
#cfunc global FreeADsStr "FreeADsStr" wstr
; res = FreeADsStr(pStr)
; pStr : LPWSTR -> "wstr"
; BOOL FreeADsStr(LPWSTR pStr)
#uselib "ACTIVEDS.dll"
#cfunc global FreeADsStr "FreeADsStr" wstr
; res = FreeADsStr(pStr)
; pStr : LPWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	activeds = windows.NewLazySystemDLL("ACTIVEDS.dll")
	procFreeADsStr = activeds.NewProc("FreeADsStr")
)

// pStr (LPWSTR)
r1, _, err := procFreeADsStr.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pStr))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function FreeADsStr(
  pStr: PWideChar   // LPWSTR
): BOOL; stdcall;
  external 'ACTIVEDS.dll' name 'FreeADsStr';
result := DllCall("ACTIVEDS\FreeADsStr"
    , "WStr", pStr   ; LPWSTR
    , "Int")   ; return: BOOL
●FreeADsStr(pStr) = DLL("ACTIVEDS.dll", "bool FreeADsStr(char*)")
# 呼び出し: FreeADsStr(pStr)
# pStr : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。