diff options
Diffstat (limited to 'sandbox/src/win_utils.cc')
-rw-r--r-- | sandbox/src/win_utils.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sandbox/src/win_utils.cc b/sandbox/src/win_utils.cc index 8be9ce4..7a95b32 100644 --- a/sandbox/src/win_utils.cc +++ b/sandbox/src/win_utils.cc @@ -139,7 +139,8 @@ bool SameObject(HANDLE handle, const wchar_t* full_path) { if (path[path.length() - 1] == kBackslash) path = path.substr(0, path.length() - 1); - if (0 == actual_path.compare(full_path)) + // Perfect match (case-insesitive check). + if (0 == _wcsicmp(actual_path.c_str(), path.c_str())) return true; // Look for the drive letter. @@ -265,6 +266,17 @@ bool GetPathFromHandle(HANDLE handle, std::wstring* path) { return true; } +bool GetNtPathFromWin32Path(const std::wstring& path, std::wstring* nt_path) { + HANDLE file = ::CreateFileW(path.c_str(), 0, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (file == INVALID_HANDLE_VALUE) + return false; + bool rv = GetPathFromHandle(file, nt_path); + ::CloseHandle(file); + return rv; +} + bool WriteProtectedChildMemory(HANDLE child_process, void* address, const void* buffer, size_t length) { // First, remove the protections. |