1 | /* $Id: d32Win32kOpenClose.c,v 1.1 2001-07-08 02:53:18 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_PTDA
|
---|
19 |
|
---|
20 | #define NO_WIN32K_LIB_FUNCTIONS
|
---|
21 |
|
---|
22 |
|
---|
23 | /*******************************************************************************
|
---|
24 | * Header Files *
|
---|
25 | *******************************************************************************/
|
---|
26 | #include <os2.h>
|
---|
27 |
|
---|
28 | #include "devSegDf.h"
|
---|
29 | #include "dev32hlp.h"
|
---|
30 | #include "dev1632.h"
|
---|
31 | #include "dev32.h"
|
---|
32 | #include "OS2Krnl.h"
|
---|
33 | #include "Win32k.h"
|
---|
34 | #include "log.h"
|
---|
35 | #include "asmutils.h"
|
---|
36 | #include "avl.h"
|
---|
37 | #include "PerTaskW32kData.h"
|
---|
38 |
|
---|
39 |
|
---|
40 | /*******************************************************************************
|
---|
41 | * Internal Functions *
|
---|
42 | *******************************************************************************/
|
---|
43 |
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Open handler.
|
---|
47 | * Make sure there is a task data structure.
|
---|
48 | * @returns Strategy return status.
|
---|
49 | * @param pRpOpen Pointer to request packet.
|
---|
50 | * @author knut st. osmundsen (kosmunds@csc.no)
|
---|
51 | */
|
---|
52 | USHORT _loadds _Far32 _Pascal Win32kOpen(PRP32OPENCLOSE pRpOpen)
|
---|
53 | {
|
---|
54 | PPTD pptd = GetTaskData(0);
|
---|
55 | if (pptd)
|
---|
56 | pptd->cUsage++;
|
---|
57 |
|
---|
58 | pRpOpen = pRpOpen;
|
---|
59 | return STATUS_DONE;
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Close handler.
|
---|
65 | * Cleanup task data structure.
|
---|
66 | * @returns Strategy return status.
|
---|
67 | * @param pRpOpen Pointer to request packet.
|
---|
68 | * @author knut st. osmundsen (kosmunds@csc.no)
|
---|
69 | */
|
---|
70 | USHORT _loadds _Far32 _Pascal Win32kClose(PRP32OPENCLOSE pRpClose)
|
---|
71 | {
|
---|
72 | PPTD pptd = GetTaskData(0);
|
---|
73 | if (pptd)
|
---|
74 | {
|
---|
75 | if (pptd->cUsage > 0)
|
---|
76 | {
|
---|
77 | APIRET rc;
|
---|
78 | if ( pptd->pszzOdin32Env != NULL
|
---|
79 | && (rc = D32Hlp_VMUnLock(&pptd->lockOdin32Env)) != NO_ERROR
|
---|
80 | )
|
---|
81 | {
|
---|
82 | kprintf(("Win32kClose: VMUnLock failed with rc=%d\n", rc));
|
---|
83 | }
|
---|
84 | pptd->cUsage--;
|
---|
85 | }
|
---|
86 | if (pptd->cUsage == 0)
|
---|
87 | RemoveTaskData(0);
|
---|
88 | }
|
---|
89 | pRpClose = pRpClose;
|
---|
90 | return STATUS_DONE;
|
---|
91 | }
|
---|
92 |
|
---|