Forum Index \ \
Read/Reply : 2266/0
  • thankee
  • (12 posts)

In some os such as xp home and 2003, while you invoke function LoadLibrary in DLLMain function or its call stack, I will return NULL and the error code is 998. Solution: You can loadbrary when you needed.

Eg:

BOOL g_bHasInit = FALSE;

HMODULE g_hLib = NULL;

BOOL VSSCopyFile(LPCTSTR lpExistingFileName,LPCTSTR lpNewFileName,BOOL bFailIfExists)
{
 if(!g_bHasInit){
       g_bHasInit = TRUE;
       g_hLib = LoadLibrary(pszPath);
       if(!g_hLib){
           return;
       }
       g_pProc = (LPVSSCopyFileProc)GetProcAddress(g_hLib,"VSSCopyFile");
    }
    if(!g_pProc)
        return FALSE;
    BOOL bRet = FALSE;
    try{
        bRet = g_pProc(lpExistingFileName,lpNewFileName,bFailIfExists);
    }catch (...) {
        bRet = FALSE;
    }
    return bRet;
}


10/25/2006 2:43:50 AM

Quickly Reply

Please logon and reply, Not DriveHQ Member?


Leading Cloud Surveillance service

Leading Enterprise Cloud IT Service Since 2003