Delphi32位程序拷贝system32目录中文件解决方法!
源码下载:http://download.csdn.net/detail/sunylat/9740352
unit Unit1; interface uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations } function DisableWowRedirection: Boolean; function RevertWowRedirection: Boolean;
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} uses System.IOUtils; procedure TForm1.Button1Click(Sender: TObject);
const
sourceFile = 'c:\windows\system32\bcdedit.exe';
var
destFile: string;
begin
destFile := ExtractFilePath(paramstr()) + 'bcdedit.exe'; try
self.DisableWowRedirection; try if TFile.Exists(sourceFile) = true then
begin self.Caption := '存在'; TFile.Copy(sourceFile, destFile);
end
else
begin self.Caption := '不存在';
end; except
on e: exception do
begin
showmessage(e.ToString);
end; end; finally
self.RevertWowRedirection;
end; end; function TForm1.DisableWowRedirection: Boolean;
type
TWow64DisableWow64FsRedirection = function(var Wow64FsEnableRedirection
: LongBool): LongBool; StdCall;
var
hHandle: THandle;
Wow64DisableWow64FsRedirection: TWow64DisableWow64FsRedirection;
isRedirect:LongBool;
begin
isRedirect := true;
try
hHandle := GetModuleHandle('kernel32.dll');
@Wow64DisableWow64FsRedirection := GetProcAddress(hHandle,
'Wow64DisableWow64FsRedirection');
if ((hHandle <> ) and (@Wow64DisableWow64FsRedirection <> nil)) then
Wow64DisableWow64FsRedirection(isRedirect);
except
isRedirect := False;
end; result:=isRedirect;
end; function TForm1.RevertWowRedirection: Boolean;
type
TWow64RevertWow64FsRedirection = function(var Wow64RevertWow64FsRedirection
: LongBool): LongBool; StdCall;
var
hHandle: THandle;
Wow64RevertWow64FsRedirection: TWow64RevertWow64FsRedirection;
isRedirect:LongBool;
begin
isRedirect := true;
try
hHandle := GetModuleHandle('kernel32.dll');
@Wow64RevertWow64FsRedirection := GetProcAddress(hHandle,
'Wow64RevertWow64FsRedirection');
if ((hHandle <> ) and (@Wow64RevertWow64FsRedirection <> nil)) then
Wow64RevertWow64FsRedirection(isRedirect);
except
isRedirect := False;
end; result:=isRedirect;
end; end.
参考文章:http://blog.csdn.net/gj333/article/details/8268379
Delphi32位程序拷贝system32目录中文件解决方法!的更多相关文章
- 在Windows下通过命令行或者.bat文件统计一个目录中文件数量
在Windows下面怎样通过命令行统计一个目录中文件的数量,或者说,如果在一个.bat文件中,统计一个目录中的文件数量? 我原来以为是不可能的,要编一个vbs程序什么的,后来到网上找了下,发现还真是可 ...
- java统计指定目录中文件的个数和总的大小
转: 统计指定目录中文件的个数和总的大小 package file; import java.io.File; import java.util.ArrayList; public class Fil ...
- C#统计目录中文件MD5值
1. [代码]统计目录中文件MD5值 using System.IO;using System.Security.Cryptography;using System.Collections;using ...
- 使用java 程序创建格式为utf-8文件的方法(写入和读取json文件)
使用java 程序创建格式为utf-8文件的方法: try{ File file=new File("C:/11.jsp"); ...
- SQL Server 无法在服务器上访问指定的路径或文件解决方法
SQL Server 无法在服务器上访问指定的路径或文件解决方法 在SQL Server附加数据库或备份数据库时出现:无法在服务器上访问指定的路径或文件. 请确保您具有必需的安全权限且该路径或文件存在 ...
- vmware tools安装程序无法继续,Microsoft Runtime DLL安装程序未能完成安装。的解决方法
vmware tools安装程序无法继续,Microsoft Runtime DLL安装程序未能完成安装.的解决方法_华英雄_新浪博客 http://blog.sina.com.cn/s/blog_5 ...
- svn冲突文件解决方法
svn冲突文件解决方法 工具/原料 svn客户端 方法/步骤 1 通过SVN客户端更新需要的文件,如果出现有感叹号的文件,找到出现感叹号的文件. 2 选择感叹号文件,即冲突文件,单击鼠标右键对冲突文件 ...
- WAMP安装提示缺少 msvcr100.dll文件解决方法
WAMP安装提示缺少wamp msvcr100.dll文件解决方法 因为wamp基于vs c++2010开发,需要提前安装这个组件才可以正常运行 微软官方组件下载地址: 32位:http://www. ...
- 关于STM32运行时程序卡在B.处的解决方法
文章转载自:https://blog.csdn.net/u014470361/article/details/78780444 背景: 程序运行时,发现程序卡死在B.处. 解决方法: 程序卡死在B.处 ...
随机推荐
- 将本地Jar包安装到maven仓库中去
开发中会遇到无法通过pom.xml下载jar包的情况,遇到这种情况我们可以手动在本地安装jar包到本地仓库中去,这样就可以下次再用到的话不用再次联网下载,具体以oracle的驱动包ojdbc6.jar ...
- quartz的配置文件
quartz在运行时默认加载的是工程目录下的quartz.properties文件,如果工程目录下没有quartz.properties文件,它就会去读取quartz jar包下的quartz.pro ...
- 网络编程基础之Socket套接字简单应用
一.Socket套接字实现通信循环 所谓通信循环,简单理解就是客户端可以给服务端循环发送信息并获得反馈的过程. 1.基础版 通信循环的程序分为两部分,即两个python模块,分别为客户端.py和服务端 ...
- 141. Linked List Cycle (List; Two-Pointers)
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using ex ...
- 71. Simplify Path压缩文件的绝对路径
[抄题]: Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/&q ...
- Tsung压力测试:Openfire
环境准备 安装Tsung.安装openfire.安装Spark 要对openfire进行压力测试,因此我们主要讲解如何利用jabber_register.xml在openfire上面注册用户,以及利用 ...
- 前端学习--HTML标签温习一
1.<a>标签 在所有浏览器中,链接的默认外观如下: 1)未被访问的链接带有下划线而且是蓝色的 2)已被访问的链接带有下划线而且是紫色的 3)活动链接带有下划线而且是红色的 提示:如果没有 ...
- jquery的get()方法
通过检索匹配jQuery对象得到对应的DOM元素. .get( [index ] ) index 类型: Integer 从0开始计数,用来确定获取哪个元素. .get() 方法允许我们直接访问jQu ...
- transform详解
1.简介 该算法用于实行容器元素的变换操作.有如下两个使用原型,一个将迭代器区间[first,last)中元素,执行一元函数对象op操作,交换后的结果放在[result,result+(last-fi ...
- [C++] const and char*
const and char* NOTICE: char *str = "hello"; the value of str is the address of the fi ...