[appstore] add AppStore version detection

* Also make sure we don't include appstore.listing.csv in the app
  and remove unneeded call to GetModuleHandle() in pki.c.
This commit is contained in:
Pete Batard 2021-02-07 20:25:21 +00:00
parent b3daef6a67
commit 1062dde076
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
7 changed files with 65 additions and 49 deletions

View file

@ -571,13 +571,23 @@ static __inline BOOL GetTextExtentPointU(HDC hdc, const char* lpString, LPSIZE l
return ret;
}
// A UTF-8 alternative to MS GetCurrentDirectory() since the latter is useless for
// apps installed from the App Store...
static __inline DWORD GetCurrentDirectoryU(DWORD nBufferLength, char* lpBuffer)
{
DWORD ret = 0, err = ERROR_INVALID_DATA;
DWORD i, ret = 0, err = ERROR_INVALID_DATA;
// coverity[returned_null]
walloc(lpBuffer, nBufferLength);
ret = GetCurrentDirectoryW(nBufferLength, wlpBuffer);
ret = GetModuleFileNameW(NULL, wlpBuffer, nBufferLength);
err = GetLastError();
if (ret > 0) {
for (i = ret - 1; i > 0; i--) {
if (wlpBuffer[i] == L'\\') {
wlpBuffer[i] = 0;
break;
}
}
}
if ((ret != 0) && ((ret = wchar_to_utf8_no_alloc(wlpBuffer, lpBuffer, nBufferLength)) == 0)) {
err = GetLastError();
}