ホーム › Networking.WinInet › FtpRenameFileA
FtpRenameFileA
関数FTPサーバー上のファイル名を変更する(ANSI版)。
シグネチャ
// WININET.dll (ANSI / -A)
#include <windows.h>
BOOL FtpRenameFileA(
void* hConnect,
LPCSTR lpszExisting,
LPCSTR lpszNew
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hConnect | void* | in |
| lpszExisting | LPCSTR | in |
| lpszNew | LPCSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// WININET.dll (ANSI / -A)
#include <windows.h>
BOOL FtpRenameFileA(
void* hConnect,
LPCSTR lpszExisting,
LPCSTR lpszNew
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool FtpRenameFileA(
IntPtr hConnect, // void*
[MarshalAs(UnmanagedType.LPStr)] string lpszExisting, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] string lpszNew // LPCSTR
);<DllImport("WININET.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function FtpRenameFileA(
hConnect As IntPtr, ' void*
<MarshalAs(UnmanagedType.LPStr)> lpszExisting As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> lpszNew As String ' LPCSTR
) As Boolean
End Function' hConnect : void*
' lpszExisting : LPCSTR
' lpszNew : LPCSTR
Declare PtrSafe Function FtpRenameFileA Lib "wininet" ( _
ByVal hConnect As LongPtr, _
ByVal lpszExisting As String, _
ByVal lpszNew As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FtpRenameFileA = ctypes.windll.wininet.FtpRenameFileA
FtpRenameFileA.restype = wintypes.BOOL
FtpRenameFileA.argtypes = [
ctypes.POINTER(None), # hConnect : void*
wintypes.LPCSTR, # lpszExisting : LPCSTR
wintypes.LPCSTR, # lpszNew : LPCSTR
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WININET.dll')
FtpRenameFileA = Fiddle::Function.new(
lib['FtpRenameFileA'],
[
Fiddle::TYPE_VOIDP, # hConnect : void*
Fiddle::TYPE_VOIDP, # lpszExisting : LPCSTR
Fiddle::TYPE_VOIDP, # lpszNew : LPCSTR
],
Fiddle::TYPE_INT)#[link(name = "wininet")]
extern "system" {
fn FtpRenameFileA(
hConnect: *mut (), // void*
lpszExisting: *const u8, // LPCSTR
lpszNew: *const u8 // LPCSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WININET.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool FtpRenameFileA(IntPtr hConnect, [MarshalAs(UnmanagedType.LPStr)] string lpszExisting, [MarshalAs(UnmanagedType.LPStr)] string lpszNew);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WININET_FtpRenameFileA' -Namespace Win32 -PassThru
# $api::FtpRenameFileA(hConnect, lpszExisting, lpszNew)#uselib "WININET.dll"
#func global FtpRenameFileA "FtpRenameFileA" sptr, sptr, sptr
; FtpRenameFileA hConnect, lpszExisting, lpszNew ; 戻り値は stat
; hConnect : void* -> "sptr"
; lpszExisting : LPCSTR -> "sptr"
; lpszNew : LPCSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "WININET.dll"
#cfunc global FtpRenameFileA "FtpRenameFileA" sptr, str, str
; res = FtpRenameFileA(hConnect, lpszExisting, lpszNew)
; hConnect : void* -> "sptr"
; lpszExisting : LPCSTR -> "str"
; lpszNew : LPCSTR -> "str"; BOOL FtpRenameFileA(void* hConnect, LPCSTR lpszExisting, LPCSTR lpszNew)
#uselib "WININET.dll"
#cfunc global FtpRenameFileA "FtpRenameFileA" intptr, str, str
; res = FtpRenameFileA(hConnect, lpszExisting, lpszNew)
; hConnect : void* -> "intptr"
; lpszExisting : LPCSTR -> "str"
; lpszNew : LPCSTR -> "str"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wininet = windows.NewLazySystemDLL("WININET.dll")
procFtpRenameFileA = wininet.NewProc("FtpRenameFileA")
)
// hConnect (void*), lpszExisting (LPCSTR), lpszNew (LPCSTR)
r1, _, err := procFtpRenameFileA.Call(
uintptr(hConnect),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszExisting))),
uintptr(unsafe.Pointer(windows.BytePtrFromString(lpszNew))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction FtpRenameFileA(
hConnect: Pointer; // void*
lpszExisting: PAnsiChar; // LPCSTR
lpszNew: PAnsiChar // LPCSTR
): BOOL; stdcall;
external 'WININET.dll' name 'FtpRenameFileA';result := DllCall("WININET\FtpRenameFileA"
, "Ptr", hConnect ; void*
, "AStr", lpszExisting ; LPCSTR
, "AStr", lpszNew ; LPCSTR
, "Int") ; return: BOOL●FtpRenameFileA(hConnect, lpszExisting, lpszNew) = DLL("WININET.dll", "bool FtpRenameFileA(void*, char*, char*)")
# 呼び出し: FtpRenameFileA(hConnect, lpszExisting, lpszNew)
# hConnect : void* -> "void*"
# lpszExisting : LPCSTR -> "char*"
# lpszNew : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。