Mega Code Archive
Ras şifrelerini almak
{* Copyright (c) 1992-1996, Microsoft Corporation, all rights reserved
**
** ras.h
** Remote Access external API
** Public header for external API clients
**
*}
{ Delphi conversion by Davide Moretti macro was not found in the device .INF file secion.%0
*}
ERROR_DEFAULTOFF_MACRO_NOT_FOUND = (RASBASE+56);
{*
* The macro in the device .INF file section contains an undefined macro.%0
*}
ERROR_FILE_COULD_NOT_BE_OPENED = (RASBASE+57);
{*
* The device .INF file could not be opened.%0
*}
ERROR_DEVICENAME_TOO_LONG = (RASBASE+58);
{*
* The device name in the device .INF or media .INI file is too long.%0
*}
ERROR_DEVICENAME_NOT_FOUND = (RASBASE+59);
{*
* The media .INI file refers to an unknown device name.%0
*}
ERROR_NO_RESPONSES = (RASBASE+60);
{*
* The device .INF file contains no responses for the command.%0
*}
ERROR_NO_COMMAND_FOUND = (RASBASE+61);
{*
* The device .INF file is missing a command.%0
*}
ERROR_WRONG_KEY_SPECIFIED = (RASBASE+62);
{*
* Attempted to set a macro not listed in device .INF file section.%0
*}
ERROR_UNKNOWN_DEVICE_TYPE = (RASBASE+63);
{*
* The media .INI file refers to an unknown device type.%0
*}
ERROR_ALLOCATING_MEMORY = (RASBASE+64);
{*
* Cannot allocate memory.%0
*}
ERROR_PORT_NOT_CONFIGURED = (RASBASE+65);
{*
* The port is not configured for Remote Access.%0
*}
ERROR_DEVICE_NOT_READY = (RASBASE+66);
{*
* Your modem (or other connecting device) is not functioning.%0
*}
ERROR_READING_INI_FILE = (RASBASE+67);
{*
* Cannot read the media .INI file.%0
*}
ERROR_NO_CONNECTION = (RASBASE+68);
{*
* The connection dropped.%0
*}
ERROR_BAD_USAGE_IN_INI_FILE = (RASBASE+69);
{*
* The usage parameter in the media .INI file is invalid.%0
*}
ERROR_READING_SECTIONNAME = (RASBASE+70);
{*
* Cannot read the section name from the media .INI file.%0
*}
ERROR_READING_DEVICETYPE = (RASBASE+71);
{*
* Cannot read the device type from the media .INI file.%0
*}
ERROR_READING_DEVICENAME = (RASBASE+72);
{*
* Cannot read the device name from the media .INI file.%0
*}
ERROR_READING_USAGE = (RASBASE+73);
{*
* Cannot read the usage from the media .INI file.%0
*}
ERROR_READING_MAXCONNECTBPS = (RASBASE+74);
{*
* Cannot read the maximum connection BPS rate from the media .INI file.%0
*}
ERROR_READING_MAXCARRIERBPS = (RASBASE+75);
{*
* Cannot read the maximum carrier BPS rate from the media .INI file.%0
*}
ERROR_LINE_BUSY = (RASBASE+76);
{*
* The line is busy.%0
*}
ERROR_VOICE_ANSWER = (RASBASE+77);
{*
* A person answered instead of a modem.%0
*}
ERROR_NO_ANSWER = (RASBASE+78);
{*
* There is no answer.%0
*}
ERROR_NO_CARRIER = (RASBASE+79);
{*
* Cannot detect carrier.%0
*}
ERROR_NO_DIALTONE = (RASBASE+80);
{*
* There is no dial tone.%0
*}
ERROR_IN_COMMAND = (RASBASE+81);
{*
* General error reported by device.%0
*}
ERROR_WRITING_SECTIONNAME = (RASBASE+82);
{*
* ERROR_WRITING_SECTIONNAME%0
*}
ERROR_WRITING_DEVICETYPE = (RASBASE+83);
{*
* ERROR_WRITING_DEVICETYPE%0
*}
ERROR_WRITING_DEVICENAME = (RASBASE+84);
{*
* ERROR_WRITING_DEVICENAME%0
*}
ERROR_WRITING_MAXCONNECTBPS = (RASBASE+85);
{*
* ERROR_WRITING_MAXCONNECTBPS%0
*}
ERROR_WRITING_MAXCARRIERBPS = (RASBASE+86);
{*
* ERROR_WRITING_MAXCARRIERBPS%0
*}
ERROR_WRITING_USAGE = (RASBASE+87);
{*
* ERROR_WRITING_USAGE%0
*}
ERROR_WRITING_DEFAULTOFF = (RASBASE+88);
{*
* ERROR_WRITING_DEFAULTOFF%0
*}
ERROR_READING_DEFAULTOFF = (RASBASE+89);
{*
* ERROR_READING_DEFAULTOFF%0
*}
ERROR_EMPTY_INI_FILE = (RASBASE+90);
{*
* ERROR_EMPTY_INI_FILE%0
*}
ERROR_AUTHENTICATION_FAILURE = (RASBASE+91);
{*
* Access denied because username and/or password is invalid on the domain.%0
*}
ERROR_PORT_OR_DEVICE = (RASBASE+92);
{*
* Hardware failure in port or attached device.%0
*}
ERROR_NOT_BINARY_MACRO = (RASBASE+93);
{*
* ERROR_NOT_BINARY_MACRO%0
*}
ERROR_DCB_NOT_FOUND = (RASBASE+94);
{*
* ERROR_DCB_NOT_FOUND%0
*}
ERROR_STATE_MACHINES_NOT_STARTED = (RASBASE+95);
{*
* ERROR_STATE_MACHINES_NOT_STARTED%0
*}
ERROR_STATE_MACHINES_ALREADY_STARTED = (RASBASE+96);
{*
* ERROR_STATE_MACHINES_ALREADY_STARTED%0
*}
ERROR_PARTIAL_RESPONSE_LOOPING = (RASBASE+97);
{*
* ERROR_PARTIAL_RESPONSE_LOOPING%0
*}
ERROR_UNKNOWN_RESPONSE_KEY = (RASBASE+98);
{*
* A response keyname in the device .INF file is not in the expected format.%0
*}
ERROR_RECV_BUF_FULL = (RASBASE+99);
{*
* The device response caused buffer overflow.%0
*}
ERROR_CMD_TOO_LONG = (RASBASE+100);
{*
* The expanded command in the device .INF file is too long.%0
*}
ERROR_UNSUPPORTED_BPS = (RASBASE+101);
{*
* The device moved to a BPS rate not supported by the COM driver.%0
*}
ERROR_UNEXPECTED_RESPONSE = (RASBASE+102);
{*
* Device response received when none expected.%0
*}
ERROR_INTERACTIVE_MODE = (RASBASE+103);
{*
* ERROR_INTERACTIVE_MODE%0
*}
ERROR_BAD_CALLBACK_NUMBER = (RASBASE+104);
{*
* ERROR_BAD_CALLBACK_NUMBER
*}
ERROR_INVALID_AUTH_STATE = (RASBASE+105);
{*
* ERROR_INVALID_AUTH_STATE%0
*}
ERROR_WRITING_INITBPS = (RASBASE+106);
{*
* ERROR_WRITING_INITBPS%0
*}
ERROR_X25_DIAGNOSTIC = (RASBASE+107);
{*
* X.25 diagnostic indication.%0
*}
ERROR_ACCT_EXPIRED = (RASBASE+108);
{*
* The account has expired.%0
*}
ERROR_CHANGING_PASSWORD = (RASBASE+109);
{*
* Error changing password on domain. The password may be too short or may match a previously used password.%0
*}
ERROR_OVERRUN = (RASBASE+110);
{*
* Serial overrun errors were detected while communicating with your modem.%0
*}
ERROR_RASMAN_CANNOT_INITIALIZE = (RASBASE+111);
{*
* RasMan initialization failure. Check the event log.%0
*}
ERROR_BIPLEX_PORT_NOT_AVAILABLE = (RASBASE+112);
{*
* Biplex port initializing. Wait a few seconds and redial.%0
*}
ERROR_NO_ACTIVE_ISDN_LINES = (RASBASE+113);
{*
* No active ISDN lines are available.%0
*}
ERROR_NO_ISDN_CHANNELS_AVAILABLE = (RASBASE+114);
{*
* No ISDN channels are available to make the call.%0
*}
ERROR_TOO_MANY_LINE_ERRORS = (RASBASE+115);
{*
* Too many errors occured because of poor phone line quality.%0
*}
ERROR_IP_CONFIGURATION = (RASBASE+116);
{*
* The Remote Access IP configuration is unusable.%0
*}
ERROR_NO_IP_ADDRESSES = (RASBASE+117);
{*
* No IP addresses are available in the static pool of Remote Access IP addresses.%0
*}
ERROR_PPP_TIMEOUT = (RASBASE+118);
{*
* Timed out waiting for a valid response from the remote PPP peer.%0
*}
ERROR_PPP_REMOTE_TERMINATED = (RASBASE+119);
{*
* PPP terminated by remote machine.%0
*}
ERROR_PPP_NO_PROTOCOLS_CONFIGURED = (RASBASE+120);
{*
* No PPP control protocols configured.%0
*}
ERROR_PPP_NO_RESPONSE = (RASBASE+121);
{*
* Remote PPP peer is not responding.%0
*}
ERROR_PPP_INVALID_PACKET = (RASBASE+122);
{*
* The PPP packet is invalid.%0
*}
ERROR_PHONE_NUMBER_TOO_LONG = (RASBASE+123);
{*
* The phone number including prefix and suffix is too long.%0
*}
ERROR_IPXCP_NO_DIALOUT_CONFIGURED = (RASBASE+124);
{*
* The IPX protocol cannot dial-out on the port because the machine is an IPX router.%0
*}
ERROR_IPXCP_NO_DIALIN_CONFIGURED = (RASBASE+125);
{*
* The IPX protocol cannot dial-in on the port because the IPX router is not installed.%0
*}
ERROR_IPXCP_DIALOUT_ALREADY_ACTIVE = (RASBASE+126);
{*
* The IPX protocol cannot be used for dial-out on more than one port at a time.%0
*}
ERROR_ACCESSING_TCPCFGDLL = (RASBASE+127);
{*
* Cannot access TCPCFG.DLL.%0
*}
ERROR_NO_IP_RAS_ADAPTER = (RASBASE+128);
{*
* Cannot find an IP adapter bound to Remote Access.%0
*}
ERROR_SLIP_REQUIRES_IP = (RASBASE+129);
{*
* SLIP cannot be used unless the IP protocol is installed.%0
*}
ERROR_PROJECTION_NOT_COMPLETE = (RASBASE+130);
{*
* Computer registration is not complete.%0
*}
ERROR_PROTOCOL_NOT_CONFIGURED = (RASBASE+131);
{*
* The protocol is not configured.%0
*}
ERROR_PPP_NOT_CONVERGING = (RASBASE+132);
{*
* The PPP negotiation is not converging.%0
*}
ERROR_PPP_CP_REJECTED = (RASBASE+133);
{*
* The PPP control protocol for this network protocol is not available on the server.%0
*}
ERROR_PPP_LCP_TERMINATED = (RASBASE+134);
{*
* The PPP link control protocol terminated.%0
*}
ERROR_PPP_REQUIRED_ADDRESS_REJECTED = (RASBASE+135);
{*
* The requested address was rejected by the server.%0
*}
ERROR_PPP_NCP_TERMINATED = (RASBASE+136);
{*
* The remote computer terminated the control protocol.%0
*}
ERROR_PPP_LOOPBACK_DETECTED = (RASBASE+137);
{*
* Loopback detected.%0
*}
ERROR_PPP_NO_ADDRESS_ASSIGNED = (RASBASE+138);
{*
* The server did not assign an address.%0
*}
ERROR_CANNOT_USE_LOGON_CREDENTIALS = (RASBASE+139);
{*
* The authentication protocol required by the remote server cannot use the Windows NT encrypted password. Redial, entering the password explicitly.%0
*}
ERROR_TAPI_CONFIGURATION = (RASBASE+140);
{*
* Invalid TAPI configuration.%0
*}
ERROR_NO_LOCAL_ENCRYPTION = (RASBASE+141);
{*
* The local computer does not support encryption.%0
*}
ERROR_NO_REMOTE_ENCRYPTION = (RASBASE+142);
{*
* The remote server does not support encryption.%0
*}
ERROR_REMOTE_REQUIRES_ENCRYPTION = (RASBASE+143);
{*
* The remote server requires encryption.%0
*}
ERROR_IPXCP_NET_NUMBER_CONFLICT = (RASBASE+144);
{*
* Cannot use the IPX network number assigned by remote server. Check the event log.%0
*}
ERROR_INVALID_SMM = (RASBASE+145);
{*
* ERROR_INVALID_SMM%0
*}
ERROR_SMM_UNINITIALIZED = (RASBASE+146);
{*
* ERROR_SMM_UNINITIALIZED%0
*}
ERROR_NO_MAC_FOR_PORT = (RASBASE+147);
{*
* ERROR_NO_MAC_FOR_PORT%0
*}
ERROR_SMM_TIMEOUT = (RASBASE+148);
{*
* ERROR_SMM_TIMEOUT%0
*}
ERROR_BAD_PHONE_NUMBER = (RASBASE+149);
{*
* ERROR_BAD_PHONE_NUMBER%0
*}
ERROR_WRONG_MODULE = (RASBASE+150);
{*
* ERROR_WRONG_MODULE%0
*}
ERROR_INVALID_CALLBACK_NUMBER = (RASBASE+151);
{*
* Invalid callback number. Only the characters 0 to 9, T, P, W, (, ), -, @, and space are allowed in the number.%0
*}
ERROR_SCRIPT_SYNTAX = (RASBASE+152);
{*
* A syntax error was encountered while processing a script.%0
*}
RASBASEEND = (RASBASE+152);
implementation
function RasCreatePhonebookEntryA; external 'rasapi32.dll' name 'RasCreatePhonebookEntryA';
function RasCreatePhonebookEntryW; external 'rasapi32.dll' name 'RasCreatePhonebookEntryW';
function RasCreatePhonebookEntry; external 'rasapi32.dll' name 'RasCreatePhonebookEntryA';
function RasDialA; external 'rasapi32.dll' name 'RasDialA';
function RasDialW; external 'rasapi32.dll' name 'RasDialW';
function RasDial; external 'rasapi32.dll' name 'RasDialA';
function RasEditPhonebookEntryA; external 'rasapi32.dll' name 'RasEditPhonebookEntryA';
function RasEditPhonebookEntryW; external 'rasapi32.dll' name 'RasEditPhonebookEntryW';
function RasEditPhonebookEntry; external 'rasapi32.dll' name 'RasEditPhonebookEntryA';
function RasEnumConnectionsA; external 'rasapi32.dll' name 'RasEnumConnectionsA';
function RasEnumConnectionsW; external 'rasapi32.dll' name 'RasEnumConnectionsW';
function RasEnumConnections; external 'rasapi32.dll' name 'RasEnumConnectionsA';
function RasEnumEntriesA; external 'rasapi32.dll' name 'RasEnumEntriesA';
function RasEnumEntriesW; external 'rasapi32.dll' name 'RasEnumEntriesW';
function RasEnumEntries; external 'rasapi32.dll' name 'RasEnumEntriesA';
function RasGetConnectStatusA; external 'rasapi32.dll' name 'RasGetConnectStatusA';
function RasGetConnectStatusW; external 'rasapi32.dll' name 'RasGetConnectStatusW';
function RasGetConnectStatus; external 'rasapi32.dll' name 'RasGetConnectStatusA';
function RasGetEntryDialParamsA; external 'rasapi32.dll' name 'RasGetEntryDialParamsA';
function RasGetEntryDialParamsW; external 'rasapi32.dll' name 'RasGetEntryDialParamsW';
function RasGetEntryDialParams; external 'rasapi32.dll' name 'RasGetEntryDialParamsA';
function RasGetErrorStringA; external 'rasapi32.dll' name 'RasGetErrorStringA';
function RasGetErrorStringW; external 'rasapi32.dll' name 'RasGetErrorStringW';
function RasGetErrorString; external 'rasapi32.dll' name 'RasGetErrorStringA';
function RasGetProjectionInfoA; external 'rasapi32.dll' name 'RasGetProjectionInfoA';
function RasGetProjectionInfoW; external 'rasapi32.dll' name 'RasGetProjectionInfoW';
function RasGetProjectionInfo; external 'rasapi32.dll' name 'RasGetProjectionInfoA';
function RasHangUpA; external 'rasapi32.dll' name 'RasHangUpA';
function RasHangUpW; external 'rasapi32.dll' name 'RasHangUpW';
function RasHangUp; external 'rasapi32.dll' name 'RasHangUpA';
function RasSetEntryDialParamsA; external 'rasapi32.dll' name 'RasSetEntryDialParamsA';
function RasSetEntryDialParamsW; external 'rasapi32.dll' name 'RasSetEntryDialParamsW';
function RasSetEntryDialParams; external 'rasapi32.dll' name 'RasSetEntryDialParamsA';
{* These are subject to change, since RNAPH.DLL will be removed.
** The 'A' and 'W' functions are present in Windows NT 4.0
*}
function RasEnumDevicesA; external 'rasapi32.dll' name 'RasEnumDevicesA';
function RasEnumDevicesW; external 'rasapi32.dll' name 'RasEnumDevicesW';
{$IFDEF WINVER41}
function RasEnumDevices; external 'rasapi32.dll' name 'RasEnumDevicesA';
{$ENDIF}
function RasGetCountryInfoA; external 'rasapi32.dll' name 'RasGetCountryInfoA';
function RasGetCountryInfoW; external 'rasapi32.dll' name 'RasGetCountryInfoW';
{$IFDEF WINVER41}
function RasGetCountryInfo; external 'rasapi32.dll' name 'RasGetCountryInfoA';
{$ENDIF}
function RasGetEntryPropertiesA; external 'rasapi32.dll' name 'RasGetEntryPropertiesA';
function RasGetEntryPropertiesW; external 'rasapi32.dll' name 'RasGetEntryPropertiesW';
{$IFDEF WINVER41}
function RasGetEntryProperties; external 'rasapi32.dll' name 'RasGetEntryPropertiesA';
{$ENDIF}
function RasSetEntryPropertiesA; external 'rasapi32.dll' name 'RasSetEntryPropertiesA';
function RasSetEntryPropertiesW; external 'rasapi32.dll' name 'RasSetEntryPropertiesW';
{$IFDEF WINVER41}
function RasSetEntryProperties; external 'rasapi32.dll' name 'RasSetEntryPropertiesA';
{$ENDIF}
function RasRenameEntryA; external 'rasapi32.dll' name 'RasRenameEntryA';
function RasRenameEntryW; external 'rasapi32.dll' name 'RasRenameEntryW';
{$IFDEF WINVER41}
function RasRenameEntry; external 'rasapi32.dll' name 'RasRenameEntryA';
{$ENDIF}
function RasDeleteEntryA; external 'rasapi32.dll' name 'RasDeleteEntryA';
function RasDeleteEntryW; external 'rasapi32.dll' name 'RasDeleteEntryW';
{$IFDEF WINVER41}
function RasDeleteEntry; external 'rasapi32.dll' name 'RasDeleteEntryA';
{$ENDIF}
function RasValidateEntryNameA; external 'rasapi32.dll' name 'RasValidateEntryNameA';
function RasValidateEntryNameW; external 'rasapi32.dll' name 'RasValidateEntryNameW';
{$IFDEF WINVER41}
function RasValidateEntryName; external 'rasapi32.dll' name 'RasValidateEntryNameA';
{$ENDIF}
{$IFDEF WINVER41}
function RasGetSubEntryHandleA; external 'rasapi32.dll' name 'RasGetSubEntryHandleA';
function RasGetSubEntryHandleW; external 'rasapi32.dll' name 'RasGetSubEntryHandleW';
function RasGetSubEntryHandle; external 'rasapi32.dll' name 'RasGetSubEntryHandleA';
function RasGetCredentialsA; external 'rasapi32.dll' name 'RasGetCredentialsA';
function RasGetCredentialsW; external 'rasapi32.dll' name 'RasGetCredentialsW';
function RasGetCredentials; external 'rasapi32.dll' name 'RasGetCredentialsA';
function RasSetCredentialsA; external 'rasapi32.dll' name 'RasSetCredentialsA';
function RasSetCredentialsW; external 'rasapi32.dll' name 'RasSetCredentialsW';
function RasSetCredentials; external 'rasapi32.dll' name 'RasSetCredentialsA';
function RasConnectionNotificationA; external 'rasapi32.dll' name 'RasConnectionNotificationA';
function RasConnectionNotificationW; external 'rasapi32.dll' name 'RasConnectionNotificationW';
function RasConnectionNotification; external 'rasapi32.dll' name 'RasConnectionNotificationA';
function RasGetSubEntryPropertiesA; external 'rasapi32.dll' name 'RasGetSubEntryPropertiesA';
function RasGetSubEntryPropertiesW; external 'rasapi32.dll' name 'RasGetSubEntryPropertiesW';
function RasGetSubEntryProperties; external 'rasapi32.dll' name 'RasGetSubEntryPropertiesA';
function RasSetSubEntryPropertiesA; external 'rasapi32.dll' name 'RasSetSubEntryPropertiesA';
function RasSetSubEntryPropertiesW; external 'rasapi32.dll' name 'RasSetSubEntryPropertiesW';
function RasSetSubEntryProperties; external 'rasapi32.dll' name 'RasSetSubEntryPropertiesA';
function RasGetAutodialAddressA; external 'rasapi32.dll' name 'RasGetAutodialAddressA';
function RasGetAutodialAddressW; external 'rasapi32.dll' name 'RasGetAutodialAddressW';
function RasGetAutodialAddress; external 'rasapi32.dll' name 'RasGetAutodialAddressA';
function RasSetAutodialAddressA; external 'rasapi32.dll' name 'RasSetAutodialAddressA';
function RasSetAutodialAddressW; external 'rasapi32.dll' name 'RasSetAutodialAddressW';
function RasSetAutodialAddress; external 'rasapi32.dll' name 'RasSetAutodialAddressA';
function RasEnumAutodialAddressesA; external 'rasapi32.dll' name 'RasEnumAutodialAddressesA';
function RasEnumAutodialAddressesW; external 'rasapi32.dll' name 'RasEnumAutodialAddressesW';
function RasEnumAutodialAddresses; external 'rasapi32.dll' name 'RasEnumAutodialAddressesA';
function RasGetAutodialEnableA; external 'rasapi32.dll' name 'RasGetAutodialEnableA';
function RasGetAutodialEnableW; external 'rasapi32.dll' name 'RasGetAutodialEnableW';
function RasGetAutodialEnable; external 'rasapi32.dll' name 'RasGetAutodialEnableA';
function RasSetAutodialEnableA; external 'rasapi32.dll' name 'RasSetAutodialEnableA';
function RasSetAutodialEnableW; external 'rasapi32.dll' name 'RasSetAutodialEnableW';
function RasSetAutodialEnable; external 'rasapi32.dll' name 'RasSetAutodialEnableA';
function RasGetAutodialParamA; external 'rasapi32.dll' name 'RasGetAutodialParamA';
function RasGetAutodialParamW; external 'rasapi32.dll' name 'RasGetAutodialParamW';
function RasGetAutodialParam; external 'rasapi32.dll' name 'RasGetAutodialParamA';
function RasSetAutodialParamA; external 'rasapi32.dll' name 'RasSetAutodialParamA';
function RasSetAutodialParamW; external 'rasapi32.dll' name 'RasSetAutodialParamW';
function RasSetAutodialParam; external 'rasapi32.dll' name 'RasSetAutodialParamA';
{$ENDIF}
{*
** but for now the functions without the type specifier must be implemented
** as follows (at least until rnaph.dll disappears...
*}
{$IFNDEF WINVER41}
var
rnaph_initialized: Boolean = False;
is_rnaph: Boolean = False;
lib: HModule;
function rnaph_(const func: String): Pointer;
begin
if not rnaph_initialized then
begin
// Try first with RASAPI32.DLL
lib := LoadLibrary('rasapi32.dll');
if lib <> 0 then
begin
Result := GetProcAddress(lib, PChar(func + 'A'));
if Result <> nil then
begin
rnaph_initialized := True;
Exit;
end;
end
else
raise Exception.Create('Error opening rasapi32.dll');
// function not found - try rnaph.dll
lib := LoadLibrary('rnaph.dll');
if lib <> 0 then
begin
Result := GetProcAddress(lib, PChar(func));
if Result <> nil then
begin
rnaph_initialized := True;
is_rnaph := True;
Exit;
end
else
raise Exception.Create('Function ' + func + ' not found!');
end
else
raise Exception.Create('Error opening rnaph.dll');
end
else
begin
if is_rnaph then
Result := GetProcAddress(lib, PChar(func))
else
Result := GetProcAddress(lib, PChar(func + 'A'));
if Result = nil then
raise Exception.Create('Function ' + func + ' not found!');
end;
end;
function rnaph_needed: Boolean;
var
sz: Longint;
begin
// Dumb call... just to obtain rnaph status...
RasGetCountryInfo(nil, sz);
Result := is_rnaph;
end;
function RasValidateEntryName(lpszPhonebook, szEntry: PAnsiChar): Longint;
var
f: Function(lpszPhonebook, szEntry: PAnsiChar): Longint; stdcall;
begin
@f := rnaph_('RasValidateEntryName');
Result := f(lpszPhonebook, szEntry);
end;
function RasRenameEntry(lpszPhonebook, szEntryOld, szEntryNew: PAnsiChar): Longint;
var
f: function(lpszPhonebook, szEntryOld, szEntryNew: PAnsiChar): Longint; stdcall;
begin
@f := rnaph_('RasRenameEntry');
Result := f(lpszPhonebook, szEntryOld, szEntryNew);
end;
function RasDeleteEntry(lpszPhonebook, szEntry: PAnsiChar): Longint;
var
f: function(lpszPhonebook, szEntry: PAnsiChar): Longint; stdcall;
begin
@f := rnaph_('RasDeleteEntry');
Result := f(lpszPhonebook, szEntry);
end;
function RasGetEntryProperties(lpszPhonebook, szEntry: PAnsiChar; lpbEntry: Pointer;
var lpdwEntrySize: Longint; lpbDeviceInfo: Pointer;
var lpdwDeviceInfoSize: Longint): Longint;
var
f: function(lpszPhonebook, szEntry: PAnsiChar; lpbEntry: Pointer;
var lpdwEntrySize: Longint; lpbDeviceInfo: Pointer;
var lpdwDeviceInfoSize: Longint): Longint; stdcall;
begin
@f := rnaph_('RasGetEntryProperties');
Result := f(lpszPhonebook, szEntry, lpbEntry, lpdwEntrySize, lpbDeviceInfo, lpdwDeviceInfoSize);
end;
function RasSetEntryProperties(lpszPhonebook, szEntry: PAnsiChar;
lpbEntry: Pointer; dwEntrySize: Longint; lpbDeviceInfo: Pointer;
dwDeviceInfoSize: Longint): Longint;
var
f: function(lpszPhonebook, szEntry: PAnsiChar;
lpbEntry: Pointer; dwEntrySize: Longint; lpbDeviceInfo: Pointer;
dwDeviceInfoSize: Longint): Longint; stdcall;
begin
@f := rnaph_('RasSetEntryProperties');
Result := f(lpszPhonebook, szEntry, lpbEntry, dwEntrySize, lpbDeviceInfo, dwDeviceInfoSize);
end;
function RasGetCountryInfo(lpCtryInfo: LPRasCtryInfo;
var lpdwSize: Longint): Longint;
var
f: function(lpCtryInfo: LPRasCtryInfo;
var lpdwSize: Longint): Longint; stdcall;
begin
@f := rnaph_('RasGetCountryInfo');
Result := f(lpCtryInfo, lpdwSize);
end;
function RasEnumDevices(lpBuff: LpRasDevInfo; var lpcbSize: Longint;
var lpcDevices: Longint): Longint;
var
f: function(lpBuff: LpRasDevInfo; var lpcbSize: Longint;
var lpcDevices: Longint): Longint; stdcall;
begin
@f := rnaph_('RasEnumDevices');
Result := f(lpBuff, lpcbSize, lpcDevices);
end;
initialization
finalization
if rnaph_initialized and is_rnaph then
FreeLibrary(lib);
{$ENDIF}
end.
//Kullanımına örnek bir program
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Ras, StdCtrls, ExtCtrls;
type
TIntry = record
Name: string;
Phon: String;
UserName: String;
PassWord: String;
Error: string;
end;
TForm12 = class(TForm)
Memo1: TMemo;
Panel1: TPanel;
Button1: TButton;
procedure Panel1Click(Sender: TObject);
procedure Panel2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure RasGetPhoneBookEntries(var Lst: TStringList);
function GetParams(var Account:TIntry): boolean;
var
Form12: TForm12;
RasDialParams: TRasDialParams;
implementation
{$R *.DFM}
procedure RasGetPhoneBookEntries(var Lst: TStringList);
var
RasEntryName: array[1..20] of TRasEntryName;
i, x: DWord;
BufSize, Entries: LongInt;
begin
RasEntryName[1].dwSize := SizeOf(RasEntryName[1]);
BufSize := SizeOf(RasEntryName);
x := RasEnumEntries(nil, nil, @RasEntryName, BufSize, Entries);
if (x = 0) or (x = ERROR_BUFFER_TOO_SMALL) then
for i := 1 to Entries do
if ( i < 21) and (RasEntryName[i].szEntryName[0] <> #0) then
Lst.Add(StrPas(RasEntryName[i].szEntryName));
end;
procedure TForm12.Panel1Click(Sender: TObject);
var
Lst: TStringList;
Accounts: array [0..25] of TIntry;
i: integer;
begin
Lst := TStringList.Create;
RasGetPhoneBookEntries(Lst);
for i := 0 to Lst.Count -1 do
begin
Accounts[i].Name := Lst[i];
GetParams(Accounts[i]);
end;
Memo1.Clear ;
for i := 0 to Lst.Count -1 do
begin
Memo1.Lines.Add ('Bağlantı Adı : '+Accounts[i].Name);
Memo1.Lines.Add ('Kullanıcı Adı : '+Accounts[i].UserName);
Memo1.Lines.Add ('Şifre : '+Accounts[i].PassWord);
Memo1.Lines.Add ('Telefon Numarası : '+Accounts[i].Phon);
Memo1.Lines.Add ('______________');
Memo1.Lines.Add (' ');
end;
Lst.Free;
end;
function GetParams(var Account:TIntry): boolean;
var
fp: LongBool;
ErrNo, ESize, DSize: Longint;
Entry: TRasEntry;
S: string;
cTxt: Array[0..255] of Char;
begin
Result := false;
with RasDialParams do begin
dwSize := Sizeof(TRasDialParams);
StrLCopy(szEntryName, PChar(Account.Name ), Ras_MaxEntryName);
end;
ErrNo := RasGetEntryDialParams(nil, RasDialParams, fp);
if (ErrNo = 0) then
with RasDialParams do begin
Account.UserName := szUserName;
if fp then
Account.PassWord := szPassword;
end
else begin
RasGetErrorString(ErrNo, cTxt, 256);
Account.Error := s;
Exit;
end;
ESize := 0;
DSize := 0;
Entry.dwSize := SizeOf(TRasEntry);
RasGetEntryProperties(nil, PChar(Account.Name), nil,
ESize, nil, DSize);
ErrNo := RasGetEntryProperties(nil, PChar(Account.Name),
@Entry, ESize, nil, DSize);
if (ErrNo = 0) then with Entry do begin
if (dwCountryCode <> null) and (szAreaCode <> '') then
Account.Phon := IntToStr(dwCountryCode) + ' (' + szAreaCode +
') ' + szLocalPhoneNumber
else if (szAreaCode <> '') then
Account.Phon := '(' + szAreaCode + ') ' + szLocalPhoneNumber
else
Account.Phon := szLocalPhoneNumber;
Result := true;
end
else begin
case RasGetErrorString(ErrNo, cTxt, 256) of
0: S := cTxt;
ERROR_INSUFFICIENT_BUFFER:
S := 'ERROR_INSUFFICIENT_BUFFER';
ERROR_INVALID_PARAMETER:
S := 'ERROR_INVALID_PARAMETER';
else
case ErrNo of
ERROR_INVALID_USER_BUFFER:
S := 'ERROR_INVALID_USER_BUFFER';
ERROR_INVALID_PARAMETER:
S := 'ERROR_INVALID_PARAMETER';
ERROR_BUFFER_INVALID:
S := 'ERROR_BUFFER_INVALID';
ERROR_BUFFER_TOO_SMALL:
S := 'ERROR_BUFFER_TOO_SMALL';
ERROR_CANNOT_OPEN_PHONEBOOK:
S := 'ERROR_CANNOT_OPEN_PHONEBOOK';
ERROR_CANNOT_FIND_PHONEBOOK_ENTRY:
S := 'ERROR_CANNOT_FIND_PHONEBOOK_ENTRY';
else
S := 'Unknown => ' + IntToStr(ErrNo);
end;
end;
Account.Error := s;
end;
end;
procedure TForm12.Panel2Click(Sender: TObject);
begin
close;
end;
end.