ホーム › System.Threading › OpenPrivateNamespaceA
OpenPrivateNamespaceA
関数既存のプライベート名前空間を開く(ANSI版)。
シグネチャ
// KERNEL32.dll (ANSI / -A)
#include <windows.h>
HANDLE OpenPrivateNamespaceA(
void* lpBoundaryDescriptor,
LPCSTR lpAliasPrefix
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpBoundaryDescriptor | void* | in |
| lpAliasPrefix | LPCSTR | in |
戻り値の型: HANDLE
各言語での呼び出し定義
// KERNEL32.dll (ANSI / -A)
#include <windows.h>
HANDLE OpenPrivateNamespaceA(
void* lpBoundaryDescriptor,
LPCSTR lpAliasPrefix
);[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern IntPtr OpenPrivateNamespaceA(
IntPtr lpBoundaryDescriptor, // void*
[MarshalAs(UnmanagedType.LPStr)] string lpAliasPrefix // LPCSTR
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function OpenPrivateNamespaceA(
lpBoundaryDescriptor As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> lpAliasPrefix As String ' LPCSTR
) As IntPtr
End Function' lpBoundaryDescriptor : void*
' lpAliasPrefix : LPCSTR
Declare PtrSafe Function OpenPrivateNamespaceA Lib "kernel32" ( _
ByVal lpBoundaryDescriptor As LongPtr, _
ByVal lpAliasPrefix As String) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
OpenPrivateNamespaceA = ctypes.windll.kernel32.OpenPrivateNamespaceA
OpenPrivateNamespaceA.restype = ctypes.c_void_p
OpenPrivateNamespaceA.argtypes = [
ctypes.POINTER(None), # lpBoundaryDescriptor : void*
wintypes.LPCSTR, # lpAliasPrefix : LPCSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
OpenPrivateNamespaceA = Fiddle::Function.new(
lib['OpenPrivateNamespaceA'],
[
Fiddle::TYPE_VOIDP, # lpBoundaryDescriptor : void*
Fiddle::TYPE_VOIDP, # lpAliasPrefix : LPCSTR
],
Fiddle::TYPE_VOIDP)#[link(name = "kernel32")]
extern "system" {
fn OpenPrivateNamespaceA(
lpBoundaryDescriptor: *mut (), // void*
lpAliasPrefix: *const u8 // LPCSTR
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr OpenPrivateNamespaceA(IntPtr lpBoundaryDescriptor, [MarshalAs(UnmanagedType.LPStr)] string lpAliasPrefix);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_OpenPrivateNamespaceA' -Namespace Win32 -PassThru
# $api::OpenPrivateNamespaceA(lpBoundaryDescriptor, lpAliasPrefix)#uselib "KERNEL32.dll"
#func global OpenPrivateNamespaceA "OpenPrivateNamespaceA" sptr, sptr
; OpenPrivateNamespaceA lpBoundaryDescriptor, lpAliasPrefix ; 戻り値は stat
; lpBoundaryDescriptor : void* -> "sptr"
; lpAliasPrefix : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global OpenPrivateNamespaceA "OpenPrivateNamespaceA" sptr, str
; res = OpenPrivateNamespaceA(lpBoundaryDescriptor, lpAliasPrefix)
; lpBoundaryDescriptor : void* -> "sptr"
; lpAliasPrefix : LPCSTR -> "str"; HANDLE OpenPrivateNamespaceA(void* lpBoundaryDescriptor, LPCSTR lpAliasPrefix)
#uselib "KERNEL32.dll"
#cfunc global OpenPrivateNamespaceA "OpenPrivateNamespaceA" intptr, str
; res = OpenPrivateNamespaceA(lpBoundaryDescriptor, lpAliasPrefix)
; lpBoundaryDescriptor : void* -> "intptr"
; lpAliasPrefix : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procOpenPrivateNamespaceA = kernel32.NewProc("OpenPrivateNamespaceA")
)
// lpBoundaryDescriptor (void*), lpAliasPrefix (LPCSTR)
r1, _, err := procOpenPrivateNamespaceA.Call(
uintptr(lpBoundaryDescriptor),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpAliasPrefix))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction OpenPrivateNamespaceA(
lpBoundaryDescriptor: Pointer; // void*
lpAliasPrefix: PAnsiChar // LPCSTR
): THandle; stdcall;
external 'KERNEL32.dll' name 'OpenPrivateNamespaceA';result := DllCall("KERNEL32\OpenPrivateNamespaceA"
, "Ptr", lpBoundaryDescriptor ; void*
, "AStr", lpAliasPrefix ; LPCSTR
, "Ptr") ; return: HANDLE●OpenPrivateNamespaceA(lpBoundaryDescriptor, lpAliasPrefix) = DLL("KERNEL32.dll", "void* OpenPrivateNamespaceA(void*, char*)")
# 呼び出し: OpenPrivateNamespaceA(lpBoundaryDescriptor, lpAliasPrefix)
# lpBoundaryDescriptor : void* -> "void*"
# lpAliasPrefix : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。