Replace shlwapi call with STL.
The only use of shlwapi is for a single method which can be easily replaced by simple wstring calls. This change makes that swap and removes the reference to shlwapi completely. Bug: v8:9031 Change-Id: Ia8f2c44e8166d93e309016896b26a84bdb90d720 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1534960 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Cliff Smolinsky <cliffsmo@microsoft.com> Cr-Commit-Position: refs/heads/master@{#60451}
This commit is contained in:
parent
7629afdb9d
commit
31d7e1d366
3
BUILD.gn
3
BUILD.gn
@ -3400,13 +3400,10 @@ v8_component("v8_libbase") {
|
|||||||
|
|
||||||
libs = [
|
libs = [
|
||||||
"dbghelp.lib",
|
"dbghelp.lib",
|
||||||
"shlwapi.lib",
|
|
||||||
"winmm.lib",
|
"winmm.lib",
|
||||||
"ws2_32.lib",
|
"ws2_32.lib",
|
||||||
]
|
]
|
||||||
|
|
||||||
ldflags = [ "/DELAYLOAD:shlwapi.dll" ]
|
|
||||||
|
|
||||||
data_deps += [ "//build/win:runtime_libs" ]
|
data_deps += [ "//build/win:runtime_libs" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <Shlwapi.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "src/base/logging.h"
|
#include "src/base/logging.h"
|
||||||
#include "src/base/macros.h"
|
#include "src/base/macros.h"
|
||||||
@ -49,12 +49,6 @@ long WINAPI StackDumpExceptionFilter(EXCEPTION_POINTERS* info) { // NOLINT
|
|||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetExePath(wchar_t* path_out) {
|
|
||||||
GetModuleFileName(nullptr, path_out, MAX_PATH);
|
|
||||||
path_out[MAX_PATH - 1] = L'\0';
|
|
||||||
PathRemoveFileSpec(path_out);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool InitializeSymbols() {
|
bool InitializeSymbols() {
|
||||||
if (g_initialized_symbols) return g_init_error == ERROR_SUCCESS;
|
if (g_initialized_symbols) return g_init_error == ERROR_SUCCESS;
|
||||||
g_initialized_symbols = true;
|
g_initialized_symbols = true;
|
||||||
@ -87,9 +81,13 @@ bool InitializeSymbols() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wchar_t exe_path[MAX_PATH];
|
wchar_t exe_path[MAX_PATH];
|
||||||
GetExePath(exe_path);
|
GetModuleFileName(nullptr, exe_path, MAX_PATH);
|
||||||
std::wstring new_path(std::wstring(symbols_path.get()) + L";" +
|
std::wstring exe_path_wstring(exe_path);
|
||||||
std::wstring(exe_path));
|
// To get the path without the filename, we just need to remove the final
|
||||||
|
// slash and everything after it.
|
||||||
|
std::wstring new_path(
|
||||||
|
std::wstring(symbols_path.get()) + L";" +
|
||||||
|
exe_path_wstring.substr(0, exe_path_wstring.find_last_of(L"\\/")));
|
||||||
if (!SymSetSearchPathW(GetCurrentProcess(), new_path.c_str())) {
|
if (!SymSetSearchPathW(GetCurrentProcess(), new_path.c_str())) {
|
||||||
g_init_error = GetLastError();
|
g_init_error = GetLastError();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user