windows-nt/Source/XPSP1/NT/admin/wmi/wbem/winmgmt/a512rosw/main.cpp
2020-09-26 16:20:57 +08:00

38 lines
842 B
C++

#include <windows.h>
#include <stdio.h>
#include <wbemcomn.h>
#include "filecach.h"
#define A51_MAX_SLEEPS 1000
#define A51_ONE_SLEEP 100
long FlushOldCache(LPCWSTR wszRepDir)
{
long lRes;
//
// Instantiate the old staging file and flush it
//
a51converter::CFileCache OldCache;
lRes = OldCache.Initialize(wszRepDir);
if(lRes != ERROR_SUCCESS)
return lRes;
int n = 0;
while(!OldCache.IsFullyFlushed() && n++ < A51_MAX_SLEEPS)
Sleep(A51_ONE_SLEEP);
if(!OldCache.IsFullyFlushed())
{
ERRORTRACE((LOG_WBEMCORE, "Upgrade waited for the old cache to flush "
"for %d seconds, but with no success. Aborting "
"upgrade\n", A51_MAX_SLEEPS * A51_ONE_SLEEP));
return ERROR_TIMEOUT;
}
return ERROR_SUCCESS;
}