BOOL CALLBACK UpdateProc(DWORD_PTR dwParam,CallingReason crReason,UpdateError ueCode,CDatabaseUpdater* pUpdater) { switch (crReason) { case StartedDatabase: if (!nQuiet) { CStringW msg; msg.FormatEx(IDS_UPDATEDB32UPDATINGDATABASE,pUpdater->GetCurrentDatabaseName(),pUpdater->GetCurrentDatabaseFile()); if (pUpdater->IsIncrementUpdate()) msg.AddString(IDS_UPDATEDB32INCREMENTALUPDATE); _putws(msg); } break; case RootChanged: if (!nQuiet) { if (pUpdater->GetCurrentRoot()!=NULL) wprintf(ID2W(IDS_UPDATEDB32SCANNING),(LPCWSTR)pUpdater->GetCurrentRoot()->m_Path); else wprintf(L"%s %s\n",(LPCWSTR)ID2W(IDS_UPDATEDB32WRITINGDB),pUpdater->GetCurrentDatabaseName()); } break; case ErrorOccured: if (!nQuiet) { switch (ueCode) { case ueAlloc: fwprintf(stderr,ID2W(IDS_UPDATEDB32ALLOCATEMEM)); break; case ueOpen: case ueCreate: fwprintf(stderr,ID2W(IDS_UPDATEDB32CANNOTCREATEFILE),(LPCSTR)pUpdater->GetCurrentDatabaseFile()); break; case ueWrite: fwprintf(stderr,ID2W(IDS_UPDATEDB32CANNOTWRITE),(LPCSTR)pUpdater->GetCurrentDatabaseFile()); break; case ueUnknown: fwprintf(stderr,ID2W(IDS_UPDATEDB32ALLOCATEMEM)); break; case ueFolderUnavailable: fwprintf(stderr,ID2W(IDS_UPDATEDB32ROOTUNAVAILABLE), pUpdater->GetCurrentRootPath()!=NULL?pUpdater->GetCurrentRootPath():L"(NULL)"); break; case ueWrongCharset: { int ch; do { fwprintf(stderr,ID2W(IDS_UPDATEDB32WRONGCHARSETINDB),pUpdater->GetCurrentDatabaseFile()); ch=getc(stdin); } while (ch!='Y' && ch!='y' && ch!='N' && ch!='n'); if (ch!='Y' && ch!='y') return FALSE; return TRUE; } case ueCannotIncrement: { int ch; do { fwprintf(stderr,ID2W(IDS_UPDATEDB32CANNOTUPDATEINCREMENTALLY),pUpdater->GetCurrentDatabaseFile()); ch=getc(stdin); } while (ch!='Y' && ch!='y' && ch!='N' && ch!='n'); if (ch!='Y' && ch!='y') return FALSE; return TRUE; } break; } } if (ueCode==ueSuccess) return 0; break; case ClassShouldDelete: { DWORD dwRunning=0; if (ppUpdaters==NULL) return TRUE; // One thread mode for (int i=0;ppUpdaters[i]!=NULL;i++) { if (ppUpdaters[i]==pUpdater) ppUpdaters[i]=UPDATER_EXITED(ueCode); else if (!IS_UPDATER_EXITED(ppUpdaters[i])) dwRunning++; } delete pUpdater; if (dwRunning==0) { delete[] ppUpdaters; ppUpdaters=NULL; } break; } } return TRUE; }