win-capture: Fix game capture file integrity test
Fixes the file integrity test when required files are placed in a path containing non-english character encodings. Closes jp9000/obs-studio#523
This commit is contained in:
parent
183d12f002
commit
a2b6432f53
@ -381,15 +381,23 @@ static bool check_file_integrity(struct game_capture *gc, const char *file,
|
|||||||
{
|
{
|
||||||
DWORD error;
|
DWORD error;
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
|
wchar_t *w_file = NULL;
|
||||||
|
|
||||||
if (!file || !*file) {
|
if (!file || !*file) {
|
||||||
warn("Game capture %s not found." STOP_BEING_BAD, name);
|
warn("Game capture %s not found." STOP_BEING_BAD, name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = CreateFileA(file, GENERIC_READ | GENERIC_EXECUTE,
|
if (!os_utf8_to_wcs_ptr(file, 0, &w_file)) {
|
||||||
|
warn("Could not convert file name to wide string");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
handle = CreateFileW(w_file, GENERIC_READ | GENERIC_EXECUTE,
|
||||||
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||||
|
|
||||||
|
bfree(w_file);
|
||||||
|
|
||||||
if (handle != INVALID_HANDLE_VALUE) {
|
if (handle != INVALID_HANDLE_VALUE) {
|
||||||
CloseHandle(handle);
|
CloseHandle(handle);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user