1 | /* $Id: d32Win32kOpenClose.c,v 1.2 2001-07-10 16:39:16 bird Exp $
|
---|
2 | *
|
---|
3 | * Open and Close handlers for the Win32k driver.
|
---|
4 | *
|
---|
5 | * Copyright (c) 2001 knut st. osmundsen (kosmunds@csc.no)
|
---|
6 | *
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 |
|
---|
12 | /*******************************************************************************
|
---|
13 | * Defined Constants And Macros *
|
---|
14 | *******************************************************************************/
|
---|
15 | #define INCL_DOSERRORS
|
---|
16 | #define INCL_NOPMAPI
|
---|
17 | #define INCL_OS2KRNL_TK
|
---|
18 | #define INCL_OS2KRNL_SEM
|
---|
19 | #define INCL_OS2KRNL_LDR
|
---|
20 | #define INCL_OS2KRNL_PTDA
|
---|
21 |
|
---|
22 | #define NO_WIN32K_LIB_FUNCTIONS
|
---|
23 |
|
---|
24 |
|
---|
25 | /*******************************************************************************
|
---|
26 | * Header Files *
|
---|
27 | *******************************************************************************/
|
---|
28 | #include <os2.h>
|
---|
29 |
|
---|
30 | #include "devSegDf.h"
|
---|
31 | #include "dev32hlp.h"
|
---|
32 | #include "dev1632.h"
|
---|
33 | #include "dev32.h"
|
---|
34 | #include "OS2Krnl.h"
|
---|
35 | #include "Win32k.h"
|
---|
36 | #include "log.h"
|
---|
37 | #include "asmutils.h"
|
---|
38 | #include "avl.h"
|
---|
39 | #include "PerTaskW32kData.h"
|
---|
40 |
|
---|
41 |
|
---|
42 | /*******************************************************************************
|
---|
43 | * Internal Functions *
|
---|
44 | *******************************************************************************/
|
---|
45 |
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Open handler.
|
---|
49 | * Make sure there is a task data structure.
|
---|
50 | * @returns Strategy return status.
|
---|
51 | * @param pRpOpen Pointer to request packet.
|
---|
52 | * @author knut st. osmundsen (kosmunds@csc.no)
|
---|
53 | */
|
---|
54 | USHORT _loadds _Far32 _Pascal Win32kOpen(PRP32OPENCLOSE pRpOpen)
|
---|
55 | {
|
---|
56 | APIRET rc;
|
---|
57 | PPTD pptd;
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * Take Loader semaphore as that currently protects everything in this driver...
|
---|
61 | */
|
---|
62 | rc = LDRRequestSem();
|
---|
63 | if (rc != NO_ERROR)
|
---|
64 | {
|
---|
65 | kprintf(("Win32kOpen: LDRRequestSem failed with rc = %d\n", rc));
|
---|
66 | //return rc;
|
---|
67 | }
|
---|
68 |
|
---|
69 | pptd = GetTaskData(0, TRUE);
|
---|
70 | if (pptd)
|
---|
71 | pptd->cUsage++;
|
---|
72 |
|
---|
73 | pRpOpen = pRpOpen;
|
---|
74 | LDRClearSem();
|
---|
75 | return STATUS_DONE;
|
---|
76 | }
|
---|
77 |
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Close handler.
|
---|
81 | * Cleanup task data structure.
|
---|
82 | * @returns Strategy return status.
|
---|
83 | * @param pRpOpen Pointer to request packet.
|
---|
84 | * @author knut st. osmundsen (kosmunds@csc.no)
|
---|
85 | */
|
---|
86 | USHORT _loadds _Far32 _Pascal Win32kClose(PRP32OPENCLOSE pRpClose)
|
---|
87 | {
|
---|
88 | APIRET rc;
|
---|
89 | PPTD pptd;
|
---|
90 |
|
---|
91 | /*
|
---|
92 | * Take Loader semaphore as that currently protects everything in this driver...
|
---|
93 | */
|
---|
94 | rc = LDRRequestSem();
|
---|
95 | if (rc != NO_ERROR)
|
---|
96 | {
|
---|
97 | kprintf(("Win32kClose: LDRRequestSem failed with rc = %d\n", rc));
|
---|
98 | //return rc;
|
---|
99 | }
|
---|
100 |
|
---|
101 | pptd = GetTaskData(0, FALSE);
|
---|
102 | if (pptd)
|
---|
103 | {
|
---|
104 | if (pptd->cUsage > 0)
|
---|
105 | pptd->cUsage--;
|
---|
106 | if (pptd->cUsage == 0)
|
---|
107 | RemoveTaskData(0);
|
---|
108 | }
|
---|
109 | pRpClose = pRpClose;
|
---|
110 |
|
---|
111 | LDRClearSem();
|
---|
112 | return STATUS_DONE;
|
---|
113 | }
|
---|
114 |
|
---|