delphi 编程断开网络,该怎么解决

delphi 编程断开网络
请问如何断开网络连接
像个人防火墙一样
调用SetIfEntry   在XP下   没有任何效果

------解决方案--------------------
看看代码吧。。。。禁用网络联接的例子,有点长

unit DeviceForm;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, CheckLst, Common, RegStr;

const
DEV_CLASS_NAME = 'Net ';
UNKNOWN_DEVICE = ' <未知设备> ';

type
TDevForm = class(TForm)
lbDev: TLabel;
btApply: TButton;
btExit: TButton;
clbDevList: TCheckListBox;
btRefresh: TButton;
procedure FormCreate(Sender: TObject);
procedure btExitClick(Sender: TObject);
procedure btApplyClick(Sender: TObject);
procedure btRefreshClick(Sender: TObject);
private
{ Private declarations }
DevState: Array of Boolean;
procedure RefreshDevState;

procedure EnumNetDevice;
function IsClassHidden(const ClassGUID: PGUID): Boolean;
function ConstructDeviceName(DeviceInfoSet: HDEVINFO;
DeviceInfoData: PSP_DEVINFO_DATA; Buffer: PAnsiChar; Length: ULONG): Boolean;
function GetRegistryProperty(DeviceInfoSet: HDEVINFO;
DeviceInfoData: PSP_DEVINFO_DATA; AProperty: ULONG; Buffer: PAnsiChar;
Length: ULONG): Boolean;
function IsDevDisable(DevIndex: DWORD; hDevInfo: HDEVINFO): Boolean;
function ChangeDevState(DevIndex, NewState: DWORD): BOOL;
public
{ Public declarations }
end;

var
DevForm: TDevForm;

implementation

{$R *.dfm}

procedure TDevForm.EnumNetDevice;
var
DeviceInfoSet: HDEVINFO;
DeviceInfoData: SP_DEVINFO_DATA;
i: Integer;
Status, Problem: DWORD;
ClassName: PChar;
ClassSize, ReqClassSize: DWORD;
DeviceName: PChar;
begin
clbDevList.Clear;

DeviceInfoSet:=SetupDiGetClassDevs(Nil,Nil,0,DIGCF_ALLCLASSES or DIGCF_PRESENT);
if DeviceInfoSet = Pointer(INVALID_HANDLE_VALUE) then
Exit;

ClassSize:=255;
GetMem(ClassName,256);
try
DeviceInfoData.cbSize := SizeOf(SP_DEVINFO_DATA);

i:=0;
while SetupDiEnumDeviceInfo(DeviceInfoSet,i,@DeviceInfoData) do
begin
Inc(i);

if not SetupDiClassNameFromGuid(@DeviceInfoData.ClassGuid,ClassName,ClassSize,
@ReqClassSize) then
begin
if ReqClassSize> ClassSize then
begin
FreeMem(ClassName);
ClassSize:=ReqClassSize;
GetMem(ClassName,ClassSize+1);
if not SetupDiClassNameFromGuid(@DeviceInfoData.ClassGuid,ClassName,ClassSize,
@ReqClassSize) then
Exit;
end
else
Exit;
end;

if not SameText(ClassName,DEV_CLASS_NAME) then
Continue;

if CM_Get_DevNode_Status(@Status, @Problem, DeviceInfoData.DevInst,0)
<> CR_SUCCESS then
Exit;

if ((Status and DN_NO_SHOW_IN_DM) <> 0) or
IsClassHidden(@DeviceInfoData.ClassGuid) then
Continue;

GetMem(DeviceName,256);
ZeroMemory(DeviceName,256);
ConstructDeviceName(DeviceInfoSet,@DeviceInfoData,DeviceName,255);
clbDevList.Items.AddObject(StrPas(DeviceName),TObject(i-1));
clbDevList.Checked[clbDevList.Count-1]:=IsDevDisable(i-1,DeviceInfoSet);
FreeMem(DeviceName);
end;
finally
FreeMem(ClassName);
SetupDiDestroyDeviceInfoList(DeviceInfoSet);