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;
}