summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-02-09 12:58:23 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-10 04:36:46 -0500
commit1d3ed1687f8eb5023338499f5f548a5b39074349 (patch)
treefc6cffa712b061fe626229671e5f42bc6f458b03 /rts
parent0ff70427c78b57558da0f966a08013090ac51fd1 (diff)
downloadhaskell-1d3ed1687f8eb5023338499f5f548a5b39074349.tar.gz
PEi386: Drop Windows Vista fallback in addLibrarySearchPath
We no longer support Windows Vista.
Diffstat (limited to 'rts')
-rw-r--r--rts/linker/PEi386.c55
1 files changed, 3 insertions, 52 deletions
diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c
index 011e47a21b..e46949d9ea 100644
--- a/rts/linker/PEi386.c
+++ b/rts/linker/PEi386.c
@@ -767,11 +767,6 @@ pathchar* findSystemLibrary_PEi386( pathchar* dll_name )
HsPtr addLibrarySearchPath_PEi386(pathchar* dll_path)
{
- HINSTANCE hDLL = LoadLibraryW(L"Kernel32.DLL");
- LPAddDLLDirectory AddDllDirectory = (LPAddDLLDirectory)(void*)GetProcAddress((HMODULE)hDLL, "AddDllDirectory");
-
- HsPtr result = NULL;
-
const unsigned int init_buf_size = 4096;
int bufsize = init_buf_size;
@@ -788,40 +783,7 @@ HsPtr addLibrarySearchPath_PEi386(pathchar* dll_path)
}
}
- if (AddDllDirectory) {
- result = AddDllDirectory(abs_path);
- }
- else
- {
- warnMissingKBLibraryPaths();
- WCHAR* str = stgMallocBytes(sizeof(WCHAR) * init_buf_size, "addLibrarySearchPath_PEi386(2)");
- wResult = GetEnvironmentVariableW(L"PATH", str, bufsize);
-
- if (wResult > init_buf_size) {
- str = realloc(str, sizeof(WCHAR) * wResult);
- bufsize = wResult;
- wResult = GetEnvironmentVariableW(L"PATH", str, bufsize);
- if (!wResult) {
- sysErrorBelch("addLibrarySearchPath[GetEnvironmentVariableW]: %" PATH_FMT " (Win32 error %lu)", dll_path, GetLastError());
- }
- }
-
- bufsize = wResult + 2 + pathlen(abs_path);
- wchar_t* newPath = stgMallocBytes(sizeof(wchar_t) * bufsize, "addLibrarySearchPath_PEi386(3)");
-
- wcscpy(newPath, abs_path);
- wcscat(newPath, L";");
- wcscat(newPath, str);
- if (!SetEnvironmentVariableW(L"PATH", (LPCWSTR)newPath)) {
- sysErrorBelch("addLibrarySearchPath[SetEnvironmentVariableW]: %" PATH_FMT " (Win32 error %lu)", abs_path, GetLastError());
- }
-
- stgFree(newPath);
- stgFree(abs_path);
-
- return str;
- }
-
+ HsPtr result = AddDllDirectory(abs_path);
if (!result) {
sysErrorBelch("addLibrarySearchPath: %" PATH_FMT " (Win32 error %lu)", abs_path, GetLastError());
stgFree(abs_path);
@@ -837,19 +799,8 @@ bool removeLibrarySearchPath_PEi386(HsPtr dll_path_index)
bool result = false;
if (dll_path_index != NULL) {
- HINSTANCE hDLL = LoadLibraryW(L"Kernel32.DLL");
- LPRemoveDLLDirectory RemoveDllDirectory = (LPRemoveDLLDirectory)(void*)GetProcAddress((HMODULE)hDLL, "RemoveDllDirectory");
-
- if (RemoveDllDirectory) {
- result = RemoveDllDirectory(dll_path_index);
- // dll_path_index is now invalid, do not use it after this point.
- }
- else
- {
- warnMissingKBLibraryPaths();
- result = SetEnvironmentVariableW(L"PATH", (LPCWSTR)dll_path_index);
- stgFree(dll_path_index);
- }
+ result = RemoveDllDirectory(dll_path_index);
+ // dll_path_index is now invalid, do not use it after this point.
if (!result) {
sysErrorBelch("removeLibrarySearchPath: (Win32 error %lu)", GetLastError());