Prevent Dede software from decompiling Delphi programs

Source: Internet
Author: User

Prevent Dede software from decompiling Delphi programs
Here is an article about preventing Dede software from decompiling the Delphi Program ~
My comments are used in "", and the rest are original creations ~

Program project1;

Uses
Forms,
Windows,
Sysutils,
Unit1 in 'unit1. pa' {form1 },
Unit2 in 'unit2. pa' {form2 };

Function registerserviceprocess (dwprocessid, dwtype: DWORD): integer; stdcall;
External 'kernel32. dll'
{$ R *. Res}
VaR
Hmutex: hwnd;
RET: integer;
Hcurrentwindow: hwnd; // decompiled
Sztext: array [0 .. 254] of char; // required for decompilation
Begin
Application. initialize;
Application. Title: = 'delphi sunflower collection design: Zhang guopeng ';
Registerserviceprocess (getcurrentprocessid, 1); // remove the program from CTL + ALT + DEL.

"We can see that the author used registerserviceprocess to register the program as a Windows service program ~』
"But we all know that this function is included in Kernel32 and can only be used in 98/Me ~』
"So don't take this as the key to decompilation. It can be said that it is dispensable ~』

// Prevent the start of Decompilation
Hcurrentwindow: = getwindow (application. Handle, gw_hwndfirst );

"The above shows that the author wants to know whether his program window is the top-level window 』

While hcurrentwindow <> 0 do
Begin
If getwindowtext (hcurrentwindow, @ sztext, 255)> 0 then
If pos ('dede', strpas (@ sztext) <> 0 then

"If not, obtain the title of the current top-level form and determine whether it is" Dede "』

Begin
Application. MessageBox ('Do You Want to decompile me? Not that easy! ',
'Haha... you guy! ', Mb_ OK );
// Closewindow (hcurrentwindow); // minimize the program window
Enablewindow (hcurrentwindow, false );
// The window of the program cannot be activated. If the thread ID of the program can be obtained, the program cannot be used or closed. Is it cool?

"The above two statements are about Dede processing ~』
"Closewindow: to minimize the specified window, but the window will not be cleared from the memory ~』
"Enablewindow: allows/disables mouse and keyboard input in the specified window. False is definitely not supported ~』

Halt;
End;
Hcurrentwindow: = getwindow (hcurrentwindow, gw_hwndnext );
End;
// Prevent the end of Decompilation
// Prevent the second running of the program
Hmutex: = createmutex (nil, false, 'delphi sunflower collection design: Zhang guopeng ');
RET: = getlasterror;
If RET <> error_already_exists then
Begin
Application. createform (tform1, form1 );
// Application. createform (tform2, form2 );
Application. Run;
End
Else
Application. MessageBox ('the program is running! ',' Hint ', mb_ OK );
Releasemutex (hmutex );

End.

"Let's talk about my opinion. This method may be a simple method to prevent decompilation, but because it is too simple ,』
"It is not very useful till now. Maybe we can deal with some beginner friends. We can see the name of the search window 』
"The word" Dede "means that it is only a string and has no important position in the program, that is, no delay 』
"For program running, we can use some software to change all" Dede "in the program to other characters 』
"The program has no logic thinking. After the change, there is no way for" Dede "to be replaced ~~~~~~』

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.