source: branches/swt/src/gdi32/initterm.cpp@ 22102

Last change on this file since 22102 was 22102, checked in by rousseau, 10 years ago

Correct debug-message format

File size: 2.8 KB
Line 
1/* $Id: initterm.cpp,v 1.21 2002-07-29 11:26:49 sandervl Exp $
2 *
3 * GDI32 DLL entry point
4 *
5 * Copyright 1998 Sander van Leeuwen
6 * Copyright 1998 Peter Fitzsimmons
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 */
10
11#define INCL_DOSMODULEMGR
12#define INCL_DOSPROCESS
13#define INCL_GPI
14#include <os2wrap.h> //Odin32 OS/2 api wrappers
15#include <stdlib.h>
16#include <stdio.h>
17#include <string.h>
18#include <odin.h>
19#include <win32api.h>
20#include <winconst.h>
21#include <odinlx.h>
22#include <cpuhlp.h>
23#include <dbglog.h>
24#include <initdll.h>
25#include <stats.h>
26#include <exitlist.h>
27
28#include "region.h"
29#include "dibsect.h"
30#include "rgbcvt.h"
31
32#define DBG_LOCALLOG DBG_initterm
33#include "dbglocal.h"
34
35// Win32 resource table (produced by wrc)
36extern DWORD gdi32_PEResTab;
37
38static HMODULE dllHandle = 0;
39void (_Optlink *pRGB555to565)(WORD *dest, WORD *src, ULONG num) = NULL;
40void (_Optlink *pRGB565to555)(WORD *dest, WORD *src, ULONG num) = NULL;
41
42BOOL WINAPI GdiLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
43{
44 switch (fdwReason)
45 {
46 case DLL_PROCESS_ATTACH:
47 return TRUE;
48
49 case DLL_THREAD_ATTACH:
50 case DLL_THREAD_DETACH:
51 return TRUE;
52
53 case DLL_PROCESS_DETACH:
54 STATS_DumpStatsGDI32();
55 return TRUE;
56 }
57 return FALSE;
58}
59
60ULONG SYSTEM DLL_InitGdi32(ULONG hModule)
61{
62 __con_debug(2,"%s::%s@%08X(%08X)\n","GDI32",__FUNCTION__,DLL_InitGdi32,hModule);
63
64 STATS_InitializeGDI32 ();
65
66 ParseLogStatusGDI32();
67
68 if (!InitializeKernel32())
69 return -1;
70
71 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
72 if (InitRegionSpace() == FALSE)
73 return -1;
74
75 DIBSection::initDIBSection();
76 if (CPUFeatures & CPUID_MMX)
77 {
78 pRGB555to565 = RGB555to565MMX;
79 pRGB565to555 = RGB565to555MMX;
80 }
81 else
82 {
83 pRGB555to565 = RGB555to565;
84 pRGB565to555 = RGB565to555;
85 }
86
87 dllHandle = RegisterLxDll(hModule, GdiLibMain, (PVOID)&gdi32_PEResTab,
88 GDI32_MAJORIMAGE_VERSION, GDI32_MINORIMAGE_VERSION,
89 IMAGE_SUBSYSTEM_NATIVE);
90 if (dllHandle == 0)
91 return -1;
92
93 dprintf(("gdi32 init %s %s (%x)", __DATE__, __TIME__, DLL_InitGdi32));
94
95 RasEntry (RAS_EVENT_Gdi32InitComplete, &dllHandle, sizeof (dllHandle));
96
97
98 return EXITLIST_GDI32;
99}
100
101void SYSTEM DLL_TermGdi32(ULONG hModule)
102{
103 __con_debug(2,"%s::%s@%08X(%08X)\n","GDI32",__FUNCTION__,DLL_TermGdi32,hModule);
104
105 dprintf(("gdi32 exit"));
106
107 if (dllHandle)
108 {
109 DestroyRegionSpace();
110 UnregisterLxDll(dllHandle);
111 }
112
113 STATS_UninitializeGDI32();
114}
115
116ULONG SYSTEM DLL_Init(ULONG hModule)
117{
118 if (DLL_InitDefault(hModule) == -1)
119 return -1;
120 return DLL_InitGdi32(hModule);
121}
122
123void SYSTEM DLL_Term(ULONG hModule)
124{
125 DLL_TermGdi32(hModule);
126 DLL_TermDefault(hModule);
127}
Note: See TracBrowser for help on using the repository browser.