/******************************************************************/
///name : Getkey
//function : Verify password
//access : public
/ /para :
// 1.: const std::string &strdata
// : value to participate in Password checksum
// return : Checksum value
//author : Hzh
//date : 2005-04-21
/**************************************************************** /
Const std::string getkey (const std::string &strdata)
{
std::string result = "";
if (strdata = = "")
{
return result;
.}
Dynamically load the DLL and call the inside function
HInstance Dllinst = LoadLibrary ("Codekey.dll");
if (Dllinst = NULL)
{
Throw Std::exception ("Unable to boot dynamic library Codekey.dll");
}
function pointer Codekey to ensure consistency with functions that need to be called in the DLL
char * (__stdcall * codekey) (const char *) = NULL;
Try
{
Point to function address in DLL
Codekey = (char* (__stdcall*) (const char *))
GetProcAddress (Dllinst, "Codekey");
if (Codekey)
{
function pointers Call DLL functions
result = Codekey (Strdata.c_str ());
}
Else
{
Throw std::exception ("Compile password error");
}
}
catch (...)
{
Throw std::exception ("error calling Dynamic library Codekey.dll.") " );
}
Release Library
FreeLibrary (Dllinst);
return result;
}