- Timestamp:
- Jul 10, 2001, 6:41:10 PM (24 years ago)
- Location:
- trunk/src/win32k
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/dev32/d32Win32kOpenClose.c
r6215 r6296 1 /* $Id: d32Win32kOpenClose.c,v 1. 1 2001-07-08 02:53:18bird Exp $1 /* $Id: d32Win32kOpenClose.c,v 1.2 2001-07-10 16:39:16 bird Exp $ 2 2 * 3 3 * Open and Close handlers for the Win32k driver. … … 16 16 #define INCL_NOPMAPI 17 17 #define INCL_OS2KRNL_TK 18 #define INCL_OS2KRNL_SEM 19 #define INCL_OS2KRNL_LDR 18 20 #define INCL_OS2KRNL_PTDA 19 21 … … 52 54 USHORT _loadds _Far32 _Pascal Win32kOpen(PRP32OPENCLOSE pRpOpen) 53 55 { 54 PPTD pptd = GetTaskData(0); 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); 55 70 if (pptd) 56 71 pptd->cUsage++; 57 72 58 73 pRpOpen = pRpOpen; 74 LDRClearSem(); 59 75 return STATUS_DONE; 60 76 } … … 70 86 USHORT _loadds _Far32 _Pascal Win32kClose(PRP32OPENCLOSE pRpClose) 71 87 { 72 PPTD pptd = GetTaskData(0); 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); 73 102 if (pptd) 74 103 { 75 104 if (pptd->cUsage > 0) 76 {77 APIRET rc;78 if ( pptd->pszzOdin32Env != NULL79 && (rc = D32Hlp_VMUnLock(&pptd->lockOdin32Env)) != NO_ERROR80 )81 {82 kprintf(("Win32kClose: VMUnLock failed with rc=%d\n", rc));83 }84 105 pptd->cUsage--; 85 }86 106 if (pptd->cUsage == 0) 87 107 RemoveTaskData(0); 88 108 } 89 109 pRpClose = pRpClose; 110 111 LDRClearSem(); 90 112 return STATUS_DONE; 91 113 } -
trunk/src/win32k/include/PerTaskW32kData.h
r6221 r6296 1 /* $Id: PerTaskW32kData.h,v 1. 1 2001-07-08 02:58:36bird Exp $1 /* $Id: PerTaskW32kData.h,v 1.2 2001-07-10 16:41:10 bird Exp $ 2 2 * 3 3 * Per Task (Win32k) Data. … … 20 20 AVLNODECORE core; 21 21 ULONG cUsage; /* Usage counter. */ 22 P ID pid;/* Also in core.Key */22 PPTDA pPTDA; /* Also in core.Key */ 23 23 PSZ pszzOdin32Env; /* Pointer to environment block. */ 24 24 LOCKHANDLE lockOdin32Env; /* VMLock handle for the environment block. */ … … 26 26 27 27 28 PPTD _Optlink GetTaskData(P ID pid);29 void _Optlink RemoveTaskData(P ID pid);28 PPTD _Optlink GetTaskData(PPTDA pPTDA, BOOL fCreate); 29 void _Optlink RemoveTaskData(PPTDA pPTDA); 30 30 31 31 #endif -
trunk/src/win32k/k32/k32SetEnvironment.cpp
r6214 r6296 1 /* $Id: k32SetEnvironment.cpp,v 1. 1 2001-07-08 02:52:11bird Exp $1 /* $Id: k32SetEnvironment.cpp,v 1.2 2001-07-10 16:39:17 bird Exp $ 2 2 * 3 3 * k32SetEnvironment - Sets the Odin32 environment for a process. … … 15 15 #define INCL_DOSERRORS 16 16 #define INCL_OS2KRNL_TK 17 #define INCL_OS2KRNL_PTDA 17 18 #define INCL_OS2KRNL_SEM 18 19 #define INCL_OS2KRNL_LDR … … 24 25 *******************************************************************************/ 25 26 #include <os2.h> 27 #include <memory.h> 26 28 #include "devSegDf.h" /* Win32k segment definitions. */ 27 29 #include "OS2Krnl.h" … … 56 58 PPTD pptd; 57 59 58 59 60 /* 60 61 * Validate pid a little bit... … … 63 64 { 64 65 kprintf(("k32SetEnvironment: invalid pid=%x\n", pid)); 66 return ERROR_INVALID_PARAMETER; 67 } 68 69 if (pid != 0) 70 { 71 kprintf(("k32SetEnvironment: currently only supported for current pid. pid=%x\n", pid)); 65 72 return ERROR_INVALID_PARAMETER; 66 73 } … … 81 88 * Get Per Task Data and try set next environment pointer. 82 89 */ 83 pptd = GetTaskData(p id);90 pptd = GetTaskData(ptdaGetCur(), TRUE); 84 91 if (pptd) 85 92 { 86 if (pptd->cUsage != 0 && pptd->pszzOdin32Env) 93 if (*(PULONG)&pptd->lockOdin32Env) 94 { 87 95 D32Hlp_VMUnLock(&pptd->lockOdin32Env); 96 memset(&pptd->lockOdin32Env, 0, sizeof(pptd->lockOdin32Env)); 97 } 88 98 pptd->pszzOdin32Env = NULL; 89 99 if (pptd->cUsage != 0 && pszzEnvironment != NULL && cchEnvironment != 0) 90 100 { 91 /*92 * Currently we're limited to the current process.93 */94 if (pid != 0 || GetTaskData(0) != pptd)95 {96 kprintf(("k32SetEnvironment: not current process (pid=%d)\n", pid));97 LDRClearSem();98 return ERROR_INVALID_PARAMETER;99 }100 101 102 101 /* 103 102 * Lock the memory (so we don't block or trap during environment searchs). … … 110 109 { 111 110 kprintf(("k32SetEnvironment: VMLock2 failed with rc=%d\n", rc)); 111 memset(&pptd->lockOdin32Env, 0, sizeof(pptd->lockOdin32Env)); 112 112 } 113 113 } -
trunk/src/win32k/misc/PerTaskW32kData.c
r6230 r6296 1 /* $Id: PerTaskW32kData.c,v 1. 1 2001-07-08 03:09:03bird Exp $1 /* $Id: PerTaskW32kData.c,v 1.2 2001-07-10 16:39:19 bird Exp $ 2 2 * 3 3 * Per Task (Win32k) Data. … … 17 17 #define INCL_OS2KRNL_VM /* OS2KRNL: Virtual Memory Management */ 18 18 #define INCL_OS2KRNL_TK /* OS2KRNL: Task Stuff */ 19 #define INCL_OS2KRNL_PTDA 19 20 20 21 /******************************************************************************* … … 52 53 * If it doesn't exist we'll allocate a new one. 53 54 * @returns Pointer to task data structure. 54 * @param pid Process id. 0 means current pid. 55 * Might be NULL (see fCreate). 56 * @param pPTDA Pointer to PTDA for the task. 57 * @param fCreate TRUE: Create structure if not found. 58 * FALSE: Return NULL if not found. 55 59 * @status completely implemented. 56 60 * @author knut st. osmundsen (kosmunds@csc.no) 57 * @remark Do we need a Get function which doesn't make a node if no data was found?58 61 */ 59 PPTD GetTaskData(P ID pid)62 PPTD GetTaskData(PPTDA pPTDA, BOOL fCreate) 60 63 { 61 64 PPTD pptd; 62 if (p id== 0)63 p id = InternalGetPid();64 pptd = (PPTD)(void*)AVLGet(&pPTDTree, pid);65 if (!pptd )65 if (pPTDA == 0) 66 pPTDA = ptdaGetCur(); 67 pptd = (PPTD)(void*)AVLGet(&pPTDTree, (AVLKEY)pPTDA); 68 if (!pptd && fCreate) 66 69 { 67 70 pptd = rmalloc(sizeof(*pptd)); … … 72 75 } 73 76 memset(pptd, 0, sizeof(*pptd)); 74 pptd->core.Key = pid;77 pptd->core.Key = (AVLKEY)pPTDA; 75 78 AVLInsert(&pPTDTree, &pptd->core); 76 79 } … … 81 84 /** 82 85 * Remove the give process id. 83 * @param p id Process id to remove. 0 means current pid.86 * @param pPTDA Pointer to PTDA for the task. 84 87 * @status completely implemented. 85 88 * @author knut st. osmundsen (kosmunds@csc.no) 86 89 */ 87 void RemoveTaskData(P ID pid)90 void RemoveTaskData(PPTDA pPTDA) 88 91 { 89 92 PPTD pptd; 90 if (p id== 0)91 p id = InternalGetPid();92 pptd = (PPTD)(void*)AVLRemove(&pPTDTree, pid);93 if (pPTDA == 0) 94 pPTDA = ptdaGetCur(); 95 pptd = (PPTD)(void*)AVLRemove(&pPTDTree, (AVLKEY)pPTDA); 93 96 if (pptd) 94 97 { 95 98 /* perhaps free data here... */ 99 if (*(PULONG)(void*)&pptd->lockOdin32Env) 100 { 101 D32Hlp_VMUnLock(&pptd->lockOdin32Env); 102 memset(&pptd->lockOdin32Env, 0, sizeof(pptd->lockOdin32Env)); 103 } 104 pptd->pszzOdin32Env = NULL; 96 105 rfree(pptd); 97 106 } -
trunk/src/win32k/pe2lx/pe2lx.cpp
r6267 r6296 1 /* $Id: pe2lx.cpp,v 1.3 0 2001-07-09 12:56:53bird Exp $1 /* $Id: pe2lx.cpp,v 1.31 2001-07-10 16:39:18 bird Exp $ 2 2 * 3 3 * Pe2Lx class implementation. Ring 0 and Ring 3 … … 1766 1766 case FINDDLL_PATH: 1767 1767 { 1768 PPTD pptd = GetTaskData( 0);1768 PPTD pptd = GetTaskData(NULL, FALSE); 1769 1769 pszPath = NULL; 1770 1770 if (pptd)
Note:
See TracChangeset
for help on using the changeset viewer.