From: Hermès Bélusca-Maïto Date: Sun, 22 Jun 2014 09:33:46 +0000 (+0000) Subject: [ODBCCP32] X-Git-Tag: backups/0.3.17@66124~971 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=adc64f21ca17d13e24d0e723481b52bf33d0e306 [ODBCCP32] The control panel automatically runs this applet without clicking on it, fix this wrong behaviour. Patch by Lee Schröder CORE-8323 #resolve #comment Thanks :) svn path=/trunk/; revision=63625 --- diff --git a/reactos/dll/cpl/odbccp32/odbccp32.c b/reactos/dll/cpl/odbccp32/odbccp32.c index ce77120626b..194ea052467 100644 --- a/reactos/dll/cpl/odbccp32/odbccp32.c +++ b/reactos/dll/cpl/odbccp32/odbccp32.c @@ -19,36 +19,47 @@ CPlApplet(HWND hwndCpl, LPARAM lParam1, LPARAM lParam2) { - if (ODBCProc == NULL) - { - TCHAR szBuffer[MAX_PATH]; + switch (uMsg) + { + case CPL_INIT: + return TRUE; - if (ExpandEnvironmentStrings(_T("%systemroot%\\system32\\odbccp32.dll"), - szBuffer, - sizeof(szBuffer) / sizeof(TCHAR)) > 0) - { - hLibrary = LoadLibrary(szBuffer); - if (hLibrary) - { - ODBCProc = (APPLET_PROC)GetProcAddress(hLibrary, "ODBCCPlApplet"); - } - } - } + case CPL_DBLCLK: + { + if (ODBCProc == NULL) + { + TCHAR szBuffer[MAX_PATH]; - if (ODBCProc) - { - return ODBCProc(hwndCpl, uMsg, lParam1, lParam2); - } - else - { - if(hLibrary) - { - FreeLibrary(hLibrary); - } + if (ExpandEnvironmentStrings(_T("%systemroot%\\system32\\odbccp32.dll"), + szBuffer, + sizeof(szBuffer) / sizeof(TCHAR)) > 0) + { + hLibrary = LoadLibrary(szBuffer); + if (hLibrary) + { + ODBCProc = (APPLET_PROC)GetProcAddress(hLibrary, "ODBCCPlApplet"); + } + } + } + + if (ODBCProc) + { + return ODBCProc(hwndCpl, uMsg, lParam1, lParam2); + } + else + { + if (hLibrary) + { + FreeLibrary(hLibrary); + } + + TerminateProcess(GetCurrentProcess(), -1); + return (LONG)-1; + } + } + } - TerminateProcess(GetCurrentProcess(), -1); - return (LONG)-1; - } + return FALSE; }