source: branches/swt/src/gdiplus/initterm.cpp

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

Integrating from Wine Sources [gdiplus]

We will start with 'gdiplus.cpp' and build a minimal 'gdiplus.dll'.
While climbing up the wine-repo, more info will be obtained about the
integration process. This info is collected at the developer-site with
the goal of auto-integration in the future.

Commit: a781bbf096d9a3264fe52fa90891b5a19fca9e4d
Wine git-repo: git://source.winehq.org/git/wine.git

File size: 2.9 KB
Line 
1/* $Id: initterm.cpp,v 1.21 2016-02-09 10:00:00 rousseau Exp $
2 *
3 * GDIPLUS 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 gdiplus_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 GdiplusLibMain(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_DumpStatsGDIPLUS();
55 return TRUE;
56 }
57 return FALSE;
58}
59
60ULONG SYSTEM DLL_InitGdiplus(ULONG hModule)
61{
62 __con_debug(2,"%s::%s@%08X(%08X)\n","GDIPLUS",__FUNCTION__,DLL_InitGdiplus,hModule);
63
64/// STATS_InitializeGDIPLUS ();
65
66/// ParseLogStatusGDIPLUS();
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, GdiplusLibMain, (PVOID)&gdiplus_PEResTab,
88 GDIPLUS_MAJORIMAGE_VERSION, GDIPLUS_MINORIMAGE_VERSION,
89 IMAGE_SUBSYSTEM_NATIVE);
90 if (dllHandle == 0)
91 return -1;
92
93 dprintf(("gdiplus init %s %s (%x)", __DATE__, __TIME__, DLL_InitGdiplus));
94
95/// RasEntry (RAS_EVENT_GdiplusInitComplete, &dllHandle, sizeof (dllHandle));
96
97
98 return EXITLIST_GDIPLUS;
99}
100
101void SYSTEM DLL_TermGdiplus(ULONG hModule)
102{
103 __con_debug(2,"%s::%s@%08X(%08X)\n","GDIPLUS",__FUNCTION__,DLL_TermGdiplus,hModule);
104
105 dprintf(("gdiplus exit"));
106/**
107 if (dllHandle)
108 {
109 DestroyRegionSpace();
110 UnregisterLxDll(dllHandle);
111 }
112 STATS_UninitializeGDIPLUS();
113*/
114}
115
116ULONG SYSTEM DLL_Init(ULONG hModule)
117{
118 if (DLL_InitDefault(hModule) == -1)
119 return -1;
120 return DLL_InitGdiplus(hModule);
121}
122
123void SYSTEM DLL_Term(ULONG hModule)
124{
125 DLL_TermGdiplus(hModule);
126 DLL_TermDefault(hModule);
127}
Note: See TracBrowser for help on using the repository browser.