Win32 API 日本語リファレンス
ホームSystem.Threading › CreateBoundaryDescriptorW

CreateBoundaryDescriptorW

関数
名前空間用の境界記述子を作成する。
DLLKERNEL32.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// KERNEL32.dll  (Unicode / -W)
#include <windows.h>

HANDLE CreateBoundaryDescriptorW(
    LPCWSTR Name,
    DWORD Flags
);

パラメーター

名前方向
NameLPCWSTRin
FlagsDWORDin

戻り値の型: HANDLE

各言語での呼び出し定義

// KERNEL32.dll  (Unicode / -W)
#include <windows.h>

HANDLE CreateBoundaryDescriptorW(
    LPCWSTR Name,
    DWORD Flags
);
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern IntPtr CreateBoundaryDescriptorW(
    [MarshalAs(UnmanagedType.LPWStr)] string Name,   // LPCWSTR
    uint Flags   // DWORD
);
<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function CreateBoundaryDescriptorW(
    <MarshalAs(UnmanagedType.LPWStr)> Name As String,   ' LPCWSTR
    Flags As UInteger   ' DWORD
) As IntPtr
End Function
' Name : LPCWSTR
' Flags : DWORD
Declare PtrSafe Function CreateBoundaryDescriptorW Lib "kernel32" ( _
    ByVal Name As LongPtr, _
    ByVal Flags As Long) As LongPtr
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreateBoundaryDescriptorW = ctypes.windll.kernel32.CreateBoundaryDescriptorW
CreateBoundaryDescriptorW.restype = ctypes.c_void_p
CreateBoundaryDescriptorW.argtypes = [
    wintypes.LPCWSTR,  # Name : LPCWSTR
    wintypes.DWORD,  # Flags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
CreateBoundaryDescriptorW = Fiddle::Function.new(
  lib['CreateBoundaryDescriptorW'],
  [
    Fiddle::TYPE_VOIDP,  # Name : LPCWSTR
    -Fiddle::TYPE_INT,  # Flags : DWORD
  ],
  Fiddle::TYPE_VOIDP)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "kernel32")]
extern "system" {
    fn CreateBoundaryDescriptorW(
        Name: *const u16,  // LPCWSTR
        Flags: u32  // DWORD
    ) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr CreateBoundaryDescriptorW([MarshalAs(UnmanagedType.LPWStr)] string Name, uint Flags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_CreateBoundaryDescriptorW' -Namespace Win32 -PassThru
# $api::CreateBoundaryDescriptorW(Name, Flags)
#uselib "KERNEL32.dll"
#func global CreateBoundaryDescriptorW "CreateBoundaryDescriptorW" wptr, wptr
; CreateBoundaryDescriptorW Name, Flags   ; 戻り値は stat
; Name : LPCWSTR -> "wptr"
; Flags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "KERNEL32.dll"
#cfunc global CreateBoundaryDescriptorW "CreateBoundaryDescriptorW" wstr, int
; res = CreateBoundaryDescriptorW(Name, Flags)
; Name : LPCWSTR -> "wstr"
; Flags : DWORD -> "int"
; HANDLE CreateBoundaryDescriptorW(LPCWSTR Name, DWORD Flags)
#uselib "KERNEL32.dll"
#cfunc global CreateBoundaryDescriptorW "CreateBoundaryDescriptorW" wstr, int
; res = CreateBoundaryDescriptorW(Name, Flags)
; Name : LPCWSTR -> "wstr"
; Flags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procCreateBoundaryDescriptorW = kernel32.NewProc("CreateBoundaryDescriptorW")
)

// Name (LPCWSTR), Flags (DWORD)
r1, _, err := procCreateBoundaryDescriptorW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(Name))),
	uintptr(Flags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HANDLE
function CreateBoundaryDescriptorW(
  Name: PWideChar;   // LPCWSTR
  Flags: DWORD   // DWORD
): THandle; stdcall;
  external 'KERNEL32.dll' name 'CreateBoundaryDescriptorW';
result := DllCall("KERNEL32\CreateBoundaryDescriptorW"
    , "WStr", Name   ; LPCWSTR
    , "UInt", Flags   ; DWORD
    , "Ptr")   ; return: HANDLE
●CreateBoundaryDescriptorW(Name, Flags) = DLL("KERNEL32.dll", "void* CreateBoundaryDescriptorW(char*, dword)")
# 呼び出し: CreateBoundaryDescriptorW(Name, Flags)
# Name : LPCWSTR -> "char*"
# Flags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。