ホーム › Storage.FileSystem › FindNextVolumeMountPointW
FindNextVolumeMountPointW
関数マウントポイント列挙で次の項目を取得する(Unicode版)。
シグネチャ
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
BOOL FindNextVolumeMountPointW(
HANDLE hFindVolumeMountPoint,
LPWSTR lpszVolumeMountPoint,
DWORD cchBufferLength
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hFindVolumeMountPoint | HANDLE | in |
| lpszVolumeMountPoint | LPWSTR | out |
| cchBufferLength | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll (Unicode / -W)
#include <windows.h>
BOOL FindNextVolumeMountPointW(
HANDLE hFindVolumeMountPoint,
LPWSTR lpszVolumeMountPoint,
DWORD cchBufferLength
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool FindNextVolumeMountPointW(
IntPtr hFindVolumeMountPoint, // HANDLE
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszVolumeMountPoint, // LPWSTR out
uint cchBufferLength // DWORD
);<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FindNextVolumeMountPointW(
hFindVolumeMountPoint As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPWStr)> lpszVolumeMountPoint As System.Text.StringBuilder, ' LPWSTR out
cchBufferLength As UInteger ' DWORD
) As Boolean
End Function' hFindVolumeMountPoint : HANDLE
' lpszVolumeMountPoint : LPWSTR out
' cchBufferLength : DWORD
Declare PtrSafe Function FindNextVolumeMountPointW Lib "kernel32" ( _
ByVal hFindVolumeMountPoint As LongPtr, _
ByVal lpszVolumeMountPoint As LongPtr, _
ByVal cchBufferLength As Long) As Long
' 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
FindNextVolumeMountPointW = ctypes.windll.kernel32.FindNextVolumeMountPointW
FindNextVolumeMountPointW.restype = wintypes.BOOL
FindNextVolumeMountPointW.argtypes = [
wintypes.HANDLE, # hFindVolumeMountPoint : HANDLE
wintypes.LPWSTR, # lpszVolumeMountPoint : LPWSTR out
wintypes.DWORD, # cchBufferLength : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
FindNextVolumeMountPointW = Fiddle::Function.new(
lib['FindNextVolumeMountPointW'],
[
Fiddle::TYPE_VOIDP, # hFindVolumeMountPoint : HANDLE
Fiddle::TYPE_VOIDP, # lpszVolumeMountPoint : LPWSTR out
-Fiddle::TYPE_INT, # cchBufferLength : DWORD
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "kernel32")]
extern "system" {
fn FindNextVolumeMountPointW(
hFindVolumeMountPoint: *mut core::ffi::c_void, // HANDLE
lpszVolumeMountPoint: *mut u16, // LPWSTR out
cchBufferLength: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool FindNextVolumeMountPointW(IntPtr hFindVolumeMountPoint, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszVolumeMountPoint, uint cchBufferLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_FindNextVolumeMountPointW' -Namespace Win32 -PassThru
# $api::FindNextVolumeMountPointW(hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength)#uselib "KERNEL32.dll"
#func global FindNextVolumeMountPointW "FindNextVolumeMountPointW" wptr, wptr, wptr
; FindNextVolumeMountPointW hFindVolumeMountPoint, varptr(lpszVolumeMountPoint), cchBufferLength ; 戻り値は stat
; hFindVolumeMountPoint : HANDLE -> "wptr"
; lpszVolumeMountPoint : LPWSTR out -> "wptr"
; cchBufferLength : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global FindNextVolumeMountPointW "FindNextVolumeMountPointW" sptr, var, int ; res = FindNextVolumeMountPointW(hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength) ; hFindVolumeMountPoint : HANDLE -> "sptr" ; lpszVolumeMountPoint : LPWSTR out -> "var" ; cchBufferLength : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global FindNextVolumeMountPointW "FindNextVolumeMountPointW" sptr, sptr, int ; res = FindNextVolumeMountPointW(hFindVolumeMountPoint, varptr(lpszVolumeMountPoint), cchBufferLength) ; hFindVolumeMountPoint : HANDLE -> "sptr" ; lpszVolumeMountPoint : LPWSTR out -> "sptr" ; cchBufferLength : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL FindNextVolumeMountPointW(HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength) #uselib "KERNEL32.dll" #cfunc global FindNextVolumeMountPointW "FindNextVolumeMountPointW" intptr, var, int ; res = FindNextVolumeMountPointW(hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength) ; hFindVolumeMountPoint : HANDLE -> "intptr" ; lpszVolumeMountPoint : LPWSTR out -> "var" ; cchBufferLength : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL FindNextVolumeMountPointW(HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength) #uselib "KERNEL32.dll" #cfunc global FindNextVolumeMountPointW "FindNextVolumeMountPointW" intptr, intptr, int ; res = FindNextVolumeMountPointW(hFindVolumeMountPoint, varptr(lpszVolumeMountPoint), cchBufferLength) ; hFindVolumeMountPoint : HANDLE -> "intptr" ; lpszVolumeMountPoint : LPWSTR out -> "intptr" ; cchBufferLength : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procFindNextVolumeMountPointW = kernel32.NewProc("FindNextVolumeMountPointW")
)
// hFindVolumeMountPoint (HANDLE), lpszVolumeMountPoint (LPWSTR out), cchBufferLength (DWORD)
r1, _, err := procFindNextVolumeMountPointW.Call(
uintptr(hFindVolumeMountPoint),
uintptr(lpszVolumeMountPoint),
uintptr(cchBufferLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FindNextVolumeMountPointW(
hFindVolumeMountPoint: THandle; // HANDLE
lpszVolumeMountPoint: PWideChar; // LPWSTR out
cchBufferLength: DWORD // DWORD
): BOOL; stdcall;
external 'KERNEL32.dll' name 'FindNextVolumeMountPointW';result := DllCall("KERNEL32\FindNextVolumeMountPointW"
, "Ptr", hFindVolumeMountPoint ; HANDLE
, "Ptr", lpszVolumeMountPoint ; LPWSTR out
, "UInt", cchBufferLength ; DWORD
, "Int") ; return: BOOL●FindNextVolumeMountPointW(hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength) = DLL("KERNEL32.dll", "bool FindNextVolumeMountPointW(void*, char*, dword)")
# 呼び出し: FindNextVolumeMountPointW(hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength)
# hFindVolumeMountPoint : HANDLE -> "void*"
# lpszVolumeMountPoint : LPWSTR out -> "char*"
# cchBufferLength : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。