Protection API - SDP_GetRegistrationName


SDP_GetRegistrationName

The SDP_GetRegistrationName function is used to read in names of registered users based on license key.

  For C++:

        int SDP_GetRegistrationName( char *szRegistrationName, // address of buffer for users name
int
iMaxLen // maximum number of characters to copy
);

  For Delphi:

       function SDP_GetRegistrationName(
szRegistrationName :PChar // address of buffer for users name iMaxLen :Integer // maximum number of characters to copy ): Integer;

Parameters
szRegistrationName

[in] points to a buffer, where users name will be copied to.

iMaxLen

[in] sets the maximum numbers of characters to copy.

Return Values
If users name is copied to the buffer, the number of copied bytes will be returned, not including last zero (ASCII). If there will be a problem, or license key is incorrect, zero will be returned.

Remarks
The size of buffer shoud be bigger than 40, or the function will possibly fail.
Example
for C/C++

#include "SDProtector.h"
//...
void GetUserName() { char szUserName[42]; int iMaxLen=42; memset(szUserName,0,iMaxLen); if(SDP_GetRegistrationName(szUserName,42)) { ::MessageBox(NULL,szUserName,"Program registered to",MB_ICONINFORMATION);
} else { ::MessageBox(NULL,"This an unregistered version","Error",MB_ICONINFORMATION); }

}

for Delphi

        
procedure GetUserName;
var szUserName:array[0..41] of char; begin fillchar(szUserName,42,#0); if SDP_GetRegistrationName(@szUserName[0],42) <> 0 then MessageBox(0,@szUserName[0],'Program registered to', MB_ICONINFORMATION); else MessageBox(0,'This an unregistered version', 'Error', MB_ICONINFORMATION); end;
Sample application is located in \Examples\Delphi\API\ and \Examples\VC\API\ directory.
 
CopyRight(C) 2003 SDProtector.com All Rights Reserved