beautypg.com

2 run-time library linking – Acrosser AR-B1673 User Manual

Page 43

background image

AR-B1673 User’s Guide

Picture 3.3

After compilation, “ProtectU.dll” and “DIO.sys” files must be put in the same directory as the executable files.
For more information on Load-time library linking, please see

http://msdn.microsoft.com

.


3.2 RUN-TIME LIBRARY LINKING

To use Protect-U library by Run-time library linking, we only need to use two files from Protect-U library (see
chapter 1.1), “ProtectU.dll” and “DIO.sys” files.
First the user have to load the Protect-U library using load-library command from Microsoft Visual C++, then load
the address of the Protect-U functions. After that, the Protect-U functions (see chapter 1.2) can be used like
normal Visual C++ functions.
Example:

#include
#include

typedef int (*MYPROC)(LPTSTR);

VOID main(VOID)
{
HINSTANCE

hinstLib;

MYPROC

InitSecuritySystem;

MYPROC

CheckId;

MYPROC

ReadStatus;

MYPROC

CloseSecuritySystem;

BOOL

fFreeResult;

// Get a handle to the DLL module


hinstLib = LoadLibrary(TEXT(“ProtectU”));


// If the handle is valid, try to get the function address


if(hinstLib != NULL)

{

43