源码下载: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目录中文件解决方法!的更多相关文章

  1. 在Windows下通过命令行或者.bat文件统计一个目录中文件数量

    在Windows下面怎样通过命令行统计一个目录中文件的数量,或者说,如果在一个.bat文件中,统计一个目录中的文件数量? 我原来以为是不可能的,要编一个vbs程序什么的,后来到网上找了下,发现还真是可 ...

  2. java统计指定目录中文件的个数和总的大小

    转: 统计指定目录中文件的个数和总的大小 package file; import java.io.File; import java.util.ArrayList; public class Fil ...

  3. C#统计目录中文件MD5值

    1. [代码]统计目录中文件MD5值 using System.IO;using System.Security.Cryptography;using System.Collections;using ...

  4. 使用java 程序创建格式为utf-8文件的方法(写入和读取json文件)

    使用java 程序创建格式为utf-8文件的方法:  try{            File file=new   File("C:/11.jsp");              ...

  5. SQL Server 无法在服务器上访问指定的路径或文件解决方法

    SQL Server 无法在服务器上访问指定的路径或文件解决方法 在SQL Server附加数据库或备份数据库时出现:无法在服务器上访问指定的路径或文件. 请确保您具有必需的安全权限且该路径或文件存在 ...

  6. vmware tools安装程序无法继续,Microsoft Runtime DLL安装程序未能完成安装。的解决方法

    vmware tools安装程序无法继续,Microsoft Runtime DLL安装程序未能完成安装.的解决方法_华英雄_新浪博客 http://blog.sina.com.cn/s/blog_5 ...

  7. svn冲突文件解决方法

    svn冲突文件解决方法 工具/原料 svn客户端 方法/步骤 1 通过SVN客户端更新需要的文件,如果出现有感叹号的文件,找到出现感叹号的文件. 2 选择感叹号文件,即冲突文件,单击鼠标右键对冲突文件 ...

  8. WAMP安装提示缺少 msvcr100.dll文件解决方法

    WAMP安装提示缺少wamp msvcr100.dll文件解决方法 因为wamp基于vs c++2010开发,需要提前安装这个组件才可以正常运行 微软官方组件下载地址: 32位:http://www. ...

  9. 关于STM32运行时程序卡在B.处的解决方法

    文章转载自:https://blog.csdn.net/u014470361/article/details/78780444 背景: 程序运行时,发现程序卡死在B.处. 解决方法: 程序卡死在B.处 ...

随机推荐

  1. 【原】Coursera—Andrew Ng机器学习—课程笔记 Lecture 11—Machine Learning System Design 机器学习系统设计

    Lecture 11—Machine Learning System Design 11.1 垃圾邮件分类 本章中用一个实际例子: 垃圾邮件Spam的分类 来描述机器学习系统设计方法.首先来看两封邮件 ...

  2. sql中问号是干什么的??

    第一次在后台 程序中遇到sql语句中的问号: /** * * 方法描述 : 通过账号id更新该账号状态 * @param state 状态 * @param id 账号id */ @Modifying ...

  3. CString 成员函数用法大全

    CString的构造函数CString( );例:CString csStr; CString( const CString& stringSrc );例:CString csStr(&quo ...

  4. 数组和集合(四)、Map集合的使用总结

    一.概述 键值对,无序 键唯一.值不唯一 只允许存在一个Key为null元素 二.实现类 1. HashMap · 无序,数组+链表+红黑树 · 非线程安全 2. LinkedHashMap · 有序 ...

  5. go grpc

    https://godoc.org/google.golang.org/grpc go get google.golang.org/grpc go get -a github.com/golang/p ...

  6. Perl 变量:标量变量

    Perl 标量标量是一个简单的数据单元.标量可以是一个整数,浮点数,字符,字符串,段落或者一个完整的网页. 1.数字标量标量通常是一个数字或字符串. 2.字符串标量以下实例演示了不同类型的字符串标量的 ...

  7. NSArray & NSDictionary

    一.NSArray 1.1 简单创建方法由难到简 NSArray *arr = [[NSArray alloc] init]; NSArray *arr = [NSArray arrayWithObj ...

  8. Opencv Canny

    #include <iostream>#include <opencv2/opencv.hpp> using namespace std;using namespace cv; ...

  9. Navicat修改查询保存路径

    mysql使用navicat查询时有时候会有很多sql语句, ctrl+s时自动保存在C:\Users\Administrator\Documents\Navicat\MySQL\servers\lo ...

  10. SQL 零碎点

    1,插入数据后,返回主键ID值: INSERT INTO tablename (name) VALUES (@name);SELECT @@Identity; 使用 SELECT @@Identity ...