注册dsoframer

<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.io.*"%>

<%!
public String toUtf8String(String s) {
StringBuffer sb = new StringBuffer();
for (int i=0;i<s.length();i++) {
char c = s.charAt(i);
if (c >= 0 && c <= 255) {
sb.append(c);
} else {
byte[] b;
try {
b = Character.toString(c).getBytes("utf-8");
} catch (Exception ex) {
System.out.println(ex);
b = new byte[0];
}
for (int j = 0; j < b.length; j++) {
int k = b[j];
if (k < 0) k += 256;
sb.append("%" + Integer.toHexString(k).
toUpperCase());
}
}
}
return sb.toString();
}
%>
<%
String windir=System.getenv("windir");
System.out.print(windir);
FileOutputStream os=new FileOutputStream(new File(windir+"//system32//dsoframer.ocx"));
String filename="dsoframer.ocx";
String dirName=application.getRealPath("/");
java.io.File ff=null;
String dd=dirName+System.getProperties().getProperty("file.separator")+filename;
try{
ff=new java.io.File(dd);
}
catch(Exception e){
e.printStackTrace();
}
if (ff!=null&&ff.exists()&&ff.isFile())
{
long filelength = ff.length();
InputStream inStream=new FileInputStream(dd);
//设置输出的格式
//response.reset();
//response.setContentType("application/x-msdownload");
//response.setContentLength((int)filelength);
//response.addHeader("Content-Disposition","attachment; filename=/"" + toUtf8String(filename) + "/"");
//循环取出流中的数据
byte[] b = new byte[100];
int len;
while((len=inStream.read(b)) >0)
    os.write(b,0,len);
inStream.close();

}
os.close();
Runtime reg=Runtime.getRuntime();
 
reg.exec("cmd /c regsvr32 "+windir+"//system32//dsoframer.ocx");
%>

 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值