From 07b2fbb35eae5497d8d058f8d2e5b1a815acdc0b Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 17 Nov 2010 18:25:56 +0000 Subject: [PATCH] - Windows: When trying to load a module (DLL) windows can give us the mysterious error 'The specified module could not be found' even though the file exists. This usually means that it depends on another DLL, but apparently Microsoft decided not to mention that in the error message. We now append some small text when such an error happens, saying that it could be because of a missing dependency. Reported by Phil. --- Changes | 6 ++++++ src/modules.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Changes b/Changes index 24c536727..e1192aa81 100644 --- a/Changes +++ b/Changes @@ -2222,3 +2222,9 @@ - Added set::options::allow-insane-bans which makes it possible to set really broad bans such as *@*.xx. Needless to say this can be very dangerous. Reported and patch provided by Stealth (#0003963). +- Windows: When trying to load a module (DLL) windows can give us the + mysterious error 'The specified module could not be found' even though the + file exists. This usually means that it depends on another DLL, but + apparently Microsoft decided not to mention that in the error message. + We now append some small text when such an error happens, saying that it + could be because of a missing dependency. Reported by Phil. diff --git a/src/modules.c b/src/modules.c index b88d8a5df..a12a05dc0 100644 --- a/src/modules.c +++ b/src/modules.c @@ -1754,6 +1754,10 @@ const char *our_dlerror(void) DWORD err = GetLastError(); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, errbuf, 512, NULL); + if (err == 126)) /* FIXME: find the correct code for 126 */ + strlcat(errbuf, " This could be because the DLL depends on another DLL, for example if you " + "are trying to load a 3rd party module which was compiled with a different compiler version.", + sizeof(errbuf)); return errbuf; } #endif