Ветеран

Сообщения: 1273
Благодарности: 1030
|
Профиль
|
Отправить PM
| Цитировать
Цитата Gugle:
Там еще драйвер нужен, поэтому первый вариант не прокатывает. Нужна установка »
|
Gugle, да, нужен. Устанавливаю драйвер вручную - dll-ка интерфейсы не выдает. Пробуйте так:
читать дальше »
Код: 
[Setup]
AppName=My Program
AppVerName=My Program v.1.2
DefaultDirName={pf}\My Program
[Files]
Source: ifList.dll; Flags: dontcopy
[code]
const
SERVICE_QUERY_CONFIG = $1;
SC_MANAGER_ALL_ACCESS = $f003f;
type
mas = record
num: Integer;
name,IPv4,IPv6,description: PAnsiChar;
end;
HANDLE = Cardinal;
function getT(): Integer; external 'getT@files:ifList.dll stdcall delayload';
function getV(d: Integer): mas; external 'getV@files:ifList.dll stdcall delayload';
function OpenSCManager(lpMachineName, lpDatabaseName: String; dwDesiredAccess: Cardinal): HANDLE;
external 'OpenSCManagerA@advapi32.dll stdcall';
function OpenService(hSCManager: HANDLE; lpServiceName: String; dwDesiredAccess: Cardinal): HANDLE;
external 'OpenServiceA@advapi32.dll stdcall';
function CloseServiceHandle(hSCObject: HANDLE): Boolean;
external 'CloseServiceHandle@advapi32.dll stdcall';
function OpenServiceManager(): HANDLE;
begin
Result := OpenSCManager('', 'ServicesActive', SC_MANAGER_ALL_ACCESS);
end;
function IsServiceInstalled(ServiceName: String): Boolean;
var
hSCM: HANDLE;
hService: HANDLE;
begin
hSCM := OpenServiceManager();
if hSCM <> 0 then
begin
hService := OpenService(hSCM, ServiceName, SERVICE_QUERY_CONFIG);
if hService <> 0 then
begin
Result := hService <> 0;
CloseServiceHandle(hService);
end;
CloseServiceHandle(hSCM);
end;
end;
function InitializeSetup(): Boolean;
begin
Result := IsServiceInstalled('npf');
if not Result then MsgBox('Установите WinPcap.', mbError, MB_OK);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
m: mas;
i: Byte;
begin
Result := True;
if CurPageID = wpWelcome then
begin
for i := 1 to getT() do
begin
m := getV(i);
MsgBox('num= ' + IntToStr(m.num) + #13#10
+ 'name= ' + String(m.name) + #13#10
+ 'IPv4= ' + String(m.IPv4) + #13#10
+ 'IPv6= ' + String(m.IPv6) + #13#10
+ 'description= ' + string(m.description) + #13#10
, mbInformation, MB_OK);
end;
end;
end;
|
Отправлено: 14:55, 13-10-2011
| #3540
|