48 HANDLE ParentProcess = OpenProcess(SYNCHRONIZE, FALSE, ParentProcessID);
55 printf(
"Waiting for parent process to terminate...");
56 DWORD res = WaitForSingleObject(ParentProcess, 10000);
57 if(res == WAIT_TIMEOUT)
58 fprintf(stderr,
"Parent process did not terminate after 10 seconds. Continuing...");
68 if (Upd.
Load(&hGroup))
71 int iRes = Upd.
Check(&hGroup);
80 fprintf(stderr,
"Target %s for update %s not found. Ignoring.\n", Upd.
DestPath, Upd.
Name);
84 fprintf(stderr,
"Target %s incorrect version for update %s. Ignoring.\n", Upd.
DestPath, Upd.
Name);
88 fprintf(stderr,
"Target %s already up-to-date at %s.\n", Upd.
DestPath, Upd.
Name);
108 fprintf(stderr,
"Unknown error while updating.\n");
120 printf(
"Updating binaries...\n");
126 { strList += strEntry; strList +=
";"; }
134 printf(
"Exploding: %s\n", strEntry);
153 if (!ok)
return false;
#define C4CFN_UpdateEntries
bool C4Group_ExplodeDirectory(const char *filename)
bool C4Group_IsGroup(const char *filename)
bool C4Group_ApplyUpdate(C4Group &hGroup, unsigned long ParentProcessID)
#define C4UPD_CHK_NO_SOURCE
#define C4UPD_CHK_BAD_VERSION
#define C4UPD_CHK_ALREADY_UPDATED
#define C4UPD_CHK_BAD_SOURCE
bool SGetModule(const char *szList, int iIndex, char *sTarget, int iSize)
bool WildcardMatch(const char *szWildcard, const char *szString)
bool FindNextEntry(const char *wildcard, StdStrBuf *filename=nullptr, size_t *size=nullptr, bool start_at_filename=false)
bool Extract(const char *files, const char *destination=nullptr, const char *exclude=nullptr)
int EntryCount(const char *wildcard=nullptr)
bool OpenAsChild(C4Group *mother, const char *entry_name, bool is_exclusive=false, bool do_create=false)
void ResetSearch(bool reload_contents=false)
bool FindEntry(const char *wildcard, StdStrBuf *filename=nullptr, size_t *size=nullptr)
int32_t RequireVersion[4]
char DestPath[_MAX_PATH_LEN]
int Check(C4Group *pGroup)
bool Load(C4Group *pGroup)
bool Execute(C4Group *pGroup)
const char * getData() const