Win32 API 日本語リファレンス
ホームSecurity › FreeSid

FreeSid

関数
AllocateAndInitializeSidで割り当てたSIDを解放する。
DLLADVAPI32.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

void* FreeSid(
    PSID pSid
);

パラメーター

名前方向
pSidPSIDin

戻り値の型: void*

各言語での呼び出し定義

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

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

FreeSid = ctypes.windll.advapi32.FreeSid
FreeSid.restype = ctypes.c_void_p
FreeSid.argtypes = [
    wintypes.HANDLE,  # pSid : PSID
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVAPI32.dll')
FreeSid = Fiddle::Function.new(
  lib['FreeSid'],
  [
    Fiddle::TYPE_VOIDP,  # pSid : PSID
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "advapi32")]
extern "system" {
    fn FreeSid(
        pSid: *mut core::ffi::c_void  // PSID
    ) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern IntPtr FreeSid(IntPtr pSid);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_FreeSid' -Namespace Win32 -PassThru
# $api::FreeSid(pSid)
#uselib "ADVAPI32.dll"
#func global FreeSid "FreeSid" sptr
; FreeSid pSid   ; 戻り値は stat
; pSid : PSID -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVAPI32.dll"
#cfunc global FreeSid "FreeSid" sptr
; res = FreeSid(pSid)
; pSid : PSID -> "sptr"
; void* FreeSid(PSID pSid)
#uselib "ADVAPI32.dll"
#cfunc global FreeSid "FreeSid" intptr
; res = FreeSid(pSid)
; pSid : PSID -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
	procFreeSid = advapi32.NewProc("FreeSid")
)

// pSid (PSID)
r1, _, err := procFreeSid.Call(
	uintptr(pSid),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void*
function FreeSid(
  pSid: THandle   // PSID
): Pointer; stdcall;
  external 'ADVAPI32.dll' name 'FreeSid';
result := DllCall("ADVAPI32\FreeSid"
    , "Ptr", pSid   ; PSID
    , "Ptr")   ; return: void*
●FreeSid(pSid) = DLL("ADVAPI32.dll", "void* FreeSid(void*)")
# 呼び出し: FreeSid(pSid)
# pSid : PSID -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。