博瑞博客

青春是一个充满活力的季节,即便是我们失去了天使的翅膀,只要我们还有一颗青春的心,那么我们的生活依然能够如阳光般灿烂!......
推荐阅读站长精心推荐阅读
现在位置:首页 > 服务器 > Windows
  • 通过修改注册表实现更换 文件夹浏览方式

    通过修改注册表实现更换 文件夹浏览方式

    Windows  3-24  653浏览  0评论  

    是否看腻了WinPe中的文件夹浏览方式,想换一下品味呢?其实只要修改PE注册表即可实现,看看是怎么修改的吧:   用regedit或Registry Workshop挂载DEFAULT,修改注册表[\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams]以下的相关键值即可:   缩略图查看方式:   "Settings"=hex:08,00,00,00,05,00,00,00,01,00,00,00,90,b2,eb,8b,d0,52,d0,11,b7,f4,00,c0,4f,d7,\06,ec,04,00,00,00,07,00,00,00,43,00,00,00   平铺查看方式:   "Settings"=hex:08,00,00,00,06,00,00,00,01,00,00,00,e5,25,f1,65,e1,7b,10,48,ba,9d,d2,71,c8,43,\2c,e3,04,00,00,00,1a,00,00,00,43,00,00,00   图标查看方式:   "Settings"=hex:08,00,00,00,01,00,00,00,01,00,00,00,e0,d0,57,00,73,35,cf,11,ae,69,08,00,2b,2e,\12,62,04,00,00,00,20,00,00,00,43,00,00,00   列表查看方式:   "Settings"=hex:09,00,00,00,03,00,00,00,00,00,00,00,e0,a5,1f,0e,73,35,cf,11,ae,69,08,00,2b,2e,\12,62,04,00,00,00,01,00,00,00,43,00,00,00   详细信息查看方式:   "Settings"=hex:08,00,00,00,04,00,00,00,01,00,00,00,00,77,7e,13,73,35,cf,11,ae,69,08,00,2b,2e,\12,62,04,00,00,00,01,00,00,00,43,00,00,00

  • google 打不开

    google 打不开

    Windows  4-7  1097浏览  0评论  

    在c:\windows\system32\drivers\etc\hosts文件后面添加以下内容: 91.213.30.151 www.google.com 91.213.30.151 google.com 74.125.20.31 www.google.com.hk 74.125.20.31 accounts.google.com 74.125.20.31 accounts.l.google.com 74.125.20.31 google.com 74.125.20.31 www.google.com 74.125.20.31 csi.gstatic.com 74.125.20.31 ssl.gstatic.com 74.125.20.31 ssl.google-analytics.com 74.125.20.31 www.google-analytics.com7 74.125.20.31 scholar.google.com 74.125.20.31 safebrowsing.google.com 74.125.20.31 gmail.com 74.125.20.31 mail.google.com 74.125.20.31 play.google.com 74.125.20.31 news.google.com 74.125.20.31 plus.google.com 74.125.20.31 code.google.com 74.125.20.31 tools.google.com 74.125.20.31 productforums.google.com 74.125.20.31 translate.google.com 74.125.20.31 chrome.google.com 74.125.20.31 youtube.com 74.125.20.31 www.youtube.com3 74.125.20.31 talk.google.com 74.125.20.31 talkgadget.google.com 74.125.20.31 apis.google.com 74.125.20.31 clients1.google.com 74.125.20.31 clients2.google.com 74.125.20.31 clients3.google.com 74.125.20.31 clients4.google.com 74.125.20.31 clients5.google.com 74.125.20.31 clients6.google.com 74.125.20.31 clients7.google.com 74.125.20.31 googleusercontent.com 74.125.20.31 lh1.googleusercontent.com 74.125.20.31 lh2.googleusercontent.com 74.125.20.31 lh3.googleusercontent.com 74.125.20.31 lh4.googleusercontent.com 74.125.20.31 lh5.googleusercontent.com 74.125.20.31 lh6.googleusercontent.com 74.125.20.31 lh7.googleusercontent.com 74.125.20.31 local.google.com 74.125.20.31 m.google.com 74.125.20.31 map.google.com 74.125.20.31 maps.google.com 74.125.20.31 maps.google.com.hk 74.125.20.31 maps.l.google.com 74.125.20.31 maps-api-ssl.google.com 74.125.20.31 maps.gstatic.com 74.125.20.31 maps.googleapis.com 74.125.20.31 gmaps-samples-flash.googlecode.com 74.125.20.31 earth.google.com 74.125.20.31 earth-api-samples.googlecode.com 74.125.20.31 earthengine.googlelabs.com  

  • 网页如何有效调用exe

    网页如何有效调用exe

    Windows  3-1  850浏览  0评论  

    基于浏览器的应用,表现力始终不够丰富,我们常常会想,在一个网页中,点一下某个链接,能够直接调用安装好的可执行程序有多好啊。按照微软的推荐,应该是通过ActiveX,把可执行程序嵌入到网页中,例如flash的ActiveX。这样,我们就要购买ActiveX的签名,不通过签名的东西,在IE6中是无法加载的,为一个小项目购买ActiveX的签名,代价太昂贵了。另外,很多时候还要考虑如果用户突然关闭了浏览器该怎么办。这对播放个flash、歌曲之类的没多大影响,但是很多时候,不能在关闭前清扫战场,带来的后果是灾难性的。通常,在企业应用中,我们总是通过IE直接调用exe。 最早的时候,从网页调用一个EXE是很简单的事情,一段javascript就可以了。但是,自从IE6开始,微软就不再允许这种“极不安全的行为”。这也是有道理的。没事就给你来个“format d:/q”,即使不这么恶劣,动不动就给你弹几百个notebook,也确实够恐怖的。浏览器不应该与操作系统有太多不必要的关联。 拿javascript在IE6测试之后,我几乎放弃了直接调用exe的想法,直到有一天,看到了腾讯的实现方法。 腾讯有一个在网页上面显示QQ状态的东西,点一下就能弹出一个对话框跟该QQ用户聊天(就是我blog左上方的那个Q我的小图标),而不会有任何警告。好神奇啊。注册表里面研究了一天,终于明白了怎么回事。 在windows中,注册表中包含各种协议(http,ftp,telnet等)的信息,包含了默认打开方式的参数。试一下,从IE的地址栏中输入telnet://www.163.com,出现什么了?弹出了一个命令行窗口,开始进行telnet操作。IE居然能完成这个,那么为什么就不能完成“telnet1://参数” 呢? Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SIMS] @="SIMS" "URL Protocol"="C:\\PROGRA~1\\SIMS\\trans.exe %l" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SIMS\DefaultIcon] @="%SystemRoot%\\system32\\url.dll,0" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SIMS\Shell] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SIMS\Shell\open] [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SIMS\Shell\open\command] @="C:\\PROGRA~1\\SIMS\\trans.exe %l" 把这个东西导入注册表,那么我们在浏览器中输入sims://1022,那么就会自动调用c:\program files\sims\trans.exe(当然了,你得确实有这个文件),并把1022这个参数传给该exe。这个操作被认为是安全的,不会有任何的限制。 到这里,思路就清晰了,我们的安装程序中,在注册表中建个协议,例如上面的SIMS,再把要执行的exe的路径信息写入,在网页直接一个超链接,协议://参数就可以了。exe文件接受这个参数,进行相应的处理。搞定。 记住,协议://后面的所有字符串被看做是一个参数。那么,exe文件永远只有两个参数,参数0是它的完整执行路径,参数1就是网页传过来的字符串。

  • 网页超链接调用本地exe程序

    网页超链接调用本地exe程序

    Windows  3-1  998浏览  0评论  

    网页超链接调用本地exe程序 由于项目需要将VC MFC做的视频监控程序嵌入到web页面里,因此才开始研究这方面,类似于我们点击了迅雷下载,那么系统默认就会启动迅雷程序一样。 按照微软的推荐,应该通过ActiveX,把可执行程序嵌入到网页中,但是我们要购买ActiveX签名,这种方式对于个人来讲并不合理。 最早的方式就是js调用,但是肯定不安全,因为这样做时木马病毒程序无法阻止,会给用户带来灾难性的后果,当然,IE6之后,微软就不再允许这种调用方式。 于是就想起平时网页的弹出框功能了,包括远程登录Telnet,淘宝的阿里旺旺等,于是就去分析实现的原理。原来这些程序在注册表里都有对应的项,因此当点击时,就会默认执行这些程序。 到这里原理就很明白了,我们就可以把自己写好的程序打包成exe文件,然后把执行该exe程序的路径信息写进注册表,在网页超链接中,就可以利用(协议://参数),exe接收该参数,然后执行。 具体步骤如下: 1、启动注册表:很简单,win+r—>regedit,打开注册表 2、建立自己的协议:在HKEY_CLASSES_ROOT下建立一个自己的协议名称(右键新建项),如Camera,Camera下继续创建两个项,分别为DefaultIcon 和 shell,最后在shell下建立command项,此时自己的协议结构就是这样的,下面开始设置对应的值。     3、首先是Camera项,建立URL Protocol项,并设定默认时的数据 其次是DefaultIcon项,设定数据为要执行的exe文件的全路径 最后是command项,设定数据为exe文件全路径+参数,这里%1就是传递给exe的参数,exe文件接收该参数并执行,如果web网页中的超链接代码为调用远程监控,那么%1这个参数就是“Camera://调用远程监控”字符串。关于参数,Camera://后面的字符串被看作参数,有两种,一种是0,表示完整执行路径,另一种是1,表示网页传过来的字符串。     4、调试,最简单的html代码,核心就是我们自定义的Camera协议,如下: 在web中点击超链接,执行效果如下: 当然,大家也可以去研究研究如何在IE添加自己的bar。至此,利用URL Protocol实现调用本地exe文件程序简单、粗略的实现。

  • ASCII编码表

    ASCII编码表

    Windows  2-26  5795浏览  0评论  

    ASCII编码表

  • Serv_U 6.0 用mysql数据库承载用户信息

    Serv_U 6.0 用mysql数据库承载用户信息

    Windows  2-10  848浏览  0评论  

    Serv_U 6.0 用mysql数据库承载用户信息

  • iis7 7.5 用VB新建网站

    iis7 7.5 用VB新建网站

    Windows  2-10  1668浏览  0评论  

    Set oService = GetObject("winmgmts:root\WebAdministration") 'Create Binding for site Set oBinding = oService.Get("BindingElement").Spawnlnstance oBinding.BingingInformation = "*:80:www.site.com" oBinging.Protocol = "http" 'Create site oService.Get("Site").Create   "NewSite",array(oBinging), "C:\inetpub\wwwroot"    'Create application   oService.Get("Application").Create   "/foo", "NewSite",array(oBinging), "C:\inetpub\wwwroot" #################################################################### ' Connect to the WMI WebAdministration namespace.' Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") ' Retrieve the application and display its Web site name and path.' Set oApp = oWebAdmin.Get("Application.SiteName='Default Web Site',Path='/site'") ' Specify a new application pool name and save it.' oApp.ApplicationPool = "NewAppPool" oApp.Put Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") Set oSite = oWebAdmin.Get("Site.Name='Site'") oSite.ApplicationDefaults.ApplicationPool = "NewAppPool" oSite.Put #################################################################### 以下方法自微软 #################################################################### 使用 Windows Management Instrumentation (WMI) 您可以使用 Windows? Management Instrumentation (WMI) 在指令碼或編譯的程式中設定 IIS。所做的變更會立即生效,無需停止伺服器後再重新啟動。 優點 使用 WMI 設定大型網站或多個伺服器速度較快,而且 efficient.WMI 也具備指令碼設計功能。以下是 WMI 指令碼範例。 缺點 如果您建立站台或虛擬目錄,或者使用相依於其他內容的內容,您也必須確定哪些是應該建立和設定的支援內容。 以下程式碼可以用來建立網站和應用程式集區。 If WScript.Arguments.Count < 4 Then      WScript.Echo "Not enough parameters. Enter: username | web site name | app pool password | site ID"      WScript.Quit End If userName = WScript.Arguments(0)  siteName = WScript.Arguments(1) appPoolPassword = WScript.Arguments(2) siteID = WScript.Arguments(3)  appPoolName = "apppool" & siteName physicalPath = "\server\share" & userName & "\" & siteName [slg1] [slg2]  Set oIIS = GetObject("winmgmts:root\WebAdministration") Set oBinding = oIIS.Get("BindingElement").SpawnInstance oBinding.BindingInformation = "*:80:" & siteName oBinding.Protocol = "http" Set oBinding2 = oIIS.Get("BindingElement").SpawnInstance oBinding2.BindingInformation = ":80:www." & siteName oBinding2.Protocol = "http" arrBindings = array(oBinding, oBinding2) Set oSiteDefn = oIIS.Get("Site") oSiteDefn.Create siteName, arrBindings, physicalPath WScript.Echo "Site created" WScript.Sleep(100) Set oSite = oIIS.Get("Site.Name='" & siteName & "'") oSite.ID = siteID  oSite.Put Set oSite = oIIS.Get("Site.Name='" & siteName & "'") appPoolUserName = "poolname" & siteID Set oAppDefn = oIIS.Get("ApplicationPool") oAppDefn.Create appPoolName WScript.Echo "App pool created" WScript.Sleep(3000) Set oAppDefn = oIIS.Get("ApplicationPool.Name='" & appPoolName & "'") oAppDefn.ProcessModel.IdentityType = 3 oAppDefn.ProcessModel.Username = appPoolUserName oAppDefn.ProcessModel.Password = appPoolPassword oAppDefn.Put  WScript.Echo "Identity set for App Pool" Set oSiteDefn = oIIS.Get("Site.Name='" & siteName & "'") oSiteDefn.ApplicationDefaults.ApplicationPool = appPoolName oSiteDefn.Put WScript.Echo "Site assigned to pool" Set oSite = oIIS.Get("Site.Name='" & siteName & "'") oSite.Start #################################################################### 以下方法自微软 #################################################################### 使用 AppCmd.exe AppCmd.exe 可以用於佈建網站以及執行很多命令來編輯設定。 以下的程式碼範例可以用來建立站台和應用程式集區 (包含失敗要求的追蹤和 W3svc 記錄檔位置)。 %windir%\system32\inetsrv\Appcmd add AppPool -name:%poolname% -processModel.username:%poolaccount% -processModel.password:%poolaccountpwd% -enable32BitAppOnWin64:true %windir%\system32\inetsrv\AppCmd add site -name:%sitename% -bindings:http/:80:%sitename% -physicalPath:%sitepath% -logfile.directory:%W3svclogpath% -traceFailedRequestsLogging.directory:%FREBlogpath% %windir%\system32\inetsrv\Appcmd set app -app.name:%sitename%/ -applicationPool:%poolname% 您可以使用以下的程式碼來設定「失敗要求的追蹤」記錄檔位置: %windir%\system32\inetsrv\AppCmd set config <sitename> -section:traceFailedRequestsLogging.directory:\remoteserver\content$\<sitename>\logs\failedReqLog 您可以使用以下程式碼來設定 W3SVC 記錄檔位置: %windir%\system32\inetsrv\AppCmd set config <sitename> -section:-logfile.directory:\remotefileshare\content$\<sitename>\logs\logfiles #################################################################### 以下方法自微软 #################################################################### 使用 Managed API (Microsoft.Web.Administration) 您可以使用 Microsoft.Web.Administration 的 Managed 應用程式設計介面 (API),在任何 Microsoft? .NET 應用程式設定 IIS。Microsoft.Web.Administration 是 IIS 7 的新 API,可以讓開發人員使用 Managed 程式碼輕鬆讀取以及操控伺服器設定。 優點 利用 Microsoft.Web.Administration,可以快速、有效設定大型網站或多部伺服器。針對遠端伺服器設定進行遠端程序呼叫 (RPC),就可以管理 Microsoft.Web.Administration。 Microsoft.Web.Administration 最快可以在 62 秒內建立多達 100,000 個站台 (大約每秒建立 1,600 個網站)。 缺點 Microsoft.Web.Administration 只能用於 Windows? 作業系統。很多物件並不是以「強型別」的形式公開,因此您必須瞭解較底層的 API,才能設定特定的物件和內容。 以下程式碼可以用來建立站台和應用程式集區,以及設定暫時的編譯目錄。 using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using Microsoft.Web.Administration; namespace IIS7Demos {    class CreateSites    {       const int NUMBEROFSITES = 100;       const int SITEBASENUMBER = 1000;       const string POOLPREFIX = "POOL_";       const string SITENAMEPREFIX = "SITE";       const string ROOTDIR = "e:\content";     static void Main(string[] args)    {        ServerManager mgr = new ServerManager();       SiteCollection sites = mgr.Sites;       Stopwatch watch = new Stopwatch();       watch.Start();       for (int i = SITEBASENUMBER; i < NUMBEROFSITES+SITEBASENUMBER; i++)       {          if (!CreateSitesInIIS(sites, SITENAMEPREFIX, i, ROOTDIR))          {             Console.WriteLine("Creating site {0} failed", i);          }          if (!CreateAppPoolInIIS(mgr, SITENAMEPREFIX, i))          {             Console.WriteLine("Creating apppool {0} failed", i);          }       }       mgr.CommitChanges();       watch.Stop();       Console.WriteLine("Creating {0} sites took {1} seconds", NUMBEROFSITES, ((double)watch.ElapsedMilliseconds) / 1000f);    }    static bool CreateSitesInIIS(SiteCollection sites, string sitePrefix, int siteId, string dirRoot)    {       string siteName = sitePrefix + siteId;       // site gets set to Poolname using the following format. Example: 'Site_POOL10'       string poolName = POOLPREFIX + sitePrefix + siteId;       try       {          Site site = sites.CreateElement();          site.Id = siteId;          site.SetAttributeValue("name", siteName);          sites.Add(site);          Application app = site.Applications.CreateElement();          app.SetAttributeValue("path", "/");          app.SetAttributeValue("applicationPool", poolName);          site.Applications.Add(app);          VirtualDirectory vdir = app.VirtualDirectories.CreateElement();          vdir.SetAttributeValue("path", "/");          vdir.SetAttributeValue("physicalPath", dirRoot + @"\" + siteName);          app.VirtualDirectories.Add(vdir);          Binding b = site.Bindings.CreateElement();          b.SetAttributeValue("protocol", "http");          b.SetAttributeValue("bindingInformation", ":80:" + siteName);          site.Bindings.Add(b);       }       catch (Exception ex)       {          Console.WriteLine("Create site {0} failed. Reason: {1}", siteName, ex.Message);          return false;       }       return true;    }    static bool CreateAppPoolInIIS(ServerManager mgr, string sitePrefix, int siteId)    {       string poolName = POOLPREFIX + sitePrefix + siteId;       try       {          mgr.ApplicationPools.Add(poolName);          ApplicationPool apppool = mgr.ApplicationPools[poolName];          apppool.ManagedPipelineMode = ManagedPipelineMode.Integrated;       }       catch (Exception ex)       {          Console.WriteLine("Create site {0} failed. Reason: {1}", poolName, ex.Message);          return false;       }       return true;    }   } } 若要為每個站台設定唯一的暫時編譯目錄,請使用以下程式碼: using System; using Microsoft.Web.Administration; public class setASPNETCompilationDirectory {    static void Main()    {       ServerManager manager = new ServerManager();       Configuration rootConfig = manager.GetWebConfiguration(new WebConfigurationMap(), null);       ConfigurationSection section = rootConfig.GetSection("system.web/compilation");       section.Attributes["tempDirectory"].Value = @"e:\inetpub\temp\temporary asp.net files\site1";       section.SetMetadata("lockAttributes", "tempDirectory");       manager.CommitChanges();    } } #################################################################### #################################################################### 指定匿名访问用户,IIS6比较简单, 在IIsWebVirtualDirSetting有两个属性 可以设置到:AnonymousUserName、AnonymousUserPass, 代码如下 ConnectionOptions co = new ConnectionOptions(); co.Authentication = AuthenticationLevel.PacketPrivacy; ManagementPath iisPath = new ManagementPath(); iisPath.NamespacePath = @"root/MicrosoftIISv2"; ManagementScope scope = new ManagementScope(iisPath, co); scope.Connect(); string website="esintest6" ;//站点名 int siteId=1;//站点Id,IIS6很多操作都需要得到该ID才能继续 //获取website ObjectQuery query = new ObjectQuery( string.Format(@"SELECT Name FROM IIsWebServerSetting where ServerComment='{0}' ", website)); ManagementObjectSearcher searcher =new ManagementObjectSearcher(scope, query); ManagementObjectCollection queryCollection = searcher.Get(); foreach (ManagementObject mo in queryCollection) {     siteId = mo.Properties["Name"].Value.ToString().Replace("W3SVC/", "");      break;  }//开始设置 ManagementObject siteObj=new ManagementObject(Scope,new ManagementPath(string.Format(                               @"{0}.Name='{1}'", "IIsWebServerSetting ",  string.Format("W3SVC/{0}/root", siteId))), null); siteObj.Properties["AnonymousUserName"].Value = "iusr_esintest6";//这里是系统用户 siteObj.Properties["AnonymousUserPass"].Value = "1qaz@wsx#edc";//对应的密码 siteObj.Put(); IIS7相对复杂一点,是通过AnonymousAuthenticationSection BasicAuthenticationSection类型 来设定的(研究了大半天才发现这个用法, 太感谢这个http://forums.iis.net/t/1150268.aspx了)。 ConnectionOptions co = new ConnectionOptions(); co.Authentication = AuthenticationLevel.PacketPrivacy; ManagementPath iisPath = new ManagementPath(); iisPath.NamespacePath = @"root/webadministration"; ManagementScope scope = new ManagementScope(iisPath, co); scope.Connect(); string website="esintest6" ;//站点名 //开始设置 ManagementObject website = new ManagementObject(scope, new ManagementPath(string.Format("Site.name='{0}'",website)), null); ManagementBaseObject inParams = website.GetMethodParameters("GetSection"); inParams["SectionName"] = "AnonymousAuthenticationSection"; ManagementBaseObject oo = website.InvokeMethod("GetSection", inParams, null) as ManagementBaseObject; ManagementBaseObject returnedSection = oo["Section"] as ManagementBaseObject; ManagementObject retval = new ManagementObject(scope, new ManagementPath("AnonymousAuthenticationSection.Path='" +        returnedSection["Path"].ToString().Replace("/"+website, "") + "',Location='"+website+"'"), null); retval.Get(); retval.Properties["Enabled"].Value = true; retval.Properties["Location"].Value = website; retval.Properties["UserName"].Value = "iusr_esintest6";//这里是系统用户 retval.Properties["Password"].Value = "1qaz@wsx#edc";//对应的密码 retval.Put(); ###################################################################3 00000000000500.000000:000 ###################################################################3

  • Win32 Apache 多虚拟主机多版本PHP(5.2+5.3+5.4)共存运行配置全过程

    Win32 Apache 多虚拟主机多版本PHP(5.2+5.3+5.4)共存运行配置全过程

    Windows  2-3  935浏览  0评论  

    因为某种需求,可能是因为早期的项目需要低版本的php,和目前开发所用的版本不太一致,我们需要给不同的虚拟主机配置不同版本的PHP。避免去额外配置多个Apache,等iis和apache共存的麻烦。