home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / delphi / kompon / d456 / RASMG110.ZIP / Ras.pas next >
Pascal/Delphi Source File  |  2002-08-05  |  106KB  |  3,909 lines

  1. {* Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved
  2. **
  3. ** ras.h
  4. ** Remote Access external API
  5. ** Public header for external API clients
  6. **
  7. *}
  8.  
  9. { Delphi conversion by Davide Moretti <dave@rimini.com }
  10. { Rewritten for dynamic RASAPI32 linking:
  11.   12 Nov 2001, Alex Ilyin alexil@pisem.net }
  12. { Bug Fix (eliminate error message when RAS not installed):
  13.   10 Jan 2002, Alex Ilyin alexil@pisem.net }
  14. { Note: All functions and structures defaults to Ansi. If you want to use
  15.   Unicode structs and funcs, use the names ending with 'W'
  16.   you must define one of these for specific features: }
  17.  
  18. {.$DEFINE WINNT35COMPATIBLE}
  19. {.$DEFINE WINVER31}   // for Windows NT 3.5, Windows NT 3.51
  20. {nothing}             // for Windows 95, Windows NT SUR (default)
  21. {$DEFINE WINVER41}   // for Windows NT SUR enhancements
  22.  
  23. {$ALIGN ON}
  24.  
  25. unit Ras;
  26.  
  27. interface
  28.  
  29. uses Windows, Messages, SysUtils;
  30.  
  31.  
  32. var  bRasAvail: Boolean;    // True if RASAPI32 successfully linked
  33.  
  34. const
  35.  
  36. { These are from lmcons.h }
  37.  
  38.   DNLEN = 15;  // Maximum domain name length
  39.   UNLEN = 256; // Maximum user name length
  40.   PWLEN = 256; // Maximum password length
  41.   NETBIOS_NAME_LEN = 16; // NetBIOS net name (bytes)
  42.  
  43.   RAS_MaxDeviceType  = 16;
  44.   RAS_MaxPhoneNumber = 128;
  45.   RAS_MaxIpAddress   = 15;
  46.   RAS_MaxIpxAddress  = 21;
  47.  
  48. {$IFDEF WINVER31}
  49. {Version 3.x sizes }
  50.   RAS_MaxEntryName      = 20;
  51.   RAS_MaxDeviceName     = 32;
  52.   RAS_MaxCallbackNumber = 48;
  53. {$ELSE}
  54. {Version 4.x sizes }
  55.   RAS_MaxEntryName      = 256;
  56.   RAS_MaxDeviceName     = 128;
  57.   RAS_MaxCallbackNumber = RAS_MaxPhoneNumber;
  58. {$ENDIF}
  59.  
  60.   RAS_MaxAreaCode       = 10;
  61.   RAS_MaxPadType        = 32;
  62.   RAS_MaxX25Address     = 200;
  63.   RAS_MaxFacilities     = 200;
  64.   RAS_MaxUserData       = 200;
  65.  
  66. type
  67.  
  68.   LPHRasConn = ^THRasConn;
  69.   THRasConn = Longint;
  70.  
  71.  
  72. {* Identifies an active RAS connection.  (See RasEnumConnections)
  73. *}
  74.   LPRasConnW = ^TRasConnW;
  75.   TRasConnW = record
  76.     dwSize: Longint;
  77.     hrasconn: THRasConn;
  78.     szEntryName: Array[0..RAS_MaxEntryName] of WideChar;
  79. {$IFNDEF WINVER31}
  80.     szDeviceType: Array[0..RAS_MaxDeviceType] of WideChar;
  81.     szDeviceName: Array[0..RAS_MaxDeviceName] of WideChar;
  82. {$ENDIF}
  83. {$IFDEF WINVER41}
  84.     szPhonebook: Array[0..MAX_PATH - 1] of WideChar;
  85.     dwSubEntry: Longint;
  86. {$ENDIF}
  87.   end;
  88.  
  89.   LPRasConnA = ^TRasConnA;
  90.   TRasConnA = record
  91.     dwSize: Longint;
  92.     hrasconn: THRasConn;
  93.     szEntryName: Array[0..RAS_MaxEntryName] of AnsiChar;
  94. {$IFNDEF WINVER31}
  95.     szDeviceType: Array[0..RAS_MaxDeviceType] of AnsiChar;
  96.     szDeviceName: Array[0..RAS_MaxDeviceName] of AnsiChar;
  97. {$ENDIF}
  98. {$IFDEF WINVER41}
  99.     szPhonebook: Array[0..MAX_PATH - 1] of AnsiChar;
  100.     dwSubEntry: Longint;
  101. {$ENDIF}
  102.   end;
  103.  
  104.   LPRasConn = ^TRasConn;
  105.   TRasConn = TRasConnA;
  106.  
  107.  
  108. const
  109.  
  110. {* Enumerates intermediate states to a connection.  (See RasDial)
  111. *}
  112.   RASCS_PAUSED = $1000;
  113.   RASCS_DONE   = $2000;
  114.  
  115. type
  116.  
  117.   LPRasConnState = ^TRasConnState;
  118.   TRasConnState = Integer;
  119.  
  120. const
  121.  
  122.   RASCS_OpenPort = 0;
  123.   RASCS_PortOpened = 1;
  124.   RASCS_ConnectDevice = 2;
  125.   RASCS_DeviceConnected = 3;
  126.   RASCS_AllDevicesConnected = 4;
  127.   RASCS_Authenticate = 5;
  128.   RASCS_AuthNotify = 6;
  129.   RASCS_AuthRetry = 7;
  130.   RASCS_AuthCallback = 8;
  131.   RASCS_AuthChangePassword = 9;
  132.   RASCS_AuthProject = 10;
  133.   RASCS_AuthLinkSpeed = 11;
  134.   RASCS_AuthAck = 12;
  135.   RASCS_ReAuthenticate = 13;
  136.   RASCS_Authenticated = 14;
  137.   RASCS_PrepareForCallback = 15;
  138.   RASCS_WaitForModemReset = 16;
  139.   RASCS_WaitForCallback = 17;
  140.   RASCS_Projected = 18;
  141. {$IFNDEF WINVER31}
  142.   RASCS_StartAuthentication = 19;
  143.   RASCS_CallbackComplete = 20;
  144.   RASCS_LogonNetwork = 21;
  145. {$ENDIF}
  146.  
  147.   RASCS_Interactive = RASCS_PAUSED;
  148.   RASCS_RetryAuthentication = RASCS_PAUSED + 1;
  149.   RASCS_CallbackSetByCaller = RASCS_PAUSED + 2;
  150.   RASCS_PasswordExpired = RASCS_PAUSED + 3;
  151.  
  152.   RASCS_Connected = RASCS_DONE;
  153.   RASCS_Disconnected = RASCS_DONE + 1;
  154.  
  155. type
  156.  
  157. {* Describes the status of a RAS connection.  (See RasConnectionStatus)
  158. *}
  159.   LPRasConnStatusW = ^TRasConnStatusW;
  160.   TRasConnStatusW = record
  161.     dwSize: Longint;
  162.     rasconnstate: TRasConnState;
  163.     dwError: LongInt;
  164.     szDeviceType: Array[0..RAS_MaxDeviceType] of WideChar;
  165.     szDeviceName: Array[0..RAS_MaxDeviceName] of WideChar;
  166. {$IFDEF WINVER41}
  167.     swPhoneNumber: Array[0..RAS_MaxPhoneNumber] of WideChar;
  168. {$ENDIF}
  169.   end;
  170.  
  171.   LPRasConnStatusA = ^TRasConnStatusA;
  172.   TRasConnStatusA = record
  173.     dwSize: Longint;
  174.     rasconnstate: TRasConnState;
  175.     dwError: LongInt;
  176.     szDeviceType: Array[0..RAS_MaxDeviceType] of AnsiChar;
  177.     szDeviceName: Array[0..RAS_MaxDeviceName] of AnsiChar;
  178. {$IFDEF WINVER41}
  179.     swPhoneNumber: Array[0..RAS_MaxPhoneNumber] of AnsiChar;
  180. {$ENDIF}
  181.   end;
  182.  
  183.   LPRasConnStatus = ^TRasConnStatus;
  184.   TRasConnStatus = TRasConnStatusA;
  185.  
  186.  
  187. {* Describes connection establishment parameters.  (See RasDial)
  188. *}
  189.   LPRasDialParamsW = ^TRasDialParamsW;
  190.   TRasDialParamsW = record
  191.     dwSize: LongInt;
  192.     szEntryName: Array[0..RAS_MaxEntryName] of WideChar;
  193.     szPhoneNumber: Array[0..RAS_MaxPhoneNumber] of WideChar;
  194.     szCallbackNumber: Array[0..RAS_MaxCallbackNumber] of WideChar;
  195.     szUserName: Array[0..UNLEN] of WideChar;
  196.     szPassword: Array[0..PWLEN] of WideChar;
  197.     szDomain: Array[0..DNLEN] of WideChar;
  198. {$IFDEF WINVER41}
  199.     dwSubEntry: Longint;
  200.     dwCallbackId: Longint;
  201. {$ENDIF}
  202.   end;
  203.  
  204.   LPRasDialParamsA = ^TRasDialParamsA;
  205.   TRasDialParamsA = record
  206.     dwSize: LongInt;
  207.     szEntryName: Array[0..RAS_MaxEntryName] of AnsiChar;
  208.     szPhoneNumber: Array[0..RAS_MaxPhoneNumber] of AnsiChar;
  209.     szCallbackNumber: Array[0..RAS_MaxCallbackNumber] of AnsiChar;
  210.     szUserName: Array[0..UNLEN] of AnsiChar;
  211.     szPassword: Array[0..PWLEN] of AnsiChar;
  212.     szDomain: Array[0..DNLEN] of AnsiChar;
  213. {$IFDEF WINVER41}
  214.     dwSubEntry: Longint;
  215.     dwCallbackId: Longint;
  216. {$ENDIF}
  217.   end;
  218.  
  219.   LPRasDialParams = ^TRasDialParams;
  220.   TRasDialParams = TRasDialParamsA;
  221.  
  222.  
  223. {* Describes extended connection establishment options.  (See RasDial)
  224. *}
  225.   LPRasDialExtensions = ^TRasDialExtensions;
  226.   TRasDialExtensions = record
  227.     dwSize: LongInt;
  228.     dwfOptions: LongInt;
  229.     hwndParent: HWND;
  230.     reserved: LongInt;
  231.   end;
  232.  
  233. const
  234.  
  235. {* 'dwfOptions' bit flags.
  236. *}
  237.   RDEOPT_UsePrefixSuffix           = $00000001;
  238.   RDEOPT_PausedStates              = $00000002;
  239.   RDEOPT_IgnoreModemSpeaker        = $00000004;
  240.   RDEOPT_SetModemSpeaker           = $00000008;
  241.   RDEOPT_IgnoreSoftwareCompression = $00000010;
  242.   RDEOPT_SetSoftwareCompression    = $00000020;
  243.   RDEOPT_DisableConnectedUI        = $00000040;
  244.   RDEOPT_DisableReconnectUI        = $00000080;
  245.   RDEOPT_DisableReconnect          = $00000100;
  246.   RDEOPT_NoUser                    = $00000200;
  247.   RDEOPT_PauseOnScript             = $00000400;
  248.  
  249.  
  250. type
  251.  
  252. {* Describes an enumerated RAS phone book entry name.  (See RasEntryEnum)
  253. *}
  254.   LPRasEntryNameW = ^TRasEntryNameW;
  255.   TRasEntryNameW = record
  256.     dwSize: Longint;
  257.     szEntryName: Array[0..RAS_MaxEntryName] of WideChar;
  258.   end;
  259.  
  260.   LPRasEntryNameA = ^TRasEntryNameA;
  261.   TRasEntryNameA = record
  262.     dwSize: Longint;
  263.     szEntryName: Array[0..RAS_MaxEntryName] of AnsiChar;
  264.   end;
  265.  
  266.   LPRasEntryName = ^TRasEntryName;
  267.   TRasEntryName = TRasEntryNameA;
  268.  
  269.  
  270. {* Protocol code to projection data structure mapping.
  271. *}
  272.   LPRasProjection = ^TRasProjection;
  273.   TRasProjection = Integer;
  274.  
  275. const
  276.  
  277.   RASP_Amb = $10000;
  278.   RASP_PppNbf = $803F;
  279.   RASP_PppIpx = $802B;
  280.   RASP_PppIp = $8021;
  281.   RASP_PppLcp = $C021;
  282.   RASP_Slip = $20000;
  283.  
  284.  
  285. type
  286.  
  287. {* Describes the result of a RAS AMB (Authentication Message Block)
  288. ** projection.  This protocol is used with NT 3.1 and OS/2 1.3 downlevel
  289. ** RAS servers.
  290. *}
  291.   LPRasAmbW = ^TRasAmbW;
  292.   TRasAmbW = record
  293.     dwSize: Longint;
  294.     dwError: Longint;
  295.     szNetBiosError: Array[0..NETBIOS_NAME_LEN] of WideChar;
  296.     bLana: Byte;
  297.   end;
  298.  
  299.   LPRasAmbA = ^TRasAmbA;
  300.   TRasAmbA = record
  301.     dwSize: Longint;
  302.     dwError: Longint;
  303.     szNetBiosError: Array[0..NETBIOS_NAME_LEN] of AnsiChar;
  304.     bLana: Byte;
  305.   end;
  306.  
  307.   LPRasAmb = ^TRasAmb;
  308.   TRasAmb = TRasAmbA;
  309.  
  310.  
  311. {* Describes the result of a PPP NBF (NetBEUI) projection.
  312. *}
  313.   LPRasPppNbfW = ^TRasPppNbfW;
  314.   TRasPppNbfW = record
  315.     dwSize: Longint;
  316.     dwError: Longint;
  317.     dwNetBiosError: Longint;
  318.     szNetBiosError: Array[0..NETBIOS_NAME_LEN] of WideChar;
  319.     szWorkstationName: Array[0..NETBIOS_NAME_LEN] of WideChar;
  320.     bLana: Byte;
  321.   end;
  322.  
  323.   LPRasPppNbfA = ^TRasPppNbfA;
  324.   TRasPppNbfA = record
  325.     dwSize: Longint;
  326.     dwError: Longint;
  327.     dwNetBiosError: Longint;
  328.     szNetBiosError: Array[0..NETBIOS_NAME_LEN] of AnsiChar;
  329.     szWorkstationName: Array[0..NETBIOS_NAME_LEN] of AnsiChar;
  330.     bLana: Byte;
  331.   end;
  332.  
  333.   LpRaspppNbf = ^TRasPppNbf;
  334.   TRasPppNbf = TRasPppNbfA;
  335.  
  336.  
  337. {* Describes the results of a PPP IPX (Internetwork Packet Exchange)
  338. ** projection.
  339. *}
  340.   LPRasPppIpxW = ^TRasPppIpxW;
  341.   TRasPppIpxW = record
  342.     dwSize: Longint;
  343.     dwError: Longint;
  344.     szIpxAddress: Array[0..RAS_MaxIpxAddress] of WideChar;
  345.   end;
  346.  
  347.   LPRasPppIpxA = ^TRasPppIpxA;
  348.   TRasPppIpxA = record
  349.     dwSize: Longint;
  350.     dwError: Longint;
  351.     szIpxAddress: Array[0..RAS_MaxIpxAddress] of AnsiChar;
  352.   end;
  353.  
  354.   LPRasPppIpx = ^TRasPppIpx;
  355.   TRasPppIpx = TRasPppIpxA;
  356.  
  357.  
  358. {* Describes the results of a PPP IP (Internet) projection.
  359. *}
  360.   LPRasPppIpW = ^TRasPppIpW;
  361.   TRasPppIpW = record
  362.     dwSize: Longint;
  363.     dwError: Longint;
  364.     szIpAddress: Array[0..RAS_MaxIpAddress] of WideChar;
  365.  
  366. {$IFNDEF WINNT35COMPATIBLE}
  367.  
  368.     {* This field was added between Windows NT 3.51 beta and Windows NT 3.51
  369.     ** final, and between Windows 95 M8 beta and Windows 95 final.  If you do
  370.     ** not require the server address and wish to retrieve PPP IP information
  371.     ** from Windows NT 3.5 or early Windows NT 3.51 betas, or on early Windows
  372.     ** 95 betas, define WINNT35COMPATIBLE.
  373.     **
  374.     ** The server IP address is not provided by all PPP implementations,
  375.     ** though Windows NT server's do provide it.
  376.     *}
  377.     szServerIpAddress: Array[0..RAS_MaxIpAddress] of WideChar;
  378.  
  379. {$ENDIF}
  380.   end;
  381.  
  382.   LPRasPppIpA = ^TRasPppIpA;
  383.   TRasPppIpA = record
  384.     dwSize: Longint;
  385.     dwError: Longint;
  386.     szIpAddress: Array[0..RAS_MaxIpAddress] of AnsiChar;
  387.  
  388. {$IFNDEF WINNT35COMPATIBLE}
  389.  
  390.     {* See RASPPPIPW comment.
  391.     *}
  392.     szServerIpAddress: Array[0..RAS_MaxIpAddress] of AnsiChar;
  393.  
  394. {$ENDIF}
  395.   end;
  396.  
  397.   LPRasPppIp = ^TRasPppIp;
  398.   TRasPppIp = TRasPppIpA;
  399.  
  400.  
  401. {* Describes the results of a PPP LCP/multi-link negotiation.
  402. *}
  403.   LpRasPppLcp = ^TRasPppLcp;
  404.   TRasPppLcp = record
  405.     dwSize: Longint;
  406.     fBundled: LongBool;
  407.   end;
  408.  
  409.  
  410. {* Describes the results of a SLIP (Serial Line IP) projection.
  411. *}
  412.   LpRasSlipW = ^TRasSlipW;
  413.   TRasSlipW = record
  414.     dwSize: Longint;
  415.     dwError: Longint;
  416.     szIpAddress: Array[0..RAS_MaxIpAddress] of WideChar;
  417.   end;
  418.  
  419.   LpRasSlipA = ^TRasSlipA;
  420.   TRasSlipA = record
  421.     dwSize: Longint;
  422.     dwError: Longint;
  423.     szIpAddress: Array[0..RAS_MaxIpAddress] of AnsiChar;
  424.   end;
  425.  
  426.   LpRasSlip = ^TRasSlip;
  427.   TRasSlip = TRasSlipA;
  428.  
  429.  
  430. const
  431.  
  432. {* If using RasDial message notifications, get the notification message code
  433. ** by passing this string to the RegisterWindowMessageA() API.
  434. ** WM_RASDIALEVENT is used only if a unique message cannot be registered.
  435. *}
  436.   RASDIALEVENT    = 'RasDialEvent';
  437.   WM_RASDIALEVENT = $CCCD;
  438.  
  439.  
  440. {* Prototypes for caller's RasDial callback handler.  Arguments are the
  441. ** message ID (currently always WM_RASDIALEVENT), the current RASCONNSTATE and
  442. ** the error that has occurred (or 0 if none).  Extended arguments are the
  443. ** handle of the RAS connection and an extended error code.
  444. **
  445. ** For RASDIALFUNC2, subsequent callback notifications for all
  446. ** subentries can be cancelled by returning FALSE.
  447. *}
  448. {
  449. typedef VOID (WINAPI *RASDIALFUNC)( UINT, RASCONNSTATE, DWORD );
  450. typedef VOID (WINAPI *RASDIALFUNC1)( HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD );
  451. typedef DWORD (WINAPI *RASDIALFUNC2)( DWORD, DWORD, HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD );
  452.  
  453. For Delphi: Just define the callback as:
  454.  
  455. procedure RASCallback(msg: Integer; state: TRasConnState;
  456.     dwError: Longint); stdcall;
  457.  
  458. procedure RASCallback1(hConn: THRasConn; msg: Integer;
  459.     state: TRasConnState; dwError: Longint; dwEexterror: Longint); stdcall;
  460.  
  461. procedure RASCallback2(dwCallbackId, dwSubEntry: Longint; hConn: THRasConn;
  462.     msg: Integer; state: TRasConnState; dwError: Longint;
  463.     dwEexterror: Longint); stdcall;
  464. }
  465.  
  466. type
  467.  
  468. {* Information describing a RAS-capable device.
  469. *}
  470.   LPRasDevInfoA = ^TRasDevInfoA;
  471.   TRasDevInfoA = record
  472.     dwSize: Longint;
  473.     szDeviceType: Array[0..RAS_MaxDeviceType] of AnsiChar;
  474.     szDeviceName: Array[0..RAS_MaxDeviceName] of AnsiChar;
  475.   end;
  476.  
  477.   LPRasDevInfoW = ^TRasDevInfoW;
  478.   TRasDevInfoW = record
  479.     dwSize: Longint;
  480.     szDeviceType: Array[0..RAS_MaxDeviceType] of WideChar;
  481.     szDeviceName: Array[0..RAS_MaxDeviceName] of WideChar;
  482.   end;
  483.  
  484.   LPRasDevInfo = ^TRasDevInfo;
  485.   TRasDevInfo = TRasDevInfoA;
  486.  
  487.  
  488. (* RAS Country Information (currently retreieved from TAPI).
  489. *)
  490.   LPRasCtryInfo = ^TRasCtryInfo;
  491.   TRasCtryInfo = record
  492.     dwSize,
  493.     dwCountryID,
  494.     dwNextCountryID,
  495.     dwCountryCode,
  496.     dwCountryNameOffset: Longint;
  497.   end;
  498.  
  499. {* There is currently no difference between
  500. ** RASCTRYINFOA and RASCTRYINFOW.  This may
  501. ** change in the future.
  502. *}
  503.  
  504.   LPRasCtryInfoW = ^TRasCtryInfoW;
  505.   TRasCtryInfoW = TRasCtryInfo;
  506.   LPRasCtryInfoA = ^TRasCtryInfoA;
  507.   TRasCtryInfoA = TRasCtryInfo;
  508.  
  509.  
  510. (* A RAS IP Address.
  511. *)
  512.   LPRasIPAddr = ^TRasIPAddr;
  513.   TRasIPAddr = record
  514.     a, b, c, d: Byte;
  515.   end;
  516.  
  517.  
  518. (* A RAS phonebook entry.
  519. *)
  520.   LPRasEntryA = ^TRasEntryA;
  521.   TRasEntryA = record
  522.     dwSize,
  523.     dwfOptions,
  524.     //
  525.     // Location/phone number.
  526.     //
  527.     dwCountryID,
  528.     dwCountryCode: Longint;
  529.     szAreaCode: array[0.. RAS_MaxAreaCode] of AnsiChar;
  530.     szLocalPhoneNumber: array[0..RAS_MaxPhoneNumber] of AnsiChar;
  531.     dwAlternatesOffset: Longint;
  532.     //
  533.     // PPP/Ip
  534.     //
  535.     ipaddr,
  536.     ipaddrDns,
  537.     ipaddrDnsAlt,
  538.     ipaddrWins,
  539.     ipaddrWinsAlt: TRasIPAddr;
  540.     //
  541.     // Framing
  542.     //
  543.     dwFrameSize,
  544.     dwfNetProtocols,
  545.     dwFramingProtocol: Longint;
  546.     //
  547.     // Scripting
  548.     //
  549.     szScript: Array[0..MAX_PATH - 1] of AnsiChar;
  550.     //
  551.     // AutoDial
  552.     //
  553.     szAutodialDll: Array [0..MAX_PATH - 1] of AnsiChar;
  554.     szAutodialFunc: Array [0..MAX_PATH - 1] of AnsiChar;
  555.     //
  556.     // Device
  557.     //
  558.     szDeviceType: Array [0..RAS_MaxDeviceType] of AnsiChar;
  559.     szDeviceName: Array [0..RAS_MaxDeviceName] of AnsiChar;
  560.     //
  561.     // X.25
  562.     //
  563.     szX25PadType: Array [0..RAS_MaxPadType] of AnsiChar;
  564.     szX25Address: Array [0..RAS_MaxX25Address] of AnsiChar;
  565.     szX25Facilities: Array [0..RAS_MaxFacilities] of AnsiChar;
  566.     szX25UserData: Array [0..RAS_MaxUserData] of AnsiChar;
  567.     dwChannels: Longint;
  568.     //
  569.     // Reserved
  570.     //
  571.     dwReserved1,
  572.     dwReserved2: Longint;
  573. {$IFDEF WINVER41}
  574.     //
  575.     // Multilink
  576.     //
  577.     dwSubEntries,
  578.     dwDialMode,
  579.     dwDialExtraPercent,
  580.     dwDialExtraSampleSeconds,
  581.     dwHangUpExtraPercent,
  582.     dwHangUpExtraSampleSeconds: Longint;
  583.     //
  584.     // Idle timeout
  585.     //
  586.     dwIdleDisconnectSeconds: Longint;
  587. {$ENDIF}
  588.   end;
  589.  
  590.   LPRasEntryW = ^TRasEntryW;
  591.   TRasEntryW = record
  592.     dwSize,
  593.     dwfOptions,
  594.     //
  595.     // Location/phone number.
  596.     //
  597.     dwCountryID,
  598.     dwCountryCode: Longint;
  599.     szAreaCode: array[0.. RAS_MaxAreaCode] of WideChar;
  600.     szLocalPhoneNumber: array[0..RAS_MaxPhoneNumber] of WideChar;
  601.     dwAlternatesOffset: Longint;
  602.     //
  603.     // PPP/Ip
  604.     //
  605.     ipaddr,
  606.     ipaddrDns,
  607.     ipaddrDnsAlt,
  608.     ipaddrWins,
  609.     ipaddrWinsAlt: TRasIPAddr;
  610.     //
  611.     // Framing
  612.     //
  613.     dwFrameSize,
  614.     dwfNetProtocols,
  615.     dwFramingProtocol: Longint;
  616.     //
  617.     // Scripting
  618.     //
  619.     szScript: Array[0..MAX_PATH - 1] of WideChar;
  620.     //
  621.     // AutoDial
  622.     //
  623.     szAutodialDll: Array [0..MAX_PATH - 1] of WideChar;
  624.     szAutodialFunc: Array [0..MAX_PATH - 1] of WideChar;
  625.     //
  626.     // Device
  627.     //
  628.     szDeviceType: Array [0..RAS_MaxDeviceType] of WideChar;
  629.     szDeviceName: Array [0..RAS_MaxDeviceName] of WideChar;
  630.     //
  631.     // X.25
  632.     //
  633.     szX25PadType: Array [0..RAS_MaxPadType] of WideChar;
  634.     szX25Address: Array [0..RAS_MaxX25Address] of WideChar;
  635.     szX25Facilities: Array [0..RAS_MaxFacilities] of WideChar;
  636.     szX25UserData: Array [0..RAS_MaxUserData] of WideChar;
  637.     dwChannels,
  638.     //
  639.     // Reserved
  640.     //
  641.     dwReserved1,
  642.     dwReserved2: Longint;
  643. {$IFDEF WINVER41}
  644.     //
  645.     // Multilink
  646.     //
  647.     dwSubEntries,
  648.     dwDialMode,
  649.     dwDialExtraPercent,
  650.     dwDialExtraSampleSeconds,
  651.     dwHangUpExtraPercent,
  652.     dwHangUpExtraSampleSeconds: Longint;
  653.     //
  654.     // Idle timeout
  655.     //
  656.     dwIdleDisconnectSeconds: Longint;
  657. {$ENDIF}
  658.   end;
  659.  
  660.   LPRasEntry = ^TRasEntry;
  661.   TRasEntry = TRasEntryA;
  662.  
  663. const
  664.  
  665. (* TRasEntry 'dwfOptions' bit flags.
  666. *)
  667.   RASEO_UseCountryAndAreaCodes = $00000001;
  668.   RASEO_SpecificIpAddr         = $00000002;
  669.   RASEO_SpecificNameServers    = $00000004;
  670.   RASEO_IpHeaderCompression    = $00000008;
  671.   RASEO_RemoteDefaultGateway   = $00000010;
  672.   RASEO_DisableLcpExtensions   = $00000020;
  673.   RASEO_TerminalBeforeDial     = $00000040;
  674.   RASEO_TerminalAfterDial      = $00000080;
  675.   RASEO_ModemLights            = $00000100;
  676.   RASEO_SwCompression          = $00000200;
  677.   RASEO_RequireEncryptedPw     = $00000400;
  678.   RASEO_RequireMsEncryptedPw   = $00000800;
  679.   RASEO_RequireDataEncryption  = $00001000;
  680.   RASEO_NetworkLogon           = $00002000;
  681.   RASEO_UseLogonCredentials    = $00004000;
  682.   RASEO_PromoteAlternates      = $00008000;
  683. {$IFDEF WINVER41}
  684.   RASEO_SecureLocalFiles       = $00010000;
  685. {$ENDIF}
  686.  
  687. (* TRasEntry 'dwfNetProtocols' bit flags. (session negotiated protocols)
  688. *)
  689.   RASNP_Netbeui = $00000001;  // Negotiate NetBEUI
  690.   RASNP_Ipx     = $00000002;  // Negotiate IPX
  691.   RASNP_Ip      = $00000004;  // Negotiate TCP/IP
  692.  
  693. (* TRasEntry 'dwFramingProtocols' (framing protocols used by the server)
  694. *)
  695.   RASFP_Ppp  = $00000001;  // Point-to-Point Protocol (PPP)
  696.   RASFP_Slip = $00000002;  // Serial Line Internet Protocol (SLIP)
  697.   RASFP_Ras  = $00000004;  // Microsoft proprietary protocol
  698.  
  699. (* TRasEntry 'szDeviceType' strings
  700. *)
  701.   RASDT_Modem = 'modem';     // Modem
  702.   RASDT_Isdn  = 'isdn';      // ISDN
  703.   RASDT_X25   = 'x25';      // X.25
  704.  
  705.  
  706. {* Old AutoDial DLL function prototype.
  707. **
  708. ** This prototype is documented for backward-compatibility
  709. ** purposes only.  It is superceded by the RASADFUNCA
  710. ** and RASADFUNCW definitions below.  DO NOT USE THIS
  711. ** PROTOTYPE IN NEW CODE.  SUPPORT FOR IT MAY BE REMOVED
  712. ** IN FUTURE VERSIONS OF RAS.
  713. *}
  714. {
  715. typedef BOOL (WINAPI *ORASADFUNC)( HWND, LPSTR, DWORD, LPDWORD );
  716.  
  717. For Delphi:
  718.  
  719. function ORasAdFunc(hwndParent: THandle; szEntry: PChar; dwFlags: Longint;
  720.     var lpdwRetCode: Longint): Boolean; stdcall;
  721. }
  722.  
  723. {.$IFDEF WINVER41}
  724. {* Flags for RasConnectionNotification().
  725. *}
  726.   RASCN_Connection       = $00000001;
  727.   RASCN_Disconnection    = $00000002;
  728.   RASCN_BandwidthAdded   = $00000004;
  729.   RASCN_BandwidthRemoved = $00000008;
  730. {$IFDEF WINVER41}
  731. {* TRasEntry 'dwDialMode' values.
  732. *}
  733.   RASEDM_DialAll      = 1;
  734.   RASEDM_DialAsNeeded = 2;
  735.  
  736. {* TRasEntry 'dwIdleDisconnectSeconds' constants.
  737. *}
  738.   RASIDS_Disabled       = $ffffffff;
  739.   RASIDS_UseGlobalValue = 0;
  740.  
  741. type
  742.  
  743. {* AutoDial DLL function parameter block.
  744. *}
  745.   LpRasADParams = ^TRasADParams;
  746.   TRasADParams = record
  747.     dwSize: Longint;
  748.     hwndOwner: THandle;
  749.     dwFlags: Longint;
  750.     xDlg,
  751.     yDlg: Longint;
  752.   end;
  753.  
  754. const
  755.  
  756. {* AutoDial DLL function parameter block 'dwFlags.'
  757. *}
  758.   RASADFLG_PositionDlg = $00000001;
  759.  
  760. {* Prototype AutoDial DLL function.
  761. *}
  762. {
  763. typedef BOOL (WINAPI *RASADFUNCA)( LPSTR, LPSTR, LPRASADPARAMS, LPDWORD );
  764. typedef BOOL (WINAPI *RASADFUNCW)( LPWSTR, LPWSTR, LPRASADPARAMS, LPDWORD );
  765.  
  766. For Delphi:
  767.  
  768. function RasAdFuncA(lpszPhonebook, lpszEntry: PAnsiChar;
  769.     var lpAutoDialParams: TRasADParams;
  770.     var lpdwRetCode: Longint): Boolean; stdcall;
  771.  
  772. function RasAdFuncW(lpszPhonebook, lpszEntry: PWideChar;
  773.     var lpAutoDialParams: TRasADParams;
  774.     var lpdwRetCode: Longint): Boolean; stdcall;
  775. }
  776.  
  777. type
  778.  
  779. {* A RAS phone book multilinked sub-entry.
  780. *}
  781.   LpRasSubEntryA = ^TRasSubEntryA;
  782.   TRasSubEntryA = record
  783.     dwSize,
  784.     dwfFlags: Longint;
  785.     //
  786.     // Device
  787.     //
  788.     szDeviceType: Array[0..RAS_MaxDeviceType] of AnsiChar;
  789.     szDeviceName: Array[0..RAS_MaxDeviceName] of AnsiChar;
  790.     //
  791.     // Phone numbers
  792.     //
  793.     szLocalPhoneNumber: Array[0..RAS_MaxPhoneNumber] of AnsiChar;
  794.     dwAlternateOffset: Longint;
  795.   end;
  796.  
  797.   LpRasSubEntryW = ^TRasSubEntryW;
  798.   TRasSubEntryW = record
  799.     dwSize,
  800.     dwfFlags: Longint;
  801.     //
  802.     // Device
  803.     //
  804.     szDeviceType: Array[0..RAS_MaxDeviceType] of WideChar;
  805.     szDeviceName: Array[0..RAS_MaxDeviceName] of WideChar;
  806.     //
  807.     // Phone numbers
  808.     //
  809.     szLocalPhoneNumber: Array[0..RAS_MaxPhoneNumber] of WideChar;
  810.     dwAlternateOffset: Longint;
  811.   end;
  812.  
  813.   LpRasSubEntry = ^TRasSubEntryA;
  814.   TRasSubEntry = TRasSubEntryA;
  815.  
  816. {* Ras(Get,Set)Credentials structure.  These calls
  817. ** supercede Ras(Get,Set)EntryDialParams.
  818. *}
  819.   LpRasCredentialsA = ^TRasCredentialsA;
  820.   TRasCredentialsA = record
  821.     dwSize,
  822.     dwMask: Longint;
  823.     szUserName: Array[0..UNLEN] of AnsiChar;
  824.     zPassword: Array[0..PWLEN ] of AnsiChar;
  825.     szDomain: Array[0..DNLEN] of AnsiChar;
  826.   end;
  827.  
  828.   LpRasCredentialsW = ^TRasCredentialsW;
  829.   TRasCredentialsW = record
  830.     dwSize,
  831.     dwMask: Longint;
  832.     szUserName: Array[0..UNLEN] of WideChar;
  833.     zPassword: Array[0..PWLEN ] of WideChar;
  834.     szDomain: Array[0..DNLEN] of WideChar;
  835.   end;
  836.  
  837.   LPRasCredentials = ^TRasCredentials;
  838.   TRasCredentials = TRasCredentialsA;
  839.  
  840. const
  841.  
  842. {* TRasCredentials 'dwMask' values.
  843. *}
  844.   RASCM_UserName = $00000001;
  845.   RASCM_Password = $00000002;
  846.   RASCM_Domain   = $00000004;
  847.  
  848.  
  849. type
  850.  
  851. {* AutoDial address properties.
  852. *}
  853.   LPRasAutoDialEntryA = ^TRasAutoDialEntryA;
  854.   TRasAutoDialEntryA = record
  855.     dwSize,
  856.     dwFlags,
  857.     dwDialingLocation: Longint;
  858.     szEntry: Array[0..RAS_MaxEntryName] of AnsiChar;
  859.   end;
  860.  
  861.   LPRasAutoDialEntryW = ^TRasAutoDialEntryW;
  862.   TRasAutoDialEntryW = record
  863.     dwSize,
  864.     dwFlags,
  865.     dwDialingLocation: Longint;
  866.     szEntry: Array[0..RAS_MaxEntryName] of WideChar;
  867.   end;
  868.  
  869.   LPRasAutoDialEntry = ^TRasAutoDialEntry;
  870.   TRasAutoDialEntry = TRasAutoDialEntryA;
  871.  
  872. const
  873.  
  874. {* AutoDial control parameter values for
  875. ** Ras(Get,Set)AutodialParam.
  876. *}
  877.   RASADP_DisableConnectionQuery  = 0;
  878.   RASADP_LoginSessionDisable     = 1;
  879.   RASADP_SavedAddressesLimit     = 2;
  880.   RASADP_FailedConnectionTimeout = 3;
  881.   RASADP_ConnectionQueryTimeout  = 4;
  882. {$ENDIF}  // WINVER41
  883.  
  884.  
  885. {* External RAS API function prototypes.
  886. *}
  887. {Note: for Delphi the function without 'A' or 'W' is the Ansi one
  888.   as on the other Delphi headers}
  889.  
  890. function RasDialA(
  891.     lpRasDialExt: LPRasDialExtensions;
  892.     lpszPhoneBook: PAnsiChar;
  893.     var params: TRasDialParamsA;
  894.     dwNotifierType: Longword;
  895.     lpNotifier: Pointer;
  896.     var rasconn: THRasConn
  897.     ): Longint;
  898. function RasDialW(
  899.     lpRasDialExt: LPRasDialExtensions;
  900.     lpszPhoneBook: PWideChar;
  901.     var params: TRasDialParamsW;
  902.     dwNotifierType: Longword;
  903.     lpNotifier: Pointer;
  904.     var rasconn: THRasConn
  905.     ): Longint;
  906. function RasDial(
  907.     lpRasDialExt: LPRasDialExtensions;
  908.     lpszPhoneBook: PChar;
  909.     var params: TRasDialParams;
  910.     dwNotifierType: Longword;
  911.     lpNotifier: Pointer;
  912.     var rasconn: THRasConn
  913.     ): Longint;
  914.  
  915. function RasEnumConnectionsA(
  916.     rasconnArray: LPRasConnA;
  917.     var lpcb: Longint;
  918.     var lpcConnections: Longint
  919.     ): Longint;
  920. function RasEnumConnectionsW(
  921.     rasconnArray: LPRasConnW;
  922.     var lpcb: Longint;
  923.     var lpcConnections: Longint
  924.     ): Longint;
  925. function RasEnumConnections(
  926.     rasconnArray: LPRasConn;
  927.     var lpcb: Longint;
  928.     var lpcConnections: Longint
  929.     ): Longint;
  930.  
  931. function RasEnumEntriesA(
  932.     reserved: PAnsiChar;
  933.     lpszPhoneBook: PAnsiChar;
  934.     entrynamesArray: LPRasEntryNameA;
  935.     var lpcb: Longint;
  936.     var lpcEntries: Longint
  937.     ): Longint;
  938. function RasEnumEntriesW(
  939.     reserved: PWideChar;
  940.     lpszPhoneBook: PWideChar;
  941.     entrynamesArray: LPRasEntryNameW;
  942.     var lpcb: Longint;
  943.     var lpcEntries: Longint
  944.     ): Longint;
  945. function RasEnumEntries(
  946.     reserved: PChar;
  947.     lpszPhoneBook: PChar;
  948.     entrynamesArray: LPRasEntryName;
  949.     var lpcb: Longint;
  950.     var lpcEntries: Longint
  951.     ): Longint;
  952.  
  953. function RasGetConnectStatusA(
  954.     hConn: THRasConn;
  955.     var lpStatus: TRasConnStatusA
  956.     ): Longint;
  957. function RasGetConnectStatusW(
  958.     hConn: THRasConn;
  959.     var lpStatus: TRasConnStatusW
  960.     ): Longint;
  961. function RasGetConnectStatus(
  962.     hConn: THRasConn;
  963.     var lpStatus: TRasConnStatus
  964.     ): Longint;
  965.  
  966. function RasGetErrorStringA(
  967.     errorValue: Integer;
  968.     erroString: PAnsiChar;
  969.     cBufSize: Longint
  970.     ): Longint;
  971. function RasGetErrorStringW(
  972.     errorValue: Integer;
  973.     erroString: PWideChar;
  974.     cBufSize: Longint
  975.     ): Longint;
  976. function RasGetErrorString(
  977.     errorValue: Integer;
  978.     erroString: PChar;
  979.     cBufSize: Longint
  980.     ): Longint;
  981.  
  982. function RasHangUpA(
  983.     hConn: THRasConn
  984.     ): Longint;
  985. function RasHangUpW(
  986.     hConn: THRasConn
  987.     ): Longint;
  988. function RasHangUp(
  989.     hConn: THRasConn
  990.     ): Longint;
  991.  
  992. function RasGetProjectionInfoA(
  993.     hConn: THRasConn;
  994.     rasproj: TRasProjection;
  995.     lpProjection: Pointer;
  996.     var lpcb: Longint
  997.     ): Longint;
  998. function RasGetProjectionInfoW(
  999.     hConn: THRasConn;
  1000.     rasproj: TRasProjection;
  1001.     lpProjection: Pointer;
  1002.     var lpcb: Longint
  1003.     ): Longint;
  1004. function RasGetProjectionInfo(
  1005.     hConn: THRasConn;
  1006.     rasproj: TRasProjection;
  1007.     lpProjection: Pointer;
  1008.     var lpcb: Longint
  1009.     ): Longint;
  1010.  
  1011. function RasCreatePhonebookEntryA(
  1012.     hwndParentWindow: HWND;
  1013.     lpszPhoneBook: PAnsiChar
  1014.     ): Longint;
  1015. function RasCreatePhonebookEntryW(
  1016.     hwndParentWindow: HWND;
  1017.     lpszPhoneBook: PWideChar
  1018.     ): Longint;
  1019. function RasCreatePhonebookEntry(
  1020.     hwndParentWindow: HWND;
  1021.     lpszPhoneBook: PChar
  1022.     ): Longint;
  1023.  
  1024. function RasEditPhonebookEntryA(
  1025.     hwndParentWindow: HWND;
  1026.     lpszPhoneBook: PAnsiChar;
  1027.     lpszEntryName: PAnsiChar
  1028.     ): Longint;
  1029. function RasEditPhonebookEntryW(
  1030.     hwndParentWindow: HWND;
  1031.     lpszPhoneBook: PWideChar;
  1032.     lpszEntryName: PWideChar
  1033.     ): Longint;
  1034. function RasEditPhonebookEntry(
  1035.     hwndParentWindow: HWND;
  1036.     lpszPhoneBook: PChar;
  1037.     lpszEntryName: PChar
  1038.     ): Longint;
  1039.  
  1040. function RasSetEntryDialParamsA(
  1041.     lpszPhoneBook: PAnsiChar;
  1042.     var lpDialParams: TRasDialParamsA;
  1043.     fRemovePassword: LongBool
  1044.     ): Longint;
  1045. function RasSetEntryDialParamsW(
  1046.     lpszPhoneBook: PWideChar;
  1047.     var lpDialParams: TRasDialParamsW;
  1048.     fRemovePassword: LongBool
  1049.     ): Longint;
  1050. function RasSetEntryDialParams(
  1051.     lpszPhoneBook: PChar;
  1052.     var lpDialParams: TRasDialParams;
  1053.     fRemovePassword: LongBool
  1054.     ): Longint;
  1055.  
  1056. function RasGetEntryDialParamsA(
  1057.     lpszPhoneBook: PAnsiChar;
  1058.     var lpDialParams: TRasDialParamsA;
  1059.     var lpfPassword: LongBool
  1060.     ): Longint;
  1061. function RasGetEntryDialParamsW(
  1062.     lpszPhoneBook: PWideChar;
  1063.     var lpDialParams: TRasDialParamsW;
  1064.     var lpfPassword: LongBool
  1065.     ): Longint;
  1066. function RasGetEntryDialParams(
  1067.     lpszPhoneBook: PChar;
  1068.     var lpDialParams: TRasDialParams;
  1069.     var lpfPassword: LongBool
  1070.     ): Longint;
  1071.  
  1072. function RasEnumDevicesA(
  1073.     lpBuff: LPRasDevInfoA;
  1074.     var lpcbSize: Longint;
  1075.     var lpcDevices: Longint
  1076.     ): Longint;
  1077. function RasEnumDevicesW(
  1078.     lpBuff: LPRasDevInfoW;
  1079.     var lpcbSize: Longint;
  1080.     var lpcDevices: Longint
  1081.     ): Longint;
  1082. function RasEnumDevices(
  1083.     lpBuff: LPRasDevInfo;
  1084.     var lpcbSize: Longint;
  1085.     var lpcDevices: Longint
  1086.     ): Longint;
  1087.  
  1088. function RasGetCountryInfoA(
  1089.     lpCtryInfo: LPRasCtryInfoA;
  1090.     var lpdwSize: Longint
  1091.     ): Longint;
  1092. function RasGetCountryInfoW(
  1093.     lpCtryInfo: LPRasCtryInfoW;
  1094.     var lpdwSize: Longint
  1095.     ): Longint;
  1096. function RasGetCountryInfo(
  1097.     lpCtryInfo: LPRasCtryInfo;
  1098.     var lpdwSize: Longint
  1099.     ): Longint;
  1100.  
  1101. function RasGetEntryPropertiesA(
  1102.     lpszPhonebook,
  1103.     szEntry: PAnsiChar;
  1104.     lpbEntry: Pointer;
  1105.     var lpdwEntrySize: Longint;
  1106.     lpbDeviceInfo: Pointer;
  1107.     var lpdwDeviceInfoSize: Longint
  1108.     ): Longint;
  1109. function RasGetEntryPropertiesW(
  1110.     lpszPhonebook,
  1111.     szEntry: PWideChar;
  1112.     lpbEntry: Pointer;
  1113.     var lpdwEntrySize: Longint;
  1114.     lpbDeviceInfo: Pointer;
  1115.     var lpdwDeviceInfoSize: Longint
  1116.     ): Longint;
  1117. function RasGetEntryProperties(
  1118.     lpszPhonebook,
  1119.     szEntry: PChar;
  1120.     lpbEntry: Pointer;
  1121.     var lpdwEntrySize: Longint;
  1122.     lpbDeviceInfo: Pointer;
  1123.     var lpdwDeviceInfoSize: Longint
  1124.     ): Longint;
  1125.  
  1126. function RasSetEntryPropertiesA(
  1127.     lpszPhonebook,
  1128.     szEntry: PAnsiChar;
  1129.     lpbEntry: Pointer;
  1130.     dwEntrySize: Longint;
  1131.     lpbDeviceInfo: Pointer;
  1132.     dwDeviceInfoSize: Longint
  1133.     ): Longint;
  1134. function RasSetEntryPropertiesW(
  1135.     lpszPhonebook,
  1136.     szEntry: PWideChar;
  1137.     lpbEntry: Pointer;
  1138.     dwEntrySize: Longint;
  1139.     lpbDeviceInfo: Pointer;
  1140.     dwDeviceInfoSize: Longint
  1141.     ): Longint;
  1142. function RasSetEntryProperties(
  1143.     lpszPhonebook,
  1144.     szEntry: PChar;
  1145.     lpbEntry: Pointer;
  1146.     dwEntrySize: Longint;
  1147.     lpbDeviceInfo: Pointer;
  1148.     dwDeviceInfoSize: Longint
  1149.     ): Longint;
  1150.  
  1151. function RasRenameEntryA(
  1152.     lpszPhonebook,
  1153.     szEntryOld,
  1154.     szEntryNew: PAnsiChar
  1155.     ): Longint;
  1156. function RasRenameEntryW(
  1157.     lpszPhonebook,
  1158.     szEntryOld,
  1159.     szEntryNew: PWideChar
  1160.     ): Longint;
  1161. function RasRenameEntry(
  1162.     lpszPhonebook,
  1163.     szEntryOld,
  1164.     szEntryNew: PChar
  1165.     ): Longint;
  1166.  
  1167. function RasDeleteEntryA(
  1168.     lpszPhonebook,
  1169.     szEntry: PAnsiChar
  1170.     ): Longint;
  1171. function RasDeleteEntryW(
  1172.     lpszPhonebook,
  1173.     szEntry: PWideChar
  1174.     ): Longint;
  1175. function RasDeleteEntry(
  1176.     lpszPhonebook,
  1177.     szEntry: PChar
  1178.     ): Longint;
  1179.  
  1180. function RasValidateEntryNameA(
  1181.     lpszPhonebook,
  1182.     szEntry: PAnsiChar
  1183.     ): Longint;
  1184. function RasValidateEntryNameW(
  1185.     lpszPhonebook,
  1186.     szEntry: PWideChar
  1187.     ): Longint;
  1188. function RasValidateEntryName(
  1189.     lpszPhonebook,
  1190.     szEntry: PChar
  1191.     ): Longint;
  1192.  
  1193. {$IFDEF WINVER41}
  1194. function RasGetSubEntryHandleA(
  1195.     hrasconn: THRasConn;
  1196.     dwSubEntry: Longint;
  1197.     var lphrasconn: THRasConn
  1198.     ): Longint;
  1199. function RasGetSubEntryHandleW(
  1200.     hrasconn: THRasConn;
  1201.     dwSubEntry: Longint;
  1202.     var lphrasconn: THRasConn
  1203.     ): Longint;
  1204. function RasGetSubEntryHandle(
  1205.     hrasconn: THRasConn;
  1206.     dwSubEntry: Longint;
  1207.     var lphrasconn: THRasConn
  1208.     ): Longint;
  1209.  
  1210. function RasGetCredentialsA(
  1211.     lpszPhoneBook,
  1212.     lpszEntry: PAnsiChar;
  1213.     var lpCredentials: TRasCredentialsA
  1214.     ): Longint;
  1215. function RasGetCredentialsW(
  1216.     lpszPhoneBook,
  1217.     lpszEntry: PWideChar;
  1218.     var lpCredentials: TRasCredentialsW
  1219.     ): Longint;
  1220. function RasGetCredentials(
  1221.     lpszPhoneBook,
  1222.     lpszEntry: PChar;
  1223.     var lpCredentials: TRasCredentials
  1224.     ): Longint;
  1225.  
  1226. function RasSetCredentialsA(
  1227.     lpszPhoneBook,
  1228.     lpszEntry: PAnsiChar;
  1229.     var lpCredentials: TRasCredentialsA;
  1230.     fRemovePassword: LongBool
  1231.     ): Longint;
  1232. function RasSetCredentialsW(
  1233.     lpszPhoneBook,
  1234.     lpszEntry: PWideChar;
  1235.     var lpCredentials: TRasCredentialsW;
  1236.     fRemovePassword: LongBool
  1237.     ): Longint;
  1238. function RasSetCredentials(
  1239.     lpszPhoneBook,
  1240.     lpszEntry: PChar;
  1241.     var lpCredentials: TRasCredentials;
  1242.     fRemovePassword: LongBool
  1243.     ): Longint;
  1244.  
  1245. function RasConnectionNotificationA(
  1246.   hrasconn: THRasConn;
  1247.   hEvent: THandle;
  1248.   dwFlags: Longint
  1249.   ): Longint;
  1250. function RasConnectionNotificationW(
  1251.   hrasconn: THRasConn;
  1252.   hEvent: THandle;
  1253.   dwFlags: Longint
  1254.   ): Longint;
  1255. function RasConnectionNotification(
  1256.   hrasconn: THRasConn;
  1257.   hEvent: THandle;
  1258.   dwFlags: Longint
  1259.   ): Longint;
  1260.  
  1261. function RasGetSubEntryPropertiesA(
  1262.     lpszPhoneBook,
  1263.     lpszEntry: PAnsiChar;
  1264.     dwSubEntry: Longint;
  1265.     var lpRasSubEntry: TRasSubEntryA;
  1266.     var lpdwcb: Longint;
  1267.     p: Pointer;
  1268.     var lpdw: Longint
  1269.     ): Longint;
  1270. function RasGetSubEntryPropertiesW(
  1271.     lpszPhoneBook,
  1272.     lpszEntry: PWideChar;
  1273.     dwSubEntry: Longint;
  1274.     var lpRasSubEntry: TRasSubEntryW;
  1275.     var lpdwcb: Longint;
  1276.     p: Pointer;
  1277.     var lpdw: Longint
  1278.     ): Longint;
  1279. function RasGetSubEntryProperties(
  1280.     lpszPhoneBook,
  1281.     lpszEntry: PChar;
  1282.     dwSubEntry: Longint;
  1283.     var lpRasSubEntry: TRasSubEntry;
  1284.     var lpdwcb: Longint;
  1285.     p: Pointer;
  1286.     var lpdw: Longint
  1287.     ): Longint;
  1288.  
  1289. function RasSetSubEntryPropertiesA(
  1290.     lpszPhoneBook,
  1291.     lpszEntry: PAnsiChar;
  1292.     dwSubEntry: Longint;
  1293.     var lpRasSubEntry: TRasSubEntryA;
  1294.     dwcb: Longint;
  1295.     p: Pointer;
  1296.     dw: Longint
  1297.     ): Longint;
  1298. function RasSetSubEntryPropertiesW(
  1299.     lpszPhoneBook,
  1300.     lpszEntry: PWideChar;
  1301.     dwSubEntry: Longint;
  1302.     var lpRasSubEntry: TRasSubEntryW;
  1303.     dwcb: Longint;
  1304.     p: Pointer;
  1305.     dw: Longint
  1306.     ): Longint;
  1307. function RasSetSubEntryProperties(
  1308.     lpszPhoneBook,
  1309.     lpszEntry: PChar;
  1310.     dwSubEntry: Longint;
  1311.     var lpRasSubEntry: TRasSubEntry;
  1312.     dwcb: Longint;
  1313.     p: Pointer;
  1314.     dw: Longint
  1315.     ): Longint;
  1316.  
  1317. function RasGetAutodialAddressA(
  1318.     lpszAddress: PAnsiChar;
  1319.     lpdwReserved: Pointer;
  1320.     lpAutoDialEntries: LPRasAutoDialEntryA;
  1321.     var lpdwcbAutoDialEntries: Longint;
  1322.     var lpdwcAutoDialEntries: Longint
  1323.     ): Longint;
  1324. function RasGetAutodialAddressW(
  1325.     lpszAddress: PWideChar;
  1326.     lpdwReserved: Pointer;
  1327.     lpAutoDialEntries: LPRasAutoDialEntryW;
  1328.     var lpdwcbAutoDialEntries: Longint;
  1329.     var lpdwcAutoDialEntries: Longint
  1330.     ): Longint;
  1331. function RasGetAutodialAddress(
  1332.     lpszAddress: PChar;
  1333.     lpdwReserved: Pointer;
  1334.     lpAutoDialEntries: LPRasAutoDialEntry;
  1335.     var lpdwcbAutoDialEntries: Longint;
  1336.     var lpdwcAutoDialEntries: Longint
  1337.     ): Longint;
  1338.  
  1339. function RasSetAutodialAddressA(
  1340.     lpszAddress: PAnsiChar;
  1341.     dwReserved: Longint;
  1342.     lpAutoDialEntries: LPRasAutoDialEntryA;
  1343.     dwcbAutoDialEntries: Longint;
  1344.     dwcAutoDialEntries: Longint
  1345.     ): Longint;
  1346.  
  1347. function RasSetAutodialAddressW(
  1348.     lpszAddress: PWideChar;
  1349.     dwReserved: Longint;
  1350.     lpAutoDialEntries: LPRasAutoDialEntryW;
  1351.     dwcbAutoDialEntries: Longint;
  1352.     dwcAutoDialEntries: Longint
  1353.     ): Longint;
  1354. function RasSetAutodialAddress(
  1355.     lpszAddress: PChar;
  1356.     dwReserved: Longint;
  1357.     lpAutoDialEntries: LPRasAutoDialEntry;
  1358.     dwcbAutoDialEntries: Longint;
  1359.     dwcAutoDialEntries: Longint
  1360.     ): Longint;
  1361.  
  1362. function RasEnumAutodialAddressesA(
  1363.     lppAddresses: Pointer;
  1364.     var lpdwcbAddresses: Longint;
  1365.     var lpdwAddresses: Longint
  1366.     ): Longint;
  1367. function RasEnumAutodialAddressesW(
  1368.     lppAddresses: Pointer;
  1369.     var lpdwcbAddresses: Longint;
  1370.     var lpdwAddresses: Longint
  1371.     ): Longint;
  1372. function RasEnumAutodialAddresses(
  1373.     lppAddresses: Pointer;
  1374.     var lpdwcbAddresses: Longint;
  1375.     var lpdwAddresses: Longint
  1376.     ): Longint;
  1377.  
  1378. function RasGetAutodialEnableA(
  1379.     dwDialingLocation: Longint;
  1380.     var lpfEnabled: LongBool
  1381.     ): Longint;
  1382. function RasGetAutodialEnableW(
  1383.     dwDialingLocation: Longint;
  1384.     var lpfEnabled: LongBool
  1385.     ): Longint;
  1386. function RasGetAutodialEnable(
  1387.     dwDialingLocation: Longint;
  1388.     var lpfEnabled: LongBool
  1389.     ): Longint;
  1390.  
  1391. function RasSetAutodialEnableA(
  1392.     dwDialingLocation: Longint;
  1393.     fEnabled: LongBool
  1394.     ): Longint;
  1395. function RasSetAutodialEnableW(
  1396.     dwDialingLocation: Longint;
  1397.     fEnabled: LongBool
  1398.     ): Longint;
  1399. function RasSetAutodialEnable(
  1400.     dwDialingLocation: Longint;
  1401.     fEnabled: LongBool
  1402.     ): Longint;
  1403.  
  1404. function RasGetAutodialParamA(
  1405.     dwKey: Longint;
  1406.     lpvValue: Pointer;
  1407.     var lpdwcbValue: Longint
  1408.     ): Longint;
  1409. function RasGetAutodialParamW(
  1410.     dwKey: Longint;
  1411.     lpvValue: Pointer;
  1412.     var lpdwcbValue: Longint
  1413.     ): Longint;
  1414. function RasGetAutodialParam(
  1415.     dwKey: Longint;
  1416.     lpvValue: Pointer;
  1417.     var lpdwcbValue: Longint
  1418.     ): Longint;
  1419.  
  1420. function RasSetAutodialParamA(
  1421.     dwKey: Longint;
  1422.     lpvValue: Pointer;
  1423.     dwcbValue: Longint
  1424.     ): Longint;
  1425. function RasSetAutodialParamW(
  1426.     dwKey: Longint;
  1427.     lpvValue: Pointer;
  1428.     dwcbValue: Longint
  1429.     ): Longint;
  1430. function RasSetAutodialParam(
  1431.     dwKey: Longint;
  1432.     lpvValue: Pointer;
  1433.     dwcbValue: Longint
  1434.     ): Longint;
  1435.  
  1436. {$ELSE}
  1437. // This is a helper function to find if RNAPH.DLL is needed
  1438. function rnaph_needed: Boolean;   // returns True if RNAPH.DLL is needed
  1439. {$ENDIF}
  1440.  
  1441. {**
  1442. ** raserror.h
  1443. ** Remote Access external API
  1444. ** RAS specific error codes
  1445. *}
  1446.  
  1447. const
  1448.  
  1449.   RASBASE = 600;
  1450.   SUCCESS = 0;
  1451.  
  1452.   PENDING                              = (RASBASE+0);
  1453. {*
  1454.  * An operation is pending.%0
  1455.  *}
  1456.   ERROR_INVALID_PORT_HANDLE            = (RASBASE+1);
  1457. {*
  1458.  * The port handle is invalid.%0
  1459.  *}
  1460.   ERROR_PORT_ALREADY_OPEN              = (RASBASE+2);
  1461. {*
  1462.  * The port is already open.%0
  1463.  *}
  1464.   ERROR_BUFFER_TOO_SMALL               = (RASBASE+3);
  1465. {*
  1466.  * Caller's buffer is too small.%0
  1467.  *}
  1468.   ERROR_WRONG_INFO_SPECIFIED           = (RASBASE+4);
  1469. {*
  1470.  * Wrong information specified.%0
  1471.  *}
  1472.   ERROR_CANNOT_SET_PORT_INFO           = (RASBASE+5);
  1473. {*
  1474.  * Cannot set port information.%0
  1475.  *}
  1476.   ERROR_PORT_NOT_CONNECTED             = (RASBASE+6);
  1477. {*
  1478.  * The port is not connected.%0
  1479.  *}
  1480.   ERROR_EVENT_INVALID                  = (RASBASE+7);
  1481. {*
  1482.  * The event is invalid.%0
  1483.  *}
  1484.   ERROR_DEVICE_DOES_NOT_EXIST          = (RASBASE+8);
  1485. {*
  1486.  * The device does not exist.%0
  1487.  *}
  1488.   ERROR_DEVICETYPE_DOES_NOT_EXIST      = (RASBASE+9);
  1489. {*
  1490.  * The device type does not exist.%0
  1491.  *}
  1492.   ERROR_BUFFER_INVALID                 = (RASBASE+10);
  1493. {*
  1494.  * The buffer is invalid.%0
  1495.  *}
  1496.   ERROR_ROUTE_NOT_AVAILABLE            = (RASBASE+11);
  1497. {*
  1498.  * The route is not available.%0
  1499.  *}
  1500.   ERROR_ROUTE_NOT_ALLOCATED            = (RASBASE+12);
  1501. {*
  1502.  * The route is not allocated.%0
  1503.  *}
  1504.   ERROR_INVALID_COMPRESSION_SPECIFIED  = (RASBASE+13);
  1505. {*
  1506.  * Invalid compression specified.%0
  1507.  *}
  1508.   ERROR_OUT_OF_BUFFERS                 = (RASBASE+14);
  1509. {*
  1510.  * Out of buffers.%0
  1511.  *}
  1512.   ERROR_PORT_NOT_FOUND                 = (RASBASE+15);
  1513. {*
  1514.  * The port was not found.%0
  1515.  *}
  1516.   ERROR_ASYNC_REQUEST_PENDING          = (RASBASE+16);
  1517. {*
  1518.  * An asynchronous request is pending.%0
  1519.  *}
  1520.   ERROR_ALREADY_DISCONNECTING          = (RASBASE+17);
  1521. {*
  1522.  * The port or device is already disconnecting.%0
  1523.  *}
  1524.   ERROR_PORT_NOT_OPEN                  = (RASBASE+18);
  1525. {*
  1526.  * The port is not open.%0
  1527.  *}
  1528.   ERROR_PORT_DISCONNECTED              = (RASBASE+19);
  1529. {*
  1530.  * The port is disconnected.%0
  1531.  *}
  1532.   ERROR_NO_ENDPOINTS                   = (RASBASE+20);
  1533. {*
  1534.  * There are no endpoints.%0
  1535.  *}
  1536.   ERROR_CANNOT_OPEN_PHONEBOOK          = (RASBASE+21);
  1537. {*
  1538.  * Cannot open the phone book file.%0
  1539.  *}
  1540.   ERROR_CANNOT_LOAD_PHONEBOOK          = (RASBASE+22);
  1541. {*
  1542.  * Cannot load the phone book file.%0
  1543.  *}
  1544.   ERROR_CANNOT_FIND_PHONEBOOK_ENTRY    = (RASBASE+23);
  1545. {*
  1546.  * Cannot find the phone book entry.%0
  1547.  *}
  1548.   ERROR_CANNOT_WRITE_PHONEBOOK         = (RASBASE+24);
  1549. {*
  1550.  * Cannot write the phone book file.%0
  1551.  *}
  1552.   ERROR_CORRUPT_PHONEBOOK              = (RASBASE+25);
  1553. {*
  1554.  * Invalid information found in the phone book file.%0
  1555.  *}
  1556.   ERROR_CANNOT_LOAD_STRING             = (RASBASE+26);
  1557. {*
  1558.  * Cannot load a string.%0
  1559.  *}
  1560.   ERROR_KEY_NOT_FOUND                  = (RASBASE+27);
  1561. {*
  1562.  * Cannot find key.%0
  1563.  *}
  1564.   ERROR_DISCONNECTION                  = (RASBASE+28);
  1565. {*
  1566.  * The port was disconnected.%0
  1567.  *}
  1568.   ERROR_REMOTE_DISCONNECTION           = (RASBASE+29);
  1569. {*
  1570.  * The port was disconnected by the remote machine.%0
  1571.  *}
  1572.   ERROR_HARDWARE_FAILURE               = (RASBASE+30);
  1573. {*
  1574.  * The port was disconnected due to hardware failure.%0
  1575.  *}
  1576.   ERROR_USER_DISCONNECTION             = (RASBASE+31);
  1577. {*
  1578.  * The port was disconnected by the user.%0
  1579.  *}
  1580.   ERROR_INVALID_SIZE                   = (RASBASE+32);
  1581. {*
  1582.  * The structure size is incorrect.%0
  1583.  *}
  1584.   ERROR_PORT_NOT_AVAILABLE             = (RASBASE+33);
  1585. {*
  1586.  * The port is already in use or is not configured for Remote Access dial out.%0
  1587.  *}
  1588.   ERROR_CANNOT_PROJECT_CLIENT          = (RASBASE+34);
  1589. {*
  1590.  * Cannot register your computer on on the remote network.%0
  1591.  *}
  1592.   ERROR_UNKNOWN                        = (RASBASE+35);
  1593. {*
  1594.  * Unknown error.%0
  1595.  *}
  1596.   ERROR_WRONG_DEVICE_ATTACHED          = (RASBASE+36);
  1597. {*
  1598.  * The wrong device is attached to the port.%0
  1599.  *}
  1600.   ERROR_BAD_STRING                     = (RASBASE+37);
  1601. {*
  1602.  * The string could not be converted.%0
  1603.  *}
  1604.   ERROR_REQUEST_TIMEOUT                = (RASBASE+38);
  1605. {*
  1606.  * The request has timed out.%0
  1607.  *}
  1608.   ERROR_CANNOT_GET_LANA                = (RASBASE+39);
  1609. {*
  1610.  * No asynchronous net available.%0
  1611.  *}
  1612.   ERROR_NETBIOS_ERROR                  = (RASBASE+40);
  1613. {*
  1614.  * A NetBIOS error has occurred.%0
  1615.  *}
  1616.   ERROR_SERVER_OUT_OF_RESOURCES        = (RASBASE+41);
  1617. {*
  1618.  * The server cannot allocate NetBIOS resources needed to support the client.%0
  1619.  *}
  1620.   ERROR_NAME_EXISTS_ON_NET             = (RASBASE+42);
  1621. {*
  1622.  * One of your NetBIOS names is already registered on the remote network.%0
  1623.  *}
  1624.   ERROR_SERVER_GENERAL_NET_FAILURE     = (RASBASE+43);
  1625. {*
  1626.  * A network adapter at the server failed.%0
  1627.  *}
  1628.   WARNING_MSG_ALIAS_NOT_ADDED          = (RASBASE+44);
  1629. {*
  1630.  * You will not receive network message popups.%0
  1631.  *}
  1632.   ERROR_AUTH_INTERNAL                  = (RASBASE+45);
  1633. {*
  1634.  * Internal authentication error.%0
  1635.  *}
  1636.   ERROR_RESTRICTED_LOGON_HOURS         = (RASBASE+46);
  1637. {*
  1638.  * The account is not permitted to logon at this time of day.%0
  1639.  *}
  1640.   ERROR_ACCT_DISABLED                  = (RASBASE+47);
  1641. {*
  1642.  * The account is disabled.%0
  1643.  *}
  1644.   ERROR_PASSWD_EXPIRED                 = (RASBASE+48);
  1645. {*
  1646.  * The password has expired.%0
  1647.  *}
  1648.   ERROR_NO_DIALIN_PERMISSION           = (RASBASE+49);
  1649. {*
  1650.  * The account does not have Remote Access permission.%0
  1651.  *}
  1652.   ERROR_SERVER_NOT_RESPONDING          = (RASBASE+50);
  1653. {*
  1654.  * The Remote Access server is not responding.%0
  1655.  *}
  1656.   ERROR_FROM_DEVICE                    = (RASBASE+51);
  1657. {*
  1658.  * Your modem (or other connecting device) has reported an error.%0
  1659.  *}
  1660.   ERROR_UNRECOGNIZED_RESPONSE          = (RASBASE+52);
  1661. {*
  1662.  * Unrecognized response from the device.%0
  1663.  *}
  1664.   ERROR_MACRO_NOT_FOUND                = (RASBASE+53);
  1665. {*
  1666.  * A macro required by the device was not found in the device .INF file section.%0
  1667.  *}
  1668.   ERROR_MACRO_NOT_DEFINED              = (RASBASE+54);
  1669. {*
  1670.  * A command or response in the device .INF file section refers to an undefined macro.%0
  1671.  *}
  1672.   ERROR_MESSAGE_MACRO_NOT_FOUND        = (RASBASE+55);
  1673. {*
  1674.  * The <message> macro was not found in the device .INF file secion.%0
  1675.  *}
  1676.   ERROR_DEFAULTOFF_MACRO_NOT_FOUND     = (RASBASE+56);
  1677. {*
  1678.  * The <defaultoff> macro in the device .INF file section contains an undefined macro.%0
  1679.  *}
  1680.   ERROR_FILE_COULD_NOT_BE_OPENED       = (RASBASE+57);
  1681. {*
  1682.  * The device .INF file could not be opened.%0
  1683.  *}
  1684.   ERROR_DEVICENAME_TOO_LONG            = (RASBASE+58);
  1685. {*
  1686.  * The device name in the device .INF or media .INI file is too long.%0
  1687.  *}
  1688.   ERROR_DEVICENAME_NOT_FOUND           = (RASBASE+59);
  1689. {*
  1690.  * The media .INI file refers to an unknown device name.%0
  1691.  *}
  1692.   ERROR_NO_RESPONSES                   = (RASBASE+60);
  1693. {*
  1694.  * The device .INF file contains no responses for the command.%0
  1695.  *}
  1696.   ERROR_NO_COMMAND_FOUND               = (RASBASE+61);
  1697. {*
  1698.  * The device .INF file is missing a command.%0
  1699.  *}
  1700.   ERROR_WRONG_KEY_SPECIFIED            = (RASBASE+62);
  1701. {*
  1702.  * Attempted to set a macro not listed in device .INF file section.%0
  1703.  *}
  1704.   ERROR_UNKNOWN_DEVICE_TYPE            = (RASBASE+63);
  1705. {*
  1706.  * The media .INI file refers to an unknown device type.%0
  1707.  *}
  1708.   ERROR_ALLOCATING_MEMORY              = (RASBASE+64);
  1709. {*
  1710.  * Cannot allocate memory.%0
  1711.  *}
  1712.   ERROR_PORT_NOT_CONFIGURED            = (RASBASE+65);
  1713. {*
  1714.  * The port is not configured for Remote Access.%0
  1715.  *}
  1716.   ERROR_DEVICE_NOT_READY               = (RASBASE+66);
  1717. {*
  1718.  * Your modem (or other connecting device) is not functioning.%0
  1719.  *}
  1720.   ERROR_READING_INI_FILE               = (RASBASE+67);
  1721. {*
  1722.  * Cannot read the media .INI file.%0
  1723.  *}
  1724.   ERROR_NO_CONNECTION                  = (RASBASE+68);
  1725. {*
  1726.  * The connection dropped.%0
  1727.  *}
  1728.   ERROR_BAD_USAGE_IN_INI_FILE          = (RASBASE+69);
  1729. {*
  1730.  * The usage parameter in the media .INI file is invalid.%0
  1731.  *}
  1732.   ERROR_READING_SECTIONNAME            = (RASBASE+70);
  1733. {*
  1734.  * Cannot read the section name from the media .INI file.%0
  1735.  *}
  1736.   ERROR_READING_DEVICETYPE             = (RASBASE+71);
  1737. {*
  1738.  * Cannot read the device type from the media .INI file.%0
  1739.  *}
  1740.   ERROR_READING_DEVICENAME             = (RASBASE+72);
  1741. {*
  1742.  * Cannot read the device name from the media .INI file.%0
  1743.  *}
  1744.   ERROR_READING_USAGE                  = (RASBASE+73);
  1745. {*
  1746.  * Cannot read the usage from the media .INI file.%0
  1747.  *}
  1748.   ERROR_READING_MAXCONNECTBPS          = (RASBASE+74);
  1749. {*
  1750.  * Cannot read the maximum connection BPS rate from the media .INI file.%0
  1751.  *}
  1752.   ERROR_READING_MAXCARRIERBPS          = (RASBASE+75);
  1753. {*
  1754.  * Cannot read the maximum carrier BPS rate from the media .INI file.%0
  1755.  *}
  1756.   ERROR_LINE_BUSY                      = (RASBASE+76);
  1757. {*
  1758.  * The line is busy.%0
  1759.  *}
  1760.   ERROR_VOICE_ANSWER                   = (RASBASE+77);
  1761. {*
  1762.  * A person answered instead of a modem.%0
  1763.  *}
  1764.   ERROR_NO_ANSWER                      = (RASBASE+78);
  1765. {*
  1766.  * There is no answer.%0
  1767.  *}
  1768.   ERROR_NO_CARRIER                     = (RASBASE+79);
  1769. {*
  1770.  * Cannot detect carrier.%0
  1771.  *}
  1772.   ERROR_NO_DIALTONE                    = (RASBASE+80);
  1773. {*
  1774.  * There is no dial tone.%0
  1775.  *}
  1776.   ERROR_IN_COMMAND                     = (RASBASE+81);
  1777. {*
  1778.  * General error reported by device.%0
  1779.  *}
  1780.   ERROR_WRITING_SECTIONNAME            = (RASBASE+82);
  1781. {*
  1782.  * ERROR_WRITING_SECTIONNAME%0
  1783.  *}
  1784.   ERROR_WRITING_DEVICETYPE             = (RASBASE+83);
  1785. {*
  1786.  * ERROR_WRITING_DEVICETYPE%0
  1787.  *}
  1788.   ERROR_WRITING_DEVICENAME             = (RASBASE+84);
  1789. {*
  1790.  * ERROR_WRITING_DEVICENAME%0
  1791.  *}
  1792.   ERROR_WRITING_MAXCONNECTBPS          = (RASBASE+85);
  1793. {*
  1794.  * ERROR_WRITING_MAXCONNECTBPS%0
  1795.  *}
  1796.   ERROR_WRITING_MAXCARRIERBPS          = (RASBASE+86);
  1797. {*
  1798.  * ERROR_WRITING_MAXCARRIERBPS%0
  1799.  *}
  1800.   ERROR_WRITING_USAGE                  = (RASBASE+87);
  1801. {*
  1802.  * ERROR_WRITING_USAGE%0
  1803.  *}
  1804.   ERROR_WRITING_DEFAULTOFF             = (RASBASE+88);
  1805. {*
  1806.  * ERROR_WRITING_DEFAULTOFF%0
  1807.  *}
  1808.   ERROR_READING_DEFAULTOFF             = (RASBASE+89);
  1809. {*
  1810.  * ERROR_READING_DEFAULTOFF%0
  1811.  *}
  1812.   ERROR_EMPTY_INI_FILE                 = (RASBASE+90);
  1813. {*
  1814.  * ERROR_EMPTY_INI_FILE%0
  1815.  *}
  1816.   ERROR_AUTHENTICATION_FAILURE         = (RASBASE+91);
  1817. {*
  1818.  * Access denied because username and/or password is invalid on the domain.%0
  1819.  *}
  1820.   ERROR_PORT_OR_DEVICE                 = (RASBASE+92);
  1821. {*
  1822.  * Hardware failure in port or attached device.%0
  1823.  *}
  1824.   ERROR_NOT_BINARY_MACRO               = (RASBASE+93);
  1825. {*
  1826.  * ERROR_NOT_BINARY_MACRO%0
  1827.  *}
  1828.   ERROR_DCB_NOT_FOUND                  = (RASBASE+94);
  1829. {*
  1830.  * ERROR_DCB_NOT_FOUND%0
  1831.  *}
  1832.   ERROR_STATE_MACHINES_NOT_STARTED     = (RASBASE+95);
  1833. {*
  1834.  * ERROR_STATE_MACHINES_NOT_STARTED%0
  1835.  *}
  1836.   ERROR_STATE_MACHINES_ALREADY_STARTED = (RASBASE+96);
  1837. {*
  1838.  * ERROR_STATE_MACHINES_ALREADY_STARTED%0
  1839.  *}
  1840.   ERROR_PARTIAL_RESPONSE_LOOPING       = (RASBASE+97);
  1841. {*
  1842.  * ERROR_PARTIAL_RESPONSE_LOOPING%0
  1843.  *}
  1844.   ERROR_UNKNOWN_RESPONSE_KEY           = (RASBASE+98);
  1845. {*
  1846.  * A response keyname in the device .INF file is not in the expected format.%0
  1847.  *}
  1848.   ERROR_RECV_BUF_FULL                  = (RASBASE+99);
  1849. {*
  1850.  * The device response caused buffer overflow.%0
  1851.  *}
  1852.   ERROR_CMD_TOO_LONG                   = (RASBASE+100);
  1853. {*
  1854.  * The expanded command in the device .INF file is too long.%0
  1855.  *}
  1856.   ERROR_UNSUPPORTED_BPS                = (RASBASE+101);
  1857. {*
  1858.  * The device moved to a BPS rate not supported by the COM driver.%0
  1859.  *}
  1860.   ERROR_UNEXPECTED_RESPONSE            = (RASBASE+102);
  1861. {*
  1862.  * Device response received when none expected.%0
  1863.  *}
  1864.   ERROR_INTERACTIVE_MODE               = (RASBASE+103);
  1865. {*
  1866.  * ERROR_INTERACTIVE_MODE%0
  1867.  *}
  1868.   ERROR_BAD_CALLBACK_NUMBER            = (RASBASE+104);
  1869. {*
  1870.  * ERROR_BAD_CALLBACK_NUMBER
  1871.  *}
  1872.   ERROR_INVALID_AUTH_STATE             = (RASBASE+105);
  1873. {*
  1874.  * ERROR_INVALID_AUTH_STATE%0
  1875.  *}
  1876.   ERROR_WRITING_INITBPS                = (RASBASE+106);
  1877. {*
  1878.  * ERROR_WRITING_INITBPS%0
  1879.  *}
  1880.   ERROR_X25_DIAGNOSTIC                 = (RASBASE+107);
  1881. {*
  1882.  * X.25 diagnostic indication.%0
  1883.  *}
  1884.   ERROR_ACCT_EXPIRED                   = (RASBASE+108);
  1885. {*
  1886.  * The account has expired.%0
  1887.  *}
  1888.   ERROR_CHANGING_PASSWORD              = (RASBASE+109);
  1889. {*
  1890.  * Error changing password on domain.  The password may be too short or may match a previously used password.%0
  1891.  *}
  1892.   ERROR_OVERRUN                        = (RASBASE+110);
  1893. {*
  1894.  * Serial overrun errors were detected while communicating with your modem.%0
  1895.  *}
  1896.   ERROR_RASMAN_CANNOT_INITIALIZE         = (RASBASE+111);
  1897. {*
  1898.  * RasMan initialization failure.  Check the event log.%0
  1899.  *}
  1900.   ERROR_BIPLEX_PORT_NOT_AVAILABLE      = (RASBASE+112);
  1901. {*
  1902.  * Biplex port initializing.  Wait a few seconds and redial.%0
  1903.  *}
  1904.   ERROR_NO_ACTIVE_ISDN_LINES           = (RASBASE+113);
  1905. {*
  1906.  * No active ISDN lines are available.%0
  1907.  *}
  1908.   ERROR_NO_ISDN_CHANNELS_AVAILABLE     = (RASBASE+114);
  1909. {*
  1910.  * No ISDN channels are available to make the call.%0
  1911.  *}
  1912.   ERROR_TOO_MANY_LINE_ERRORS           = (RASBASE+115);
  1913. {*
  1914.  * Too many errors occured because of poor phone line quality.%0
  1915.  *}
  1916.   ERROR_IP_CONFIGURATION               = (RASBASE+116);
  1917. {*
  1918.  * The Remote Access IP configuration is unusable.%0
  1919.  *}
  1920.   ERROR_NO_IP_ADDRESSES                = (RASBASE+117);
  1921. {*
  1922.  * No IP addresses are available in the static pool of Remote Access IP addresses.%0
  1923.  *}
  1924.   ERROR_PPP_TIMEOUT                    = (RASBASE+118);
  1925. {*
  1926.  * Timed out waiting for a valid response from the remote PPP peer.%0
  1927.  *}
  1928.   ERROR_PPP_REMOTE_TERMINATED          = (RASBASE+119);
  1929. {*
  1930.  * PPP terminated by remote machine.%0
  1931.  *}
  1932.   ERROR_PPP_NO_PROTOCOLS_CONFIGURED    = (RASBASE+120);
  1933. {*
  1934.  * No PPP control protocols configured.%0
  1935.  *}
  1936.   ERROR_PPP_NO_RESPONSE                = (RASBASE+121);
  1937. {*
  1938.  * Remote PPP peer is not responding.%0
  1939.  *}
  1940.   ERROR_PPP_INVALID_PACKET             = (RASBASE+122);
  1941. {*
  1942.  * The PPP packet is invalid.%0
  1943.  *}
  1944.   ERROR_PHONE_NUMBER_TOO_LONG          = (RASBASE+123);
  1945. {*
  1946.  * The phone number including prefix and suffix is too long.%0
  1947.  *}
  1948.   ERROR_IPXCP_NO_DIALOUT_CONFIGURED    = (RASBASE+124);
  1949. {*
  1950.  * The IPX protocol cannot dial-out on the port because the machine is an IPX router.%0
  1951.  *}
  1952.   ERROR_IPXCP_NO_DIALIN_CONFIGURED     = (RASBASE+125);
  1953. {*
  1954.  * The IPX protocol cannot dial-in on the port because the IPX router is not installed.%0
  1955.  *}
  1956.   ERROR_IPXCP_DIALOUT_ALREADY_ACTIVE   = (RASBASE+126);
  1957. {*
  1958.  * The IPX protocol cannot be used for dial-out on more than one port at a time.%0
  1959.  *}
  1960.   ERROR_ACCESSING_TCPCFGDLL            = (RASBASE+127);
  1961. {*
  1962.  * Cannot access TCPCFG.DLL.%0
  1963.  *}
  1964.   ERROR_NO_IP_RAS_ADAPTER              = (RASBASE+128);
  1965. {*
  1966.  * Cannot find an IP adapter bound to Remote Access.%0
  1967.  *}
  1968.   ERROR_SLIP_REQUIRES_IP               = (RASBASE+129);
  1969. {*
  1970.  * SLIP cannot be used unless the IP protocol is installed.%0
  1971.  *}
  1972.   ERROR_PROJECTION_NOT_COMPLETE        = (RASBASE+130);
  1973. {*
  1974.  * Computer registration is not complete.%0
  1975.  *}
  1976.   ERROR_PROTOCOL_NOT_CONFIGURED        = (RASBASE+131);
  1977. {*
  1978.  * The protocol is not configured.%0
  1979.  *}
  1980.   ERROR_PPP_NOT_CONVERGING             = (RASBASE+132);
  1981. {*
  1982.  * The PPP negotiation is not converging.%0
  1983.  *}
  1984.   ERROR_PPP_CP_REJECTED                = (RASBASE+133);
  1985. {*
  1986.  * The PPP control protocol for this network protocol is not available on the server.%0
  1987.  *}
  1988.   ERROR_PPP_LCP_TERMINATED             = (RASBASE+134);
  1989. {*
  1990.  * The PPP link control protocol terminated.%0
  1991.  *}
  1992.   ERROR_PPP_REQUIRED_ADDRESS_REJECTED  = (RASBASE+135);
  1993. {*
  1994.  * The requested address was rejected by the server.%0
  1995.  *}
  1996.   ERROR_PPP_NCP_TERMINATED             = (RASBASE+136);
  1997. {*
  1998.  * The remote computer terminated the control protocol.%0
  1999.  *}
  2000.   ERROR_PPP_LOOPBACK_DETECTED          = (RASBASE+137);
  2001. {*
  2002.  * Loopback detected.%0
  2003.  *}
  2004.   ERROR_PPP_NO_ADDRESS_ASSIGNED        = (RASBASE+138);
  2005. {*
  2006.  * The server did not assign an address.%0
  2007.  *}
  2008.   ERROR_CANNOT_USE_LOGON_CREDENTIALS   = (RASBASE+139);
  2009. {*
  2010.  * The authentication protocol required by the remote server cannot use the Windows NT encrypted password.  Redial, entering the password explicitly.%0
  2011.  *}
  2012.   ERROR_TAPI_CONFIGURATION             = (RASBASE+140);
  2013. {*
  2014.  * Invalid TAPI configuration.%0
  2015.  *}
  2016.   ERROR_NO_LOCAL_ENCRYPTION            = (RASBASE+141);
  2017. {*
  2018.  * The local computer does not support encryption.%0
  2019.  *}
  2020.   ERROR_NO_REMOTE_ENCRYPTION           = (RASBASE+142);
  2021. {*
  2022.  * The remote server does not support encryption.%0
  2023.  *}
  2024.   ERROR_REMOTE_REQUIRES_ENCRYPTION     = (RASBASE+143);
  2025. {*
  2026.  * The remote server requires encryption.%0
  2027.  *}
  2028.   ERROR_IPXCP_NET_NUMBER_CONFLICT      = (RASBASE+144);
  2029. {*
  2030.  * Cannot use the IPX network number assigned by remote server.  Check the event log.%0
  2031.  *}
  2032.   ERROR_INVALID_SMM                    = (RASBASE+145);
  2033. {*
  2034.  * ERROR_INVALID_SMM%0
  2035.  *}
  2036.   ERROR_SMM_UNINITIALIZED              = (RASBASE+146);
  2037. {*
  2038.  * ERROR_SMM_UNINITIALIZED%0
  2039.  *}
  2040.   ERROR_NO_MAC_FOR_PORT                = (RASBASE+147);
  2041. {*
  2042.  * ERROR_NO_MAC_FOR_PORT%0
  2043.  *}
  2044.   ERROR_SMM_TIMEOUT                    = (RASBASE+148);
  2045. {*
  2046.  * ERROR_SMM_TIMEOUT%0
  2047.  *}
  2048.   ERROR_BAD_PHONE_NUMBER               = (RASBASE+149);
  2049. {*
  2050.  * ERROR_BAD_PHONE_NUMBER%0
  2051.  *}
  2052.   ERROR_WRONG_MODULE                   = (RASBASE+150);
  2053. {*
  2054.  * ERROR_WRONG_MODULE%0
  2055.  *}
  2056.   ERROR_INVALID_CALLBACK_NUMBER        = (RASBASE+151);
  2057. {*
  2058.  * Invalid callback number.  Only the characters 0 to 9, T, P, W, (, ), -, @, and space are allowed in the number.%0
  2059.  *}
  2060.   ERROR_SCRIPT_SYNTAX                  = (RASBASE+152);
  2061. {*
  2062.  * A syntax error was encountered while processing a script.%0
  2063.  *}
  2064.   RASBASEEND                           = (RASBASE+152);
  2065.  
  2066. implementation
  2067.  
  2068. var
  2069.   hRas: HModule;
  2070.  
  2071. _RasDialA: function(
  2072.     lpRasDialExt: LPRasDialExtensions;
  2073.     lpszPhoneBook: PAnsiChar;
  2074.     var params: TRasDialParamsA;
  2075.     dwNotifierType: Longword;
  2076.     lpNotifier: Pointer;
  2077.     var rasconn: THRasConn
  2078.     ): Longint; stdcall;
  2079. _RasDialW: function(
  2080.     lpRasDialExt: LPRasDialExtensions;
  2081.     lpszPhoneBook: PWideChar;
  2082.     var params: TRasDialParamsW;
  2083.     dwNotifierType: Longword;
  2084.     lpNotifier: Pointer;
  2085.     var rasconn: THRasConn
  2086.     ): Longint; stdcall;
  2087.  
  2088. _RasEnumConnectionsA: function(
  2089.     rasconnArray: LPRasConnA;
  2090.     var lpcb: Longint;
  2091.     var lpcConnections: Longint
  2092.     ): Longint; stdcall;
  2093. _RasEnumConnectionsW: function(
  2094.     rasconnArray: LPRasConnW;
  2095.     var lpcb: Longint;
  2096.     var lpcConnections: Longint
  2097.     ): Longint; stdcall;
  2098.  
  2099. _RasEnumEntriesA: function(
  2100.     reserved: PAnsiChar;
  2101.     lpszPhoneBook: PAnsiChar;
  2102.     entrynamesArray: LPRasEntryNameA;
  2103.     var lpcb: Longint;
  2104.     var lpcEntries: Longint
  2105.     ): Longint; stdcall;
  2106. _RasEnumEntriesW: function(
  2107.     reserved: PWideChar;
  2108.     lpszPhoneBook: PWideChar;
  2109.     entrynamesArray: LPRasEntryNameW;
  2110.     var lpcb: Longint;
  2111.     var lpcEntries: Longint
  2112.     ): Longint; stdcall;
  2113.  
  2114. _RasGetConnectStatusA: function(
  2115.     hConn: THRasConn;
  2116.     var lpStatus: TRasConnStatusA
  2117.     ): Longint; stdcall;
  2118. _RasGetConnectStatusW: function(
  2119.     hConn: THRasConn;
  2120.     var lpStatus: TRasConnStatusW
  2121.     ): Longint; stdcall;
  2122.  
  2123. _RasGetErrorStringA: function(
  2124.     errorValue: Integer;
  2125.     erroString: PAnsiChar;
  2126.     cBufSize: Longint
  2127.     ): Longint; stdcall;
  2128. _RasGetErrorStringW: function(
  2129.     errorValue: Integer;
  2130.     erroString: PWideChar;
  2131.     cBufSize: Longint
  2132.     ): Longint; stdcall;
  2133.  
  2134. _RasHangUpA: function(
  2135.     hConn: THRasConn
  2136.     ): Longint; stdcall;
  2137. _RasHangUpW: function(
  2138.     hConn: THRasConn
  2139.     ): Longint; stdcall;
  2140.  
  2141. _RasGetProjectionInfoA: function(
  2142.     hConn: THRasConn;
  2143.     rasproj: TRasProjection;
  2144.     lpProjection: Pointer;
  2145.     var lpcb: Longint
  2146.     ): Longint; stdcall;
  2147. _RasGetProjectionInfoW: function(
  2148.     hConn: THRasConn;
  2149.     rasproj: TRasProjection;
  2150.     lpProjection: Pointer;
  2151.     var lpcb: Longint
  2152.     ): Longint; stdcall;
  2153.  
  2154. _RasCreatePhonebookEntryA: function(
  2155.     hwndParentWindow: HWND;
  2156.     lpszPhoneBook: PAnsiChar
  2157.     ): Longint; stdcall;
  2158. _RasCreatePhonebookEntryW: function(
  2159.     hwndParentWindow: HWND;
  2160.     lpszPhoneBook: PWideChar
  2161.     ): Longint; stdcall;
  2162.  
  2163. _RasEditPhonebookEntryA: function(
  2164.     hwndParentWindow: HWND;
  2165.     lpszPhoneBook: PAnsiChar;
  2166.     lpszEntryName: PAnsiChar
  2167.     ): Longint; stdcall;
  2168. _RasEditPhonebookEntryW: function(
  2169.     hwndParentWindow: HWND;
  2170.     lpszPhoneBook: PWideChar;
  2171.     lpszEntryName: PWideChar
  2172.     ): Longint; stdcall;
  2173.  
  2174. _RasSetEntryDialParamsA: function(
  2175.     lpszPhoneBook: PAnsiChar;
  2176.     var lpDialParams: TRasDialParamsA;
  2177.     fRemovePassword: LongBool
  2178.     ): Longint; stdcall;
  2179. _RasSetEntryDialParamsW: function(
  2180.     lpszPhoneBook: PWideChar;
  2181.     var lpDialParams: TRasDialParamsW;
  2182.     fRemovePassword: LongBool
  2183.     ): Longint; stdcall;
  2184.  
  2185. _RasGetEntryDialParamsA: function(
  2186.     lpszPhoneBook: PAnsiChar;
  2187.     var lpDialParams: TRasDialParamsA;
  2188.     var lpfPassword: LongBool
  2189.     ): Longint; stdcall;
  2190. _RasGetEntryDialParamsW: function(
  2191.     lpszPhoneBook: PWideChar;
  2192.     var lpDialParams: TRasDialParamsW;
  2193.     var lpfPassword: LongBool
  2194.     ): Longint; stdcall;
  2195.  
  2196. _RasEnumDevicesA: function(
  2197.     lpBuff: LPRasDevInfoA;
  2198.     var lpcbSize: Longint;
  2199.     var lpcDevices: Longint
  2200.     ): Longint; stdcall;
  2201. _RasEnumDevicesW: function(
  2202.     lpBuff: LPRasDevInfoW;
  2203.     var lpcbSize: Longint;
  2204.     var lpcDevices: Longint
  2205.     ): Longint; stdcall;
  2206.  
  2207. _RasGetCountryInfoA: function(
  2208.     lpCtryInfo: LPRasCtryInfoA;
  2209.     var lpdwSize: Longint
  2210.     ): Longint; stdcall;
  2211. _RasGetCountryInfoW: function(
  2212.     lpCtryInfo: LPRasCtryInfoW;
  2213.     var lpdwSize: Longint
  2214.     ): Longint; stdcall;
  2215.  
  2216. _RasGetEntryPropertiesA: function(
  2217.     lpszPhonebook,
  2218.     szEntry: PAnsiChar;
  2219.     lpbEntry: Pointer;
  2220.     var lpdwEntrySize: Longint;
  2221.     lpbDeviceInfo: Pointer;
  2222.     var lpdwDeviceInfoSize: Longint
  2223.     ): Longint; stdcall;
  2224. _RasGetEntryPropertiesW: function(
  2225.     lpszPhonebook,
  2226.     szEntry: PWideChar;
  2227.     lpbEntry: Pointer;
  2228.     var lpdwEntrySize: Longint;
  2229.     lpbDeviceInfo: Pointer;
  2230.     var lpdwDeviceInfoSize: Longint
  2231.     ): Longint; stdcall;
  2232.  
  2233. _RasSetEntryPropertiesA: function(
  2234.     lpszPhonebook,
  2235.     szEntry: PAnsiChar;
  2236.     lpbEntry: Pointer;
  2237.     dwEntrySize: Longint;
  2238.     lpbDeviceInfo: Pointer;
  2239.     dwDeviceInfoSize: Longint
  2240.     ): Longint; stdcall;
  2241. _RasSetEntryPropertiesW: function(
  2242.     lpszPhonebook,
  2243.     szEntry: PWideChar;
  2244.     lpbEntry: Pointer;
  2245.     dwEntrySize: Longint;
  2246.     lpbDeviceInfo: Pointer;
  2247.     dwDeviceInfoSize: Longint
  2248.     ): Longint; stdcall;
  2249.  
  2250. _RasRenameEntryA: function(
  2251.     lpszPhonebook,
  2252.     szEntryOld,
  2253.     szEntryNew: PAnsiChar
  2254.     ): Longint; stdcall;
  2255. _RasRenameEntryW: function(
  2256.     lpszPhonebook,
  2257.     szEntryOld,
  2258.     szEntryNew: PWideChar
  2259.     ): Longint; stdcall;
  2260.  
  2261. _RasDeleteEntryA: function(
  2262.     lpszPhonebook,
  2263.     szEntry: PAnsiChar
  2264.     ): Longint; stdcall;
  2265. _RasDeleteEntryW: function(
  2266.     lpszPhonebook,
  2267.     szEntry: PWideChar
  2268.     ): Longint; stdcall;
  2269.  
  2270. _RasValidateEntryNameA: function(
  2271.     lpszPhonebook,
  2272.     szEntry: PAnsiChar
  2273.     ): Longint; stdcall;
  2274. _RasValidateEntryNameW: function(
  2275.     lpszPhonebook,
  2276.     szEntry: PWideChar
  2277.     ): Longint; stdcall;
  2278.  
  2279. {$IFDEF WINVER41}
  2280. _RasGetSubEntryHandleA: function(
  2281.     hrasconn: THRasConn;
  2282.     dwSubEntry: Longint;
  2283.     var lphrasconn: THRasConn
  2284.     ): Longint; stdcall;
  2285. _RasGetSubEntryHandleW: function(
  2286.     hrasconn: THRasConn;
  2287.     dwSubEntry: Longint;
  2288.     var lphrasconn: THRasConn
  2289.     ): Longint; stdcall;
  2290.  
  2291. _RasGetCredentialsA: function(
  2292.     lpszPhoneBook,
  2293.     lpszEntry: PAnsiChar;
  2294.     var lpCredentials: TRasCredentialsA
  2295.     ): Longint; stdcall;
  2296. _RasGetCredentialsW: function(
  2297.     lpszPhoneBook,
  2298.     lpszEntry: PWideChar;
  2299.     var lpCredentials: TRasCredentialsW
  2300.     ): Longint; stdcall;
  2301.  
  2302. _RasSetCredentialsA: function(
  2303.     lpszPhoneBook,
  2304.     lpszEntry: PAnsiChar;
  2305.     var lpCredentials: TRasCredentialsA;
  2306.     fRemovePassword: LongBool
  2307.     ): Longint; stdcall;
  2308. _RasSetCredentialsW: function(
  2309.     lpszPhoneBook,
  2310.     lpszEntry: PWideChar;
  2311.     var lpCredentials: TRasCredentialsW;
  2312.     fRemovePassword: LongBool
  2313.     ): Longint; stdcall;
  2314.  
  2315. _RasConnectionNotificationA: function(
  2316.   hrasconn: THRasConn;
  2317.   hEvent: THandle;
  2318.   dwFlags: Longint
  2319.   ): Longint; stdcall;
  2320. _RasConnectionNotificationW: function(
  2321.   hrasconn: THRasConn;
  2322.   hEvent: THandle;
  2323.   dwFlags: Longint
  2324.   ): Longint; stdcall;
  2325.  
  2326. _RasGetSubEntryPropertiesA: function(
  2327.     lpszPhoneBook,
  2328.     lpszEntry: PAnsiChar;
  2329.     dwSubEntry: Longint;
  2330.     var lpRasSubEntry: TRasSubEntryA;
  2331.     var lpdwcb: Longint;
  2332.     p: Pointer;
  2333.     var lpdw: Longint
  2334.     ): Longint; stdcall;
  2335. _RasGetSubEntryPropertiesW: function(
  2336.     lpszPhoneBook,
  2337.     lpszEntry: PWideChar;
  2338.     dwSubEntry: Longint;
  2339.     var lpRasSubEntry: TRasSubEntryW;
  2340.     var lpdwcb: Longint;
  2341.     p: Pointer;
  2342.     var lpdw: Longint
  2343.     ): Longint; stdcall;
  2344.  
  2345. _RasSetSubEntryPropertiesA: function(
  2346.     lpszPhoneBook,
  2347.     lpszEntry: PAnsiChar;
  2348.     dwSubEntry: Longint;
  2349.     var lpRasSubEntry: TRasSubEntryA;
  2350.     dwcb: Longint;
  2351.     p: Pointer;
  2352.     dw: Longint
  2353.     ): Longint; stdcall;
  2354. _RasSetSubEntryPropertiesW: function(
  2355.     lpszPhoneBook,
  2356.     lpszEntry: PWideChar;
  2357.     dwSubEntry: Longint;
  2358.     var lpRasSubEntry: TRasSubEntryW;
  2359.     dwcb: Longint;
  2360.     p: Pointer;
  2361.     dw: Longint
  2362.     ): Longint; stdcall;
  2363.  
  2364. _RasGetAutodialAddressA: function(
  2365.     lpszAddress: PAnsiChar;
  2366.     lpdwReserved: Pointer;
  2367.     lpAutoDialEntries: LPRasAutoDialEntryA;
  2368.     var lpdwcbAutoDialEntries: Longint;
  2369.     var lpdwcAutoDialEntries: Longint
  2370.     ): Longint; stdcall;
  2371. _RasGetAutodialAddressW: function(
  2372.     lpszAddress: PWideChar;
  2373.     lpdwReserved: Pointer;
  2374.     lpAutoDialEntries: LPRasAutoDialEntryW;
  2375.     var lpdwcbAutoDialEntries: Longint;
  2376.     var lpdwcAutoDialEntries: Longint
  2377.     ): Longint; stdcall;
  2378.  
  2379. _RasSetAutodialAddressA: function(
  2380.     lpszAddress: PAnsiChar;
  2381.     dwReserved: Longint;
  2382.     lpAutoDialEntries: LPRasAutoDialEntryA;
  2383.     dwcbAutoDialEntries: Longint;
  2384.     dwcAutoDialEntries: Longint
  2385.     ): Longint; stdcall;
  2386. _RasSetAutodialAddressW: function(
  2387.     lpszAddress: PWideChar;
  2388.     dwReserved: Longint;
  2389.     lpAutoDialEntries: LPRasAutoDialEntryW;
  2390.     dwcbAutoDialEntries: Longint;
  2391.     dwcAutoDialEntries: Longint
  2392.     ): Longint; stdcall;
  2393.  
  2394. _RasEnumAutodialAddressesA: function(
  2395.     lppAddresses: Pointer;
  2396.     var lpdwcbAddresses: Longint;
  2397.     var lpdwAddresses: Longint
  2398.     ): Longint; stdcall;
  2399. _RasEnumAutodialAddressesW: function(
  2400.     lppAddresses: Pointer;
  2401.     var lpdwcbAddresses: Longint;
  2402.     var lpdwAddresses: Longint
  2403.     ): Longint; stdcall;
  2404.  
  2405. _RasGetAutodialEnableA: function(
  2406.     dwDialingLocation: Longint;
  2407.     var lpfEnabled: LongBool
  2408.     ): Longint; stdcall;
  2409. _RasGetAutodialEnableW: function(
  2410.     dwDialingLocation: Longint;
  2411.     var lpfEnabled: LongBool
  2412.     ): Longint; stdcall;
  2413.  
  2414. _RasSetAutodialEnableA: function(
  2415.     dwDialingLocation: Longint;
  2416.     fEnabled: LongBool
  2417.     ): Longint; stdcall;
  2418. _RasSetAutodialEnableW: function(
  2419.     dwDialingLocation: Longint;
  2420.     fEnabled: LongBool
  2421.     ): Longint; stdcall;
  2422.  
  2423. _RasGetAutodialParamA: function(
  2424.     dwKey: Longint;
  2425.     lpvValue: Pointer;
  2426.     var lpdwcbValue: Longint
  2427.     ): Longint; stdcall;
  2428. _RasGetAutodialParamW: function(
  2429.     dwKey: Longint;
  2430.     lpvValue: Pointer;
  2431.     var lpdwcbValue: Longint
  2432.     ): Longint; stdcall;
  2433.  
  2434. _RasSetAutodialParamA: function(
  2435.     dwKey: Longint;
  2436.     lpvValue: Pointer;
  2437.     dwcbValue: Longint
  2438.     ): Longint; stdcall;
  2439. _RasSetAutodialParamW: function(
  2440.     dwKey: Longint;
  2441.     lpvValue: Pointer;
  2442.     dwcbValue: Longint
  2443.     ): Longint; stdcall;
  2444. {$ENDIF}
  2445.  
  2446. function RasDialA(
  2447.     lpRasDialExt: LPRasDialExtensions;
  2448.     lpszPhoneBook: PAnsiChar;
  2449.     var params: TRasDialParamsA;
  2450.     dwNotifierType: Longword;
  2451.     lpNotifier: Pointer;
  2452.     var rasconn: THRasConn
  2453.     ): Longint;
  2454. begin
  2455.   if bRasAvail and (@_RasDialA <> nil) then
  2456.     Result := _RasDialA(lpRasDialExt, lpszPhoneBook, params, dwNotifierType,
  2457.       lpNotifier, rasconn)
  2458.   else
  2459.     Result := -1;
  2460. end;
  2461.  
  2462. function RasDialW(
  2463.     lpRasDialExt: LPRasDialExtensions;
  2464.     lpszPhoneBook: PWideChar;
  2465.     var params: TRasDialParamsW;
  2466.     dwNotifierType: Longword;
  2467.     lpNotifier: Pointer;
  2468.     var rasconn: THRasConn
  2469.     ): Longint;
  2470. begin
  2471.   if bRasAvail and (@_RasDialW <> nil) then
  2472.     Result := _RasDialW(lpRasDialExt, lpszPhoneBook, params, dwNotifierType,
  2473.       lpNotifier, rasconn)
  2474.   else
  2475.     Result := -1;
  2476. end;
  2477.  
  2478. function RasDial(
  2479.     lpRasDialExt: LPRasDialExtensions;
  2480.     lpszPhoneBook: PChar;
  2481.     var params: TRasDialParams;
  2482.     dwNotifierType: Longword;
  2483.     lpNotifier: Pointer;
  2484.     var rasconn: THRasConn
  2485.     ): Longint;
  2486. begin
  2487.   if bRasAvail and (@_RasDialA <> nil) then
  2488.     Result := _RasDialA(lpRasDialExt, lpszPhoneBook, params, dwNotifierType,
  2489.       lpNotifier, rasconn)
  2490.   else
  2491.     Result := -1;
  2492. end;
  2493.  
  2494. function RasEnumConnectionsA(
  2495.     rasconnArray: LPRasConnA;
  2496.     var lpcb: Longint;
  2497.     var lpcConnections: Longint
  2498.     ): Longint;
  2499. begin
  2500.   if bRasAvail and (@_RasEnumConnectionsA <> nil) then
  2501.     Result := _RasEnumConnectionsA(rasconnArray, lpcb, lpcConnections)
  2502.   else
  2503.     Result := -1;
  2504. end;
  2505.  
  2506. function RasEnumConnectionsW(
  2507.     rasconnArray: LPRasConnW;
  2508.     var lpcb: Longint;
  2509.     var lpcConnections: Longint
  2510.     ): Longint;
  2511. begin
  2512.   if bRasAvail and (@_RasEnumConnectionsW <> nil) then
  2513.     Result := _RasEnumConnectionsW(rasconnArray, lpcb, lpcConnections)
  2514.   else
  2515.     Result := -1;
  2516. end;
  2517.  
  2518. function RasEnumConnections(
  2519.     rasconnArray: LPRasConn;
  2520.     var lpcb: Longint;
  2521.     var lpcConnections: Longint
  2522.     ): Longint;
  2523. begin
  2524.   if bRasAvail and (@_RasEnumConnectionsA <> nil) then
  2525.     Result := _RasEnumConnectionsA(LPRasConnA(rasconnArray), lpcb,
  2526.       lpcConnections)
  2527.   else
  2528.     Result := -1;
  2529. end;
  2530.  
  2531. function RasEnumEntriesA(
  2532.     reserved: PAnsiChar;
  2533.     lpszPhoneBook: PAnsiChar;
  2534.     entrynamesArray: LPRasEntryNameA;
  2535.     var lpcb: Longint;
  2536.     var lpcEntries: Longint
  2537.     ): Longint;
  2538. begin
  2539.   if bRasAvail and (@_RasEnumEntriesA <> nil) then
  2540.     Result := _RasEnumEntriesA(reserved, lpszPhoneBook, entrynamesArray,
  2541.       lpcb, lpcEntries)
  2542.   else
  2543.     Result := -1;
  2544. end;
  2545.  
  2546. function RasEnumEntriesW(
  2547.     reserved: PWideChar;
  2548.     lpszPhoneBook: PWideChar;
  2549.     entrynamesArray: LPRasEntryNameW;
  2550.     var lpcb: Longint;
  2551.     var lpcEntries: Longint
  2552.     ): Longint;
  2553. begin
  2554.   if bRasAvail and (@_RasEnumEntriesW <> nil) then
  2555.     Result := _RasEnumEntriesW(reserved, lpszPhoneBook, entrynamesArray,
  2556.       lpcb, lpcEntries)
  2557.   else
  2558.     Result := -1;
  2559. end;
  2560.  
  2561. function RasEnumEntries(
  2562.     reserved: PChar;
  2563.     lpszPhoneBook: PChar;
  2564.     entrynamesArray: LPRasEntryName;
  2565.     var lpcb: Longint;
  2566.     var lpcEntries: Longint
  2567.     ): Longint;
  2568. begin
  2569.   if bRasAvail and (@_RasEnumEntriesA <> nil) then
  2570.     Result := _RasEnumEntriesA(reserved, lpszPhoneBook,
  2571.       LPRasEntryNameA(entrynamesArray), lpcb, lpcEntries)
  2572.   else
  2573.     Result := -1;
  2574. end;
  2575.  
  2576. function RasGetConnectStatusA(
  2577.     hConn: THRasConn;
  2578.     var lpStatus: TRasConnStatusA
  2579.     ): Longint;
  2580. begin
  2581.   if bRasAvail and (@_RasGetConnectStatusA <> nil) then
  2582.     Result := _RasGetConnectStatusA(hConn, lpStatus)
  2583.   else
  2584.     Result := -1;
  2585. end;
  2586.  
  2587. function RasGetConnectStatusW(
  2588.     hConn: THRasConn;
  2589.     var lpStatus: TRasConnStatusW
  2590.     ): Longint;
  2591. begin
  2592.   if bRasAvail and (@_RasGetConnectStatusW <> nil) then
  2593.     Result := _RasGetConnectStatusW(hConn, lpStatus)
  2594.   else
  2595.     Result := -1;
  2596. end;
  2597.  
  2598. function RasGetConnectStatus(
  2599.     hConn: THRasConn;
  2600.     var lpStatus: TRasConnStatus
  2601.     ): Longint;
  2602. begin
  2603.   if bRasAvail and (@_RasGetConnectStatusA <> nil) then
  2604.     Result := _RasGetConnectStatusA(hConn, lpStatus)
  2605.   else
  2606.     Result := -1;
  2607. end;
  2608.  
  2609. function RasGetErrorStringA(
  2610.     errorValue: Integer;
  2611.     erroString: PAnsiChar;
  2612.     cBufSize: Longint
  2613.     ): Longint;
  2614. begin
  2615.   if bRasAvail and (@_RasGetErrorStringA <> nil) then
  2616.     Result := _RasGetErrorStringA(errorValue, erroString, cBufSize)
  2617.   else
  2618.     Result := -1;
  2619. end;
  2620.  
  2621. function RasGetErrorStringW(
  2622.     errorValue: Integer;
  2623.     erroString: PWideChar;
  2624.     cBufSize: Longint
  2625.     ): Longint;
  2626. begin
  2627.   if bRasAvail and (@_RasGetErrorStringW <> nil) then
  2628.     Result := _RasGetErrorStringW(errorValue, erroString, cBufSize)
  2629.   else
  2630.     Result := -1;
  2631. end;
  2632.  
  2633. function RasGetErrorString(
  2634.     errorValue: Integer;
  2635.     erroString: PChar;
  2636.     cBufSize: Longint
  2637.     ): Longint;
  2638. begin
  2639.   if bRasAvail and (@_RasGetErrorStringA <> nil) then
  2640.     Result := _RasGetErrorStringA(errorValue, erroString, cBufSize)
  2641.   else
  2642.     Result := -1;
  2643. end;
  2644.  
  2645. function RasHangUpA(
  2646.     hConn: THRasConn
  2647.     ): Longint;
  2648. begin
  2649.   if bRasAvail and (@_RasHangUpA <> nil) then
  2650.     Result := _RasHangUpA(hConn)
  2651.   else
  2652.     Result := -1;
  2653. end;
  2654.  
  2655. function RasHangUpW(
  2656.     hConn: THRasConn
  2657.     ): Longint;
  2658. begin
  2659.   if bRasAvail and (@_RasHangUpW <> nil) then
  2660.     Result := _RasHangUpW(hConn)
  2661.   else
  2662.     Result := -1;
  2663. end;
  2664.  
  2665. function RasHangUp(
  2666.     hConn: THRasConn
  2667.     ): Longint;
  2668. begin
  2669.   if bRasAvail and (@_RasHangUpA <> nil) then
  2670.     Result := _RasHangUpA(hConn)
  2671.   else
  2672.     Result := -1;
  2673. end;
  2674.  
  2675. function RasGetProjectionInfoA(
  2676.     hConn: THRasConn;
  2677.     rasproj: TRasProjection;
  2678.     lpProjection: Pointer;
  2679.     var lpcb: Longint
  2680.     ): Longint;
  2681. begin
  2682.   if bRasAvail and (@_RasGetProjectionInfoA <> nil) then
  2683.     Result := _RasGetProjectionInfoA(hConn, rasproj, lpProjection, lpcb)
  2684.   else
  2685.     Result := -1;
  2686. end;
  2687.  
  2688. function RasGetProjectionInfoW(
  2689.     hConn: THRasConn;
  2690.     rasproj: TRasProjection;
  2691.     lpProjection: Pointer;
  2692.     var lpcb: Longint
  2693.     ): Longint;
  2694. begin
  2695.   if bRasAvail and (@_RasGetProjectionInfoW <> nil) then
  2696.     Result := _RasGetProjectionInfoW(hConn, rasproj, lpProjection, lpcb)
  2697.   else
  2698.     Result := -1;
  2699. end;
  2700.  
  2701. function RasGetProjectionInfo(
  2702.     hConn: THRasConn;
  2703.     rasproj: TRasProjection;
  2704.     lpProjection: Pointer;
  2705.     var lpcb: Longint
  2706.     ): Longint;
  2707. begin
  2708.   if bRasAvail and (@_RasGetProjectionInfoA <> nil) then
  2709.     Result := _RasGetProjectionInfoA(hConn, rasproj, lpProjection, lpcb)
  2710.   else
  2711.     Result := -1;
  2712. end;
  2713.  
  2714. function RasCreatePhonebookEntryA(
  2715.     hwndParentWindow: HWND;
  2716.     lpszPhoneBook: PAnsiChar
  2717.     ): Longint;
  2718. begin
  2719.   if bRasAvail and (@_RasCreatePhonebookEntryA <> nil) then
  2720.     Result := _RasCreatePhonebookEntryA(hwndParentWindow, lpszPhoneBook)
  2721.   else
  2722.     Result := -1;
  2723. end;
  2724.  
  2725. function RasCreatePhonebookEntryW(
  2726.     hwndParentWindow: HWND;
  2727.     lpszPhoneBook: PWideChar
  2728.     ): Longint;
  2729. begin
  2730.   if bRasAvail and (@_RasCreatePhonebookEntryW <> nil) then
  2731.     Result := _RasCreatePhonebookEntryW(hwndParentWindow, lpszPhoneBook)
  2732.   else
  2733.     Result := -1;
  2734. end;
  2735.  
  2736. function RasCreatePhonebookEntry(
  2737.     hwndParentWindow: HWND;
  2738.     lpszPhoneBook: PChar
  2739.     ): Longint;
  2740. begin
  2741.   if bRasAvail and (@_RasCreatePhonebookEntryA <> nil) then
  2742.     Result := _RasCreatePhonebookEntryA(hwndParentWindow, lpszPhoneBook)
  2743.   else
  2744.     Result := -1;
  2745. end;
  2746.  
  2747. function RasEditPhonebookEntryA(
  2748.     hwndParentWindow: HWND;
  2749.     lpszPhoneBook: PAnsiChar;
  2750.     lpszEntryName: PAnsiChar
  2751.     ): Longint;
  2752. begin
  2753.   if bRasAvail and (@_RasEditPhonebookEntryA <> nil) then
  2754.     Result := _RasEditPhonebookEntryA(hwndParentWindow, lpszPhoneBook,
  2755.       lpszEntryName)
  2756.   else
  2757.     Result := -1;
  2758. end;
  2759.  
  2760. function RasEditPhonebookEntryW(
  2761.     hwndParentWindow: HWND;
  2762.     lpszPhoneBook: PWideChar;
  2763.     lpszEntryName: PWideChar
  2764.     ): Longint;
  2765. begin
  2766.   if bRasAvail and (@_RasEditPhonebookEntryW <> nil) then
  2767.     Result := _RasEditPhonebookEntryW(hwndParentWindow, lpszPhoneBook,
  2768.       lpszEntryName)
  2769.   else
  2770.     Result := -1;
  2771. end;
  2772.  
  2773. function RasEditPhonebookEntry(
  2774.     hwndParentWindow: HWND;
  2775.     lpszPhoneBook: PChar;
  2776.     lpszEntryName: PChar
  2777.     ): Longint;
  2778. begin
  2779.   if bRasAvail and (@_RasEditPhonebookEntryA <> nil) then
  2780.     Result := _RasEditPhonebookEntryA(hwndParentWindow, lpszPhoneBook,
  2781.       lpszEntryName)
  2782.   else
  2783.     Result := -1;
  2784. end;
  2785.  
  2786. function RasSetEntryDialParamsA(
  2787.     lpszPhoneBook: PAnsiChar;
  2788.     var lpDialParams: TRasDialParamsA;
  2789.     fRemovePassword: LongBool
  2790.     ): Longint;
  2791. begin
  2792.   if bRasAvail and (@_RasSetEntryDialParamsA <> nil) then
  2793.     Result := _RasSetEntryDialParamsA(lpszPhoneBook, lpDialParams,
  2794.       fRemovePassword)
  2795.   else
  2796.     Result := -1;
  2797. end;
  2798.  
  2799. function RasSetEntryDialParamsW(
  2800.     lpszPhoneBook: PWideChar;
  2801.     var lpDialParams: TRasDialParamsW;
  2802.     fRemovePassword: LongBool
  2803.     ): Longint;
  2804. begin
  2805.   if bRasAvail and (@_RasSetEntryDialParamsW <> nil) then
  2806.     Result := _RasSetEntryDialParamsW(lpszPhoneBook, lpDialParams,
  2807.       fRemovePassword)
  2808.   else
  2809.     Result := -1;
  2810. end;
  2811.  
  2812. function RasSetEntryDialParams(
  2813.     lpszPhoneBook: PChar;
  2814.     var lpDialParams: TRasDialParams;
  2815.     fRemovePassword: LongBool
  2816.     ): Longint;
  2817. begin
  2818.   if bRasAvail and (@_RasSetEntryDialParamsA <> nil) then
  2819.     Result := _RasSetEntryDialParamsA(lpszPhoneBook, lpDialParams,
  2820.       fRemovePassword)
  2821.   else
  2822.     Result := -1;
  2823. end;
  2824.  
  2825. function RasGetEntryDialParamsA(
  2826.     lpszPhoneBook: PAnsiChar;
  2827.     var lpDialParams: TRasDialParamsA;
  2828.     var lpfPassword: LongBool
  2829.     ): Longint;
  2830. begin
  2831.   if bRasAvail and (@_RasGetEntryDialParamsA <> nil) then
  2832.     Result := _RasGetEntryDialParamsA(lpszPhoneBook, lpDialParams,
  2833.       lpfPassword)
  2834.   else
  2835.     Result := -1;
  2836. end;
  2837.  
  2838. function RasGetEntryDialParamsW(
  2839.     lpszPhoneBook: PWideChar;
  2840.     var lpDialParams: TRasDialParamsW;
  2841.     var lpfPassword: LongBool
  2842.     ): Longint;
  2843. begin
  2844.   if bRasAvail and (@_RasGetEntryDialParamsW <> nil) then
  2845.     Result := _RasGetEntryDialParamsW(lpszPhoneBook, lpDialParams,
  2846.       lpfPassword)
  2847.   else
  2848.     Result := -1;
  2849. end;
  2850.  
  2851. function RasGetEntryDialParams(
  2852.     lpszPhoneBook: PChar;
  2853.     var lpDialParams: TRasDialParams;
  2854.     var lpfPassword: LongBool
  2855.     ): Longint;
  2856. begin
  2857.   if bRasAvail and (@_RasGetEntryDialParamsA <> nil) then
  2858.     Result := _RasGetEntryDialParamsA(lpszPhoneBook, lpDialParams,
  2859.       lpfPassword)
  2860.   else
  2861.     Result := -1;
  2862. end;
  2863.  
  2864. function RasEnumDevicesA(
  2865.     lpBuff: LPRasDevInfoA;
  2866.     var lpcbSize: Longint;
  2867.     var lpcDevices: Longint
  2868.     ): Longint;
  2869. begin
  2870.   if bRasAvail and (@_RasEnumDevicesA <> nil) then
  2871.     Result := _RasEnumDevicesA(lpBuff, lpcbSize, lpcDevices)
  2872.   else
  2873.     Result := -1;
  2874. end;
  2875.  
  2876. function RasEnumDevicesW(
  2877.     lpBuff: LPRasDevInfoW;
  2878.     var lpcbSize: Longint;
  2879.     var lpcDevices: Longint
  2880.     ): Longint;
  2881. begin
  2882.   if bRasAvail and (@_RasEnumDevicesW <> nil) then
  2883.     Result := _RasEnumDevicesW(lpBuff, lpcbSize, lpcDevices)
  2884.   else
  2885.     Result := -1;
  2886. end;
  2887.  
  2888. {$IFDEF WINVER41}
  2889. function RasEnumDevices(
  2890.     lpBuff: LPRasDevInfo;
  2891.     var lpcbSize: Longint;
  2892.     var lpcDevices: Longint
  2893.     ): Longint;
  2894. begin
  2895.   if bRasAvail and (@_RasEnumDevicesA <> nil) then
  2896.     Result := _RasEnumDevicesA(LPRasDevInfoA(lpBuff), lpcbSize, lpcDevices)
  2897.   else
  2898.     Result := -1;
  2899. end;
  2900. {$ENDIF}
  2901.  
  2902. function RasGetCountryInfoA(
  2903.     lpCtryInfo: LPRasCtryInfoA;
  2904.     var lpdwSize: Longint
  2905.     ): Longint;
  2906. begin
  2907.   if bRasAvail and (@_RasGetCountryInfoA <> nil) then
  2908.     Result := _RasGetCountryInfoA(lpCtryInfo, lpdwSize)
  2909.   else
  2910.     Result := -1;
  2911. end;
  2912.  
  2913. function RasGetCountryInfoW(
  2914.     lpCtryInfo: LPRasCtryInfoW;
  2915.     var lpdwSize: Longint
  2916.     ): Longint;
  2917. begin
  2918.   if bRasAvail and (@_RasGetCountryInfoW <> nil) then
  2919.     Result := _RasGetCountryInfoW(lpCtryInfo, lpdwSize)
  2920.   else
  2921.     Result := -1;
  2922. end;
  2923.  
  2924. {$IFDEF WINVER41}
  2925. function RasGetCountryInfo(
  2926.     lpCtryInfo: LPRasCtryInfo;
  2927.     var lpdwSize: Longint
  2928.     ): Longint;
  2929. begin
  2930.   if bRasAvail and (@_RasGetCountryInfoA <> nil) then
  2931.     Result := _RasGetCountryInfoA(LPRasCtryInfoA(lpCtryInfo), lpdwSize)
  2932.   else
  2933.     Result := -1;
  2934. end;
  2935. {$ENDIF}
  2936.  
  2937. function RasGetEntryPropertiesA(
  2938.     lpszPhonebook,
  2939.     szEntry: PAnsiChar;
  2940.     lpbEntry: Pointer;
  2941.     var lpdwEntrySize: Longint;
  2942.     lpbDeviceInfo: Pointer;
  2943.     var lpdwDeviceInfoSize: Longint
  2944.     ): Longint;
  2945. begin
  2946.   if bRasAvail and (@_RasGetEntryPropertiesA <> nil) then
  2947.     Result := _RasGetEntryPropertiesA(lpszPhonebook, szEntry, lpbEntry,
  2948.       lpdwEntrySize, lpbDeviceInfo, lpdwDeviceInfoSize)
  2949.   else
  2950.     Result := -1;
  2951. end;
  2952.  
  2953. function RasGetEntryPropertiesW(
  2954.     lpszPhonebook,
  2955.     szEntry: PWideChar;
  2956.     lpbEntry: Pointer;
  2957.     var lpdwEntrySize: Longint;
  2958.     lpbDeviceInfo: Pointer;
  2959.     var lpdwDeviceInfoSize: Longint
  2960.     ): Longint;
  2961. begin
  2962.   if bRasAvail and (@_RasGetEntryPropertiesW <> nil) then
  2963.     Result := _RasGetEntryPropertiesW(lpszPhonebook, szEntry, lpbEntry,
  2964.       lpdwEntrySize, lpbDeviceInfo, lpdwDeviceInfoSize)
  2965.   else
  2966.     Result := -1;
  2967. end;
  2968.  
  2969. {$IFDEF WINVER41}
  2970. function RasGetEntryProperties(
  2971.     lpszPhonebook,
  2972.     szEntry: PChar;
  2973.     lpbEntry: Pointer;
  2974.     var lpdwEntrySize: Longint;
  2975.     lpbDeviceInfo: Pointer;
  2976.     var lpdwDeviceInfoSize: Longint
  2977.     ): Longint;
  2978. begin
  2979.   if bRasAvail and (@_RasGetEntryPropertiesA <> nil) then
  2980.     Result := _RasGetEntryPropertiesA(lpszPhonebook, szEntry, lpbEntry,
  2981.       lpdwEntrySize, lpbDeviceInfo, lpdwDeviceInfoSize)
  2982.   else
  2983.     Result := -1;
  2984. end;
  2985. {$ENDIF}
  2986.  
  2987. function RasSetEntryPropertiesA(
  2988.     lpszPhonebook,
  2989.     szEntry: PAnsiChar;
  2990.     lpbEntry: Pointer;
  2991.     dwEntrySize: Longint;
  2992.     lpbDeviceInfo: Pointer;
  2993.     dwDeviceInfoSize: Longint
  2994.     ): Longint;
  2995. begin
  2996.   if bRasAvail and (@_RasSetEntryPropertiesA <> nil) then
  2997.     Result := _RasSetEntryPropertiesA(lpszPhonebook, szEntry, lpbEntry,
  2998.       dwEntrySize, lpbDeviceInfo, dwDeviceInfoSize)
  2999.   else
  3000.     Result := -1;
  3001. end;
  3002.  
  3003. function RasSetEntryPropertiesW(
  3004.     lpszPhonebook,
  3005.     szEntry: PWideChar;
  3006.     lpbEntry: Pointer;
  3007.     dwEntrySize: Longint;
  3008.     lpbDeviceInfo: Pointer;
  3009.     dwDeviceInfoSize: Longint
  3010.     ): Longint;
  3011. begin
  3012.   if bRasAvail and (@_RasSetEntryPropertiesW <> nil) then
  3013.     Result := _RasSetEntryPropertiesW(lpszPhonebook, szEntry, lpbEntry,
  3014.       dwEntrySize, lpbDeviceInfo, dwDeviceInfoSize)
  3015.   else
  3016.     Result := -1;
  3017. end;
  3018.  
  3019. {$IFDEF WINVER41}
  3020. function RasSetEntryProperties(
  3021.     lpszPhonebook,
  3022.     szEntry: PChar;
  3023.     lpbEntry: Pointer;
  3024.     dwEntrySize: Longint;
  3025.     lpbDeviceInfo: Pointer;
  3026.     dwDeviceInfoSize: Longint
  3027.     ): Longint;
  3028. begin
  3029.   if bRasAvail and (@_RasSetEntryPropertiesA <> nil) then
  3030.     Result := _RasSetEntryPropertiesA(lpszPhonebook, szEntry, lpbEntry,
  3031.       dwEntrySize, lpbDeviceInfo, dwDeviceInfoSize)
  3032.   else
  3033.     Result := -1;
  3034. end;
  3035. {$ENDIF}
  3036.  
  3037. function RasRenameEntryA(
  3038.     lpszPhonebook,
  3039.     szEntryOld,
  3040.     szEntryNew: PAnsiChar
  3041.     ): Longint;
  3042. begin
  3043.   if bRasAvail and (@_RasRenameEntryA <> nil) then
  3044.     Result := _RasRenameEntryA(lpszPhonebook, szEntryOld, szEntryNew)
  3045.   else
  3046.     Result := -1;
  3047. end;
  3048.  
  3049. function RasRenameEntryW(
  3050.     lpszPhonebook,
  3051.     szEntryOld,
  3052.     szEntryNew: PWideChar
  3053.     ): Longint;
  3054. begin
  3055.   if bRasAvail and (@_RasRenameEntryW <> nil) then
  3056.     Result := _RasRenameEntryW(lpszPhonebook, szEntryOld, szEntryNew)
  3057.   else
  3058.     Result := -1;
  3059. end;
  3060.  
  3061. {$IFDEF WINVER41}
  3062. function RasRenameEntry(
  3063.     lpszPhonebook,
  3064.     szEntryOld,
  3065.     szEntryNew: PChar
  3066.     ): Longint;
  3067. begin
  3068.   if bRasAvail and (@_RasRenameEntryA <> nil) then
  3069.     Result := _RasRenameEntryA(lpszPhonebook, szEntryOld, szEntryNew)
  3070.   else
  3071.     Result := -1;
  3072. end;
  3073. {$ENDIF}
  3074.  
  3075. function RasDeleteEntryA(
  3076.     lpszPhonebook,
  3077.     szEntry: PAnsiChar
  3078.     ): Longint;
  3079. begin
  3080.   if bRasAvail and (@_RasDeleteEntryA <> nil) then
  3081.     Result := _RasDeleteEntryA(lpszPhonebook, szEntry)
  3082.   else
  3083.     Result := -1;
  3084. end;
  3085.  
  3086. function RasDeleteEntryW(
  3087.     lpszPhonebook,
  3088.     szEntry: PWideChar
  3089.     ): Longint;
  3090. begin
  3091.   if bRasAvail and (@_RasDeleteEntryW <> nil) then
  3092.     Result := _RasDeleteEntryW(lpszPhonebook, szEntry)
  3093.   else
  3094.     Result := -1;
  3095. end;
  3096.  
  3097. {$IFDEF WINVER41}
  3098. function RasDeleteEntry(
  3099.     lpszPhonebook,
  3100.     szEntry: PChar
  3101.     ): Longint;
  3102. begin
  3103.   if bRasAvail and (@_RasDeleteEntryA <> nil) then
  3104.     Result := _RasDeleteEntryA(lpszPhonebook, szEntry)
  3105.   else
  3106.     Result := -1;
  3107. end;
  3108. {$ENDIF}
  3109.  
  3110. function RasValidateEntryNameA(
  3111.     lpszPhonebook,
  3112.     szEntry: PAnsiChar
  3113.     ): Longint;
  3114. begin
  3115.   if bRasAvail and (@_RasValidateEntryNameA <> nil) then
  3116.     Result := _RasValidateEntryNameA(lpszPhonebook, szEntry)
  3117.   else
  3118.     Result := -1;
  3119. end;
  3120.  
  3121. function RasValidateEntryNameW(
  3122.     lpszPhonebook,
  3123.     szEntry: PWideChar
  3124.     ): Longint;
  3125. begin
  3126.   if bRasAvail and (@_RasValidateEntryNameW <> nil) then
  3127.     Result := _RasValidateEntryNameW(lpszPhonebook, szEntry)
  3128.   else
  3129.     Result := -1;
  3130. end;
  3131.  
  3132. {$IFDEF WINVER41}
  3133. function RasValidateEntryName(
  3134.     lpszPhonebook,
  3135.     szEntry: PChar
  3136.     ): Longint;
  3137. begin
  3138.   if bRasAvail and (@_RasValidateEntryNameA <> nil) then
  3139.     Result := _RasValidateEntryNameA(lpszPhonebook, szEntry)
  3140.   else
  3141.     Result := -1;
  3142. end;
  3143.  
  3144. function RasGetSubEntryHandleA(
  3145.     hrasconn: THRasConn;
  3146.     dwSubEntry: Longint;
  3147.     var lphrasconn: THRasConn
  3148.     ): Longint;
  3149. begin
  3150.   if bRasAvail and (@_RasGetSubEntryHandleA <> nil) then
  3151.     Result := _RasGetSubEntryHandleA(hrasconn, dwSubEntry, lphrasconn)
  3152.   else
  3153.     Result := -1;
  3154. end;
  3155.  
  3156. function RasGetSubEntryHandleW(
  3157.     hrasconn: THRasConn;
  3158.     dwSubEntry: Longint;
  3159.     var lphrasconn: THRasConn
  3160.     ): Longint;
  3161. begin
  3162.   if bRasAvail and (@_RasGetSubEntryHandleW <> nil) then
  3163.     Result := _RasGetSubEntryHandleW(hrasconn, dwSubEntry, lphrasconn)
  3164.   else
  3165.     Result := -1;
  3166. end;
  3167.  
  3168. function RasGetSubEntryHandle(
  3169.     hrasconn: THRasConn;
  3170.     dwSubEntry: Longint;
  3171.     var lphrasconn: THRasConn
  3172.     ): Longint;
  3173. begin
  3174.   if bRasAvail and (@_RasGetSubEntryHandleA <> nil) then
  3175.     Result := _RasGetSubEntryHandleA(hrasconn, dwSubEntry, lphrasconn)
  3176.   else
  3177.     Result := -1;
  3178. end;
  3179.  
  3180. function RasGetCredentialsA(
  3181.     lpszPhoneBook,
  3182.     lpszEntry: PAnsiChar;
  3183.     var lpCredentials: TRasCredentialsA
  3184.     ): Longint;
  3185. begin
  3186.   if bRasAvail and (@_RasGetCredentialsA <> nil) then
  3187.     Result := _RasGetCredentialsA(lpszPhoneBook, lpszEntry, lpCredentials)
  3188.   else
  3189.     Result := -1;
  3190. end;
  3191.  
  3192. function RasGetCredentialsW(
  3193.     lpszPhoneBook,
  3194.     lpszEntry: PWideChar;
  3195.     var lpCredentials: TRasCredentialsW
  3196.     ): Longint;
  3197. begin
  3198.   if bRasAvail and (@_RasGetCredentialsW <> nil) then
  3199.     Result := _RasGetCredentialsW(lpszPhoneBook, lpszEntry, lpCredentials)
  3200.   else
  3201.     Result := -1;
  3202. end;
  3203.  
  3204. function RasGetCredentials(
  3205.     lpszPhoneBook,
  3206.     lpszEntry: PChar;
  3207.     var lpCredentials: TRasCredentials
  3208.     ): Longint;
  3209. begin
  3210.   if bRasAvail and (@_RasGetCredentialsA <> nil) then
  3211.     Result := _RasGetCredentialsA(lpszPhoneBook, lpszEntry, lpCredentials)
  3212.   else
  3213.     Result := -1;
  3214. end;
  3215.  
  3216. function RasSetCredentialsA(
  3217.     lpszPhoneBook,
  3218.     lpszEntry: PAnsiChar;
  3219.     var lpCredentials: TRasCredentialsA;
  3220.     fRemovePassword: LongBool
  3221.     ): Longint;
  3222. begin
  3223.   if bRasAvail and (@_RasSetCredentialsA <> nil) then
  3224.     Result := _RasSetCredentialsA(lpszPhoneBook, lpszEntry, lpCredentials,
  3225.       fRemovePassword)
  3226.   else
  3227.     Result := -1;
  3228. end;
  3229.  
  3230. function RasSetCredentialsW(
  3231.     lpszPhoneBook,
  3232.     lpszEntry: PWideChar;
  3233.     var lpCredentials: TRasCredentialsW;
  3234.     fRemovePassword: LongBool
  3235.     ): Longint;
  3236. begin
  3237.   if bRasAvail and (@_RasSetCredentialsW <> nil) then
  3238.     Result := _RasSetCredentialsW(lpszPhoneBook, lpszEntry, lpCredentials,
  3239.       fRemovePassword)
  3240.   else
  3241.     Result := -1;
  3242. end;
  3243.  
  3244. function RasSetCredentials(
  3245.     lpszPhoneBook,
  3246.     lpszEntry: PChar;
  3247.     var lpCredentials: TRasCredentials;
  3248.     fRemovePassword: LongBool
  3249.     ): Longint;
  3250. begin
  3251.   if bRasAvail and (@_RasSetCredentialsA <> nil) then
  3252.     Result := _RasSetCredentialsA(lpszPhoneBook, lpszEntry, lpCredentials,
  3253.       fRemovePassword)
  3254.   else
  3255.     Result := -1;
  3256. end;
  3257.  
  3258. function RasConnectionNotificationA(
  3259.   hrasconn: THRasConn;
  3260.   hEvent: THandle;
  3261.   dwFlags: Longint
  3262.   ): Longint;
  3263. begin
  3264.   if bRasAvail and (@_RasConnectionNotificationA <> nil) then
  3265.     Result := _RasConnectionNotificationA(hrasconn, hEvent, dwFlags)
  3266.   else
  3267.     Result := -1;
  3268. end;
  3269.  
  3270. function RasConnectionNotificationW(
  3271.   hrasconn: THRasConn;
  3272.   hEvent: THandle;
  3273.   dwFlags: Longint
  3274.   ): Longint;
  3275. begin
  3276.   if bRasAvail and (@_RasConnectionNotificationW <> nil) then
  3277.     Result := _RasConnectionNotificationW(hrasconn, hEvent, dwFlags)
  3278.   else
  3279.     Result := -1;
  3280. end;
  3281.  
  3282. function RasConnectionNotification(
  3283.   hrasconn: THRasConn;
  3284.   hEvent: THandle;
  3285.   dwFlags: Longint
  3286.   ): Longint;
  3287. begin
  3288.   if bRasAvail and (@_RasConnectionNotificationA <> nil) then
  3289.     Result := _RasConnectionNotificationA(hrasconn, hEvent, dwFlags)
  3290.   else
  3291.     Result := -1;
  3292. end;
  3293.  
  3294. function RasGetSubEntryPropertiesA(
  3295.     lpszPhoneBook,
  3296.     lpszEntry: PAnsiChar;
  3297.     dwSubEntry: Longint;
  3298.     var lpRasSubEntry: TRasSubEntryA;
  3299.     var lpdwcb: Longint;
  3300.     p: Pointer;
  3301.     var lpdw: Longint
  3302.     ): Longint;
  3303. begin
  3304.   if bRasAvail and (@_RasGetSubEntryPropertiesA <> nil) then
  3305.     Result := _RasGetSubEntryPropertiesA(lpszPhoneBook, lpszEntry,
  3306.       dwSubEntry, lpRasSubEntry, lpdwcb, p, lpdw)
  3307.   else
  3308.     Result := -1;
  3309. end;
  3310.  
  3311. function RasGetSubEntryPropertiesW(
  3312.     lpszPhoneBook,
  3313.     lpszEntry: PWideChar;
  3314.     dwSubEntry: Longint;
  3315.     var lpRasSubEntry: TRasSubEntryW;
  3316.     var lpdwcb: Longint;
  3317.     p: Pointer;
  3318.     var lpdw: Longint
  3319.     ): Longint;
  3320. begin
  3321.   if bRasAvail and (@_RasGetSubEntryPropertiesW <> nil) then
  3322.     Result := _RasGetSubEntryPropertiesW(lpszPhoneBook, lpszEntry,
  3323.       dwSubEntry, lpRasSubEntry, lpdwcb, p, lpdw)
  3324.   else
  3325.     Result := -1;
  3326. end;
  3327.  
  3328. function RasGetSubEntryProperties(
  3329.     lpszPhoneBook,
  3330.     lpszEntry: PChar;
  3331.     dwSubEntry: Longint;
  3332.     var lpRasSubEntry: TRasSubEntry;
  3333.     var lpdwcb: Longint;
  3334.     p: Pointer;
  3335.     var lpdw: Longint
  3336.     ): Longint;
  3337. begin
  3338.   if bRasAvail and (@_RasGetSubEntryPropertiesA <> nil) then
  3339.     Result := _RasGetSubEntryPropertiesA(lpszPhoneBook, lpszEntry,
  3340.       dwSubEntry, lpRasSubEntry, lpdwcb, p, lpdw)
  3341.   else
  3342.     Result := -1;
  3343. end;
  3344.  
  3345. function RasSetSubEntryPropertiesA(
  3346.     lpszPhoneBook,
  3347.     lpszEntry: PAnsiChar;
  3348.     dwSubEntry: Longint;
  3349.     var lpRasSubEntry: TRasSubEntryA;
  3350.     dwcb: Longint;
  3351.     p: Pointer;
  3352.     dw: Longint
  3353.     ): Longint;
  3354. begin
  3355.   if bRasAvail and (@_RasSetSubEntryPropertiesA <> nil) then
  3356.     Result := _RasSetSubEntryPropertiesA(lpszPhoneBook, lpszEntry,
  3357.       dwSubEntry, lpRasSubEntry, dwcb, p, dw)
  3358.   else
  3359.     Result := -1;
  3360. end;
  3361.  
  3362. function RasSetSubEntryPropertiesW(
  3363.     lpszPhoneBook,
  3364.     lpszEntry: PWideChar;
  3365.     dwSubEntry: Longint;
  3366.     var lpRasSubEntry: TRasSubEntryW;
  3367.     dwcb: Longint;
  3368.     p: Pointer;
  3369.     dw: Longint
  3370.     ): Longint;
  3371. begin
  3372.   if bRasAvail and (@_RasSetSubEntryPropertiesW <> nil) then
  3373.     Result := _RasSetSubEntryPropertiesW(lpszPhoneBook, lpszEntry,
  3374.       dwSubEntry, lpRasSubEntry, dwcb, p, dw)
  3375.   else
  3376.     Result := -1;
  3377. end;
  3378.  
  3379. function RasSetSubEntryProperties(
  3380.     lpszPhoneBook,
  3381.     lpszEntry: PChar;
  3382.     dwSubEntry: Longint;
  3383.     var lpRasSubEntry: TRasSubEntry;
  3384.     dwcb: Longint;
  3385.     p: Pointer;
  3386.     dw: Longint
  3387.     ): Longint;
  3388. begin
  3389.   if bRasAvail and (@_RasSetSubEntryPropertiesA <> nil) then
  3390.     Result := _RasSetSubEntryPropertiesA(lpszPhoneBook, lpszEntry,
  3391.       dwSubEntry, lpRasSubEntry, dwcb, p, dw)
  3392.   else
  3393.     Result := -1;
  3394. end;
  3395.  
  3396. function RasGetAutodialAddressA(
  3397.     lpszAddress: PAnsiChar;
  3398.     lpdwReserved: Pointer;
  3399.     lpAutoDialEntries: LPRasAutoDialEntryA;
  3400.     var lpdwcbAutoDialEntries: Longint;
  3401.     var lpdwcAutoDialEntries: Longint
  3402.     ): Longint;
  3403. begin
  3404.   if bRasAvail and (@_RasGetAutodialAddressA <> nil) then
  3405.     Result := _RasGetAutodialAddressA(lpszAddress, lpdwReserved,
  3406.       lpAutoDialEntries, lpdwcbAutoDialEntries, lpdwcAutoDialEntries)
  3407.   else
  3408.     Result := -1;
  3409. end;
  3410.  
  3411. function RasGetAutodialAddressW(
  3412.     lpszAddress: PWideChar;
  3413.     lpdwReserved: Pointer;
  3414.     lpAutoDialEntries: LPRasAutoDialEntryW;
  3415.     var lpdwcbAutoDialEntries: Longint;
  3416.     var lpdwcAutoDialEntries: Longint
  3417.     ): Longint;
  3418. begin
  3419.   if bRasAvail and (@_RasGetAutodialAddressW <> nil) then
  3420.     Result := _RasGetAutodialAddressW(lpszAddress, lpdwReserved,
  3421.       lpAutoDialEntries, lpdwcbAutoDialEntries, lpdwcAutoDialEntries)
  3422.   else
  3423.     Result := -1;
  3424. end;
  3425.  
  3426. function RasGetAutodialAddress(
  3427.     lpszAddress: PChar;
  3428.     lpdwReserved: Pointer;
  3429.     lpAutoDialEntries: LPRasAutoDialEntry;
  3430.     var lpdwcbAutoDialEntries: Longint;
  3431.     var lpdwcAutoDialEntries: Longint
  3432.     ): Longint;
  3433. begin
  3434.   if bRasAvail and (@_RasGetAutodialAddressA <> nil) then
  3435.     Result := _RasGetAutodialAddressA(lpszAddress, lpdwReserved,
  3436.       LPRasAutoDialEntryA(lpAutoDialEntries), lpdwcbAutoDialEntries, lpdwcAutoDialEntries)
  3437.   else
  3438.     Result := -1;
  3439. end;
  3440.  
  3441. function RasSetAutodialAddressA(
  3442.     lpszAddress: PAnsiChar;
  3443.     dwReserved: Longint;
  3444.     lpAutoDialEntries: LPRasAutoDialEntryA;
  3445.     dwcbAutoDialEntries: Longint;
  3446.     dwcAutoDialEntries: Longint
  3447.     ): Longint;
  3448. begin
  3449.   if bRasAvail and (@_RasSetAutodialAddressA <> nil) then
  3450.     Result := _RasSetAutodialAddressA(lpszAddress, dwReserved,
  3451.       lpAutoDialEntries, dwcbAutoDialEntries, dwcAutoDialEntries)
  3452.   else
  3453.     Result := -1;
  3454. end;
  3455.  
  3456. function RasSetAutodialAddressW(
  3457.     lpszAddress: PWideChar;
  3458.     dwReserved: Longint;
  3459.     lpAutoDialEntries: LPRasAutoDialEntryW;
  3460.     dwcbAutoDialEntries: Longint;
  3461.     dwcAutoDialEntries: Longint
  3462.     ): Longint;
  3463. begin
  3464.   if bRasAvail and (@_RasSetAutodialAddressW <> nil) then
  3465.     Result := _RasSetAutodialAddressW(lpszAddress, dwReserved,
  3466.       lpAutoDialEntries, dwcbAutoDialEntries, dwcAutoDialEntries)
  3467.   else
  3468.     Result := -1;
  3469. end;
  3470.  
  3471. function RasSetAutodialAddress(
  3472.     lpszAddress: PChar;
  3473.     dwReserved: Longint;
  3474.     lpAutoDialEntries: LPRasAutoDialEntry;
  3475.     dwcbAutoDialEntries: Longint;
  3476.     dwcAutoDialEntries: Longint
  3477.     ): Longint;
  3478. begin
  3479.   if bRasAvail and (@_RasSetAutodialAddressA <> nil) then
  3480.     Result := _RasSetAutodialAddressA(lpszAddress, dwReserved,
  3481.       LPRasAutoDialEntryA(lpAutoDialEntries), dwcbAutoDialEntries, dwcAutoDialEntries)
  3482.   else
  3483.     Result := -1;
  3484. end;
  3485.  
  3486. function RasEnumAutodialAddressesA(
  3487.     lppAddresses: Pointer;
  3488.     var lpdwcbAddresses: Longint;
  3489.     var lpdwAddresses: Longint
  3490.     ): Longint;
  3491. begin
  3492.   if bRasAvail and (@_RasEnumAutodialAddressesA <> nil) then
  3493.     Result := _RasEnumAutodialAddressesA(lppAddresses, lpdwcbAddresses,
  3494.       lpdwAddresses)
  3495.   else
  3496.     Result := -1;
  3497. end;
  3498.  
  3499. function RasEnumAutodialAddressesW(
  3500.     lppAddresses: Pointer;
  3501.     var lpdwcbAddresses: Longint;
  3502.     var lpdwAddresses: Longint
  3503.     ): Longint;
  3504. begin
  3505.   if bRasAvail and (@_RasEnumAutodialAddressesW <> nil) then
  3506.     Result := _RasEnumAutodialAddressesW(lppAddresses, lpdwcbAddresses,
  3507.       lpdwAddresses)
  3508.   else
  3509.     Result := -1;
  3510. end;
  3511.  
  3512. function RasEnumAutodialAddresses(
  3513.     lppAddresses: Pointer;
  3514.     var lpdwcbAddresses: Longint;
  3515.     var lpdwAddresses: Longint
  3516.     ): Longint;
  3517. begin
  3518.   if bRasAvail and (@_RasEnumAutodialAddressesA <> nil) then
  3519.     Result := _RasEnumAutodialAddressesA(lppAddresses, lpdwcbAddresses,
  3520.       lpdwAddresses)
  3521.   else
  3522.     Result := -1;
  3523. end;
  3524.  
  3525. function RasGetAutodialEnableA(
  3526.     dwDialingLocation: Longint;
  3527.     var lpfEnabled: LongBool
  3528.     ): Longint;
  3529. begin
  3530.   if bRasAvail and (@_RasGetAutodialEnableA <> nil) then
  3531.     Result := _RasGetAutodialEnableA(dwDialingLocation, lpfEnabled)
  3532.   else
  3533.     Result := -1;
  3534. end;
  3535.  
  3536. function RasGetAutodialEnableW(
  3537.     dwDialingLocation: Longint;
  3538.     var lpfEnabled: LongBool
  3539.     ): Longint;
  3540. begin
  3541.   if bRasAvail and (@_RasGetAutodialEnableW <> nil) then
  3542.     Result := _RasGetAutodialEnableW(dwDialingLocation, lpfEnabled)
  3543.   else
  3544.     Result := -1;
  3545. end;
  3546.  
  3547. function RasGetAutodialEnable(
  3548.     dwDialingLocation: Longint;
  3549.     var lpfEnabled: LongBool
  3550.     ): Longint;
  3551. begin
  3552.   if bRasAvail and (@_RasGetAutodialEnableA <> nil) then
  3553.     Result := _RasGetAutodialEnableA(dwDialingLocation, lpfEnabled)
  3554.   else
  3555.     Result := -1;
  3556. end;
  3557.  
  3558. function RasSetAutodialEnableA(
  3559.     dwDialingLocation: Longint;
  3560.     fEnabled: LongBool
  3561.     ): Longint;
  3562. begin
  3563.   if bRasAvail and (@_RasSetAutodialEnableA <> nil) then
  3564.     Result := _RasSetAutodialEnableA(dwDialingLocation, fEnabled)
  3565.   else
  3566.     Result := -1;
  3567. end;
  3568.  
  3569. function RasSetAutodialEnableW(
  3570.     dwDialingLocation: Longint;
  3571.     fEnabled: LongBool
  3572.     ): Longint;
  3573. begin
  3574.   if bRasAvail and (@_RasSetAutodialEnableW <> nil) then
  3575.     Result := _RasSetAutodialEnableW(dwDialingLocation, fEnabled)
  3576.   else
  3577.     Result := -1;
  3578. end;
  3579.  
  3580. function RasSetAutodialEnable(
  3581.     dwDialingLocation: Longint;
  3582.     fEnabled: LongBool
  3583.     ): Longint;
  3584. begin
  3585.   if bRasAvail and (@_RasSetAutodialEnableA <> nil) then
  3586.     Result := _RasSetAutodialEnableA(dwDialingLocation, fEnabled)
  3587.   else
  3588.     Result := -1;
  3589. end;
  3590.  
  3591. function RasGetAutodialParamA(
  3592.     dwKey: Longint;
  3593.     lpvValue: Pointer;
  3594.     var lpdwcbValue: Longint
  3595.     ): Longint;
  3596. begin
  3597.   if bRasAvail and (@_RasGetAutodialParamA <> nil) then
  3598.     Result := _RasGetAutodialParamA(dwKey, lpvValue, lpdwcbValue)
  3599.   else
  3600.     Result := -1;
  3601. end;
  3602.  
  3603. function RasGetAutodialParamW(
  3604.     dwKey: Longint;
  3605.     lpvValue: Pointer;
  3606.     var lpdwcbValue: Longint
  3607.     ): Longint;
  3608. begin
  3609.   if bRasAvail and (@_RasGetAutodialParamW <> nil) then
  3610.     Result := _RasGetAutodialParamW(dwKey, lpvValue, lpdwcbValue)
  3611.   else
  3612.     Result := -1;
  3613. end;
  3614.  
  3615. function RasGetAutodialParam(
  3616.     dwKey: Longint;
  3617.     lpvValue: Pointer;
  3618.     var lpdwcbValue: Longint
  3619.     ): Longint;
  3620. begin
  3621.   if bRasAvail and (@_RasGetAutodialParamA <> nil) then
  3622.     Result := _RasGetAutodialParamA(dwKey, lpvValue, lpdwcbValue)
  3623.   else
  3624.     Result := -1;
  3625. end;
  3626.  
  3627. function RasSetAutodialParamA(
  3628.     dwKey: Longint;
  3629.     lpvValue: Pointer;
  3630.     dwcbValue: Longint
  3631.     ): Longint;
  3632. begin
  3633.   if bRasAvail and (@_RasSetAutodialParamA <> nil) then
  3634.     Result := _RasSetAutodialParamA(dwKey, lpvValue, dwcbValue)
  3635.   else
  3636.     Result := -1;
  3637. end;
  3638.  
  3639. function RasSetAutodialParamW(
  3640.     dwKey: Longint;
  3641.     lpvValue: Pointer;
  3642.     dwcbValue: Longint
  3643.     ): Longint;
  3644. begin
  3645.   if bRasAvail and (@_RasSetAutodialParamW <> nil) then
  3646.     Result := _RasSetAutodialParamW(dwKey, lpvValue, dwcbValue)
  3647.   else
  3648.     Result := -1;
  3649. end;
  3650.  
  3651. function RasSetAutodialParam(
  3652.     dwKey: Longint;
  3653.     lpvValue: Pointer;
  3654.     dwcbValue: Longint
  3655.     ): Longint;
  3656. begin
  3657.   if bRasAvail and (@_RasSetAutodialParamA <> nil) then
  3658.     Result := _RasSetAutodialParamA(dwKey, lpvValue, dwcbValue)
  3659.   else
  3660.     Result := -1;
  3661. end;
  3662.  
  3663. {$ENDIF}
  3664. {*
  3665. ** but for now the functions without the type specifier must be implemented
  3666. ** as follows (at least until rnaph.dll disappears...
  3667. *}
  3668.  
  3669. {$IFNDEF WINVER41}
  3670. var
  3671.   rnaph_initialized: Boolean = False;
  3672.   is_rnaph: Boolean = False;
  3673.   lib: HModule;
  3674.  
  3675. function rnaph_(const func: String): Pointer;
  3676. var
  3677.   em: UInt;
  3678. begin
  3679.   if not rnaph_initialized then begin
  3680.     em := SetErrorMode(SEM_FAILCRITICALERRORS or SEM_NOOPENFILEERRORBOX);
  3681.     try
  3682.       try
  3683.     // Try first with RASAPI32.DLL
  3684.     lib := LoadLibrary('rasapi32.dll');
  3685.       except
  3686.         lib := 0;
  3687.       end;
  3688.     finally
  3689.       SetErrorMode(em);
  3690.     end;
  3691.     if lib <> 0 then begin
  3692.       Result := GetProcAddress(lib, PChar(func + 'A'));
  3693.       if Result <> nil then begin
  3694.         rnaph_initialized := True;
  3695.         Exit;
  3696.       end;
  3697.     end else
  3698.       raise Exception.Create('Error opening rasapi32.dll');
  3699.     // function not found - try rnaph.dll
  3700.     if lib <> 0 then FreeLibrary(lib);
  3701.     em := SetErrorMode(SEM_FAILCRITICALERRORS or SEM_NOOPENFILEERRORBOX);
  3702.     try
  3703.       try
  3704.     lib := LoadLibrary('rnaph.dll');
  3705.       except
  3706.         lib := 0;
  3707.       end;
  3708.     finally
  3709.       SetErrorMode(em);
  3710.     end;
  3711.     if lib <> 0 then begin
  3712.       Result := GetProcAddress(lib, PChar(func));
  3713.       if Result <> nil then begin
  3714.         rnaph_initialized := True;
  3715.         is_rnaph := True;
  3716.         Exit;
  3717.       end else
  3718.         raise Exception.Create('Function ' + func + ' not found!');
  3719.     end else
  3720.       raise Exception.Create('Error opening rnaph.dll');
  3721.   end else begin
  3722.     if is_rnaph then
  3723.       Result := GetProcAddress(lib, PChar(func))
  3724.     else
  3725.       Result := GetProcAddress(lib, PChar(func + 'A'));
  3726.     if Result = nil then
  3727.       raise Exception.Create('Function ' + func + ' not found!');
  3728.   end;
  3729. end;
  3730.  
  3731. function rnaph_needed: Boolean;
  3732. var
  3733.   sz: Longint;
  3734. begin
  3735.   // Dumb call... just to obtain rnaph status...
  3736.   RasGetCountryInfo(nil, sz);
  3737.   Result := is_rnaph;
  3738. end;
  3739.  
  3740. function RasConnectionNotification(hrasconn: THRasConn; hEvent: THandle; dwFlags: Longint): Longint;
  3741. var
  3742.   f: Function(hrasconn: THRasConn; hEvent: THandle; dwFlags: Longint): Longint; stdcall;
  3743. begin
  3744.   @f := rnaph_('RasConnectionNotification');
  3745.   Result := f(hrasconn, hevent, dwFlags);
  3746. end;
  3747.  
  3748. function RasValidateEntryName(lpszPhonebook, szEntry: PAnsiChar): Longint;
  3749. var
  3750.   f: Function(lpszPhonebook, szEntry: PAnsiChar): Longint; stdcall;
  3751. begin
  3752.   @f := rnaph_('RasValidateEntryName');
  3753.   Result := f(lpszPhonebook, szEntry);
  3754. end;
  3755.  
  3756. function RasRenameEntry(lpszPhonebook, szEntryOld, szEntryNew: PAnsiChar): Longint;
  3757. var
  3758.   f: function(lpszPhonebook, szEntryOld, szEntryNew: PAnsiChar): Longint; stdcall;
  3759. begin
  3760.   @f := rnaph_('RasRenameEntry');
  3761.   Result := f(lpszPhonebook, szEntryOld, szEntryNew);
  3762. end;
  3763.  
  3764. function RasDeleteEntry(lpszPhonebook, szEntry: PAnsiChar): Longint;
  3765. var
  3766.   f: function(lpszPhonebook, szEntry: PAnsiChar): Longint; stdcall;
  3767. begin
  3768.   @f := rnaph_('RasDeleteEntry');
  3769.   Result := f(lpszPhonebook, szEntry);
  3770. end;
  3771.  
  3772. function RasGetEntryProperties(lpszPhonebook, szEntry: PAnsiChar; lpbEntry: Pointer;
  3773.     var lpdwEntrySize: Longint; lpbDeviceInfo: Pointer;
  3774.     var lpdwDeviceInfoSize: Longint): Longint;
  3775. var
  3776.   f: function(lpszPhonebook, szEntry: PAnsiChar; lpbEntry: Pointer;
  3777.        var lpdwEntrySize: Longint; lpbDeviceInfo: Pointer;
  3778.        var lpdwDeviceInfoSize: Longint): Longint; stdcall;
  3779. begin
  3780.   @f := rnaph_('RasGetEntryProperties');
  3781.   Result := f(lpszPhonebook, szEntry, lpbEntry, lpdwEntrySize, lpbDeviceInfo, lpdwDeviceInfoSize);
  3782. end;
  3783.  
  3784. function RasSetEntryProperties(lpszPhonebook, szEntry: PAnsiChar;
  3785.   lpbEntry: Pointer; dwEntrySize: Longint; lpbDeviceInfo: Pointer;
  3786.   dwDeviceInfoSize: Longint): Longint;
  3787. var
  3788.   f: function(lpszPhonebook, szEntry: PAnsiChar;
  3789.        lpbEntry: Pointer; dwEntrySize: Longint; lpbDeviceInfo: Pointer;
  3790.        dwDeviceInfoSize: Longint): Longint; stdcall;
  3791. begin
  3792.   @f := rnaph_('RasSetEntryProperties');
  3793.   Result := f(lpszPhonebook, szEntry, lpbEntry, dwEntrySize, lpbDeviceInfo, dwDeviceInfoSize);
  3794. end;
  3795.  
  3796. function RasGetCountryInfo(lpCtryInfo: LPRasCtryInfo;
  3797.   var lpdwSize: Longint): Longint;
  3798. var
  3799.   f: function(lpCtryInfo: LPRasCtryInfo;
  3800.     var lpdwSize: Longint): Longint; stdcall;
  3801. begin
  3802.   @f := rnaph_('RasGetCountryInfo');
  3803.   Result := f(lpCtryInfo, lpdwSize);
  3804. end;
  3805.  
  3806. function RasEnumDevices(lpBuff: LpRasDevInfo; var lpcbSize: Longint;
  3807.   var lpcDevices: Longint): Longint;
  3808. var
  3809.   f: function(lpBuff: LpRasDevInfo; var lpcbSize: Longint;
  3810.        var lpcDevices: Longint): Longint; stdcall;
  3811. begin
  3812.   @f := rnaph_('RasEnumDevices');
  3813.   Result := f(lpBuff, lpcbSize, lpcDevices);
  3814. end;
  3815. {$ENDIF}
  3816.  
  3817. var
  3818.   em: UInt;
  3819.  
  3820. initialization
  3821.   // set global vars
  3822.   bRasAvail := False;    // True if RASAPI32 successfully linked
  3823.  
  3824.   em := SetErrorMode(SEM_FAILCRITICALERRORS or SEM_NOOPENFILEERRORBOX);
  3825.   try
  3826.     try
  3827.       hRas := LoadLibrary('rasapi32.dll');
  3828.     except
  3829.       hRas := 0;
  3830.     end;
  3831.   finally
  3832.     SetErrorMode(em);
  3833.   end;
  3834.   if hRas <> 0 then begin
  3835.     bRasAvail := True;
  3836.     _RasCreatePhonebookEntryA := GetProcAddress(hRas, 'RasCreatePhonebookEntryA');
  3837.     _RasCreatePhonebookEntryW := GetProcAddress(hRas, 'RasCreatePhonebookEntryW');
  3838.     _RasDialA                 := GetProcAddress(hRas, 'RasDialA');
  3839.     _RasDialW                 := GetProcAddress(hRas, 'RasDialW');
  3840.     _RasEditPhonebookEntryA   := GetProcAddress(hRas, 'RasEditPhonebookEntryA');
  3841.     _RasEditPhonebookEntryW   := GetProcAddress(hRas, 'RasEditPhonebookEntryW');
  3842.     _RasEnumConnectionsA      := GetProcAddress(hRas, 'RasEnumConnectionsA');
  3843.     _RasEnumConnectionsW      := GetProcAddress(hRas, 'RasEnumConnectionsW');
  3844.     _RasEnumEntriesA          := GetProcAddress(hRas, 'RasEnumEntriesA');
  3845.     _RasEnumEntriesW          := GetProcAddress(hRas, 'RasEnumEntriesW');
  3846.     _RasGetConnectStatusA     := GetProcAddress(hRas, 'RasGetConnectStatusA');
  3847.     _RasGetConnectStatusW     := GetProcAddress(hRas, 'RasGetConnectStatusW');
  3848.     _RasGetEntryDialParamsA   := GetProcAddress(hRas, 'RasGetEntryDialParamsA');
  3849.     _RasGetEntryDialParamsW   := GetProcAddress(hRas, 'RasGetEntryDialParamsW');
  3850.     _RasGetErrorStringA       := GetProcAddress(hRas, 'RasGetErrorStringA');
  3851.     _RasGetErrorStringW       := GetProcAddress(hRas, 'RasGetErrorStringW');
  3852.     _RasGetProjectionInfoA    := GetProcAddress(hRas, 'RasGetProjectionInfoA');
  3853.     _RasGetProjectionInfoW    := GetProcAddress(hRas, 'RasGetProjectionInfoW');
  3854.     _RasHangUpA               := GetProcAddress(hRas, 'RasHangUpA');
  3855.     _RasHangUpW               := GetProcAddress(hRas, 'RasHangUpW');
  3856.     _RasSetEntryDialParamsA   := GetProcAddress(hRas, 'RasSetEntryDialParamsA');
  3857.     _RasSetEntryDialParamsW   := GetProcAddress(hRas, 'RasSetEntryDialParamsW');
  3858.     _RasEnumDevicesA          := GetProcAddress(hRas, 'RasEnumDevicesA');
  3859.     _RasEnumDevicesW          := GetProcAddress(hRas, 'RasEnumDevicesW');
  3860.     _RasGetCountryInfoA       := GetProcAddress(hRas, 'RasGetCountryInfoA');
  3861.     _RasGetCountryInfoW       := GetProcAddress(hRas, 'RasGetCountryInfoW');
  3862.     _RasGetEntryPropertiesA   := GetProcAddress(hRas, 'RasGetEntryPropertiesA');
  3863.     _RasGetEntryPropertiesW   := GetProcAddress(hRas, 'RasGetEntryPropertiesW');
  3864.     _RasSetEntryPropertiesA   := GetProcAddress(hRas, 'RasSetEntryPropertiesA');
  3865.     _RasSetEntryPropertiesW   := GetProcAddress(hRas, 'RasSetEntryPropertiesW');
  3866.     _RasRenameEntryA          := GetProcAddress(hRas, 'RasRenameEntryA');
  3867.     _RasRenameEntryW          := GetProcAddress(hRas, 'RasRenameEntryW');
  3868.     _RasDeleteEntryA          := GetProcAddress(hRas, 'RasDeleteEntryA');
  3869.     _RasDeleteEntryW          := GetProcAddress(hRas, 'RasDeleteEntryW');
  3870.     _RasValidateEntryNameA    := GetProcAddress(hRas, 'RasValidateEntryNameA');
  3871.     _RasValidateEntryNameW    := GetProcAddress(hRas, 'RasValidateEntryNameW');
  3872. {$IFDEF WINVER41}
  3873.     _RasGetSubEntryHandleA    := GetProcAddress(hRas, 'RasGetSubEntryHandleA');
  3874.     _RasGetSubEntryHandleW    := GetProcAddress(hRas, 'RasGetSubEntryHandleW');
  3875.     _RasGetCredentialsA       := GetProcAddress(hRas, 'RasGetCredentialsA');
  3876.     _RasGetCredentialsW       := GetProcAddress(hRas, 'RasGetCredentialsW');
  3877.     _RasSetCredentialsA       := GetProcAddress(hRas, 'RasSetCredentialsA');
  3878.     _RasSetCredentialsW       := GetProcAddress(hRas, 'RasSetCredentialsW');
  3879.     _RasConnectionNotificationA := GetProcAddress(hRas, 'RasConnectionNotificationA');
  3880.     _RasConnectionNotificationW := GetProcAddress(hRas, 'RasConnectionNotificationW');
  3881.     _RasGetSubEntryPropertiesA  := GetProcAddress(hRas, 'RasGetSubEntryPropertiesA');
  3882.     _RasGetSubEntryPropertiesW  := GetProcAddress(hRas, 'RasGetSubEntryPropertiesW');
  3883.     _RasSetSubEntryPropertiesA  := GetProcAddress(hRas, 'RasSetSubEntryPropertiesA');
  3884.     _RasSetSubEntryPropertiesW  := GetProcAddress(hRas, 'RasSetSubEntryPropertiesW');
  3885.     _RasGetAutodialAddressA     := GetProcAddress(hRas, 'RasGetAutodialAddressA');
  3886.     _RasGetAutodialAddressW     := GetProcAddress(hRas, 'RasGetAutodialAddressW');
  3887.     _RasSetAutodialAddressA     := GetProcAddress(hRas, 'RasSetAutodialAddressA');
  3888.     _RasSetAutodialAddressW     := GetProcAddress(hRas, 'RasSetAutodialAddressW');
  3889.     _RasEnumAutodialAddressesA  := GetProcAddress(hRas, 'RasEnumAutodialAddressesA');
  3890.     _RasEnumAutodialAddressesW  := GetProcAddress(hRas, 'RasEnumAutodialAddressesW');
  3891.     _RasGetAutodialEnableA      := GetProcAddress(hRas, 'RasGetAutodialEnableA');
  3892.     _RasGetAutodialEnableW      := GetProcAddress(hRas, 'RasGetAutodialEnableW');
  3893.     _RasSetAutodialEnableA      := GetProcAddress(hRas, 'RasSetAutodialEnableA');
  3894.     _RasSetAutodialEnableW      := GetProcAddress(hRas, 'RasSetAutodialEnableW');
  3895.     _RasGetAutodialParamA       := GetProcAddress(hRas, 'RasGetAutodialParamA');
  3896.     _RasGetAutodialParamW       := GetProcAddress(hRas, 'RasGetAutodialParamW');
  3897.     _RasSetAutodialParamA       := GetProcAddress(hRas, 'RasSetAutodialParamA');
  3898.     _RasSetAutodialParamW       := GetProcAddress(hRas, 'RasSetAutodialParamW');
  3899. {$ENDIF}
  3900.   end;
  3901.  
  3902. finalization
  3903.   if bRasAvail then FreeLibrary(hRas);
  3904. {$IFNDEF WINVER41}
  3905.   if rnaph_initialized then FreeLibrary(lib);
  3906. {$ENDIF}
  3907.  
  3908. end.
  3909.