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
master
sorayuki 2016-03-17 17:34:54 +08:00 committed by jp9000
parent 183d12f002
commit a2b6432f53
1 changed files with 9 additions and 1 deletions

View File

@ -381,15 +381,23 @@ static bool check_file_integrity(struct game_capture *gc, const char *file,
{
DWORD error;
HANDLE handle;
wchar_t *w_file = NULL;
if (!file || !*file) {
warn("Game capture %s not found." STOP_BEING_BAD, name);
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);
bfree(w_file);
if (handle != INVALID_HANDLE_VALUE) {
CloseHandle(handle);
return true;