Commit 31d7e1d3 authored by Cliff Smolinsky's avatar Cliff Smolinsky Committed by Commit Bot

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/+/1534960Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Cliff Smolinsky <cliffsmo@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60451}
parent 7629afdb
......@@ -3400,13 +3400,10 @@ v8_component("v8_libbase") {
libs = [
"dbghelp.lib",
"shlwapi.lib",
"winmm.lib",
"ws2_32.lib",
]
ldflags = [ "/DELAYLOAD:shlwapi.dll" ]
data_deps += [ "//build/win:runtime_libs" ]
}
......
......@@ -16,11 +16,11 @@
#include <windows.h>
#include <dbghelp.h>
#include <Shlwapi.h>
#include <stddef.h>
#include <iostream>
#include <memory>
#include <string>
#include "src/base/logging.h"
#include "src/base/macros.h"
......@@ -49,12 +49,6 @@ long WINAPI StackDumpExceptionFilter(EXCEPTION_POINTERS* info) { // NOLINT
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() {
if (g_initialized_symbols) return g_init_error == ERROR_SUCCESS;
g_initialized_symbols = true;
......@@ -87,9 +81,13 @@ bool InitializeSymbols() {
}
wchar_t exe_path[MAX_PATH];
GetExePath(exe_path);
std::wstring new_path(std::wstring(symbols_path.get()) + L";" +
std::wstring(exe_path));
GetModuleFileName(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.
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())) {
g_init_error = GetLastError();
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment