我试图测试关于纸张保护金星的申请书,我想使用壳牌ExecuteEx AP(我需要使用该份标语,因为我需要LpVerb:=“runas”)呼吁执行第二个方案,但我仍要用壳牌ExecuteEx电话获得“Write Protect Error”。 http://www.microsoft.com/downloads/D3.pdf 这里是我留下的错误:
<>> 书面保护
以下法典中的任何规定都试图写到这一运动中,就是壳牌。 排他性反应会给我错想做什么呢? 否则,我如何能够从偷窃中找到这一错误。 任何帮助都将受到高度赞赏。
<>strong>[WP-ON.reg]
REGEDIT4
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlStorageDevicePolicies]
"WriteProtect"=dword:00000001
<>strong>[WP-OFF.reg]
REGEDIT4
[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlStorageDevicePolicies]
"WriteProtect"=dword:00000000
<>光> 每次更新登记册时,你必须照搬和重新安装。
<>strong>[项目1.dpr]
program project1;
{.$APPTYPE CONSOLE}
uses
Windows, SysUtils;
begin
Windows.MessageBox(Windows.GetActiveWindow(),
PChar( Hello World! ), PChar( project1 ), MB_OK);
end.
[ launch.manifest ]
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity processorArchitecture="x86" version="2.0.1.0" name="eyeClaxton.asInvoker.Launch" type="win32" />
<description>asInvoker Launch</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
<>strong>[发射]
program launch;
uses
Windows, ShellAPI;
{$R MANIFEST.RES }
procedure ShellEx(const theFilename, theParams: string);
function RunAsAdmin(): Boolean;
var
OSVerInfo: TOSVersionInfo;
begin
OSVerInfo.dwOSVersionInfoSize := System.SizeOf(OSVerInfo);
Result := (Windows.GetVersionEx(OSVerInfo)) and (OSVerInfo.dwMajorVersion > 5);
end;
var
ShellExInfo: TShellExecuteInfo;
Directory: array[0..MAX_PATH] of Char;
begin
Windows.ZeroMemory(@ShellExInfo, System.SizeOf(ShellExInfo));
ShellExInfo.cbSize := System.SizeOf(TShellExecuteInfo);
ShellExInfo.Wnd := Windows.GetActiveWindow();
ShellExInfo.nShow := SW_SHOWNORMAL;
ShellExInfo.fMask := SEE_MASK_FLAG_NO_UI;
if (RunAsAdmin()) then // If OS is greater than Windows XP
ShellExInfo.lpVerb := PChar( runas );
Windows.ZeroMemory(@Directory, System.SizeOf(Directory));
Windows.GetCurrentDirectory(SizeOf(Directory), Directory);
ShellExInfo.lpDirectory := PChar(string(Directory));
ShellExInfo.lpFile := PChar( " + string(Directory) + + theFilename + " );
ShellExInfo.lpParameters := PChar( " + theParams + " );
//
// ShellExecuteEx causes a "Write Protect" error to popup.
//
if (not ShellAPI.ShellExecuteEx(@ShellExInfo)) then
Windows.MessageBox(Windows.GetActiveWindow(),
PChar( File + ShellExInfo.lpFile + not found! ),
PChar( asInvoker Launch ), MB_OK or MB_ICONERROR);
end;
begin
ShellEx( project1.exe , System.ParamStr(1));
end.