Lock Serial Number to Hardware in Licensing using VMProtect


VMProtect (http://vmpsoft.com) is a powerful Software Protection tool. It is developed by a Russian company. It is a commercial software.

The VMProtect supports licensing distribution by serial key string. A serial key is a encrypted string that contains the following content:  user info, expiry date, hardware id, free update limitation, blacklist, runtime limit etc.

vmp1 Lock Serial Number to Hardware in Licensing using VMProtect 32 bit 64 bit assembly language beginner compiler delphi I/O File implementation interpreter / compiler object pascal programming languages technical tools / utilities VMProtect Win32 API windows

vmp2 Lock Serial Number to Hardware in Licensing using VMProtect 32 bit 64 bit assembly language beginner compiler delphi I/O File implementation interpreter / compiler object pascal programming languages technical tools / utilities VMProtect Win32 API windows

vmp_new_key Lock Serial Number to Hardware in Licensing using VMProtect 32 bit 64 bit assembly language beginner compiler delphi I/O File implementation interpreter / compiler object pascal programming languages technical tools / utilities VMProtect Win32 API windows

The Hardware ID can be easily obtained by the VMProtectGetCurrentHWID API provided by VMP in the form of VMProtectSDK32.dll or VMProtectSDK64.dll which corresponds to 32 or 64 bit respectively. Calling this function the first time with the parameter NULL and 0 returns the length of the hardware ID, the second time, passing the pointer (address) to the string buffer (which you will need to allocate) and the size of the string will fill the buffer with the hardware ID. The function is defined as such:

function GetHardwareID: String;
var
  nSize: Integer;
  buf: array of AnsiChar;
begin
  nSize := VMProtectGetCurrentHWID(nil, 0);
  SetLength(buf, nSize);
  VMProtectGetCurrentHWID(@buf[0], nSize);
  Result := StrPas(@buf[0]);
end;

The unit VMProtectSDK.pas thus is required to include. The unit simply references to the API interfaces defined in the DLL.

const
{$IFDEF WIN32}
  VMProtectDLLName = 'VMProtectSDK32.dll';
{$ELSE}
  VMProtectDLLName = 'VMProtectSDK64.dll';
{$ENDIF}
function VMProtectGetCurrentHWID; stdcall; external VMProtectDLLName;

It is worth notice that, before using the VMProtect to encrypt the executable (.EXE or .DLL), the VMProtectSDK32.dll or VMProtectSDK64.dll is required at runtime, otherwise the application will terminate because the DLL is not found. Apart from this, the Hardware ID will simply return ‘myhwid’ for testing purpose before protection.

hardwareid2 Lock Serial Number to Hardware in Licensing using VMProtect 32 bit 64 bit assembly language beginner compiler delphi I/O File implementation interpreter / compiler object pascal programming languages technical tools / utilities VMProtect Win32 API windows

After protection, the VMProtectGetCurrentHWID returns correct value.

hardwareid Lock Serial Number to Hardware in Licensing using VMProtect 32 bit 64 bit assembly language beginner compiler delphi I/O File implementation interpreter / compiler object pascal programming languages technical tools / utilities VMProtect Win32 API windows

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
480 words
Last Post: Visual Studio .NET 4.0 Disables COM DLL protected by VMProtect
Next Post: Using COM object in NodeJS

The Permanent URL is: Lock Serial Number to Hardware in Licensing using VMProtect

One Response

  1. Rob

Leave a Reply