source: trunk/src/winspool/initterm.cpp@ 22012

Last change on this file since 22012 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/*
2 * WINSPOOL DLL entry point
3 *
4 * Copyright 1998 Sander van Leeuwen
5 * Copyright 1998 Peter Fitzsimmons
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 */
9
10#define INCL_DOSMODULEMGR
11#define INCL_DOSPROCESS
12#include <os2wrap.h> //Odin32 OS/2 api wrappers
13#include <stdlib.h>
14#include <stdio.h>
15#include <string.h>
16#include <odin.h>
17#include <win32type.h>
18#include <winconst.h>
19#include <odinlx.h>
20#include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
21#include <initdll.h>
22
23#include "oslibspl.h"
24
25// Win32 resource table (produced by wrc)
26extern DWORD winspool_PEResTab;
27
28static HMODULE dllHandle = 0;
29
30BOOL WINAPI LibMainWinSpool(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
31{
32 switch (fdwReason)
33 {
34 case DLL_PROCESS_ATTACH:
35 {
36 //Write default printer name to registry
37 ExportPrintersToRegistry();
38 return TRUE;
39 }
40
41 case DLL_THREAD_ATTACH:
42 case DLL_THREAD_DETACH:
43 case DLL_PROCESS_DETACH:
44 return TRUE;
45 }
46 return FALSE;
47}
48
49ULONG SYSTEM DLL_InitWinspool(ULONG hModule)
50{
51 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
52
53 dllHandle = RegisterLxDll(hModule, LibMainWinSpool, (PVOID)&winspool_PEResTab,
54 0, 0,
55 IMAGE_SUBSYSTEM_WINDOWS_GUI);
56 if (dllHandle == 0)
57 return -1;
58
59 return 0;
60}
61
62void SYSTEM DLL_TermWinspool(ULONG hModule)
63{
64 if (dllHandle)
65 UnregisterLxDll(dllHandle);
66}
67
68ULONG SYSTEM DLL_Init(ULONG hModule)
69{
70 if (DLL_InitDefault(hModule) == -1)
71 return -1;
72 return DLL_InitWinspool(hModule);
73}
74
75void SYSTEM DLL_Term(ULONG hModule)
76{
77 DLL_TermWinspool(hModule);
78 DLL_TermDefault(hModule);
79}
Note: See TracBrowser for help on using the repository browser.