ホーム › System.AddressBook › ScLocalPathFromUNC
ScLocalPathFromUNC
関数UNCパスをローカルパスに変換する。
シグネチャ
// MAPI32.dll
#include <windows.h>
INT ScLocalPathFromUNC(
LPSTR lpszUNC,
LPSTR lpszLocal,
DWORD cchLocal
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpszUNC | LPSTR | in |
| lpszLocal | LPSTR | in |
| cchLocal | DWORD | in |
戻り値の型: INT
各言語での呼び出し定義
// MAPI32.dll
#include <windows.h>
INT ScLocalPathFromUNC(
LPSTR lpszUNC,
LPSTR lpszLocal,
DWORD cchLocal
);[DllImport("MAPI32.dll", ExactSpelling = true)]
static extern int ScLocalPathFromUNC(
[MarshalAs(UnmanagedType.LPStr)] string lpszUNC, // LPSTR
[MarshalAs(UnmanagedType.LPStr)] string lpszLocal, // LPSTR
uint cchLocal // DWORD
);<DllImport("MAPI32.dll", ExactSpelling:=True)>
Public Shared Function ScLocalPathFromUNC(
<MarshalAs(UnmanagedType.LPStr)> lpszUNC As String, ' LPSTR
<MarshalAs(UnmanagedType.LPStr)> lpszLocal As String, ' LPSTR
cchLocal As UInteger ' DWORD
) As Integer
End Function' lpszUNC : LPSTR
' lpszLocal : LPSTR
' cchLocal : DWORD
Declare PtrSafe Function ScLocalPathFromUNC Lib "mapi32" ( _
ByVal lpszUNC As String, _
ByVal lpszLocal As String, _
ByVal cchLocal As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScLocalPathFromUNC = ctypes.windll.mapi32.ScLocalPathFromUNC
ScLocalPathFromUNC.restype = ctypes.c_int
ScLocalPathFromUNC.argtypes = [
wintypes.LPCSTR, # lpszUNC : LPSTR
wintypes.LPCSTR, # lpszLocal : LPSTR
wintypes.DWORD, # cchLocal : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MAPI32.dll')
ScLocalPathFromUNC = Fiddle::Function.new(
lib['ScLocalPathFromUNC'],
[
Fiddle::TYPE_VOIDP, # lpszUNC : LPSTR
Fiddle::TYPE_VOIDP, # lpszLocal : LPSTR
-Fiddle::TYPE_INT, # cchLocal : DWORD
],
Fiddle::TYPE_INT)#[link(name = "mapi32")]
extern "system" {
fn ScLocalPathFromUNC(
lpszUNC: *mut u8, // LPSTR
lpszLocal: *mut u8, // LPSTR
cchLocal: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MAPI32.dll")]
public static extern int ScLocalPathFromUNC([MarshalAs(UnmanagedType.LPStr)] string lpszUNC, [MarshalAs(UnmanagedType.LPStr)] string lpszLocal, uint cchLocal);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MAPI32_ScLocalPathFromUNC' -Namespace Win32 -PassThru
# $api::ScLocalPathFromUNC(lpszUNC, lpszLocal, cchLocal)#uselib "MAPI32.dll"
#func global ScLocalPathFromUNC "ScLocalPathFromUNC" sptr, sptr, sptr
; ScLocalPathFromUNC lpszUNC, lpszLocal, cchLocal ; 戻り値は stat
; lpszUNC : LPSTR -> "sptr"
; lpszLocal : LPSTR -> "sptr"
; cchLocal : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MAPI32.dll"
#cfunc global ScLocalPathFromUNC "ScLocalPathFromUNC" str, str, int
; res = ScLocalPathFromUNC(lpszUNC, lpszLocal, cchLocal)
; lpszUNC : LPSTR -> "str"
; lpszLocal : LPSTR -> "str"
; cchLocal : DWORD -> "int"; INT ScLocalPathFromUNC(LPSTR lpszUNC, LPSTR lpszLocal, DWORD cchLocal)
#uselib "MAPI32.dll"
#cfunc global ScLocalPathFromUNC "ScLocalPathFromUNC" str, str, int
; res = ScLocalPathFromUNC(lpszUNC, lpszLocal, cchLocal)
; lpszUNC : LPSTR -> "str"
; lpszLocal : LPSTR -> "str"
; cchLocal : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mapi32 = windows.NewLazySystemDLL("MAPI32.dll")
procScLocalPathFromUNC = mapi32.NewProc("ScLocalPathFromUNC")
)
// lpszUNC (LPSTR), lpszLocal (LPSTR), cchLocal (DWORD)
r1, _, err := procScLocalPathFromUNC.Call(
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszUNC))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszLocal))),
uintptr(cchLocal),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ScLocalPathFromUNC(
lpszUNC: PAnsiChar; // LPSTR
lpszLocal: PAnsiChar; // LPSTR
cchLocal: DWORD // DWORD
): Integer; stdcall;
external 'MAPI32.dll' name 'ScLocalPathFromUNC';result := DllCall("MAPI32\ScLocalPathFromUNC"
, "AStr", lpszUNC ; LPSTR
, "AStr", lpszLocal ; LPSTR
, "UInt", cchLocal ; DWORD
, "Int") ; return: INT●ScLocalPathFromUNC(lpszUNC, lpszLocal, cchLocal) = DLL("MAPI32.dll", "int ScLocalPathFromUNC(char*, char*, dword)")
# 呼び出し: ScLocalPathFromUNC(lpszUNC, lpszLocal, cchLocal)
# lpszUNC : LPSTR -> "char*"
# lpszLocal : LPSTR -> "char*"
# cchLocal : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。