delphi共享软件防破解的实用方法

2018-10-31

共享软件防破解的实用方法  

1、检测主程序大小,防止破解补丁之类:   
Function TForm1.GesSelfSf: integer;  
var   F: file of byte;  
begin   
 Filemode:=0;   
 Assignfile(F,'.FileName.exe');   
 Reset(f);   
 Result:=Filesize(F);   
 Closefile(F);  
end;  

2、检测创建日期和时间,让破解补丁实效:   
Function TForm1.FinDate:String;  
var   
 t:TDate;  
begin   
 ShortDateFormat:='yyyy-mm-dd';   
 t:=FileDateToDateTime(FileAge('FileName.exe'));   
 Result:=DateToStr(t);  
end;  

3、注册码加密函数嵌入数学函数,增加破解难度:  (略)
 
4、必要时自己删除自己(主程序):   
procedure TForm1.Funll;  
var   
 hModule: THandle;   
 buff: array[0..255] of Char;   
 hKernel32: THandle;   
 pExitProcess, pDeleteFileA, pUnmapViewOfFile: Pointer;  
begin   
 hModule:=GetModuleHandle(nil);   
 GetModuleFileName(hModule, buff, sizeof(buff));   
 CloseHandle(THandle(4));   
 hKernel32:=GetModuleHandle('KERNEL32');   
 pExitProcess:=GetProcAddress(hKernel32, 'ExitProcess');   
 pDeleteFileA:=GetProcAddress(hKernel32, 'DeleteFileA');   
 pUnmapViewOfFile:=GetProcAddress(hKernel32, 'UnmapViewOfFile');  
asm   
 LEA EAX, buff   
 PUSH 0   
 PUSH 0   
 PUSH EAX   
 PUSH pExitProcess   
 PUSH hModule   
 PUSH pDeleteFileA   
 PUSH pUnmapViewOfFile  
 RET  
end;   
begin   
 Funll;  
end;  
end;   

 具体怎么使用,那要看你自己的意愿了和需要了。反正俺是这样做的,俺的软件ADSL拨号计时器只在很早版本上出过注册机,后来的v3.70出过破解补丁——其实只是破掉了启动时提示注册的对话框,实质上根本没破解。用了上述的着法以后,到现在的v5.28版本,再没有过什么破解补丁或注册机。  如果现在的v5.28版本谁能破解,将立即公布程序源码。怎么样?
阅读51