MINGW-packages/mingw-w64-nodejs/0021-Use-wide-character-Win32-API-functions-to-handle-wch.patch
2024-11-09 17:50:52 +01:00

81 lines
3.7 KiB
Diff

From 1bcebd98fee4e97be94be19ade983c142d3f2892 Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Sat, 14 Apr 2018 20:40:00 +0200
Subject: [PATCH 21/23] Use wide-character Win32 API functions to handle
`wchar_t *`
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
deps/v8/src/base/debug/stack_trace_win.cc | 2 +-
deps/v8/src/base/platform/platform-win32.cc | 10 +++++-----
deps/v8/src/diagnostics/unwinding-info-win64.cc | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/deps/v8/src/base/debug/stack_trace_win.cc b/deps/v8/src/base/debug/stack_trace_win.cc
index f981bec6..16655d51 100644
--- a/deps/v8/src/base/debug/stack_trace_win.cc
+++ b/deps/v8/src/base/debug/stack_trace_win.cc
@@ -81,7 +81,7 @@ bool InitializeSymbols() {
}
wchar_t exe_path[MAX_PATH];
- GetModuleFileName(nullptr, exe_path, MAX_PATH);
+ GetModuleFileNameW(nullptr, exe_path, MAX_PATH);
std::wstring exe_path_wstring(exe_path);
// To get the path without the filename, we just need to remove the final
// slash and everything after it.
diff --git a/deps/v8/src/base/platform/platform-win32.cc b/deps/v8/src/base/platform/platform-win32.cc
index fa03a80e..800816ee 100644
--- a/deps/v8/src/base/platform/platform-win32.cc
+++ b/deps/v8/src/base/platform/platform-win32.cc
@@ -759,7 +759,7 @@ bool UserShadowStackEnabled() {
"IsUserCetAvailableInEnvironment"));
auto get_process_mitigation_policy =
reinterpret_cast<decltype(&GetProcessMitigationPolicy)>(::GetProcAddress(
- ::GetModuleHandle(L"Kernel32.dll"), "GetProcessMitigationPolicy"));
+ ::GetModuleHandleW(L"kernel32.dll"), "GetProcessMitigationPolicy"));
if (!is_user_cet_available_in_environment || !get_process_mitigation_policy) {
return false;
@@ -802,13 +802,13 @@ void OS::EnsureWin32MemoryAPILoaded() {
static bool loaded = false;
if (!loaded) {
VirtualAlloc2 = (VirtualAlloc2_t)GetProcAddress(
- GetModuleHandle(L"kernelbase.dll"), "VirtualAlloc2");
+ GetModuleHandleW(L"kernelbase.dll"), "VirtualAlloc2");
MapViewOfFile3 = (MapViewOfFile3_t)GetProcAddress(
- GetModuleHandle(L"kernelbase.dll"), "MapViewOfFile3");
+ GetModuleHandleW(L"kernelbase.dll"), "MapViewOfFile3");
UnmapViewOfFile2 = (UnmapViewOfFile2_t)GetProcAddress(
- GetModuleHandle(L"kernelbase.dll"), "UnmapViewOfFile2");
+ GetModuleHandleW(L"kernelbase.dll"), "UnmapViewOfFile2");
loaded = true;
}
@@ -1091,7 +1091,7 @@ bool OS::DiscardSystemPages(void* address, size_t size) {
reinterpret_cast<DiscardVirtualMemoryFunction>(-1))
discard_virtual_memory =
reinterpret_cast<DiscardVirtualMemoryFunction>(GetProcAddress(
- GetModuleHandle(L"Kernel32.dll"), "DiscardVirtualMemory"));
+ GetModuleHandleW(L"kernel32.dll"), "DiscardVirtualMemory"));
// Use DiscardVirtualMemory when available because it releases faster than
// MEM_RESET.
DiscardVirtualMemoryFunction discard_function = discard_virtual_memory.load();
diff --git a/deps/v8/src/diagnostics/unwinding-info-win64.cc b/deps/v8/src/diagnostics/unwinding-info-win64.cc
index a71b8661..5c8c6010 100644
--- a/deps/v8/src/diagnostics/unwinding-info-win64.cc
+++ b/deps/v8/src/diagnostics/unwinding-info-win64.cc
@@ -471,7 +471,7 @@ static decltype(
void LoadNtdllUnwindingFunctionsOnce() {
// Load functions from the ntdll.dll module.
HMODULE ntdll_module =
- LoadLibraryEx(L"ntdll.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
+ LoadLibraryExW(L"ntdll.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
DCHECK_NOT_NULL(ntdll_module);
// This fails on Windows 7.
--
2.17.0.windows.1