diff --git a/ninewinecfg/main.c b/ninewinecfg/main.c index 36a59dd..4285f11 100644 --- a/ninewinecfg/main.c +++ b/ninewinecfg/main.c @@ -230,36 +230,24 @@ static BOOL remove_file(LPCSTR filename) static BOOL create_symlink(LPCSTR target, LPCSTR filename) { BOOL ret; - char *target_fn, *fn; - - if (!(target_fn = unix_filename(target))) - { - ret = FALSE; - goto done; - } + char *fn = unix_filename(filename); - if (!(fn = unix_filename(filename))) - { - ret = FALSE; - goto free_target_fn; - } + if (!fn) + return FALSE; - if (!symlink(target_fn, fn)) + if (!symlink(target, fn)) { TRACE("Symlinked '%s' to '%s'\n", nine_dbgstr_a(fn), - nine_dbgstr_a(target_fn)); + nine_dbgstr_a(target)); ret = TRUE; } else { ERR("Failed to symlinked '%s' to '%s'\n", nine_dbgstr_a(fn), - nine_dbgstr_a(target_fn)); + nine_dbgstr_a(target)); ret = FALSE; } HeapFree(GetProcessHeap(), 0, fn); -free_target_fn: - HeapFree(GetProcessHeap(), 0, target_fn); -done: return ret; } @@ -468,8 +456,6 @@ static void nine_set(BOOL status, BOOL NoOtherArch) if (status) { - HMODULE hmod; - if (!nine_install_forwarder()) { ERR("Failed to install forwarder\n"); @@ -485,23 +471,7 @@ static void nine_set(BOOL status, BOOL NoOtherArch) remove_file(dst); } - hmod = LoadLibraryExA(fn_forwarder_dll, NULL, DONT_RESOLVE_DLL_REFERENCES); - if (hmod) - { - CHAR buf[MAX_PATH]; - DWORD len = GetModuleFileNameA(hmod, (LPSTR)buf, sizeof(buf)); - - if (len && len < sizeof(buf)) - create_symlink(buf, dst); - else - ERR("GetModuleFileNameA failed to get file path\n"); - - FreeLibrary(hmod); - } else { - LPWSTR msg = load_message(GetLastError()); - ERR("Couldn't load %s: %s\n", fn_forwarder_dll, nine_dbgstr_w(msg)); - LocalFree(msg); - } + create_symlink(fn_forwarder_dll, dst); } else { if (is_nine_symlink(dst)) {