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