/packages/os2units/src/ftpapi.pas
Pascal | 1181 lines | 815 code | 192 blank | 174 comment | 0 complexity | 24668ab954839f9be0580d6a393d1a94 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
1{ 2 Copyright (c) 2002 by Yuri Prokushev (prokushev@freemail.ru). 3 4 Functions from FTPAPI.DLL (part of standard OS/2 Warp 4/eCS installation). 5 6 This program is free software; you can redistribute it and/or modify it 7 under the terms of the GNU Library General Public License (LGPL) as 8 published by the Free Software Foundation; either version 2 of the 9 License, or (at your option) any later version. This program is 10 distributed in the hope that it will be useful, but WITHOUT ANY 11 WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 FITNESS FOR A PARTICULAR PURPOSE. 13 14 See the GNU Library General Public License for more details. You should 15 have received a copy of the GNU Library General Public License along 16 with this program; if not, write to the Free Software Foundation, Inc., 17 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 **********************************************************************} 20 21{ 22@abstract(a unit to handle FTP) 23@author(Yuri Prokushev (prokushev@freemail.ru)) 24@created(22 Jul 2002) 25@lastmod(01 Oct 2002) 26This is functions from FTPAPI.DLL. Goal is ftp manipulation. 27Warning: This code is alfa. Future versions of this unit will propably 28not be compatible. 29@todo(Rework some functions to support strings longer then 255 chars) 30@todo(Finish functions description) 31} 32unit FTPAPI; 33 34{**************************************************************************** 35 36 RTL configuration 37 38****************************************************************************} 39 40 41interface 42 43uses 44 OS2Def, 45 PMWin, 46 Strings; 47 48Const 49 // window message id for post xfer updates 50 WM_FTPAPI_XFER_UPDATE = WM_USER + 1000; 51 52 // Transfer types is ASCII 53 T_ASCII = 1; 54 // Transfer types is EBCDIC 55 T_EBCDIC = 2; 56 // Transfer types is BINARY 57 T_BINARY = 3; 58 59 // command/reply trace file modes 60 M_OVERLAY = 1; 61 M_APPEND = 2; 62 63 // command/reply tracing error codes 64 65 // invalid trace file open mode 66 TRCMODE = 1; 67 // unable to open trace file 68 TRCOPEN = 2; 69 70 // Common error codes (try Ftp_ErrNo, all other functions returns usually 71 // 0 if all ok, -1 if all bad) 72 73 // No any error 74 FTPNOERROR = 00; 75 // Unknown service. 76 FTPSERVICE = 01; 77 // Unknown host. 78 FTPHOST = 02; 79 // Unable to obtain socket. 80 FTPSOCKET = 03; 81 // Unable to connect to server. 82 FTPCONNECT = 04; 83 // Login failed. 84 FTPLOGIN = 05; 85 // Transfer aborted. 86 FTPABORT = 06; 87 // Problem opening the local file. 88 FTPLOCALFILE = 07; 89 // Problem initializing data connection. 90 FTPDATACONN = 08; 91 // Command failed. 92 FTPCOMMAND = 09; 93 // Proxy server does not support third party transfers. 94 FTPPROXYTHIRD = 10; 95 // No primary connection for proxy transfer. 96 FTPNOPRIMARY = 11; 97 // No code page translation table was loaded 98 FTPNOXLATETBL = 12; 99 100 // ping error codes 101 102 // All ok 103 PINGOK = 0; 104 // Host does not reply 105 PINGREPLY = -1; 106 // Unable to obtain socket 107 PINGSOCKET = -3; 108 // Unknown protocol ICMP 109 PINGPROTO = -4; 110 // Send failed 111 PINGSEND = -5; 112 // Recv() failed 113 PINGRECV = -6; 114 // Unknown host (can't resolve) 115 PINGHOST = -7; 116 117 // Restart Specific 118 REST_GET = 1; 119 REST_PUT = 2; 120 121Const 122 // Short functions vars 123 ShortHost: String=''; 124 ShortUserId: String=''; 125 ShortPasswd: String=''; 126 ShortAcct: String=''; 127 ShortTransferType: Integer = T_ASCII; 128 129 130{**************************************************************************** 131 132 Opening and Closing Functions 133 134****************************************************************************} 135 136// Defines Host, UserId, Passwd and Acct for short function calls 137Function FtpSetUser(Host, UserId, Passwd, Acct: String): Integer; 138 139// Defines TransferType for short function calls 140Function FtpSetBinary(TransferType: Integer): Integer; 141 142// Stores the string containing the FTP API version 143// Buf is the buffer to store version string 144// BufLen is length of the buffer 145// Version string is null-terminated and truncated to buffer length 146Function FtpVer(var Buf; BufLen: Integer): Integer; cdecl; 147 148Function FtpVer(Var Buf: String): Integer; 149 150// Closes all current connections 151Procedure FtpLogoff; cdecl; 152 153{**************************************************************************** 154 155 File Action Functions 156 157****************************************************************************} 158 159// Appends information to a remote file 160// Host is hostname. Use 'hostname portnumber' to specify non-standard port 161// UserID is user ID 162// Passwd is password 163// Acct is account (can be nil) 164// Local is local filename 165// Remote is Remote filename 166// TransferType is type of transfer (T_* constants) 167Function FTPAppend(Host, UserId, Passwd, Acct, Local, Remote: PChar; 168 Transfertype: Integer): Integer; cdecl; 169 170Function FTPAppend(Host, UserId, Passwd, Acct, Local, Remote: String; 171 Transfertype: Integer): Integer; 172 173Function FTPAppend(Local, Remote: PChar; Transfertype: Integer): Integer; 174Function FTPAppend(Local, Remote: String; Transfertype: Integer): Integer; 175 176Function FTPAppend(Local, Remote: PChar): Integer; 177Function FTPAppend(Local, Remote: String): Integer; 178 179// Deletes files on a remote host 180Function FtpDelete(Host, UserId, Passwd, Acct, Name: PChar): Integer; cdecl; 181 182Function FtpDelete(Host, UserId, Passwd, Acct, Name: String): Integer; 183 184Function FtpDelete(Name: PChar): Integer; 185Function FtpDelete(Name: String): Integer; 186 187// Renames a file on a remote host 188Function FtpRename(Host, UserId, Passwd, Acct, NameFrom, NameTo: PChar): Integer; cdecl; 189 190Function FtpRename(Host, UserId, Passwd, Acct, NameFrom, NameTo: String): Integer; 191 192Function FtpRename(NameFrom, NameTo: PChar): Integer; 193Function FtpRename(NameFrom, NameTo: String): Integer; 194 195// Gets a file from an FTP server 196// Mode is either 'w' for re_w_rite, or 'a' for _a_ppend 197Function FtpGet(Host, UserId, Passwd, Acct, Local, Remote, Mode: PChar; TransferType: integer): Integer; cdecl; 198 199Function FtpGet(Host, UserId, Passwd, Acct, Local, Remote, Mode: String; TransferType: integer): Integer; 200 201Function FtpGet(Local, Remote, Mode: PChar; TransferType: integer): Integer; 202Function FtpGet(Local, Remote, Mode: String; TransferType: integer): Integer; 203 204Function FtpGet(Local, Remote, Mode: PChar): Integer; 205Function FtpGet(Local, Remote, Mode: String): Integer; 206 207// Transfers a file to an FTP server 208Function FtpPut(Host, UserId, Passwd, Acct, Local, Remote: PChar; TransferType: Integer): Integer; cdecl; 209 210Function FtpPut(Host, UserId, Passwd, Acct, Local, Remote: String; TransferType: Integer): Integer; 211 212Function FtpPut(Local, Remote: PChar; TransferType: Integer): Integer; 213Function FtpPut(Local, Remote: String; TransferType: Integer): Integer; 214 215Function FtpPut(Local, Remote: PChar): Integer; 216Function FtpPut(Local, Remote: String): Integer; 217 218// Transfers a file to a host and ensures it is created with a unique name 219Function FtpPutUnique(Host, UserId, Passwd, Acct, Local, Remote: PChar; TransferType: Integer): Integer; cdecl; 220 221Function FtpPutUnique(Host, UserId, Passwd, Acct, Local, Remote: String; TransferType: Integer): Integer; 222 223Function FtpPutUnique(Local, Remote: PChar; TransferType: Integer): Integer; 224Function FtpPutUnique(Local, Remote: String; TransferType: Integer): Integer; 225 226Function FtpPutUnique(Local, Remote: PChar): Integer; 227Function FtpPutUnique(Local, Remote: String): Integer; 228 229// Restarts an aborted transaction from the point of interruption 230Function FtpReStart(Host, UserId, Passwd, Acct, Local, Remote, Mode: PChar; TransferType, Rest: Integer): Longint; cdecl; 231 232Function FtpReStart(Host, UserId, Passwd, Acct, Local, Remote, Mode: String; TransferType, Rest: Integer): Longint; 233 234Function FtpReStart(Local, Remote, Mode: String; TransferType, Rest: Integer): Longint; 235Function FtpReStart(Local, Remote, Mode: String; Rest: Integer): Longint; 236 237 238{**************************************************************************** 239 240 Directory Listing Functions 241 242****************************************************************************} 243 244// Gets directory information in short format from a remote host and stores it to a local file 245// You can use named pipes here to avoid a need for creating a real file 246Function FtpLs(Host, Userid, Passwd, Acct, Local, Pattern: PChar): Integer; cdecl; 247 248Function FtpLs(Host, Userid, Passwd, Acct, Local, Pattern: String): Integer; 249 250Function FtpLs(Local, Pattern: String): Integer; 251 252// Gets a directory in wide format from a host and stores it in file Local 253// See comment regarding named pipes above 254Function FtpDir(Host, UserId, Passwd, Acct, Local, Pattern: PChar): Integer; cdecl; 255 256Function FtpDir(Host, Userid, Passwd, Acct, Local, Pattern: String): Integer; 257 258Function FtpDir(Local, Pattern: String): Integer; 259 260 261{**************************************************************************** 262 263 Directory Action Functions 264 265****************************************************************************} 266 267// Changes the current working directory on a host 268Function FtpCd(Host, Userid, Passwd, Acct, Dir: PChar): Integer; cdecl; 269 270Function FtpCd(Host, Userid, Passwd, Acct, Dir: String): Integer; 271 272Function FtpCd(Dir: String): Integer; 273 274// Creates a new directory on a target machine 275Function FtpMkd(Host, Userid, Passwd, Acct, Dir: PChar): Integer; cdecl; 276 277Function FtpMkd(Host, Userid, Passwd, Acct, Dir: String): Integer; 278 279Function FtpMkd(Dir: String): Integer; 280 281// Removes a directory on a target machine 282Function FtpRmd(Host, UserId, Passwd, Acct, Dir: PChar): Integer; cdecl; 283 284Function FtpRmd(Host, UserId, Passwd, Acct, Dir: String): Integer; 285 286Function FtpRmd(Dir: String): Integer; 287 288// Stores the string containing the FTP server description of the current 289// working directory on the host to the buffer 290Function FtpPwd(Host, UserId, Passwd, Acct, Buf: PChar; BufLen: Integer): Integer; cdecl; 291 292Function FtpPwd(Host, UserId, Passwd, Acct: String; var Buf: String): Integer; 293 294Function FtpPwd(var Buf: String): Integer; 295 296{**************************************************************************** 297 298 Remote Server Functions 299 300****************************************************************************} 301 302// Sends a string to the server verbatim 303Function FtpQuote(Host, UserId, Passwd, Acct, QuoteStr: PChar): Integer; cdecl; 304 305Function FtpQuote(Host, UserId, Passwd, Acct, QuoteStr: String): Integer; 306 307Function FtpQuote(QuoteStr: String): Integer; 308 309// Executes the site command 310Function FtpSite(Host, UserId, Passwd, Acct, SiteStr: PChar): Integer; cdecl; 311 312Function FtpSite(Host, UserId, Passwd, Acct, SiteStr: String): Integer; 313 314Function FtpSite(SiteStr: String): Integer; 315 316// Stores the string containing the FTP server description of the operating 317// system running on the host in a buffer 318Function FtpSys(Host, UserId, Passwd, Acct, Buf: PChar; BufLen: Integer): Integer; cdecl; 319 320Function FtpSys(Host, UserId, Passwd, Acct: String; var Buf: String): Integer; 321 322Function FtpSys(var Buf: String): Integer; 323 324 325// Transfers a file between two remote servers without sending the file to 326// the local host 327Function FtpProxy(Host1, UserId1, Passwd1, Acct1, 328 Host2, UserId2, Passwd2, Acct2, 329 FN1, FN2: PChar; TransferType: Integer): Integer; cdecl; 330 331Function FtpProxy(Host1, UserId1, Passwd1, Acct1, 332 Host2, UserId2, Passwd2, Acct2, 333 FN1, FN2: String; TransferType: Integer): Integer; 334 335Function FtpProxy(Host1, UserId1, Passwd1, Acct1, 336 Host2, UserId2, Passwd2, Acct2, 337 FN1, FN2: String): Integer; 338 339// Resolves a host name and sends a ping to the remote host to determine if the host is responding 340Function FtpPing(Host: PChar; Len: Integer; var Addr: Longint): Integer; cdecl; 341 342Function FtpPing(Host: String; Len: Integer; var Addr: Longint): Integer; 343 344// Sends a ping to the remote host to determine if the host is responding 345Function Ping(Addr: Longint; Len: Integer): Integer; cdecl; 346 347// Returns the size of a file on the remote host 348Function FtpRemSize(Host, UserId, Passwd, Acct, Local, Remote, Mode: Pchar; TransferType: Integer): Longint; cdecl; 349 350Function FtpRemSize(Host, UserId, Passwd, Acct, Local, Remote, Mode: String; TransferType: Integer): Longint; 351 352Function FtpRemSize(Local, Remote, Mode: String; TransferType: Integer): Longint; 353 354Function FtpRemSize(Local, Remote, Mode: String): Longint; 355 356// Maintain the original date/time of files received. 357Function Keep_File_Date(LocalFile, RemoteFile: PChar): Boolean; cdecl; 358 359Function Keep_File_Date(LocalFile, RemoteFile: String): Boolean; 360 361{**************************************************************************** 362 363 Trace Functions 364 365****************************************************************************} 366 367 368// Opens the trace file specified and starts tracing 369Function FtpTrcOn(FileSpec: PChar; Mode: Integer): Integer; cdecl; 370 371Function FtpTrcOn(FileSpec: String; Mode: Integer): Integer; cdecl; 372 373// Closes the trace file, and stops tracing of the command and reply sequences that 374// were sent over the control connection between the local and remote hosts 375Function FtpTrcOff: Integer; cdecl; 376 377{**************************************************************************** 378 379 Other Functions 380 381****************************************************************************} 382 383// FTP error No 384Function Ftp_ErrNo: Integer; cdecl; 385 386 387(* Undocumented / unimplemented functions: 388Function FtpXLate(Dig: Longint; St:PChar): Longint; cdecl; 389Procedure FtpXferWnd(var _hwnd: HWND); cdecl; 390Procedure FtpSetConvertMode(var code: integer); cdecl; 391Procedure FtpSetEncodeMode(var code: integer); cdecl; 392Procedure FtpSetDecodeMode(var code: integer); cdecl; 393Function FtpSetActiveMode(var UseActiveOnly: integer): integer; cdecl; 394*) 395 396implementation 397 398const 399 FTPAPIDLL = 'FTPAPI'; 400 401Function FTPAppend(Host, UserId, Passwd, Acct, Local, Remote: PChar; 402 Transfertype: Integer): Integer; cdecl; 403 external FTPAPIDLL index 1; 404 405Function FTPAppend(Host, UserId, Passwd, Acct, Local, Remote: String; 406 Transfertype: Integer): Integer; 407Var 408 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 409Begin 410 StrPCopy(@_Host, Host); 411 StrPCopy(@_UserId, UserId); 412 StrPCopy(@_Passwd, Passwd); 413 StrPCopy(@_Acct, Acct); 414 StrPCopy(@_Local, Local); 415 StrPCopy(@_Remote, Remote); 416 FtpAppend:=FtpAppend(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, TransferType); 417End; 418 419Function FTPAppend(Local, Remote: PChar; TransferType: Integer): Integer; 420Var 421 Host, UserId, Passwd, Acct: Array[0..255] of Char; 422Begin 423 StrPCopy(@Host, ShortHost); 424 StrPCopy(@UserId, ShortUserId); 425 StrPCopy(@Passwd, ShortPasswd); 426 StrPCopy(@Acct, ShortAcct); 427 FtpAppend:=FtpAppend(@Host, @UserId, @Passwd, @Acct, Local, Remote, TransferType); 428End; 429 430Function FTPAppend(Local, Remote: PChar): Integer; 431Begin 432 FtpAppend:=FtpAppend(Local, Remote, ShortTransferType); 433End; 434 435Function FTPAppend(Local, Remote: String; TransferType: Integer): Integer; 436Var 437 _Local, _Remote: Array[0..255] of Char; 438Begin 439 StrPCopy(@_Local, Local); 440 StrPCopy(@_Remote, Remote); 441 FtpAppend:=FtpAppend(@_Local, @_Remote, TransferType); 442End; 443 444Function FTPAppend(Local, Remote: String): Integer; 445Var 446 _Local, _Remote: Array[0..255] of Char; 447Begin 448 StrPCopy(@_Local, Local); 449 StrPCopy(@_Remote, Remote); 450 FtpAppend:=FtpAppend(@_Local, @_Remote); 451End; 452 453Function FtpCd(Host, Userid, Passwd, Acct, Dir: PChar): Integer; cdecl; 454 external FTPAPIDLL index 2; 455 456Function FtpCd(Host, Userid, Passwd, Acct, Dir: String): Integer; 457Var 458 _Host, _UserId, _Passwd, _Acct, _Dir: PChar; 459Begin 460 GetMem(_Host, Length(Host)+1); 461 GetMem(_UserId, Length(UserId)+1); 462 GetMem(_Passwd, Length(Passwd)+1); 463 GetMem(_Acct, Length(Acct)+1); 464 GetMem(_Dir, Length(Dir)+1); 465 StrPCopy(_Host, Host); 466 StrPCopy(_UserId, UserId); 467 StrPCopy(_Passwd, Passwd); 468 StrPCopy(_Acct, Acct); 469 StrPCopy(_Dir, Dir); 470 FtpCd:=FtpCd(_Host, _Userid, _Passwd, _Acct, _Dir); 471 FreeMem(_Host, Length(Host)+1); 472 FreeMem(_UserId, Length(UserId)+1); 473 FreeMem(_Passwd, Length(Passwd)+1); 474 FreeMem(_Acct, Length(Acct)+1); 475 FreeMem(_Dir, Length(Dir)+1); 476End; 477 478Function FtpCd(Dir: String): Integer; 479Begin 480 FtpCd:=FtpCd(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Dir); 481End; 482 483Function FtpDelete(Host, UserId, Passwd, Acct, Name: PChar): Integer; cdecl; 484 external FTPAPIDLL index 3; 485 486Function FtpDelete(Host, UserId, Passwd, Acct, Name: String): Integer; 487Var 488 _Host, _UserId, _Passwd, _Acct, _Name: Array[0..255] of Char; 489Begin 490 StrPCopy(@_Host, Host); 491 StrPCopy(@_UserId, UserId); 492 StrPCopy(@_Passwd, Passwd); 493 StrPCopy(@_Acct, Acct); 494 StrPCopy(@_Name, Name); 495 FtpDelete:=FtpDelete(@_Host, @_UserId, @_Passwd, @_Acct, @_Name); 496End; 497 498Function FtpDelete(Name: PChar): Integer; 499Var 500 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 501Begin 502 StrPCopy(@_Host, ShortHost); 503 StrPCopy(@_UserId, ShortUserId); 504 StrPCopy(@_Passwd, ShortPasswd); 505 StrPCopy(@_Acct, ShortAcct); 506 FtpDelete:=FtpDelete(@_Host, @_UserId, @_Passwd, @_Acct, Name); 507End; 508 509Function FtpDelete(Name: String): Integer; 510Var 511 _Host, _UserId, _Passwd, _Acct, _Name: Array[0..255] of Char; 512Begin 513 StrPCopy(@_Host, ShortHost); 514 StrPCopy(@_UserId, ShortUserId); 515 StrPCopy(@_Passwd, ShortPasswd); 516 StrPCopy(@_Acct, ShortAcct); 517 StrPCopy(@_Name, Name); 518 FtpDelete:=FtpDelete(@_Host, @_UserId, @_Passwd, @_Acct, @_Name); 519End; 520 521Function FtpDir(Host, UserId, Passwd, Acct, Local, Pattern: PChar): Integer; cdecl; 522 external FTPAPIDLL index 4; 523 524Function FtpDir(Host, Userid, Passwd, Acct, Local, Pattern: String): Integer; 525Var 526 _Host, _UserId, _Passwd, _Acct, _Local, _Pattern: PChar; 527Begin 528 GetMem(_Host, Length(Host)+1); 529 GetMem(_UserId, Length(UserId)+1); 530 GetMem(_Passwd, Length(Passwd)+1); 531 GetMem(_Acct, Length(Acct)+1); 532 GetMem(_Local, Length(Local)+1); 533 GetMem(_Pattern, Length(Pattern)+1); 534 StrPCopy(_Host, Host); 535 StrPCopy(_UserId, UserId); 536 StrPCopy(_Passwd, Passwd); 537 StrPCopy(_Acct, Acct); 538 StrPCopy(_Local, Local); 539 StrPCopy(_Pattern, Pattern); 540 FtpDir:=FtpDir(_Host, _Userid, _Passwd, _Acct, _Local, _Pattern); 541 FreeMem(_Host, Length(Host)+1); 542 FreeMem(_UserId, Length(UserId)+1); 543 FreeMem(_Passwd, Length(Passwd)+1); 544 FreeMem(_Acct, Length(Acct)+1); 545 FreeMem(_Local, Length(Local)+1); 546 FreeMem(_Pattern, Length(Pattern)+1); 547End; 548 549Function FtpDir(Local, Pattern: String): Integer; 550Begin 551 FtpDir:=FtpDir(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Local, Pattern); 552End; 553 554Function FtpLs(Host, Userid, Passwd, Acct, Local, Pattern: PChar): Integer; cdecl; 555 external FTPAPIDLL index 7; 556 557Function FtpLs(Host, Userid, Passwd, Acct, Local, Pattern: String): Integer; 558Var 559 _Host, _UserId, _Passwd, _Acct, _Local, _Pattern: PChar; 560Begin 561 GetMem(_Host, Length(Host)+1); 562 GetMem(_UserId, Length(UserId)+1); 563 GetMem(_Passwd, Length(Passwd)+1); 564 GetMem(_Acct, Length(Acct)+1); 565 GetMem(_Local, Length(Local)+1); 566 GetMem(_Pattern, Length(Pattern)+1); 567 StrPCopy(_Host, Host); 568 StrPCopy(_UserId, UserId); 569 StrPCopy(_Passwd, Passwd); 570 StrPCopy(_Acct, Acct); 571 StrPCopy(_Local, Local); 572 StrPCopy(_Pattern, Pattern); 573 FtpLs:=FtpLs(_Host, _Userid, _Passwd, _Acct, _Local, _Pattern); 574 FreeMem(_Host, Length(Host)+1); 575 FreeMem(_UserId, Length(UserId)+1); 576 FreeMem(_Passwd, Length(Passwd)+1); 577 FreeMem(_Acct, Length(Acct)+1); 578 FreeMem(_Local, Length(Local)+1); 579 FreeMem(_Pattern, Length(Pattern)+1); 580End; 581 582Function FtpLs(Local, Pattern: String): Integer; 583Begin 584 FtpLs:=FtpLs(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Local, Pattern); 585End; 586 587Function FtpGet(Host, UserId, Passwd, Acct, Local, Remote, Mode: PChar; TransferType: integer): Integer; cdecl; 588 external FTPAPIDLL index 5; 589 590Function FtpGet(Host, UserId, Passwd, Acct, Local, Remote, Mode: String; TransferType: integer): Integer; 591Var 592 _Host, _UserId, _Passwd, _Acct, _Local, _Remote, _Mode: Array[0..255] of Char; 593Begin 594 StrPCopy(@_Host, Host); 595 StrPCopy(@_UserId, UserId); 596 StrPCopy(@_Passwd, Passwd); 597 StrPCopy(@_Acct, Acct); 598 StrPCopy(@_Local, Local); 599 StrPCopy(@_Remote, Remote); 600 StrPCopy(@_Mode, Mode); 601 FtpGet:=FtpGet(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, @_Mode, TransferType); 602End; 603 604Function FtpGet(Local, Remote, Mode: PChar; TransferType: integer): Integer; 605Var 606 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 607Begin 608 StrPCopy(@_Host, ShortHost); 609 StrPCopy(@_UserId, ShortUserId); 610 StrPCopy(@_Passwd, ShortPasswd); 611 StrPCopy(@_Acct, ShortAcct); 612 FtpGet:=FtpGet(@_Host, @_UserId, @_Passwd, @_Acct, Local, Remote, Mode, TransferType); 613End; 614 615Function FtpGet(Local, Remote, Mode: String; TransferType: integer): Integer; 616Var 617 _Host, _UserId, _Passwd, _Acct, _Local, _Remote, _Mode: Array[0..255] of Char; 618Begin 619 StrPCopy(@_Host, ShortHost); 620 StrPCopy(@_UserId, ShortUserId); 621 StrPCopy(@_Passwd, ShortPasswd); 622 StrPCopy(@_Acct, ShortAcct); 623 StrPCopy(@_Local, Local); 624 StrPCopy(@_Remote, Remote); 625 StrPCopy(@_Mode, Mode); 626 FtpGet:=FtpGet(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, @_Mode, TransferType); 627End; 628 629Function FtpGet(Local, Remote, Mode: PChar): Integer; 630Var 631 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 632Begin 633 StrPCopy(@_Host, ShortHost); 634 StrPCopy(@_UserId, ShortUserId); 635 StrPCopy(@_Passwd, ShortPasswd); 636 StrPCopy(@_Acct, ShortAcct); 637 FtpGet:=FtpGet(@_Host, @_UserId, @_Passwd, @_Acct, Local, Remote, Mode, ShortTransferType); 638End; 639 640Function FtpGet(Local, Remote, Mode: String): Integer; 641Var 642 _Host, _UserId, _Passwd, _Acct, _Local, _Remote, _Mode: Array[0..255] of Char; 643Begin 644 StrPCopy(@_Host, ShortHost); 645 StrPCopy(@_UserId, ShortUserId); 646 StrPCopy(@_Passwd, ShortPasswd); 647 StrPCopy(@_Acct, ShortAcct); 648 StrPCopy(@_Local, Local); 649 StrPCopy(@_Remote, Remote); 650 StrPCopy(@_Mode, Mode); 651 FtpGet:=FtpGet(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, @_Mode, ShortTransferType); 652End; 653 654Procedure FtpLogoff; cdecl; 655 external FTPAPIDLL index 6; 656 657Function FtpMkd(Host, Userid, Passwd, Acct, Dir: PChar): Integer; cdecl; 658 external FTPAPIDLL index 8; 659 660Function FtpMkD(Host, Userid, Passwd, Acct, Dir: String): Integer; 661Var 662 _Host, _UserId, _Passwd, _Acct, _Dir: PChar; 663Begin 664 GetMem(_Host, Length(Host)+1); 665 GetMem(_UserId, Length(UserId)+1); 666 GetMem(_Passwd, Length(Passwd)+1); 667 GetMem(_Acct, Length(Acct)+1); 668 GetMem(_Dir, Length(Dir)+1); 669 StrPCopy(_Host, Host); 670 StrPCopy(_UserId, UserId); 671 StrPCopy(_Passwd, Passwd); 672 StrPCopy(_Acct, Acct); 673 StrPCopy(_Dir, Dir); 674 FtpMkD:=FtpMkD(_Host, _Userid, _Passwd, _Acct, _Dir); 675 FreeMem(_Host, Length(Host)+1); 676 FreeMem(_UserId, Length(UserId)+1); 677 FreeMem(_Passwd, Length(Passwd)+1); 678 FreeMem(_Acct, Length(Acct)+1); 679 FreeMem(_Dir, Length(Dir)+1); 680End; 681 682Function FtpMkD(Dir: String): Integer; 683Begin 684 FtpMkD:=FtpMkD(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Dir); 685End; 686 687Function FtpPing(Host: PChar; Len: Integer; var Addr: Longint): Integer; cdecl; 688 external FTPAPIDLL index 9; 689 690Function FtpPing(Host: String; Len: Integer; var Addr: Longint): Integer; 691var 692 _Host: PChar; 693Begin 694 GetMem(_Host, Length(Host)+1); 695 StrPCopy(_Host, Host); 696 FtpPing:=FtpPing(_Host, Len, Addr); 697 FreeMem(_Host, Length(Host)+1); 698End; 699 700Function FtpProxy(Host1, UserId1, Passwd1, Acct1, 701 Host2, UserId2, Passwd2, Acct2, 702 FN1, FN2: PChar; TransferType: Integer): Integer; cdecl; 703 external FTPAPIDLL index 10; 704 705Function FtpProxy(Host1, UserId1, Passwd1, Acct1, 706 Host2, UserId2, Passwd2, Acct2, 707 FN1, FN2: String; TransferType: Integer): Integer; 708Begin 709 Host1:=Host2+#0; 710 Host2:=Host2+#0; 711 UserId1:=UserId1+#0; 712 UserId2:=UserId2+#0; 713 Passwd1:=Passwd1+#0; 714 Passwd2:=Passwd2+#0; 715 Acct1:=Acct1+#0; 716 Acct2:=Acct2+#0; 717 FN1:=FN1+#0; 718 FN2:=FN2+#0; 719 FtpProxy:=FtpProxy(@Host1[1], @UserId1[1], @Passwd1[1], @Acct1[1], 720 @Host2[1], @UserId2[1], @Passwd2[1], @Acct2[1], 721 @FN1[1], @FN2[1], TransferType); 722End; 723 724Function FtpProxy(Host1, UserId1, Passwd1, Acct1, 725 Host2, UserId2, Passwd2, Acct2, 726 FN1, FN2: String): Integer; 727Begin 728 FtpProxy:=FtpProxy(Host1, UserId1, Passwd1, Acct1, 729 Host2, UserId2, Passwd2, Acct2, 730 FN1, FN2, ShortTransferType); 731End; 732 733Function FtpPut(Host, UserId, Passwd, Acct, Local, Remote: PChar; TransferType: Integer): Integer; cdecl; 734 external FTPAPIDLL index 11; 735 736Function FtpPut(Host, UserId, Passwd, Acct, Local, Remote: String; TransferType: Integer): Integer; 737Var 738 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 739Begin 740 StrPCopy(@_Host, Host); 741 StrPCopy(@_UserId, UserId); 742 StrPCopy(@_Passwd, Passwd); 743 StrPCopy(@_Acct, Acct); 744 StrPCopy(@_Local, Local); 745 StrPCopy(@_Remote, Remote); 746 FtpPut:=FtpPut(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, TransferType); 747End; 748 749Function FtpPut(Local, Remote: PChar; TransferType: Integer): Integer; 750Var 751 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 752Begin 753 StrPCopy(@_Host, ShortHost); 754 StrPCopy(@_UserId, ShortUserId); 755 StrPCopy(@_Passwd, ShortPasswd); 756 StrPCopy(@_Acct, ShortAcct); 757 FtpPut:=FtpPut(@_Host, @_UserId, @_Passwd, @_Acct, Local, Remote, TransferType); 758End; 759 760Function FtpPut(Local, Remote: String; TransferType: Integer): Integer; 761Var 762 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 763Begin 764 StrPCopy(@_Host, ShortHost); 765 StrPCopy(@_UserId, ShortUserId); 766 StrPCopy(@_Passwd, ShortPasswd); 767 StrPCopy(@_Acct, ShortAcct); 768 StrPCopy(@_Local, Local); 769 StrPCopy(@_Remote, Remote); 770 FtpPut:=FtpPut(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, TransferType); 771End; 772 773Function FtpPut(Local, Remote: PChar): Integer; 774Var 775 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 776Begin 777 StrPCopy(@_Host, ShortHost); 778 StrPCopy(@_UserId, ShortUserId); 779 StrPCopy(@_Passwd, ShortPasswd); 780 StrPCopy(@_Acct, ShortAcct); 781 FtpPut:=FtpPut(@_Host, @_UserId, @_Passwd, @_Acct, Local, Remote, ShortTransferType); 782End; 783 784Function FtpPut(Local, Remote: String): Integer; 785Var 786 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 787Begin 788 StrPCopy(@_Host, ShortHost); 789 StrPCopy(@_UserId, ShortUserId); 790 StrPCopy(@_Passwd, ShortPasswd); 791 StrPCopy(@_Acct, ShortAcct); 792 StrPCopy(@_Local, Local); 793 StrPCopy(@_Remote, Remote); 794 FtpPut:=FtpPut(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, ShortTransferType); 795End; 796 797Function FtpPutUnique(Host, UserId, Passwd, Acct, Local, Remote: PChar; TransferType: Integer): Integer; cdecl; 798 external FTPAPIDLL index 12; 799 800Function FtpPutUnique(Host, UserId, Passwd, Acct, Local, Remote: String; TransferType: Integer): Integer; 801Var 802 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 803Begin 804 StrPCopy(@_Host, Host); 805 StrPCopy(@_UserId, UserId); 806 StrPCopy(@_Passwd, Passwd); 807 StrPCopy(@_Acct, Acct); 808 StrPCopy(@_Local, Local); 809 StrPCopy(@_Remote, Remote); 810 FtpPutUnique:=FtpPutUnique(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, TransferType); 811End; 812 813Function FtpPutUnique(Local, Remote: PChar; TransferType: Integer): Integer; 814Var 815 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 816Begin 817 StrPCopy(@_Host, ShortHost); 818 StrPCopy(@_UserId, ShortUserId); 819 StrPCopy(@_Passwd, ShortPasswd); 820 StrPCopy(@_Acct, ShortAcct); 821 FtpPutUnique:=FtpPutUnique(@_Host, @_UserId, @_Passwd, @_Acct, Local, Remote, TransferType); 822End; 823 824Function FtpPutUnique(Local, Remote: String; TransferType: Integer): Integer; 825Var 826 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 827Begin 828 StrPCopy(@_Host, ShortHost); 829 StrPCopy(@_UserId, ShortUserId); 830 StrPCopy(@_Passwd, ShortPasswd); 831 StrPCopy(@_Acct, ShortAcct); 832 StrPCopy(@_Local, Local); 833 StrPCopy(@_Remote, Remote); 834 FtpPutUnique:=FtpPutUnique(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, TransferType); 835End; 836 837Function FtpPutUnique(Local, Remote: PChar): Integer; 838Var 839 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 840Begin 841 StrPCopy(@_Host, ShortHost); 842 StrPCopy(@_UserId, ShortUserId); 843 StrPCopy(@_Passwd, ShortPasswd); 844 StrPCopy(@_Acct, ShortAcct); 845 FtpPutUnique:=FtpPutUnique(@_Host, @_UserId, @_Passwd, @_Acct, Local, Remote, ShortTransferType); 846End; 847 848Function FtpPutUnique(Local, Remote: String): Integer; 849Var 850 _Host, _UserId, _Passwd, _Acct, _Local, _Remote: Array[0..255] of Char; 851Begin 852 StrPCopy(@_Host, ShortHost); 853 StrPCopy(@_UserId, ShortUserId); 854 StrPCopy(@_Passwd, ShortPasswd); 855 StrPCopy(@_Acct, ShortAcct); 856 StrPCopy(@_Local, Local); 857 StrPCopy(@_Remote, Remote); 858 FtpPutUnique:=FtpPutUnique(@_Host, @_UserId, @_Passwd, @_Acct, @_Local, @_Remote, ShortTransferType); 859End; 860 861Function FtpPwd(Host, UserId, Passwd, Acct, Buf: PChar; BufLen: Integer): Integer; cdecl; 862 external FTPAPIDLL index 13; 863 864Function FtpPwd(Host, UserId, Passwd, Acct: String; var Buf: String): Integer; 865Var 866 _Host, _UserId, _Passwd, _Acct: PChar; 867 _Buf: Array[0..255] of Char; 868Begin 869 GetMem(_Host, Length(Host)+1); 870 GetMem(_UserId, Length(UserId)+1); 871 GetMem(_Passwd, Length(Passwd)+1); 872 GetMem(_Acct, Length(Acct)+1); 873 StrPCopy(_Host, Host); 874 StrPCopy(_UserId, UserId); 875 StrPCopy(_Passwd, Passwd); 876 StrPCopy(_Acct, Acct); 877 FtpPwd:=FtpPwd(_Host, _UserId, _Passwd, _Acct, @_Buf, SizeOf(_Buf)); 878 Buf:=StrPas(@_Buf); 879 FreeMem(_Host, Length(Host)+1); 880 FreeMem(_UserId, Length(UserId)+1); 881 FreeMem(_Passwd, Length(Passwd)+1); 882 FreeMem(_Acct, Length(Acct)+1); 883End; 884 885Function FtpPwd(var Buf: String): Integer; 886Begin 887 FtpPwd:=FtpPwd(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Buf); 888End; 889 890 891Function FtpQuote(Host, UserId, Passwd, Acct, QuoteStr: PChar): Integer; cdecl; 892 external FTPAPIDLL index 14; 893 894Function FtpQuote(Host, UserId, Passwd, Acct, QuoteStr: String): Integer; 895Var 896 _Host, _UserId, _Passwd, _Acct, _QuoteStr: PChar; 897Begin 898 GetMem(_Host, Length(Host)+1); 899 GetMem(_UserId, Length(UserId)+1); 900 GetMem(_Passwd, Length(Passwd)+1); 901 GetMem(_Acct, Length(Acct)+1); 902 GetMem(_QuoteStr, Length(QuoteStr)+1); 903 StrPCopy(_Host, Host); 904 StrPCopy(_UserId, UserId); 905 StrPCopy(_Passwd, Passwd); 906 StrPCopy(_Acct, Acct); 907 StrPCopy(_QuoteStr, QuoteStr); 908 FtpQuote:=FtpQuote(_Host, _UserId, _Passwd, _Acct, _QuoteStr); 909 FreeMem(_Host, Length(Host)+1); 910 FreeMem(_UserId, Length(UserId)+1); 911 FreeMem(_Passwd, Length(Passwd)+1); 912 FreeMem(_Acct, Length(Acct)+1); 913 FreeMem(_QuoteStr, Length(QuoteStr)+1); 914End; 915 916Function FtpQuote(QuoteStr: String): Integer; 917Begin 918 FtpQuote:=FtpQuote(ShortHost, ShortUserId, ShortPasswd, ShortAcct, QuoteStr); 919End; 920 921Function FtpRename(Host, UserId, Passwd, Acct, NameFrom, NameTo: PChar): Integer; cdecl; 922 external FTPAPIDLL index 15; 923 924Function FtpRename(Host, UserId, Passwd, Acct, NameFrom, NameTo: String): Integer; 925Var 926 _Host, _UserId, _Passwd, _Acct, _NameFrom, _NameTo: Array[0..255] of Char; 927Begin 928 StrPCopy(@_Host, Host); 929 StrPCopy(@_UserId, UserId); 930 StrPCopy(@_Passwd, Passwd); 931 StrPCopy(@_Acct, Acct); 932 StrPCopy(@_NameTo, NameTo); 933 StrPCopy(@_NameFrom, NameFrom); 934 FtpRename:=FtpRename(@_Host, @_UserId, @_Passwd, @_Acct, @_NameFrom, @_NameTo); 935End; 936 937Function FtpRename(NameFrom, NameTo: PChar): Integer; 938Var 939 _Host, _UserId, _Passwd, _Acct: Array[0..255] of Char; 940Begin 941 StrPCopy(@_Host, ShortHost); 942 StrPCopy(@_UserId, ShortUserId); 943 StrPCopy(@_Passwd, ShortPasswd); 944 StrPCopy(@_Acct, ShortAcct); 945 FtpRename:=FtpRename(@_Host, @_UserId, @_Passwd, @_Acct, NameFrom, NameTo); 946End; 947 948Function FtpRename(NameFrom, NameTo: String): Integer; 949Var 950 _Host, _UserId, _Passwd, _Acct, _NameFrom, _NameTo: Array[0..255] of Char; 951Begin 952 StrPCopy(@_Host, ShortHost); 953 StrPCopy(@_UserId, ShortUserId); 954 StrPCopy(@_Passwd, ShortPasswd); 955 StrPCopy(@_Acct, ShortAcct); 956 StrPCopy(@_NameTo, NameTo); 957 StrPCopy(@_NameFrom, NameFrom); 958 FtpRename:=FtpRename(@_Host, @_UserId, @_Passwd, @_Acct, @_NameFrom, @_NameTo); 959End; 960 961Function FtpRmd(Host, UserId, Passwd, Acct, Dir: PChar): Integer; cdecl; 962 external FTPAPIDLL index 16; 963 964Function FtpRmD(Host, Userid, Passwd, Acct, Dir: String): Integer; 965Var 966 _Host, _UserId, _Passwd, _Acct, _Dir: PChar; 967Begin 968 GetMem(_Host, Length(Host)+1); 969 GetMem(_UserId, Length(UserId)+1); 970 GetMem(_Passwd, Length(Passwd)+1); 971 GetMem(_Acct, Length(Acct)+1); 972 GetMem(_Dir, Length(Dir)+1); 973 StrPCopy(_Host, Host); 974 StrPCopy(_UserId, UserId); 975 StrPCopy(_Passwd, Passwd); 976 StrPCopy(_Acct, Acct); 977 StrPCopy(_Dir, Dir); 978 FtpRmD:=FtpRmD(_Host, _Userid, _Passwd, _Acct, _Dir); 979 FreeMem(_Host, Length(Host)+1); 980 FreeMem(_UserId, Length(UserId)+1); 981 FreeMem(_Passwd, Length(Passwd)+1); 982 FreeMem(_Acct, Length(Acct)+1); 983 FreeMem(_Dir, Length(Dir)+1); 984End; 985 986Function FtpRmD(Dir: String): Integer; 987Begin 988 FtpRmD:=FtpRmD(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Dir); 989End; 990 991Function FtpSite(Host, UserId, Passwd, Acct, SiteStr: PChar): Integer; cdecl; 992 external FTPAPIDLL index 17; 993 994Function FtpSite(Host, UserId, Passwd, Acct, SiteStr: String): Integer; 995Var 996 _Host, _UserId, _Passwd, _Acct, _SiteStr: PChar; 997Begin 998 GetMem(_Host, Length(Host)+1); 999 GetMem(_UserId, Length(UserId)+1); 1000 GetMem(_Passwd, Length(Passwd)+1); 1001 GetMem(_Acct, Length(Acct)+1); 1002 GetMem(_SiteStr, Length(SiteStr)+1); 1003 StrPCopy(_Host, Host); 1004 StrPCopy(_UserId, UserId); 1005 StrPCopy(_Passwd, Passwd); 1006 StrPCopy(_Acct, Acct); 1007 StrPCopy(_SiteStr, SiteStr); 1008 FtpSite:=FtpSite(_Host, _Userid, _Passwd, _Acct, _SiteStr); 1009 FreeMem(_Host, Length(Host)+1); 1010 FreeMem(_UserId, Length(UserId)+1); 1011 FreeMem(_Passwd, Length(Passwd)+1); 1012 FreeMem(_Acct, Length(Acct)+1); 1013 FreeMem(_SiteStr, Length(SiteStr)+1); 1014End; 1015 1016Function FtpSite(SiteStr: String): Integer; 1017Begin 1018 FtpSite:=FtpSite(ShortHost, ShortUserid, ShortPasswd, ShortAcct, SiteStr); 1019End; 1020 1021Function FtpSys(Host, UserId, Passwd, Acct, Buf: PChar; BufLen: Integer): Integer; cdecl; 1022 external FTPAPIDLL index 18; 1023 1024Function FtpSys(Host, UserId, Passwd, Acct: String; var Buf: String): Integer; 1025var 1026 _Buf: Array[0..255] of char; 1027Begin 1028 Host:=Host+#0; 1029 UserId:=UserId+#0; 1030 Passwd:=Passwd+#0; 1031 Acct:=Acct+#0; 1032 FtpSys:=FtpSys(@Host[1], @UserId[1], @Passwd[1], @Acct[1], @_Buf, SizeOf(Buf)); 1033 Buf:=StrPas(@_Buf); 1034End; 1035 1036Function FtpSys(var Buf: String): Integer; 1037Begin 1038 FtpSys:=FtpSys(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Buf); 1039End; 1040 1041Function Ping(Addr: Longint; Len: Integer): Integer; cdecl; 1042 external FTPAPIDLL index 19; 1043 1044Function Ftp_ErrNo: Integer; cdecl; 1045 external FTPAPIDLL index 21; 1046 1047Function FtpVer(var Buf; BufLen: Integer): Integer; cdecl; 1048 external FTPAPIDLL index 23; 1049 1050Function FtpVer(var Buf: String): Integer; 1051var 1052 T:array[0..255] of char; 1053begin 1054 FtpVer:=FtpVer(T, SizeOf(T)); 1055 Buf:=StrPas(T); 1056end; 1057 1058Function FtpTrcOn(FileSpec: PChar; Mode: Integer): Integer; cdecl; 1059 external FTPAPIDLL index 24; 1060 1061Function FtpTrcOn(FileSpec: String; Mode: Integer): Integer; cdecl; 1062Begin 1063 FileSpec:=FileSpec+#0; 1064 FtpTrcOn:=FtpTrcOn(@FileSpec[1], Mode); 1065End; 1066 1067Function FtpTrcOff: Integer; cdecl; 1068 external FTPAPIDLL index 25; 1069 1070Function Keep_File_Date(LocalFile, RemoteFile: PChar): Boolean; cdecl; 1071 external FTPAPIDLL index 30; 1072 1073Function Keep_File_Date(LocalFile, RemoteFile: String): Boolean; 1074Begin 1075 LocalFile:=LocalFile+#0; 1076 RemoteFile:=RemoteFile+#0; 1077 Keep_File_Date:=Keep_File_Date(@LocalFile[1], @RemoteFile[1]); 1078End; 1079 1080Function FtpReStart(Host, UserId, Passwd, Acct, Local, Remote, Mode: PChar; TransferType, Rest: Integer): Longint; cdecl; 1081 external FTPAPIDLL index 31; 1082 1083Function FtpReStart(Host, UserId, Passwd, Acct, Local, Remote, Mode: String; TransferType, Rest: Integer): Longint; 1084Var 1085 _Host, _UserId, _Passwd, _Acct, _Local, _Remote, _Mode: PChar; 1086Begin 1087 GetMem(_Host, Length(Host)+1); 1088 GetMem(_UserId, Length(UserId)+1); 1089 GetMem(_Passwd, Length(Passwd)+1); 1090 GetMem(_Acct, Length(Acct)+1); 1091 GetMem(_Local, Length(Local)+1); 1092 GetMem(_Remote, Length(Remote)+1); 1093 GetMem(_Mode, Length(Mode)+1); 1094 StrPCopy(_Host, Host); 1095 StrPCopy(_UserId, UserId); 1096 StrPCopy(_Passwd, Passwd); 1097 StrPCopy(_Acct, Acct); 1098 StrPCopy(_Local, Local); 1099 StrPCopy(_Remote, Remote); 1100 StrPCopy(_Mode, Mode); 1101 FtpReStart:=FtpReStart(_Host, _UserId, _Passwd, _Acct, _Local, _Remote, _Mode, TransferType, Rest); 1102 FreeMem(_Host, Length(Host)+1); 1103 FreeMem(_UserId, Length(UserId)+1); 1104 FreeMem(_Passwd, Length(Passwd)+1); 1105 FreeMem(_Acct, Length(Acct)+1); 1106 FreeMem(_Local, Length(Local)+1); 1107 FreeMem(_Remote, Length(Remote)+1); 1108 FreeMem(_Mode, Length(Mode)+1); 1109End; 1110 1111Function FtpReStart(Local, Remote, Mode: String; TransferType, Rest: Integer): Longint; 1112Begin 1113 FtpReStart:=FtpReStart(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Local, Remote, Mode, TransferType, Rest); 1114End; 1115 1116Function FtpReStart(Local, Remote, Mode: String; Rest: Integer): Longint; 1117Begin 1118 FtpReStart:=FtpReStart(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Local, Remote, Mode, ShortTransferType, Rest); 1119End; 1120 1121Function FtpRemSize(Host, UserId, Passwd, Acct, Local, Remote, Mode: Pchar; TransferType: Integer): Longint; cdecl; 1122 external FTPAPIDLL index 32; 1123 1124Function FtpRemSize(Host, UserId, Passwd, Acct, Local, Remote, Mode: String; TransferType: Integer): Longint; 1125Begin 1126 Host:=Host+#0; 1127 UserId:=UserId+#0; 1128 Passwd:=Passwd+#0; 1129 Acct:=Acct+#0; 1130 Local:=Local+#0; 1131 Remote:=Remote+#0; 1132 Mode:=Mode+#0; 1133 FtpRemSize:=FtpRemSize(@Host[1], @UserId[1], @Passwd[1], @Acct[1], @Local[1], @Remote[1], @Mode[1], TransferType); 1134End; 1135 1136Function FtpRemSize(Local, Remote, Mode: String; TransferType: Integer): Longint; 1137Begin 1138 FtpRemSize:=FtpRemSize(ShortHost, ShortUserId, ShortPasswd, ShortAcct, Local, Remote, Mode, TransferType); 1139End; 1140 1141Function FtpRemSize(Local, Remote, Mode: String): Longint; 1142Begin 1143 FtpRemSize:=FtpRemSize(Local, Remote, Mode, ShortTransferType); 1144End; 1145 1146Function FtpSetUser(Host, UserId, Passwd, Acct: String): Integer; 1147Begin 1148 ShortHost:=Host; 1149 ShortUserId:=UserId; 1150 ShortPasswd:=Passwd; 1151 ShortAcct:=Acct; 1152 FtpSetUser:=0; 1153 If (Host='') or (UserId='') then FtpSetUser:=-1; 1154End; 1155 1156Function FtpSetBinary(TransferType: Integer): Integer; 1157Begin 1158 ShortTransferType:=TransferType; 1159 FtpSetBinary:=0; 1160End; 1161 1162(* Undocumented functions follow 1163Function FtpXLate(Dig: Longint; St:PChar): Longint; cdecl; 1164 external FTPAPIDLL index 22; 1165Procedure FtpXferWnd(var _hwnd: HWND); cdecl; external FTPAPIDLL index 26; 1166Procedure FtpSetConvertMode(var code: integer); cdecl; 1167 external FTPAPIDLL index 27; 1168Procedure FtpSetEncodeMode(var code: integer); cdecl; 1169 external FTPAPIDLL index 28; 1170Procedure FtpSetDecodeMode(var code: integer); cdecl; 1171 external FTPAPIDLL index 29; 1172 1173Absolutely no information about following functions: 1174 1175var FtpErrNo: integer; cdecl; external FTPAPIDLL index 20; // seems to be a copy of ftp_errno 1176//� 00033 � FTPQUOTEREPLY // Seems to be direct command send (reply to ftpquote) 1177//� 00034 � FtpSetActiveMode 1178 1179*) 1180 1181End.