ReactOS  0.4.14-dev-358-gbef841c
odbccp32.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS ODBC Control Panel Applet
3  * FILE: dll/cpl/odbccp32/odbccp32.c
4  * PURPOSE: applet initialization
5  * PROGRAMMER: Johannes Anderwald
6  */
7 
8 #include "odbccp32.h"
9 
13 
14 
15 LONG
17 CPlApplet(HWND hwndCpl,
18  UINT uMsg,
19  LPARAM lParam1,
20  LPARAM lParam2)
21 {
22  switch (uMsg)
23  {
24  case CPL_INIT:
25  return TRUE;
26 
27  case CPL_DBLCLK:
28  {
29  if (ODBCProc == NULL)
30  {
31  TCHAR szBuffer[MAX_PATH];
32 
33  if (ExpandEnvironmentStrings(_T("%systemroot%\\system32\\odbccp32.dll"),
34  szBuffer,
35  sizeof(szBuffer) / sizeof(TCHAR)) > 0)
36  {
37  hLibrary = LoadLibrary(szBuffer);
38  if (hLibrary)
39  {
40  ODBCProc = (APPLET_PROC)GetProcAddress(hLibrary, "ODBCCPlApplet");
41  }
42  }
43  }
44 
45  if (ODBCProc)
46  {
47  return ODBCProc(hwndCpl, uMsg, lParam1, lParam2);
48  }
49  else
50  {
51  if (hLibrary)
52  {
54  }
55 
57  return (LONG)-1;
58  }
59  }
60  }
61 
62  return FALSE;
63 }
64 
65 
66 BOOL
67 WINAPI
68 DllMain(HINSTANCE hinstDLL,
70  LPVOID lpReserved)
71 {
73  UNREFERENCED_PARAMETER(lpReserved);
74 
75  switch(dwReason)
76  {
77  case DLL_PROCESS_ATTACH:
78  case DLL_THREAD_ATTACH:
79  {
80  InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
83 
84  hApplet = hinstDLL;
85  break;
86  }
87  }
88 
89  return TRUE;
90 }
#define TRUE
Definition: types.h:120
LONG CALLBACK CPlApplet(HWND hwndCpl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
Definition: odbccp32.c:17
#define LoadLibrary
Definition: winbase.h:3686
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DLL_THREAD_ATTACH
Definition: compat.h:121
LONG(APIENTRY * APPLET_PROC)(HWND, UINT, LPARAM, LPARAM)
Definition: cpl.h:23
#define ExpandEnvironmentStrings
Definition: winbase.h:3598
#define CALLBACK
Definition: compat.h:27
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
static VOID InitControls(HWND hwnd)
Definition: mplay32.c:303
#define CPL_DBLCLK
Definition: cpl.h:16
DWORD dwReason
Definition: misc.cpp:154
#define ICC_UPDOWN_CLASS
Definition: commctrl.h:62
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
char TCHAR
Definition: xmlstorage.h:189
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:413
HINSTANCE hApplet
Definition: odbccp32.c:10
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CPL_INIT
Definition: cpl.h:12
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
HMODULE hLibrary
Definition: odbccp32.c:12
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved)
Definition: odbccp32.c:68
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
unsigned int UINT
Definition: ndis.h:50
APPLET_PROC ODBCProc
Definition: odbccp32.c:11
#define GetProcAddress(x, y)
Definition: compat.h:418