0
我试图创建一个安装程序来检查当前的传输控制协议连接在windows64机器。是否有可能创建?inno setup:如何在windows中获取tcp连接列表?
我打算使用使用extern的命令行。如果我给ls -lf它会返回所有当前运行的文件
[code]
const
GetFileExInfoStandard = $0;
type
FILETIME = record
LowDateTime: DWORD;
HighDateTime: DWORD;
end;
WIN32_FILE_ATTRIBUTE_DATA = record
FileAttributes: DWORD;
CreationTime: FILETIME;
LastAccessTime: FILETIME;
LastWriteTime: FILETIME;
FileSizeHigh: DWORD;
FileSizeLow: DWORD;
end;
SYSTEMTIME = record
Year: WORD;
Month: WORD;
DayOfWeek: WORD;
Day: WORD;
Hour: WORD;
Minute: WORD;
Second: WORD;
Milliseconds: WORD;
end;
function GetFileAttributesEx (
FileName: string;
InfoLevelId: DWORD;
var FileInformation: WIN32_FILE_ATTRIBUTE_DATA
): Boolean;
external '[email protected] stdcall';
function FileTimeToSystemTime(
FileTime: FILETIME;
var SystemTime: SYSTEMTIME
): Boolean;
external '[email protected] stdcall';
var
TmpfileName: String;
i,j,ResultCode:integer;
ExecStdout,processes:Tarrayofstring;
Page:TInputOptionWizardPage;
procedure initializeWizard;
begin
TmpFileName := ExpandConstant('{tmp}') + '\processes.txt';
Exec('cmd.exe','/C netstat > "' + TmpFileName + '"',
'',SW_HIDE,ewWaitUntilTerminated, ResultCode);
Page := CreateInputOptionPage(wpWelcome,
'Current Running processes on your computer',
'Displays All Running processes on this machine, selecte any process
to terminate','Seleet Any one from the list, Click on next'+#13+
'Note: Do not select System processes this may cause damage to your machine..'
, True, True);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpwelcome then
begin
if LoadStringsFromFile(TmpFileName, ExecStdout) then
begin
for i:=3 to GetArrayLength(ExecStdout)-1 do
begin
setarraylength(processes,i-2)
processes[i-3]:='';
for j:=1 to length(Execstdout[i]) do
begin
if not ((Execstdout[i][j]=' ') and (Execstdout[i][j+1]=' ')) then
begin
processes[i-3]:=processes[i-3]+execstdout[i][j];
end;
if ((Execstdout[i][j]=' ') and (Execstdout[i][j+1]=' ')) then
j:=length(Execstdout[i]);
end;
page.add(processes[i-3]);
end;
end;
Result:=true;
end;
if CurPageID = page.id then
begin
result:=true;
end;
if CurPageID = wpReady then
Result:=true;
end;
您面临的问题是什么? – tod
你能告诉我什么是我需要使用此功能 – Ramkee
我会使用['GetTcpTable'](http://msdn.microsoft.com/en-us/library/windows/desktop/aa366026( v = vs.85).aspx)函数。 – TLama