- Timestamp:
- Oct 27, 1999, 4:03:01 AM (26 years ago)
- Location:
- trunk/src/win32k
- Files:
-
- 3 added
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/Makefile
r1332 r1467 1 1 ################################################################################ 2 # $Id: Makefile,v 1. 9 1999-10-17 02:12:19bird Exp $2 # $Id: Makefile,v 1.10 1999-10-27 02:02:52 bird Exp $ 3 3 # 4 4 # Copyright 1998-1999 knut st. osmundsen … … 155 155 object\asmutils.obj \ 156 156 object\calltab.obj \ 157 object\cout.obj \158 object\log.obj \159 157 object\malloc.obj \ 160 158 object\new.obj \ … … 163 161 object\vsprintf.obj \ 164 162 object\vprintf.obj \ 163 object\avl.obj \ 165 164 object\ldr.obj \ 166 165 object\myldrClose.obj \ … … 169 168 object\myLDRQAppType.obj \ 170 169 object\pe2lx.obj 171 # 172 # object\lxSuper.obj \ 173 # object\lxFile.obj \ 174 # object\accelerator.obj \ 175 # object\bitmap.obj \ 176 # object\cursor.obj \ 177 # object\cursorgrp.obj \ 178 # object\dialog.obj \ 179 # object\icon.obj \ 180 # object\icongrp.obj \ 181 # object\menu.obj \ 182 # object\misc.obj \ 183 # object\pefile.obj \ 184 # object\rcdata.obj \ 185 # object\strings.obj \ 186 170 171 # not used 172 # object\cout.obj 187 173 188 174 OBJSINIT = \ … … 226 212 @mapsym $*.map > nul 227 213 $(CP) $@ $(PDWIN32_BIN) 214 copy win32k.sym c:\temp 215 copy win32k.sys c:\temp 228 216 229 217 -
trunk/src/win32k/dev16/d16init.c
r847 r1467 1 /* $Id: d16init.c,v 1. 1 1999-09-06 02:19:55bird Exp $1 /* $Id: d16init.c,v 1.2 1999-10-27 02:02:53 bird Exp $ 2 2 * 3 3 * d16init - init routines for both drivers. … … 33 33 #include <memory.h> 34 34 35 #include "probkrnl.h" 35 36 #include "dev1632.h" 36 37 #include "dev16.h" 37 38 38 39 39 /** … … 61 61 /** 62 62 * init function - device 1. 63 * We will send an IOCtl request to the win32i$ (device 0) which will63 * We will send an IOCtl request to the elf$ (device 0) which will 64 64 * perform the Ring-0 initiation of the driver. 65 65 * @returns Status word. … … 77 77 NPSZ npszErrMsg = NULL; 78 78 79 rc = DosOpen("\\dev\\win32i$", &hDev0, &usAction, 0UL, FILE_NORMAL, 80 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 81 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 82 0UL); 79 rc = ProbeKernel(pRpIn); 83 80 if (rc == NO_ERROR) 84 81 { 85 param.pRpInitIn = pRpIn; 86 rc = DosDevIOCtl(&data, ¶m, D16_IOCTL_RING0INIT, D16_IOCTL_CAT, hDev0); 87 /* _asm int 3; */ 82 rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL, 83 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 84 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 85 0UL); 88 86 if (rc == NO_ERROR) 89 87 { 90 if (data.Status != STATUS_DONE) 91 npszErrMsg = "Ring-0 initiation failed\n\r"; 88 param.pRpInitIn = pRpIn; 89 rc = DosDevIOCtl(&data, ¶m, D16_IOCTL_RING0INIT, D16_IOCTL_CAT, hDev0); 90 if (rc == NO_ERROR) 91 { 92 if (data.Status != STATUS_DONE) 93 npszErrMsg = "Ring-0 initiation failed\n\r"; 94 else 95 { 96 register NPSZ npsz = "Win32k.sys succesfully initiated!\n\r"; 97 DosPutMessage(1, strlen(npsz)+1, npsz); 98 pRpOut->Status = data.Status; 99 } 100 } 92 101 else 93 { 94 register NPSZ npsz = "Test.sys succesfully initiated!\n\r"; 95 DosPutMessage(1, strlen(npsz)+1, npsz); 96 pRpOut->Status = data.Status; 97 } 102 npszErrMsg = "DosDevIOCtl failed.\n\r"; 103 DosClose(hDev0); 98 104 } 99 105 else 100 npszErrMsg = "DosDevIOCtl failed\n\r"; 101 DosClose(hDev0); 106 npszErrMsg = "DosOpen failed.\n\r"; 102 107 } 103 108 else 104 npszErrMsg = "DosOpen failed\n\r"; 105 109 npszErrMsg = "ProbeKernel failed.\n\r"; 106 110 pRpOut->BPBArray = NULL; 107 111 pRpOut->CodeEnd = (USHORT)&CODE16END; … … 144 148 145 149 pDT2 = (PDOSTABLE2)((char FAR *)pDT + pDT->cul*4 + 1); 146 TKSSBase16 = pDT2->TKSSBase;150 TKSSBase16 = (ULONG)pDT2->pTKSSBase; 147 151 R0FlatCS16 = (USHORT)pDT2->R0FlatCS; 148 152 R0FlatDS16 = (USHORT)pDT2->R0FlatDS; … … 169 173 ) 170 174 { 171 /*_asm int 3;*/172 175 usRc = CallR0Init32(SSToDS_16(&rp32init)); 173 /*_asm int 3;*/174 176 } 175 177 else 176 178 usRc |= ERROR_I24_INVALID_PARAMETER; 177 179 178 ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc;180 ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc; 179 181 180 182 /* finished - unlock data and parm */ -
trunk/src/win32k/dev16/d16strat.c
r847 r1467 1 /* $Id: d16strat.c,v 1. 1 1999-09-06 02:19:55bird Exp $1 /* $Id: d16strat.c,v 1.2 1999-10-27 02:02:53 bird Exp $ 2 2 * 3 3 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr) … … 36 36 { 37 37 { 38 (unsigned long)(void _far *)(&aDevHdrs[1]), 38 (unsigned long)(void _far *)(&aDevHdrs[1]), /* NextHeader */ 39 39 DEVLEV_3 | DEV_30 | DEV_CHAR_DEV, /* SDevAtt */ 40 40 (unsigned short)(void _near *)strategyAsm0, /* StrategyEP */ 41 41 0, /* InterruptEP */ 42 " win32i$ ", /* Later: elf ?*//* DevName */42 "elf$ ", /* DevName */ 43 43 0, /* SDevProtCS */ 44 44 0, /* SDevProtDS */ … … 67 67 USHORT R0FlatCS16 = 0; 68 68 USHORT R0FlatDS16 = 0; 69 BOOL fInitTime = TRUE; 69 70 70 71 … … 79 80 * Strategy routine. 80 81 * @returns Status word. 81 * @param pRpH Pointer to request packed header. 82 * @param pRpH Pointer to request packed header. (Do not change the pointer!) 82 83 * @parma usDev Device number. 83 84 * @remark This function is called from the entrypoint in dev1st.asm … … 85 86 USHORT NEAR strategy(PRPH pRpH, unsigned short usDev) 86 87 { 88 87 89 switch (pRpH->Cmd) 88 90 { 89 91 case CMDInit: /* INIT command */ 90 if (usDev == 0) 91 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 92 else 93 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 92 if (fInitTime) 93 { 94 if (usDev == 0) 95 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 96 else 97 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH); 98 } 99 break; 94 100 95 101 case CMDGenIOCTL: /* Generic IOCTL */ … … 104 110 case CMDShutdown: 105 111 return STATUS_DONE; 112 } 106 113 107 default: 108 return STATUS_DONE | STATUS_ERR_UNKCMD; 109 } 114 return STATUS_DONE | STATUS_ERR_UNKCMD; 110 115 } 111 116 … … 121 126 USHORT dev0GenIOCtl(PRP_GENIOCTL pRp) 122 127 { 123 /* _asm int 3;*/ 124 if (pRp->Category == D16_IOCTL_CAT && pRp->Function == D16_IOCTL_RING0INIT) 125 return R0Init16(pRp); 128 USHORT rc; 129 if (pRp->Category == D16_IOCTL_CAT) 130 { 131 switch (pRp->Function) 132 { 133 case D16_IOCTL_RING0INIT: 134 if (fInitTime) 135 { 136 rc = R0Init16(pRp); 137 fInitTime = FALSE; 138 return rc; 139 } 140 break; 141 142 case D16_IOCTL_GETKRNLOTES: 143 { 144 ULONG ulLin; 145 if (DevHelp_VirtToLin(SELECTOROF(pRp->DataPacket), OFFSETOF(pRp->DataPacket), &ulLin) != NO_ERROR) 146 return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER; 147 return CallGetOTEs32(ulLin); 148 } 149 150 case D16_IOCTL_VERIFYPROCTAB: 151 if (fInitTime) 152 return CallVerifyProcTab32(); 153 break; 154 } 155 } 126 156 127 157 return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER; -
trunk/src/win32k/dev16/probkrnl.c
r847 r1467 1 /* $Id: probkrnl.c,v 1. 1 1999-09-06 02:19:55bird Exp $1 /* $Id: probkrnl.c,v 1.2 1999-10-27 02:02:53 bird Exp $ 2 2 * 3 3 * Description: Autoprobes the os2krnl file and os2krnl[*].sym files. … … 13 13 * How this works: 14 14 * 1. parses the device-line parameters and collects some "SysInfo". 15 * 2. gets the kernel object table. ( win32i$)15 * 2. gets the kernel object table. (elf$) 16 16 * 3. finds the kernel image and scans it for a build number. 17 17 * 4. locates and scans the symbol-file(s) for the entrypoints which are wanted. 18 * 5. the entry points are verified. ( win32i$)18 * 5. the entry points are verified. (elf$) 19 19 * 6. finished. 20 20 * … … 29 29 #ifdef DEBUGR3 30 30 #if 1 31 int printf(const char *, ...); 31 32 #define dprintf(a) printf a 32 33 #else … … 35 36 #else 36 37 #define dprintf(a) 38 #define static 37 39 #endif 38 40 … … 125 127 static char szMsg1[] = "\n\r\tFound kernel: "; 126 128 static char szMsg1a[] = "\n\r\tBuild: "; 127 static char szMsg2[] = "\n\r\ n\r\tFound symbolfile: ";129 static char szMsg2[] = "\n\r\tFound symbolfile: "; 128 130 static char szMsg4[] = "\n\r\tFailed to find symbolfile!\n\r"; 129 131 static char szMsgfailed[]= "failed!"; … … 311 313 312 314 /** 313 * kstrlen - String length 314 * @returns length of string 315 * @param p Pointer to string 316 */ 317 static int kstrlen(const char * p) 318 { 319 int len = 0; 320 while ( p[len++] != '\0'); 321 return len-1; 315 * kstrlen - String length. 316 * @returns Length of the string. 317 * @param psz Pointer to string. 318 * @status completely implemented and tested. 319 * @author knut st. osmundsen 320 */ 321 static int kstrlen(const char * psz) 322 { 323 int cch = 0; 324 while (psz[cch] != '\0') 325 cch++; 326 return cch; 322 327 } 323 328 … … 381 386 USHORT usAction = 0; 382 387 383 rc = DosOpen("\\dev\\ win32i$", &hDev0, &usAction, 0UL, FILE_NORMAL,388 rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL, 384 389 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 385 390 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, … … 430 435 /* read header and display it */ 431 436 rc = fread(&MapDef, sizeof(MAPDEF), 1, SymFile); 432 if ( rc)437 if (rc) 433 438 { 434 439 Buffer[0] = MapDef.achModName[0]; … … 591 596 } 592 597 593 /* Worker function for ReadOS2Krnl */ 598 /** 599 * Worker function for ReadOS2Krnl 600 * @returns 0 on success. 601 * errorcodes on failure. (-1 >= rc >= -14) 602 * @param 603 * @equiv 604 * @time 605 * @sketch 606 * @status 607 * @author knut st. osmundsen 608 * @remark 609 */ 594 610 static int ReadOS2Krnl2(HFILE krnl, unsigned long cbKrnl) 595 611 { … … 722 738 if (pObj->o32_size < KrnlOTEs.aObjects[i].ote_size) 723 739 return -12; 740 741 #if 0 /* don't work! */ 724 742 if ((pObj->o32_flags & 0xffffUL) != (KrnlOTEs.aObjects[i].ote_flags & 0xffffUL)) 725 743 return -14; 744 #endif 726 745 } 727 746 } … … 764 783 USHORT usAction = 0; 765 784 766 rc = DosOpen("\\dev\\ win32i$", &hDev0, &usAction, 0UL, FILE_NORMAL,785 rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL, 767 786 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 768 787 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, … … 779 798 return rc; 780 799 #else 800 KrnlOTEs.cObjects = 23; 781 801 return 0; 782 802 #endif … … 857 877 858 878 /* functions */ 859 if (rc > -50)879 if (rc == 0) 860 880 { 861 881 puts(szMsg2); -
trunk/src/win32k/dev32/d32globals.c
r847 r1467 1 /* $Id: d32globals.c,v 1. 1 1999-09-06 02:19:56bird Exp $1 /* $Id: d32globals.c,v 1.2 1999-10-27 02:02:53 bird Exp $ 2 2 * 3 3 * d32globals - global data (32-bit) … … 21 21 * Global Variables * 22 22 *******************************************************************************/ 23 ULONGTKSSBase32;23 PULONG pulTKSSBase32; 24 24 struct options options; 25 25 -
trunk/src/win32k/dev32/d32hlp.asm
r847 r1467 1 ; $Id: d32hlp.asm,v 1. 1 1999-09-06 02:19:56bird Exp $1 ; $Id: d32hlp.asm,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 2 ; 3 3 ; d32hlp - 32-bit Device Driver Helper Function. 4 4 ; 5 5 ; Copyright (c) 1999 knut st. osmundsen 6 ; 7 ; Project Odin Software License can be found in LICENSE.TXT 6 8 ; 7 9 .386p -
trunk/src/win32k/dev32/d32init.c
r847 r1467 1 /* $Id: d32init.c,v 1. 1 1999-09-06 02:19:56bird Exp $1 /* $Id: d32init.c,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. … … 12 12 #define MAXSIZE_PROLOG 0x10 /* Note that this must be synced with */ 13 13 /* the one used in calltab.asm. */ 14 #define static 14 15 15 16 #define INCL_DOSERRORS … … 31 32 #include "log.h" 32 33 #include "asmutils.h" 33 #include "cout.h"34 34 #include "malloc.h" 35 35 #include "ldr.h" … … 58 58 * @returns Status word. 59 59 * @param pRpInit Pointer init request packet. 60 * @sketch Set TKSSBase32. 61 * Set default parameters. 62 * Parse command line options. 63 * Show (kprint) configuration. 64 * Init heap. 65 * Init ldr. 66 * Init procs. (overloaded ldr procedures) 67 * @status completely implemented. 68 * @author knut st. osmundsen 60 69 */ 61 70 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit) … … 64 73 char *pszTmp; 65 74 66 TKSSBase32 =_TKSSBase16;75 pulTKSSBase32 = (PULONG)_TKSSBase16; 67 76 68 77 SET_OPTIONS_TO_DEFAULT(options); … … 80 89 switch (*pszTmp) 81 90 { 82 case 'C': /* -C[1|2] - com-port no */91 case 'C': /* -C[1|2] - com-port no, def:-C2 */ 83 92 switch (pszTmp[1]) 84 93 { … … 86 95 options.usCom = OUTPUT_COM1; 87 96 break; 97 88 98 case '2': 99 default: 89 100 options.usCom = OUTPUT_COM2; 90 break;91 101 } 92 102 break; 93 103 94 case 'L': /* -L:[Y|N or ]*/104 case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */ 95 105 pszTmp2 = strpbrk(pszTmp, ":=/- "); 96 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 && (*pszTmp2 == '=' || *pszTmp2 == ':' || *pszTmp2 == ' ' && (pszTmp2[1] != '-' || pszTmp2[1] != '/'))) 97 { 98 switch (pszTmp2[1]) 99 { 100 case 'D': /*disable*/ 101 options.fLogging = FALSE; 102 break; 103 case 'E': /*enable*/ 104 options.fLogging = TRUE; 105 break; 106 case 'Y': /*yes*/ 107 options.fLogging = TRUE; 108 break; 109 case 'N': /*no*/ 110 options.fLogging = FALSE; 111 break; 112 } 113 } 106 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 107 && (pszTmp2[1] == 'N' ||pszTmp2[1] == 'n' || pszTmp2[1] == 'D' || pszTmp2[1] == 'd') 108 ) 109 options.fLogging = FALSE; 114 110 else 115 111 options.fLogging = TRUE; … … 126 122 127 123 case 'V': /* verbose initialization */ 128 options.fQuiet = TRUE;124 options.fQuiet = FALSE; 129 125 break; 130 126 … … 164 160 * init sub-parts 165 161 */ 166 167 162 /* heap */ 168 163 if (heapInit(HEAP_SIZE) != NO_ERROR) 169 164 return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 170 171 /* cout init */172 coutInit(options.usCom);173 165 174 166 /* loader */ … … 201 193 { 202 194 kprintf(("VerifyProcTab32: procedure no.%d was not found!\n", i)); 203 return 1; 204 } 205 206 /* verify read/writeable. - NOT IMPLEMENTED (yet) */ 195 return STATUS_DONE | STERR | 1; 196 } 197 198 /* verify read/writeable. - FIXME */ 199 if (_aProcTab[i].ulAddress < 0xffe00000UL) 200 { 201 kprintf(("VerifyProcTab32: procedure no.%d has an invlalid address, %#08x!\n", 202 i, _aProcTab[i].ulAddress)); 203 return STATUS_DONE | STERR | 2; 204 } 207 205 208 206 /* verify known function prolog. (only EPT_PROC) */ … … 212 210 { 213 211 kprintf(("VerifyProcTab32: verify failed for procedure no.%d\n",i)); 214 return 2;212 return STATUS_DONE | STERR | 3; 215 213 } 216 214 } … … 218 216 { 219 217 kprintf(("VerifyProcTab32: only EPT_PROC is implemented\n",i)); 220 return 3;221 } 222 } 223 224 return 0;218 return STATUS_DONE | STERR | 4; 219 } 220 } 221 222 return STATUS_DONE; 225 223 } 226 224 … … 228 226 /** 229 227 * Get kernel OTEs 230 * @returns 0 if ok. !0 on failiure. 228 * @returns Strategy return code: 229 * STATUS_DONE on success. 230 * STATUS_DONE | STERR | errorcode on failure. 231 231 * @param pOTEBuf Pointer to output buffer. 232 * @status completely implemented and tested. 233 * @author knut st. osmundsen 232 234 * @remark Called from IOCtl. 233 235 */ … … 271 273 kprintf(("GetOTEs32: failed. usRc = %d\n", usRc)); 272 274 273 return usRc ;275 return usRc | (usRc != 0 ? STATUS_DONE | STERR : STATUS_DONE); 274 276 } 275 277 … … 292 294 * push ebp 293 295 * mov ebp,esp 296 * or 297 * push ebp 298 * mov ecx, dword ptr [123407452] 294 299 */ 295 300 296 if (p[0] == 0x55 && p[1] == 0x8b && p[2] == 0xec) 297 { 298 rc = 3; 301 if (p[0] == 0x55 && p[1] == 0x8b) 302 { 303 if (p[2] == 0xec) 304 rc = 3; 305 else 306 rc = 1; 299 307 while (rc < 5) 300 308 { … … 308 316 case 0x33: /* xor (ldrClose, ldrOpen) */ 309 317 rc +=2; 318 break; 319 case 0x8b: 320 if (p[rc+1] == 0x0d) 321 rc += 6; 322 else 323 rc += 2; /*????!*/ 310 324 break; 311 325 case 0x8d: /* lea (ldrRead) */ … … 341 355 for (i = 0; i < NUMBER_OF_PROCS; i++) 342 356 { 343 if ((cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress)) <= 0 && cb + 5 >= MAXSIZE_PROLOG) 344 { 345 kprintf(("rehookFunctions: verify failed for procedure no.%d\n", i)); 357 cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress); 358 if (cb <= 0 || cb + 5 >= MAXSIZE_PROLOG) 359 { 360 kprintf(("rehookFunctions: verify failed for procedure no.%d, cb=%d\n", i, cb)); 346 361 return 1; 347 362 } … … 369 384 370 385 /* copy function prolog */ 371 memcpy(callTab[i], ( char*)_aProcTab[i].ulAddress,cb);386 memcpy(callTab[i], (void*)_aProcTab[i].ulAddress, (size_t)cb); 372 387 373 388 /* jump from calltab to original function */ … … 386 401 return 1; 387 402 } 388 i++;389 403 } 390 404 -
trunk/src/win32k/dev32/devfirst.asm
r847 r1467 1 ; $Id: devfirst.asm,v 1. 1 1999-09-06 02:19:56bird Exp $1 ; $Id: devfirst.asm,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 2 ; 3 3 ; DevFirst - entrypoint and segment definitions … … 5 5 ; Copyright (c) 1999 knut st. osmundsen 6 6 ; 7 ; Project Odin Software License can be found in LICENSE.TXT 7 8 ; 8 9 .386p … … 12 13 ; 13 14 include devsegdf.inc 15 include sas.inc 14 16 15 17 ; … … 29 31 public _strategyAsm0 30 32 public _strategyAsm1 33 public _CallGetOTEs32 31 34 public _SSToDS_16a 35 public GetOS2KrnlMTE 32 36 33 37 … … 35 39 ; Externs 36 40 ; 41 extrn _TKSSBase16:dword 42 extrn GETOTES32:FAR 43 .286p 37 44 extrn _strategy:near 38 extrn CODE16END:byte39 extrn DATA16END:byte40 extrn _TKSSBase16:dword41 45 42 46 … … 46 50 CODE16START label byte 47 51 52 .286p 48 53 ;$win32ki entry point 49 54 _strategyAsm0: … … 56 61 jmp _strategyAsm 57 62 63 ;; 64 ; Stub which pushes parameters onto the stack and call the 16-bit C strategy routine. 65 ; @returns returns the return value of strategy(...) 66 ; @author knut st. osmundsen 58 67 _strategyAsm proc far 59 68 push es … … 66 75 mov word ptr es:[bx+3], ax 67 76 add sp, 2 68 ; int 369 77 retf 70 78 _strategyAsm endp 71 79 72 80 73 ;extern LIN SSToDS_16a(void NEAR *pStackVar); 81 .386p 82 ;; 83 ; Thunk procedure for R0Init32. 84 ; @cproto USHORT NEAR CallGetOTEs32(ULONG addressOTEBuf); 85 ; @returns Same as GetOTEs32. 86 ; @param addressOTEBuf 32-bit pointer to request data. 87 ; @status completely implemented. 88 ; @author knut st. osmundsen 89 _CallGetOTEs32 PROC NEAR 90 ASSUME CS:CODE16 91 push ds 92 push word ptr [esp+6] ; push high word. 93 push word ptr [esp+6] ; push low word. 94 call far ptr FLAT:GETOTES32 95 pop ds 96 retn 97 _CallGetOTEs32 ENDP 98 99 100 ;; 101 ; SSToDS - stack pointer to Flat pointer. 102 ; @cproto extern LIN SSToDS_16a(void NEAR *pStackVar); 103 ; @returns ax:dx makes up a 32-bit flat pointer to stack. 104 ; @param pStackVar Stack pointer which is to be made a flat pointer. 105 ; @equiv SSToDS in 32-bit code. 106 ; @sketch Get Flat CS 107 ; Get TKSSBase address. (FLAT) 108 ; return *TKSSBase + pStackVar. 109 ; @status completely implemented. 110 ; @author knut st. osmundsen 111 ; @remark es is cs, not ds! 74 112 _SSToDS_16a proc near 75 113 assume CS:CODE16, DS:DATA16, ES:NOTHING 114 mov edx, ds:_TKSSBase16 ; get pointer held by _TKSSBase16 (pointer to stack base) 115 call far ptr FLAT:far_getCS ; get flat selector. 76 116 push es 77 jmp far ptr FLAT:_SSToDS_16a_GetFLAT_32 78 _SSToDS_16a_GetFLAT_16:: 79 mov edx, ds:_TKSSBase16 80 movzx eax, word ptr ss:[esp + 4] 81 add eax, es:[edx] 117 mov es, ax 118 assume es:FLAT 119 mov eax, es:[edx] ; get pointer to stack base 120 pop es 121 movzx edx, word ptr ss:[esp + 2] ; 16-bit stack pointer (parameter) 122 add eax, edx ; 32-bit stack pointer in eax 82 123 mov edx, eax 83 shr edx, 16 84 pop es 124 shr edx, 16 ; dx high 16-bit of 32-bit stack pointer. 85 125 ret 86 126 _SSToDS_16a endp … … 88 128 CODE16 ends 89 129 130 131 ; 132 ; all segments have a <segmentname>START label at the start of the segment. 133 ; 134 90 135 CODE32 segment 91 136 CODE32START label byte 92 ASSUME CS:CODE32 93 _SSToDS_16a_GetFLAT_32: 94 push cs 95 pop es 96 jmp far ptr CODE16:_SSToDS_16a_GetFLAT_16 137 138 ;; 139 ; Gets the current cs. 140 ; @cproto none. 141 ; @returns CS 142 ; @author knut st. osmundsen 143 ; @remark internal method. called from 16-bit code... 144 far_getCS proc far 145 ASSUME DS:nothing, ES:nothing 146 mov ax, cs 147 retf 148 far_getCS endp 149 150 151 152 ;; 153 ; Gets the a 32-bit flat pointer to the OS/2 Kernel MTE. 154 ; @cproto extern PMTE _System GetOS2KrnlMTE(void); 155 ; @returns Pointer to kernel MTE. 156 ; @status completely implemented. 157 ; @author knut st. osmundsen 158 GetOS2KrnlMTE PROC NEAR 159 push es 160 161 mov ax, SAS_selector ;70h - Read-only SAS selector. 162 mov es, ax 163 xor ebx, ebx 164 assume ebx: PTR SAS 165 mov bx, es:[ebx].SAS_vm_data ;SAS_vm_data (0ch) 166 assume ebx: PTR SAS_vm_section 167 mov eax, es:[ebx].SAS_vm_krnl_mte ;SAS_vm_krnl_mte (0ch) 168 169 pop es 170 ret 171 GetOS2KrnlMTE ENDP 97 172 98 173 CODE32 ends 99 174 100 175 101 ;102 ; all segments have a <segmentname>START label at the start of the segment.103 ;104 176 DATA16 segment 105 177 DATA16START label byte -
trunk/src/win32k/dev32/devlast.asm
r847 r1467 1 ; $Id: devlast.asm,v 1.1 1999-09-06 02:19:56 bird Exp $ 2 ; DevLast - the last object file which is resident all the time. 3 ; Object files which are linked in after this is discarded after init. 1 ; $Id: devlast.asm,v 1.2 1999-10-27 02:02:54 bird Exp $ 2 ; 3 ; DevLast - the object file termintating the resident part of the objects. 4 ; Code after the ???END labes and object files and which are linked in 5 ; after this file is discarded after init. 4 6 ; 5 7 ; Copyright (c) 1999 knut st. osmundsen 6 8 ; 9 ; Project Odin Software License can be found in LICENSE.TXT 7 10 ; 8 11 .model flat … … 28 31 public CONST32_ROEND 29 32 public _CallR0Init32 30 33 public _CallVerifyProcTab32 31 34 32 35 … … 49 52 50 53 extrn R0INIT32:FAR 54 extrn VERIFYPROCTAB32:FAR 51 55 52 56 CODE16 segment 53 ASSUME CS:CODE1654 57 CODE16END db ? 55 58 56 59 ;; 60 ; Thunk procedure for R0Init32. 61 ; @cproto USHORT NEAR CallR0Init32(LIN pRpInit); 62 ; @returns Same as R0Init32. 63 ; @param pRpInit 32-bit pointer to request packet. 64 ; @status completely implemented. 65 ; @author knut st. osmundsen 57 66 _CallR0Init32 PROC NEAR 67 ASSUME CS:CODE16 58 68 push ds 59 push word ptr [esp+ 4]60 push word ptr [esp+ 8]69 push word ptr [esp+6] ; push high word. 70 push word ptr [esp+6] ; push low word. 61 71 call far ptr FLAT:R0INIT32 62 72 pop ds 63 73 retn 64 74 _CallR0Init32 ENDP 75 76 77 ;; 78 ; Thunk procedure for VerifyProcTab32. 79 ; @cproto USHORT NEAR CallVerifyProcTab32(void); 80 ; @returns Same as VerifyProcTab32. 81 ; @status completely implemented. 82 ; @author knut st. osmundsen 83 _CallVerifyProcTab32 PROC NEAR 84 ASSUME CS:CODE16 85 push ds 86 call far ptr FLAT:VERIFYPROCTAB32 87 pop ds 88 retn 89 _CallVerifyProcTab32 ENDP 90 65 91 CODE16 ends 92 66 93 67 94 CODE32 segment -
trunk/src/win32k/include/OS2Krnl.h
r847 r1467 1 /* $Id: OS2Krnl.h,v 1. 1 1999-09-06 02:19:57bird Exp $1 /* $Id: OS2Krnl.h,v 1.2 1999-10-27 02:02:55 bird Exp $ 2 2 * 3 3 * OS/2 kernel structures, typedefs and macros. … … 10 10 #pragma pack(1) 11 11 12 #if ndef RING0_DEBUG_IN_RING313 typedef USHORT SFN, *PSFN; /* system file number */12 #ifdef RING0 13 typedef USHORT SFN, *PSFN; /* system file number */ 14 14 #else 15 15 #define SFN HFILE -
trunk/src/win32k/include/asmutils.h
r847 r1467 1 /* $Id: asmutils.h,v 1. 1 1999-09-06 02:19:57bird Exp $1 /* $Id: asmutils.h,v 1.2 1999-10-27 02:02:55 bird Exp $ 2 2 * 3 3 * Assembly utilities. … … 29 29 extern void __stdcall memmov(void *p, signed int off, unsigned int len); 30 30 31 #ifdef _OS2Krnl_h_32 extern PMTE _System GetOS2KrnlMTE(void);33 #endif34 35 31 #ifdef __cplusplus 36 32 } -
trunk/src/win32k/include/cout.h
r847 r1467 1 /* $Id: cout.h,v 1. 1 1999-09-06 02:19:57bird Exp $1 /* $Id: cout.h,v 1.2 1999-10-27 02:02:55 bird Exp $ 2 2 * 3 3 * cout - cout replacement. … … 6 6 * 7 7 */ 8 9 #error("Not used! Use kprintf/dprintf!") 8 10 9 11 #ifndef _cout_h_ -
trunk/src/win32k/include/dev16.h
r847 r1467 1 /* $Id: dev16.h,v 1. 1 1999-09-06 02:19:57bird Exp $1 /* $Id: dev16.h,v 1.2 1999-10-27 02:02:56 bird Exp $ 2 2 * dev16 - 16-bit specific. Should not be used in 32-bit C/C++. 3 3 * … … 42 42 #define D16_IOCTL_VERIFYPROCTAB 0x42 43 43 44 45 44 /** 46 * Regards goes to Matthieu Willm for this!45 * Regards goes to Matthieu Willm for (parts of) this! 47 46 */ 47 #ifdef INCL_16 48 typedef void FAR * FPVOID; 49 #else 50 typedef ULONG FPVOID; 51 #endif 48 52 typedef struct _DosTable /* dt */ 49 53 { 50 54 UCHAR cul; /* count of entries (dwords) in this table.*/ 51 ULONG notinterestingAtAll; 55 FPVOID fph_HardError; 56 FPVOID fph_UCase; 57 ULONG UnknownOrReserved1; 58 ULONG UnknownOrReserved2; 59 ULONG UnknownOrReserved3; 60 FPVOID fph_MemMapAlias; 61 FPVOID fph_MemUnmapAlias; 62 FPVOID fph_GoProtAll; 63 FPVOID fph_GoRealAll; 64 FPVOID fph_doshlp_RedirDev; 65 ULONG UnknownOrReserved4; 66 ULONG UnknownOrReserved5; 67 FPVOID fph_SFFromSFN; 68 FPVOID fph_SegGetInfo; 69 FPVOID fph_AsgCheckDrive; 70 ULONG UnknownOrReserved6; 71 ULONG UnknownOrReserved7; 52 72 } DOSTABLE, FAR *PDOSTABLE , NEAR *NPDOSTABLE; 53 73 … … 55 75 { 56 76 UCHAR cul; /* count of entries (dwords) in this table.*/ 57 ULONG notinteresting0;58 ULONG notinteresting1;59 ULONG notinteresting2;60 ULONG notinteresting3;61 ULONG notinteresting4;62 ULONG notinteresting5;63 ULONG notinteresting6;64 ULONG notinteresting7;65 ULONG notinteresting8;77 FPVOID fpErrMap24; 78 FPVOID fpErrMap24End; 79 FPVOID fpErr_Table_24; 80 FPVOID fpCDSAddr; 81 FPVOID fpGDT_RDR1; 82 FPVOID fpInterrupLevel; 83 FPVOID fp_cInDos; 84 ULONG UnknownOrReserved1; 85 ULONG UnknownOrReserved2; 66 86 ULONG R0FlatCS; 67 87 ULONG R0FlatDS; 68 ULONGTKSSBase;69 ULONG notinterestingC;70 ULONG notinterestingD;71 ULONG notinterestingE;72 ULONG notinterestingF;73 ULONGReserveVM;74 ULONG notinterestingH;75 ULONG notinterestingI;88 LIN pTKSSBase; 89 LIN pintSwitchStack; 90 LIN pprivatStack; 91 FPVOID fpPhysDiskTablePtr; 92 LIN pforceEMHandler; 93 LIN pReserveVM; 94 LIN p_pgpPageDir; 95 ULONG UnknownOrReserved3; 76 96 } DOSTABLE2, FAR *PDOSTABLE2 , NEAR *NPDOSTABLE2; 77 97 … … 89 109 */ 90 110 USHORT NEAR CallR0Init32(LIN pRpInit); 91 111 USHORT NEAR CallGetOTEs32(ULONG addressOTEBuf); 112 USHORT NEAR CallVerifyProcTab32(void); 92 113 93 114 /* -
trunk/src/win32k/include/dev32.h
r1269 r1467 1 /* $Id: dev32.h,v 1. 2 1999-10-14 01:16:49bird Exp $1 /* $Id: dev32.h,v 1.3 1999-10-27 02:02:56 bird Exp $ 2 2 * 3 3 * dev32 - header file for 32-bit part of the driver. … … 48 48 * Function prototypes. 49 49 */ 50 #if ndef __cplusplus50 #if !defined(__cplusplus) && defined(RING0) 51 51 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit); 52 52 USHORT _loadds _Far32 _Pascal GetOTEs32(PKRNLOBJTABLE pOTEBuf); 53 53 USHORT _loadds _Far32 _Pascal VerifyProcTab32(void); 54 54 #endif 55 #ifdef _OS2Krnl_h_ 56 PMTE _System GetOS2KrnlMTE(void); /* (devfirst.asm) */ 57 #endif 58 55 59 56 60 /* 57 61 * Global variables 58 62 */ 59 extern ULONGTKSSBase32;63 extern PULONG pulTKSSBase32; 60 64 61 65 /* 62 * Macros 66 * SSToDS( stack pointer ) 67 * 68 * In RING-0 this translates pointers to stack memory in the 69 * Stack Segment (SS) to pointers to stack memory in the 70 * Data Segment (DS). SS is 16-bit compatible, DS is 32-bit flat. 71 * It is vitally important to use this macro whenever creating 72 * a pointer to stack memory which don't implies that is a pointer 73 * relative to SS. For example when passing the pointer to an stack 74 * variable into an function call; like the addToModule calls. 75 * 76 * @returns 32-bit FLAT stack pointer. 63 77 */ 64 #define SSToDS(a) ((PVOID)((ULONG)(a) + TKSSBase32)) 78 #ifdef RING0 79 #define SSToDS(a) ((PVOID)((ULONG)(a) + *pulTKSSBase32)) 80 #else 81 #define SSToDS(a) ((PVOID)(a)) 82 #endif 65 83 66 84 #ifdef __cplusplus -
trunk/src/win32k/include/devSegDf.inc
r847 r1467 1 ; $Id: devSegDf.inc,v 1. 1 1999-09-06 02:19:58bird Exp $1 ; $Id: devSegDf.inc,v 1.2 1999-10-27 02:02:56 bird Exp $ 2 2 ; 3 3 ; Segment definitions for win32k.sys. … … 24 24 CODE32 ends 25 25 26 CALLTAB segment dword public ' CODE' use3226 CALLTAB segment dword public 'DATA' use32 27 27 CALLTAB ends 28 28 -
trunk/src/win32k/include/ldr.h
r1269 r1467 1 /* $Id: ldr.h,v 1. 2 1999-10-14 01:16:49bird Exp $1 /* $Id: ldr.h,v 1.3 1999-10-27 02:02:56 bird Exp $ 2 2 * 3 3 * ldr - loader header file. … … 14 14 extern BOOL fQAppType; 15 15 16 /* **************************************************************/17 /* handle state - Array of handle states. Four state per byte! */18 /***************************************************************/16 /* 17 * handle state - Array of handle states. Eight state per byte! 18 */ 19 19 #define MAX_FILE_HANDLES 0x10000 20 20 … … 31 31 32 32 33 /* *************/34 /* PE handles */35 /**************/36 typedef struct _ PENode33 /* 34 * Module struct. 35 */ 36 typedef struct _Module 37 37 { 38 /* linking stuff */ 39 struct _PENode *left; 40 struct _PENode *right; 38 AVLNODECORE coreKey; /* Key is hFile. */ 39 AVLNODECORE coreMTE; /* Key is pMTE. */ 41 40 42 /* key*/43 SFN hFile; /* system file number or file handle if you prefer that*/41 SFN hFile; /* System file number or file handle if you prefer that. */ 42 PMTE pMTE; /* Pointer to MTE if we got one - NULL is allowed. */ 44 43 45 /* misc */ 46 PMTE pMTE; /* pointer to MTE if we got one - may be NULL */ 44 ULONG fFlags; /* Flags. Flags if coreMte is in use and what Data contains. */ 45 union 46 { 47 Pe2Lx * pPe2Lx; /* Pointer to a Pe2Lx object. (Win32 executables) */ 48 #if 0 49 Elf2Lx * pElf2Lx; /* Pointer to a Elf2Lx object. (ELF executables) */ 50 Script * pScript; /* Pointer to a Script object. (Shell scripts) */ 51 Pe * pPe; /* Pointer to a Pe object. (Ring3 loader) */ 52 #endif 53 void * pv; 54 } Data; /* Pointer to data. Currently it's allways a Pe2Lx object! */ 55 } MODULE, *PMODULE; 47 56 48 /* Pe2Lx object */ 49 Pe2Lx *pPe2Lx; 50 } PENODE, *PPENODE; 57 #define MOD_FLAGS_IN_MTETREE 0x00000010 /* The node is present in the MTE-tree. */ 58 #define MOD_TYPE_MASK 0x0000000F /* Type mask. */ 59 #define MOD_TYPE_PE2LX 0x00000001 /* Pe2Lx module. */ 60 #define MOD_TYPE_ELF2LX 0x00000002 /* Elf2Lx module. */ 61 #define MOD_TYPE_SCRIPT 0x00000003 /* Script module. */ 62 #define MOD_TYPE_PE 0x00000004 /* Pe module. */ 51 63 52 #define SIZEOF_NODE (sizeof(NODE))53 64 54 ULONG insertNode(PPENODE pNode); 55 ULONG deleteNode(SFN key); /* removes from tree and freeNode */ 56 PPENODE getNodePtr(SFN key); 57 PPENODE findNodePtr(const char *pszFilename); 58 ULONG depthPE(void); 59 PPENODE allocateNode(void); 60 ULONG freeNode(PPENODE pNode); /* don't remove from tree! */ 65 /* 66 * Modules operations. 67 */ 68 PMODULE getModuleBySFN(SFN hFile); 69 PMODULE getModuleByMTE(PMTE pMTE); 70 PMODULE getModuleByFilename(PCSZ pszFilename); 61 71 62 /* if sequential insertion - this will give a lower tree. */ 63 /* testing shows that 3 gives best results for 27 to 134 nodes */ 64 #define ROTATION 3 65 #define AdjustKey(a) ((USHORT)(a << 16-ROTATION) | (USHORT)(a >> ROTATION) ) 66 #define UnAdjustKey(a) ((USHORT)(a >> 16-ROTATION) | (USHORT)(a << ROTATION) ) 72 ULONG addModule(SFN hFile, PMTE pMTE, ULONG fFlags, void *pData); 73 ULONG removeModule(SFN hFile); 67 74 68 75 #endif 76 69 77 /*************/ 70 78 /* functions */ -
trunk/src/win32k/include/log.h
r1269 r1467 1 /* $Id: log.h,v 1. 2 1999-10-14 01:16:50bird Exp $1 /* $Id: log.h,v 1.3 1999-10-27 02:02:56 bird Exp $ 2 2 * 3 3 * log - C-style logging - kprintf. … … 5 5 * 6 6 * Copyright (c) 1998-1999 knut st. osmundsen 7 * 8 * Project Odin Software License can be found in LICENSE.TXT 7 9 * 8 10 */ … … 15 17 #endif 16 18 19 /* 20 * COM-Port port numbers. 21 */ 17 22 #define OUTPUT_COM1 0x3f8 18 23 #define OUTPUT_COM2 0x2f8 24 19 25 20 26 /* … … 26 32 #include "vprintf.h" 27 33 #define kprintf(a) printf a 28 #define kernel_printf(a) printf a, printf("\n") /* obsolete */29 34 #else 30 35 #define kprintf(a) (void)0 31 #define kernel_printf(a) (void)032 36 #endif 33 37 -
trunk/src/win32k/include/malloc.h
r1269 r1467 1 /* $Id: malloc.h,v 1. 2 1999-10-14 01:16:50bird Exp $1 /* $Id: malloc.h,v 1.3 1999-10-27 02:02:57 bird Exp $ 2 2 * 3 3 * Heap. … … 46 46 #define MAXPTR _uHeapMaxPtr 47 47 48 #define HEAP_SIZE 0x00600000U /* 10MB of heap */ 48 /*#define HEAP_SIZE 0x00600000U*/ /* 10MB of heap */ 49 #define HEAP_SIZE 0x100000U /* 1MB of heap */ 49 50 50 51 /* HeapPointer assert - old ones... */ -
trunk/src/win32k/include/options.h
r847 r1467 1 /* $Id: options.h,v 1.1 1999-09-06 02:19:59 bird Exp $ 1 /* $Id: options.h,v 1.2 1999-10-27 02:02:57 bird Exp $ 2 * 2 3 * Options. 3 4 * 4 5 * Copyright (c) 1998-1999 knut st. osmundsen 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 5 8 * 6 9 */ … … 9 12 #define _options_h_ 10 13 14 /******************************************************************************* 15 * Defined Constants And Macros * 16 *******************************************************************************/ 11 17 /* fKernel */ 12 18 #define KF_UNI 0x00000000UL 13 19 #define KF_SMP 0x00000001UL 14 20 21 /* Set defaults. */ 22 #define SET_OPTIONS_TO_DEFAULT(o) \ 23 o.fQuiet = 0; \ 24 o.usCom = OUTPUT_COM2; \ 25 o.fLogging = 0; \ 26 o.ulBuild = ~0; \ 27 o.fKernel = KF_UNI; \ 28 o.usVerMajor = ~0; \ 29 o.usVerMinor = ~0; 15 30 31 32 /******************************************************************************* 33 * Structures and Typedefs * 34 *******************************************************************************/ 16 35 /** Option struct */ 17 36 struct options … … 39 58 /** @cat Options affecting the generated LX executable */ 40 59 //******************************************************/ 41 int noExeTIBFix; /* ask win32k for initstuff (win32k only) */ 42 int AlignSections; /* don't align sections */ 43 //int TIBFixObject; /* make a TIBFix object - AlignSections = 0 */ 44 45 int lxoffset; /* if true use the fixed LXOFFSET if not ulPEOffset */ 46 int ourstub; /* our DOS stub or the one from the PE-file */ 60 /* none yet... */ 47 61 }; 48 62 49 63 50 extern struct options options; 51 52 #define SET_OPTIONS_TO_DEFAULT(o) \ 53 o.fQuiet = 0; \ 54 o.usCom = OUTPUT_COM2; \ 55 o.fLogging = 0; \ 56 o.ulBuild = 8259; \ 57 o.fKernel = KF_UNI; \ 58 o.usVerMajor = 20; \ 59 o.usVerMinor = 30; \ 60 o.noExeTIBFix = 0; \ 61 o.AlignSections = 1; \ 62 o.lxoffset = 0; \ 63 o.ourstub = 0 64 65 66 #define SET_OPTIONS_WIN32K(o) \ 67 SET_OPTIONS_TO_DEFAULT(o) 68 69 #define SET_OPTIONS_WIN32K_SAFE(o) \ 70 SET_OPTIONS_TO_DEFAULT(o); \ 71 o.noExeTIBFix = 0; \ 72 o.AlignSections = 1 73 74 75 #define SET_OPTIONS_PE2LX(o) \ 76 SET_OPTIONS_TO_DEFAULT(o); \ 77 o.fLogging = 1; \ 78 o.noExeTIBFix = 0; \ 79 o.AlignSections = 1; \ 80 o.lxoffset = 0; \ 81 o.ourstub = 0 64 /******************************************************************************* 65 * Global Variables * 66 *******************************************************************************/ 67 extern struct options options; /* defined in d32globals.c */ 82 68 83 69 #endif -
trunk/src/win32k/include/pe2lx.h
r1270 r1467 1 /* $Id: pe2lx.h,v 1. 4 1999-10-14 01:17:55bird Exp $1 /* $Id: pe2lx.h,v 1.5 1999-10-27 02:02:57 bird Exp $ 2 2 * 3 3 * Pe2Lx class declarations. Ring 0 and Ring 3 … … 17 17 * Defined Constants And Macros * 18 18 *******************************************************************************/ 19 /*20 * RING3 wrappings for RING0 constructs.21 */22 #ifdef RING323 typedef HFILE SFN; /* System File Number. (OS2Krnl.h) */24 typedef PVOID PMTE; /* Pointer to Module Table Entry. (OS2Krnl.h) */25 #endif26 27 19 /* 28 20 * Misc -
trunk/src/win32k/include/probkrnl.h
r847 r1467 1 /* $Id: probkrnl.h,v 1. 1 1999-09-06 02:19:59bird Exp $1 /* $Id: probkrnl.h,v 1.2 1999-10-27 02:02:57 bird Exp $ 2 2 * 3 3 * Include file for ProbKrnl. … … 57 57 extern unsigned long int _usVerMinor; /* 'usVerMinor' in PrbKrnl.c */ 58 58 59 #ifdef INCL_16 /* 16-bit only */ 60 int ProbeKernel(PRPINITIN pReqPack); 61 #endif 59 62 60 63 #endif -
trunk/src/win32k/ldr/calltab.asm
r847 r1467 1 ; $Id: calltab.asm,v 1. 1 1999-09-06 02:20:00bird Exp $1 ; $Id: calltab.asm,v 1.2 1999-10-27 02:02:58 bird Exp $ 2 2 ; 3 3 ; callTab - Call back again table - table with entry for each function which is overrided. … … 6 6 ; Copyright (c) 1998-1999 knut st. osmundsen 7 7 ; 8 ; Project Odin Software License can be found in LICENSE.TXT 8 9 ; 9 10 .386p … … 33 34 assume cs:CALLTAB, ds:flat, ss:nothing 34 35 36 ; 37 ; must match with the aProcTab array in dev16\ProbKrnl.c 38 ; 35 39 callTab: 40 __ldrRead@24 PROC NEAR 41 db MAXSIZE_PROLOG dup(0cch) 42 __ldrRead@24 ENDP 43 44 __ldrOpen@12 PROC NEAR 45 db MAXSIZE_PROLOG dup(0cch) 46 __ldrOpen@12 ENDP 47 36 48 __ldrClose@4 PROC NEAR 37 d wMAXSIZE_PROLOG dup(0cch)49 db MAXSIZE_PROLOG dup(0cch) 38 50 __ldrClose@4 ENDP 39 51 40 __ldrOpen@12 PROC NEAR41 dw MAXSIZE_PROLOG dup(0cch)42 __ldrOpen@12 ENDP43 44 __ldrRead@24 PROC NEAR45 dw MAXSIZE_PROLOG dup(0cch)46 __ldrRead@24 ENDP47 48 52 __LDRQAppType@8 PROC NEAR 49 d wMAXSIZE_PROLOG dup(0cch)53 db MAXSIZE_PROLOG dup(0cch) 50 54 __LDRQAppType@8 ENDP 51 55 … … 53 57 public __LDRLoadExe 54 58 __LDRLoadExe PROC NEAR 55 d wMAXSIZE_PROLOG dup(0cch)59 db MAXSIZE_PROLOG dup(0cch) 56 60 __LDRLoadExe END 57 61 58 62 public __ldrGetResource 59 63 __ldrGetResource PROC NEAR 60 d wMAXSIZE_PROLOG dup(0cch)64 db MAXSIZE_PROLOG dup(0cch) 61 65 __ldrGetResource ENDP 62 66 63 67 public __ldrOpenNewExe 64 68 __ldrOpenNewExe PROC NEAR 65 d wMAXSIZE_PROLOG dup(0cch)69 db MAXSIZE_PROLOG dup(0cch) 66 70 __ldrOpenNewExe ENDP 67 71 68 72 public __ldrCreateMte 69 73 __ldrCreateMte PROC NEAR 70 d wMAXSIZE_PROLOG dup(0cch)74 db MAXSIZE_PROLOG dup(0cch) 71 75 __ldrCreateMte ENDP 72 76 73 77 public __ldrGetMte 74 78 __ldrGetMte PROC NEAR 75 d wMAXSIZE_PROLOG dup(0cch)79 db MAXSIZE_PROLOG dup(0cch) 76 80 __ldrGetMte ENDP 77 81 -
trunk/src/win32k/ldr/ldr.cpp
r1273 r1467 1 /* $Id: ldr.cpp,v 1. 2 1999-10-14 01:25:38 bird Exp $1 /* $Id: ldr.cpp,v 1.3 1999-10-27 02:02:58 bird Exp $ 2 2 * 3 * ldr.cpp - Loader helper functions a structures.3 * ldr.cpp - Loader helpers. 4 4 * 5 5 * Copyright (c) 1999 knut St. osmundsen … … 23 23 #include <memory.h> 24 24 #include <stdlib.h> 25 #include <stddef.h> 25 26 26 27 #include "log.h" … … 29 30 #include "OS2Krnl.h" 30 31 #include "pe2lx.h" 32 #include "avl.h" 31 33 #include "ldr.h" 34 32 35 33 36 … … 35 38 * Global Variables * 36 39 *******************************************************************************/ 37 PPENODE pPE; 40 PAVLNODECORE pSFNRoot = NULL; 41 PAVLNODECORE pMTERoot = NULL; 42 38 43 unsigned char achHandleStates[MAX_FILE_HANDLES/8]; 39 44 40 45 41 /******************************************************************************* 42 * Internal Functions * 43 *******************************************************************************/ 44 static PPENODE findNodePtr2(PPENODE pRoot, const char *pszFilename); 45 static ULONG depth(PPENODE pNode); 46 47 48 /** 49 * Inserts a PENode into the pPE tree. 50 * @returns NO_ERROR on success. !0 on error. 51 * @param pNode Pointer to node to insert. 52 */ 53 ULONG insertNode(PPENODE pNode) 54 { 55 int level; 56 PPENODE pPrev; 57 PPENODE pTmp; 58 59 if (pPE == NULL) 60 { 61 pPE = pNode; 62 pNode->left = pNode->right = NULL; 46 /** 47 * Gets a module by the give hFile. 48 * @returns Pointer to module node. If not found NULL. 49 * @param hFile File handle of the module to be found. 50 * @sketch return a AVLGet on the pSFNRoot-tree. 51 * @status completely implemented. 52 * @author knut st. osmundsen 53 */ 54 PMODULE getModuleBySFN(SFN hFile) 55 { 56 return (PMODULE)AVLGet(&pSFNRoot, (AVLKEY)hFile); 57 } 58 59 60 /** 61 * Gets a module by the MTE. 62 * @returns Pointer to module node. If not found NULL. 63 * @param pMTE Pointer an Module Table Entry. 64 * @sketch Try find it in the MTE tree. 65 * IF not found THEN 66 * BEGIN 67 * DEBUG: validate pMTE pointer. 68 * Get the SFN from the MTE. 69 * IF found in the SFN-tree THEN 70 * BEGIN 71 * Update the pMTE in the node. 72 * Add the node to the MTE-tree. 73 * END 74 * ELSE return NULL 75 * END 76 * return pointer to module node. 77 * @status completely implemented. 78 * @author knut st. osmundsen 79 */ 80 PMODULE getModuleByMTE(PMTE pMTE) 81 { 82 PMODULE pMod = (PMODULE)AVLGet(&pMTERoot, (AVLKEY)pMTE); 83 if (pMod == NULL) 84 { 85 #ifdef DEBUG 86 if (pMTE <= (PMTE)0x10000) 87 { 88 kprintf(("getModuleByMTE: invalid pMTE pointer - %#8x\n", pMTE)); 89 return NULL; 90 } 91 #endif 92 pMod = (PMODULE)AVLGet(&pSFNRoot, (AVLKEY)pMTE->mte_sfn); 93 if (pMod != NULL) 94 { 95 pMod->coreMTE.Key = (AVLKEY)pMTE; 96 pMod->fFlags |= MOD_FLAGS_IN_MTETREE; 97 AVLInsert(&pMTERoot, (PAVLNODECORE)((unsigned)pMod + offsetof(MODULE, coreMTE))); 98 } 63 99 } 64 100 else 65 { 66 level = 0; 67 pPrev = NULL; 68 pTmp = pPE; 69 while (pTmp != NULL) 70 { 71 level = 0; 72 pPrev = pTmp; 73 pTmp = AdjustKey(pNode->hFile) < AdjustKey(pTmp->hFile) ? pTmp->left : pTmp->right; 74 } 75 76 if (pNode->hFile != pPrev->hFile) 77 { 78 if (AdjustKey(pNode->hFile) < AdjustKey(pPrev->hFile)) 79 pPrev->left = pNode; 80 else 81 pPrev->right = pNode; 82 pNode->left = pNode->right = NULL; 83 } 84 else 85 return -1; 101 pMod = (PMODULE)((unsigned)pMod - offsetof(MODULE, coreMTE)); 102 return pMod; 103 } 104 105 106 /** 107 * Get a module by filename. 108 * @returns Pointer to module node. If not found NULL. 109 * @param pszFilename Pointer to the filename which we are search by. 110 * @sketch Not implemented. 111 * @status Stub. 112 * @author knut st. osmundsen 113 */ 114 PMODULE getModuleByFilename(PCSZ pszFilename) 115 { 116 pszFilename = pszFilename; 117 return NULL; 118 } 119 120 121 /** 122 * Adds a module to the SFN-tree, if pMTE is not NULL it is added to the MTE-tree too. 123 * @returns NO_ERROR on success. Appropriate errorcode on failiure. 124 * @param hFile System file number for the module. 125 * @param pMTE Pointer to MTE. NULL is valid. 126 * @param fFlags Type flags for the fFlags field in the node. 127 * @param pvData Pointer to data. 128 * @sketch DEBUG: check that the module doesn't exists and parameter check. 129 * (try) Allocate a new node. (return errorcode on failure) 130 * Fill in the node. 131 * Add the node to the SFN-tree. 132 * IF valid MTE pointer THEN add it to the MTE tree and set the in MTE-tree flag. 133 * return successfully. 134 * @status completely implemented. 135 * @author knut st. osmundsen 136 */ 137 ULONG addModule(SFN hFile, PMTE pMTE, ULONG fFlags, void *pvData) 138 { 139 PMODULE pMod; 140 #ifdef DEBUG 141 if (AVLGet(&pSFNRoot, (AVLKEY)hFile) != NULL) 142 kprintf(("addModule: Module allready present in the SFN-tree!\n")); 143 if (hFile == 0) 144 { 145 kprintf(("addModule: invalid parameter: hFile = 0\n")); 146 return ERROR_INVALID_PARAMETER; 147 } 148 if ((fFlags & MOD_TYPE_MASK) == 0 || (fFlags & ~MOD_TYPE_MASK) != 0) 149 { 150 kprintf(("addModule: invalid parameter: fFlags = 0x%#8x\n", fFlags)); 151 return ERROR_INVALID_PARAMETER; 152 } 153 #endif 154 155 /* try allocate memory for the node. */ 156 pMod = (PMODULE)malloc(sizeof(MODULE)); 157 if (pMod == NULL) 158 { 159 kprintf(("addModule: out of memory!\n")); 160 return ERROR_NOT_ENOUGH_MEMORY; 161 } 162 163 /* fill in the module node. */ 164 pMod->coreKey.Key = (AVLKEY)hFile; 165 pMod->hFile = hFile; 166 pMod->pMTE = pMTE; 167 pMod->fFlags = fFlags; 168 pMod->Data.pv = pvData; 169 170 /* insert the module node into the tree(s) */ 171 AVLInsert(&pSFNRoot, (PAVLNODECORE)pMod); 172 if (pMTE != NULL) 173 { 174 pMod->coreMTE.Key = (AVLKEY)pMTE; 175 pMod->fFlags |= MOD_FLAGS_IN_MTETREE; 176 AVLInsert(&pMTERoot, (PAVLNODECORE)((unsigned)pMod + offsetof(MODULE, coreMTE))); 86 177 } 87 178 … … 91 182 92 183 /** 93 * Deletes a node from the pPE tree. 94 * @returns NO_ERROR on success. !0 on error. 95 * @param key Filehandle, which is the key. 96 */ 97 ULONG deleteNode(SFN key) 98 { 99 int level,level2; 100 ULONG rc; 101 PPENODE pTmp,pTmp2; 102 PPENODE pPrev,pPrev2; 103 int left; 104 105 if (pPE != NULL) 106 { 107 /* find node to delete */ 108 level = 1; 109 pPrev = NULL; 110 pTmp = pPE; 111 while (pTmp != NULL && key != pTmp->hFile) 112 { 113 pPrev = pTmp; 114 pTmp = (left = (AdjustKey(key) < AdjustKey(pTmp->hFile))) == TRUE ? pTmp->left : pTmp->right; 115 level ++; 116 } 117 118 if (pTmp != NULL) 119 { 120 /*found it: pTmp -> node to delete - pPrev -> parent node*/ 121 level--; 122 rc = -1; 123 if (pTmp->left != NULL && pTmp->right != NULL) 124 { 125 /* hard case - fetch the leftmost node in the right subtree */ 126 level2 = level; 127 pPrev2 = pTmp; 128 pTmp2 = pTmp->right; 129 while (pTmp2->left != NULL) 130 { 131 pPrev2 = pTmp2; 132 pTmp2 = pTmp2->left; 133 level2++; 134 } 135 /* pTmp2 -> new root - pPrev2 -> parent node */ 136 137 /* left child of pTmp2 */ 138 pTmp2->left = pTmp->left; 139 140 /* parent of pTmp2 and pTmp2->right */ 141 if (pPrev2 != pTmp) 142 { 143 pPrev2->left = pTmp2->right; 144 pTmp2->right = pTmp->right; 145 } 146 //else pTmp2->right = pTmp2->right; 147 148 /* link in pTmp2 */ 149 if (pTmp != pPE) 150 { 151 if (left) 152 pPrev->left = pTmp2; 153 else 154 pPrev->right = pTmp2; 155 } 156 else 157 pPE = pTmp2; 158 rc = NO_ERROR; 159 } 160 161 /* leaf */ 162 if (rc!=0 && pTmp->left == NULL && pTmp->right == NULL) 163 { 164 if (pTmp != pPE) 165 { 166 if (left) 167 pPrev->left = NULL; 168 else 169 pPrev->right = NULL; 170 } 171 else 172 pPE = NULL; 173 rc = NO_ERROR; 174 } 175 176 /* left is NULL */ 177 if (rc!=0 && pTmp->left == NULL && pTmp->right != NULL) 178 { 179 /* move up right node */ 180 if (pTmp != pPE) 181 { 182 if (left) 183 pPrev->left = pTmp->right; 184 else 185 pPrev->right = pTmp->right; 186 } 187 else 188 pPE = pTmp->right; 189 rc = NO_ERROR; 190 } 191 192 /* right is NULL */ 193 if (rc!=0 && pTmp->left != NULL && pTmp->right == NULL) 194 { 195 /* move up left node */ 196 if (pTmp != pPE) 197 { 198 if (left) 199 pPrev->left = pTmp->left; 200 else 201 pPrev->right = pTmp->left; 202 } 203 else 204 pPE = pTmp->left; 205 rc = NO_ERROR; 206 } 207 208 /* free node */ 209 if (rc == NO_ERROR) 210 rc = freeNode( pTmp ); 211 } 212 else 213 rc = 1; //not found 214 } 215 else 216 rc = 1; //not found 217 return rc; 218 } 219 220 221 /** 222 * Get the pointer to a node in the pPE tree. 223 * @returns Pointer to node on success. NULL if not found or error occured. 224 * @param key Filehandle, which is the key for the pPE tree. 225 */ 226 PPENODE getNodePtr(SFN key) 227 { 228 PPENODE pTmp = pPE; 229 int level = 1; 230 while (pTmp != NULL && pTmp->hFile != key) 231 { 232 pTmp = AdjustKey(key) < AdjustKey(pTmp->hFile) ? pTmp->left : pTmp->right; 233 level++; 234 } 235 return pTmp; 236 } 237 238 239 /** 240 * Find a PENode by filename in the node tree. 241 * @returns Pointer to PENode if found, NULL if not found. 242 * @param pszFilename Pointer to filename. 243 */ 244 PPENODE findNodePtr(const char *pszFilename) 245 { 246 /*depth first search thru the whole tree */ 247 return findNodePtr2(pPE, pszFilename); 248 } 249 250 251 /** 252 * Find a PENode by filename in the given tree. 253 * Depth first search thru the whole tree. 254 * @returns Pointer to matching PENode. 255 * @param pRoot Tree root. 256 * @param pszFilename Pointer to filename. 257 * @remark sub-function of findNodePtr. 258 */ 259 static PPENODE findNodePtr2(PPENODE pRoot, const char *pszFilename) 260 { 261 PPENODE pNode = NULL; 262 263 /*depth first search thru the whole tree */ 264 if (pRoot == NULL || pRoot->pPe2Lx->queryIsModuleName(pszFilename)) 265 return pRoot; 266 267 //search subtrees 268 if (pRoot->left != NULL) 269 pNode = findNodePtr2(pRoot->left,pszFilename); 270 if (pNode == NULL && pRoot->right != NULL) 271 pNode = findNodePtr2(pRoot->right,pszFilename); 272 return pNode; 273 } 274 275 276 /** 277 * Allocate memory for a PENode. 278 * @returns Pointer to new PENode on success. NULL pointer on error. 279 */ 280 PPENODE allocateNode(void) 281 { 282 PPENODE pNode; 283 284 pNode = new PENODE; 285 if (pNode == NULL) 286 kprintf(("allocateNode: new returned a NULL-pointer\n")); 287 288 return pNode; 289 } 290 291 292 /** 293 * Frees node. 294 * @returns NO_ERROR on success. 295 * @param pNode Pointer to node which is to be freed. 296 */ 297 ULONG freeNode(PPENODE pNode) 298 { 299 if (pNode != NULL) 300 delete pNode; 184 * Removes and frees a module node (including the data pointer). 185 * @returns NO_ERROR on success. Appropriate error code on failure. 186 * @param hFile System filehandle of the module. 187 * @sketch Remove the node from the SFN-tree. 188 * IF present in the MTE-tree THEN remove it from the tree. 189 * Delete the datapointer. 190 * Free the module node. 191 * return successfully. 192 * @status completely implemented. 193 * @author knut st. osmundsen 194 */ 195 ULONG removeModule(SFN hFile) 196 { 197 PMODULE pMod = (PMODULE)AVLRemove(&pSFNRoot, (AVLKEY)hFile); 198 if (pMod == NULL) 199 { 200 kprintf(("removeModule: Module not found! hFile=%#4x\n", hFile)); 201 return ERROR_INVALID_PARAMETER; 202 } 203 204 /* In MTE-tree too? */ 205 if (pMod->fFlags & MOD_FLAGS_IN_MTETREE) 206 { 207 if (AVLRemove(&pMTERoot, (AVLKEY)pMod->pMTE) == NULL) 208 { 209 kprintf(("removeModule: MOD_FLAGS_IN_MTETREE set but AVLRemove returns NULL\n")); 210 } 211 } 212 213 /* Delete the datapointer. */ 214 switch (pMod->fFlags & MOD_TYPE_MASK) 215 { 216 case MOD_TYPE_PE2LX: 217 delete pMod->Data.pPe2Lx; 218 break; 219 220 case MOD_TYPE_ELF2LX: 221 case MOD_TYPE_SCRIPT: 222 case MOD_TYPE_PE: 223 default: 224 kprintf(("removeModule: Unknown type, %#x\n", pMod->fFlags & MOD_TYPE_MASK)); 225 } 226 227 /* Free the module node. */ 228 free(pMod); 301 229 302 230 return NO_ERROR; 303 }304 305 306 /**307 * Gets the depth of the pPE tree.308 * @returns Number of levels in the the pPE tree.309 */310 ULONG depthPE(void)311 {312 return depth(pPE);313 }314 315 316 317 /**318 * Gets the depth of the pPE tree.319 * @returns Number of levels in the the pPE tree.320 * @param pNode Node to start at. (root node...)321 */322 static ULONG depth(PPENODE pNode)323 {324 if (pNode != NULL)325 {326 int l, r;327 l = depth(pNode->left);328 r = depth(pNode->right);329 return 1 + (l > r ? l : r);330 }331 else332 return 0;333 231 } 334 232 … … 346 244 memset(&achHandleStates[0], 0, sizeof(achHandleStates)); 347 245 348 /* init pPEFiles* */ 349 pPE = NULL; 246 /* init the tree roots */ 247 pSFNRoot = NULL; 248 pMTERoot = NULL; 350 249 351 250 return rc; -
trunk/src/win32k/ldr/myldrClose.cpp
r1273 r1467 1 /* $Id: myldrClose.cpp,v 1. 2 1999-10-14 01:25:38 bird Exp $1 /* $Id: myldrClose.cpp,v 1.3 1999-10-27 02:02:58 bird Exp $ 2 2 * 3 3 * myldrClose - _ldrClose … … 26 26 #include "OS2Krnl.h" 27 27 #include "pe2lx.h" 28 #include "avl.h" 28 29 #include "ldr.h" 29 30 #include "ldrCalls.h" … … 44 45 if (GetState(hFile) == HSTATE_OUR) 45 46 { 46 rc = deleteNode(hFile);47 rc = removeModule(hFile); 47 48 if (rc != NO_ERROR) 48 kprintf((" Funny! deleteNode failed rc =%d\n", rc));49 kprintf(("_ldrClose: removeModule retured rc=%d\n", rc)); 49 50 50 51 SetState(hFile, HSTATE_UNUSED); -
trunk/src/win32k/ldr/myldrOpen.cpp
r1273 r1467 1 /* $Id: myldrOpen.cpp,v 1. 2 1999-10-14 01:25:38 bird Exp $1 /* $Id: myldrOpen.cpp,v 1.3 1999-10-27 02:02:58 bird Exp $ 2 2 * 3 3 * myldrOpen - _ldrOpen. … … 29 29 #include "OS2Krnl.h" 30 30 #include "pe2lx.h" 31 #include "elf.h" 32 #include "avl.h" 31 33 #include "ldr.h" 32 34 #include "ldrCalls.h" 33 35 34 #include "elf.h"35 36 36 37 /** … … 71 72 if (rc == NO_ERROR && *(PULONG)pach == IMAGE_NT_SIGNATURE) 72 73 { /* PE signature found */ 73 P PENODE pNode;74 PMODULE pMod; 74 75 75 kprintf(("_ldrOpen: PE executable !(?)\n"));76 kprintf(("_ldrOpen: PE executable...\n")); 76 77 #pragma info(none) 77 78 if (/* invoke pe.exe or do conversion now? */ 1) 78 79 { /* pe2lx - win32k */ 79 80 #pragma info(restore) 80 pNode = allocateNode();81 if (p Node!= NULL)81 Pe2Lx * pPe2Lx = new Pe2Lx(*phFile); 82 if (pPe2Lx != NULL) 82 83 { 83 pNode->pPe2Lx = new Pe2Lx(*phFile);84 if ( pNode->pPe2Lx != NULL)84 rc = pPe2Lx->init(pszFilename); 85 if (rc == NO_ERROR) 85 86 { 86 rc = pNode->pPe2Lx->init(pszFilename); 87 kprintf(("_ldrOpen: Successfully init of Pe2Lx object.\n")); 88 rc = addModule(*phFile, NULL, MOD_TYPE_PE2LX, pPe2Lx); 87 89 if (rc == NO_ERROR) 88 { 89 kprintf(("_ldrOpen: Successfully init of Pe2Lx object.\n")); 90 rc = insertNode(pNode); 91 if (rc != NO_ERROR) 92 { 93 kprintf(("_ldrOpen: Failed to insert PeNode into tree. rc=%d\n")); 94 delete pNode->pPe2Lx; 95 pNode->pPe2Lx = NULL; 96 freeNode(pNode); 97 SetState(*phFile, HSTATE_OUR); 98 } 99 } 90 SetState(*phFile, HSTATE_OUR); 100 91 else 101 { 102 kprintf(("_ldrOpen: Failed to init Pe2Lx object. rc=%d\n")); 103 delete pNode->pPe2Lx; 104 pNode->pPe2Lx = NULL; 105 freeNode(pNode); 106 } 92 kprintf(("_ldrOpen: Failed to add the module. rc=%d\n")); 107 93 } 108 94 else 109 { 110 kprintf(("_ldrOpen: Failed to allocate Pe2Lx object.\n")); 111 freeNode(pNode); 112 } 95 kprintf(("_ldrOpen: Failed to init Pe2Lx object. rc=%d\n")); 96 if (rc != NO_ERROR) 97 delete pPe2Lx; 113 98 } 114 99 else 115 kprintf(("_ldrOpen: Failed to allocate node.\n"));100 kprintf(("_ldrOpen: Failed to allocate Pe2Lx object.\n")); 116 101 } 117 102 else -
trunk/src/win32k/ldr/myldrRead.cpp
r1276 r1467 1 /* $Id: myldrRead.cpp,v 1. 3 1999-10-14 02:36:08 bird Exp $1 /* $Id: myldrRead.cpp,v 1.4 1999-10-27 02:02:58 bird Exp $ 2 2 * 3 3 * myldrRead - _ldrRead. … … 27 27 #include "OS2Krnl.h" 28 28 #include "pe2lx.h" 29 #include "avl.h" 29 30 #include "ldrCalls.h" 30 31 #include "ldr.h" … … 45 46 if (GetState(hFile) == HSTATE_OUR) 46 47 { 47 PPENODE pNode; 48 PMODULE pMod; 49 kprintf(("_ldrRead+: hF=%+04x off=%+08x pB=%+08x fl=%+08x cb=%+04x pMTE=%+08x\n",hFile,ulOffset,pBuffer,ulFlags,ulBytesToRead,pMTE)); 48 50 49 p Node = getNodePtr(hFile);50 if (p Node!= NULL)51 pMod = getModuleBySFN(hFile); 52 if (pMod != NULL) 51 53 { 52 54 /* I would love to have a pointer to the MTE */ 53 if (p Node->pMTE == NULL && pMTE != NULL)54 p Node->pMTE == pMTE;55 if (pMod->pMTE == NULL && pMTE != NULL) 56 pMod->pMTE == pMTE; 55 57 56 58 /* debug */ … … 58 60 kprintf(("_ldrRead: Warning ulFlags = 0x%x (!= 0)\n", ulFlags)); 59 61 60 rc = pNode->pPe2Lx->read(ulOffset, pBuffer, ulBytesToRead, ulFlags, pMTE); 62 if ((pMod->fFlags & MOD_TYPE_MASK) == MOD_TYPE_PE2LX) 63 rc = pMod->Data.pPe2Lx->read(ulOffset, pBuffer, ulBytesToRead, ulFlags, pMTE); 64 else 65 { 66 kprintf(("_ldrRead: Invalid module type, %#x\n", pMod->fFlags & MOD_TYPE_MASK)); 67 rc = ERROR_READ_FAULT; 68 } 61 69 return rc; 62 70 } … … 67 75 rc = _ldrRead(hFile, ulOffset, pBuffer, ulFlags, ulBytesToRead, pMTE); 68 76 69 // kprintf(("_ldrRead: hF=%+04x off=%+08x pB=%+08x fl=%+08x cb=%+04x pMTE=%+08x rc=%d\n",hFile,ulOffset,pBuffer,ulFlags,ulBytesToRead,pMTE,rc)); 77 #if 0 78 kprintf(("_ldrRead: hF=%+04x off=%+08x pB=%+08x fl=%+08x cb=%+04x pMTE=%+08x rc=%d\n", 79 hFile,ulOffset,pBuffer,ulFlags,ulBytesToRead,pMTE,rc)); 80 #endif 70 81 71 82 return rc; -
trunk/src/win32k/misc/asmutils.asm
r909 r1467 1 ; $Id: asmutils.asm,v 1. 2 1999-09-12 00:26:27bird Exp $1 ; $Id: asmutils.asm,v 1.3 1999-10-27 02:02:59 bird Exp $ 2 2 ; 3 3 ; asmutils - assembly utility functions … … 5 5 ; Copyright (c) 1998-1999 knut st. osmundsen 6 6 ; 7 ; Project Odin Software License can be found in LICENSE.TXT 7 8 ; 8 9 .386p … … 12 13 ; 13 14 include devsegdf.inc 14 include sas.inc15 15 16 16 ; … … 26 26 public _memrevmov@12 27 27 public _memmov@12 28 public GetOS2KrnlMTE29 28 ; public DisableInterrupts 30 29 ; public EnableInterrupts … … 196 195 197 196 198 ; gets the FLAT pointer to the OS2 Kernel MTE.199 ; eax is flat pointer to OS2 Kernel MTE.200 GetOS2KrnlMTE PROC NEAR201 push es202 203 mov ax, SAS_selector ;70h - Read-only SAS selector.204 mov es, ax205 xor ebx, ebx206 assume ebx: PTR SAS207 mov bx, [ebx].SAS_vm_data ;SAS_vm_data (0ch)208 assume ebx: PTR SAS_vm_section209 mov eax,[ebx].SAS_vm_krnl_mte ;SAS_vm_krnl_mte (0ch)210 211 pop es212 ret213 GetOS2KrnlMTE ENDP214 215 216 197 CODE32 ends 217 198 end -
trunk/src/win32k/misc/cout.cpp
r847 r1467 1 /* $Id: cout.cpp,v 1. 1 1999-09-06 02:20:02bird Exp $1 /* $Id: cout.cpp,v 1.2 1999-10-27 02:02:59 bird Exp $ 2 2 * 3 3 * cout - cout replacement. 4 4 * 5 * Note: use of cout is discurraged. 6 * 5 7 * Copyright (c) 1998-1999 knut st. osmundsen 8 * 9 * Project Odin Software License can be found in LICENSE.TXT 6 10 * 7 11 */ -
trunk/src/win32k/misc/malloc.c
r1271 r1467 1 /* $Id: malloc.c,v 1. 2 1999-10-14 01:19:21bird Exp $1 /* $Id: malloc.c,v 1.3 1999-10-27 02:03:00 bird Exp $ 2 2 * 3 3 * Heap. … … 10 10 */ 11 11 12 12 #define static 13 13 /****************************************************************************** 14 14 * Defined macros and constants … … 289 289 290 290 #ifdef RING0 291 pFree = D32Hlp_VMAlloc(VMDHA_SWAP | VMDHA_USEHIGHMEM, cbSize, ~0UL);291 pFree = D32Hlp_VMAlloc(VMDHA_SWAP, cbSize, ~0UL); 292 292 #else 293 293 if (DosAllocMem((void*)&pFree, cbSize, PAG_COMMIT | PAG_READ | PAG_WRITE) != 0) -
trunk/src/win32k/misc/vprintf.c
r1271 r1467 1 /* $Id: vprintf.c,v 1. 1 1999-10-14 01:19:22bird Exp $1 /* $Id: vprintf.c,v 1.2 1999-10-27 02:03:00 bird Exp $ 2 2 * 3 3 * vprintf and printf … … 31 31 #include <stdarg.h> 32 32 33 #include "dev32.h" 34 #include "vprintf.h" 33 35 #ifdef RING0 34 #include "dev32.h" 35 #else 36 #define SSToDS(a) (a) 36 #include <builtin.h> 37 #include "options.h" 37 38 #endif 38 #include "vprintf.h" 39 39 40 41 /******************************************************************************* 42 * Global Variables * 43 *******************************************************************************/ 44 static char chNewLine = '\n'; 45 static char chReturn = '\r'; 40 46 41 47 /******************************************************************************* … … 44 50 static int _atoi_skip(const char **ppsz); 45 51 static unsigned _strnlen(const char *psz, unsigned cchMax); 46 _Inline void chout(int ch); 52 static void chout(int ch); 53 static char * strout(char *psz, signed cchMax); 47 54 48 55 … … 162 169 #if 0 163 170 else if (!(fFlags & NTSF_LEFT) && cchWidth > 0) 164 { /* not supported! */171 { /* not yet supported! */ 165 172 /* 166 173 for (j = i-1; j >= 0; j--) … … 207 214 int vprintf(const char *pszFormat, va_list args) 208 215 { 216 #ifdef RING0 217 if (options.fQuiet) 218 return 0; 219 #else 220 int cch = 0; 221 #endif 222 209 223 while (*pszFormat != '\0') 210 224 { 211 225 if (*pszFormat == '%') 212 226 { 227 #ifndef RING0 228 if (cch > 0) 229 { 230 strout((char*)(pszFormat - cch), cch); 231 cch = 0; 232 } 233 #endif 234 213 235 pszFormat++; /* skip '%' */ 214 236 if (*pszFormat == '%') /* '%%'-> '%' */ … … 306 328 case 's': /* string */ 307 329 { 308 int i;309 330 int cchStr; 310 331 char *pszStr = va_arg(args, char*); … … 316 337 while (--cchWidth >= cchStr) 317 338 chout(' '); 318 for (i = cchStr; i > 0; i--) 319 chout(*pszStr++);339 340 pszStr = strout(pszStr, cchStr); 320 341 321 342 while (--cchWidth >= cchStr) … … 352 373 } 353 374 else 354 chout(*pszFormat++); 355 } 375 { 376 #ifdef RING0 377 chout(*pszFormat++); 378 #else 379 cch++; 380 pszFormat++; 381 #endif 382 } 383 } 384 385 #ifndef RING0 386 if (cch > 0) 387 { 388 strout((char*)(pszFormat - cch), cch); 389 cch = 0; 390 } 391 #endif 356 392 357 393 return 0UL; … … 376 412 va_list arguments; 377 413 414 #ifdef RING0 415 if (options.fQuiet) 416 return 0; 417 #endif 418 378 419 va_start(arguments, pszFormat); 379 420 cch = vprintf(pszFormat, arguments); … … 390 431 va_list arguments; 391 432 433 #ifdef RING0 434 if (options.fQuiet) 435 return 0; 436 #endif 437 392 438 va_start(arguments, pszFormat); 393 439 cch = vprintf(pszFormat, arguments); … … 402 448 int cch; 403 449 va_list arguments; 450 451 #ifdef RING0 452 if (options.fQuiet) 453 return 0; 454 #endif 404 455 405 456 va_start(arguments, pszFormat); … … 419 470 * @author knut st. osmundsen 420 471 */ 421 _Inline void chout(int ch) 422 { 423 #ifdef RING0 424 425 #else 472 static void chout(int ch) 473 { 474 #ifndef RING0 426 475 ULONG ulWrote; 427 476 #endif … … 431 480 if (ch == '\n') 432 481 { 433 static char chReturn = '\r';434 482 #ifdef RING0 435 483 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 484 _outp(options.usCom, chReturn); /* Put the char. */ 436 485 #else 437 486 DosWrite(1, (void*)&chReturn, 1, &ulWrote); … … 439 488 } 440 489 #ifdef RING0 441 490 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 491 _outp(options.usCom, ch); /* Put the char. */ 442 492 #else 443 493 DosWrite(1, (void*)&ch, 1, &ulWrote); … … 446 496 } 447 497 498 499 /** 500 * Write a string to the output device. 501 * @returns pointer end of string. 502 * @param psz Pointer to the string to write. 503 * @param cchMax Max count of chars to write. (or until '\0') 504 * @status completely implemented. 505 * @author knut st. osmundsen 506 */ 507 static char *strout(char *psz, signed cchMax) 508 { 509 while (cchMax > 0 && *psz != '\0') 510 { 511 ULONG cch = 0; 512 ULONG ul; 513 514 while (cchMax - cch > 0 && psz[cch] != '\0' && psz[cch] != '\r' && psz[cch] != '\n') 515 cch++; 516 517 /* write string part */ 518 #ifdef RING0 519 for (ul = 0; ul < cch; ul++) 520 { 521 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 522 _outp(options.usCom, psz[ul]); /* Put the char. */ 523 } 524 #else 525 DosWrite(1, (void*)psz, cch, &ul); 526 #endif 527 528 /* cr and lf check + skip */ 529 if (psz[cch] == '\n' || psz[cch] == '\r') 530 { 531 if (psz[cch] == '\n') 532 { 533 #ifdef RING0 534 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 535 _outp(options.usCom, chReturn); /* Put the char. */ 536 while (!(_inp(options.usCom + 5) & 0x20)); /* Waits for the port to be ready. */ 537 _outp(options.usCom, chNewLine); /* Put the char. */ 538 #else 539 DosWrite(1, (void*)&chReturn, 1, &ul); 540 DosWrite(1, (void*)&chNewLine, 1, &ul); 541 #endif 542 543 } 544 545 while (cchMax - cch > 0 && (psz[cch] == '\r' || psz[cch] == '\n')) 546 cch++; 547 } 548 549 /* next */ 550 psz += cch; 551 cchMax -= cch; 552 } 553 return psz; 554 } 555 -
trunk/src/win32k/misc/vsprintf.c
r1271 r1467 1 /* $Id: vsprintf.c,v 1. 2 1999-10-14 01:19:22bird Exp $1 /* $Id: vsprintf.c,v 1.3 1999-10-27 02:03:00 bird Exp $ 2 2 * 3 3 * vsprintf and sprintf … … 31 31 #include <stdarg.h> 32 32 33 #ifdef RING0 34 #include "dev32.h" 35 #else 36 #define SSToDS(a) (a) 37 #endif 33 #include "dev32.h" 38 34 #include "sprintf.h" 39 35 -
trunk/src/win32k/pe2lx/makefile
r1289 r1467 1 1 ############################################################################## 2 # $Id: makefile,v 1. 4 1999-10-14 13:20:16bird Exp $2 # $Id: makefile,v 1.5 1999-10-27 02:03:01 bird Exp $ 3 3 # 4 4 # PD-Win32 API … … 112 112 pe2lx.cpp \ 113 113 $(WIN32K_INCLUDE)\pe2lx.h \ 114 $(WIN32K_INCLUDE)\OS2Krnl.h \ 114 115 $(WIN32K_INCLUDE)\malloc.h \ 115 116 $(WIN32K_INCLUDE)\new.h … … 118 119 pe2lxmain.cpp \ 119 120 $(WIN32K_INCLUDE)\pe2lx.h \ 121 $(WIN32K_INCLUDE)\OS2Krnl.h 120 122 121 123 $(PE2LXOBJ)\malloc.$(OBJEXT): \ -
trunk/src/win32k/pe2lx/pe2lx.cpp
r1277 r1467 1 /* $Id: pe2lx.cpp,v 1. 4 1999-10-14 02:36:51 bird Exp $1 /* $Id: pe2lx.cpp,v 1.5 1999-10-27 02:03:01 bird Exp $ 2 2 * 3 3 * Pe2Lx class implementation. Ring 0 and Ring 3 … … 44 44 /* aligns something, a, up to nearest alignment boundrary- 45 45 * Note: Aligment must be a 2**n number. */ 46 47 #ifndef RING048 #define SSToDS(p) (p) /* In RING-0 this translates pointers to stack memory in the49 * Stack Segment (SS) to pointers to stack memory in the50 * Data Segment (DS). SS is 16-bit compatible, DS is 32-bit flat.51 * It is vitally important to use this macro whenever creating52 * a pointer to stack memory which don't implies that is a pointer53 * relative to SS. For example when passing the pointer to an stack54 * variable into an function call; like the addToModule calls.55 */56 #endif57 58 46 59 47 /* … … 131 119 132 120 #include "vprintf.h" /* win32k printf and vprintf. Not C library! */ 133 121 #include "dev32.h" /* 32-Bit part of the device driver. (SSToDS) */ 122 #include "OS2Krnl.h" /* kernel structs. (SFN) */ 134 123 #ifdef RING0 135 #include "dev32.h" /* 32-Bit part of the device driver. (SSToDS) */136 #include "OS2Krnl.h" /* kernel structs. (SFN) */137 124 #include "ldrCalls.h" /* _ldr* calls. (_ldrRead) */ 138 125 #endif 139 140 126 #include "pe2lx.h" /* Pe2Lx class definitions, ++. */ 141 127 #include <versionos2.h> /* Pe2Lx version. */ -
trunk/src/win32k/pe2lx/pe2lxmain.cpp
r1290 r1467 1 /* $Id: pe2lxmain.cpp,v 1. 2 1999-10-14 13:27:02bird Exp $1 /* $Id: pe2lxmain.cpp,v 1.3 1999-10-27 02:03:01 bird Exp $ 2 2 * 3 3 * Pe2Lx main program. (Ring 3 only!) … … 27 27 #include <string.h> 28 28 #include <stdlib.h> 29 #include "OS2Krnl.h" 29 30 #include "pe2lx.h" 30 31 #include <stdio.h> -
trunk/src/win32k/win32k.def
r886 r1467 4 4 ;****************************************************************************** 5 5 PHYSICAL DEVICE WIN32K 6 DESCRIPTION "$@#knut st. osmundsen:v0.5.0alpha#@Win32k - Odin32, Ring-0 part - Copyright (c) 1998-199 8knut st. osmundsen"6 DESCRIPTION "$@#knut st. osmundsen:v0.5.0alpha#@Win32k - Odin32, Ring-0 part - Copyright (c) 1998-1999 knut st. osmundsen" 7 7 8 8 CODE PRELOAD EXECUTEREAD … … 15 15 CODE16 class 'CODE' 16 16 CODE32 class 'CODE' 17 CALLTAB class ' CODE'17 CALLTAB class 'DATA' 18 18 DATA32 class 'DATA' 19 19 c_common class 'DATA'
Note:
See TracChangeset
for help on using the changeset viewer.