# HG changeset patch
# Node ID 8c92008d5aac
# Parent  12e26d298873
diff --git a/Makefile.mingw b/Makefile.mingw
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -69,7 +69,7 @@
 STRIPPED_RELEASE_DIR = $(PIDGIN_TREE_TOP)/pidgin-$(PIDGIN_VERSION)-win32bin
 DEBUG_SYMBOLS_DIR = $(PIDGIN_TREE_TOP)/pidgin-$(PIDGIN_VERSION)-dbgsym
 
-PIDGIN_INST_DEP_DIR="$(WIN32_DEV_TOP)/pidgin-inst-deps-20130214"
+PIDGIN_INST_DEP_DIR="$(WIN32_DEV_TOP)/pidgin-inst-deps-2022-12-01"
 
 # Any *.dll or *.exe files included in win32-install-dir that we don't compile
 # should be included in this list so they don't get stripped
@@ -85,6 +85,7 @@
 	libplc4.dll \
 	libplds4.dll \
 	libssp-0.dll \
+	mgwhelp.dll \
 	nss3.dll \
 	nssutil3.dll \
 	smime3.dll \
@@ -119,6 +120,7 @@
 	cp $(ENCHANT_TOP)/bin/libenchant.dll $(PIDGIN_INSTALL_DIR)/spellcheck
 	cp -R $(ENCHANT_TOP)/lib/enchant/*.dll $(PIDGIN_INSTALL_DIR)/spellcheck/lib/enchant
 	cp $(PIDGIN_INST_DEP_DIR)/exchndl.dll $(PIDGIN_INSTALL_DIR)
+	cp $(PIDGIN_INST_DEP_DIR)/mgwhelp.dll $(PIDGIN_INSTALL_DIR)
 	cp $(GCC_SSP_TOP)/libssp-0.dll $(PIDGIN_INSTALL_DIR)
 
 gtk_runtime_zip:
diff --git a/pidgin/win32/gtkwin32dep.c b/pidgin/win32/gtkwin32dep.c
--- a/pidgin/win32/gtkwin32dep.c
+++ b/pidgin/win32/gtkwin32dep.c
@@ -383,32 +383,8 @@
 }
 
 void winpidgin_init(HINSTANCE hint) {
-	typedef void (__cdecl* LPFNSETLOGFILE)(const LPCSTR);
-	LPFNSETLOGFILE MySetLogFile;
-	gchar *exchndl_dll_path;
-
 	purple_debug_info("winpidgin", "winpidgin_init start\n");
 
-	exe_hInstance = hint;
-
-	exchndl_dll_path = g_build_filename(wpurple_install_dir(), "exchndl.dll", NULL);
-	MySetLogFile = (LPFNSETLOGFILE) wpurple_find_and_loadproc(exchndl_dll_path, "SetLogFile");
-	g_free(exchndl_dll_path);
-	exchndl_dll_path = NULL;
-	if (MySetLogFile) {
-		gchar *debug_dir, *locale_debug_dir;
-
-		debug_dir = g_build_filename(purple_user_dir(), "pidgin.RPT", NULL);
-		locale_debug_dir = g_locale_from_utf8(debug_dir, -1, NULL, NULL, NULL);
-
-		purple_debug_info("winpidgin", "Setting exchndl.dll LogFile to %s\n", debug_dir);
-
-		MySetLogFile(locale_debug_dir);
-
-		g_free(debug_dir);
-		g_free(locale_debug_dir);
-	}
-
 #ifdef USE_GTKSPELL
 	winpidgin_spell_init();
 #endif
diff --git a/pidgin/win32/nsis/pidgin-installer.nsi b/pidgin/win32/nsis/pidgin-installer.nsi
--- a/pidgin/win32/nsis/pidgin-installer.nsi
+++ b/pidgin/win32/nsis/pidgin-installer.nsi
@@ -641,6 +641,7 @@
     Delete "$INSTDIR\ssl3.dll"
     Delete "$INSTDIR\${PIDGIN_UNINST_EXE}"
     Delete "$INSTDIR\exchndl.dll"
+    Delete "$INSTDIR\mgwhelp.dll"
     Delete "$INSTDIR\install.log"
 
     ; Remove the debug symbols
diff --git a/pidgin/win32/winpidgin.c b/pidgin/win32/winpidgin.c
--- a/pidgin/win32/winpidgin.c
+++ b/pidgin/win32/winpidgin.c
@@ -39,6 +39,8 @@
 typedef BOOL (WINAPI* LPFNATTACHCONSOLE)(DWORD);
 typedef BOOL (WINAPI* LPFNSETPROCESSDEPPOLICY)(DWORD);
 
+typedef void (WINAPI* ExcHndlInit)(void);
+
 static BOOL portable_mode = FALSE;
 
 /*
@@ -616,53 +618,17 @@
 
 			wcscat(pidgin_dir, L"\\exchndl.dll");
 			if ((hmod = LoadLibraryW(pidgin_dir))) {
-				typedef void (__cdecl* LPFNSETLOGFILE)(const LPCSTR);
-				LPFNSETLOGFILE MySetLogFile;
-				/* exchndl.dll is built without UNICODE */
-				char debug_dir[MAX_PATH];
+				ExcHndlInit init_func = NULL;
+
 				wprintf(L"Loaded exchndl.dll\n");
-				/* Temporarily override exchndl.dll's logfile
-				 * to something sane (Pidgin will override it
-				 * again when it initializes) */
-				MySetLogFile = (LPFNSETLOGFILE) GetProcAddress(hmod, "SetLogFile");
-				if (MySetLogFile) {
-					if (GetTempPathA(sizeof(debug_dir), debug_dir) != 0) {
-						strcat(debug_dir, "pidgin.RPT");
-						wprintf(L" Setting exchndl.dll LogFile to %s\n",
-							debug_dir);
-						MySetLogFile(debug_dir);
-					}
+
+				init_func = (void *)GetProcAddress(hmod, "ExcHndlInit");
+				if(init_func != NULL) {
+					init_func();
+					wprintf(L"Initialized exchndl.dll\n");
+				} else {
+					wprintf(L"Failed to find ExcHndlInit in exchndl.dll");
 				}
-				/* The function signature for SetDebugInfoDir is the same as SetLogFile,
-				 * so we can reuse the variable */
-				MySetLogFile = (LPFNSETLOGFILE) GetProcAddress(hmod, "SetDebugInfoDir");
-				if (MySetLogFile) {
-					char *pidgin_dir_ansi = NULL;
-					/* Restore pidgin_dir to point to where the executable is */
-					pidgin_dir_start[0] = L'\0';
-					i = WideCharToMultiByte(CP_ACP, 0, pidgin_dir,
-						-1, NULL, 0, NULL, NULL);
-					if (i != 0) {
-						pidgin_dir_ansi = malloc(i);
-						i = WideCharToMultiByte(CP_ACP, 0, pidgin_dir,
-							-1, pidgin_dir_ansi, i, NULL, NULL);
-						if (i == 0) {
-							free(pidgin_dir_ansi);
-							pidgin_dir_ansi = NULL;
-						}
-					}
-					if (pidgin_dir_ansi != NULL) {
-						_snprintf(debug_dir, sizeof(debug_dir),
-							"%s\\pidgin-%s-dbgsym",
-							pidgin_dir_ansi,  VERSION);
-						debug_dir[sizeof(debug_dir) - 1] = '\0';
-						wprintf(L" Setting exchndl.dll DebugInfoDir to %s\n",
-							debug_dir);
-						MySetLogFile(debug_dir);
-						free(pidgin_dir_ansi);
-					}
-				}
-
 			}
 
 			/* Restore pidgin_dir to point to where the executable is */
