Форум: "Сети";
Текущий архив: 2002.08.19;
Скачать: [xml.tar.bz2];
Вниз????? Функция RasGetEntryDialParams ????? Найти похожие ветки
← →
naZi (2002-06-08 10:47) [0]Как используя функцию RasGetEntryDialParams получить
пароли от Dial-Up соединений + Телефоны к ним ???
Напишите примерчик, исходничек !!!
← →
Avenger (2002-06-09 01:31) [1]Вот пример:
unit Unit1;
interface
uses
Ras,
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ImgList;
type
TForm1 = class(TForm)
lv: TListView;
ImageList1: TImageList;
procedure FormCreate(Sender: TObject);
function GetTel(x:Integer):String;
private
dialparams: TRasDialParams;
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function TForm1.GetTel(x:Integer):String;
var
entry: LPRasEntry;
entrySize, devinfoSize: Integer;
entryName: string;
begin
entryName := lv.Items.Item[x].Caption;
entrySize := 0;
devinfoSize := 0;
if RasGetEntryProperties(nil, PChar(entryName),
nil, entrySize, nil, devinfoSize) <> ERROR_BUFFER_TOO_SMALL then
begin
ShowMessage("RasGetEntryProperties failed.");
Exit;
end;
entry := AllocMem(entrySize);
try
entry^.dwSize := SizeOf(TRasEntry);
if RasGetEntryProperties(nil, PChar(entryName), entry, entrySize, nil, devinfoSize) = 0 then Result:= entry^.szLocalPhoneNumber;
finally
FreeMem(entry);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
bufsize: Longint;
numEntries: Longint;
entries, p: LPRasEntryName;
x: Integer;
res: Integer;
r: Longint;
fp: LongBool;
c: Array[0..100] of Char;
param:String;
begin
lv.Items.Clear;
entries := AllocMem(SizeOf(TRasEntryName));
entries^.dwSize := SizeOf(TRasEntryName);
bufsize := SizeOf(TRasEntryName);
res := RasEnumEntries(nil, nil, entries, bufsize, numEntries);
if res = ERROR_BUFFER_TOO_SMALL then
begin
ReallocMem(entries, bufsize);
FillChar(entries^, bufsize, 0);
entries^.dwSize := SizeOf(TRasEntryName);
res := RasEnumEntries(nil, nil, entries, bufsize, numEntries);
end;
if res = 0 then
begin
if numEntries > 0 then
begin
p := entries;
for x := 0 to numEntries - 1 do
begin
lv.Items.Add.Caption := p^.szEntryName;
Inc(p);
end;
end;
end
else
ShowMessage("RasEnumEntries failed.");
FreeMem(entries);
//passview
for x:=0 to lv.Items.Count -1 do
begin
FillChar(dialparams, SizeOf(TRasDialParams), 0);
with dialparams do
begin
dwSize := Sizeof(TRasDialParams);
StrPCopy(szEntryName, lv.Items.Item[x].Caption);
end;
r := RasGetEntryDialParams(nil, dialparams, fp);
if r = 0 then
with dialparams do
begin
param:=GetTel(x);
param:=param+#13#10+szUserName;
if fp then param:=param+#13#10+szPassword;
lv.Items.Item[x].SubItems.Text:=param;
end
else
begin
RasGetErrorString(r, c, 100);
ShowMessage("RasGetEntryDialParams failed: " + c);
end;
end;
end;
end.
Если надо Ras.pas то пиши на мыло, вышлю...
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2002.08.19;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.007 c