PathCchSkipRoot
関数パスのルート部分を飛ばした位置のポインタを取得する。
シグネチャ
// api-ms-win-core-path-l1-1-0.dll
#include <windows.h>
HRESULT PathCchSkipRoot(
LPCWSTR pszPath,
LPCWSTR* ppszRootEnd
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pszPath | LPCWSTR | in |
| ppszRootEnd | LPCWSTR* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-core-path-l1-1-0.dll
#include <windows.h>
HRESULT PathCchSkipRoot(
LPCWSTR pszPath,
LPCWSTR* ppszRootEnd
);[DllImport("api-ms-win-core-path-l1-1-0.dll", ExactSpelling = true)]
static extern int PathCchSkipRoot(
[MarshalAs(UnmanagedType.LPWStr)] string pszPath, // LPCWSTR
IntPtr ppszRootEnd // LPCWSTR* out
);<DllImport("api-ms-win-core-path-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function PathCchSkipRoot(
<MarshalAs(UnmanagedType.LPWStr)> pszPath As String, ' LPCWSTR
ppszRootEnd As IntPtr ' LPCWSTR* out
) As Integer
End Function' pszPath : LPCWSTR
' ppszRootEnd : LPCWSTR* out
Declare PtrSafe Function PathCchSkipRoot Lib "api-ms-win-core-path-l1-1-0" ( _
ByVal pszPath As LongPtr, _
ByVal ppszRootEnd As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PathCchSkipRoot = ctypes.windll.LoadLibrary("api-ms-win-core-path-l1-1-0.dll").PathCchSkipRoot
PathCchSkipRoot.restype = ctypes.c_int
PathCchSkipRoot.argtypes = [
wintypes.LPCWSTR, # pszPath : LPCWSTR
ctypes.c_void_p, # ppszRootEnd : LPCWSTR* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-path-l1-1-0.dll')
PathCchSkipRoot = Fiddle::Function.new(
lib['PathCchSkipRoot'],
[
Fiddle::TYPE_VOIDP, # pszPath : LPCWSTR
Fiddle::TYPE_VOIDP, # ppszRootEnd : LPCWSTR* out
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-core-path-l1-1-0")]
extern "system" {
fn PathCchSkipRoot(
pszPath: *const u16, // LPCWSTR
ppszRootEnd: *const *const u16 // LPCWSTR* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-path-l1-1-0.dll")]
public static extern int PathCchSkipRoot([MarshalAs(UnmanagedType.LPWStr)] string pszPath, IntPtr ppszRootEnd);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-path-l1-1-0_PathCchSkipRoot' -Namespace Win32 -PassThru
# $api::PathCchSkipRoot(pszPath, ppszRootEnd)#uselib "api-ms-win-core-path-l1-1-0.dll"
#func global PathCchSkipRoot "PathCchSkipRoot" sptr, sptr
; PathCchSkipRoot pszPath, varptr(ppszRootEnd) ; 戻り値は stat
; pszPath : LPCWSTR -> "sptr"
; ppszRootEnd : LPCWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "api-ms-win-core-path-l1-1-0.dll" #cfunc global PathCchSkipRoot "PathCchSkipRoot" wstr, var ; res = PathCchSkipRoot(pszPath, ppszRootEnd) ; pszPath : LPCWSTR -> "wstr" ; ppszRootEnd : LPCWSTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "api-ms-win-core-path-l1-1-0.dll" #cfunc global PathCchSkipRoot "PathCchSkipRoot" wstr, sptr ; res = PathCchSkipRoot(pszPath, varptr(ppszRootEnd)) ; pszPath : LPCWSTR -> "wstr" ; ppszRootEnd : LPCWSTR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT PathCchSkipRoot(LPCWSTR pszPath, LPCWSTR* ppszRootEnd) #uselib "api-ms-win-core-path-l1-1-0.dll" #cfunc global PathCchSkipRoot "PathCchSkipRoot" wstr, var ; res = PathCchSkipRoot(pszPath, ppszRootEnd) ; pszPath : LPCWSTR -> "wstr" ; ppszRootEnd : LPCWSTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT PathCchSkipRoot(LPCWSTR pszPath, LPCWSTR* ppszRootEnd) #uselib "api-ms-win-core-path-l1-1-0.dll" #cfunc global PathCchSkipRoot "PathCchSkipRoot" wstr, intptr ; res = PathCchSkipRoot(pszPath, varptr(ppszRootEnd)) ; pszPath : LPCWSTR -> "wstr" ; ppszRootEnd : LPCWSTR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_path_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-path-l1-1-0.dll")
procPathCchSkipRoot = api_ms_win_core_path_l1_1_0.NewProc("PathCchSkipRoot")
)
// pszPath (LPCWSTR), ppszRootEnd (LPCWSTR* out)
r1, _, err := procPathCchSkipRoot.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPath))),
uintptr(ppszRootEnd),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction PathCchSkipRoot(
pszPath: PWideChar; // LPCWSTR
ppszRootEnd: PPWideChar // LPCWSTR* out
): Integer; stdcall;
external 'api-ms-win-core-path-l1-1-0.dll' name 'PathCchSkipRoot';result := DllCall("api-ms-win-core-path-l1-1-0\PathCchSkipRoot"
, "WStr", pszPath ; LPCWSTR
, "Ptr", ppszRootEnd ; LPCWSTR* out
, "Int") ; return: HRESULT●PathCchSkipRoot(pszPath, ppszRootEnd) = DLL("api-ms-win-core-path-l1-1-0.dll", "int PathCchSkipRoot(char*, void*)")
# 呼び出し: PathCchSkipRoot(pszPath, ppszRootEnd)
# pszPath : LPCWSTR -> "char*"
# ppszRootEnd : LPCWSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。