Page 2 of 2
Re: Software protection example
Posted: Tue Jun 18, 2024 7:32 am
by edk
It's the same

- ezgif.com-optimize.gif (1.46 MiB) Viewed 1939 times
Re: Software protection example
Posted: Tue Jun 18, 2024 8:51 am
by brunellopulix
too fast I can't understand. Why did you try to change without asking first? you also confused the program and it doesn't work. Try resetting and try to understand why it doesn't work for you.
Re: Software protection example
Posted: Wed Jun 19, 2024 8:56 am
by edk
Sorry, I looped the GIF unnecessarily.
In my previous post, I added a comment and turned off the loop to better illustrate what I do to make it work for me.
To play the gif from the beginning, click this link:
http://hmgforum.com/viewtopic.php?p=71131
List of step by step I perform:
- I delete the demoprot.exe file as you asked
- unpack the demoprot.exe file from the demoprot.zip file
- I run the demoprot.exe file in the usual way
- array range error appears
- I am trying to fix the problem by restoring the system to the state it was in before running demoprot.exe, for this purpose I delete the damaged entries in the registry and the demoprot.dat file, which contains corrupt or incomplete security data
- I run the demoprot.exe file again, but this time as Administrator. The program works, the registry entries are correct and the demoprot.dat file contains the correct security data.
Re: Software protection example
Posted: Wed Jun 19, 2024 2:49 pm
by brunellopulix
OK, if you think it might be of interest and right for you, send me an email and I'll send you the missing file.
As I already said, the source code cannot be published but I can share it if it is usable.
You can find my email in the forum
Brunello Pulix
Re: Software protection example
Posted: Wed Jun 19, 2024 9:41 pm
by edk
I don't need your source code. I know more or less how it works. Generally, if you store your own data in the Windows registry, in some environments you need administrator privileges to access the registry.
Therefore, I think it is enough to force the application to run in administrator mode.
The code below checks whether the application is running in administrator mode, if not, it runs it in this mode (the same as "Run as Administrator")
Code: Select all
#include <hmg.ch>
PROCEDURE MAIN
PRIVATE lIsAdmin := wapi_IsUserAnAdmin()
IF .Not. lIsAdmin .AND. MsgYesNo ( "The application does not run in administrator mode, do you want to run it as an administrator?", "Run As Administrator" )
RunApiAsAdministrator()
RETURN
ENDIF
Msgdebug ( "Does the application run in administrator mode?" , lIsAdmin )
/* rest of prg */
RETURN
Function RunApiAsAdministrator()
ShellExecuteEx( wapi_GetActiveWindow(), 'runas', hb_ProgName(), , , SW_SHOWNORMAL )
Return Nil
#pragma BEGINDUMP
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
#include <windows.h>
#include <hbapi.h>
#include <shlobj.h>
HB_FUNC( SHELLEXECUTEEX )
{
SHELLEXECUTEINFO SHExecInfo;
ZeroMemory(&SHExecInfo, sizeof(SHExecInfo));
SHExecInfo.cbSize = sizeof(SHExecInfo);
SHExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
SHExecInfo.hwnd = HB_ISNIL( 1 ) ? GetActiveWindow() : (HWND) HMG_parnl( 1 );
SHExecInfo.lpVerb = (LPCSTR) HMG_parc( 2 );
SHExecInfo.lpFile = (LPCSTR) HMG_parc( 3 );
SHExecInfo.lpParameters = (LPCSTR) HMG_parc( 4 );
SHExecInfo.lpDirectory = (LPCSTR) HMG_parc( 5 );
SHExecInfo.nShow = hb_parni( 6 );
if( ShellExecuteEx(&SHExecInfo) )
{
// hb_retnl( (LONG) SHExecInfo.hProcess );
CloseHandle(SHExecInfo.hProcess);
}
}
#pragma ENDDUMP
P.S. An array error also appears when you delete the demoprot.dat file after registering the application. In this case, just running it as Administrator does not help, you need to delete the keys from the Windows registry.
Re: Software protection example
Posted: Fri Jul 19, 2024 4:01 pm
by franco
I have not downloaded this. But just by reading through what happens if person gets a new computer.
This is the same as giving the program to a friend.
Re: Software protection example
Posted: Sat Jul 20, 2024 7:23 am
by serge_girard
You can also protect PC by 'Allowed Hosts', in case there is a database connection.
See image