Changeset 4065 for branches/GRACE/src
- Timestamp:
- Aug 22, 2000, 12:59:40 AM (25 years ago)
- Location:
- branches/GRACE/src/win32k
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GRACE/src/win32k/dev16/probkrnl.c
r4052 r4065 1 /* $Id: probkrnl.c,v 1.20.4. 7 2000-08-20 08:08:43bird Exp $1 /* $Id: probkrnl.c,v 1.20.4.8 2000-08-21 22:59:34 bird Exp $ 2 2 * 3 3 * Description: Autoprobes the os2krnl file and os2krnl[*].sym files. … … 125 125 {FALSE, -1, 11, "ptda_module", -1, -1, -1, -1, EPT_VARIMPORT16}, /* 34 */ 126 126 {FALSE, -1, 18, "ptda_pBeginLIBPATH", -1, -1, -1, -1, EPT_VARIMPORT16}, /* 35 */ 127 {FALSE, -1, 16, "_ldrpFileNameBuf", -1, -1, -1, -1, EPT_VARIMPORT32}, /* 36 */ 127 128 128 129 }; … … 1666 1667 int i; 1667 1668 1668 printf16("/* $Id: probkrnl.c,v 1.20.4. 7 2000-08-20 08:08:43bird Exp $\n"1669 printf16("/* $Id: probkrnl.c,v 1.20.4.8 2000-08-21 22:59:34 bird Exp $\n" 1669 1670 "*\n" 1670 1671 "* Autogenerated kernel symbol database.\n" -
branches/GRACE/src/win32k/include/LdrCalls.h
r4052 r4065 1 /* $Id: LdrCalls.h,v 1.3.4. 4 2000-08-20 08:08:45bird Exp $1 /* $Id: LdrCalls.h,v 1.3.4.5 2000-08-21 22:59:38 bird Exp $ 2 2 * 3 3 * Prototypes for the loader overrided function. … … 213 213 extern PMTE LDRCALL ldrValidateMteHandle(HMTE hMTE); 214 214 215 extern PSZ *pldrpFileNameBuf; 216 #define ldrpFileNameBuf (*pldrpFileNameBuf) 215 217 216 218 -
branches/GRACE/src/win32k/include/ldr.h
r4046 r4065 1 /* $Id: ldr.h,v 1.5.4. 3 2000-08-19 14:37:07bird Exp $1 /* $Id: ldr.h,v 1.5.4.4 2000-08-21 22:59:38 bird Exp $ 2 2 * 3 3 * ldr - Our loader "subsystem" public header file. … … 28 28 29 29 30 /** @design 31 * Loader State. 30 /** @design Loader State. 32 31 * 33 32 * Used to determin behaviour in different cases. -
branches/GRACE/src/win32k/include/pe2lx.h
r4052 r4065 1 /* $Id: pe2lx.h,v 1.9.4. 2 2000-08-20 08:08:45bird Exp $1 /* $Id: pe2lx.h,v 1.9.4.3 2000-08-21 22:59:38 bird Exp $ 2 2 * 3 3 * Pe2Lx class declarations. Ring 0 and Ring 3 … … 76 76 BOOL isDll(); 77 77 static HMTE getKernel32SFN() { return sfnKernel32; } 78 static VOID setKernel32SFN(SFN sfn) { sfnKernel32 = sfn; } 78 static VOID setKernel32SFN(SFN sfn) { sfnKernel32 = sfn; } 79 static VOID invalidateOdin32Path(); 80 static LONG getLoadedModuleCount() { return cLoadedModules;} 79 81 80 82 /** @cat public Helper methods */ … … 128 130 static PCSZ queryOdin32ModuleName(PCSZ pszWin32ModuleName); 129 131 static BOOL initOdin32Path(); 132 static BOOL setOdin32Path(const char *psz); 130 133 131 134 /** @cat static dump methods */ … … 204 207 } paSecChars2Flags[]; 205 208 206 static const char * pszOdin32Path; /* Odin32 base path. */ 209 static LONG cLoadedModules; /* Count of existing objects. Updated by constructor and destructor. */ 210 static const char * pszOdin32Path; /* Odin32 base path (include a slash). */ 207 211 static SFN sfnKernel32; /* Odin32 Kernel32 filehandle. */ 208 212 }; -
branches/GRACE/src/win32k/include/probkrnl.h
r4052 r4065 1 /* $Id: probkrnl.h,v 1.13.4. 5 2000-08-20 08:08:45bird Exp $1 /* $Id: probkrnl.h,v 1.13.4.6 2000-08-21 22:59:39 bird Exp $ 2 2 * 3 3 * Include file for ProbKrnl. … … 16 16 * Defined Constants And Macros * 17 17 *******************************************************************************/ 18 #define NBR_OF_KRNLIMPORTS 3 6/* When this is changed make sure to */18 #define NBR_OF_KRNLIMPORTS 37 /* When this is changed make sure to */ 19 19 /* update the arrays in d32init.c and */ 20 20 /* probkrnl.c */ -
branches/GRACE/src/win32k/ldr/ldr.cpp
r3834 r4065 1 /* $Id: ldr.cpp,v 1.7.4. 1 2000-07-16 22:43:34bird Exp $1 /* $Id: ldr.cpp,v 1.7.4.2 2000-08-21 22:59:39 bird Exp $ 2 2 * 3 3 * ldr.cpp - Loader helpers. … … 238 238 } 239 239 240 /* 241 * Increment the object counters. 242 */ 243 switch (fFlags & MOD_TYPE_MASK) 244 { 245 case MOD_TYPE_PE2LX: Pe2Lx::cLoadedModules++; 246 #ifdef DEBUG 247 /*case MOD_TYPE_ELF2LX: Elf2Lx::cElf2Lx++;*/ 248 default: 249 kprintf(("addModule: fFlags don't have any MOD_TYPE_* (%x).\n", fFlags)); 250 #endif 251 } 252 240 253 return NO_ERROR; 241 254 } … … 277 290 case MOD_TYPE_PE2LX: 278 291 delete pMod->Data.pPe2Lx; 292 Pe2Lx::cLoadedModules--; 279 293 break; 280 294 /* 281 295 case MOD_TYPE_ELF2LX: 282 case MOD_TYPE_SCRIPT: 283 case MOD_TYPE_PE: 296 Elf2Lx::cLoadedModules--; 297 break; 298 */ 299 #ifdef DEBUG 284 300 default: 285 301 kprintf(("removeModule: Unknown type, %#x\n", pMod->fFlags & MOD_TYPE_MASK)); 302 #endif 286 303 } 287 304 -
branches/GRACE/src/win32k/pe2lx/pe2lx.cpp
r4052 r4065 1 /* $Id: pe2lx.cpp,v 1.18.4. 4 2000-08-20 08:08:47bird Exp $1 /* $Id: pe2lx.cpp,v 1.18.4.5 2000-08-21 22:59:40 bird Exp $ 2 2 * 3 3 * Pe2Lx class implementation. Ring 0 and Ring 3 … … 100 100 #include <versionos2.h> /* Pe2Lx version. */ 101 101 #include "yield.h" /* Yield CPU. */ 102 #include "options.h" /* Win32k options. */ 102 103 103 104 … … 205 206 LXHdr.e32_pagesize = PAGESIZE; 206 207 LXHdr.e32_objtab = sizeof(LXHdr); 208 cLoadedModules++; 207 209 } 208 210 … … 277 279 _res_heapmin(); 278 280 _swp_heapmin(); 281 282 /* 283 * If no Pe2Lx objects left, then invalidate the Odin32Path. 284 * We'll have to do this since we may (theoretically) not receive 285 * a close on a kernel32 handle if loading failes before kernel32 286 * is loaded and the odin32path is determined using ldrOpenPath. 287 * (Ie. no sfnKernel32.) 288 */ 289 if (--cLoadedModules <= 0) 290 invalidateOdin32Path(); 291 #ifdef DEBUG 292 if (cLoadedModules < 0) 293 printIPE(("Pe2Lx::cLoadedModules is %d which is less that zero!\n", cLoadedModules)); 294 #endif 279 295 } 280 296 … … 1729 1745 1730 1746 /** 1747 * Invalidates the odin32path. 1748 * Called by ldrClose when the kernel32 handle is closed. 1749 * @sketch Free path 1750 * nullify path pointer and kernel32 handle. 1751 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 1752 */ 1753 VOID Pe2Lx::invalidateOdin32Path() 1754 { 1755 if (pszOdin32Path != NULL) 1756 { 1757 rfree((void*)pszOdin32Path); 1758 pszOdin32Path = NULL; 1759 } 1760 sfnKernel32 = NULLHANDLE; 1761 } 1762 1763 1764 /** 1731 1765 * Gets the size of the virtual LX-file. 1732 1766 * @returns Size of the virtual LX-file in bytes. … … 4647 4681 4648 4682 4683 4684 /** 4685 * Initiates the odin32path. 4686 * @returns Success indicator. 4687 * @sketch 4688 * @status 4689 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 4690 * @remark 4691 */ 4649 4692 BOOL Pe2Lx::initOdin32Path() 4650 4693 { … … 4661 4704 pMTE = NULL; 4662 4705 rc = ldrFindModule("KERNEL32", 8, CLASS_GLOBAL, &pMTE); 4663 if (rc == NO_ERROR && pMTE != NULL) 4664 { 4665 char *psz = pMTE->mte_swapmte->smte_path; 4666 if (psz != NULL) 4667 { 4668 char * pszEnd = psz + strlen(psz) - 1; 4669 while (pszEnd > psz && *pszEnd != '\\' && *pszEnd != '/' && *pszEnd != ':') 4670 pszEnd--; 4671 pszEnd--; 4672 while (pszEnd > psz && *pszEnd != '\\' && *pszEnd != '/' && *pszEnd != ':') 4673 pszEnd--; 4674 if (pszEnd > psz) 4675 { 4676 char * pszPath = (char*)malloc(pszEnd - psz); 4677 memcpy(pszPath, psz, pszEnd - psz); 4678 pszPath[pszEnd - psz] = '\0'; 4679 4680 if (pszOdin32Path) 4681 free((void*)pszOdin32Path); 4682 pszOdin32Path = pszPath; 4683 sfnKernel32 = pMTE->mte_sfn; 4684 4685 return TRUE; 4686 } 4687 } 4688 } 4706 if (rc == NO_ERROR && pMTE != NULL && pMTE->mte_swapmte != NULL) 4707 { 4708 /* 4709 * We now take the smte_path. Start at the end and skip the filename, 4710 * and one directory up. We assume a fully qualified path is found in 4711 * smte_path. 4712 */ 4713 if (pMTE->mte_swapmte->smte_path != NULL)//paranoia 4714 { 4715 sfnKernel32 = pMTE->mte_sfn; 4716 return setOdin32Path(pMTE->mte_swapmte->smte_path); 4717 } 4718 } 4719 4720 4721 /* 4722 * KERNEL32 isn't loaded. We'll only search the paths if 4723 */ 4724 if (pszOdin32Path != NULL) 4725 return TRUE; 4726 4689 4727 4690 4728 /* 4691 4729 * Try find it searching the LIBPATHs. 4692 * (Don't thing we should use ldrOpenPath since it 4693 * end's up calling ldrOpen - which is overloaded.) 4730 * 4731 * For the time being: 4732 * We'll use ldrOpenPath to do this, but we'll have to 4733 * disable the win32k.sys overloading temporarily. 4694 4734 */ 4735 ldrlv_t lv = {0}; 4736 ULONG ful = 0; 4737 ULONG ul; 4738 4739 ul = options.fNoLoader; 4740 options.fNoLoader = TRUE; 4741 rc = ldrOpenPath("KERNEL32", 8, &lv, &ful); 4742 options.fNoLoader = ul; 4743 if (rc == NO_ERROR) 4744 { 4745 /* 4746 * Set the odin32path according to the kernel32 path we've found. 4747 * (ldrOpen sets ldrpFileNameBuf to the fully qualified path of 4748 * the last opended filed, which in this case is kernel32.dll.) 4749 * We'll close the file handle first of course. 4750 */ 4751 ldrClose(lv.lv_sfn); 4752 return setOdin32Path(ldrpFileNameBuf); 4753 } 4754 4755 return rc == NO_ERROR; 4756 } 4757 4758 4759 4760 /** 4761 * Sets the Odin32Path to the given fully qualified filename of kernel32. 4762 * @returns Success indicator. 4763 * @param psz Fully qualified filename of kernel32 with path. 4764 * @sketch 4765 * @status 4766 * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no) 4767 * @remark 4768 */ 4769 BOOL Pe2Lx::setOdin32Path(const char *psz) 4770 { 4771 const char * pszEnd; 4772 char * pszPath; 4773 4774 /* 4775 * We now take the psz. Start at the end and skip the filename, 4776 * and one directory up. We assume a fully qualified path. 4777 */ 4778 pszEnd = psz + strlen(psz) - 1; 4779 while (pszEnd > psz && *pszEnd != '\\' && *pszEnd != '/' && *pszEnd != ':') 4780 pszEnd--; 4781 pszEnd--; 4782 while (pszEnd > psz && *pszEnd != '\\' && *pszEnd != '/' && *pszEnd != ':') 4783 pszEnd--; 4784 if (pszEnd > psz) 4785 { 4786 /* 4787 * Free old path (if any) and allocate space for a new path. 4788 * Copy the path including the slash. 4789 * Remember the kernel32 filehandle (to be able to invalidate the path). 4790 */ 4791 if (pszOdin32Path) 4792 rfree((void*)pszOdin32Path); 4793 if (*pszEnd == ':') //in case someone installed odin in a root directory. 4794 pszEnd++; 4795 pszEnd++; //include the slash 4796 pszPath = (char*)rmalloc(pszEnd - psz); 4797 if (pszPath == NULL) return FALSE; 4798 memcpy(pszPath, psz, pszEnd - psz); 4799 pszPath[pszEnd - psz] = '\0'; 4800 pszOdin32Path = pszPath; 4801 4802 return TRUE; 4803 } 4695 4804 4696 4805 return FALSE; 4697 4806 } 4807 4808 4698 4809 4699 4810 -
branches/GRACE/src/win32k/win32k.vpj
r4052 r4065 1 1 [COMPILER] 2 2 MACRO=odin32_maketagfile();\n 3 FILTEREXPANSION=1 1 1 00 0 0 0 1 0 0 0 0 13 FILTEREXPANSION=1 1 1 1 0 0 0 0 1 0 0 0 0 1 4 4 compile=concur|capture|clear|:Compile:&Compile,nmake %n.obj 5 5 make=concur|capture|clear|:Build:&Build,nmake
Note:
See TracChangeset
for help on using the changeset viewer.