16番会議室「玉石混淆みんなで作るSample蔵」に寄せられたサンプル
"RasGetEntryProperties 他の宣言"
この発言は #01274 Fermion さんのダイアルアップ接続設定の取得・複写 に対するコメントです
■概要
RasGetEntryProperties 他を宣言したユニットです。 RasEntry.pas という
ファイル名で保存して下さい。
■サンプルコード
//=========================================================================
unit RasEntry;
interface
uses
Windows;
const
UNLEN = 256; // Maximum user name length
PWLEN = 256; // Maximum password length
CNLEN = 15; // Computer name length
DNLEN = CNLEN; // Maximum domain name length
RAS_MaxAreaCode = 10;
RAS_MaxPhoneNumber = 128;
RAS_MaxDeviceType = 16;
RAS_MaxIpAddress = 15;
RAS_MaxIpxAddress = 21;
RAS_MaxEntryName = 256;
RAS_MaxDeviceName = 128;
RAS_MaxPadType = 32;
RAS_MaxX25Address = 200;
RAS_MaxFacilities = 200;
RAS_MaxUserData = 200;
RAS_MaxCallbackNumber = RAS_MaxPhoneNumber;
{* RASENTRY 'dwfOptions' bit flags. *}
RASEO_UseCountryAndAreaCodes = $00000001;
RASEO_SpecificIpAddr = $00000002;
RASEO_SpecificNameServers = $00000004;
RASEO_IpHeaderCompression = $00000008;
RASEO_RemoteDefaultGateway = $00000010;
RASEO_DisableLcpExtensions = $00000020;
RASEO_TerminalBeforeDial = $00000040;
RASEO_TerminalAfterDial = $00000080;
RASEO_ModemLights = $00000100;
RASEO_SwCompression = $00000200;
RASEO_RequireEncryptedPw = $00000400;
RASEO_RequireMsEncryptedPw = $00000800;
RASEO_RequireDataEncryption = $00001000;
RASEO_NetworkLogon = $00002000;
RASEO_UseLogonCredentials = $00004000;
RASEO_PromoteAlternates = $00008000;
{* Windows NT4 enhancements --------------------------------------------
RASEO_SecureLocalFiles = $00010000;
//--------------------------------------------------------------------*}
{* Windows 2000 --------------------------------------------------------
RASEO_RequireEAP = $00020000;
RASEO_RequirePAP = $00040000;
RASEO_RequireSPAP = $00080000;
RASEO_Custom = $00100000;
RASEO_PreviewPhoneNumber = $00200000;
RASEO_SharedPhoneNumbers = $00800000;
RASEO_PreviewUserPw = $01000000;
RASEO_PreviewDomain = $02000000;
RASEO_ShowDialingProgress = $04000000;
RASEO_RequireCHAP = $08000000;
RASEO_RequireMsCHAP = $10000000;
RASEO_RequireMsCHAP2 = $20000000;
RASEO_RequireW95MSCHAP = $40000000;
RASEO_CustomScript = $80000000;
//--------------------------------------------------------------------*}
{* RASENTRY 'dwfNetProtocols' bit flags. *}
RASNP_NetBEUI = $00000001;
RASNP_Ipx = $00000002;
RASNP_Ip = $00000004;
{* RASENTRY 'dwFramingProtocols' bit flags. *}
RASFP_Ppp = $00000001;
RASFP_Slip = $00000002;
RASFP_Ras = $00000004;
{* RASENTRY 'szDeviceType' default strings. *}
RASDT_Modem = 'modem';
RASDT_Isdn = 'isdn';
RASDT_X25 = 'x25';
RASDT_Vpn = 'vpn';
RASDT_Pad = 'pad';
RASDT_Generic = 'GENERIC';
RASDT_Serial = 'SERIAL';
RASDT_FrameRelay = 'FRAMERELAY';
RASDT_Atm = 'ATM';
RASDT_Sonet = 'SONET';
RASDT_SW56 = 'SW56';
RASDT_Irda = 'IRDA';
RASDT_Parallel = 'PARALLEL';
// The entry type used to determine which UI properties
// are to be presented to user. This generally corresponds
// to a Connections "add" wizard selection.
RASET_Phone = 1; // Phone lines: modem, ISDN, X.25, etc
RASET_Vpn = 2; // Virtual private network
RASET_Direct = 3; // Direct connect: serial, parallel
RASET_Internet = 4; // BaseCamp internet
{* RASENTRY 'dwDialMode' values. *}
RASEDM_DialAll = 1;
RASEDM_DialAsNeeded = 2;
{* RASENTRY 'dwIdleDisconnectSeconds' constants. *}
RASIDS_Disabled = $ffffffff;
RASIDS_UseGlobalValue = $00000000;
{* Error *}
//ERROR_INVALID_PARAMETER = 87;
ERROR_BUFFER_INVALID = 610;
ERROR_BUFFER_TOO_SMALL = 603;
ERROR_CANNOT_OPEN_PHONEBOOK = 621;
ERROR_CANNOT_FIND_PHONEBOOK_ENTRY = 623;
type
TRASIPADDR = packed record
a, b, c, d: Byte;
end;
PRasEntry = ^TRasEntry;
TRasEntry = record
dwSize : DWORD;
dwfOptions: DWORD;
{*--------------------------------------------------------------------
Location/phone number.
//------------------------------------------------------------------*}
dwCountryID : DWORD;
dwCountryCode : DWORD;
szAreaCode : array[0..RAS_MaxAreaCode] of Char;
szLocalPhoneNumber: array[0..RAS_MaxPhoneNumber] of Char;
dwAlternateOffset : DWORD;
{*--------------------------------------------------------------------
PPP/Ip
//------------------------------------------------------------------*}
ipaddr : TRASIPADDR;
ipaddrDns : TRASIPADDR;
ipaddrDnsAlt : TRASIPADDR;
ipaddrWins : TRASIPADDR;
ipaddrWinsAlt: TRASIPADDR;
{*--------------------------------------------------------------------
Framing
//------------------------------------------------------------------*}
dwFrameSize : DWORD;
dwfNetProtocols : DWORD;
dwFramingProtocol: DWORD;
{*--------------------------------------------------------------------
Scripting
//------------------------------------------------------------------*}
szScript: array[0..MAX_PATH - 1] of Char;
{*--------------------------------------------------------------------
AutoDial
//------------------------------------------------------------------*}
szAutodialDll : array[0..MAX_PATH - 1] of Char;
szAutodialFunc: array[0..MAX_PATH - 1] of Char;
{*--------------------------------------------------------------------
Device
//------------------------------------------------------------------*}
szDeviceType: array[0..RAS_MaxDeviceType] of Char;
szDeviceName: array[0..RAS_MaxDeviceName] of Char;
{*--------------------------------------------------------------------
X.25
//------------------------------------------------------------------*}
szX25PadType : array[0..RAS_MaxPadType] of Char;
szX25Address : array[0..RAS_MaxX25Address] of Char;
szX25Facilities: array[0..RAS_MaxFacilities] of Char;
szX25UserData : array[0..RAS_MaxUserData] of Char;
dwChannels : DWORD;
{*--------------------------------------------------------------------
Reserved
//------------------------------------------------------------------*}
dwReserved1: DWORD;
dwReserved2: DWORD;
(* Windows NT4 enhancements ------------------------------------------
{*--------------------------------------------------------------------
Multilink
//------------------------------------------------------------------*}
dwSubEntries : DWORD;
dwDialMode : DWORD;
dwDialExtraPercent : DWORD;
dwDialExtraSampleSeconds : DWORD;
dwHangUpExtraPercent : DWORD;
dwHangUpExtraSampleSeconds: DWORD;
{*--------------------------------------------------------------------
Idle timeout
//------------------------------------------------------------------*}
dwIdleDisconnectSeconds: DWORD;
//------------------------------------------------------------------*)
(* Windows 2000 ------------------------------------------------------
{*--------------------------------------------------------------------
Entry Type
//------------------------------------------------------------------*}
dwType: DWORD;
{*--------------------------------------------------------------------
Encryption type
//------------------------------------------------------------------*}
dwEncryptionType: DWORD;
{*--------------------------------------------------------------------
CustomAuthKey to be used for EAP
//------------------------------------------------------------------*}
dwCustomAuthKey: DWORD;
{*--------------------------------------------------------------------
Guid of the connection
//------------------------------------------------------------------*}
guidId: TGUID;
{*--------------------------------------------------------------------
Custom Dial Dll
//------------------------------------------------------------------*}
szCustomDialDll: array[0..MAX_PATH - 1] of Char;
{*--------------------------------------------------------------------
DwVpnStrategy
//------------------------------------------------------------------*}
dwVpnStrategy: DWORD;
//------------------------------------------------------------------*)
end;{TRasEntry}
PRasDialParams = ^TRasDialParams;
TRasDialParams = record
dwSize : DWORD;
szEntryName : array[0..RAS_MaxEntryName] of Char;
szPhoneNumber : array[0..RAS_MaxPhoneNumber] of Char;
szCallbackNumber: array[0..RAS_MaxCallbackNumber] of Char;
szUserName : array[0..UNLEN] of Char;
szPassword : array[0..PWLEN] of Char;
szDomain : array[0..DNLEN] of Char;
(* Windows NT4 enhancements ------------------------------------------
dwSubEntry : DWORD;
dwCallbackId : Pointer;
//------------------------------------------------------------------*)
end;{TRasDialParam}
function RasGetEntryProperties( lpszPhonebook : LPTSTR;
lpszEntry : LPTSTR;
lpRasEntry : PRasEntry;
lpdwEntryInfoSize : LPDWORD;
lpbDeviceInfo : PByte;
lpdwDeviceInfoSize: LPDWORD
): DWORD; stdcall;
function RasSetEntryProperties( lpszPhonebook : LPTSTR;
lpszEntry : LPTSTR;
lpRasEntry : PRasEntry;
dwEntryInfoSize : DWORD;
lpbDeviceInfo : PByte;
dwDeviceInfoSize: DWORD ): DWORD; stdcall;
function RasSetEntryDialParams( lpszPhonebook : LPTSTR;
lpRasDialParams: PRasDialParams;
fRemovePassword: BOOL ): DWORD; stdcall;
function RasGetEntryDialParams( lpszPhonebook : LPTSTR;
lpRasDialParams: PRasDialParams;
lpfPassword : PBOOL ): DWORD; stdcall;
implementation
function RasGetEntryProperties;
external 'rasapi32.dll' name 'RasGetEntryPropertiesA';
function RasSetEntryProperties;
external 'rasapi32.dll' name 'RasSetEntryPropertiesA';
function RasSetEntryDialParams;
external 'rasapi32.dll' name 'RasSetEntryDialParamsA';
function RasGetEntryDialParams;
external 'rasapi32.dll' name 'RasGetEntryDialParamsA';
end.
//=========================================================================
01/02/12(Mon) 10:47pm Fermion [KHF03264]
- FDELPHI MES(16):玉石混淆みんなで作るSample蔵【見本蓄積】 01/02/14 -
Original document by Fermion 氏 ID:(KHF03264)
ここにあるドキュメントは NIFTY SERVEの Delphi Users' Forum の16番会議室「玉石混淆みんなで作るSample蔵」に投稿されたサンプルです。これらのサンプルはボーランド株式会社がサポートする公式のものではありません。また、必ずしも動作が検証されているものではありません。これらのサンプルを使用したことに起因するいかなる損害も投稿者、およびフォーラムスタッフはその責めを負いません。使用者のリスクの範疇でご使用下さい。
Copyright 1996-2002 Delphi Users' Forum
|