14 15:02:16 JinzhiIPxiugai_:1560 SetValue HKCU\Software\Policies\Microsoft\Windows\Network Connections\NC_EnableAdminProhibits SUCCESS 0x1
15 15:02:16 JinzhiIPxiugai_:1560 CloseKey HKCU\Software\Policies\Microsoft\Windows\Network Connections SUCCESS
16 15:02:16 JinzhiIPxiugai_:1560 CreateKey HKCU\Software\Policies\Microsoft\Windows\Network Connections SUCCESS Access: 0xF003F
17 15:02:16 JinzhiIPxiugai_:1560 SetValue HKCU\Software\Policies\Microsoft\Windows\Network Connections\NC_LanChangeProperties SUCCESS 0x0
18 15:02:16 JinzhiIPxiugai_:1560 CloseKey HKCU\Software\Policies\Microsoft\Windows\Network Connections SUCCESS
2008-08-01上午09:48更新
经过测试后发现,其原理是通过注册表,修改Windows组策略来实现对用户访问的控制,在网上还找到一些其它内容,在这里贴一下.
使系统管理员也受限制
请注意,这个是总开关,不使用它,是没法限制管理员的
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_EnableAdminProhibits"=dword:00000001
禁止TCP协议高级选项
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_AllowAdvancedTCPIPConfig"=dword:00000000
禁止安装和卸载网络协议
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_AddRemoveComponents"=dword:00000000
禁止查看网络状态
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_Statistics"=dword:00000000
禁止访问网络议属性
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_LanChangeProperties"=dword:00000000
禁止启用和停止网络协议
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_ChangeBindState"=dword:00000000
禁止使用网络属性
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_LanProperties"=dword:00000000
禁止停用网卡
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_LanConnect"=dword:00000000
禁止重命名网卡
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Network Connections]
"NC_RenameConnection"=dword:00000000
接下来应该是程序部分了,Borland C++Builder编写.
TRegistry *Registry = new TRegistry; //分配注册表对象
try
{
Registry->RootKey=HKEY_CURRENT_USER;//设置根键
}
catch(...)
{
MessageDlg("注册表项目丢失",mtError,TMsgDlgButtons()<<mbOK, 0);
delete Registry;
Registry=NULL;
}
if(Registry->OpenKey("Software\\Policies\\Microsoft\\Windows",true))//设置主键
{
if(Registry->OpenKey("Network Connections",true))//存在则打开这个Key
{
Registry->WriteInteger("NC_EnableAdminProhibits",1);
Registry->WriteInteger("NC_LanChangeProperties",0);
}
}
delete Registry;
Registry=NULL;
Form2->Edit1->Text="此计算机修改IP受限";
WinExec("explorer ::{7007ACC7-3202-11D1-AAD2-00805FC1270E}", SW_SHOWNORMAL);