用命令行参数实现啊:)if ParamCount=0 then exit; if ParamStr(1)<>'123456' then begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end;调用这个程序的时候带上参数,如: ShellExecute(0, 'open', 'Project1.exe', '-123456', nil, SW_SHOWNORMAL);
写错了:)if ParamCount=0 then exit; if ParamStr(1)='123456' then begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end;调用这个程序的时候带上参数,如: ShellExecute(0, 'open', 'Project1.exe', '123456', nil, SW_SHOWNORMAL);
if ParamStr(1)<>'123456' then
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end;调用这个程序的时候带上参数,如:
ShellExecute(0, 'open', 'Project1.exe', '-123456', nil, SW_SHOWNORMAL);
if ParamStr(1)='123456' then
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end;调用这个程序的时候带上参数,如:
ShellExecute(0, 'open', 'Project1.exe', '123456', nil, SW_SHOWNORMAL);
在调用程序中加入输入密码判断就行了。
呵呵就类似商业的保护系统一样
例如ASPack什么的,只是他们只是加壳,没要求密码而已,你能开发这类工具就行的
能指点一下具体的实现吗?或者告诉我哪儿能找到相关的资料
=======================================
PE文件简单加密--100%源码这个小软件通过在可执行文件(.exe)的尾部添加一个新节(Section),并且修改PE的入口地址,使可执行文件在运行时,跳出一个输入密码的对话框,从而实现了简单的加密。源程序采用Delphi 6.0编写, 兼有少量的asm代码,用於可执行文件的加密。作者在[大富翁论坛]的ID为smokingroom, 希望能和大家交流^_^
如需传播,请保留作品的完整性!
在http://www.programmerlife.com 上没有找到你说的东东啊?还有,我实际上是要用检测Usb狗来做权限控制,不是输入密码来验证。To: clasj(我蛮怀)
有没有办法直接把B.exe从流中调到内存运行?我想最好能实现这样,实在不行就只能先释放到硬盘运行等运行完后再删除;另外,对于ShellExecut、WinExec等外壳调用函数能否等待调用返回结果再继续执行后面的代码?
各位高手给点建议好么~~
SysUtils, Windows, Classes;var
StartupInfo: _StartupInfoA;
ProcessInfo: _Process_Information;
Stream: TResourceStream;
begin
Stream:=TResourceStream.Create(0, 'test', 'exefile');
try
Stream.SaveToFile('C:\test.exe');
StartupInfo.cb:=SizeOf(StartupInfo);
CreateProcess('C:\test.exe', nil, nil, nil, false, 0, nil, nil, StartupInfo, ProcessInfo);
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
DeleteFile('C:\test.exe');
finally
Stream.Free;
end;
end.
非常感谢,这样可以满足基本需求了,但用户可以在test.exe被释放出来,执行后,拷贝test.exe,从而以后绕过加密的外壳,有没有更好的方法啊?