<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>四裤全输的小窝～～</title>
<link>http://blogger.org.cn/blog/blog.asp?name=RandomRen</link>
<description>四裤全输的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[谷歌地图定位偏移解决方法]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=72761</link>
<author>RandomRen</author>
<pubDate>2012/7/17 21:04:22</pubDate>
<description><![CDATA[装上google地图后，发现定位总是向西偏移200-500m。
经过试验，可以尝试采用如下方法解决：
1. root explorer进入system文件夹，找到build.prop文件，打开编辑，找ro.cdma.home.operator.numeric，后面的数值改为46003(原来是310120)，保存。关闭网络(飞行)，再打开网络，再打开谷歌地图。

2. 如果1不行，打开build.prop文件，将下面的310120改成46003，us改成cn。

ro.cdma.home.operator.numeric=310120

gsm.sim.operator.numeric=310120

gsm.operator.numeric=310120

gsm.sim.operator.iso-country=us

gsm.operator.iso-country=us

3. 如果2还是不行，到市场下载Market Enabler，将运营商代码改成46003。


转自：http://www.diypda.com/thread-304638-1-1.html]]></description>
</item><item>
<title><![CDATA[【转】利用Windows内置的命令作端口映射]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=72726</link>
<author>RandomRen</author>
<pubDate>2012/6/1 14:57:52</pubDate>
<description><![CDATA[转自:http://www.fengyun.org/bbs/zhuti.asp?bh=118

今天玩了一下ICF（Internet连接防火墙）的端口映射，结果郁闷死，速度奇慢无比，可能是有传输大小的限制，下载了一定的数据后页面就卡住了，一直都没找出个解决方法来，不过还算有进步，我记得以前玩的时候好像是完全不通的：）。
    后来弄了一下netsh，结果还真从netsh里面玩出来个端口映射的，用如下命令即可轻松实现端口映射：
netsh i p a v 8080 www.fengyun.org 80
这样，就把服务器www.fengyun.org的80端口映射到了本机的8080端口。
查看已有的映射命令如下：
netsh i p s v
删除8080端口的映射：
netsh i p de v 8080
注意：XP和2003下可能需要添加IPv6协议，否则上面的命令虽然没有提示错误信息，但不一定会有效果哦。
现在，终于不用CCProxy来做端口映射了 ：）
上面的指令使用了简写，完整写法分别如下：
netsh i p a v => netsh interface portproxy add v4tov4
netsh i p s v => netsh interface portproxy show v4tov4
netsh i p de v => netsh interface portproxy delete v4tov4

XP/2003和Vista/2008上测试均通过。]]></description>
</item><item>
<title><![CDATA[WIN2003服务器安全加固方案]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=72480</link>
<author>RandomRen</author>
<pubDate>2012/3/12 13:30:06</pubDate>
<description><![CDATA[<span id="SpTitle" style="font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 22px; font-weight: bold; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><strong>WIN2003服务器安全加固方案</strong></span><span style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; "><span class="Apple-converted-space">&nbsp;</span></span><br style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><input id="InpRef" value="http://www.4fang.net/article/2010/6/9/95491_1.html" style="font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted; border-top-color: red; border-right-color: red; border-bottom-color: red; border-left-color: red; border-image: initial; width: 400px; font-style: normal; font-variant: normal; font-weight: normal; orphans: 2; white-space: normal; widows: 2; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; " type="text"><br style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span id="SpAuthDate" style="font-family: Arial; font-size: 12px; color: olive; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><strong>jangogo @ 2010-6-9 15:25:00</strong></span><span style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; "></span><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">一．服务器安全加固的重要性</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">因为IIS(即Internet Information Server)的方便性和易用性，使它成为最受欢迎的Web服务器软件之一。但是，IIS的安全性却一直令人担忧。如何利用IIS建立一个安全的Web服务器，是很多人关心的话题。要创建一个安全可靠的Web服务器，必须要实现Windows 2003和IIS的双重安全，因为IIS的用户同时也是Windows 2003的用户，并且IIS目录的权限依赖Windows的NTFS文件系统的权限控制，所以保护IIS安全的第一步就是确保Windows 2000操作系统的安全，所以要对服务器进行安全加固，以免遭到黑客的攻击，造成严重的后果。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">二．我们通过一下几个方面对您的系统进行安全加固：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1．系统的安全加固：我们通过配置目录权限，系统安全策略，协议栈加强，系统服务和访问控制加固您的系统，整体提高服务器的安全性。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">2． IIS手工加固：手工加固iis可以有效的提高iweb站点的安全性，合理分配用户权限，配置相应的安全策略，有效的防止iis用户溢出提权。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">3．系统应用程序加固，提供应用程序的安全性，例如sql的安全配置以及服务器应用软件的安全加固。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">三．系统的安全加固：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1．目录权限的配置：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1.1 除系统所在分区之外的所有分区都赋予Administrators和SYSTEM有完全控制权，之后再对其下的子目录作单独的目录权限，如果WEB站点目录，你要为其目录<strong>权限分配</strong>一个与之对应的匿名访问帐号并赋予它有修改权限，如果想使网站更加坚固，可以分配只读权限并对特殊的目录作可写权限。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1.2 系统所在分区下的根目录都要设置为不继承父权限，之后为该分区只赋予Administrators和SYSTEM有完全控制权。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1.3 因为服务器只有管理员有本地登录权限，所在要配置Documents and Settings这个目录权限只保留Administrators和SYSTEM有完全控制权，其下的子目录同样。另外还有一个隐藏目录也需要同样操作。因为如果你安装有PCAnyWhere那么他的的配置信息都保存在其下，使用webshell或FSO可以轻松的调取这个配置文件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1.4 配置Program files目录，为Common Files目录之外的所有目录赋予Administrators和SYSTEM有完全控制权。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1.5 配置Windows目录，其实这一块主要是根据自身的情况如果使用默认的安全设置也是可行的，不过还是应该进入SYSTEM32目录下，将 cmd.exe、ftp.exe、net.exe、scrrun.dll、shell.dll这些杀手锏程序赋予匿名帐号拒绝访问。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1．6审核MetBase.bin，<strong>C</strong>:\WINNT\system32\inetsrv目录只有administrator只允许Administrator用户读写。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">2．组策略配置:</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在用户权利指派下，从通过网络访问此计算机中删除Power Users和Backup Operators；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用不允许匿名访问SAM帐号和共享；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用不允许为网络验证存储凭据或Passport；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">从文件共享中删除允许匿名登录的DFS$和COMCFG；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用交互登录：不显示上次的用户名；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用在下一次密码变更时不存储LANMAN哈希值；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁止IIS匿名用户在本地登录；</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">3.本地安全策略设置:</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">开始菜单—&gt;管理工具—&gt;本地安全策略</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　A、本地策略——&gt;审核策略</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核策略更改　　　成功　失败　　</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核登录事件　　　成功　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核对象访问　　　　　　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核过程跟踪　　　无审核</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核目录服务访问　　　　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核特权使用　　　　　　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核系统事件　　　成功　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核账户登录事件　成功　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　审核账户管理　　　成功　失败</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">注：在设置审核登陆事件时选择记失败，这样在事件查看器里的安全日志就会记录登陆失败的信息。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　B、本地策略——&gt;用户<strong>权限分配</strong></p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　关闭系统：只有Administrators组、其它全部删除。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　通过终端服务拒绝登陆：加入Guests、User组</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　通过终端服务允许登陆：只加入Administrators组，其他全部删除</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　<strong>C</strong>、本地策略——&gt;安全选项</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　交互式登陆：不显示上次的用户名　　　　　　　启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　网络访问：不允许SAM帐户和共享的匿名枚举　　启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　网络访问：不允许为网络身份验证储存凭证　　　启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　网络访问：可匿名访问的共享　　　　　　　　　全部删除</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　网络访问：可匿名访问的命　　　　　　　　　　全部删除</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　网络访问：可远程访问的注册表路径　　　　　　全部删除</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　网络访问：可远程访问的注册表路径和子路径　　全部删除</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　帐户：重命名来宾帐户　　　　　　　　　　　　重命名一个帐户</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">　　帐户：重命名系统管理员帐户　　　　　　　　　重命名一个帐户</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">4．本地账户策略：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在账户策略-&gt;密码策略中设定：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">密码复杂性要求启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">密码长度最小值 6位</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">强制密码历史 5次</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">最长存留期 30天</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在账户策略-&gt;账户锁定策略中设定：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">账户锁定 3次错误登录</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">锁定时间 20分钟</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">复位锁定计数 20分钟</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5. 修改注册表配置：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.1 通过更改注册表</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">local_machine\system\currentcontrolset\control\lsa-restrictanonymous = 1来禁止139空连接</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.2 修改数据包的生存时间(ttl)值</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">defaultttl reg_dword 0-0xff(0-255 十进制,默认值128)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.3 防止syn洪水攻击</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">synattackprotect reg_dword 0x2(默认值为0x0)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.4禁止响应icmp路由通告报文</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services\tcpip\parameters\interfaces\interface</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">performrouterdiscovery reg_dword 0x0(默认值为0x2)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.5防止icmp重定向报文的攻击</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">enableicmpredirects reg_dword 0x0(默认值为0x1)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.6不支持igmp协议</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.7修改3389默认端口:</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">运行 Regedt32 并转到此项：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp, 找到“PortNumber”子项，您会看到值 00000D3D，它是 3389 的十六进制表示形式。使用十六进制数值修改此端口号，并保存新值。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用不必要的服务不但可以降低服务器的资源占用减轻负担，而且可以增强安全性。下面列出了</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">igmplevel reg_dword 0x0(默认值为0x2)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.8 设置arp缓存老化时间设置</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services:\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">arpcachelife reg_dword 0-0xffffffff(秒数,默认值为120秒)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">arpcacheminreferencedlif<wbr>e reg_dword 0-0xffffffff(秒数,默认值为600)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.9禁止死网关监测技术</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services:\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">enabledeadgwdetect reg_dword 0x0(默认值为ox1)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.10 不支持路由功能</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">hkey_local_machine\system\currentcontrolset\services:\tcpip\parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">ipenablerouter reg_dword 0x0(默认值为0x0)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">6. 禁用服务：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Application Experience Lookup Service</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Automatic Updates</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·BITS</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Computer Browser</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·DHCP Client</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Error Reporting Service</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Help and Support</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Network Location Awareness</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Print Spooler</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Remote Registry</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Secondary Logon</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Server</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Smartcard</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·TCP/IP NetBIOS Helper</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Workstation</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Windows Audio</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Windows Time</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">·Wireless Configuration</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">7．解除NetBios与TCP/IP协议的绑定</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">控制面版——网络——绑定——NetBios接口——禁用 2000：控制面版——网络和拨号连接——本地网络——属性——TCP/IP——属性——高级——WINS——禁用TCP/IP上的NETBIOS</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">8. 使用tcp/ip筛选</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在网络连接的协议里启用TCP/IP筛选，仅开放必要的端口（如80）</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">9．禁止WebDAV</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在注册表：HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">加以下注册表值：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">数值名称：DisableWebDAV</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">数据类型：DWORD</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">数值数据：1</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">四． iis 加固方案：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1. 仅安装必要的 iis 组件。（禁用不需要的如ftp 和 smtp 服务）</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">2. 仅启用必要的服务和 web service 扩展，推荐配置:</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">ui 中的组件名称</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">设置</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">设置逻辑</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">后台智能传输服务 (bits) 服务器扩展</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">bits 是 windows updates 和"自动更新"所使用的后台文件传输机制。如果使用 windows updates 或"自动更新"在 iis 服务器中自动应用 service pack 和热修补程序，则必须有该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">公用文件</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">iis 需要这些文件，一定要在 iis 服务器中启用它们。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">文件传输协议 (ftp) 服务</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">允许 iis 服务器提供 ftp 服务。专用 iis 服务器不需要该服务。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">frontpage 2002 server extensions</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">为管理和发布 web 站点提供 frontpage 支持。如果没有使用 frontpage 扩展的 web 站点，请在专用 iis 服务器中禁用该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">internet 信息服务管理器</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">iis 的管理界面。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">internet 打印</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">提供基于 web 的打印机管理，允许通过 http 共享打印机。专用 iis 服务器不需要该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">nntp 服务</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在 internet 中分发、查询、检索和投递 usenet 新闻文章。专用 iis 服务器不需要该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">smtp 服务</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">支持传输电子邮件。专用 iis 服务器不需要该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">万维网服务</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">为客户端提供 web 服务、静态和动态内容。专用 iis 服务器需要该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">万维网服务子组件</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">ui 中的组件名称</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">安装选项</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">设置逻辑</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">active server page</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">提供 asp 支持。如果 iis 服务器中的 web 站点和应用程序都不使用 asp，请禁用该组件；或使用 web 服务扩展禁用它。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">internet 数据连接器</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">通过扩展名为 .idc 的文件提供动态内容支持。如果 iis 服务器中的 web 站点和应用程序都不包括 .idc 扩展文件，请禁用该组件；或使用 web 服务扩展禁用它。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">远程管理 (html)</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">提供管理 iis 的 html 界面。改用 iis 管理器可使管理更容易，并减少了 iis 服务器的攻击面。专用 iis 服务器不需要该功能。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">远程桌面 web 连接</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">包括了管理终端服务客户端连接的 microsoft activex? 控件和范例页面。改用 iis 管理器可使管理更容易，并减少了 iis 服务器的攻击面。专用 iis 服务器不需要该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">服务器端包括</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">提供 .shtm、.shtml 和 .stm 文件的支持。如果在 iis 服务器中运行的 web 站点和应用程序都不使用上述扩展的包括文件，请禁用该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">webdav</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">禁用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">webdav 扩展了 http/1.1 协议，允许客户端发布、锁定和管理 web 中的资源。专用 iis 服务器禁用该组件；或使用 web 服务扩展禁用该组件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">万维网服务</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">启用</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">为客户端提供 web 服务、静态和动态内容。专用 iis 服务器需要该组件</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">3. 将iis目录&amp;数据与系统磁盘分开，保存在专用磁盘空间内。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">4. 在iis管理器中删除必须之外的任何没有用到的映射（保留asp等必要映射即可）</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5. 在iis中将http404 object not found出错页面通过url重定向到一个定制htm文件</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">6. web站点权限设定（建议）</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">web 站点权限：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">授予的权限：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">读</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">允许</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">写</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">不允许</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">脚本源访问</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">不允许</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">目录浏览</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">建议关闭</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">日志访问</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">建议关闭</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">索引资源</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">建议关闭</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">执行</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">推荐选择 "仅限于脚本"</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">7. 建议使用w3<strong>c</strong>扩充日志文件格式，每天记录客户ip地址，用户名，服务器端口，方法，uri字根，http状态，用户代理，而且每天均要审查日志。（最好不要使用缺省的目录，建议更换一个记日志的路径，同时设置日志的访问权限，只允许管理员和system为full control）。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">8. 程序安全:</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">1) 涉及用户名与口令的程序最好封装在服务器端，尽量少的在asp文件里出现，涉及到与数据库连接地用户名与口令应给予最小的权限;</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">2) 需要经过验证的asp页面，可跟踪上一个页面的文件名，只有从上一页面转进来的会话才能读取这个页面。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">防止asp主页.inc文件泄露问题;</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">4) 防止ue等编辑器生成some.asp.bak文件泄露问题。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">安全更新</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">应用所需的所有 service pack 和定期手动更新补丁。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">安装和配置防病毒保护</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">推荐nav 8.1以上版本病毒防火墙（配置为至少每周自动升级一次）。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">安装和配置防火墙保护</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">推荐最新版blackice server protection防火墙（配置简单，比较实用）</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">监视解决方案</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">根据要求安装和配置 mom代理或类似的监视解决方案。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">加强数据备份</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">web数据定时做备份，保证在出现问题后可以恢复到最近的状态。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">9. 删除不必要的应用程序映射</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">ISS中默认存在很多种应用程序映射，除了ASP的这个程序映射，其他的文件在网站上都很少用到。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在“Internet 服务管理器”中，右击网站目录，选择“属性”，在网站目录属性对话框的“主目录”页面中，点击[配置]按钮，弹出“应用程序配置”对话框，在“应用程序映射”页面，删除无用的程序映射。如果需要这一类文件时，必须安装最新的系统修补补丁，并且选中相应的程序映射，再点击[编辑]按钮，在“添加/编辑应用程序扩展名映射”对话框中勾选“检查文件是否存在”选项。这样当客户请求这类文件时，IIS会先检查文件是否存在，文件存在后才会去调用程序映射中定义的动态链接库来解析。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">保护日志安全</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">日志是系统安全策略的一个重要环节，确保日志的安全能有效提高系统整体安全性。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">修改IIS日志的存放路径</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">默认情况下，IIS的日志存放在%WinDir%/System32/LogFiles，黑客当然非常清楚，所以最好修改一下其存放路径。在 “Internet服务管理器”中，右击网站目录，选择“属性”，在网站目录属性对话框的“Web站点”页面中，在选中“启用日志记录”的情况下，点击旁边的[属性]按钮，在“常规属性”页面，点击[浏览]按钮或者直接在输入框中输入日志存放路径即可。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">&nbsp;<wbr></p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">五。 sql服务器安全加固</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">安装最新的mdac（http://www.microsoft.com/data/download.htm）</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.1 密码策略</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">由于sql server不能更改sa用户名称，也不能删除这个超级用户，所以，我们必须对这个帐号进行最强的保护，当然，包括使用一个非常强壮的密码，最好不要在数据库应用中使用sa帐号。新建立一个拥有与sa一样权限的超级用户来管理数据库。同时养成定期修改密码的好习惯。数据库管理员应该定期查看是否有不符合密码要求的帐号。比如使用下面的sql语句：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">use master</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">select name,password from syslogins where password is null</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.2 数据库日志的记录</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">核数据库登录事件的"失败和成功"，在实例属性中选择"安全性"，将其中的审核级别选定为全部，这样在数据库系统和操作系统日志里面，就详细记录了所有帐号的登录事件。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.3 管理扩展存储过程</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">xp_cmdshell是进入操作系统的最佳捷径，是数据库留给操作系统的一个大后门。请把它去掉。使用这个sql语句：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">use master</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">sp_dropextendedproc ’xp_cmdshell’</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">注：如果你需要这个存储过程，请用这个语句也可以恢复过来。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">sp_addextendedproc ’xp_cmdshell’, ’xpsql70.dll’</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">ole自动存储过程（会造成管理器中的某些特征不能使用），这些过程包括如下（不需要可以全部去掉：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">sp_oacreate sp_oadestroy sp_oageterrorinfo sp_oagetproperty</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">sp_oamethod sp_oasetproperty sp_oastop</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">去掉不需要的注册表访问的存储过程，注册表存储过程甚至能够读出操作系统管理员的密码来，如下：</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">xp_regaddmultistring xp_regdeletekey xp_regdeletevalue xp_regenumvalues</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">xp_regread xp_regremovemultistring xp_regwrite</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">5.4 防tcp/ip端口探测</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在实例属性中选择tcp/ip协议的属性。选择隐藏 sql server 实例。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">请在上一步配置的基础上，更改原默认的1433端口。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">在ipsec过滤拒绝掉1434端口的udp通讯，可以尽可能地隐藏你的sql server。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">对网络连接进行ip限制</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">使用操作系统自己的ipsec可以实现ip数据包的安全性。请对ip连接进行限制，保证只有自己的ip能够访问，拒绝其他ip进行的端口连接。</p><p style="color: rgb(0, 0, 0); font-family: Arial, 微软雅黑, 宋体, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-indent: 2em; ">&nbsp;<wbr></p><p style="color: rgb(0, 0, 0); font-family: Arial,微软雅黑,宋体,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; text-indent: 2em;">通过以上的配置，禁止了服务器开放不必要的端口，防止服务被植入后门程序，通过配置目录权限可以防止入侵者拿到welshell后提权，加强了服务器的安全性，避免了对服务器的攻击和加强了TCP协议栈。通过iis的配置提高了iis的安全性和稳定性。修改了sql server的默认端口，可以防止恶意用户对服务器进行扫描尝试暴力破解sa账户提供数据库的安全性。对服务器实现了整体的安全加固。</p><p style="color: rgb(0, 0, 0); font-family: Arial,微软雅黑,宋体,Helvetica,sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; text-indent: 2em;">转自：<a href="http://www.4fang.net/article/2010/6/9/95491_1.html">http://www.4fang.net/article/2010/6/9/95491_1.html</a></p>]]></description>
</item><item>
<title><![CDATA[[转]sql server 日期比较、日期查询常用语句：月的第一天，季度的第一天等]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=47586</link>
<author>RandomRen</author>
<pubDate>2009/11/26 11:38:26</pubDate>
<description><![CDATA[<A></A>
<P><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: medium Simsun; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><SPAN class=Apple-style-span style="FONT-SIZE: 12px; COLOR: rgb(84,84,84); LINE-HEIGHT: 23px; FONT-FAMILY: &#65533;&#65533;&#65533;&#65533;, &#65533;&#65533;&#65533;&#65533;_gb2312, arial">在SQL SERVER中，你可能需要获得当前日期和计算一些其他的日期，例如，你的程序可能需要判断一个月的第一天或者最后一天。你们大部分人大概都知道怎样把日期进行分割（年、月、日等），然后仅仅用分割出来的年、月、日等放在几个函数中计算出自己所需要的日期！在这篇文章里，我将告诉你如何使用DATEADD和DATEDIFF函数来计算出在你的程序中可能你要用到的一些不同日期。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>在使用本文中的例子之前，你必须注意以下的问题。大部分可能不是所有例子在不同的机器上执行的结果可能不一样，这完全由哪一天是一个星期的第一天这个设置决定。第一天（DATEFIRST）设定决定了你的系统使用哪一天作为一周的第一天。所有以下的例子都是以星期天作为一周的第一天来建立，也就是第一天设置为7。假如你的第一天设置不一样，你可能需要调整这些例子，使它和不同的第一天设置相符合。你可以通过@@DATEFIRST函数来检查第一天设置。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 为了理解这些例子，我们先复习一下DATEDIFF和DATEADD函数。DATEDIFF函数计算两个日期之间的小时、天、周、月、年等时间间隔总数。DATEADD函数计算一个日期通过给时间间隔加减来获得一个新的日期。要了解更多的DATEDIFF和DATEADD函数以及时间间隔可以阅读微软联机帮助。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 使用DATEDIFF和DATEADD函数来计算日期，和本来从当前日期转换到你需要的日期的考虑方法有点不同。你必须从时间间隔这个方面来考虑。比如，从当前日期到你要得到的日期之间有多少时间间隔，或者，从今天到某一天（比如1900-1-1）之间有多少时间间隔，等等。理解怎样着眼于时间间隔有助于你轻松的理解我的不同的日期计算例子。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>一个月的第一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第一个例子，我将告诉你如何从当前日期去这个月的最后一天。请注意：这个例子以及这篇文章中的其他例子都将只使用DATEDIFF和DATEADD函数来计算我们想要的日期。每一个例子都将通过计算但前的时间间隔，然后进行加减来得到想要计算的日期。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这是计算一个月第一天的SQL&nbsp; 脚本：&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; DATEADD(mm,&nbsp; DATEDIFF(mm,0,getdate()),&nbsp; 0)&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我们把这个语句分开来看看它是如何工作的。最核心的函数是getdate()，大部分人都知道这个是返回当前的日期和时间的函数。下一个执行的函数DATEDIFF(mm,0,getdate())是计算当前日期和"1900-01-01&nbsp; 00:00:00.000"这个日期之间的月数。记住：时期和时间变量和毫秒一样是从"1900-01-01&nbsp; 00:00:00.000"开始计算的。这就是为什么你可以在DATEDIFF函数中指定第一个时间表达式为"0"。下一个函数是DATEADD，增加当前日期到"1900-01-01"的月数。通过增加预定义的日期"1900-01-01"和当前日期的月数，我们可以获得这个月的第一天。另外，计算出来的日期的时间部分将会是"00:00:00.000"。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这个计算的技巧是先计算当前日期到"1900-01-01"的时间间隔数，然后把它加到"1900-01-01"上来获得特殊的日期，这个技巧可以用来计算很多不同的日期。下一个例子也是用这个技巧从当前日期来产生不同的日期。&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR><STRONG>本周的星期一</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里我是用周(wk)的时间间隔来计算哪一天是本周的星期一。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; DATEADD(wk,&nbsp; DATEDIFF(wk,0,getdate()),&nbsp; 0)&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>一年的第一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 现在用年(yy)的时间间隔来显示这一年的第一天。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; DATEADD(yy,&nbsp; DATEDIFF(yy,0,getdate()),&nbsp; 0)&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>季度的第一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 假如你要计算这个季度的第一天，这个例子告诉你该如何做。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; DATEADD(qq,&nbsp; DATEDIFF(qq,0,getdate()),&nbsp; 0)&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>当天的半夜</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 曾经需要通过getdate()函数为了返回时间值截掉时间部分，就会考虑到当前日期是不是在半夜。假如这样，这个例子使用DATEDIFF和DATEADD函数来获得半夜的时间点。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; DATEADD(dd,&nbsp; DATEDIFF(dd,0,getdate()),&nbsp; 0)&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>深入DATEDIFF和DATEADD函数计算&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 你可以明白，通过使用简单的DATEDIFF和DATEADD函数计算，你可以发现很多不同的可能有意义的日期。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 目前为止的所有例子只是仅仅计算当前的时间和"1900-01-01"之间的时间间隔数量，然后把它加到"1900-01-01"的时间间隔上来计算出日期。假定你修改时间间隔的数量，或者使用不同的时间间隔来调用DATEADD函数，或者减去时间间隔而不是增加，那么通过这些小的调整你可以发现和多不同的日期。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这里有四个例子使用另外一个DATEADD函数来计算最后一天来分别替换DATEADD函数前后两个时间间隔。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>上个月的最后一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 这是一个计算上个月最后一天的例子。它通过从一个月的最后一天这个例子上减去3毫秒来获得。有一点要记住，在Sql&nbsp; Server中时间是精确到3毫秒。这就是为什么我需要减去3毫秒来获得我要的日期和时间。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; dateadd(ms,-3,DATEADD(mm,&nbsp; DATEDIFF(mm,0,getdate()),&nbsp; 0))&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 计算出来的日期的时间部分包含了一个Sql&nbsp; Server可以记录的一天的最后时刻("23:59:59:997")的时间。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>去年的最后一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 连接上面的例子，为了要得到去年的最后一天，你需要在今年的第一天上减去3毫秒。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; dateadd(ms,-3,DATEADD(yy,&nbsp; DATEDIFF(yy,0,getdate()),&nbsp; 0))&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>本月的最后一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 现在，为了获得本月的最后一天，我需要稍微修改一下获得上个月的最后一天的语句。修改需要给用DATEDIFF比较当前日期和"1900-01-01"返回的时间间隔上加1。通过加1个月，我计算出下个月的第一天，然后减去3毫秒，这样就计算出了这个月的最后一天。这是计算本月最后一天的SQL脚本。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; dateadd(ms,-3,DATEADD(mm,&nbsp; DATEDIFF(m,0,getdate())+1,&nbsp; 0))&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>本年的最后一天</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 你现在应该掌握这个的做法，这是计算本年最后一天脚本&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT&nbsp; dateadd(ms,-3,DATEADD(yy,&nbsp; DATEDIFF(yy,0,getdate())+1,&nbsp; 0))。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>本月的第一个星期一&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR></STRONG>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 好了，现在是最后一个例子。这里我要计算这个月的第一个星期一。这是计算的脚本。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select&nbsp; DATEADD(wk,&nbsp; DATEDIFF(wk,0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dateadd(dd,6-datepart(day,getdate()),getdate())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ),&nbsp; 0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在这个例子里，我使用了"本周的星期一"的脚本，并作了一点点修改。修改的部分是把原来脚本中"getdate()"部分替换成计算本月的第6天，在计算中用本月的第6天来替换当前日期使得计算可以获得这个月的第一个星期一。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR><STRONG>总结</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我希望这些例子可以在你用DATEADD和DATEDIFF函数计算日期时给你一点启发。通过使用这个计算日期的时间间隔的数学方法，我发现为了显示两个日期之间间隔的有用历法是有价值的。注意，这只是计算出这些日期的一种方法。要牢记，还有很多方法可以得到相同的计算结果。假如你有其他的方法，那很不错，要是你没有，我希望这些例子可以给你一些启发，当你要用DATEADD和DATEDIFF函数计算你程序可能要用到的日期时。&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>---------------------------------------------------------------&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR><STRONG>附录，其他日期处理方法</STRONG>&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>1)去掉时分秒&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>declare&nbsp; @&nbsp; datetime&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>set&nbsp; @&nbsp; =&nbsp; getdate()&nbsp; --'2003-7-1&nbsp; 10:00:00'&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>SELECT&nbsp; @,DATEADD(day,&nbsp; DATEDIFF(day,0,@),&nbsp; 0)&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>2）显示星期几&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp; datename(weekday,getdate())&nbsp;&nbsp;&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>3）如何取得某个月的天数&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>declare&nbsp; @m&nbsp; int&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>set&nbsp; @m=2&nbsp; --月份&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp;&nbsp;&nbsp; datediff(day,'2003-'+cast(@m&nbsp; as&nbsp; varchar)+'-15'&nbsp; ,'2003-'+cast(@m+1&nbsp;&nbsp;&nbsp; as&nbsp; varchar)+'-15')&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>另外，取得本月天数&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp;&nbsp;&nbsp; datediff(day,cast(month(GetDate())&nbsp; as&nbsp; varchar)+'-'+cast(month(GetDate())&nbsp; as&nbsp; varchar)+'-15'&nbsp; ,cast(month(GetDate())&nbsp; as&nbsp; varchar)+'-'+cast(month(GetDate())+1&nbsp;&nbsp;&nbsp; as&nbsp; varchar)+'-15')&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>或者使用计算本月的最后一天的脚本，然后用DAY函数区最后一天&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>SELECT&nbsp; Day(dateadd(ms,-3,DATEADD(mm,&nbsp; DATEDIFF(m,0,getdate())+1,&nbsp; 0)))&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>4）判断是否闰年：&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>SELECT&nbsp; case&nbsp; day(dateadd(mm,&nbsp; 2,&nbsp; dateadd(ms,-3,DATEADD(yy,&nbsp; DATEDIFF(yy,0,getdate()),&nbsp; 0))))&nbsp; when&nbsp; 28&nbsp; then&nbsp; '平年'&nbsp; else&nbsp; '闰年'&nbsp; end&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>或者&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp; case&nbsp; datediff(day,datename(year,getdate())+'-02-01',dateadd(mm,1,datename(year,getdate())+'-02-01'))&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>when&nbsp; 28&nbsp; then&nbsp; '平年'&nbsp; else&nbsp; '闰年'&nbsp; end&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;<BR>5）一个季度多少天&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>declare&nbsp; @m&nbsp; tinyint,@time&nbsp; smalldatetime&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp; @m=month(getdate())&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp; @m=case&nbsp; when&nbsp; @m&nbsp; between&nbsp; 1&nbsp; and&nbsp; 3&nbsp; then&nbsp; 1&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when&nbsp; @m&nbsp; between&nbsp; 4&nbsp; and&nbsp; 6&nbsp; then&nbsp; 4&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when&nbsp; @m&nbsp; between&nbsp; 7&nbsp; and&nbsp; 9&nbsp; then&nbsp; 7&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp; 10&nbsp; end&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp; @time=datename(year,getdate())+'-'+convert(varchar(10),@m)+'-01'&nbsp;<SPAN class=Apple-converted-space>&nbsp;</SPAN><BR>select&nbsp; datediff(day,@time,dateadd(mm,3,@time))</SPAN></SPAN></P>
<P><SPAN class=Apple-style-span style="WORD-SPACING: 0px; FONT: medium Simsun; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; webkit-border-horizontal-spacing: 0px; webkit-border-vertical-spacing: 0px; webkit-text-decorations-in-effect: none; webkit-text-size-adjust: auto; webkit-text-stroke-width: 0px"><SPAN class=Apple-style-span style="FONT-SIZE: 12px; COLOR: rgb(84,84,84); LINE-HEIGHT: 23px; FONT-FAMILY: &#65533;&#65533;&#65533;&#65533;, &#65533;&#65533;&#65533;&#65533;_gb2312, arial"><FONT color=#000000>转自：</FONT><A href="http://www.lvbaishun.com/Information/2009-07/0907202309007575.html">http://www.lvbaishun.com/Information/2009-07/0907202309007575.html</A><FONT color=#000000> </FONT></SPAN></SPAN></P>]]></description>
</item><item>
<title><![CDATA[MediaCoder 一般参数设置]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=47148</link>
<author>RandomRen</author>
<pubDate>2009/9/27 13:14:56</pubDate>
<description><![CDATA[http://wiki.broadintel.com/MediaCoder:Basics/zh

记录一下，以备下次使用好查看。]]></description>
</item><item>
<title><![CDATA[[转]VMware中创建共享磁盘阵列的方法]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=46761</link>
<author>RandomRen</author>
<pubDate>2009/8/4 17:19:28</pubDate>
<description><![CDATA[<P>转自：<A href="http://www.yesadmin.com/648/140801/index.html">http://www.yesadmin.com/648/140801/index.html</A><BR><BR>VMware中创建共享磁盘阵列的方法<BR>关于VMWare GSX Server的下载及注册,我提供的是嬴政的下载地址(<A href="http://soft.winzheng.com">http://soft.winzheng.com</A>),如果下载不了请 <BR>多试几次, <BR>VMWare GSX Server注册码:8TTR5-MH8DM-N7MA2-1LMV4 <BR>VMWare Workstation:下载地址:http://download3.vmware.com/software/wkst/VMware-workstation-3.2.1-2237.exe <BR>注册码: 68M29-DKQ4N-7FQA1-3V0CD </P>
<P>3.关于plainmaker.exe,在GSX安装目录下肯定有这个文件,我把这个文件传到了网上,请大家下载.有这个文件后 <BR>就可以在VMWare Workstation和GSX Server创建共享磁盘阵列. </P>
<P>下面我详细说一下在VMware中创建共享磁盘阵列的方法: <BR>1.将plainmaker.exe考到第一个虚拟机的目录下,如"C:\vmwin2k1\Windows 2000 Professional" <BR>执行以下命令将创建200M和2G的日志磁盘和共享磁盘: <BR>plainmaker quorum.pln 200&nbsp; <BR>plainmaker shareddisk.pln 2000&nbsp; </P>
<P>确认"C:\vmwin2k1\Windows 2000 Professional"目录下生成了四个quorum.pln,shareddisk.pln,quorum1.dat,shareddisk1.dat，分别打开&nbsp; <BR>quorum.pln，shareddisk.pln <BR>确认ACCESS一行的目录为当前虚拟机的目录。&nbsp; <BR>如：Access "C:\vmwin2k1\Windows 2000 Professional\quorum1.dat"&nbsp; <BR>Access "C:\vmwin2k1\Windows 2000 Professional\shareddisk1.dat"&nbsp; </P>
<P>2.在第一台虚拟机的"configuration Editor"中，添加创建的日志磁盘和共享磁盘：Add-HardDisk-use an exciting disk-brower-选中第一台虚拟机目录中quorum.pln,shareddisk.pln <BR>&nbsp; <BR>打开第一台虚拟机目录中的vmx文件，在最后一行添加： <BR>disk.locking="FALSE"&nbsp; <BR>scsi0.SharedBus="Virtual" </P>
<P>3.在第二台虚拟机的"configuration Editor"中，添加创建的日志磁盘和共享磁盘：Add-HardDisk-use an exciting disk-brower-选中第一台虚拟机目录中quorum.pln,shareddisk.pln <BR>&nbsp; <BR>打开第二台虚拟机目录中的vmx文件，在最后一行添加： <BR>disk.locking="FALSE"&nbsp; <BR>scsi0.SharedBus="Virtual" </P>
<P>第二步和第三步将创建的日志磁盘和共享磁盘做成了共享磁盘阵列(两台虚拟机同时使用第一台虚拟机目录中的quorum.pln,shareddisk.pln) </P>
<P>4.先打开第一台虚拟机,在打开第二台虚拟机,打开后,执行第一台虚拟机的"计算机管理-磁盘管理, <BR>取消"欢迎使用写入签名和升级磁盘向导"-右击磁盘1-签名-签名后请对磁盘1和磁盘2进行分区格式化. </P>
<P>执行第二台虚拟机的"计算机管理-磁盘管理, <BR>取消"欢迎使用写入签名和升级磁盘向导"-右击磁盘1-签名-签名后请对磁盘1和磁盘2进行分区格式化.<BR></P>]]></description>
</item><item>
<title><![CDATA[微软的官方方法：延长Windows Server 2008试用期限到240天]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=36136</link>
<author>RandomRen</author>
<pubDate>2008/5/29 10:15:32</pubDate>
<description><![CDATA[<P>微软的官方方法：延长Windows Server 2008试用期限到240天<BR>参阅<A href="http://support.microsoft.com/kb/948472" target=_blank><FONT color=#810081>http://support.microsoft.com/kb/948472</FONT></A><BR><BR>无需下载第三方软件，像timestop.exe什么的。<BR>（这么简单的方法不用，还要编译个可执行文件发布，不知是何居心）<BR><BR>运行：<B>slmgr.vbs -dli </B>显示剩余试用天数<BR>运行：<B>slmgr.vbs –rearm</B> 重置评估周期为60天<BR><BR>最多可重置三次，使得Windows Server 2008最大试用期限至240天。</P>]]></description>
</item><item>
<title><![CDATA[cxGrid 过滤 排序后 取选中记录的值]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=31278</link>
<author>RandomRen</author>
<pubDate>2008/1/14 14:46:53</pubDate>
<description><![CDATA[<P>控件版本：<BR>&#160; ExpressQuantumGrid Suite 6.30<BR><BR>方法一：<BR>使用函数GetRowValue<BR>此方法在表格过滤、排序后也正常<BR>procedure TfrmBillExtraction.pmGetBill_D_DatasClick(Sender: TObject);<BR>var<BR>&#160; I,J : Integer;<BR>begin<BR>&#160; with cxGDBTV_Bill_M.DataController,cxGDBTV_Bill_M.DataController.DataSet do<BR>&#160; begin<BR>&#160;&#160;&#160; for I := 0 to GetSelectedCount-1 do<BR>&#160;&#160;&#160; begin<BR>&#160;&#160;&#160;&#160;&#160; J := GetSelectedRowIndex(I);<BR>&#160;&#160;&#160;&#160;&#160; //取选中行，列名为sMergeNO的值<BR>&#160;&#160;&#160;&#160;&#160; ShowMessage(Trim(GetRowValue(GetRowInfo(J),FieldByName('sMergeNo').Index)));<BR>&#160;&#160;&#160; end;<BR>&#160; end;<BR>end;<BR><BR><BR>方法二：<BR>使用函数：GetValue<BR>此方法开了过滤、排序后不正常，请大家注意。<BR>procedure TfrmBillExtraction.pmGetBill_D_DatasClick(Sender: TObject);<BR>var<BR>&#160; I,J : Integer;<BR>begin<BR>&#160; with cxGDBTV_Bill_M.DataController,cxGDBTV_Bill_M.DataController.DataSet do<BR>&#160; begin<BR>&#160;&#160;&#160; for I := 0 to GetSelectedCount-1 do<BR>&#160;&#160;&#160; begin<BR>&#160;&#160;&#160;&#160;&#160; J := GetSelectedRowIndex(I);<BR>&#160;&#160;&#160;&#160;&#160; //取选中行，列名为sMergeNO的值<BR>&#160;&#160;&#160;&#160;&#160; ShowMessage(Trim(GetValue(J,FieldByName('sMergeNo').Index)));<BR>&#160;&#160;&#160; end;<BR>&#160; end;<BR>end;</P>
<P>方法三：<BR>直接取表格的显示值，这个应该算是比如好了的。经测试，拖动、分组、过滤等操作都不会影响取值。<BR><BR>for i:= 0 to AView.Controller.SelectedRowCount-1 do begin<BR>&#160;&#160; showmessage(AView.DataController.GetDisplayText(AView.Controller.SelectedRows[i].RecordIndex,AView.DataController.GetItemByFieldName('sMergeNo').Index));<BR>end;<BR></P>
<P>方法四：<BR>
https://www.devexpress.com/Support/Center/Question/Details/A302]]></description>
</item><item>
<title><![CDATA[TreeView 父节点 子节点 状态一致]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=31241</link>
<author>RandomRen</author>
<pubDate>2008/1/11 22:39:28</pubDate>
<description><![CDATA[<A></A>
<P>今天晚上写用户组管理,需要对树进行操作.主要是勾选状态的一致性比较难处理,在网上搜索了一下没结果,就自己动手写了一个.核心函数主要有三个,供大家参考,如果还有更好的算法,希望大家能交流.<BR>注:我所用的是cxTreeView<BR><BR>&nbsp;&nbsp;&nbsp; //所有子节点是否有处于选中状态<BR>&nbsp;&nbsp;&nbsp; function ChildChecked(TreeNode:TTreeNode):Boolean;<BR>&nbsp;&nbsp;&nbsp; //改变所有子节点状态<BR>&nbsp;&nbsp;&nbsp; procedure ChangeChildState(sParent:TTreeNode;StateIndex:Integer);<BR>&nbsp;&nbsp;&nbsp; //改变父节点状态<BR>&nbsp;&nbsp;&nbsp; procedure ChangeParentState(TreeNode:TTreeNode;StateIndex:Integer);<BR><BR>function TfrmRole.ChildChecked(TreeNode:TTreeNode):Boolean;<BR>var<BR>&nbsp; I : Integer;<BR>begin<BR>&nbsp; Result := False;<BR>&nbsp; for I := 0 to TreeNode.Count - 1 do<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp; if TreeNode[I].HasChildren then<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if&nbsp; 2 = TreeNode[I].StateIndex then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Result := True;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChildChecked(TreeNode[I]);<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; else begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if&nbsp; 2 = TreeNode[I].StateIndex then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Result := True;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp; end;<BR>end;<BR><BR>procedure TfrmRole.ChangeChildState(sParent: TTreeNode; StateIndex: Integer);<BR>var<BR>&nbsp; I : Integer;<BR>begin<BR>&nbsp; sParent.StateIndex := StateIndex;<BR>&nbsp; for I := 0 to sParent.Count - 1 do<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp; if sParent[I].HasChildren then<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sParent[I].StateIndex := StateIndex;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChangeChildState(sParent[I],StateIndex);<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sParent[I].StateIndex := StateIndex;<BR>&nbsp; end;<BR>end;<BR><BR>procedure TfrmRole.ChangeParentState(TreeNode: TTreeNode; StateIndex: Integer);<BR>var<BR>&nbsp; I : Integer;<BR>begin<BR>&nbsp; if TreeNode.Parent = nil then<BR>&nbsp;&nbsp;&nbsp; Exit;<BR>&nbsp; //如果父节点是勾选状态,则要判断是否有其它节点是勾选状态,如果有,则退出,保持勾选<BR>&nbsp; if 2 = TreeNode.Parent.StateIndex then<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp; if ChildChecked(TreeNode.Parent) then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit;<BR>&nbsp; end;<BR>&nbsp; TreeNode.Parent.StateIndex := StateIndex;<BR>&nbsp; ChangeParentState(TreeNode.Parent,StateIndex);<BR>end;<BR><BR>这段代码也比较有用,这个是点中节点才改变状态,点树上的"+""-"不会触发.<BR><BR>procedure TfrmRole.cxTV_MenuMouseDown(Sender: TObject; Button: TMouseButton;<BR>&nbsp; Shift: TShiftState; X, Y: Integer);<BR>var<BR>&nbsp; MyHitTest : THitTests;<BR>&nbsp; tn : TTreeNode;<BR>begin<BR>&nbsp; inherited;<BR>&nbsp; MyHitTest := cxTV_Menu.GetHitTestInfoAt(X,Y);<BR>&nbsp; tn:=TcxTreeView(Sender).GetNodeAt(x,y);<BR>&nbsp; if tn=nil then<BR>&nbsp;&nbsp;&nbsp; Exit;<BR>&nbsp; if htOnItem in MyHitTest then<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp; if 1 = tn.StateIndex then<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChangeChildState(tn,2);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChangeParentState(tn,2);<BR>&nbsp;&nbsp;&nbsp; end<BR>&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChangeChildState(tn,1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ChangeParentState(tn,1);<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp; end;<BR>end;<BR>效果:<BR>1 全部不选择:<BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=全部不选择 src="http://blogger.org.cn/blog/uploadfile/2008111225121107.GIF" border=0><BR>2 选计量单位:<BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=选计量单位 src="http://blogger.org.cn/blog/uploadfile/2008111225049668.GIF" border=0><BR><BR>3 选资信等级<BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=选资信等级 src="http://blogger.org.cn/blog/uploadfile/2008111225213325.GIF" border=0><BR><BR>4 取消选择计量单<BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=取消选择计量单 src="http://blogger.org.cn/blog/uploadfile/200811122531323.GIF" border=0><BR><BR>5 只取消选择"计量单位修改"<BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=只取消选择 src="http://blogger.org.cn/blog/uploadfile/2008111225436615.GIF" border=0 计量单位修改??><BR><BR>稍候整理一下.把源码也上传上来.</P>]]></description>
</item><item>
<title><![CDATA[DevExpress v30 汉化包]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=31159</link>
<author>RandomRen</author>
<pubDate>2008/1/9 13:52:08</pubDate>
<description><![CDATA[<P>&nbsp; 此汉化包是以DevExpress v30 基础上进行汉化的，下载后直接覆盖源文件即可，经测试，没有问题，但还是提醒大家注意备份源文件。<BR>&nbsp; 此包只汉化了表格右键菜单和过滤部门，窗体部分没汉化，效果如下：<BR>&nbsp; <IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=表头菜单 src="http://blogger.org.cn/blog/uploadfile/200819135752436.GIF" border=0><BR><BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=脚注 src="http://blogger.org.cn/blog/uploadfile/200819135835572.GIF" border=0><BR><BR><IMG style="BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM-COLOR: #000000; BORDER-TOP-COLOR: #000000; BORDER-RIGHT-COLOR: #000000" alt=过滤 src="http://blogger.org.cn/blog/uploadfile/20081913595157.GIF" border=0><BR><BR>文件下载：<BR><IMG src="http://blogger.org.cn/blog/images/file/zip.gif" border=0><A href="http://blogger.org.cn/blog/uploadfile/200819135934407.RAR" target=_blank>DevExpressVCLV 汉化包.rar</A></P>]]></description>
</item><item>
<title><![CDATA[用SPCOMM 接收数据会出错丢失，怎样解决？]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=31146</link>
<author>RandomRen</author>
<pubDate>2008/1/9 10:05:14</pubDate>
<description><![CDATA[<P>"我用spcomm 接收数据，会出现数据丢失的现象。<BR><BR>如用SPCOMM 触发方式接收发下数据 <BR>bb bb 57 57 11 01 00 00 00 00 <BR><BR>其中会出现接收BB BB 57 57 01 00 00 00 00 会丢失11，不知有何方法解决？"<BR><BR>发表者：xiangdie<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 把outtx_xonxoffflow属性赋为false&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 再不行就把inx_xonxoffflow也置为false;</P>
<P>发表者：framesniper<BR>数据丢失个人感觉应该是硬件问题，不太可能是spcomm本身出现问题</P>
<P>发表者：jpyc<BR>$11/$13是用于软件握手的，将xonxoff属性相关的关闭就可以了。与硬件无关。&nbsp;&nbsp;&nbsp;<BR></P>]]></description>
</item><item>
<title><![CDATA[压缩日志及数据库文件大小]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=31025</link>
<author>RandomRen</author>
<pubDate>2008/1/4 15:06:55</pubDate>
<description><![CDATA[<P>转自：<A href="http://topic.csdn.net/t/20051004/20/4307435.html">http://topic.csdn.net/t/20051004/20/4307435.html</A><BR>压缩日志及数据库文件大小 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; /*--特别注意 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 请按步骤进行,未进行前面的步骤,请不要做后面的步骤 &nbsp; <BR>&nbsp; 否则可能损坏你的数据库. &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 一般不建议做第4,6两步 &nbsp; <BR>&nbsp; 第4步不安全,有可能损坏数据库或丢失数据 &nbsp; <BR>&nbsp; 第6步如果日志达到上限,则以后的数据库处理会失败,在清理日志后才能恢复. &nbsp; <BR>&nbsp; --*/ &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; --下面的所有库名都指你要处理的数据库的库名 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 1.清空日志 &nbsp; <BR>&nbsp; DUMP &nbsp; &nbsp; TRANSACTION &nbsp; &nbsp; 库名 &nbsp; &nbsp; WITH &nbsp; &nbsp; NO_LOG &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 2.截断事务日志： &nbsp; <BR>&nbsp; BACKUP &nbsp; LOG &nbsp; 库名 &nbsp; WITH &nbsp; NO_LOG &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 3.收缩数据库文件(如果不压缩,数据库的文件不会减小 &nbsp; <BR>&nbsp; 企业管理器--右键你要压缩的数据库--所有任务--收缩数据库--收缩文件 &nbsp; <BR>&nbsp; --选择日志文件--在收缩方式里选择收缩至XXM,这里会给出一个允许收缩到的最小M数,直接输入这个数,确定就可以了 &nbsp; <BR>&nbsp; --选择数据文件--在收缩方式里选择收缩至XXM,这里会给出一个允许收缩到的最小M数,直接输入这个数,确定就可以了 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 也可以用SQL语句来完成 &nbsp; <BR>&nbsp; --收缩数据库 &nbsp; <BR>&nbsp; DBCC &nbsp; SHRINKDATABASE(库名) &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; --收缩指定数据文件,1是文件号,可以通过这个语句查询到:select &nbsp; * &nbsp; from &nbsp; sysfiles &nbsp; <BR>&nbsp; DBCC &nbsp; SHRINKFILE(1) &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 4.为了最大化的缩小日志文件(如果是sql &nbsp; 7.0,这步只能在查询分析器中进行) &nbsp; <BR>&nbsp; a.分离数据库: &nbsp; <BR>&nbsp; 企业管理器--服务器--数据库--右键--分离数据库 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; b.在我的电脑中删除LOG文件 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; c.附加数据库: &nbsp; <BR>&nbsp; 企业管理器--服务器--数据库--右键--附加数据库 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 此法将生成新的LOG，大小只有500多K &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 或用代码： &nbsp; &nbsp; <BR>&nbsp; 下面的示例分离 &nbsp; pubs，然后将 &nbsp; pubs &nbsp; 中的一个文件附加到当前服务器。 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; a.分离 &nbsp; <BR>&nbsp; EXEC &nbsp; sp_detach_db &nbsp; @dbname &nbsp; = &nbsp; '库名' &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; b.删除日志文件 &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; c.再附加 &nbsp; <BR>&nbsp; EXEC &nbsp; sp_attach_single_file_db &nbsp; @dbname &nbsp; = &nbsp; '库名', &nbsp; &nbsp; <BR>&nbsp; &nbsp; &nbsp; &nbsp; @physname &nbsp; = &nbsp; 'c:\Program &nbsp; Files\Microsoft &nbsp; SQL &nbsp; Server\MSSQL\Data\库名.mdf' &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 5.为了以后能自动收缩,做如下设置: &nbsp; <BR>&nbsp; 企业管理器--服务器--右键数据库--属性--选项--选择"自动收缩" &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; --SQL语句设置方式: &nbsp; <BR>&nbsp; EXEC &nbsp; sp_dboption &nbsp; '库名', &nbsp; 'autoshrink', &nbsp; 'TRUE' &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; 6.如果想以后不让它日志增长得太大 &nbsp; <BR>&nbsp; 企业管理器--服务器--右键数据库--属性--事务日志 &nbsp; <BR>&nbsp; --将文件增长限制为xM(x是你允许的最大数据文件大小) &nbsp; <BR>&nbsp; &nbsp; <BR>&nbsp; --SQL语句的设置方式: &nbsp; <BR>&nbsp; alter &nbsp; database &nbsp; 库名 &nbsp; modify &nbsp; file(name=逻辑文件名,maxsize=20) </P>]]></description>
</item><item>
<title><![CDATA[在Delphi中应用MVC结构]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=30865</link>
<author>RandomRen</author>
<pubDate>2007/12/29 14:54:31</pubDate>
<description><![CDATA[<P>该文章转载自网络大本营：<A href="http://www.xrss.cn/Dev/Delphi/20078815527.Html">http://www.xrss.cn/Dev/Delphi/20078815527.Html</A></P>
<P>一、&nbsp; 参考资料<BR>1、J2EE技术内幕(J2EE Unleashed)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 机械工业出版社(SAMS)</P>
<P>&nbsp;</P>
<P>二、&nbsp; 传统的应用开发模式<BR>&nbsp;&nbsp;&nbsp; 传统的应用开发是围绕着事件驱动用户界面来组织应用结构。在该模式中，开发人员创建界面，然后在界面的事件中编写相应的动作。对于小型，业务清晰，而且不用重复进行功能、业务修改的应用系统来说，这种模式明显很合适，不但直观，而且方便，开发与运行效率也很高。但对于较大型系统或分布系统，则不一定合适。<BR>&nbsp; l、大多数复杂的应用需要以多种查看数据的方式来查看数据。直接在界面中编写代码导致在系统的多个模块中出现重复，业务的变更需要在多处进行修改。<BR>&nbsp; 2、数据操作逻辑、格式化、显示代码同用户事件等代码混在一起时，应用的维护变得非常困难。如果经过一段时间后、或由外人修改代码时，情况可想而知。<BR>&nbsp; 3、如果应用逻辑与界面混在一起时，用户界面或应用逻辑都不能被重用。<BR>&nbsp; 4、增加、修改功能、界面都需要对代码进行多处的修改，而这样的修改被会非常困难。<BR>&nbsp; 5、由于应用逻辑与界面依赖程度太高，造成在团体开发中，无法由多人来开发一个模块。</P>
<P>&nbsp;</P>
<P>三、&nbsp; MVC结构简述<BR>&nbsp;&nbsp;&nbsp; MVC结构即是：模型(Model)-视图(VIEW)-控制器(CONTROLOR)模式。模型代表了应用数据和操作这些数据的方法；视图向用户显示这些数据并接受用户的操作事件，然后转发给控制器；控制器负责解释用户的动作，并把操作发送给模型。然后模型更新视图，反映数据的变化。在模型中不应包含对输入数据格式的翻译工作，该翻译工作由控制器执行，而模型不应该负责判断如何显示结果。<BR>&nbsp;&nbsp;&nbsp; MVC结构中VC中很早就开始使用，在J2EE中得到进一步的推广与完善，现在已经是分布式系统中的一种必选模式了。可惜JinBo以前一直忙于项目，没有时间进行充电，在Delphi中分离应用逻辑与界面设计这方面走了不少弯路，最近才发现MVC结构就是我想要达到的目标，心里那个是恨啊。</P>
<P>&nbsp;</P>
<P>四、&nbsp; MVC结构的优缺点<BR>优点：<BR>&nbsp; 1、通过从数据显示和用户交互中分离出数据模型澄清的应用设计。<BR>&nbsp; 2、允许使用多种方式观察相同数据。<BR>&nbsp; 3、从表示部分分离出应用功能，增强重用性。<BR>&nbsp; 4 、增加灵活性，因为数据模型、用户交互和数据显示可以是可拆装的。<BR>&nbsp; 5、把应用系统的功能划分由模块变为对象，真正地进行面向对象的系统分析。<BR>缺点：<BR>&nbsp; 1、组件间不能实现代码共享，导致应用复杂程度上升，效率下降。(JinBo个人认为Java的运行效率低的其中一个原因就是强调面向对象。假如Java类库设计得跟MFC一样的话，肯定效率会上升很多)<BR>&nbsp; 2、存在更多的通信量和其他潜在问题，开发人员必须小心处理。<BR>&nbsp; 3、模型的设计要求更高，而控制器对模型的依赖很高，模型设计的不合理将导致控制器实现很困难。可以配合设计模式中的命令模式来改善这一点。</P>
<P>&nbsp;</P>
<P>五、&nbsp; 个人的体会<BR>&nbsp;&nbsp;&nbsp; 在Delphi这事件驱动的开发环境中，很自然地大部分开发人员直接以传统方式进行应用系统的开发。然后项目进行到一定的时间，需求变化了很多，回头一看，程序中有很多地方还是可重用，但是打算提取出来时却发现里面千丝万缕，界面、应用逻辑代码纠缠不清，把有用的地方切割出来还不如重新再写。于是项目的新版本只能重新开发了。这样的情况我相信做过一、两个项目的开发人员都会有比较大的体会。而使用MVC结构来将界面与应用逻辑分离将在一定程序上能解决这个问题。<BR>&nbsp;&nbsp;&nbsp; 关于代码重用，个人的意见是在众多项目中做到代码重用还是非常困难的，但是在一个项目的多个版本中达到代码重用却是可行的，并且有相当大的实际意义，这也是我在Delphi中应用MVC结构的目的。</P>
<P>&nbsp;</P>
<P>六、&nbsp; 在Delphi中的应用<BR>&nbsp;&nbsp;&nbsp; 将Delphi系统中的一个功能或模块划分为视图(窗体)、控制器、模型等三个部分。视图直接面对用户，显示数据并接受用户的操作事件，视图中只包括视图本身的维护代码，如控件间的互动，状态的设定等。而视图中表示的数据定义为视图中的一个或多个属性。控制器负责对用户的事件进行响应，然后转发给模型，由模型进行实际的操作，即干拉皮条的活。模型是真正干活的主，包含全部的应用逻辑代码，直接操纵数据库如果需要的话。<BR>&nbsp;&nbsp;&nbsp; 我所提到的应用方式中，实际上是将控制器作为一个入口，供其它类调用。而且作为视图与模型沟通的桥梁，视图与模型都先经过控制器的访问，它们使用的一些资源、类等都在控制器中定义。因此，控制器在这种方式中，可重用性是最低的。<BR>&nbsp;&nbsp;&nbsp; 当然，如果功能太简单，比如AboutDailog等，就不必强求整个系统都以这种方式来构造，这时编码就足够了。对于不大不小的功能或模块，则可以根据实际的情况，将控制器与视图进行结合，而将模型分离来，这是因为应用逻辑相同与界面来说，需求变化的可能性更小，而应用逻辑需求变化后界面不变的可能性就更小了。这样模型同样还具备相当大的重用性。<BR>&nbsp;&nbsp;&nbsp; 在具体应用中，将视图、控制器、模型做到完全相互独立，都具备用重用性，还是非常困难的。因此，建议将MVC三个组件都进行更高层次的抽象，把共性的部分提炼出来，然后将它们的父类作为用重用的类。如果业务没有那么复杂或提炼有困难，可以将不可重用的代码集中在视图或控制器，然后保证其他的组件具备一定的重用性。如果还是不行，那就算了吧，该怎么着就怎么着，不要勉强了，呵呵。</P>
<P>&nbsp;</P>
<P>七、&nbsp; 实现的细节问题<BR>1、&nbsp; 一般点击事件。<BR>这里指的是一些简单的操作性质事件，如保存、删除等，直接由控制器转发由模型执行业务处理类即可<BR>procedure TfrmExampleView.btnSaveClick(Sender: TObject);<BR>begin<BR>&nbsp; ExampleCtrl.ExampleModel.Save;<BR>end;</P>
<P>&nbsp;</P>
<P>2、&nbsp; 设定界面控件的状态或属性。<BR>将控件的状态或属性都定义为窗体的属性或方法，然后控制器可以通过设定属性或调用方法来达到设定界面控件状态的目的.</P>
<P>&nbsp;</P>
<P>例：需在运行时设定窗体中的若干个控件为只读或可读写状态。则在该窗体中定义只读属性，并编写相关代码，然后控制器简单地设定该属性为TRUE或FALSE来达到目的。</P>
<P>&nbsp;</P>
<P>视图中定义EditReadOnly属性，该属性决定了leName等多个控件的可读定状态<BR>TfrmExampleView = class(TForm)<BR>&nbsp; tvExample: TTreeView;<BR>&nbsp; leName: TLabeledEdit;<BR>&nbsp; …<BR>private<BR>&nbsp; …<BR>&nbsp; function GetReadOnly: boolean;<BR>&nbsp; procedure SetReadOnly(const Value: boolean);<BR>public<BR>&nbsp; …<BR>&nbsp; property EditReadOnly : boolean read GetReadOnly write SetReadOnly;<BR>end;</P>
<P>&nbsp;</P>
<P>procedure TfrmExampleView.SetReadOnly(const Value: boolean);<BR>begin<BR>&nbsp; leName.ReadOnly = Value;<BR>&nbsp; …<BR>end;</P>
<P>&nbsp;</P>
<P>function TfrmExampleView.GetReadOnly: boolean;<BR>begin<BR>&nbsp; result := leName.ReadOnly;<BR>end;<BR>&nbsp;&nbsp;&nbsp; 然后在控制器中设定视图控件的状态就很简单了。<BR>&nbsp;&nbsp;&nbsp; frmExampleView.EditReadOnly := True;</P>
<P>&nbsp;</P>
<P>3、&nbsp; 对视图数据的读取、更新。<BR>&nbsp;&nbsp;&nbsp; 对视图进行数据读取、更新时，分为两种情况，一种数据量比较小，如对某个Edit的赋值，应该使用刚才的方式，在视图中增加一个属性，然后进行属性的设置。<BR>&nbsp; TfrmExampleView = class(TForm)<BR>&nbsp; public<BR>&nbsp;&nbsp; property UserName : string read GetUserName write SetUserName;<BR>&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp; function TfrmExampleView.GetUserName: string;<BR>&nbsp; begin<BR>&nbsp;&nbsp; result := Trim(leName.Text);<BR>&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp; procedure TfrmExampleView.SetUserName(const Value: string);<BR>&nbsp; begin<BR>&nbsp;&nbsp; leName.Text := Value;<BR>&nbsp; end;</P>
<P>&nbsp;</P>
<P><BR>&nbsp; 对于比较大量的数据更新，如TStringGrid、多个TEdit的赋值、取值，可以利用J2EE设计模式中值对象(即有多个属性的对象)，控制器将一个值对象传递给视图或模型，然后视图或模型自己对值对象进行操作。</P>
<P>&nbsp;</P>
<P>&nbsp; 先定义一个值对象<BR>&nbsp; TUserValueObject = class<BR>&nbsp;&nbsp; private<BR>&nbsp;&nbsp; FUserName: string;<BR>&nbsp;&nbsp; FUserID: integer;<BR>&nbsp;&nbsp; FUserTel: string;<BR>&nbsp;&nbsp;&nbsp; …<BR>&nbsp;&nbsp; public<BR>&nbsp;&nbsp; property UserID : integer read FUserID write FUserID;<BR>&nbsp;&nbsp; property UserName : string read FUserName write FUserName;<BR>&nbsp;&nbsp; property UserTel : string read FUserTel write FUserTel;<BR>&nbsp;&nbsp;&nbsp; …<BR>&nbsp;&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; 在视图中定义一个值对象的属性<BR>&nbsp;&nbsp;&nbsp; TfrmExampleView = class(TForm)<BR>&nbsp;&nbsp;&nbsp;&nbsp; private<BR>&nbsp;&nbsp;&nbsp;&nbsp; function GetValues: TUserValueObject;<BR>&nbsp;&nbsp;&nbsp;&nbsp; procedure SetValues(const Value: TUserValueObject);<BR>&nbsp;&nbsp;&nbsp;&nbsp; public<BR>&nbsp;&nbsp;&nbsp;&nbsp; property Values : TUserValueObject read GetValues write SetValues;<BR>&nbsp;&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; function TfrmExampleView.GetValues: TUserValueObject;<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp; result.UserName := Trim(leName.Text);<BR>&nbsp;&nbsp;&nbsp;&nbsp; result.UserTel := Trim(leTel.Text);<BR>&nbsp;&nbsp;&nbsp;&nbsp; …<BR>&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; procedure TfrmExampleView.SetValues(const Value: TUserValueObject);<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp; leName.Text := Value.UserName<BR>&nbsp;&nbsp;&nbsp;&nbsp; leTel.Text := Value.UserTel;<BR>&nbsp;&nbsp;&nbsp;&nbsp; …<BR>&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; 在控制器中创建值对象<BR>&nbsp;&nbsp;&nbsp; TExampleCTRL = class<BR>&nbsp;&nbsp;&nbsp;&nbsp; private<BR>&nbsp;&nbsp;&nbsp;&nbsp; FExampleModel: TExampleModel;<BR>&nbsp;&nbsp;&nbsp;&nbsp; FfrmExampleView: TfrmExampleView;<BR>&nbsp;&nbsp;&nbsp;&nbsp; FUserValueObject: TUserValueObject;<BR>&nbsp;&nbsp;&nbsp;&nbsp; protected<BR>&nbsp;&nbsp;&nbsp;&nbsp; public<BR>&nbsp;&nbsp;&nbsp;&nbsp; constructor Create;<BR>&nbsp;&nbsp;&nbsp;&nbsp; destructor Destroy; override;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; property frmExampleView : TfrmExampleView read FfrmExampleView;<BR>&nbsp;&nbsp;&nbsp;&nbsp; property ExampleModel : TExampleModel read FExampleModel;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; property UserValueObject : TUserValueObject read FUserValueObject;<BR>&nbsp;&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; constructor TExampleCTRL.Create;<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp; FfrmExampleView := TfrmExampleView.Create(nil);<BR>&nbsp;&nbsp;&nbsp;&nbsp; FExampleModel := TExampleModel.Create;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //==创建值对象==<BR>&nbsp;&nbsp;&nbsp;&nbsp; FUserValueObject := TUserValueObject.Create;<BR>&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp;&nbsp;&nbsp; 然后就可以进行访向了<BR>&nbsp;&nbsp;&nbsp; //==取值对象==<BR>&nbsp;&nbsp;&nbsp; UserValueObject := ExampleModel.Values;<BR>&nbsp;&nbsp;&nbsp; //==设定视图的值对象==<BR>&nbsp;&nbsp;&nbsp; frmExampleView.Values := UserValueObject;</P>
<P>&nbsp;</P>
<P><BR>4、&nbsp; 控件的事件。<BR>&nbsp; 在应用系统的设计中，经常需要对用户的操作进行同步的数据更新或即时反应用户的操作。所以需要系统直接响应控件的事件，如TreeView中OnChange事件中对树节点变化的响应等。这种情况可以在控制器中建立对应的方法，响应事件并从模型中取出数据并更新到视图中，然后在初始化时将该事件指向处理方法。另一种方式就是定义一个更大的值对象或对象链表，然后扔过去给视图自己处理。</P>
<P>&nbsp;</P>
<P>&nbsp; constructor TExampleCTRL.Create;<BR>&nbsp; begin<BR>&nbsp;&nbsp; …<BR>&nbsp;&nbsp; frmExampleView.tvExample.OnChange := DoNodeChange;<BR>&nbsp; end;</P>
<P>&nbsp;</P>
<P>&nbsp; procedure TExampleCTRL.DoNodeChange(Sender: TObject; Node: TTreeNode);<BR>&nbsp; begin<BR>&nbsp;&nbsp; //==进行节点改变事件的处理==<BR>&nbsp; end;</P>
<P><BR>该文章转载自网络大本营：<A href="http://www.xrss.cn/Dev/Delphi/20078815527.Html">http://www.xrss.cn/Dev/Delphi/20078815527.Html</A></P>]]></description>
</item><item>
<title><![CDATA[DELPHI 快捷键]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=28632</link>
<author>RandomRen</author>
<pubDate>2007/10/11 16:30:08</pubDate>
<description><![CDATA[<P>转自：<A href="http://blog.donews.com/ejren/archive/2007/05/18/1166298.aspx">http://blog.donews.com/ejren/archive/2007/05/18/1166298.aspx</A><BR>&nbsp;&nbsp;&nbsp; Ctrl+PageUp 将光标移至本屏的第一行，屏幕不滚动。 <BR>　　Ctrl+PageDown 将光标移至本屏的最后一行，屏幕不滚动。 <BR>　　Ctrl+↓ 向下滚动屏幕，光标跟随滚动不出本屏。 <BR>　　Ctrl+↑ 向上滚动屏幕，光标跟随滚动不出本屏。 <BR>　　Ctrl+Shift+NUM 在光标行设置最多九个临时标志号，对临时切换非常有用。 <BR>　　行的左边将出现一本书，封面有NUM，再按一次取消设置。 <BR>　　Ctrl+NUM 直接将光标跳到NUM处，NUM是用Ctrl+Shift+NUM设置的标号。 <BR>　　NUM不能用小键盘。 <BR>　　Ctrl+Home 将光标移至文件头。 <BR>　　Ctrl+End 将光标移至文件尾。 <BR>　　Ctrl+B Buffer List窗口。 <BR>　　Ctrl+I 同Tab键。 <BR>　　Ctrl+M 同Enter键。 <BR>　　Ctrl+N 同Enter键，但光标位置保持不变。 <BR>　　Ctrl+T 删除光标右边的一个单词。 <BR>　　Ctrl+Y 删除光标所在行。 </P>
<P>　　Ctrl+Shift+↑ 光标在函数体内时，将光标快速移至当前函数声明处。 <BR>　　Ctrl+Shift+↓ 光标在函数声明行时，将光标快速移至函数定义处。 <BR>　　Ctrl+Shift+C 声明一个过程或函数后，直接生成过程或函数的名称、begin、end; <BR>　　Ctrl+Shift+E 光标在Edit窗口和Explorer窗口间切换。 <BR>　　Ctrl+Shift+G 插入GUID。 <BR>　　Ctrl+Shift+J 弹出Delphi语句提示窗口，选择所需语句将自动完成一条语句。 <BR>　　Ctrl+Shift+T 在光标行加入To-Do注释。 <BR>　　Ctrl+Shift+Y 删除光标之后至本行末尾之间的文本。 </P>
<P>　　Ctrl+F3 Call Stack窗口。 <BR>　　Ctrl+F4 等于File菜单中的Close项。 </P>
<P>　　Ctrl+鼠标转轮 加速滚屏。 </P>
<P>　　Shift+F8 调试时弹出CPU窗口。 <BR>　　Shift+F10 等于鼠标右键（Windows快捷键）。 </P>
<P>　　Alt+F4 关闭所有编辑框中打开的源程序文件，但不关闭项目。 </P>
<P>　　设置Code Insight 模板，begin...end,以后只要输入be，然后按ctrl+j就可以匹配begin,end;但是从begin到相应的end，就不知道了，匹配括号之类的可以用alt+[,Alt+] </P>
<P>　　搜索editor keyboard shortcuts可能可以找到，你自己看帮助吧。 </P>
<P>　　在编程序时 unit 右键菜单的properties /Code Insight </P>
<P>　　设置你喜欢的任何东东 </P>
<P>　　ctr+j即可。 </P>
<P>　　DELPHI IDE中部分操作快捷方式(大部分在Delphi 5.0的菜单中找不到，其中有一些还是非常有用的) </P>
<P>　　1 代码模板：CTRL+J </P>
<P>　　2 代码整块移动：CTRL+SHIFT+I（右移） CTRL+SHIFT+U（左移） </P>
<P>　　3 选中窗体 ： 先选中任一控件，SHIFT+鼠标左键 </P>
<P>　　4 将鼠标指向变量名、单元名、类名，再用 CTRL+鼠标左键 可找到相应的说明 </P>
<P>　　5 在过程、函数、事件内部， SHIFT+CTRL+向上的方向键 可跳跃到相应的过程、函数、事件的定义 </P>
<P>　　6 相反，在过程、函数、事件的定义处，SHIFT+CTRL+向下的方向键 可跳跃到具体过程、函数、事件内部 </P>
<P><BR>　7 CTRL+ SHIFT + C:编写申明或者补上函数 </P>
<P>　　8 SHIFT+CTRL+E 显示 EXPLORER </P>
<P>　　9 Ctrl+ shift + n (n=1,2,3,4......)定义书签 </P>
<P>　　10 Ctrl+ n (n=1,2,3,4......)跳到书签n </P>
<P>　　11 ALT+鼠标左键可以块选代码，删除对齐的重复代码非常有用 </P>
<P>　　12 Ctrl+PageUp 将光标移至本屏的第一行，屏幕不滚动。 </P>
<P>　　13 Ctrl+PageDown 将光标移至本屏的最后一行，屏幕不滚动。 </P>
<P>　　14 Ctrl+↓ 向下滚动屏幕，光标跟随滚动不出本屏。 </P>
<P>　　15 Ctrl+↑ 向上滚动屏幕，光标跟随滚动不出本屏。 </P>
<P>　　16 Ctrl+Home 将光标移至文件头。 </P>
<P>　　17 Ctrl+End 将光标移至文件尾。 </P>
<P>　　18 Ctrl+B Buffer List窗口。 </P>
<P>　　19 Ctrl+I 同Tab键。 </P>
<P>　　20 Ctrl+M 同Enter键。 </P>
<P>　　21 Ctrl+N 同Enter键，但光标位置保持不变。 </P>
<P>　　22 Ctrl+T 删除光标右边的一个单词。 </P>
<P>　　23 Ctrl+Y 删除光标所在行。 </P>
<P>　　24 Ctrl+Shift+↑ 光标在函数体内时，将光标快速移至当前函数声明处。 </P>
<P>　　25 Ctrl+Shift+↓ 光标在函数声明行时，将光标快速移至函数定义处。 </P>
<P>　　26 Ctrl+Shift+C 声明一个过程或函数后，直接生成过程或函数的名称、begin、end; </P>
<P>　　27 Ctrl+Shift+E 光标在Edit窗口和Explorer窗口间切换。 </P>
<P>　　28 Ctrl+Shift+G 插入GUID。 </P>
<P>　　29 Ctrl+Shift+J 弹出Delphi语句提示窗口，选择所需语句将自动完成一条语句。 </P>
<P>　　30 Ctrl+Shift+T 在光标行加入To-Do注释。 </P>
<P>　　31 Ctrl+Shift+Y 删除光标之后至本行末尾之间的文本。 </P>
<P>　　32 Ctrl+F3 Call Stack窗口。 </P>
<P>　　33 Ctrl+F4 等于File菜单中的Close项。 </P>
<P>　　34 Ctrl+鼠标转轮 加速滚屏。 </P>
<P>　　35 Shift+F8 调试时弹出CPU窗口。 </P>
<P>　　36 Shift+F10 等于鼠标右键（Windows快捷键）。 </P>
<P>　　37 Alt+F4 关闭所有编辑框中打开的源程序文件，但不关闭项目。 </P>
<P><BR>delphi7的快捷键 </P>
<P>1.SHIFT+鼠标左键 先选中任一控件,按键后可选中窗体(选中控件后按Esc效果一样) </P>
<P><BR>2.Shift+F8 调试时弹出CPU窗口。 </P>
<P>3.Shift+F10 等于鼠标右键（Windows快捷键）。 </P>
<P>4.Shitf+箭头 选择 </P>
<P>5.shift +F12 快速查找窗体并打开 </P>
<P>6.F7 （步进式调试同时追踪进入子过程） </P>
<P>7.F8 （步进式调试不进入子过程） </P>
<P>8.F9 运行 </P>
<P>9.F12 切换EDITOR,FORM </P>
<P>10.Alt+F4 关闭所有编辑框中打开的源程序文件，但不关闭项目 </P>
<P>11.ALT+鼠标左键 可以块选代码，用来删除对齐的重复代码非常有用 </P>
<P>12.Ctrl+F9 编译 </P>
<P>13.Ctrl+shift+N(n=1,2,3,4......) 定义书签 </P>
<P>14.Ctrl+n(n=1,2,3,4......)跳到书签n </P>
<P>15.CTRL +SHIFT+N 在书签N处，再按一次 取消书签 </P>
<P>16.Ctrl+PageUp 将光标移至本屏的第一行，屏幕不滚动 </P>
<P>17.Ctrl+PageDown 将光标移至本屏的最后一行，屏幕不滚动 </P>
<P>18.Ctrl+↓ 向下滚动屏幕，光标跟随滚动不出本屏 </P>
<P>19.Ctrl+↑ 向上滚动屏幕，光标跟随滚动不出本屏 </P>
<P>20.Ctrl+Home 将光标移至文件头 </P>
<P>21.Ctrl+End 将光标移至文件尾 </P>
<P>22.Ctrl+B Buffer List窗口 </P>
<P>23.Ctrl+I 同Tab键 </P>
<P>24.CTRL+J (弹出Delphi语句提示窗口，选择所需语句将自动完成一条语句)代码模板 </P>
<P>25.Ctrl+M 同Enter键。 </P>
<P>26.Ctrl+N 同Enter键，但光标位置保持不变 </P>
<P>27.Ctrl+T 删除光标右边的一个单词 </P>
<P>28.Ctrl+Y 删除光标所在行 </P>
<P>29.CTRL+C 复制 </P>
<P>30.CTRL+V 粘贴 </P>
<P>31.CTRL+X 剪切 </P>
<P>32.CTRL+Z 还原(Undo) </P>
<P>33.CTRL+S 保存 </P>
<P>34.Ctrl+F 查找 </P>
<P>35.Ctrl+L 继续查找 </P>
<P>36.Ctrl+r 替换 </P>
<P>37.CTRL+ENTER 定位到单元文件 </P>
<P>38.Ctrl+F3 弹出Call Stack窗口 </P>
<P>39.Ctrl+F4 等于File菜单中的Close项 </P>
<P>40.Ctrl+Backspace 后退删除一个词,直到遇到一个分割符 </P>
<P>41.Ctrl+鼠标转轮 加速滚屏 </P>
<P>42.Ctrl+O+U 切换选择块的大小写(注意松开O后再按U,Ctrl保持按下) </P>
<P>43.Ctrl+K+O 切换选择块为小写(注意松开K后再按O,Ctrl保持按下) </P>
<P>44.Ctrl+K+N 切换选择块为大写(注意松开K后再按N,Ctrl保持按下) </P>
<P>45.Ctrl+Shift+G 插入GUID </P>
<P>46.Ctrl+Shift+T 在光标行加入To-Do注释 </P>
<P>47.Ctrl+Shift+Y 删除光标之后至本行末尾之间的文本 </P>
<P>48.CTRL+SHIFT+C 编写申明或者补上函数，绝好!!! </P>
<P>49.CTRL+SHIFT+E 显示EXPLORER </P>
<P>50.Ctrl+Tab 在Inspector中切换Properties页和Events页 </P>
<P>51.CTRL+SHIFT+U 代码整块左移2个空格位置 </P>
<P>52.CTRL+SHIFT+I 代码整块右移2个空格位置 </P>
<P>53.CTRL+SHIFT+↑ 在过程、函数、事件内部, 可跳跃到相应的过程、函数、事 </P>
<P>件的定义（在interface和implementation之间来回切换） </P>
<P>54.CTRL+SHIFT+↓ 在过程、函数、事件的定义处， 可跳跃到具体过程、函数、事件内部(同上) </P>
<P>55.Tab 在object inspector窗口按tab键将光标移动到属性名区，然后键入属性名的开头 </P>
<P>字母可快速定位到该属性 </P>
<P>56.Ctrl+Alt 按着Ctrl+Alt之后，可用鼠标选择一个矩形块中的代码， </P>
<P>并可比它进行复制，粘贴 </P>
<P>57.Shift+↓、↑、→、← 以1像素单位更改所选控件大小 </P>
<P>58.Ctrl+↓、↑、→、←以1像素单位更改所选控件位置 </P>
<P>59.Ctrl+E 快速选择（呵呵，试试吧，很好玩的） </P>
<P>---------GExperts中--------- </P>
<P>60.Ctrl+Alt+c 注释块 </P>
<P>61.Ctrl+Alt+u 取消注释块 </P>
<P>62.Ctrl+Alt+h 生成头(更详细的设置在GExperts配置的Editor Experts属性页) </P>
<P>63.Ctrl+Alt+o 选择对应分隔符之间的语句 </P>
<P>64.Ctrl+Alt+v 在对应的分隔符之间来回跳转(与已有快捷键有冲突，请更改) </P>
<P>-------------------------------------------------------------------------- </P>
<P>65、将鼠标指向变量名、单元名、类名，再用 CTRL+鼠标左键 可找到相应的说明 </P>
<P>66、CTRL+ SHIFT + C 编写申明或者补上函数. </P>
<P>如： </P>
<P>procedure TT.A(AA: string); //函数申明 </P>
<P>安下：CTRL+ SHIFT + C后，会写上 </P>
<P>procedure TT.A(AA: string); </P>
<P>begin </P>
<P>end; </P>
<P>67、ALT+鼠标左键可以块选代码，删除对齐的重复代码非常有用。 </P>
<P>68、Ctrl+shift+G 产生一个GUID号</P>]]></description>
</item><item>
<title><![CDATA[非匿名方式访问远程的com+]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=28567</link>
<author>RandomRen</author>
<pubDate>2007/10/9 11:54:13</pubDate>
<description><![CDATA[<P>转自:http://blog.csdn.net/looyo/archive/2007/07/27/1711546.aspx<BR>windwos的安全机制规定：windows接收远程的com+调用的时候，会验证这个调用的权限。如果权限不够就出现经典的“拒绝访问”错误。</P>
<P>解决这个问题已知访问方式有：</P>
<P>1、匿名访问；在应用服务器（简称AP）启用guest，并且设置guest具有激活和访问COM+的权限。这条路是可行，不过安全性不能得到保证。</P>
<P>2、客户端电脑的登录用户和密码和AP上的一个用户一致，并且这个用户在AP上也具有相应的访问COM+的权限。这种方式要比第一种好一些，但是哪个单位的IT系统会是这种样子呢。肯定是每台机器都有自己的帐户密码。这个方式也不好。注：这种方式在不需要发布客户端软件到诺干多的机器上的时候也是可行的，比如访问COM+ 的是webServer.</P>
<P>3、在域管理的网络环境中，同样可以实现，但是有个问题，如果您的客户不愿意改造成域环境呢。所以这种方法也是有局限性的。</P>
<P>最后，我想到如果远程访问COM+的时候能够显式的给定用于AP验证权限的用户名和密码不是就可以解决这个问题了吗？事实上这个方式是可行的。不过在delphi7中还没有现成的函数可以达到这个目的。</P>
<P>comobj.pas 中有个函数 function CreateRemoteComObject(const MachineName: WideString;<BR>&nbsp; const ClassID: TGUID): IUnknown; 这个是用来创建远程的com+接口的。我要改造的主要是这个函数。</P>
<P>&nbsp;</P>
<P>function CoCreateInstanceEx(const clsid: TCLSID; unkOuter: IUnknown; dwClsCtx: Longint; ServerInfo: PCoServerInfo; dwCount: Longint; rgmqResults: PMultiQIArray): HResult; stdcall; 这个函数可以用来创建远程的com+</P>
<P>ServerInfo 用来存储远程的服务器信息，包括访问和激活com+服务的帐户和密码。</P>
<P>我们来分析一下PCoServerInfo;<BR>&nbsp; PCoServerInfo = ^TCoServerInfo;<BR>&nbsp; _COSERVERINFO = record<BR>&nbsp;&nbsp;&nbsp; dwReserved1: Longint;<BR>&nbsp;&nbsp;&nbsp; pwszName: LPWSTR;<BR>&nbsp;&nbsp;&nbsp; pAuthInfo: Pointer;<BR>&nbsp;&nbsp;&nbsp; dwReserved2: Longint;<BR>&nbsp; end;</P>
<P>&nbsp;&nbsp;&nbsp; pUnShort=^Word;<BR>&nbsp;&nbsp;&nbsp; pCoAuthIdentity=^_CoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp; _CoAuthIdentity=record<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user:pUnShort;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserLength:ULONG;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Domain:pUnShort;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DomainLength:Ulong;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password:pUnShort;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PasswordLength:ulong;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags:ulong;<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; _CoAuthInfo=record<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnSvc:DWORD;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthzSvc:DWORD;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pwszServerPrincName:WideString;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnLevel:Dword;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwImpersonationLevel:dword;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pAuthIdentityData:pCoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwCapabilities:DWORD;<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; TSocInfo=class(Tobject)<BR>&nbsp;&nbsp;&nbsp; public<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fcid:_CoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fcai:_CoAuthInfo;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServerInfo: TCoServerInfo;<BR>&nbsp;&nbsp;&nbsp; end;</P>
<P>我们在CreateRemoteComObject中调用CoCreateInstanceEx的时候，首先给ServerInfo赋值如下</P>
<P>function CreateRemoteComObjectwh(const MachineName: WideString; const ClassID: TGUID): IUnknown;<BR>const<BR>&nbsp; LocalFlags =CLSCTX_LOCAL_SERVER or CLSCTX_REMOTE_SERVER or CLSCTX_INPROC_SERVER;<BR>&nbsp; RemoteFlags = CLSCTX_REMOTE_SERVER;<BR>var<BR>&nbsp;&nbsp;&nbsp; MQI: TMultiQI;<BR>&nbsp;&nbsp;&nbsp; ServerInfo: TCoServerInfo;<BR>&nbsp;&nbsp;&nbsp; IID_IUnknown: TGuid;<BR>&nbsp;&nbsp;&nbsp; Flags, Size: DWORD;<BR>&nbsp;&nbsp;&nbsp; LocalMachine: array [0..MAX_COMPUTERNAME_LENGTH] of char;<BR>&nbsp; ////&nbsp; add by wanghui 2007-07-24<BR>&nbsp;&nbsp;&nbsp; Fcai:_CoAuthInfo;<BR>&nbsp;&nbsp;&nbsp; Fcid:_CoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp;&nbsp; wUser,wDomain,wPsw:WideString;<BR>&nbsp;&nbsp;&nbsp; iiu:idispatch;<BR>&nbsp;&nbsp;&nbsp; fr:HRESULT;<BR>begin<BR>&nbsp; if (GetObjectContext = nil)&nbsp; then<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if @CoCreateInstanceEx =nil then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; raise Exception.CreateRes(@SDCOMNotInstalled);</P>
<P>&nbsp;&nbsp;&nbsp; wUser:=getAppUserid();//用户名<BR>&nbsp;&nbsp;&nbsp; wDomain:=getappserver();//远程计算机名<BR>&nbsp;&nbsp;&nbsp; wPsw:=getAppPassword();//密码</P>
<P>&nbsp;&nbsp;&nbsp; FillMemory(@Fcai,sizeof(Fcai),0);<BR>&nbsp;&nbsp;&nbsp; FillMemory(@FCid,sizeof(FCid),0);</P>
<P>&nbsp;&nbsp;&nbsp; with fcid do begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user:=pUnshort(@wUser[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserLength:=length(wUser);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Domain:=pUnshort(@wDomain[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DomainLength:=length(wDomain);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password:=pUnshort(@wPsw[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PasswordLength:=length(wPsw);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags:=2;<BR>&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;&nbsp;&nbsp; with fcai do begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnSvc:=10;//winNt默认的鉴证服务&nbsp;&nbsp; RPC_C_AUTHN_WINNT<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthzSvc:=$FFFFFF;//0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //RPC_C_AUTHZ_NONE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //pwszServerPrincName:=pwidechar(wDomain);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnLevel:=3;//0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwImpersonationLevel:=3;//必须设置成模拟<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pAuthIdentityData:=@fcid;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwCapabilities:=$0;//$0800;<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; FillMemory(@ServerInfo, sizeof(ServerInfo), 0);<BR>&nbsp;&nbsp;&nbsp; ServerInfo.pwszName := PWideChar(wDomain);<BR>&nbsp;&nbsp;&nbsp; ServerInfo.dwReserved1:=0;<BR>&nbsp;&nbsp;&nbsp; ServerInfo.pAuthInfo:=@fcai;</P>
<P>&nbsp;&nbsp;&nbsp; IID_IUnknown := IUnknown;<BR>&nbsp;&nbsp;&nbsp; MQI.IID := @IID_IUnknown;<BR>&nbsp;&nbsp;&nbsp; MQI.itf := nil;<BR>&nbsp;&nbsp;&nbsp; MQI.hr := 0;</P>
<P>&nbsp;&nbsp;&nbsp; if Length(MachineName) &gt; 0 then<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size := Sizeof(LocalMachine);&nbsp; // Win95 is hypersensitive to size<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if GetComputerName(LocalMachine, Size) and&nbsp; (AnsiCompareText(LocalMachine, MachineName) = 0) then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags := LocalFlags<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags := RemoteFlags;<BR>&nbsp;&nbsp;&nbsp; end else Flags := LocalFlags;<BR>&nbsp;&nbsp;&nbsp; OleCheck(CoCreateInstanceEx(ClassID, nil, CLSCTX_REMOTE_SERVER, @(ServerInfo), 1, @MQI));<BR>&nbsp;&nbsp;&nbsp; OleCheck(MQI.HR);<BR>&nbsp;&nbsp;&nbsp; Result := MQI.itf;<BR>&nbsp; end&nbsp;&nbsp; else<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetObjectContext.CreateInstance(ClassID, IUnknown, Result);<BR>&nbsp; end;<BR>end;</P>
<P>以上代码 确保获取远程的com+的接口，接口类型为Iunkown</P>
<P>但是要访问其中的方法还需要用下面的函数来设置远程com本地引用的访问权限。</P>
<P>&nbsp;with fcai do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CoSetProxyBlanket(iu,dwAuthnSvc,dwAuthzSvc,pwidechar(pAuthIdentityData^.Domain),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnLevel,dwImpersonationLevel,pAuthIdentityData,dwCapabilities);</P>
<P>将这个函数封装后得到一个新函数</P>
<P>function SetProxyBlanket(iu:IUnknown):boolean;<BR>var<BR>&nbsp;&nbsp;&nbsp; Fcai:_CoAuthInfo;<BR>&nbsp;&nbsp;&nbsp; Fcid:_CoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp; wUser,wDomain,wPsw:WideString;<BR>&nbsp;&nbsp;&nbsp; iiu:idispatch;</P>
<P>&nbsp;&nbsp;&nbsp; si:Tsocinfo;<BR>begin</P>
<P>&nbsp;&nbsp; wUser:=getAppUserid();//用户名<BR>&nbsp;&nbsp;&nbsp; wDomain:=getappserver();//远程计算机名<BR>&nbsp;&nbsp;&nbsp; wPsw:=getAppPassword();//密码<BR>&nbsp;&nbsp; if wDomain='127.0.0.1' then exit;<BR>&nbsp;&nbsp;&nbsp; FillMemory(@Fcai,sizeof(Fcai),0);<BR>&nbsp;&nbsp;&nbsp; FillMemory(@FCid,sizeof(FCid),0);<BR>&nbsp;&nbsp;&nbsp; // FillMemory(@FSvInfo,sizeof(FSvInfo),0);<BR>&nbsp;&nbsp;&nbsp; with fcid do begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user:=pUnshort(@wUser[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserLength:=length(wUser);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Domain:=pUnshort(@wDomain[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DomainLength:=length(wDomain);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password:=pUnshort(@wPsw[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PasswordLength:=length(wPsw);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags:=2;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //SEC_WINNT_AUTH_IDENTITY_UNICODE<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; //以上填充_CoAuthIdentity结构<BR>&nbsp;&nbsp; with fcai do begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnSvc:=10;//winNt默认的鉴证服务&nbsp;&nbsp; RPC_C_AUTHN_WINNT<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthzSvc:=$FFFFFF;//0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //RPC_C_AUTHZ_NONE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //pwszServerPrincName:=pwidechar(wDomain);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnLevel:=3;//0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwImpersonationLevel:=3;//必须设置成模拟<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pAuthIdentityData:=@fcid;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwCapabilities:=$0;//$0800;<BR>&nbsp;&nbsp;&nbsp; end;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with fcai do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CoSetProxyBlanket(iu,dwAuthnSvc,dwAuthzSvc,pwidechar(pAuthIdentityData^.Domain),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dwAuthnLevel,dwImpersonationLevel,pAuthIdentityData,dwCapabilities);<BR>end;</P>
<P>最后我们改造delphi自动生成的*_TLB.pas 中的函数CreateRemote 如下</P>
<P>class function Comymenu.CreateRemote(const MachineName: string): Imymenu;<BR>var&nbsp; iu:IUnknown;<BR>begin<BR>&nbsp;&nbsp;&nbsp; iu:=CreateRemoteComObjectwh(MachineName, CLASS_mymenu);<BR>&nbsp;&nbsp;&nbsp; SetProxyBlanket(iu);<BR>&nbsp;&nbsp;&nbsp; result:=iu as Imymenu;<BR>&nbsp;&nbsp;&nbsp; SetProxyBlanket(IUnknown(result));<BR>end;</P>
<P><BR>参考了一些资料：MSDN，《windows安全性编程》。</P>
<P>软件环境：</P>
<P>&nbsp; client&nbsp; winXP SP2</P>
<P>AP： win2003 sp1</P>]]></description>
</item><item>
<title><![CDATA[以远程计算机上的用户身份访问Com+应用]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=28536</link>
<author>RandomRen</author>
<pubDate>2007/10/7 21:34:54</pubDate>
<description><![CDATA[<A></A> 
<P>转自：<A href="http://www.cntuba.com/developer/Delphi/200701/20070101164256_22899.html">http://www.cntuba.com/developer/Delphi/200701/20070101164256_22899.html</A><BR><BR>DELPHI程序员开发com+应用的速度是非常快的，其主要原因是其较好地封装了com+的windows底层功能，开发人员通过较为简单的类继承就避开了复杂的com+底层技术细节，使开发人员将精力放在应用本身的功能上面。Delphi在封装com+应用时采取了许多折衷，在保留通用性的同时也避开了一些实现起来困难但是应用面不太广的com+底层特性。这些避开的特性中最令delphi com开发人员关心的就是安全特性。从delphi 5开始，有许多人都面临过这样的问题：com应用开发出来并且在本机上运行一切正常，但是一旦分发出去实施远程访问时，就无法正常运行了。我自己有段时间在看到“拒绝访问”错误提示时会本能的头晕。其实认真追究起来，还是因为自己对windows安全技术了解不多造成的。多年来我一直没有发现国内有windows安全方面比较系统的资料和书籍，直到Keith Brownr的&lt;windows安全性编程&gt;中文版的出现。正是基于这本书我才有了下面的一些试验，也知道了为什么我老是补拒绝的原因。下面的讨论只是我在解决自身现有代码的安全访问问题时，总结出的几个小经难方法。建议愿意了解windows安全性的朋友去看一看&lt;windows安全性编程&gt;一书，你会发现windows的安全不再神秘。 这篇文章将会说明如何以远程工作站上的用户身份激活com+对象，并以此用户身份访问Interface。<BR>1、Delphi默认com+对象的远程激活Delph中远程com+对象激活一般通过TdispatchConnection及其子类来实现，实际代码中多用TDCOMConnection或TsocketConnectoion这两个组件，TDCOMConnection组件最终调用CoCreateInstanceEx创建com+对象。CoCreateInstanceEx (const clsid: TCLSID; unkOuter: IUnknown; dwClsCtx: Longint; ServerInfo:PCoServerInfo;dwCount: Longint; rgmqResults: PMultiQIArray): HResult。 TDCOMConnection在调用CoCreateInstanceEx时为pCoServerInfo参数中的pAuthInfo传递了Null值，因此TdcomConnection在创建Com对象时使用的是本地计算机登录者的用户令牌。假若A计算机上的登录用户Auser使用TDCOMConnection类连接远程计算机B上的com+对象，则B计算机会使用Auser的用户名/密码在B计算机上建立登录会话并最终创建com+对象。但是一台windows工作站上的本地用户只能在本地登录而无法在别的计算机上登录，因此A计算机上的Auser就无法在B工作站上建立登录会话，当然也就无法创建com+对象，此时远程工作站B会尝试用Guest帐户建立会话并使用该账户激活com+对象。在这种情况下，如果B工作站上的Guest账户没有启用或Guest没有激活com+对象的权限，你就会看见令人头晕的提示“拒绝访问”。看到这里你是不对现在网上最“流行”的dcom配置方法有所悟了呢。那个方法就是允许everyone访问、激活com对象、并且将“默认身份验证级别”设置成无。这种方法能够使你的com应用可以“用了”，但是，它可以上“任何人”访问。而且这种设置你将无法利用com+基于角色的安全访问控制功能。<BR>2、怎样不用GUEST账户激活 这个问题的实际上应该是：怎样用远程工作站上的用户激活远程com对象。解决这个问题其实很简单：只要你在调用CoCreateInstanceEx时为它指定远程工作站上的用户名和密码，只要用户名/密码通过远程计算机的验证，并且该用户被授予了“远程激活”com+对象的权限，那么远程工作站会用该用户身份激活com+对象。看一下代码： <BR>var<BR>&nbsp; mts:IMTSXjpimsDB; <BR>&nbsp; ov:Variant; <BR>&nbsp; i:integer; <BR>&nbsp; cai:_CoAuthInfo; <BR>&nbsp; cid:_CoAuthIdentity; <BR>&nbsp; csi:COSERVERINFO; <BR>&nbsp; mqi:MULTI_QI; <BR>&nbsp; iid_unk:TGUID; <BR>&nbsp; idsp:IDispatch; <BR>&nbsp; wUser,wDomain,wpsw:WideString; <BR>begin <BR>&nbsp; wUser:=eduser.text;//用户名 <BR>&nbsp; wDomain:=edSvr.Text;//远程计算机名 <BR>&nbsp; wPsw:=edPsw.Text;//密码 <BR>&nbsp; cid.user:=pUnshort(@wUser[1]); <BR>&nbsp; cid.UserLength:=length(wUser); <BR>&nbsp; cid.Domain:=pUnshort(@wDomain[1]); <BR>&nbsp; cid.DomainLength:=length(wDomain); <BR>&nbsp; cid.password:=pUnshort(@wPsw[1]); <BR>&nbsp; cid.PasswordLength:=length(wPsw); <BR>&nbsp; cid.Flags:=2; <BR>&nbsp; //以上填充_CoAuthIdentity结构 <BR>&nbsp; cai.dwAuthnSvc:=10;//winNt默认的鉴证服务 <BR>&nbsp; cai.dwAuthzSvc:=0; <BR>&nbsp; cai.pwszServerPrincName:=wDomain; <BR>&nbsp; cai.dwAuthnLevel:=0; <BR>&nbsp; cai.dwImpersonationLevel:=3;//必须设置成模拟 <BR>&nbsp; cai.pAuthIdentityData:=@cid; <BR>&nbsp; cai.dwCapabilities:=$0800;&nbsp;&nbsp; //以上填充_CoAuthInfo结构 <BR>&nbsp; FillChar(csi, sizeof(csi), 0); <BR>&nbsp; csi.dwReserved1:=0; <BR>&nbsp; csi.pwszName:=pwidechar(wdomain); <BR>&nbsp; csi.pAuthInfo:=@cai; <BR>&nbsp; //以上填充COSERVERINFO结构 <BR>&nbsp; iid_unk:=IUnknown; <BR>&nbsp; mqi.IID:=@iid_unk;mqi.Itf:=nil;mqi.hr:=0; <BR>&nbsp; Screen.Cursor:=crHourGlass; olecheck(CoCreateInstanceEx(CLASS_MTSXjpimsDB,nil,CLSCTX_REMOTE_SERVER,@csi,1,@mqi));<BR>这段代码中除了最后实际调用CoCreateInstanceEx外，前面的代码都是设置参数。这些参数的含义请大家参考msdn，除了用户名、主机名、密码外，只有一个重要要部分要说明：cai.dwImpersonationLevel必须设置成允许模拟(值为3)，否则远程计算机将无法按提供的用户/密码建议网络会话。 <BR>3、不修改现有代码，可以实现用远程用户身份激活吗？ 当然可以，我扩展了TDcomConnection类，为其加入了用户名和密码，并修改其默认的DoConnect方法，使其在调用CoCreateInstanceEx时用指定的用户名和密码填充参数。代码如下：</P>
<P>unit SecDComConnection;</P>
<P>interface</P>
<P>uses<BR>&nbsp; windows,SysUtils, Classes,ActiveX, DB, DBClient, MConnect,comobj,Midas;</P>
<P>type<BR>&nbsp; {<BR>&nbsp; typedef struct _SEC_WINNT_AUTH_IDENTITY<BR>&nbsp; unsigned short __RPC_FAR* User;<BR>&nbsp; unsigned long UserLength;<BR>&nbsp; unsigned short __RPC_FAR* Domain;<BR>&nbsp; unsigned long DomainLength;<BR>&nbsp; unsigned short __RPC_FAR* Password;<BR>&nbsp; unsigned long PasswordLength;<BR>&nbsp; unsigned long Flags;<BR>&nbsp; SEC_WINNT_AUTH_IDENTITY, *PSEC_WINNT_AUTH_IDENTITY;<BR>&nbsp; }<BR>&nbsp; {<BR>&nbsp; typedef struct _COAUTHIDENTITY</P>
<P>&nbsp;&nbsp;&nbsp; USHORT * User;</P>
<P>&nbsp;&nbsp;&nbsp; ULONG UserLength;</P>
<P>&nbsp;&nbsp;&nbsp; USHORT * Domain;</P>
<P>&nbsp;&nbsp;&nbsp; ULONG DomainLength;</P>
<P>&nbsp;&nbsp;&nbsp; USHORT * Password;</P>
<P>&nbsp;&nbsp;&nbsp; ULONG PasswordLength;</P>
<P>&nbsp;&nbsp;&nbsp; ULONG Flags;</P>
<P>&nbsp;&nbsp;&nbsp; COAUTHIDENTITY;<BR>&nbsp; }</P>
<P><BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_NONE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_DCE_PRIVATE&nbsp;&nbsp;&nbsp;&nbsp; 1<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_DCE_PUBLIC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_DEC_PUBLIC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_GSS_NEGOTIATE&nbsp;&nbsp; 9<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_WINNT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_GSS_SCHANNEL&nbsp;&nbsp; 14<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_GSS_KERBEROS&nbsp;&nbsp; 16<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_MSN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 17<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_DPA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_MQ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_DEFAULT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0xFFFFFFFFL<BR>&nbsp; }</P>
<P><BR>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHZ_NONE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHZ_NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHZ_DCE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHZ_DEFAULT&nbsp;&nbsp; 0xFFFFFFFF<BR>&nbsp; }</P>
<P>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_DEFAULT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_NONE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_CONNECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_CALL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_PKT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_PKT_INTEGRITY&nbsp;&nbsp; 5<BR>&nbsp;&nbsp;&nbsp; #define RPC_C_AUTHN_LEVEL_PKT_PRIVACY&nbsp;&nbsp;&nbsp;&nbsp; 6<BR>&nbsp; }</P>
<P>&nbsp; {<BR>&nbsp;&nbsp;&nbsp; SEC_WINNT_AUTH_IDENTITY_UNICODE=2<BR>&nbsp; }</P>
<P><BR>&nbsp; pUnShort=^Word;<BR>&nbsp; pCoAuthIdentity=^_CoAuthIdentity;<BR>&nbsp; _CoAuthIdentity=record<BR>&nbsp;&nbsp;&nbsp; user:pUnShort;<BR>&nbsp;&nbsp;&nbsp; UserLength:ULONG;<BR>&nbsp;&nbsp;&nbsp; Domain:pUnShort;<BR>&nbsp;&nbsp;&nbsp; DomainLength:Ulong;<BR>&nbsp;&nbsp;&nbsp; password:pUnShort;<BR>&nbsp;&nbsp;&nbsp; PasswordLength:ulong;<BR>&nbsp;&nbsp;&nbsp; Flags:ulong;<BR>&nbsp; end;</P>
<P>&nbsp; _CoAuthInfo=record<BR>&nbsp;&nbsp;&nbsp; dwAuthnSvc:DWORD;<BR>&nbsp;&nbsp;&nbsp; dwAuthzSvc:DWORD;<BR>&nbsp;&nbsp;&nbsp; pwszServerPrincName:WideString;<BR>&nbsp;&nbsp;&nbsp; dwAuthnLevel:Dword;<BR>&nbsp;&nbsp;&nbsp; dwImpersonationLevel:dword;<BR>&nbsp;&nbsp;&nbsp; pAuthIdentityData:pCoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp; dwCapabilities:DWORD;<BR>&nbsp; end;</P>
<P>&nbsp; TSecDComConnection = class(TDCOMConnection)<BR>&nbsp; private<BR>&nbsp;&nbsp;&nbsp; FCai:_CoAuthInfo;<BR>&nbsp;&nbsp;&nbsp; FCid:_CoAuthIdentity;<BR>&nbsp;&nbsp;&nbsp; FSvInfo:COSERVERINFO;<BR>&nbsp;&nbsp;&nbsp; FUser:WideString;<BR>&nbsp;&nbsp;&nbsp; FPassWord:WideString;<BR>&nbsp;&nbsp;&nbsp; procedure SetPassword(const Value: wideString);<BR>&nbsp;&nbsp;&nbsp; procedure SetUser(const Value: wideString);<BR>&nbsp;&nbsp;&nbsp; procedure SetSvInfo(const Value: COSERVERINFO);<BR>&nbsp; protected<BR>&nbsp;&nbsp;&nbsp; procedure DoConnect; override;<BR>&nbsp; public<BR>&nbsp;&nbsp;&nbsp; property SvInfo:COSERVERINFO read FSvInfo write SetSvInfo;<BR>&nbsp;&nbsp;&nbsp; constructor Create(AOwner: TComponent); override;<BR>&nbsp;&nbsp;&nbsp; procedure MySetBlanket(itf:IUnknown;const vCai:_CoAuthInfo);<BR>&nbsp;&nbsp;&nbsp; function GetServer: IAppServer; override;<BR>&nbsp; published<BR>&nbsp;&nbsp;&nbsp; property User:wideString read FUser write SetUser;<BR>&nbsp;&nbsp;&nbsp; Property Password:wideString read FPassword write SetPassword;<BR>&nbsp; end;</P>
<P>&nbsp; procedure Register;</P>
<P>implementation</P>
<P>constructor TSecDCOMConnection.Create(AOwner: TComponent);<BR>begin<BR>&nbsp; inherited Create(AOwner);<BR>&nbsp; FillMemory(@Fcai,sizeof(Fcai),0);<BR>&nbsp; FillMemory(@FCid,sizeof(FCid),0);<BR>&nbsp; FillMemory(@FSvInfo,sizeof(FSvInfo),0);<BR>&nbsp; with FCai do begin<BR>&nbsp;&nbsp;&nbsp; dwAuthnSvc:=10;//RPC_C_AUTHN_WINNT<BR>&nbsp;&nbsp;&nbsp; dwAuthzSvc:=0;// RPC_C_AUTHZ_NONE<BR>&nbsp;&nbsp;&nbsp; dwAuthnLevel:=0;//RPC_C_AUTHN_LEVEL_DEFAULT<BR>&nbsp;&nbsp;&nbsp; dwImpersonationLevel:=3;<BR>&nbsp;&nbsp;&nbsp; pAuthIdentityData:=@fcid;<BR>&nbsp;&nbsp;&nbsp; dwCapabilities:=$0800;<BR>&nbsp; end;<BR>end;</P>
<P><BR>procedure TSecDCOMConnection.DoConnect;<BR>var<BR>&nbsp; tmpCmpName :widestring;<BR>&nbsp; IID_IUnknown:TGUID;<BR>&nbsp; iiu:IDispatch;<BR>&nbsp; Mqi:MULTI_QI;<BR>&nbsp; qr:HRESULT;<BR>begin<BR>&nbsp; if (ObjectBroker) &lt;&gt; nil then<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp; repeat<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ComputerName = '' then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ComputerName := ObjectBroker.GetComputerForGUID(GetServerCLSID);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetAppServer(CreateRemoteComObject(ComputerName, GetServerCLSID) as IDispatch);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectBroker.SetConnectStatus(ComputerName, True);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectBroker.SetConnectStatus(ComputerName, False);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ComputerName := '';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; until Connected;<BR>&nbsp; end<BR>&nbsp; else if (ComputerName &lt;&gt; '') then begin<BR>&nbsp;&nbsp;&nbsp; with fcid do begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user:=pUnshort(@fuser[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserLength:=length(fuser);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tmpCmpName:=ComputerName;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Domain:=pUnshort(@tmpCmpName[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DomainLength:=length(TmpCmpName);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password:=pUnShort(@FPassword[1]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PasswordLength:=length(FPassword);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flags:=2;//Unicode<BR>&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;&nbsp;&nbsp; FSvInfo.pwszName:=pwidechar(tmpCmpName);<BR>&nbsp;&nbsp;&nbsp; FSvinfo.pAuthInfo:=@Fcai;<BR>&nbsp;&nbsp;&nbsp; IID_IUnknown:=IUnknown;<BR>&nbsp;&nbsp;&nbsp; mqi.IID:=@IID_IUnknown;mqi.Itf:=nil;mqi.hr:=0;<BR>&nbsp;&nbsp;&nbsp; olecheck(CoCreateInstanceEx(GetServerCLSID,nil,CLSCTX_REMOTE_SERVER,@FSvinfo,1,@mqi));<BR>&nbsp;&nbsp;&nbsp; olecheck(mqi.hr);<BR>&nbsp;&nbsp;&nbsp; MySetBlanket(mqi.Itf,Fcai);<BR>&nbsp;&nbsp;&nbsp; qr:=mqi.Itf.QueryInterface(idispatch,iiu);<BR>&nbsp;&nbsp;&nbsp; olecheck(qr);<BR>&nbsp;&nbsp;&nbsp; MySetBlanket(IUnknown(iiu),FCai);<BR>&nbsp;&nbsp;&nbsp; SetAppServer(iiu);<BR>&nbsp; end else<BR>&nbsp;&nbsp;&nbsp; inherited DoConnect;<BR>end;</P>
<P><BR>function TSecDComConnection.GetServer: IAppServer;<BR>var<BR>&nbsp; QIResult: HResult;<BR>begin<BR>&nbsp; Connected := True;<BR>&nbsp; QIResult := IDispatch(AppServer).QueryInterface(IAppServer, Result);<BR>&nbsp; if QIResult &lt;&gt; S_OK then<BR>&nbsp; begin<BR>&nbsp;&nbsp;&nbsp; Result := TDispatchAppServer.Create(IAppServerDisp(IDispatch(AppServer)));<BR>&nbsp; end;<BR>&nbsp; MySetBlanket(IUnknown(Result),FCai);<BR>end;</P>
<P>procedure TSecDCOMConnection.MySetBlanket(itf: IUnknown;<BR>&nbsp; const vCai: _CoAuthInfo);<BR>begin<BR>&nbsp; with vCai do<BR>&nbsp;&nbsp;&nbsp; CoSetProxyBlanket(Itf,dwAuthnSvc,dwAuthzSvc,pwidechar(pAuthIdentityData^.Domain),dwAuthnLevel,dwImpersonationLevel,pAuthIdentityData,dwCapabilities);<BR>end;</P>
<P>procedure TSecDCOMConnection.SetPassword(const Value: wideString);<BR>begin<BR>&nbsp; FPassword := Value;<BR>end;</P>
<P>procedure TSecDCOMConnection.SetSvInfo(const Value: COSERVERINFO);<BR>begin<BR>&nbsp; FSvInfo := Value;<BR>end;</P>
<P>procedure TSecDCOMConnection.SetUser(const Value: wideString);<BR>begin<BR>&nbsp; FUser := Value;<BR>end;</P>
<P>procedure Register;<BR>begin<BR>&nbsp; RegisterComponents('DataSnap', [TSecDComConnection]);<BR>end;</P>
<P>end.</P>
<P>代码中有一些C风格的注释，是因为delphi没有为我们预定义这些变量和数据结构。 如何使用呢？将这个组件安装在IDE中，并将其放到你的现有代码的远程数据模块中去，将原有指向TDOCMConnection的数据集控件设置成这个新的TSecDCOMConnection控件。然后你可以在远程计算机中设置最严格的安全选项。但是要记住应该为你要使用的用户设置合适的权限：给予远程激活权限、给予远程访问权限。 <BR>4、到现在还没有谈到访问的问题。首先激活和访问并不是一回事。一个用户可能拥有激活权限但没有访问权限，也有可能只有访问权限却无激活权限。前面谈到CoCreateInstacnceEx可以用另一身份激活对象并取得IunKnown指针的一个本地引用。如果你直接用这个指针去取得IappServer接口并调用方法，那么你很可能又会见到“拒绝访问”信息。这是IUnKnown指针的本地引用存在于客户机的进程中，再没有做特殊设置前，该指针继承了客户机进程的本地令牌，也就是说当用这个指针获取远程IappServer接口时，会用客户机当前登录令牌调用QueryInterface，在调用过程中远程计算机将有此令牌中缓存的用户名和密码进行再次登录验证，当然此时又会被拒绝，而后远程计算机再次尝试用GUEST帐户登录并获取com对象接口，此时若没有找开GUEST访问权限，则客户端访问失败，windows返回“拒绝访问”信息。那么怎样才能使QueryInterface调用也使用远程用户身份呢，这就要调用CoSetProxyBlanket强制设置本地接口引用使用远程用户的令牌。在上面的代码中，我用MySetBlanket包装了该API，以便使用激活时的用户身份调用QueryInterface。而后在取得的IappServer接口上再次调用MySetBlanket，保证在使用该接口时也采用远程用户身份。 <BR>&nbsp;MySetBlanket(mqi.Itf,Fcai); <BR>&nbsp;qr:=mqi.Itf.QueryInterface(idispatch,iiu); <BR>&nbsp;olecheck(qr); <BR>&nbsp;MySetBlanket(IUnknown(iiu),FCai);<BR>为保证直接引用DataProvider的TclientDataSet也能按上述要求工作，在扩展的TSecDCOMConnection控件中，重载了GetServer方法。这样TSecDCOMConnection已能完全替换TDCOMConnection实现便利的com+应用编程了。 由于时间仓促，写这篇时很多术语没有做解释交待，因此可能会有一些不太好理解，但是出于为delphi Fans提供一个简单的实现安全性com访问的方法，我还是将这篇贴上来，主要是可以让需要的朋友直接复制代码用在自己的应用上。使用TSecDCOMConnection后，服务器方的com+对象可以强制找开访问检查，并打开组件级的访问检查。在打开访问检查的情况下，必须将服务器中允许访问com+对象的用户名加入到角色中才能正确访问。 (上述代码在delphi7/winXP sp2中调试通过，对于windows98和windows nt4.0及以下操作系统，由于CoCreateInstanceEx不能直接生成com+对象的安全上下文，因此代码不可用) <BR><BR><BR>昆仑踏月&nbsp; 于乌鲁木齐 2005.6.1</P>]]></description>
</item><item>
<title><![CDATA[*******事务全攻略****** [转]]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=27951</link>
<author>RandomRen</author>
<pubDate>2007/9/8 15:08:09</pubDate>
<description><![CDATA[<A></A>
<P>*******事务全攻略****** <BR>来自:http://www.itpub.net/printthread.php?threadid=167586<BR>一 事务的属性 <BR><BR>事务具有ACID属性 <BR>即 Atomic原子性, Consistent一致性, Isolated隔离性, Durable永久性 <BR><BR>原子性 <BR><BR>就是事务应作为一个工作单元,事务处理完成，所有的工作要么都在数据库中保存下来，要么完全 <BR>回滚，全部不保留 <BR><BR><BR>一致性 <BR>事务完成或者撤销后，都应该处于一致的状态 <BR><BR>隔离性 <BR><BR>多个事务同时进行，它们之间应该互不干扰.应该防止一个事务处理其他事务也要修改的数据时， <BR>不合理的存取和不完整的读取数据 <BR><BR><BR>永久性 <BR>事务提交以后，所做的工作就被永久的保存下来 <BR><BR><BR>二 事务并发处理会产生的问题 <BR><BR>丢失更新 <BR><BR>当两个或多个事务选择同一行，然后基于最初选定的值更新该行时，会发生丢失更新问题、 <BR>每个事务都不知道其它事务的存在。最后的更新将重写由其它事务所做的更新，这将导致数据丢失。 <BR><BR>脏读 <BR>当第二个事务选择其它事务正在更新的行时，会发生未确认的相关性问题。 <BR>第二个事务正在读取的数据还没有确认并且可能由更新此行的事务所更改。 <BR><BR>不可重复读 <BR><BR>当第二个事务多次访问同一行而且每次读取不同的数据时，会发生不一致的分析问题。 <BR>不一致的分析与未确认的相关性类似，因为其它事务也是正在更改第二个事务正在读取的数据。 <BR>然而，在不一致的分析中，第二个事务读取的数据是由已进行了更改的事务提交的。而且，不一致的分析涉及多次（两次或更多）读取同一行，而且每次信息都由其它事务更改；因而该行被非重复读取。 <BR><BR>幻像读 <BR><BR>当对某行执行插入或删除操作，而该行属于某个事务正在读取的行的范围时，会发生幻像读问题。 <BR>事务第一次读的行范围显示出其中一行已不复存在于第二次读或后续读中，因为该行已被其它事务删除。同样，由于其它事务的插入操作，事务的第二次或后续读显示有一行已不存在于原始读中。 <BR><BR><BR>三 事务处理类型 <BR><BR><BR>自动处理事务 <BR><BR>系统默认每个T－SQL命令都是事务处理 由系统自动开始并提交 <BR><BR><BR>隐式事务 <BR><BR>当有大量的DDL 和DML命令执行时会自动开始，并一直保持到用户明确提交为止，切换隐式事务可以用SET IMPLICIT_TRANSACTIONS <BR>为连接设置隐性事务模式.当设置为 ON 时，SET IMPLICIT_TRANSACTIONS 将连接设置为隐性事务模式。当设置为 OFF 时，则使连接返回到自动提交事务模式 <BR><BR><BR>用户定义事务 <BR><BR>由用户来控制事务的开始和结束 命令有: begin tran commit tran rollback tran 命令 <BR><BR><BR>分布式事务 <BR>跨越多个服务器的事务称为分布式事务,sql server 可以由DTc microsoft distributed transaction coordinator <BR>来支持处理分布式事务,可以使用 BEgin distributed transaction 命令启动一个分布式事务处理 <BR><BR><BR><BR>四 事务处理的隔离级别 <BR><BR>使用SET TRANSACTION ISOLATION LEVEL来控制由连接发出的所有语句的默认事务锁定行为 <BR><BR>从低到高依次是 <BR><BR><BR>READ UNCOMMITTED <BR><BR>执行脏读或 0 级隔离锁定，这表示不发出共享锁，也不接受排它锁。当设置该选项时，可以对数据执行未提交读或脏读；在事务结束前可以更改数据内的数值，行也可以出现在数据集中或从数据集消失。该选项的作用与在事务内所有语句中的所有表上设置 NOLOCK 相同。这是四个隔离级别中限制最小的级别。 <BR><BR>举例 <BR><BR>设table1(A,B,C) <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR><BR>新建两个连接 <BR>在第一个连接中执行以下语句 <BR>select * from table1 <BR>begin tran <BR>update table1 set c='c' <BR>select * from table1 <BR>waitfor delay '00:00:10' --等待10秒 <BR>rollback tran <BR>select * from table1 <BR><BR>在第二个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED <BR>print '脏读' <BR>select * from table1 <BR>if @@rowcount&gt;0 <BR>begin <BR>waitfor delay '00:00:10' <BR>print '不重复读' <BR>select * from table1 <BR>end <BR><BR>第二个连接的结果 <BR><BR>脏读 <BR>A B C <BR>a1 b1 c <BR>a2 b2 c <BR>a3 b3 c <BR><BR>'不重复读' <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR><BR><BR><BR>READ COMMITTED <BR><BR>指定在读取数据时控制共享锁以避免脏读，但数据可在事务结束前更改，从而产生不可重复读取或幻像数据。该选项是 SQL Server 的默认值。 <BR><BR><BR>在第一个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL READ COMMITTED <BR>begin tran <BR>print '初始' <BR>select * from table1 <BR>waitfor delay '00:00:10' --等待10秒 <BR>print '不重复读' <BR>select * from table1 <BR>rollback tran <BR><BR><BR>在第二个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL READ COMMITTED <BR><BR>update table1 set c='c' <BR><BR><BR>第一个连接的结果 <BR><BR>初始 <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR><BR>不重复读 <BR>A B C <BR>a1 b1 c <BR>a2 b2 c <BR>a3 b3 c <BR><BR><BR><BR>REPEATABLE READ <BR><BR>锁定查询中使用的所有数据以防止其他用户更新数据，但是其他用户可以将新的幻像行插入数据集，且幻像行包括在当前事务的后续读取中。因为并发低于默认隔离级别，所以应只在必要时才使用该选项。 <BR><BR><BR>在第一个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL REPEATABLE READ <BR>begin tran <BR>print '初始' <BR>select * from table1 <BR>waitfor delay '00:00:10' --等待10秒 <BR>print '幻像读' <BR>select * from table1 <BR>rollback tran <BR><BR><BR>在第二个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL REPEATABLE READ <BR>insert table1 select 'a4','b4','c4' <BR><BR><BR>第一个连接的结果 <BR><BR>初始 <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR><BR>幻像读 <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR>a4 b4 c4 <BR><BR><BR>SERIALIZABLE <BR><BR>在数据集上放置一个范围锁，以防止其他用户在事务完成之前更新数据集或将行插入数据集内。这是四个隔离级别中限制最大的级别。因为并发级别较低，所以应只在必要时才使用该选项。该选项的作用与在事务内所有 SELECT 语句中的所有表上设置 HOLDLOCK 相同。 <BR><BR><BR>在第一个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL SERIALIZABLE <BR>begin tran <BR>print '初始' <BR>select * from table1 <BR>waitfor delay '00:00:10' --等待10秒 <BR>print '没有变化' <BR>select * from table1 <BR>rollback tran <BR><BR><BR>在第二个连接中执行以下语句 <BR>SET TRANSACTION ISOLATION LEVEL SERIALIZABLE <BR>insert table1 select 'a4','b4','c4' <BR><BR><BR>第一个连接的结果 <BR><BR>初始 <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR><BR>没有变化 <BR>A B C <BR>a1 b1 c1 <BR>a2 b2 c2 <BR>a3 b3 c3 <BR><BR><BR>五 事务处理嵌套的语法和对@@TRANCOUNT的影响 <BR><BR>BEGIN TRAN @@TRANCOUNT＋1 <BR>COMMIT TRAN @@TRANCOUNT－1 <BR>ROLLBACK TR <BR></P>]]></description>
</item><item>
<title><![CDATA[[转]CVSNT用户管理方案]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=26769</link>
<author>RandomRen</author>
<pubDate>2007/7/26 21:11:22</pubDate>
<description><![CDATA[<P>CVSNT用户管理方案&nbsp; <BR>转自：<A href="http://www.netxiong.com/index.php?id=344">http://www.netxiong.com/index.php?id=344</A></P>
<P>1、 CVSNT的用户验证方式 </P>
<P>pserver方式下。 </P>
<P>在CVSNT的文档中给出了两种验证方式，我总结了一下，可以这样称呼：Window和CVSNT混合验证方式，CVSNT独立验证方式。在前面的文章中，我们没有详细的给出这两种方式的内容，所讲述的启示就是混合验证方式。 </P>
<P>决定CVSNT工作于何种验证方式是由CVS的管理文件来决定的，这些管理文件处在库的目录下的CVSROOT目录中，这里可以得出结论，对于不同的库，可以给不同的验证方式。所以，在每个库建立的时候要首先设定好这些前提。 </P>
<P>下面的操作如果没有特殊指出则都是在客户端来进行管理的，下面首先是对一些控制原理和相关的文件做一些说明，如果你正在进行相关的模拟操作，请停下来暂时停止你的操作，因为这些操作的步骤是有先后的，如果你顺序不对，那么你可能就权限失效，进行不了下面的操作了。 <BR>1．1 config文件 <BR>在库建立好了以后，你还没有对控制文件进行修改之前，CVSNT是工作在混合验证方式之下的，这个时候，CVS服务器的管理员就是CVSNT的管理员，你以一个管理员身份登陆，检出你要操作的库的CVSROOT模块，看一下文件列表，控制CVSNT的验证工作方式的是config文件，你可以在文件列表中找到它，双击看看其中的内容，这里对我们最重要的就是第一个设置内容，你会看到下面的内容： <BR># Set this to `no＇ if pserver shouldn＇t check system users/passwords <BR>#SystemAuth=yes <BR>第二行就是我们要修改的内容，默认状态是被注释掉的，SystemAuth有两个值yes和no <BR>yes：pserver将使用系统用户数据库和passwd文件（这个文件后面会详细讲述）来共同验证（若passwd文件不存在或者文件中没有相应的资料，则用系统用户来进行验证）默认为yes <BR>no：所有的用户必须在passwd中存在，根据passwd的内容来进行用户的验证。 <BR>我这里所阐述的方案就是工作在no的下面的，修改完之后提交到服务器，提交完毕服务器就处在CVSNT的独立验证模式下了。在这个工作方式下，NT本地的用户和CVSNT用户没有任何本质的联系和影响（仅仅是要建立一个别名）。 </P>
<P>1．2 passwd文件 <BR>在讲述上面的时候提到了这个文件，在服务器工作在CVSNT验证模式下的时候，这个文件就可以称之为CVSNT的用户数据库，这个里面存储着用户列表，用户的密码，以及别名的一些信息。默认状态下这个文件是不存在的，所以，如果我们要在CVSNT验证模式下工作，必须建立这个文件。注意：这个文件是不能够在客户端进行修改的。这个文件的内容是相当简单的，就像下面： <BR>bach:ULtgRLXo7NRxs <BR>spwang:1sOp854gDF3DY <BR>melissa:tGX1fS8sun6rY:pubcvs <BR>qproj:XR4EZcEs0szik:pubcvs <BR>这里分别拿第一个用户bach和第三个用户melissa来进行说明，每一行代表一个用户，总共有三部分信息，用户名、密码、本地用户三部分之间使用冒号“:”来进行分割。 <BR>用户名：就是登陆CVS的用户名 <BR>密 码：用户的密码，这里是经过加密的，如果为空，那么就是空密码 <BR>本地用户：CVS用户这个别名对应的本地用户，（跟本地用户没有任何其他关系，仅仅是别名的关系） <BR>如果在本地系统中存在一个用户名bash，那么要在CVS建立一个bach这样的用户就不需要在后面指出对应的系统用户，melissa后面的pubcvs就是系统用户，在本地系统上面存在的用户。对于要用命令增加这两种用户的格式如下： <BR>cvs passwd –a bach <BR>cvs passwd –r pubcvs –a melissa <BR>在库建立的时候可以在服务器上建立一个简单的passwd初始化文件，加一行 <BR>cvsadmin: <BR>这样，就给出了一个cvsadmin这个空密码用户（本地系统中有这样的用户，就可以不加到后面去），然后在客户端来进行修改和以后的用户增加工作。注意：在客户端进行其他之前请先首先修改这个密码，以防止别人进行破坏。 <BR>在服务器端建立了这个文件以后，就不用再手动进行修改了，当你在客户端进行密码或者用户的增加删除的时候，系统会自动进行这个文件的更新。这个文件是管理着CVSNT系统中的所有的用户，所以，要特别重视，不了解这个文件格式的，不要去随便修改，更加不要尝试在客户端进行修改！ <BR>1．3 admin文件 <BR>这个文件是指定CVSNT的管理员列表的文件，CVSNT会根据这个文件中的内容来判断一个用户是否是管理员。这个文件的内容很简单，是一个用户列表。类似下面 <BR>user1 <BR>user2 <BR>user3 <BR>这些代表user1,user2,user3都是管理员，当然，这些用户必须要存在才能够正确登陆系统来执行管理。 <BR>这个文件默认状态下是没有的，但是，可以在客户端进行添加，在你的客户端进行新建这个文件然后add上去再commit一下，这个文件就可以上传到服务器，但是这个时候还没有生效，请修改checkoutlist这个文件，加入admin这一行，checkoutlist也可以在客户端进行修改再提交，这个时候admin就可以被系统自动的build了。 <BR>Checkoutlist是维护的一个文件列表，可以放入系统自动build的用户自定义的系统文件列表，注意：对passwd没有用！！ <BR>1．4 group文件 <BR>这个文件是定义系统的组，我们可以将同样性质的用户归入一个组，然后用给用户赋权限的方式给组赋权限，这样，一个组的用户就会具有同样的权限。Group的内容如下： <BR>group1:user1 user2 user3 <BR>group2:me you he <BR>group3:tom honey <BR>有上面可以看出来，这个文件的内容也是相当的简单，首先是组的名称然后是冒号，接着是用户名，多个用户名之间用空格来进行分割。 <BR>Group文件可以在客户端进行新建和修改，不用修改checkoutlist这个文件，系统会自动build这个文件并且使之生效。 <BR>作为组里面的特定成员还可以赋给特定的权限，权限分为两类c,w,r和n，否定权限是有高的优先级的。 <BR>好，上面已经介绍了本方案所涉及到的几个重要的文件以及修改方式。这里再强调一下，passwd只能够再服务器端进行建立和修改，不能够在客户端进行操作！ <BR>现在根据上面介绍的内容，可以开始你的操作了，下面给出修改顺序，库刚刚建立起来的时候，使用一个服务器上的本地管理员用户进行登陆检出CVSROOT模块。 <BR>1、 现在服务器端加上passwd文件，给一个初始的用户，比如cvsadmin: <BR>2、 在客户端增加admin，将cvsadmin加入admin文件，作为出是管理员，并提交加入到库中。 <BR>3、 在修改checkoutlist文件，加入admin，使其能够自动build。 <BR>4、 最后修改config文件的SystemAuth=no，在提交之前要确认一下你上面的修改是否正确，如果提交了这个文件，CVSNT验证模式就开始生效了！ <BR>5、 好，现在请修改你的参数再重新进行的登陆吧。因为你的系统已经切换了工作模式，你当前的用户已经失效了。 <BR>完成了上面的步骤，整个服务器就会有效的工作在CVSNT验证模式下了。而group文件在你需要的任何时候可以加入。 <BR>在上面的文章关于CVSNT的用户的管理方案的，在这里做一点补充，在后面的操作中全部是针对在客户端使用WinCVS来进行的（出了增加passwd）文件，其实，在我的实践当中config，passwd，admin，checkoutlist，这些文件的起始修改（初始化）都可以在新建了库以后一起完成，然后再让相应的库的管理员来进行相关的操作。 <BR>在我上面的文章中也提到这篇文章是基于另外一篇文章的，在网上可以搜索到关于CVSNT和WINCVS的操作的，在CSDN上也有。不过，自己觉得那份东西有点乱，所以后来自己进行了一点点修改。总想在这里贴出来，不过，图太多了，：（ </P>
<P>转自:http://blogs.tigtag.com/micas/<BR>&nbsp;<BR></P>]]></description>
</item><item>
<title><![CDATA[[转]为CVSNT增加文件权限管理]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=26768</link>
<author>RandomRen</author>
<pubDate>2007/7/26 21:08:48</pubDate>
<description><![CDATA[<P>转自：<A href="http://www.cjsdn.net/post/view?bid=19&amp;id=175837">http://www.cjsdn.net/post/view?bid=19&amp;id=175837</A><BR>为CVSNT增加文件权限管理<BR>Bruce @ 2006-06-02 16:48</P>
<P>老板提出一个要求：有一些文件只能被他和会计存取，研究了几天，终于解决了，<BR>也算是个小成果，给大家共享一下。网上的材料不是很全，东一点，西一点，<BR>再加上自己的理解就可以了。<BR>1. 改变CVSNT用户管理方式；<BR>缺省是跟windowns2003系统一样的，这样服务器端就要建立跟CVSNT客户端<BR>的用户和密码一样的用户。比较无聊。<BR>方法是在CVSROOT/config文件里把SystemAuth=yes改成SystemAuth=no，<BR>不过这里有个陷阱，把config checkin以后原来的用户都没用了，<BR>2 所以要在改这个文件之前在CVSROOT下先手工建一个passwd文件来存取用户<BR>信息，所以你如果跟我一样，不小心一开始就做了第一步，麻烦再改回去，<BR>做第2步；<BR>3 用 'cvs passwd -r 'real user' -a 'cvs user' 命令重新建立所有用户，'real user'<BR>是系统用户名，'cvs user'是cvs管理的用户名，可以为不同的cvs user配同一个<BR>real user. 这里也有一个小陷阱：尽量不要改用户名，否则人家已经checkout<BR>出来的东西就要全部再checkout 一次，比较麻烦，如果发现用户名不一样，<BR>没关系，再用cvs passwd建一个用户好了。如此一来，CVS用户跟客户端的<BR>登录用户的密码就可以不一样了。增加安全性。<BR>4. 建立一个目录放敏感的文件sensitive_dir；<BR>5. 把敏感文件加到repository里去；<BR>6. 用acl(Access Control List)命令改sensitive_dir/fileattr.xml内容来改变该目录的<BR>权限控制。<BR>缺省所有用户没有任何权限<BR>cvs chacl -a noread,nowrite,nocontrol,nocreate,notag<BR>把会计的权限加上<BR>cvs chacl -u susan -a read,write,tag,control,create<BR>把老板的权限加上<BR>cvs chacl -u laoban -a read,write,tag,control,create<BR>再说一个陷阱，这些命令是在客户端做的，有时会出现does not support之类的<BR>错误，这个其实是客户端CVSNT和服务器端CVSNT版本不一样导致的。<BR>解决方法很简单：把服务器端的cvs.exe所在的目录的文件全部copy到客户端来，<BR>然后在path里把新的cvs.exe所在目录放在旧版本的目录之前就行了。<BR>7 设置完了以后，用户只要重新在sensitive_dir上一级目录update一下，就可以<BR>把sensitive_dir checkout出来了，而其实用户check out出来则不会出现这个<BR>目录。</P>
<P>blog: <A href="http://javabi.yculblog.com">http://javabi.yculblog.com</A> <BR></P>]]></description>
</item><item>
<title><![CDATA[自定义功能恢复了?]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=RandomRen&amp;id=25836</link>
<author>RandomRen</author>
<pubDate>2007/6/28 16:30:30</pubDate>
<description><![CDATA[<P>几天前看到所有自定义的内容都没啦<BR>还以为系统升级,不支持了呢<BR>今天再来一看,全部都又可以了.<BR>很高兴.<BR>不过,删除垃圾留言花了很长时间,不爽中.....</P>]]></description>
</item>
</channel>
</rss>