From 2e8166fd64d015979b3778abf8b5bbba5f4faca0 Mon Sep 17 00:00:00 2001 From: "selmer%netscape.com" Date: Wed, 13 Oct 1999 00:19:03 +0000 Subject: [PATCH] Added checking to ensure DLL & procedure get loaded successfully git-svn-id: svn://10.0.0.236/trunk@50521 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/cck/driver/interpret.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mozilla/cck/driver/interpret.cpp b/mozilla/cck/driver/interpret.cpp index 45a0241327a..b48b7a581a4 100644 --- a/mozilla/cck/driver/interpret.cpp +++ b/mozilla/cck/driver/interpret.cpp @@ -220,11 +220,12 @@ CString CInterpret::replaceVars(char *str, char *listval) BOOL CInterpret::CallDLL(char *dll, char *proc, char *parms) { // When searching for DLL info, the m_DLLs is a dummy object - // with its names set to the null string so it will never - // match. This simplifies the handling of the linked list. + // that only exists to hold the head of the list. This simplifies + // the handling of the linked list by allowing us to otherwise + // ignore the difference in the first node. - DLLINFO *dllp = &m_DLLs; - DLLINFO *last = NULL; + DLLINFO *last = &m_DLLs; + DLLINFO *dllp = m_DLLs.next; int found = FALSE; while (!found && dllp) { @@ -243,7 +244,11 @@ BOOL CInterpret::CallDLL(char *dll, char *proc, char *parms) dllp->dllName = CString(dll); dllp->procName = CString(proc); VERIFY(dllp->hDLL = ::LoadLibrary(dll)); + if (!dllp->hDLL) + return FALSE; VERIFY(dllp->procAddr = (DLLPROC *) ::GetProcAddress(dllp->hDLL, proc)); + if (!dllp->procAddr) + return FALSE; dllp->next = NULL; last->next = dllp;