New upstream version 19.0.3+dfsg1

This commit is contained in:
Sebastian Ramacher 2017-06-29 21:01:10 +02:00
parent 3708b8e092
commit 1f1bbb3518
534 changed files with 13862 additions and 2459 deletions

View file

@ -2,6 +2,10 @@ if(NOT ENABLE_WIN_UPDATER)
return()
endif()
if(DISABLE_UPDATE_MODULE)
return()
endif()
if(NOT DEFINED STATIC_ZLIB_PATH OR "${STATIC_ZLIB_PATH}" STREQUAL "")
message(STATUS "STATIC_ZLIB_PATH not set, windows updater disabled")
return()

View file

@ -36,10 +36,10 @@ public:
static bool ReadZippedHTTPData(string &responseBuf, z_stream *strm,
string &zipBuf, const uint8_t *buffer, DWORD outSize)
{
do {
strm->avail_in = outSize;
strm->next_in = buffer;
strm->avail_in = outSize;
strm->next_in = buffer;
do {
strm->avail_out = (uInt)zipBuf.size();
strm->next_out = (Bytef *)zipBuf.data();
@ -293,10 +293,10 @@ static bool ReadHTTPZippedFile(z_stream *strm, HANDLE updateFile,
string &zipBuf, const uint8_t *buffer, DWORD outSize,
int *responseCode)
{
do {
strm->avail_in = outSize;
strm->next_in = buffer;
strm->avail_in = outSize;
strm->next_in = buffer;
do {
strm->avail_out = (uInt)zipBuf.size();
strm->next_out = (Bytef *)zipBuf.data();

View file

@ -580,6 +580,27 @@ static bool NonCorePackageInstalled(const char *name)
return false;
}
static inline bool is_64bit_windows(void)
{
#ifdef _WIN64
return true;
#else
BOOL x86 = false;
bool success = !!IsWow64Process(GetCurrentProcess(), &x86);
return success && !!x86;
#endif
}
static inline bool is_64bit_file(const char *file)
{
if (!file)
return false;
return strstr(file, "64bit") != nullptr ||
strstr(file, "64.dll") != nullptr ||
strstr(file, "64.exe") != nullptr;
}
#define UTF8ToWideBuf(wide, utf8) UTF8ToWide(wide, _countof(wide), utf8)
#define WideToUTF8Buf(utf8, wide) WideToUTF8(utf8, _countof(utf8), wide)
@ -592,6 +613,8 @@ static bool AddPackageUpdateFiles(json_t *root, size_t idx,
json_t *name = json_object_get(package, "name");
json_t *files = json_object_get(package, "files");
bool isWin64 = is_64bit_windows();
if (!json_is_array(files))
return true;
if (!json_is_string(name))
@ -628,6 +651,9 @@ static bool AddPackageUpdateFiles(json_t *root, size_t idx,
if (strlen(hashUTF8) != BLAKE2_HASH_LENGTH * 2)
continue;
if (!isWin64 && is_64bit_file(fileUTF8))
continue;
/* convert strings to wide */
wchar_t sourceURL[1024];
@ -972,10 +998,11 @@ static bool Update(wchar_t *cmdLine)
}
StringCbCopy(lpAppDataPath, sizeof(lpAppDataPath), pOut);
StringCbCat(lpAppDataPath, sizeof(lpAppDataPath),
L"\\obs-studio");
}
StringCbCat(lpAppDataPath, sizeof(lpAppDataPath),
L"\\obs-studio");
/* ------------------------------------- *
* Get download path */
@ -987,18 +1014,18 @@ static bool Update(wchar_t *cmdLine)
StringCbPrintf(manifestPath, sizeof(manifestPath),
L"%s\\updates\\manifest.json", lpAppDataPath);
if (!GetTempPathW(_countof(tempPath), tempPath)) {
if (!GetTempPathW(_countof(tempDirName), tempDirName)) {
Status(L"Update failed: Failed to get temp path: %ld",
GetLastError());
return false;
}
if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempDirName)) {
if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempPath)) {
Status(L"Update failed: Failed to create temp dir name: %ld",
GetLastError());
return false;
}
StringCbCat(tempPath, sizeof(tempPath), tempDirName);
DeleteFile(tempPath);
CreateDirectory(tempPath, nullptr);
/* ------------------------------------- *
@ -1086,7 +1113,8 @@ static bool Update(wchar_t *cmdLine)
* Send file hashes */
string newManifest;
{
if (json_array_size(files) > 0) {
char *post_body = json_dumps(files, JSON_COMPACT);
int responseCode;
@ -1117,6 +1145,8 @@ static bool Update(wchar_t *cmdLine)
responseCode);
return false;
}
} else {
newManifest = "[]";
}
/* ------------------------------------- *

View file

@ -1,6 +1,7 @@
#include "win-update-helpers.hpp"
#include "update-window.hpp"
#include "remote-text.hpp"
#include "qt-wrappers.hpp"
#include "win-update.hpp"
#include "obs-app.hpp"
@ -479,7 +480,7 @@ void GenerateGUID(string &guid)
void AutoUpdateThread::infoMsg(const QString &title, const QString &text)
{
QMessageBox::information(App()->GetMainWindow(), title, text);
OBSMessageBox::information(App()->GetMainWindow(), title, text);
}
void AutoUpdateThread::info(const QString &title, const QString &text)
@ -490,20 +491,20 @@ void AutoUpdateThread::info(const QString &title, const QString &text)
Q_ARG(QString, text));
}
int AutoUpdateThread::queryUpdateSlot(bool manualUpdate, const QString &text)
int AutoUpdateThread::queryUpdateSlot(bool localManualUpdate, const QString &text)
{
OBSUpdate updateDlg(App()->GetMainWindow(), manualUpdate, text);
OBSUpdate updateDlg(App()->GetMainWindow(), localManualUpdate, text);
return updateDlg.exec();
}
int AutoUpdateThread::queryUpdate(bool manualUpdate, const char *text_utf8)
int AutoUpdateThread::queryUpdate(bool localManualUpdate, const char *text_utf8)
{
int ret = OBSUpdate::No;
QString text = text_utf8;
QMetaObject::invokeMethod(this, "queryUpdateSlot",
Qt::BlockingQueuedConnection,
Q_RETURN_ARG(int, ret),
Q_ARG(bool, manualUpdate),
Q_ARG(bool, localManualUpdate),
Q_ARG(QString, text));
return ret;
}
@ -536,7 +537,7 @@ try {
string text;
string error;
string signature;
CryptProvider provider;
CryptProvider localProvider;
BYTE manifestHash[BLAKE2_HASH_LENGTH];
bool updatesAvailable = false;
bool success;
@ -579,7 +580,7 @@ try {
/* ----------------------------------- *
* create signature provider */
if (!CryptAcquireContext(&provider,
if (!CryptAcquireContext(&localProvider,
nullptr,
MS_ENH_RSA_AES_PROV,
PROV_RSA_AES,
@ -587,7 +588,7 @@ try {
throw strprintf("CryptAcquireContext failed: %lu",
GetLastError());
::provider = provider;
provider = localProvider;
/* ----------------------------------- *
* avoid downloading manifest again */
@ -638,7 +639,7 @@ try {
if (responseCode == 404)
return;
throw strprintf("Failed to fetch manifest file: %s", error);
throw strprintf("Failed to fetch manifest file: %s", error.c_str());
}
/* ----------------------------------- *
@ -658,11 +659,11 @@ try {
if (responseCode == 200) {
if (!QuickWriteFile(manifestPath, text.data(), text.size()))
throw strprintf("Could not write file '%s'",
manifestPath);
manifestPath.Get());
} else {
if (!QuickReadFile(manifestPath, text))
throw strprintf("Could not read file '%s'",
manifestPath);
manifestPath.Get());
}
/* ----------------------------------- *
@ -764,7 +765,7 @@ try {
QString msg = QTStr("Updater.FailedToLaunch");
info(msg, msg);
throw strprintf("Can't launch updater '%s': %d",
updateFilePath, GetLastError());
updateFilePath.Get(), GetLastError());
}
/* force OBS to perform another update check immediately after updating