Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
484084ab
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 搜索 >>
提交
484084ab
编写于
11月 14, 2020
作者:
J
jpark37
提交者:
Jim
11月 15, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
win-capture: Clean up remaining /W4 warnings
上级
1fa99dd0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
38 deletion
+43
-38
plugins/win-capture/app-helpers.c
plugins/win-capture/app-helpers.c
+6
-3
plugins/win-capture/inject-library.c
plugins/win-capture/inject-library.c
+15
-15
plugins/win-capture/load-graphics-offsets.c
plugins/win-capture/load-graphics-offsets.c
+11
-11
plugins/win-capture/plugin-main.c
plugins/win-capture/plugin-main.c
+8
-7
plugins/win-capture/window-helpers.c
plugins/win-capture/window-helpers.c
+3
-2
未找到文件。
plugins/win-capture/app-helpers.c
浏览文件 @
484084ab
...
...
@@ -2,8 +2,9 @@
#include <stdio.h>
#include "app-helpers.h"
#include "nt-stuff.h"
#include "util/base.h"
WINADVAPI
WINAPI
ConvertSidToStringSidW
(
PSID
sid
,
LPWSTR
*
str
);
WINADVAPI
BOOL
WINAPI
ConvertSidToStringSidW
(
PSID
sid
,
LPWSTR
*
str
);
bool
is_app
(
HANDLE
process
)
{
...
...
@@ -16,8 +17,10 @@ bool is_app(HANDLE process)
&
ret
,
sizeof
(
ret
),
&
size_ret
);
if
(
!
success
)
{
DWORD
error
=
GetLastError
();
int
test
=
0
;
const
DWORD
error
=
GetLastError
();
blog
(
LOG_ERROR
,
"is_app GetTokenInformation failed: 0x%08lX"
,
error
);
}
CloseHandle
(
token
);
...
...
plugins/win-capture/inject-library.c
浏览文件 @
484084ab
...
...
@@ -37,16 +37,16 @@ int inject_library_obf(HANDLE process, const wchar_t *dll,
virtual_free_ex_t
virtual_free_ex
;
FARPROC
load_library_w
;
create_remote_thread
=
get_obfuscated_func
(
kernel32
,
create_remote_thread_obf
,
obf1
);
write_process_memory
=
get_obfuscated_func
(
kernel32
,
write_process_memory_obf
,
obf2
);
virtual_alloc_ex
=
get_obfuscated_func
(
kernel32
,
virtual_alloc_ex_obf
,
obf3
);
virtual_free_ex
=
get_obfuscated_func
(
kernel32
,
virtual_free_ex_obf
,
obf4
);
load_library_w
=
get_obfuscated_func
(
kernel32
,
load_library_w_obf
,
obf5
);
create_remote_thread
=
(
create_remote_thread_t
)
get_obfuscated_func
(
kernel32
,
create_remote_thread_obf
,
obf1
);
write_process_memory
=
(
write_process_memory_t
)
get_obfuscated_func
(
kernel32
,
write_process_memory_obf
,
obf2
);
virtual_alloc_ex
=
(
virtual_alloc_ex_t
)
get_obfuscated_func
(
kernel32
,
virtual_alloc_ex_obf
,
obf3
);
virtual_free_ex
=
(
virtual_free_ex_t
)
get_obfuscated_func
(
kernel32
,
virtual_free_ex_obf
,
obf4
);
load_library_w
=
(
FARPROC
)
get_obfuscated_func
(
kernel32
,
load_library_w_obf
,
obf5
);
/* -------------------------------- */
...
...
@@ -108,7 +108,7 @@ int inject_library_safe_obf(DWORD thread_id, const wchar_t *dll,
HMODULE
user32
=
GetModuleHandleW
(
L"USER32"
);
set_windows_hook_ex_t
set_windows_hook_ex
;
HMODULE
lib
=
LoadLibraryW
(
dll
);
LPVOID
proc
;
HOOKPROC
proc
;
HHOOK
hook
;
size_t
i
;
...
...
@@ -117,17 +117,17 @@ int inject_library_safe_obf(DWORD thread_id, const wchar_t *dll,
}
#ifdef _WIN64
proc
=
GetProcAddress
(
lib
,
"dummy_debug_proc"
);
proc
=
(
HOOKPROC
)
GetProcAddress
(
lib
,
"dummy_debug_proc"
);
#else
proc
=
GetProcAddress
(
lib
,
"_dummy_debug_proc@12"
);
proc
=
(
HOOKPROC
)
GetProcAddress
(
lib
,
"_dummy_debug_proc@12"
);
#endif
if
(
!
proc
)
{
return
INJECT_ERROR_UNLIKELY_FAIL
;
}
set_windows_hook_ex
=
get_obfuscated_func
(
user32
,
set_windows_hook_ex_obf
,
obf1
);
set_windows_hook_ex
=
(
set_windows_hook_ex_t
)
get_obfuscated_func
(
user32
,
set_windows_hook_ex_obf
,
obf1
);
hook
=
set_windows_hook_ex
(
WH_GETMESSAGE
,
proc
,
lib
,
thread_id
);
if
(
!
hook
)
{
...
...
plugins/win-capture/load-graphics-offsets.c
浏览文件 @
484084ab
...
...
@@ -156,11 +156,12 @@ failed:
return
!
ver_mismatch
;
}
bool
load_graphics_offsets
(
bool
is32bit
,
const
char
*
config_path
)
bool
load_graphics_offsets
(
bool
is32bit
,
bool
use_hook_address_cache
,
const
char
*
config_path
)
{
char
*
offset_exe_path
=
NULL
;
struct
dstr
offset_exe
=
{
0
};
struct
dstr
config_ini
=
{
0
};
struct
dstr
offset_exe
=
{
0
};
struct
dstr
str
=
{
0
};
os_process_pipe_t
*
pp
;
bool
success
=
false
;
...
...
@@ -200,15 +201,14 @@ bool load_graphics_offsets(bool is32bit, const char *config_path)
goto
error
;
}
// uncomment this if you enable USE_HOOK_ADDRESS_CACHE
/*
dstr_copy(&config_ini, config_path);
dstr_cat(&config_ini, is32bit ? "32.ini" : "64.ini");
if
(
use_hook_address_cache
)
{
dstr_copy
(
&
config_ini
,
config_path
);
dstr_cat
(
&
config_ini
,
is32bit
?
"32.ini"
:
"64.ini"
);
os_quick_write_utf8_file_safe(config_ini.array, str.array, str.len, false
,
"tmp", NULL);
dstr_free(&config_ini);
*/
os_quick_write_utf8_file_safe
(
config_ini
.
array
,
str
.
array
,
str
.
len
,
false
,
"tmp"
,
NULL
);
dstr_free
(
&
config_ini
);
}
success
=
load_offsets_from_string
(
is32bit
?
&
offsets32
:
&
offsets64
,
str
.
array
);
...
...
@@ -235,7 +235,7 @@ bool load_cached_graphics_offsets(bool is32bit, const char *config_path)
success
=
load_offsets_from_file
(
is32bit
?
&
offsets32
:
&
offsets64
,
config_ini
.
array
);
if
(
!
success
)
success
=
load_graphics_offsets
(
is32bit
,
config_path
);
success
=
load_graphics_offsets
(
is32bit
,
true
,
config_path
);
dstr_free
(
&
config_ini
);
return
success
;
...
...
plugins/win-capture/plugin-main.c
浏览文件 @
484084ab
...
...
@@ -19,7 +19,8 @@ static HANDLE init_hooks_thread = NULL;
extern
bool
cached_versions_match
(
void
);
extern
bool
load_cached_graphics_offsets
(
bool
is32bit
,
const
char
*
config_path
);
extern
bool
load_graphics_offsets
(
bool
is32bit
,
const
char
*
config_path
);
extern
bool
load_graphics_offsets
(
bool
is32bit
,
bool
use_hook_address_cache
,
const
char
*
config_path
);
/* temporary, will eventually be erased once we figure out how to create both
* 32bit and 64bit versions of the helpers/hook */
...
...
@@ -29,22 +30,22 @@ extern bool load_graphics_offsets(bool is32bit, const char *config_path);
#define IS32BIT true
#endif
/* note, need to enable cache writing in load-graphics-offsets.c if you turn
* this back on*/
#define USE_HOOK_ADDRESS_CACHE false
static
const
bool
use_hook_address_cache
=
false
;
static
DWORD
WINAPI
init_hooks
(
LPVOID
param
)
{
char
*
config_path
=
param
;
if
(
USE_HOOK_ADDRESS_CACHE
&&
cached_versions_match
()
&&
if
(
use_hook_address_cache
&&
cached_versions_match
()
&&
load_cached_graphics_offsets
(
IS32BIT
,
config_path
))
{
load_cached_graphics_offsets
(
!
IS32BIT
,
config_path
);
obs_register_source
(
&
game_capture_info
);
}
else
if
(
load_graphics_offsets
(
IS32BIT
,
config_path
))
{
load_graphics_offsets
(
!
IS32BIT
,
config_path
);
}
else
if
(
load_graphics_offsets
(
IS32BIT
,
use_hook_address_cache
,
config_path
))
{
load_graphics_offsets
(
!
IS32BIT
,
use_hook_address_cache
,
config_path
);
}
bfree
(
config_path
);
...
...
plugins/win-capture/window-helpers.c
浏览文件 @
484084ab
...
...
@@ -58,9 +58,10 @@ static HMODULE kernel32(void)
static
inline
HANDLE
open_process
(
DWORD
desired_access
,
bool
inherit_handle
,
DWORD
process_id
)
{
static
HANDLE
(
WINAPI
*
open_process_proc
)(
DWORD
,
BOOL
,
DWORD
)
=
NULL
;
typedef
HANDLE
(
WINAPI
*
PFN_OpenProcess
)(
DWORD
,
BOOL
,
DWORD
);
static
PFN_OpenProcess
open_process_proc
=
NULL
;
if
(
!
open_process_proc
)
open_process_proc
=
get_obfuscated_func
(
open_process_proc
=
(
PFN_OpenProcess
)
get_obfuscated_func
(
kernel32
(),
"B}caZyah`~q"
,
0x2D5BEBAF6DDULL
);
return
open_process_proc
(
desired_access
,
inherit_handle
,
process_id
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录