Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
9cc5aa56
O
Obs Studio
项目概览
小白菜888
/
Obs Studio
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Obs Studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9cc5aa56
编写于
12月 09, 2020
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI/updater: Update redist checks to VS2019
上级
0ab2b038
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
33 deletion
+33
-33
UI/win-update/updater/updater.cpp
UI/win-update/updater/updater.cpp
+33
-33
未找到文件。
UI/win-update/updater/updater.cpp
浏览文件 @
9cc5aa56
...
...
@@ -59,7 +59,7 @@ void FreeWinHttpHandle(HINTERNET handle)
static
inline
bool
is_64bit_windows
(
void
);
static
inline
bool
HasVS201
7
Redist2
()
static
inline
bool
HasVS201
9
Redist2
()
{
wchar_t
base
[
MAX_PATH
];
wchar_t
path
[
MAX_PATH
];
...
...
@@ -70,32 +70,32 @@ static inline bool HasVS2017Redist2()
SHGetFolderPathW
(
NULL
,
folder
,
NULL
,
SHGFP_TYPE_CURRENT
,
base
);
StringCbCopyW
(
path
,
sizeof
(
path
),
base
);
StringCbCatW
(
path
,
sizeof
(
path
),
L"
\\
msvcp140.dll"
);
handle
=
FindFirstFileW
(
path
,
&
wfd
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
return
false
;
}
else
{
FindClose
(
handle
);
}
#define check_dll_installed(dll) \
do { \
StringCbCopyW(path, sizeof(path), base); \
StringCbCatW(path, sizeof(path), L"\\" dll ".dll"); \
handle = FindFirstFileW(path, &wfd); \
if (handle == INVALID_HANDLE_VALUE) { \
return false; \
} else { \
FindClose(handle); \
} \
} while (false)
StringCbCopyW
(
path
,
sizeof
(
path
),
base
);
StringCbCatW
(
path
,
sizeof
(
path
),
L"
\\
vcruntime140.dll"
);
handle
=
FindFirstFileW
(
path
,
&
wfd
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
return
false
;
}
else
{
FindClose
(
handle
);
}
check_dll_installed
(
L"msvcp140.dll"
);
check_dll_installed
(
L"vcruntime140.dll"
);
check_dll_installed
(
L"vcruntime140_1.dll"
);
#undef check_dll_installed
return
true
;
}
static
bool
HasVS201
7
Redist
()
static
bool
HasVS201
9
Redist
()
{
PVOID
old
=
nullptr
;
bool
redirect
=
!!
Wow64DisableWow64FsRedirection
(
&
old
);
bool
success
=
HasVS201
7
Redist2
();
bool
success
=
HasVS201
9
Redist2
();
if
(
redirect
)
Wow64RevertWow64FsRedirection
(
old
);
return
success
;
...
...
@@ -928,7 +928,7 @@ static wchar_t tempPath[MAX_PATH] = {};
L"https://obsproject.com/update_studio/getpatchmanifest"
#define HASH_NULL L"0000000000000000000000000000000000000000"
static
bool
UpdateVS201
7
Redists
(
json_t
*
root
)
static
bool
UpdateVS201
9
Redists
(
json_t
*
root
)
{
/* ------------------------------------------ *
* Initialize session */
...
...
@@ -965,10 +965,10 @@ static bool UpdateVS2017Redists(json_t *root)
/* ------------------------------------------ *
* Download redist */
Status
(
L"Downloading %s"
,
L"Visual C++ 201
7
Redistributable"
);
Status
(
L"Downloading %s"
,
L"Visual C++ 201
9
Redistributable"
);
const
wchar_t
*
file
=
(
is32bit
)
?
L"
vc2017redist_
x86.exe"
:
L"
vc2017redist_
x64.exe"
;
const
wchar_t
*
file
=
(
is32bit
)
?
L"
VC_redist.
x86.exe"
:
L"
VC_redist.
x64.exe"
;
wstring
sourceURL
;
sourceURL
+=
L"https://cdn-fastly.obsproject.com/downloads/"
;
...
...
@@ -985,7 +985,7 @@ static bool UpdateVS2017Redists(json_t *root)
DeleteFile
(
destPath
.
c_str
());
Status
(
L"Update failed: Could not download "
L"%s (error code %d)"
,
L"Visual C++ 201
7
Redistributable"
,
responseCode
);
L"Visual C++ 201
9
Redistributable"
,
responseCode
);
return
false
;
}
...
...
@@ -993,9 +993,9 @@ static bool UpdateVS2017Redists(json_t *root)
* Get expected hash */
json_t
*
redistJson
=
json_object_get
(
root
,
is32bit
?
"vc201
7_redist_x86"
:
"vc2017
_redist_x64"
);
root
,
is32bit
?
"vc201
9_redist_x86"
:
"vc2019
_redist_x64"
);
if
(
!
redistJson
)
{
Status
(
L"Update failed: Could not parse VC201
7
redist json"
);
Status
(
L"Update failed: Could not parse VC201
9
redist json"
);
return
false
;
}
...
...
@@ -1020,7 +1020,7 @@ static bool UpdateVS2017Redists(json_t *root)
if
(
!
CalculateFileHash
(
destPath
.
c_str
(),
downloadHash
))
{
DeleteFile
(
destPath
.
c_str
());
Status
(
L"Update failed: Couldn't verify integrity of %s"
,
L"Visual C++ 201
7
Redistributable"
);
L"Visual C++ 201
9
Redistributable"
);
return
false
;
}
...
...
@@ -1031,7 +1031,7 @@ static bool UpdateVS2017Redists(json_t *root)
if
(
wcscmp
(
expectedHashWide
,
downloadHashWide
)
!=
0
)
{
DeleteFile
(
destPath
.
c_str
());
Status
(
L"Update failed: Couldn't verify integrity of %s"
,
L"Visual C++ 201
7
Redistributable"
);
L"Visual C++ 201
9
Redistributable"
);
return
false
;
}
...
...
@@ -1050,7 +1050,7 @@ static bool UpdateVS2017Redists(json_t *root)
nullptr
,
false
,
CREATE_NO_WINDOW
,
nullptr
,
nullptr
,
&
si
,
&
pi
);
if
(
success
)
{
Status
(
L"Installing %s..."
,
L"Visual C++ 201
7
Redistributable"
);
Status
(
L"Installing %s..."
,
L"Visual C++ 201
9
Redistributable"
);
CloseHandle
(
pi
.
hThread
);
WaitForSingleObject
(
pi
.
hProcess
,
INFINITE
);
...
...
@@ -1058,7 +1058,7 @@ static bool UpdateVS2017Redists(json_t *root)
}
else
{
Status
(
L"Update failed: Could not execute "
L"%s (error code %d)"
,
L"Visual C++ 201
7
Redistributable"
,
(
int
)
GetLastError
());
L"Visual C++ 201
9
Redistributable"
,
(
int
)
GetLastError
());
}
DeleteFile
(
destPath
.
c_str
());
...
...
@@ -1260,10 +1260,10 @@ static bool Update(wchar_t *cmdLine)
}
/* ------------------------------------- *
* Check for VS201
7
redistributables */
* Check for VS201
9
redistributables */
if
(
!
HasVS201
7
Redist
())
{
if
(
!
UpdateVS201
7
Redists
(
root
))
{
if
(
!
HasVS201
9
Redist
())
{
if
(
!
UpdateVS201
9
Redists
(
root
))
{
return
false
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录