mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2025-02-25 22:38:10 +01:00
Updates: Check remote hash against locally computed hash
This commit is contained in:
parent
50f3a709c0
commit
4cfc2cea4b
@ -240,7 +240,47 @@ BOOL IsUpdateAvailableHelper(
|
|||||||
DWORD dwLocalSecondLeft = 0;
|
DWORD dwLocalSecondLeft = 0;
|
||||||
DWORD dwLocalSecondRight = 0;
|
DWORD dwLocalSecondRight = 0;
|
||||||
DWORD dwLocalRightMost = 0;
|
DWORD dwLocalRightMost = 0;
|
||||||
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLocalLeftMost, &dwLocalSecondLeft, &dwLocalSecondRight, &dwLocalRightMost);
|
BOOL bExtractedFromHash = FALSE;
|
||||||
|
CHAR hashCopy[100];
|
||||||
|
strcpy_s(hashCopy, 100, szCheckAgainst);
|
||||||
|
char* szLocalLeftMost = NULL, *szLocalSecondLeft = NULL, *szLocalSecondRight = NULL, *szLocalRightMost = NULL, *szLocalRealHash = NULL;
|
||||||
|
if (strchr(hashCopy, '.'))
|
||||||
|
{
|
||||||
|
szLocalLeftMost = hashCopy;
|
||||||
|
if (szLocalSecondLeft = strchr(szLocalLeftMost, '.'))
|
||||||
|
{
|
||||||
|
*szLocalSecondLeft = 0;
|
||||||
|
szLocalSecondLeft++;
|
||||||
|
if (szLocalSecondRight = strchr(szLocalSecondLeft, '.'))
|
||||||
|
{
|
||||||
|
*szLocalSecondRight = 0;
|
||||||
|
szLocalSecondRight++;
|
||||||
|
if (szLocalRightMost = strchr(szLocalSecondRight, '.'))
|
||||||
|
{
|
||||||
|
*szLocalRightMost = 0;
|
||||||
|
szLocalRightMost++;
|
||||||
|
if (szLocalRealHash = strchr(szLocalRightMost, '.'))
|
||||||
|
{
|
||||||
|
*szLocalRealHash = 0;
|
||||||
|
szLocalRealHash++;
|
||||||
|
|
||||||
|
bExtractedFromHash = TRUE;
|
||||||
|
dwLocalLeftMost = atoi(szLocalLeftMost);
|
||||||
|
dwLocalSecondLeft = atoi(szLocalSecondLeft);
|
||||||
|
dwLocalSecondRight = atoi(szLocalSecondRight);
|
||||||
|
dwLocalRightMost = atoi(szLocalRightMost);
|
||||||
|
#ifdef UPDATES_VERBOSE_OUTPUT
|
||||||
|
printf("[Updates] Local version obtained from hash is %d.%d.%d.%d.\n", dwLocalLeftMost, dwLocalSecondLeft, dwLocalSecondRight, dwLocalRightMost);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!bExtractedFromHash)
|
||||||
|
{
|
||||||
|
QueryVersionInfo(hModule, VS_VERSION_INFO, &dwLocalLeftMost, &dwLocalSecondLeft, &dwLocalSecondRight, &dwLocalRightMost);
|
||||||
|
}
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
if (!res)
|
if (!res)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user