browseui: Fix several memory leaks in the tests.
[wine/hacks.git] / dlls / riched32 / richedit.c
blob7513273291eee07305af6137681354e2716c953a
1 /*
2 * RichEdit32 functions
4 * This module is a simple wrapper for the RichEdit 2.0 control
6 * Copyright 2000 by Jean-Claude Batista
7 * Copyright 2005 Mike McCormack
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include <stdarg.h>
25 #include <string.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winreg.h"
30 #include "winerror.h"
31 #include "winuser.h"
32 #include "richedit.h"
33 #include "shlwapi.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
39 /* Window procedure of the RichEdit 1.0 control in riched20.dll */
40 extern LRESULT WINAPI RichEdit10ANSIWndProc(HWND, UINT, WPARAM, LPARAM);
43 /* Unregisters the window class. */
44 static BOOL RICHED32_Unregister(void)
46 TRACE("\n");
48 UnregisterClassA(RICHEDIT_CLASS10A, NULL);
49 return TRUE;
53 /* Registers the window class. */
54 static BOOL RICHED32_Register(void)
56 WNDCLASSA wndClass;
58 ZeroMemory(&wndClass, sizeof(WNDCLASSA));
59 wndClass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
60 wndClass.lpfnWndProc = RichEdit10ANSIWndProc;
61 wndClass.cbClsExtra = 0;
62 wndClass.cbWndExtra = sizeof(void *);
63 wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
64 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
65 wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */
67 RegisterClassA(&wndClass);
69 return TRUE;
72 /* Initialization function */
73 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
75 TRACE("\n");
76 switch (fdwReason)
78 case DLL_PROCESS_ATTACH:
79 DisableThreadLibraryCalls(hinstDLL);
80 return RICHED32_Register();
82 case DLL_PROCESS_DETACH:
83 return RICHED32_Unregister();
85 return TRUE;
88 /***********************************************************************
89 * DllGetVersion [RICHED32.2]
91 * Retrieves version information
93 HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
95 TRACE("\n");
97 if (pdvi->cbSize != sizeof(DLLVERSIONINFO))
98 return E_INVALIDARG;
100 pdvi->dwMajorVersion = 4;
101 pdvi->dwMinorVersion = 0;
102 pdvi->dwBuildNumber = 0;
103 pdvi->dwPlatformID = 0;
105 return S_OK;