关于win98 和 2k中关闭网络连接(局域网),(100分)

  • 主题发起人 主题发起人 smilboy
  • 开始时间 开始时间
S

smilboy

Unregistered / Unconfirmed
GUEST, unregistred user!
请提供代码
 
const
NETBUFF_SIZE = $208;
type

NetSessionEnum = function(ServerName: LPSTR; Level: DWORD; Bufptr: PBYTE; MaxLen: DWORD; total: LPDWORD; resume_hwnd: LPDWORD): Dword; stdcall;
NetSessionDel = function(ServerName: LPSTR; ClientName: LPSTR; UserName: LPSTR): dword; stdcall;

function NetCloseAll: Boolean;
type
TbyBuff=array[0..NETBUFF_SIZE-1] of byte;
var
byBuff:TBybuff;
dwNetRet,i,dwEntries,dwTotalEntries:dword;
szClient:LPSTR;
dwUserName:LPSTR;
bRet:boolean;
lpbyBuff:^TbyBuff;
h:hwnd;
EnumProc:NetSessionEnum;
DelProc:NetSessionDel;
begin
h:=LoadLibrary('svrapi.dll');
lpbybuff:=@bybuff;
bRet:=false;
if h<>0 then
begin
EnumProc:=GetProcAddress(h,'NetSessionEnum');
DelProc:=GetprocAddress(h,'NetSessionDel');
if Assigned(EnumProc) and Assigned(DelProc) then
begin
dwNetRet:=EnumProc(nil,$32,@byBuff,NETBUFF_SIZE,@dwEntries,@dwTotalEntries);
if dwNetRet=0 then
begin
bRet:=true;
for i:=0 to dwTotalEntries-1 do
begin
szClient:=LPSTR(lpbybuff^[0]);
dwUserName:=LPSTR(LPbybuff^[2]);
dwNetRet:=DelProc(nil,szClient,dwUserName);
if dwNetRet<>0 then
begin
bRet:=false;
break;
end;
lpbybuff:=pointer(integer(lpbybuff)+26);
end;
end; //NetSessionEnum
end
else
bRet:=false;
end //GetProcAddress
else
bRet:=false;
FreeLibrary(h);
result:=bRet;
end;
 
斑竹帮我收回分数行么?
 
接受答案了.
 
后退
顶部