Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Inno setup inno设置:如何在windows中获取tcp连接列表?_Inno Setup_Pascalscript - Fatal编程技术网

Inno setup inno设置:如何在windows中获取tcp连接列表?

Inno setup inno设置:如何在windows中获取tcp连接列表?,inno-setup,pascalscript,Inno Setup,Pascalscript,我试图创建一个安装程序来检查windows64计算机上的当前传输控制协议连接。是否有可能创建 我将使用extern命令行。如果我给ls-lf,它将返回当前运行的所有文件 [code] const GetFileExInfoStandard = $0; type FILETIME = record LowDateTime: DWORD; HighDateTime: DWORD; end; WIN32_FILE_ATTRIBUTE_DATA = record FileAttribut

我试图创建一个安装程序来检查windows64计算机上的当前传输控制协议连接。是否有可能创建

我将使用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 'GetFileAttributesExA@kernel32.dll stdcall'; 

function FileTimeToSystemTime(
  FileTime:           FILETIME;
  var SystemTime:     SYSTEMTIME
  ): Boolean; 
external 'FileTimeToSystemTime@kernel32.dll 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;

结束

此代码工作正常,但显示结果可能需要半分钟

[Code]

function NextButtonClick(CurPage: Integer): Boolean;
var
    TmpFileName, ExecStdout: string;
    ResultCode: integer;
begin
   if CurPage = wpWelcome then begin
   TmpFileName := ExpandConstant('{tmp}') + '\ipconfig_results.txt';
   Exec('cmd.exe', '/C netstat > "' + TmpFileName + '"', '', SW_HIDE,
          ewWaitUntilTerminated, ResultCode);
if LoadStringFromFile(TmpFileName, ExecStdout) then begin

       MsgBox(ExecStdout, mbInformation, MB_OK);
      // do something with contents of file...
     end;
   DeleteFile(TmpFileName);
   end;
   Result := True;
 end;

你面临的问题是什么?你能告诉我我需要使用哪些函数来实现这一点吗?我会使用这个函数。不。我没有这样的代码。我甚至不知道是否可以使用Inno Setup Pascal脚本中的函数。最好是将它包装到一个外部DLL中。@TLama好的,我会尝试这样做