- Timestamp:
- Feb 25, 2000, 7:19:24 PM (26 years ago)
- Location:
- trunk/src/win32k
- Files:
-
- 4 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/Makefile
r2868 r2898 1 1 ################################################################################ 2 # $Id: Makefile,v 1.2 7 2000-02-23 09:02:19bird Exp $2 # $Id: Makefile,v 1.28 2000-02-25 18:15:01 bird Exp $ 3 3 # 4 4 # Copyright 1998-1999 knut st. osmundsen … … 34 34 LFLAGS = /nologo /MAP /NOI /NOE /NOD /A:16 /MAP /O:$@ 35 35 CDEFINES = -DWIN32K -DRING0 -D__WIN32OS2__ -D__WINE__ 36 CDEFINES16 = 36 CDEFINES16 = -DRING0 37 37 ADEFINES = -D:WIN32K 38 38 … … 56 56 CFLAGS16 = $(CFLAGS16) -Zi -Od 57 57 CPPFLAGS = $(CPPFLAGS) -O- -Ti+ 58 LFLAGS = $(LFLAGS) /NOEXEPACK /DEBUG /NODEBUG58 LFLAGS = $(LFLAGS) /NOEXEPACK /DEBUG /NODEB 59 59 ASFLAGS = $(ASFLAGS) -Od+ 60 60 CDEFINES = $(CDEFINES) -DDEBUG … … 64 64 65 65 !ifdef NODEBUGINFO 66 LFLAGS = $(LFLAGS) /NODEB 66 LFLAGS = $(LFLAGS) /NODEB /EXEPACK:2 /PACKD /PACKC 67 CFLAGS16 = $(CFLAGS16) -Owis 68 CFLAGS = $(CFLAGS) -O+ -Oi- 69 CPPFLAGS = $(CPPFLAGS) -O+ -Oi- 67 70 !endif 68 71 … … 95 98 .SUFFIXES: .obj .cpp .c .asm 96 99 97 {dev16}.c{ object}.obj:100 {dev16}.c{$(WIN32KOBJ)}.obj: 98 101 @$(ECHO) compiling 16bit: $< 99 102 @$(CC16) $(CFLAGS16) $(CDEFINES16) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES16) $< 100 103 101 {dev32}.asm{ object}.obj:104 {dev32}.asm{$(WIN32KOBJ)}.obj: 102 105 @$(ECHO) assembling: $< 103 106 @$(AS) $(ASFLAGS) $(ADEFINES) $(AINCLUDES) $< -Fo:$@ -Fl:$(WIN32KLIST)\$(*B).lst 104 {dev32}.c{ object}.obj:105 @$(ECHO) compiling 32bit: $< 106 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 107 {dev32}.cpp{ object}.obj:108 @$(ECHO) compiling 32bit: $< 109 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 110 111 {k32}.asm{ object}.obj:107 {dev32}.c{$(WIN32KOBJ)}.obj: 108 @$(ECHO) compiling 32bit: $< 109 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 110 {dev32}.cpp{$(WIN32KOBJ)}.obj: 111 @$(ECHO) compiling 32bit: $< 112 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 113 114 {k32}.asm{$(WIN32KOBJ)}.obj: 112 115 @$(ECHO) assembling: $< 113 116 @$(AS) $(ASFLAGS) $(ADEFINES) $(AINCLUDES) $< -Fo:$@ -Fl:$(WIN32KLIST)\$(*B).lst 114 {k32}.c{ object}.obj:115 @$(ECHO) compiling 32bit: $< 116 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 117 {k32}.cpp{ object}.obj:118 @$(ECHO) compiling 32bit: $< 119 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 120 121 {ldr}.asm{ object}.obj:117 {k32}.c{$(WIN32KOBJ)}.obj: 118 @$(ECHO) compiling 32bit: $< 119 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 120 {k32}.cpp{$(WIN32KOBJ)}.obj: 121 @$(ECHO) compiling 32bit: $< 122 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 123 124 {ldr}.asm{$(WIN32KOBJ)}.obj: 122 125 @$(ECHO) assembling: $< 123 126 @$(AS) $(ASFLAGS) $(ADEFINES) $(AINCLUDES) $< -Fo:$@ -Fl:$(WIN32KLIST)\$(*B).lst 124 {ldr}.c{ object}.obj:125 @$(ECHO) compiling 32bit: $< 126 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 127 {ldr}.cpp{ object}.obj:128 @$(ECHO) compiling 32bit: $< 129 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 130 131 {misc}.asm{ object}.obj:127 {ldr}.c{$(WIN32KOBJ)}.obj: 128 @$(ECHO) compiling 32bit: $< 129 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 130 {ldr}.cpp{$(WIN32KOBJ)}.obj: 131 @$(ECHO) compiling 32bit: $< 132 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 133 134 {misc}.asm{$(WIN32KOBJ)}.obj: 132 135 @$(ECHO) assembling: $< 133 136 $(AS) $(ASFLAGS) $(ADEFINES) $(AINCLUDES) $< -Fo:$@ -Fl:$(WIN32KLIST)\$(*B).lst 134 {misc}.c{ object}.obj:135 @$(ECHO) compiling 32bit: $< 136 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 137 {misc}.cpp{ object}.obj:138 @$(ECHO) compiling 32bit: $< 139 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 140 141 {pe2lx}.c{ object}.obj 32bit:137 {misc}.c{$(WIN32KOBJ)}.obj: 138 @$(ECHO) compiling 32bit: $< 139 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 140 {misc}.cpp{$(WIN32KOBJ)}.obj: 141 @$(ECHO) compiling 32bit: $< 142 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 143 144 {pe2lx}.c{$(WIN32KOBJ)}.obj 32bit: 142 145 @$(ECHO) compiling: $< 143 146 @$(CC) -c $(CFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< 144 {pe2lx}.cpp{ object}.obj:147 {pe2lx}.cpp{$(WIN32KOBJ)}.obj: 145 148 @$(ECHO) compiling 32bit: $< 146 149 @$(CC) -c $(CPPFLAGS) $(CDEFINES) -Fa$(WIN32KLIST)\$(*B).s -Fo$@ $(CINCLUDES) $< … … 159 162 # OBJECTS and LIBRARIES - Don't mess with the order or objects and libraries! 160 163 ################################################################################ 161 OBJS = object\devfirst.obj \ 162 object\d16strat.obj \ 163 object\d32hlp.obj \ 164 object\d32globals.obj \ 165 object\asmutils.obj \ 166 object\calltab.obj \ 167 object\malloc.obj \ 168 object\smalloc_avl.obj \ 169 object\avl.obj \ 170 object\rmalloc_avl.obj \ 171 object\new.obj \ 172 object\stricmp.obj \ 173 object\yield.obj \ 174 object\vsprintf.obj \ 175 object\vprintf.obj \ 176 object\ldr.obj \ 177 object\myldrClose.obj \ 178 object\myldrOpen.obj \ 179 object\myldrRead.obj \ 180 object\myLDRQAppType.obj \ 181 object\myldrEnum32bitRelRecs.obj \ 182 object\pe2lx.obj \ 183 object\ModuleBase.obj \ 184 object\d32ElfIOCtl.obj \ 185 object\d32Win32kIOCtl.obj \ 186 object\k32AllocMemEx.obj \ 187 object\buffer.obj \ 188 object\mytkExecPgm.obj 164 OBJS = $(WIN32KOBJ)\devfirst.obj \ 165 $(WIN32KOBJ)\d16strat.obj \ 166 $(WIN32KOBJ)\d32hlp.obj \ 167 $(WIN32KOBJ)\d32globals.obj \ 168 $(WIN32KOBJ)\d16globl.obj \ 169 $(WIN32KOBJ)\asmutils.obj \ 170 $(WIN32KOBJ)\calltab.obj \ 171 $(WIN32KOBJ)\malloc.obj \ 172 $(WIN32KOBJ)\smalloc_avl.obj \ 173 $(WIN32KOBJ)\avl.obj \ 174 $(WIN32KOBJ)\rmalloc_avl.obj \ 175 $(WIN32KOBJ)\new.obj \ 176 $(WIN32KOBJ)\stricmp.obj \ 177 $(WIN32KOBJ)\yield.obj \ 178 $(WIN32KOBJ)\vsprintf.obj \ 179 $(WIN32KOBJ)\vprintf.obj \ 180 $(WIN32KOBJ)\ldr.obj \ 181 $(WIN32KOBJ)\myldrClose.obj \ 182 $(WIN32KOBJ)\myldrOpen.obj \ 183 $(WIN32KOBJ)\myldrRead.obj \ 184 $(WIN32KOBJ)\myLDRQAppType.obj \ 185 $(WIN32KOBJ)\myldrEnum32bitRelRecs.obj \ 186 $(WIN32KOBJ)\pe2lx.obj \ 187 $(WIN32KOBJ)\ModuleBase.obj \ 188 $(WIN32KOBJ)\d32ElfIOCtl.obj \ 189 $(WIN32KOBJ)\d32Win32kIOCtl.obj \ 190 $(WIN32KOBJ)\k32AllocMemEx.obj \ 191 $(WIN32KOBJ)\buffer.obj \ 192 $(WIN32KOBJ)\mytkExecPgm.obj 189 193 190 194 191 195 OBJSINIT = \ 192 object\d16init.obj \ 193 object\d32init.obj \ 194 object\probkrnl.obj 196 $(WIN32KOBJ)\d16init.obj \ 197 $(WIN32KOBJ)\d32init.obj \ 198 $(WIN32KOBJ)\ProbKrnl.obj \ 199 $(WIN32KOBJ)\SymDB.obj \ 200 $(WIN32KOBJ)\vprntf16.obj 195 201 196 202 LIBS = \ … … 210 216 # SPECIAL RULES - Testing 211 217 ################################################################################ 212 ProbKrnl.exe: dev16\ProbKrnl.c $(WIN32KBASE)\include\sym.h \ 218 ProbKrnl.exe: dev16\ProbKrnl.c dev16\symdb.c dev16\vprntf16.c \ 219 $(WIN32KBASE)\include\sym.h \ 213 220 $(WIN32KBASE)\include\probKrnl.h 221 $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \ 222 -DDEBUG -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B).s \ 223 -Fo$(WIN32KOBJ)\probkrnl_p.obj $(CINCLUDES16) dev16\probkrnl.c 224 $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \ 225 -DDEBUG -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B).s \ 226 -Fo$(WIN32KOBJ)\symdb_p.obj $(CINCLUDES16) dev16\symdb.c 227 $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fa -Zi -Od -Lp \ 228 -DDEBUG -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B).s \ 229 -Fo$(WIN32KOBJ)\vprntf16_p.obj $(CINCLUDES16) dev16\vprntf16.c 230 link /NOD /MAP:FULL /CO /pmtype:vio \ 231 $(WIN32KOBJ)\probkrnl_p.obj + $(WIN32KOBJ)\symdb_p.obj + $(WIN32KOBJ)\vprntf16_p.obj, \ 232 probkrnl.exe, probkrnl.map, $(TOOLKIT)\lib\os2286.lib + $(MSCPATH)\lib\clibcep.lib; 233 234 extract.exe: dev16\ProbKrnl.c dev16\vprntf16.c \ 235 $(WIN32KBASE)\include\sym.h \ 236 $(WIN32KBASE)\include\probKrnl.h 214 237 $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \ 215 $(CDEFINES16) -DDEBUGR3 -Fa$(WIN32KLIST)\$(*B).s \ 216 -Foprobkrnl.obj $(CINCLUDES16) dev16\probkrnl.c 217 link /NOD /MAP:FULL /CO /pmtype:vio probkrnl.obj, probkrnl.exe, probkrnl.map, $(TOOLKIT)\lib\os2286.lib + $(MSCPATH)\lib\clibcep.lib; 238 -DDEBUG -DEXTRACT -Fa$(WIN32KLIST)\$(*B).s \ 239 -Fo$(WIN32KOBJ)\probkrnl_e.obj $(CINCLUDES16) dev16\probkrnl.c 240 $(CC16) -c -W4 -Asfw -G2s -Zp -Zl -nologo -Fo$@ -Fa -Zi -Od -Lp \ 241 -DDEBUG -DEXTRACT -Fa$(WIN32KLIST)\$(*B).s \ 242 -Fo$(WIN32KOBJ)\vprntf16_e.obj $(CINCLUDES16) dev16\vprntf16.c 243 link /NOD /MAP:FULL /CO /pmtype:vio \ 244 $(WIN32KOBJ)\probkrnl_e.obj + $(WIN32KOBJ)\vprntf16_e.obj, \ 245 $@, $(*B).map, $(TOOLKIT)\lib\os2286.lib + $(MSCPATH)\lib\clibcep.lib; 246 247 d32init.exe: dev32\d32init.c 248 icc -Ss /Gr+ $(CINCLUDES) -DRING3 -DDEBUGR3 -DDEBUG \ 249 -Fo$(WIN32KOBJ)\$(*B).r3obj -Fe$@ dev32\$(*B).c 218 250 219 251 … … 222 254 # Win32k.sys rule. Don't mess with the order or objects and libraries! 223 255 ################################################################################ 224 $(NAME).sys: $(OBJS) $(LIBS) last.lib $(OBJSINIT)$(LIBSINIT) $(NAME).def256 $(NAME).sys: $(OBJS) $(LIBS) last.lib init.lib $(LIBSINIT) $(NAME).def 225 257 -@$(ECHO) linking: $@ 226 258 $(LD) $(LFLAGS) @<< 227 $(OBJS) $(LIBS) last.lib $(OBJSINIT)/IG $(LIBSINIT) $(NAME).def259 $(OBJS) $(LIBS) last.lib init.lib /IG $(LIBSINIT) $(NAME).def 228 260 << 229 261 @mapsym $*.map > nul … … 247 279 $(ILIB) /nologo /nobackup /convformat $@; 248 280 249 last.lib: object\devlast.obj250 -@ del$@ > nul 2> nul281 last.lib: $(WIN32KOBJ)\devlast.obj 282 -@$(RM) $@ > nul 2> nul 251 283 $(ILIB) /nologo /nobackup $@ $**; 252 284 285 init.lib: $(OBJSINIT) 286 -@$(RM) $@ > nul 2> nul 287 $(ILIB) /nologo /nobackup $@ $**; 288 253 289 libconv.exe: libconv.c 254 icc -Q+ libconv.c290 icc -Q+ -Fe$@ -Fo$(WIN32KOBJ)\$(*B).obj libconv.c 255 291 256 292 … … 291 327 ################################################################################ 292 328 dep: 293 $(PDWIN32_TOOLS)\fastdep -o Object$(CINCLUDES) misc\*.c* ldr\*.c* dev32\*.c* \329 $(PDWIN32_TOOLS)\fastdep -o$(WIN32KOBJ) $(CINCLUDES) misc\*.c* ldr\*.c* dev32\*.c* \ 294 330 dev16\*.c* pe2lx\*.c* k32\*.c* lib\*.c include\*.h 295 $(PDWIN32_TOOLS)\fastdep -a+ -o Object$(CINCLUDES16) dev16\*.c*296 297 298 object\asmutils.obj:misc\asmutils.asm include\devsegdf.inc299 object\buffer.obj:misc\buffer.asm include\devsegdf.inc300 object\calltab.obj:ldr\calltab.asm include\devsegdf.inc301 object\mytkExecPgm.obj:ldr\mytkExecPgm.asm include\devsegdf.inc302 object\d32hlp.obj:dev32\d32hlp.asm include\devsegdf.inc303 object\devfirst.obj:dev32\devfirst.asm include\devsegdf.inc304 object\devlast.obj:dev32\devlast.asm include\devsegdf.inc331 $(PDWIN32_TOOLS)\fastdep -a+ -o$(WIN32KOBJ) $(CINCLUDES16) dev16\*.c* 332 333 334 $(WIN32KOBJ)\asmutils.obj: misc\asmutils.asm include\devsegdf.inc 335 $(WIN32KOBJ)\buffer.obj: misc\buffer.asm include\devsegdf.inc 336 $(WIN32KOBJ)\calltab.obj: ldr\calltab.asm include\devsegdf.inc 337 $(WIN32KOBJ)\mytkExecPgm.obj: ldr\mytkExecPgm.asm include\devsegdf.inc 338 $(WIN32KOBJ)\d32hlp.obj: dev32\d32hlp.asm include\devsegdf.inc 339 $(WIN32KOBJ)\devfirst.obj: dev32\devfirst.asm include\devsegdf.inc 340 $(WIN32KOBJ)\devlast.obj: dev32\devlast.asm include\devsegdf.inc 305 341 306 342 !ifndef NODEP -
trunk/src/win32k/dev16/d16init.c
r2836 r2898 1 /* $Id: d16init.c,v 1. 5 2000-02-21 04:45:45bird Exp $1 /* $Id: d16init.c,v 1.6 2000-02-25 18:15:02 bird Exp $ 2 2 * 3 3 * d16init - init routines for both drivers. … … 21 21 #define INCL_DOSERRORS 22 22 #define INCL_NOPMAPI 23 23 24 24 25 /******************************************************************************* -
trunk/src/win32k/dev16/d16strat.c
r2877 r2898 1 /* $Id: d16strat.c,v 1. 7 2000-02-23 20:10:19bird Exp $1 /* $Id: d16strat.c,v 1.8 2000-02-25 18:15:02 bird Exp $ 2 2 * 3 3 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr) … … 64 64 }; 65 65 66 /* Note: All global variables must be initialized! *67 * Uninitialized variables ends up in DATA32. */68 PFN Device_Help = NULL;69 ULONG TKSSBase16 = 0;70 USHORT R0FlatCS16 = 0;71 USHORT R0FlatDS16 = 0;72 BOOL fInitTime = TRUE;73 66 74 67 … … 129 122 { 130 123 USHORT rc; 124 131 125 if (pRp->Category == D16_IOCTL_CAT) 132 126 { 133 127 switch (pRp->Function) 134 128 { 129 /* 130 * This is the IOCtl which does the R0-initiation of the device driver. 131 * Only available at init time... 132 */ 135 133 case D16_IOCTL_RING0INIT: 136 134 if (fInitTime) … … 142 140 break; 143 141 144 case D16_IOCTL_GETKRNLOTES: 142 /* 143 * This is the IOCtl collects info of the running kernel. 144 * Only available at init time. 145 * 146 * Since this IOCtl is issued before R0-Init is done, we'll have to 147 * init TKSSBase for both 16-bit and 32-bit code and be a bit carefull. 148 */ 149 case D16_IOCTL_GETKRNLINFO: 145 150 if (fInitTime) 146 151 { … … 151 156 &ulLin) != NO_ERROR) 152 157 return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER; 153 return CallGet OTEs32(ulLin);158 return CallGetKernelInfo32(ulLin); 154 159 } 155 160 break; 156 161 157 case D16_IOCTL_VERIFYPROCTAB: 162 /* 163 * This is the IOCtl verifies the data in the ImportTab. 164 * Only available at init time. 165 * 166 * Since this IOCtl is issued before R0-Init is done, we'll have to 167 * init TKSSBase for both 16-bit and 32-bit code and be a bit carefull. 168 */ 169 case D16_IOCTL_VERIFYIMPORTTAB: 158 170 if (fInitTime) 159 171 { -
trunk/src/win32k/dev16/probkrnl.c
r2848 r2898 1 /* $Id: probkrnl.c,v 1.1 5 2000-02-21 14:53:38bird Exp $1 /* $Id: probkrnl.c,v 1.16 2000-02-25 18:15:02 bird Exp $ 2 2 * 3 3 * Description: Autoprobes the os2krnl file and os2krnl[*].sym files. … … 30 30 * Defined Constants And Macros * 31 31 *******************************************************************************/ 32 #ifdef DEBUGR3 33 #if 1 34 int printf(const char *, ...); 35 #define dprintf(a) printf a 36 #else 37 #define dprintf(a) 38 #endif 39 #else 40 #define dprintf(a) 41 #define static 32 /* Disable logging when doing extracts */ 33 #if defined(EXTRACT) || defined(RING0) 34 #define NOLOGGING 1 42 35 #endif 43 36 … … 72 65 #include "dev16.h" 73 66 #include "dev1632.h" 67 #include "vprntf16.h" 68 #include "log.h" 74 69 75 70 … … 111 106 }; 112 107 113 unsigned long int ulBuild = 0;108 unsigned short int usBuild = 0; 114 109 unsigned short usVerMajor = 0; 115 110 unsigned short usVerMinor = 0; 111 unsigned char fSMP = FALSE; 112 unsigned char fDebug = FALSE; 116 113 117 114 … … 144 141 }; 145 142 146 static KRNLOBJTABLE KrnlOTEs = {0}; 147 148 /* messages */ 149 static char szBanner[] = "Win32k - Odin32 support driver."; 150 static char szMsg1[] = "\n\r Found kernel: "; 151 static char szMsg1a[] = "\n\r Build: "; 152 static char szMsg2[] = "\n\r Found symbolfile: "; 153 static char szMsg4[] = "\n\r Failed to find symbolfile!\n\r"; 154 static char szMsgfailed[]= "failed! "; 143 /* Result from GetKernelInfo/ReadOS2Krnl. */ 144 static unsigned char cObjects = 0; 145 static POTE paKrnlOTEs = NULL; 146 155 147 156 148 … … 172 164 static int kstrnicmp(const char *psz1, const char *psz2, int cch); 173 165 static int kstrlen(const char *psz); 166 static char * kstrcpy(char * pszTarget, const char * pszSource); 174 167 static int kargncpy(char *pszTarget, const char *pszArg, unsigned cchMaxlen); 175 168 176 169 /* Workers */ 170 static int LookupKrnlEntry(unsigned uBuild, unsigned char chType, 171 unsigned char fSMP, unsigned char cObjects); 177 172 static int VerifyPrologs(void); 178 static int ProbeSymFile(char *pszFilename); 179 static int VerifyKernelVer(void); 180 static int ReadOS2Krnl(char *pszFilename); 181 static int ReadOS2Krnl2(HFILE hKrnl, unsigned long cbKrnl); 182 static int GetKernelOTEs(void); 173 static int ProbeSymFile(const char *pszFilename); 174 static int GetKernelInfo(void); 183 175 184 176 /* Ouput */ … … 186 178 static void ShowHexNumber(unsigned long ul); 187 179 static void ShowResult(int rc, int iSym); 180 181 /* Others used while debugging in R3. */ 182 static int VerifyKernelVer(void); 183 static int ReadOS2Krnl(char *pszFilename); 184 static int ReadOS2Krnl2(HFILE hKrnl, unsigned long cbKrnl); 185 static int processFile(const char *pszFilename); 188 186 189 187 … … 409 407 410 408 /** 409 * String copy (strcpy). 410 * @returns Pointer to target string. 411 * @param pszTarget Target string. 412 * @param pszSource Source string. 413 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 414 */ 415 static char * kstrcpy(char * pszTarget, register const char * pszSource) 416 { 417 register char *psz = pszTarget; 418 419 while (*pszSource != '\0') 420 *psz++ = *pszSource++; 421 422 return pszTarget; 423 } 424 425 426 427 428 /** 411 429 * Copy an argument to a buffer. Ie. "-K[=|:]c:\os2krnl ....". Supports quotes 412 430 * @returns Number of chars of pszArg that has been processed. … … 465 483 * Implementation Of The Important Functions * 466 484 *******************************************************************************/ 485 #ifndef EXTRACT 486 /** 487 * Checks if this kernel is within the kernel symbol database. 488 * If an entry for the kernel is found, the data is copied from the 489 * database entry to aImportTab. 490 * @returns NO_ERROR on succes (0) 491 * 1 if not found. 492 * Error code on error. 493 * @param uBuild Build level. 494 * @param chType 'A' all strict 495 * 'H' half strict 496 * 'R' retail 497 * @param fSMP TRUE: SMP 498 * FALSE: UNI 499 * @param cObjects Count of object in the running kernel. 500 * @sketch Loop thru the table. 501 * @status completely implemented. 502 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 503 */ 504 static int LookupKrnlEntry(unsigned uBuild, unsigned char chType, unsigned char fSMP, unsigned char cObjects) 505 { 506 int i; 507 508 /* 509 * Loop tru the DB entries until a NULL pointer is found. 510 */ 511 for (i = 0; aKrnlSymDB[i].usBuild != 0; i++) 512 { 513 if (aKrnlSymDB[i].usBuild == uBuild 514 && aKrnlSymDB[i].chType == chType 515 && aKrnlSymDB[i].fSMP == fSMP 516 && aKrnlSymDB[i].cObjects == cObjects) 517 { /* found matching entry! */ 518 int j; 519 int rc; 520 register PKRNLDBENTRY pEntry = &aKrnlSymDB[i]; 521 522 dprintf(("LookUpKrnlEntry - found entry for this kernel!\n")); 523 524 /* 525 * Copy symbol data from the DB to aImportTab. 526 */ 527 for (j = 0; j < NBR_OF_KRNLIMPORTS; j++) 528 { 529 aImportTab[j].offObject = pEntry->aSyms[j].offObject; 530 aImportTab[j].iObject = pEntry->aSyms[j].iObject; 531 aImportTab[j].ulAddress = paKrnlOTEs[pEntry->aSyms[j].iObject].ote_base 532 + pEntry->aSyms[j].offObject; 533 aImportTab[j].usSel = paKrnlOTEs[pEntry->aSyms[j].iObject].ote_sel; 534 aImportTab[j].fFound = TRUE; 535 dprintf((" %-3d addr=0x%08lx off=0x%08lx %s\n", 536 j, aImportTab[j].ulAddress, aImportTab[j].offObject, 537 aImportTab[j].achName)); 538 } 539 540 /* Verify prologs*/ 541 rc = VerifyPrologs(); 542 543 /* set sym name */ 544 if (rc == 0) 545 kstrcpy(szUsrSym, "Win32k Symbol Database"); 546 return rc; 547 } 548 } 549 550 /* not found */ 551 return 1; 552 } 553 #endif /* !EXTRACT */ 467 554 468 555 /** … … 473 560 static int VerifyPrologs(void) 474 561 { 475 #if ndef DEBUGR3562 #if !defined(DEBUGR3) && !defined(EXTRACT) 476 563 APIRET rc; 477 564 HFILE hDev0 = 0; … … 484 571 if (rc == NO_ERROR) 485 572 { 486 rc = DosDevIOCtl("", "", D16_IOCTL_VERIFY PROCTAB, D16_IOCTL_CAT, hDev0);573 rc = DosDevIOCtl("", "", D16_IOCTL_VERIFYIMPORTTAB, D16_IOCTL_CAT, hDev0); 487 574 DosClose(hDev0); 488 575 } … … 502 589 * @remark Error codes starts at -50. 503 590 */ 504 static int ProbeSymFile(c har * pszFilename)591 static int ProbeSymFile(const char * pszFilename) 505 592 { 506 593 HFILE hSym; /* Filehandle */ … … 565 652 * Verify that the number of segments is equal to the number objects in OS2KRNL. 566 653 */ 567 if (MapDef.cSegs != KrnlOTEs.cObjects) 654 #ifndef EXTRACT 655 if (MapDef.cSegs != cObjects) 568 656 { /* incorrect count of segments. */ 569 657 dprintf(("Segment No. verify failed\n")); … … 571 659 return -52; 572 660 } 661 #endif /* !EXTRACT */ 573 662 574 663 … … 577 666 */ 578 667 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 668 { 579 669 aImportTab[i].fFound = 0; 670 #ifdef DEBUG 671 aImportTab[i].offObject = 0; 672 aImportTab[i].ulAddress = 0; 673 aImportTab[i].usSel = 0; 674 #endif 675 } 580 676 581 677 … … 697 793 { /* Symbol was found */ 698 794 aImportTab[i].offObject = (SegDef.bFlags & 0x01 ? SymDef32.wSymVal : SymDef16.wSymVal); 699 aImportTab[i].ulAddress = aImportTab[i].offObject + KrnlOTEs.aObjects[iSeg].ote_base;795 aImportTab[i].ulAddress = aImportTab[i].offObject + paKrnlOTEs[iSeg].ote_base; 700 796 aImportTab[i].iObject = (unsigned char)iSeg; 701 aImportTab[i].usSel = KrnlOTEs.aObjects[iSeg].ote_sel; 797 aImportTab[i].usSel = paKrnlOTEs[iSeg].ote_sel; 798 dprintf(("debug: base=%lx, size=%lx iSeg=%d\n", paKrnlOTEs[iSeg].ote_base, paKrnlOTEs[iSeg].ote_size, iSeg)); 702 799 703 800 /* Paranoia test! */ 704 if (aImportTab[i].offObject < KrnlOTEs.aObjects[iSeg].ote_size) 801 #ifndef EXTRACT 802 if (aImportTab[i].offObject < paKrnlOTEs[iSeg].ote_size) 705 803 { 706 804 aImportTab[i].fFound = TRUE; … … 712 810 else/* test failed, continue on next symbol*/ 713 811 dprintf(("Error: Paranoia test failed for %s\n", aImportTab[i].achName));; 812 #else 813 aImportTab[i].fFound = TRUE; 814 cLeftToFind--; 815 #endif /* !EXTRACT */ 714 816 break; 715 817 } … … 740 842 741 843 /** 742 * Verifies that build no, matches kernel number.743 * @returns 0 on equal, !0 on error.744 */745 static int VerifyKernelVer(void)746 {747 int VerMinor, VerMajor;748 749 VerMajor = ulBuild < 20000 ? 20 : 30/*?*/;750 VerMinor = ulBuild < 6600 ? 10 : ulBuild < 8000 ? 11 : ulBuild < 9000 ? 30 :751 ulBuild < 10000 ? 40 : ulBuild < 15000 ? 45 : 50;752 753 return VerMajor - (int)usVerMajor | VerMinor - (int)usVerMinor;754 }755 756 757 /**758 * Reads and verifies OS/2 kernel.759 * @returns 0 on success, not 0 on failure.760 * @param filename Filename of the OS/2 kernel.761 * @result ulBuild is set.762 * @remark This step will be eliminated by searching thru the DOSGROUP datasegment763 * in the kernel memory. This segment have a string "Internal revision 9.034[smp|uni]"764 * This would be much faster than reading the kernel file. It will also give us a more precise765 * answer to the question! This is currently a TODO issue. !FIXME!766 */767 static int ReadOS2Krnl(char * pszFilename)768 {769 HFILE hKrnl;770 unsigned long cbKrnl;771 int rc;772 773 hKrnl = fopen(pszFilename, "rb");774 if (hKrnl != 0)775 {776 cbKrnl = fsize(hKrnl);777 if (!fseek(hKrnl, 0, SEEK_SET))778 rc = ReadOS2Krnl2(hKrnl, cbKrnl);779 else780 rc = -2;781 fclose(hKrnl);782 }783 else784 {785 dprintf(("Could not open file\n"));786 rc = -1;787 }788 return rc;789 }790 791 /**792 * Worker function for ReadOS2Krnl793 * @returns 0 on success.794 * errorcodes on failure. (-1 >= rc >= -14)795 * @param hKrnl Handle to the kernel file.796 * @param cbKrnl Size of the kernel file.797 * @author knut st. osmundsen798 */799 static int ReadOS2Krnl2(HFILE hKrnl, unsigned long cbKrnl)800 {801 int i, j;802 int rc = 0;803 char achBuffer[KERNEL_ID_STRING_LENGTH + KERNEL_READ_SIZE];804 unsigned long offLXHdr;805 struct e32_exe *pLXHdr;806 807 808 /* find bldlevel string - "@#IBM:14.020#@ IBM OS/2 Kernel - 14.020F" */809 if (fseek(hKrnl, 0, SEEK_SET))810 return -2;811 812 if (!fread(&achBuffer[KERNEL_ID_STRING_LENGTH], 1, KERNEL_READ_SIZE, hKrnl))813 return -3;814 815 i = KERNEL_ID_STRING_LENGTH;816 while (cbKrnl > 0)817 {818 if (i == KERNEL_READ_SIZE)819 {820 821 kmemcpy(achBuffer, &achBuffer[KERNEL_READ_SIZE], KERNEL_ID_STRING_LENGTH);822 if (!fread(&achBuffer[KERNEL_ID_STRING_LENGTH], 1, cbKrnl > KERNEL_READ_SIZE ? KERNEL_READ_SIZE : (int)cbKrnl, hKrnl))823 return -3;824 825 i = 0;826 }827 828 if (kstrncmp("@#IBM:", &achBuffer[i], 6) == 0)829 break;830 831 /* next */832 i++;833 cbKrnl--;834 }835 836 if (cbKrnl == 0)837 {838 fclose(hKrnl);839 return -4;840 }841 842 /* displacement */843 j = 0;844 while (j < 6 && achBuffer[i+10+j] != '#')845 j++;846 847 /* verify signature */848 if (kstrncmp(&achBuffer[i+10+j], "#@ IBM OS/2 Kernel", 19) != 0)849 return -5;850 851 /* read ulBuild */852 ulBuild = (char)(achBuffer[i+6] - '0') * 1000;853 if (achBuffer[i+7] != '.')854 {855 /* this code is for Warp5 */856 ulBuild *= 10;857 ulBuild += (char)(achBuffer[i+7] - '0') * 1000;858 i++;859 j--;860 if (achBuffer[i+7] != '.')861 {862 ulBuild = ulBuild * 10;863 ulBuild = ulBuild + (unsigned long)(achBuffer[i+7] - '0') * 1000;864 i++;865 j--;866 }867 }868 869 if (j == 0)870 {871 ulBuild += (achBuffer[i+ 8] - '0') * 10;872 ulBuild += (achBuffer[i+ 9] - '0') * 1;873 } else874 {875 if (j == 3)876 return -9;877 ulBuild += (achBuffer[i+ 8] - '0') * 100;878 ulBuild += (achBuffer[i+ 9] - '0') * 10;879 ulBuild += (achBuffer[i+10] - '0');880 }881 882 if (VerifyKernelVer())883 return -9;884 dprintf(("ulBuild: %d\n",ulBuild));885 886 /* get segment number */887 /* read-MZheader */888 if (fseek(hKrnl,0,SEEK_SET))889 return -2;890 891 if (!fread(achBuffer, 1, 0x40, hKrnl))892 return -3;893 894 offLXHdr = *(unsigned long int *)&achBuffer[0x3c];895 896 if (offLXHdr > 0x2000 && offLXHdr < 0x80) /* just to detect garbage */897 return -6;898 899 if (fseek(hKrnl, offLXHdr, SEEK_SET))900 return -2;901 902 if (!fread(achBuffer, 1, sizeof(struct e32_exe), hKrnl))903 return -3;904 905 /* check LX-magic */906 if (achBuffer[0] != 'L' || achBuffer[1] != 'X')907 return -7;908 909 #ifndef DEBUGR3910 /* check object count - match it with what we got from the kernel. */911 pLXHdr = (struct e32_exe *)achBuffer;912 if ((UCHAR)pLXHdr->e32_objcnt != KrnlOTEs.cObjects)913 return -8;914 915 if (pLXHdr->e32_objcnt < 10)916 return -9;917 918 /* check objects (sizes and flags(?)) */919 if (!fseek(hKrnl, (LONG)offLXHdr + (LONG)pLXHdr->e32_objtab, SEEK_SET))920 {921 struct o32_obj *pObj = (struct o32_obj *)achBuffer;922 for (i = 0; i < (int)KrnlOTEs.cObjects; i++)923 {924 if (!fread(achBuffer, 1, sizeof(OTE), hKrnl))925 return -11;926 if (pObj->o32_size < KrnlOTEs.aObjects[i].ote_size)927 return -12;928 929 #if 0 /* don't work! */930 if ((pObj->o32_flags & 0xffffUL) != (KrnlOTEs.aObjects[i].ote_flags & 0xffffUL))931 return -14;932 #endif933 }934 }935 else936 return -10;937 #else938 /* Since we can't get the OTEs from the kernel when debugging in RING-3,939 * we'll use what we find in the kernel.940 */941 942 /* object count */943 pLXHdr = (struct e32_exe *)achBuffer;944 KrnlOTEs.cObjects = (UCHAR)pLXHdr->e32_objcnt;945 946 /* get OTEs */947 if (!fseek(hKrnl, (LONG)offLXHdr + (LONG)pLXHdr->e32_objtab, SEEK_SET))948 {949 struct o32_obj *pObj = (struct o32_obj *)achBuffer;950 for (i = 0; i < (int)KrnlOTEs.cObjects; i++)951 if (!fread(&KrnlOTEs.aObjects[i], 1, sizeof(struct o32_obj), hKrnl))952 return -11;953 }954 else955 return -10;956 #endif957 958 return 0;959 }960 961 962 /**963 844 * Gets the os/2 kernel OTE's (object table entries). 964 845 * @returns 0 on success. Not 0 on error. 965 846 */ 966 static int GetKernelOTEs(void) 967 { 968 #ifndef DEBUGR3 847 static int GetKernelInfo(void) 848 { 849 #if !defined(DEBUGR3) && !defined(EXTRACT) /* IOCtl not available after inittime! */ 850 static KRNLINFO KrnlInfo = {0}; 969 851 APIRET rc; 970 852 HFILE hDev0 = 0; … … 977 859 if (rc == NO_ERROR) 978 860 { 979 rc = DosDevIOCtl(&KrnlOTEs, "", D16_IOCTL_GETKRNLOTES, D16_IOCTL_CAT, hDev0); 861 rc = DosDevIOCtl(&KrnlInfo, "", D16_IOCTL_GETKRNLINFO, D16_IOCTL_CAT, hDev0); 862 if (rc == NO_ERROR) 863 { 864 int i; 865 866 /* Set the exported parameters */ 867 usBuild = KrnlInfo.usBuild; 868 fSMP = KrnlInfo.fSMP; 869 fDebug = KrnlInfo.fDebug; 870 cObjects = KrnlInfo.cObjects; 871 paKrnlOTEs = &KrnlInfo.aObjects[0]; 872 #ifdef DEBUG 873 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 874 dprintf(("debug: no.%2d base=%lx size=%lx sel=%x\n", 875 i, 876 paKrnlOTEs[i].ote_base, 877 paKrnlOTEs[i].ote_size, 878 paKrnlOTEs[i].ote_sel)); 879 #endif 880 881 } 980 882 DosClose(hDev0); 981 883 } 982 884 983 885 if (rc != NO_ERROR) 984 p uts("Failed to get kernel OTEs\r\n");886 printf16("Failed to get kernel OTEs\r\n"); 985 887 986 888 return rc; 889 987 890 #else 988 KrnlOTEs.cObjects = 23; 989 return 0; 891 #ifndef EXTRACT 892 APIRET rc; 893 894 /*--------------*/ 895 /* read kernel */ 896 /*--------------*/ 897 if (szUsrOS2Krnl[0] != '\0') 898 { 899 rc = ReadOS2Krnl(szUsrOS2Krnl); 900 if (rc != 0) 901 { 902 puts("Warning: Invalid kernel file specified. Tries defaults.\n\r"); 903 szUsrOS2Krnl[0] = '\0'; 904 rc = ReadOS2Krnl(szOS2Krnl); 905 } 906 } 907 else 908 rc = ReadOS2Krnl(szOS2Krnl); 909 return rc; 910 #else 911 return 0; 912 #endif 990 913 #endif 991 914 } 992 993 994 /**995 * Displays an ULONG in decimal notation using DosPutMessage996 * @param n ULONG to show.997 */998 static void ShowDecNumber(unsigned long n)999 {1000 int f = 0;1001 unsigned long div;1002 char sif;1003 1004 for (div = 1000000; div > 0; div /= 10)1005 {1006 sif = (char)(n/div);1007 n %= div;1008 if (sif != 0 || f)1009 {1010 f = 1;1011 sif += '0';1012 DosPutMessage(0, 1, &sif);1013 }1014 }1015 }1016 1017 1018 /**1019 * Displays an ULONG in hexadecimal notation using DosPutMessage1020 * @param n ULONG to show.1021 */1022 static void ShowHexNumber(unsigned long int n)1023 {1024 signed int div;1025 char sif;1026 DosPutMessage(0, 2, "0x");1027 for (div = 28; div >= 0; div -= 4)1028 {1029 sif = (char)(n >> div) & (char)0xF;1030 sif += (sif < 10 ? '0' : 'a' - 10);1031 DosPutMessage(0, 1, &sif);1032 }1033 }1034 1035 915 1036 916 … … 1040 920 * @param iSym index of .sym-file into static struct. 1041 921 */ 922 #ifndef EXTRACT 1042 923 static void ShowResult(int rc, int iSym) 1043 924 { 1044 int i, j; 1045 1046 /* complain even if quiet on error */ 925 int i; 926 927 /* 928 * Complain even if quiet on error 929 */ 1047 930 if (!fQuiet || rc != 0) 1048 931 { 1049 puts(szBanner); 1050 1051 /* kernel stuff */ 1052 puts(szMsg1); 932 printf16("Win32k - Odin32 support driver.\n"); 933 934 /* 935 * kernel stuff 936 */ 1053 937 if (rc <= -50 || rc == 0) 1054 938 { 1055 puts(szOS2Krnl); 1056 puts(szMsg1a); 1057 ShowDecNumber(ulBuild); 1058 puts(" - v"); 1059 ShowDecNumber(usVerMajor); 1060 puts("."); 1061 ShowDecNumber(usVerMinor); 939 #ifdef DEBUGR3 940 printf16(" Found kernel: %s\n", szOS2Krnl); 941 #endif 942 printf16(" Build: %d - v%d.%d\n", 943 usBuild, usVerMajor, usVerMinor); 1062 944 } 1063 945 else 1064 puts(szMsgfailed); 1065 1066 /* functions */ 946 printf16(" Kernel probing failed with rc=%d.\n", rc); 947 948 /* 949 * symbol-file 950 */ 1067 951 if (rc == 0) 952 printf16(" Found symbolfile: %s\n", 953 szUsrSym[0] == '\0' ? apszSym[iSym] : szUsrSym); 954 else 955 printf16(" Failed to find symbolfile! rc=%d\n", rc); 956 957 /* 958 * function listing 959 */ 960 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 1068 961 { 1069 p uts(szMsg2);1070 if ( szUsrSym[0] == '\0')1071 p uts(apszSym[iSym]);962 printf16(" %-20s at ",aImportTab[i].achName); 963 if (aImportTab[i].fFound) 964 printf16("0x%08lx%s", aImportTab[i].ulAddress, (i % 2) == 0 ? "" : "\n"); 1072 965 else 1073 puts(szUsrSym); 1074 1075 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 1076 { 1077 if ((i % 2) == 0) 1078 puts("\n\r "); 1079 else 1080 puts(" "); 1081 puts(aImportTab[i].achName); 1082 for (j = aImportTab[i].cchName; j < 20; j++) 1083 puts(" "); 1084 1085 puts(" at "); 1086 if (aImportTab[i].fFound) 1087 ShowHexNumber(aImportTab[i].ulAddress); 1088 else 1089 puts(szMsgfailed); 1090 } 966 printf16("failed!%s", (i % 2) == 0 ? "" : "\n"); 1091 967 } 1092 else 1093 puts(szMsg4); 1094 puts("\n\r"); 1095 } 1096 1097 /* if error: write rc */ 1098 if (rc != 0) 1099 { 1100 puts("rc = "); 1101 ShowHexNumber((unsigned long)rc); 1102 puts("\n\r"); 1103 } 1104 } 1105 968 if (i % 2) printf16("\n"); 969 } 970 } 1106 971 1107 972 … … 1187 1052 1188 1053 /*-----------------*/ 1189 /* get kernel OTEs*/1054 /* get kernel info */ 1190 1055 /*-----------------*/ 1191 rc = GetKernel OTEs();1056 rc = GetKernelInfo(); 1192 1057 if (rc != NO_ERROR) 1193 1058 return rc; 1194 1195 /*--------------*/1196 /* read kernel */1197 /*--------------*/1198 if (szUsrOS2Krnl[0] != '\0')1199 {1200 rc = ReadOS2Krnl(szUsrOS2Krnl);1201 if (rc != 0)1202 {1203 puts("Warning: Invalid kernel file specified. Tries defaults.\n\r");1204 szUsrOS2Krnl[0] = '\0';1205 rc = ReadOS2Krnl(szOS2Krnl);1206 }1207 }1208 else1209 rc = ReadOS2Krnl(szOS2Krnl);1210 1059 1211 1060 /*--------------*/ … … 1224 1073 } 1225 1074 } 1226 if (rc != 0) /* if user sym failed or don't exists */1075 if (rc != 0) /* if user sym failed or don't exists. */ 1227 1076 { 1228 i = 0; 1229 while (apszSym[i] != NULL && (rc = ProbeSymFile(apszSym[i])) != 0) 1230 i++; 1077 /* 1078 * Check database - only if not a debug kernel! 1079 * You usually have a .sym-file when using a debug kernel. 1080 * (Currently I am not able to distinguish between half and all strict kernels...) 1081 */ 1082 if (fDebug || 1083 (rc = LookupKrnlEntry((unsigned short)usBuild, 'R', fSMP, cObjects)) != 0 1084 ) 1085 { 1086 /* search on disk */ 1087 i = 0; 1088 while (apszSym[i] != NULL && (rc = ProbeSymFile(apszSym[i])) != 0) 1089 i++; 1090 } 1231 1091 } 1232 1092 } … … 1238 1098 return rc; 1239 1099 } 1240 1100 #endif 1241 1101 1242 1102 1243 1103 #ifdef DEBUGR3 1104 /** 1105 * Verifies that build no, matches kernel number. 1106 * @returns 0 on equal, !0 on error. 1107 */ 1108 static int VerifyKernelVer(void) 1109 { 1110 int VerMinor, VerMajor; 1111 1112 VerMajor = usBuild < 20000 ? 20 : 30/*?*/; 1113 VerMinor = usBuild < 6600 ? 10 : usBuild < 8000 ? 11 : usBuild < 9000 ? 30 : 1114 usBuild < 10000 ? 40 : usBuild < 15000 ? 45 : 50; 1115 1116 return VerMajor - (int)usVerMajor | VerMinor - (int)usVerMinor; 1117 } 1118 1119 1120 /** 1121 * Reads and verifies OS/2 kernel. 1122 * @returns 0 on success, not 0 on failure. 1123 * @param filename Filename of the OS/2 kernel. 1124 * @result usBuild is set. 1125 * @remark This step will be eliminated by searching thru the DOSGROUP datasegment 1126 * in the kernel memory. This segment have a string "Internal revision 9.034[smp|uni]" 1127 * This would be much faster than reading the kernel file. It will also give us a more precise 1128 * answer to the question! This is currently a TODO issue. !FIXME! 1129 */ 1130 static int ReadOS2Krnl(char * pszFilename) 1131 { 1132 HFILE hKrnl; 1133 unsigned long cbKrnl; 1134 int rc; 1135 1136 hKrnl = fopen(pszFilename, "rb"); 1137 if (hKrnl != 0) 1138 { 1139 cbKrnl = fsize(hKrnl); 1140 if (!fseek(hKrnl, 0, SEEK_SET)) 1141 rc = ReadOS2Krnl2(hKrnl, cbKrnl); 1142 else 1143 rc = -2; 1144 fclose(hKrnl); 1145 } 1146 else 1147 { 1148 dprintf(("Could not open file\n")); 1149 rc = -1; 1150 } 1151 return rc; 1152 } 1153 1154 1155 /** 1156 * Worker function for ReadOS2Krnl 1157 * @returns 0 on success. 1158 * errorcodes on failure. (-1 >= rc >= -14) 1159 * @param hKrnl Handle to the kernel file. 1160 * @param cbKrnl Size of the kernel file. 1161 * @author knut st. osmundsen 1162 */ 1163 static int ReadOS2Krnl2(HFILE hKrnl, unsigned long cbKrnl) 1164 { 1165 #if defined(DEBUGR3) || !defined(EXTRACT) 1166 static KRNLINFO KrnlInfo = {0}; 1167 #endif 1168 int i, j; 1169 int rc = 0; 1170 char achBuffer[KERNEL_ID_STRING_LENGTH + KERNEL_READ_SIZE]; 1171 unsigned long offLXHdr; 1172 struct e32_exe *pLXHdr; 1173 1174 1175 /* find bldlevel string - "@#IBM:14.020#@ IBM OS/2 Kernel - 14.020F" */ 1176 if (fseek(hKrnl, 0, SEEK_SET)) 1177 return -2; 1178 1179 if (!fread(&achBuffer[KERNEL_ID_STRING_LENGTH], 1, KERNEL_READ_SIZE, hKrnl)) 1180 return -3; 1181 1182 i = KERNEL_ID_STRING_LENGTH; 1183 while (cbKrnl > 0) 1184 { 1185 if (i == KERNEL_READ_SIZE) 1186 { 1187 1188 kmemcpy(achBuffer, &achBuffer[KERNEL_READ_SIZE], KERNEL_ID_STRING_LENGTH); 1189 if (!fread(&achBuffer[KERNEL_ID_STRING_LENGTH], 1, cbKrnl > KERNEL_READ_SIZE ? KERNEL_READ_SIZE : (int)cbKrnl, hKrnl)) 1190 return -3; 1191 1192 i = 0; 1193 } 1194 1195 if (kstrncmp("@#IBM:", &achBuffer[i], 6) == 0) 1196 break; 1197 1198 /* next */ 1199 i++; 1200 cbKrnl--; 1201 } 1202 1203 if (cbKrnl == 0) 1204 { 1205 fclose(hKrnl); 1206 return -4; 1207 } 1208 1209 /* displacement */ 1210 j = 0; 1211 while (j < 6 && achBuffer[i+10+j] != '#') 1212 j++; 1213 1214 /* verify signature */ 1215 if (kstrncmp(&achBuffer[i+10+j], "#@ IBM OS/2 Kernel", 19) != 0) 1216 return -5; 1217 1218 /* read usBuild */ 1219 usBuild = (char)(achBuffer[i+6] - '0') * 1000; 1220 if (achBuffer[i+7] != '.') 1221 { 1222 /* this code is for Warp5 */ 1223 usBuild *= 10; 1224 usBuild += (char)(achBuffer[i+7] - '0') * 1000; 1225 i++; 1226 j--; 1227 if (achBuffer[i+7] != '.') 1228 { 1229 usBuild = usBuild * 10; 1230 usBuild = usBuild + (unsigned short)(achBuffer[i+7] - '0') * 1000; 1231 i++; 1232 j--; 1233 } 1234 } 1235 1236 if (j == 0) 1237 { 1238 usBuild += (achBuffer[i+ 8] - '0') * 10; 1239 usBuild += (achBuffer[i+ 9] - '0') * 1; 1240 } 1241 else 1242 { 1243 if (j == 3) 1244 return -9; 1245 usBuild += (achBuffer[i+ 8] - '0') * 100; 1246 usBuild += (achBuffer[i+ 9] - '0') * 10; 1247 usBuild += (achBuffer[i+10] - '0'); 1248 } 1249 1250 if (VerifyKernelVer()) 1251 return -9; 1252 dprintf(("usBuild: %d\n", usBuild)); 1253 1254 /* get segment number */ 1255 /* read-MZheader */ 1256 if (fseek(hKrnl,0,SEEK_SET)) 1257 return -2; 1258 1259 if (!fread(achBuffer, 1, 0x40, hKrnl)) 1260 return -3; 1261 1262 offLXHdr = *(unsigned long int *)&achBuffer[0x3c]; 1263 1264 if (offLXHdr > 0x2000 && offLXHdr < 0x80) /* just to detect garbage */ 1265 return -6; 1266 1267 if (fseek(hKrnl, offLXHdr, SEEK_SET)) 1268 return -2; 1269 1270 if (!fread(achBuffer, 1, sizeof(struct e32_exe), hKrnl)) 1271 return -3; 1272 1273 /* check LX-magic */ 1274 if (achBuffer[0] != 'L' || achBuffer[1] != 'X') 1275 return -7; 1276 1277 #if !defined(DEBUGR3) && !defined(EXTRACT) 1278 /* check object count - match it with what we got from the kernel. */ 1279 pLXHdr = (struct e32_exe *)achBuffer; 1280 if ((UCHAR)pLXHdr->e32_objcnt != cObjects) 1281 return -8; 1282 1283 if (pLXHdr->e32_objcnt < 10) 1284 return -9; 1285 1286 /* check objects (sizes and flags(?)) */ 1287 if (!fseek(hKrnl, (LONG)offLXHdr + (LONG)pLXHdr->e32_objtab, SEEK_SET)) 1288 { 1289 struct o32_obj *pObj = (struct o32_obj *)achBuffer; 1290 for (i = 0; i < (int)cObjects; i++) 1291 { 1292 if (!fread(achBuffer, 1, sizeof(OTE), hKrnl)) 1293 return -11; 1294 if (pObj->o32_size < paKrnlOTEs[i].ote_size) 1295 return -12; 1296 1297 #if 0 /* don't work! */ 1298 if ((pObj->o32_flags & 0xffffUL) != (paKrnlOTEs[i].ote_flags & 0xffffUL)) 1299 return -14; 1300 #endif 1301 } 1302 } 1303 else 1304 return -10; 1305 #else 1306 /* Since we can't get the OTEs from the kernel when debugging in RING-3, 1307 * we'll use what we find in the kernel. 1308 */ 1309 1310 /* object count */ 1311 pLXHdr = (struct e32_exe *)achBuffer; 1312 cObjects = (UCHAR)pLXHdr->e32_objcnt; 1313 paKrnlOTEs = &KrnlInfo.aObjects[0]; 1314 1315 /* get OTEs */ 1316 if (!fseek(hKrnl, (LONG)offLXHdr + (LONG)pLXHdr->e32_objtab, SEEK_SET)) 1317 { 1318 struct o32_obj *pObj = (struct o32_obj *)achBuffer; 1319 for (i = 0; i < (int)cObjects; i++) 1320 if (!fread(&paKrnlOTEs[i], 1, sizeof(struct o32_obj), hKrnl)) 1321 return -11; 1322 } 1323 else 1324 return -10; 1325 #endif 1326 1327 return 0; 1328 } 1329 1330 1331 1244 1332 /** 1245 1333 * Debug - Main procedure for standalone testing. … … 1269 1357 ProbeKernel(&ReqPack); 1270 1358 } 1271 1272 1359 #endif 1273 1360 1361 1362 #ifdef EXTRACT 1363 /** 1364 * Dumps writes a KRNLDBENTRY struct to stderr for the given .sym-file. 1365 * The filesnames are on this format: 1366 * nnnn[n]tm.SYM 1367 * Where: n - are the build number 4 or 5 digits. 1368 * t - kernel type. R = retail, H = half strict, A = all strict. 1369 * m - UNI or SMP. U = UNI processor kernel. S = SMP processor kernel. 1370 * @returns NO_ERROR on success. Untracable error code on error. 1371 * @param pszFilename Pointer to read only filename of the .sym-file. 1372 * @status completely implemented. 1373 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 1374 * @remark Currently only retail kernels are processed. See note below. 1375 */ 1376 static int processFile(const char *pszFilename) 1377 { 1378 APIRET rc; 1379 int cch = kstrlen(pszFilename); 1380 1381 /* Filename check */ 1382 if (cch < 10 || cch > 11 1383 || !(pszFilename[0] >= '0' && pszFilename[0] <= '9') 1384 || !(pszFilename[1] >= '0' && pszFilename[1] <= '9') 1385 || !(pszFilename[2] >= '0' && pszFilename[2] <= '9') 1386 || !(pszFilename[3] >= '0' && pszFilename[3] <= '9') 1387 || !(pszFilename[cch-7] >= '0' && pszFilename[cch-7] <= '9') 1388 || !(pszFilename[cch-6] == 'A' || pszFilename[cch-6] == 'H' || pszFilename[cch-6] == 'R') 1389 || !(pszFilename[cch-5] == 'S' || pszFilename[cch-5] == 'U') 1390 ) 1391 { 1392 printf16("invalid filename: %s\n", pszFilename); 1393 return 2; 1394 } 1395 1396 /** @remark 1397 * All a/h-strict files are currently ignored. 1398 * When a debug kernel is used we'll have to use the 1399 * .sym-file for it. This is so because I can't distinguish 1400 * between a all-strick and a half-strick kernel (yet). 1401 */ 1402 if (pszFilename[cch-6] != 'R') 1403 return 0; 1404 1405 /* 1406 * Probe kernelfile 1407 */ 1408 rc = ProbeSymFile(pszFilename); 1409 1410 1411 /* 1412 * on success dump a struct for this kernel 1413 */ 1414 if (rc == 0) 1415 { 1416 int i; 1417 1418 printf16(" { /* %s */\n" 1419 " %.*s, \'%c\', %s, %d,\n" 1420 " {\n", 1421 pszFilename, 1422 cch - 6, &pszFilename[0], /* build number */ 1423 pszFilename[cch - 6], /* Type, A=astrict, H=halfstrict, R=Retail */ 1424 pszFilename[cch - 5] == 'S' ? "TRUE" : "FALSE", /* UNI: TRUE SMP: FALSE */ 1425 aImportTab[0].iObject + 1); /* ASSUMES that DOSCODE32 is the last object. */ 1426 1427 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 1428 { 1429 char *psz = aImportTab[i].achName; 1430 printf16(" {%2d, 0x%08lx}, /* %s */\n", 1431 aImportTab[i].iObject, 1432 aImportTab[i].offObject, 1433 (char *)&aImportTab[i].achName[0] 1434 ); 1435 } 1436 printf16(" }\n" 1437 " },\n"); 1438 } 1439 else 1440 printf16("ProbeSymFile failed with rc=%d\n", rc); 1441 1442 return rc; 1443 } 1444 1445 1446 /** 1447 * Extract program. 1448 * 1449 * This is some initial trial-and-error for creating an "database" of 1450 * kernel entrypoints. 1451 * 1452 * Output to stderr the structs generated for the passed in *.sym file. 1453 * 1454 */ 1455 int main(int argc, char **argv) 1456 { 1457 APIRET rc; 1458 1459 if (argc > 1) 1460 { 1461 /* 1462 * Arguments: extract.exe <symfiles...> 1463 */ 1464 int i; 1465 for (i = 0; i < argc; i++) 1466 { 1467 rc = processFile(argv[i]); 1468 if (rc != NO_ERROR) 1469 { 1470 printf16("processFile failed with rc=%d for file %s\n", 1471 rc, argv[i]); 1472 return rc; 1473 } 1474 } 1475 } 1476 else 1477 { 1478 /* 1479 * Arguments: extract.exe 1480 * 1481 * Action: Scan current directory for *.sym files. 1482 * 1483 */ 1484 USHORT usSearch = 1; 1485 HDIR hDir = HDIR_CREATE; 1486 FILEFINDBUF ffb; 1487 int i; 1488 1489 printf16("/* $Id: probkrnl.c,v 1.16 2000-02-25 18:15:02 bird Exp $\n" 1490 "*\n" 1491 "* Autogenerated kernel symbol database.\n" 1492 "*\n" 1493 "* Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)\n" 1494 "*\n" 1495 "* Project Odin Software License can be found in LICENSE.TXT\n" 1496 "*\n" 1497 "*/\n"); 1498 1499 printf16("\n" 1500 "#include <os2.h>\n" 1501 "#include \"probkrnl.h\"\n" 1502 "\n"); 1503 1504 printf16("KRNLDBENTRY aKrnlSymDB[] = \n" 1505 "{\n"); 1506 1507 rc = DosFindFirst("*.sym", &hDir, FILE_NORMAL, 1508 &ffb, sizeof(ffb), 1509 &usSearch, 0UL); 1510 while (rc == NO_ERROR & usSearch > 0) 1511 { 1512 rc = processFile(&ffb.achName[0]); 1513 if (rc != NO_ERROR) 1514 { 1515 printf16("processFile failed with rc=%d for file %s\n", 1516 rc, &ffb.achName[0]); 1517 return rc; 1518 } 1519 1520 /* next file */ 1521 rc = DosFindNext(hDir, &ffb, sizeof(ffb), &usSearch); 1522 } 1523 DosFindClose(hDir); 1524 1525 printf16(" { /* Terminating entry */\n" 1526 " 0,0,0,0,\n" 1527 " {\n"); 1528 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 1529 printf16(" {0,0},\n"); 1530 printf16(" }\n" 1531 " }\n" 1532 "}; /* end of aKrnlSymDB[] */\n" 1533 ); 1534 } 1535 1536 1537 return rc; 1538 } 1539 #endif /* EXTRACT */ 1540 -
trunk/src/win32k/dev32/d32globals.c
r2849 r2898 1 /* $Id: d32globals.c,v 1. 4 2000-02-21 15:59:20bird Exp $1 /* $Id: d32globals.c,v 1.5 2000-02-25 18:15:03 bird Exp $ 2 2 * 3 3 * d32globals - global data (32-bit) … … 18 18 *******************************************************************************/ 19 19 #include <os2.h> 20 #include "options.h"21 20 22 21 /******************************************************************************* … … 24 23 *******************************************************************************/ 25 24 PULONG pulTKSSBase32; 26 #ifdef DEBUG27 char szStartOfOptions[] = "START-OF-OPTIONS";28 #endif29 struct options options = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};30 #ifdef DEBUG31 char szEndOfOptions[] = "END-OF-OPTIONS";32 #endif33 25 -
trunk/src/win32k/dev32/d32init.c
r2878 r2898 1 /* $Id: d32init.c,v 1.1 5 2000-02-23 23:01:00bird Exp $1 /* $Id: d32init.c,v 1.16 2000-02-25 18:15:03 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. … … 15 15 /* the one used in calltab.asm. */ 16 16 #define static /* just to make all symbols visible in the kernel debugger. */ 17 #if 0 /* Enable this to have extra debug logging. */ 18 #define kprintf2(a) kprintf 19 #else 20 #define kprintf2(a) (void)0 21 #endif 17 22 18 23 … … 49 54 static char * apszInfoLevel[] = {"INFOLEVEL_QUIET", "INFOLEVEL_ERROR", "INFOLEVEL_WARNING", "INFOLEVEL_INFO", "INFOLEVEL_INFOALL", "!invalid!"}; 50 55 #endif 56 static PMTE pKrnlMTE = NULL; 57 static PSMTE pKrnlSMTE = NULL; 58 static POTE pKrnlOTE = NULL; 59 51 60 52 61 /******************************************************************************* … … 70 79 /* extern(s) located in mytkExecPgm.asm */ 71 80 extern char mytkExecPgm; 72 extern char CODE32START;73 extern char CODE32END;74 extern char CONST32_ROEND;75 extern char DATA16START;76 extern char DATA16_CONSTEND;77 81 78 82 … … 94 98 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit) 95 99 { 96 char *pszTmp2; 97 char *pszTmp; 98 ULONG ul; 99 APIRET rc; 100 LOCKHANDLE lhData16={0,0,0,0, 0,0,0,0, 0,0,0,0}; 101 LOCKHANDLE lhData = {0,0,0,0, 0,0,0,0, 0,0,0,0}; 102 LOCKHANDLE lhCode = {0,0,0,0, 0,0,0,0, 0,0,0,0}; 100 char * pszTmp2; 101 char * pszTmp; 102 ULONG ul; 103 APIRET rc; 104 LOCKHANDLE lockhandle; 103 105 104 106 pulTKSSBase32 = (PULONG)_TKSSBase16; 105 106 SET_OPTIONS_TO_DEFAULT(options);107 107 108 108 /*---------------------*/ … … 273 273 274 274 /* Transfer version and build number from 16-bit probkrnl.c */ 275 options.ulBuild = _u lBuild;275 options.ulBuild = _usBuild; 276 276 options.usVerMajor = _usVerMajor; 277 277 options.usVerMinor = _usVerMinor; 278 278 279 /* log option summary - FIXME */ 279 /* Log option summary */ 280 #ifdef DEBUG 280 281 kprintf(("Options - Summary - Start\n")); 281 282 if (options.fQuiet) … … 306 307 options.cbSwpHeapInit, options.cbSwpHeapMax)); 307 308 kprintf(("Options - Summary - End\n")); 309 #endif /* debug */ 308 310 /* end option summary */ 309 311 … … 331 333 */ 332 334 /* 32-bit code segment */ 335 memset(SSToDS(&lockhandle), 0, sizeof(lockhandle)); 333 336 rc = D32Hlp_VMLock2(&CODE32START, 334 337 ((unsigned)&CODE32END & ~0xFFF) - (unsigned)&CODE32START, /* Round down so we don't overlap with the next request. */ 335 338 VMDHL_LONG, 336 SSToDS(&l hCode));339 SSToDS(&lockhandle)); 337 340 if (rc != NO_ERROR) 338 341 kprintf(("code segment lock failed with with rc=%d\n", rc)); 339 342 340 343 /* 32-bit data segment */ 344 memset(SSToDS(&lockhandle), 0, sizeof(lockhandle)); 341 345 rc = D32Hlp_VMLock2(callTab, 342 346 &CONST32_ROEND - (char*)callTab, 343 347 VMDHL_LONG | VMDHL_WRITE, 344 SSToDS(&l hData));348 SSToDS(&lockhandle)); 345 349 if (rc != NO_ERROR) 346 350 kprintf(("data segment lock failed with with rc=%d\n", rc)); 347 351 348 /* 16-bit data segment */ 352 /* 16-bit data segment - is this necessary? */ 353 memset(SSToDS(&lockhandle), 0, sizeof(lockhandle)); 349 354 rc = D32Hlp_VMLock2(&DATA16START, 350 &DATA16 _CONSTEND - &DATA16START,355 &DATA16END - &DATA16START, 351 356 VMDHL_LONG | VMDHL_WRITE, 352 SSToDS(&l hData16));357 SSToDS(&lockhandle)); 353 358 if (rc != NO_ERROR) 354 kprintf((" data segment lock failed with with rc=%d\n", rc));359 kprintf(("16-bit data segment lock failed with with rc=%d\n", rc)); 355 360 356 361 return STATUS_DONE; … … 371 376 int i = 0; 372 377 378 /* determin ulBase */ 373 379 if (*pszNum == '0') 374 380 if (pszNum[1] == 'x' || pszNum[1] == 'X') … … 403 409 /** 404 410 * Get kernel OTEs 411 * This function set pKrnlMTE, pKrnlSMTE and pKrnlOTE. 405 412 * @returns Strategy return code: 406 413 * STATUS_DONE on success. 407 414 * STATUS_DONE | STERR | errorcode on failure. 408 * @param pOTEBuf Pointer to output buffer. 415 * @param pKrnlInfo Pointer to output buffer. 416 * If NULL only the three global variables are set. 409 417 * @status completely implemented and tested. 410 418 * @author knut st. osmundsen 411 419 * @remark Called from IOCtl. 420 * WARNING! This function is called before the initroutine (R0INIT)! 412 421 */ 413 USHORT _loadds _Far32 _Pascal Get OTEs32(PKRNLOBJTABLE pOTEBuf)422 USHORT _loadds _Far32 _Pascal GetKernelInfo32(PKRNLINFO pKrnlInfo) 414 423 { 415 PMTE pMTE;416 PSMTE pSMTE;417 POTE pOTE;418 424 int i; 419 425 USHORT usRc; 420 426 421 pMTE = GetOS2KrnlMTE(); 422 if (pMTE != NULL) 427 /* VerifyImporTab32 is called before the initroutine! */ 428 pulTKSSBase32 = (PULONG)_TKSSBase16; 429 430 /* Find the kernel OTE table */ 431 pKrnlMTE = GetOS2KrnlMTE(); 432 if (pKrnlMTE != NULL) 423 433 { 424 p SMTE = pMTE->mte_swapmte;425 if (p SMTE != NULL)434 pKrnlSMTE = pKrnlMTE->mte_swapmte; 435 if (pKrnlSMTE != NULL) 426 436 { 427 pOTEBuf->cObjects = (unsigned char)pSMTE->smte_objcnt; 428 if (pSMTE->smte_objcnt <= MAXKRNLOBJECTS) 437 if (pKrnlSMTE->smte_objcnt <= MAXKRNLOBJECTS) 429 438 { 430 p OTE = pSMTE->smte_objtab;431 if (p OTE != NULL)439 pKrnlOTE = pKrnlSMTE->smte_objtab; 440 if (pKrnlOTE != NULL) 432 441 { 433 /* Copy OTEs */ 434 for (i = 0; i < pOTEBuf->cObjects; i++) 435 memcpy((void*)&pOTEBuf->aObjects[i], &pOTE[i], sizeof(OTE)); 442 /* 443 * Thats all? 444 */ 445 if (pKrnlInfo == NULL) 446 return NO_ERROR; 447 448 pKrnlInfo->cObjects = (unsigned char)pKrnlSMTE->smte_objcnt; 449 450 /* 451 * Copy OTEs 452 */ 453 for (i = 0; i < pKrnlInfo->cObjects; i++) 454 { 455 memcpy((void*)&pKrnlInfo->aObjects[i], &pKrnlOTE[i], sizeof(OTE)); 456 kprintf2(("GetKernelInfo32: %d base=0x%08x size=0x%08x flags=0x%08x\n", 457 i, pKrnlOTE[i].ote_base, pKrnlOTE[i].ote_size, pKrnlOTE[i].ote_flags)); 458 } 436 459 usRc = 0; 437 460 … … 439 462 * Search for internal revision stuff in the two first objects. 440 463 */ 441 #if 0442 for (i = 0; i < 2 ; i++)464 pKrnlInfo->usBuild = 0; 465 for (i = 0; i < 2 && pKrnlInfo->usBuild == 0; i++) 443 466 { 444 const char *psz = (const char*)p OTE[i].ote_base;445 const char *pszEnd = psz + p OTE[i].ote_size;467 const char *psz = (const char*)pKrnlOTE[i].ote_base; 468 const char *pszEnd = psz + pKrnlOTE[i].ote_size; 446 469 447 470 while (psz + 100 < pszEnd) 448 471 { 449 strncmp(psz, "Internal revision"); 472 if (strncmp(psz, "Internal revision ", 18) == 0 && (psz[18] >= '0' && psz[18] <= '9')) 473 { 474 int j; 475 kprintf2(("GetOTEs32: found internal revision: '%s'\n", psz)); 476 477 /* skip to end of "Internal revision " string. */ 478 psz += 18; 479 480 /* Read number*/ 481 while ((*psz >= '0' && *psz <= '9') || *psz == '.') 482 { 483 if (*psz != '.') 484 pKrnlInfo->usBuild = (unsigned short)(pKrnlInfo->usBuild * 10 + (*psz - '0')); 485 psz++; 486 } 487 488 /* Check if build number seems valid. */ 489 if ( !(pKrnlInfo->usBuild >= 8254 && pKrnlInfo->usBuild < 8383) /* Warp 3 fp 32 -> fp 60 */ 490 && !(pKrnlInfo->usBuild >= 9023 && pKrnlInfo->usBuild < 9063) /* Warp 4 GA -> fp 40 */ 491 && !(pKrnlInfo->usBuild >= 14039 && pKrnlInfo->usBuild < 14080) /* Warp 4.5 GA -> fp 40 */ 492 ) 493 { 494 kprintf(("GetOTEs32: info summary: Build %d is invalid - invalid fixpack?\n", pKrnlInfo->usBuild)); 495 usRc = 6; 496 break; 497 } 498 499 /* If this is an Aurora or Warp 3 kernel there is more info! */ 500 pKrnlInfo->fSMP = (char)(*psz != ',' 501 && ( (psz[1] == '_' && (psz[2] == 'S' || psz[2] == 's')) /* F_SMP */ 502 || (psz[2] == '_' && (psz[1] == 'S' || psz[1] == 's'))));/* _SMP */ 503 504 /* Check if its a debug kernel (look for DEBUG at start of object 3-5) */ 505 j = 3; 506 pKrnlInfo->fDebug = FALSE; 507 while (j < 5) 508 { 509 510 /* There should be no iopl object preceding the debugger data object. */ 511 if ((pKrnlOTE[j].ote_flags & OBJIOPL) != 0) 512 break; 513 /* Is this is? */ 514 if ((pKrnlOTE[j].ote_flags & OBJINVALID) == 0 515 && (pKrnlOTE[j].ote_flags & (OBJREAD | OBJWRITE)) == (OBJREAD | OBJWRITE) 516 && strncmp((char*)pKrnlOTE[j].ote_base, "DEBUG", 5) == 0) 517 { 518 pKrnlInfo->fDebug = TRUE; 519 break; 520 } 521 j++; 522 } 523 524 /* Display info */ 525 kprintf(("GetOTEs32: info summary: Build %d, fSMP=%d, fDebug=%d\n", 526 pKrnlInfo->usBuild, pKrnlInfo->fSMP, pKrnlInfo->fDebug)); 527 528 /* Break out */ 529 break; 530 } 450 531 451 532 /* next */ 452 533 psz++; 453 } 534 } /* while loop searching for "Internal revision " */ 535 } /* for loop on objects 0-1. */ 536 537 /* Set error code if not found */ 538 if (pKrnlInfo->usBuild == 0) 539 { 540 usRc = 5; 541 kprintf(("GetOTEs32: Internal revision was not found!\n")); 454 542 } 455 #endif456 543 } 457 544 else … … 466 553 else 467 554 usRc = 1; 555 468 556 469 557 if (usRc != 0) … … 515 603 int cb = -3; 516 604 517 kprintf (("interpretFunctionProlog32(0x%08x, %d):\n"518 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n"519 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n",520 pach, fOverload,521 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7],522 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15]));605 kprintf2(("interpretFunctionProlog32(0x%08x, %d):\n" 606 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n" 607 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n", 608 pach, fOverload, 609 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7], 610 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15])); 523 611 524 612 /* … … 699 787 int cb = -7; 700 788 701 kprintf (("interpretFunctionProlog16(0x%08x, %d):\n"702 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n"703 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n",704 pach, fOverload,705 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7],706 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15]));789 kprintf2(("interpretFunctionProlog16(0x%08x, %d):\n" 790 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n" 791 "\t%02x %02x %02x %02x - %02x %02x %02x %02x\n", 792 pach, fOverload, 793 pach[0], pach[1], pach[2], pach[3], pach[4], pach[5], pach[6], pach[7], 794 pach[8], pach[9], pach[10],pach[11],pach[12],pach[13],pach[14],pach[15])); 707 795 /* 708 796 * Check for the well known prolog (the only that is supported now) … … 817 905 * @returns 0 if ok. !0 if not ok. 818 906 * @remark Called from IOCtl. 819 * WARNING! VerifyImporTab32 is called before the initroutine!907 * WARNING! This function is called before the initroutine (R0INIT)! 820 908 */ 821 909 USHORT _loadds _Far32 _Pascal VerifyImportTab32(void) … … 828 916 pulTKSSBase32 = (PULONG)_TKSSBase16; 829 917 830 /* verify */ 918 /* Check that pKrnlOTE is set */ 919 if (GetKernelInfo32(NULL) != NO_ERROR) 920 return STATUS_DONE | STERR | 1; 921 922 /* 923 * Verify aImportTab. 924 */ 831 925 for (i = 0; i < NBR_OF_KRNLIMPORTS; i++) 832 926 { 833 /* verify that it is found */ 927 /* 928 * Debug info 929 */ 930 kprintf2(("VerifyImportTab32: procedure no.%d is being checked: %s addr=0x%08x iObj=%d offObj=%d\n", 931 i, &_aImportTab[i].achName[0], _aImportTab[i].ulAddress, 932 _aImportTab[i].iObject, _aImportTab[i].offObject)); 933 934 /* Verify that it is found */ 834 935 if (!_aImportTab[i].fFound) 835 936 { 836 kprintf(("VerifyImportTab32: procedure no.%d was not f ound!\n", i));837 return STATUS_DONE | STERR | 1;937 kprintf(("VerifyImportTab32: procedure no.%d was not fFound!\n", i)); 938 return STATUS_DONE | STERR | 2; 838 939 } 839 940 840 /* verify read/writeable. - FIXME */ 941 /* Verify read/writeable. */ 942 if (_aImportTab[i].iObject >= pKrnlSMTE->smte_objcnt /* object index valid? */ 943 || _aImportTab[i].ulAddress < pKrnlOTE[_aImportTab[i].iObject].ote_base /* address valid? */ 944 || _aImportTab[i].ulAddress + 16 > (pKrnlOTE[_aImportTab[i].iObject].ote_base + 945 pKrnlOTE[_aImportTab[i].iObject].ote_size) /* address valid? */ 946 || _aImportTab[i].ulAddress - _aImportTab[i].offObject 947 != pKrnlOTE[_aImportTab[i].iObject].ote_base /* offObject ok? */ 948 ) 949 { 950 kprintf(("VerifyImportTab32: procedure no.%d has an invalid address or object number.!\n" 951 " %s addr=0x%08x iObj=%d offObj=%d\n", 952 i, &_aImportTab[i].achName[0], _aImportTab[i].ulAddress, 953 _aImportTab[i].iObject, _aImportTab[i].offObject)); 954 return STATUS_DONE | STERR | 3; 955 } 956 957 958 841 959 if (_aImportTab[i].ulAddress < 0xffe00000UL) 842 960 { 843 kprintf(("VerifyImportTab32: procedure no.%d has an inv lalid address, %#08x!\n",961 kprintf(("VerifyImportTab32: procedure no.%d has an invalid address, %#08x!\n", 844 962 i, _aImportTab[i].ulAddress)); 845 return STATUS_DONE | STERR | 2;963 return STATUS_DONE | STERR | 4; 846 964 } 847 965 … … 855 973 if (EPT32BitEntry(_aImportTab[i])) 856 974 { 857 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC32); 975 cb = interpretFunctionProlog32((char*)_aImportTab[i].ulAddress, 976 _aImportTab[i].fType == EPT_PROC32); 858 977 cbmin = 5; /* Size of the jump instruction */ 859 978 } 860 979 else 861 980 { 862 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC16); 981 cb = interpretFunctionProlog16((char*)_aImportTab[i].ulAddress, 982 _aImportTab[i].fType == EPT_PROC16); 863 983 cbmin = 7; /* Size of the far jump instruction */ 864 984 } … … 870 990 { /* failed, too small or too large. */ 871 991 kprintf(("VerifyImportTab32: verify failed for procedure no.%d (cd=%d)\n", i, cb)); 872 return STATUS_DONE | STERR | 3;992 return STATUS_DONE | STERR | 5; 873 993 } 874 994 break; … … 881 1001 kprintf(("VerifyImportTab32: only EPT_PROC is implemented\n",i)); 882 1002 Int3(); /* temporary fix! */ 883 return STATUS_DONE | STERR | 4;1003 return STATUS_DONE | STERR | 6; 884 1004 } 885 1005 } -
trunk/src/win32k/dev32/devfirst.asm
r2836 r2898 1 ; $Id: devfirst.asm,v 1. 4 2000-02-21 04:45:46bird Exp $1 ; $Id: devfirst.asm,v 1.5 2000-02-25 18:15:03 bird Exp $ 2 2 ; 3 3 ; DevFirst - entrypoint and segment definitions … … 28 28 public BSS32START 29 29 public CONST32_ROSTART 30 public _VFTSTART 31 public EH_DATASTART 32 30 33 31 34 public _strategyAsm0 32 35 public _strategyAsm1 33 public _CallGet OTEs3236 public _CallGetKernelInfo32 34 37 public _CallElfIOCtl 35 38 public _CallWin32kIOCtl … … 42 45 ; 43 46 extrn _TKSSBase16:dword 44 extrn GET OTES32:FAR47 extrn GETKERNELINFO32:FAR 45 48 extrn ELFIOCTL:FAR 46 49 extrn WIN32KIOCTL:FAR … … 86 89 ;; 87 90 ; Thunk procedure for R0Init32. 88 ; @cproto USHORT NEAR CallGet OTEs32(ULONG addressOTEBuf);89 ; @returns Same as Get OTEs32.90 ; @param address of OTEBuf 32-bit pointer to request data.91 ; @status completely implemented. 92 ; @author knut st. osmundsen 93 _CallGet OTEs32 PROC NEAR91 ; @cproto USHORT NEAR CallGetKernelInfo32(ULONG addressKrnlInfoBuf); 92 ; @returns Same as GetKernelInfo32. 93 ; @param addressKrnlInfoBuf 32-bit pointer to request data on stack. 94 ; @status completely implemented. 95 ; @author knut st. osmundsen 96 _CallGetKernelInfo32 PROC NEAR 94 97 ASSUME CS:CODE16 95 98 push ds 96 99 push word ptr [esp+6] ; push high word. 97 100 push word ptr [esp+6] ; push low word. 98 call far ptr FLAT:GET OTES32101 call far ptr FLAT:GETKERNELINFO32 99 102 pop ds 100 103 retn 101 _CallGet OTEs32 ENDP104 _CallGetKernelInfo32 ENDP 102 105 103 106 -
trunk/src/win32k/dev32/devlast.asm
r2836 r2898 1 ; $Id: devlast.asm,v 1. 4 2000-02-21 04:45:46bird Exp $1 ; $Id: devlast.asm,v 1.5 2000-02-25 18:15:03 bird Exp $ 2 2 ; 3 3 ; DevLast - the object file termintating the resident part of the objects. … … 30 30 public BSS32END 31 31 public CONST32_ROEND 32 public _VFTEND 33 public EH_DATAEND 32 34 public _CallR0Init32 33 35 public _CallVerifyImportTab32 … … 93 95 94 96 CODE32 segment 95 CODE32END db ?97 CODE32END LABEL BYTE 96 98 CODE32 ends 97 99 98 100 DATA32 segment 99 DATA32END db ?101 DATA32END LABEL BYTE 100 102 DATA32 ends 101 103 -
trunk/src/win32k/include/dev16.h
r2836 r2898 1 /* $Id: dev16.h,v 1. 7 2000-02-21 04:45:46bird Exp $1 /* $Id: dev16.h,v 1.8 2000-02-25 18:15:04 bird Exp $ 2 2 * dev16 - 16-bit specific. Should not be used in 32-bit C/C++. 3 3 * … … 13 13 typedef ULONG LIN; 14 14 typedef ULONG FAR *PLIN; 15 #endif 16 #ifndef MAX_DISKDD_CMD /* macro from reqpkt.h where these normally is declared. */ 17 typedef void FAR *PRPINITIN; 18 typedef void FAR *PRPINITOUT; 19 typedef void FAR *PRP_GENIOCTL; 20 typedef ULONG DDHDR; 15 21 #endif 16 22 … … 36 42 * Get Kernel OTEs. No params. Data is KRNLOBJTABLE (dev1632.h). 37 43 */ 38 #define D16_IOCTL_GETKRNL OTES0x4144 #define D16_IOCTL_GETKRNLINFO 0x41 39 45 40 46 41 47 /* 42 * Get Kernel OTEs. No params. No data. aImportTab is used.48 * Verify aImportTab. No params. No data (aImportTab is used). 43 49 */ 44 #define D16_IOCTL_VERIFYPROCTAB 0x42 50 #define D16_IOCTL_VERIFYIMPORTTAB 0x42 51 45 52 46 53 /** … … 112 119 */ 113 120 USHORT NEAR CallR0Init32(LIN pRpInit); 114 USHORT NEAR CallGet OTEs32(ULONG addressOTEBuf);121 USHORT NEAR CallGetKernelInfo32(ULONG addressKrnlInfoBuf); 115 122 USHORT NEAR CallVerifyImportTab32(void); 116 123 USHORT NEAR CallElfIOCtl(LIN pRpIOCtl); … … 132 139 extern USHORT R0FlatCS16; 133 140 extern USHORT R0FlatDS16; 141 extern BOOL fInitTime; 134 142 135 143 … … 155 163 extern char PASCAL BSS32START ; 156 164 extern char PASCAL CONST32_ROSTART ; 165 extern char PASCAL _VFTSTART ; 166 extern char PASCAL EH_DATASTART ; 157 167 158 168 extern char PASCAL CODE16END ; … … 166 176 extern char PASCAL BSS32END ; 167 177 extern char PASCAL CONST32_ROEND ; 178 extern char PASCAL _VFTEND ; 179 extern char PASCAL EH_DATAEND ; 168 180 169 181 -
trunk/src/win32k/include/dev1632.h
r2831 r2898 1 /* $Id: dev1632.h,v 1. 3 2000-02-19 23:52:00bird Exp $1 /* $Id: dev1632.h,v 1.4 2000-02-25 18:15:04 bird Exp $ 2 2 * dev1632.h - Common header file for 16-bit and 32-bit C 3 3 * … … 48 48 49 49 #define MAXKRNLOBJECTS 24 50 typedef struct _KRNL OBJTABLE50 typedef struct _KRNLINFO 51 51 { 52 52 unsigned char cObjects; 53 unsigned char fDebug; 54 unsigned char fSMP; 55 unsigned short usBuild; 53 56 OTE aObjects[MAXKRNLOBJECTS]; 54 } KRNL OBJTABLE, FAR * PKRNLOBJTABLE;57 } KRNLINFO, FAR * PKRNLINFO; 55 58 56 59 #else 57 60 58 #define PKRNL OBJTABLEvoid *61 #define PKRNLINFO void * 59 62 60 63 #endif -
trunk/src/win32k/include/dev32.h
r2836 r2898 1 /* $Id: dev32.h,v 1. 7 2000-02-21 04:45:46bird Exp $1 /* $Id: dev32.h,v 1.8 2000-02-25 18:15:04 bird Exp $ 2 2 * 3 3 * dev32 - header file for 32-bit part of the driver. … … 23 23 #define RP32GENIOCTL void 24 24 #define PRP32GENIOCTL void * 25 #define PKRNL OBJTABLEvoid *25 #define PKRNLINFO void * 26 26 #endif 27 27 … … 56 56 #if !defined(__cplusplus) && defined(RING0) 57 57 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit); 58 USHORT _loadds _Far32 _Pascal Get OTEs32(PKRNLOBJTABLE pOTEBuf);58 USHORT _loadds _Far32 _Pascal GetKernelInfo32(PKRNLINFO pKrnlInfo); 59 59 USHORT _loadds _Far32 _Pascal VerifyImportTab32(void); 60 60 USHORT _loadds _Far32 _Pascal ElfIOCtl(PRP32GENIOCTL pRpIOCtl); … … 96 96 #endif 97 97 98 99 /* 100 * START and END labels. NOTE: these are not bytes only assembly labels. 101 */ 102 extern char CODE16START ; 103 extern char DATA16START ; 104 extern char DATA16START ; 105 extern char DATA16_BSSSTART ; 106 extern char DATA16_CONSTSTART; 107 extern char CODE16START ; 108 extern char CODE32START ; 109 extern char DATA32START ; 110 extern char BSS32START ; 111 extern char CONST32_ROSTART ; 112 extern char _VFTSTART ; 113 extern char EH_DATASTART ; 114 115 extern char CODE16END ; 116 extern char DATA16END ; 117 extern char DATA16END ; 118 extern char DATA16_BSSEND ; 119 extern char DATA16_CONSTEND; 120 extern char CODE16END ; 121 extern char CODE32END ; 122 extern char DATA32END ; 123 extern char BSS32END ; 124 extern char CONST32_ROEND ; 125 extern char _VFTEND ; 126 extern char EH_DATAEND ; 127 128 129 130 98 131 #endif -
trunk/src/win32k/include/log.h
r1467 r2898 1 /* $Id: log.h,v 1. 3 1999-10-27 02:02:56bird Exp $1 /* $Id: log.h,v 1.4 2000-02-25 18:15:04 bird Exp $ 2 2 * 3 3 * log - C-style logging - kprintf. 4 4 * Dual mode, RING0 and RING3. 5 * Dual 16 and 32 bit. 5 6 * 6 * Copyright (c) 1998-1999 knut st. osmundsen 7 * Define NOLOGGING to disable logging for the given sourcefile or the entire system. 8 * 9 * Copyright (c) 1998-2000 knut st. osmundsen 7 10 * 8 11 * Project Odin Software License can be found in LICENSE.TXT … … 28 31 */ 29 32 #define dprintf kprintf 30 #ifdef DEBUG 31 #include <stdarg.h> 32 #include "vprintf.h" 33 #define kprintf(a) printf a 33 #if defined(DEBUG) && !defined(NOLOGGING) 34 #ifndef INCL_16 35 /* 32-bit */ 36 #include <stdarg.h> 37 #include "vprintf.h" 38 #define kprintf(a) printf a 39 #else 40 /* 16-bit */ 41 #include "vprntf16.h" 42 #define kprintf(a) printf16 a 43 #endif 34 44 #else 35 #define kprintf(a) (void)045 #define kprintf(a) (void)0 36 46 #endif 37 47 -
trunk/src/win32k/include/options.h
r2849 r2898 1 /* $Id: options.h,v 1. 9 2000-02-21 15:59:21bird Exp $1 /* $Id: options.h,v 1.10 2000-02-25 18:15:06 bird Exp $ 2 2 * 3 3 * Options. … … 16 16 *******************************************************************************/ 17 17 /* fKernel */ 18 #define KF_UNI 0x00000000UL19 #define KF_SMP 0x00000001UL18 #define KF_UNI 0x00000000UL 19 #define KF_SMP 0x00000001UL 20 20 21 21 /* fPE */ … … 26 26 27 27 /* ulInfoLevel */ 28 #define INFOLEVEL_QUIET 29 #define INFOLEVEL_ERROR 30 #define INFOLEVEL_WARNING 31 #define INFOLEVEL_INFO 32 #define INFOLEVEL_INFOALL 28 #define INFOLEVEL_QUIET 0x00000000UL 29 #define INFOLEVEL_ERROR 0x00000001UL 30 #define INFOLEVEL_WARNING 0x00000002UL 31 #define INFOLEVEL_INFO 0x00000003UL 32 #define INFOLEVEL_INFOALL 0x00000004UL 33 33 34 34 /* default heapsizes */ 35 #define CB_SWP_INIT (1024*512) 36 #define CB_SWP_MAX (1024*1024*16) 37 #define CB_RES_INIT (1024*256) 38 #define CB_RES_MAX (1024*1024*10) 35 #define CB_SWP_INIT (1024*512) /* 512KB */ 36 #define CB_SWP_MAX (1024*1024*16) /* 16MB */ 37 #define CB_RES_INIT (1024*256) /* 256KB */ 38 #define CB_RES_MAX (1024*1024*10) /* 10MB */ 39 39 40 /* default assignments */ 41 #define DEFAULT_OPTION_ASSIGMENTS \ 42 {FALSE, /* fQuiet */ \ 43 OUTPUT_COM2, /* usCom */ \ 44 FALSE, /* fLogging */ \ 45 KF_UNI, /* fKernel */ \ 46 ~0UL, /* ulBuild */ \ 47 (unsigned short)~0, /* usVerMajor */ \ 48 (unsigned short)~0, /* usVerMinor */ \ 49 FLAGS_PE_PE2LX, /* fPE */ \ 50 INFOLEVEL_QUIET, /* ulInfoLevel */ \ 51 FALSE, /* fElf */ \ 52 TRUE, /* fScript */ \ 53 FALSE, /* fNoLoader */ \ 54 CB_SWP_INIT, /* cbSwpHeapInit */ \ 55 CB_SWP_MAX, /* cbSwpHeapMax */ \ 56 CB_RES_INIT, /* cbResHeapInit */ \ 57 CB_RES_MAX} /* cbResHeapMax */ 40 58 41 /* Set defaults. */42 #define SET_OPTIONS_TO_DEFAULT(o) \43 o.fQuiet = FALSE; \44 o.usCom = OUTPUT_COM2; \45 o.fLogging = FALSE; \46 o.fKernel = KF_UNI; \47 o.ulBuild = ~0UL; \48 o.usVerMajor = (unsigned short)~0; \49 o.usVerMinor = (unsigned short)~0; \50 o.fPE = FLAGS_PE_PE2LX; \51 o.ulInfoLevel = INFOLEVEL_QUIET; \52 o.fElf = FALSE; \53 o.fScript = TRUE; \54 o.fNoLoader = FALSE; \55 o.cbSwpHeapInit = CB_SWP_INIT; \56 o.cbSwpHeapMax = CB_SWP_MAX; \57 o.cbResHeapInit = CB_RES_INIT; \58 o.cbResHeapMax = CB_RES_MAX;59 59 60 60 … … 63 63 *******************************************************************************/ 64 64 /** Option struct */ 65 #pragma pack(4) 65 66 struct options 66 67 { 67 68 /** @cat misc */ 68 BOOLfQuiet; /* Quiet initialization. */69 ULONG fQuiet; /* Quiet initialization. */ 69 70 70 71 /** @cat logging options */ 71 72 USHORT usCom; /* Output port no. */ 72 BOOLfLogging; /* Logging. */73 ULONG fLogging; /* Logging. */ 73 74 74 75 /** @cat kernel selection */ … … 79 80 80 81 /** @cat Options affecting the generated LX executables */ 81 BOOLfPE; /* Flags set the type of conversion. */82 ULONG fPE; /* Flags set the type of conversion. */ 82 83 ULONG ulInfoLevel; /* Pe2Lx InfoLevel. */ 83 84 84 85 /** @cat Options affecting the generated ELF executables */ 85 BOOLfElf; /* Elf flags. */86 ULONG fElf; /* Elf flags. */ 86 87 87 88 /** @cat Options affecting the script executables */ 88 BOOLfScript; /* Script flags. */89 ULONG fScript; /* Script flags. */ 89 90 90 91 /** @cat Options affecting the script executables */ 91 BOOLfNoLoader; /* No loader stuff. */92 ULONG fNoLoader; /* No loader stuff. */ 92 93 93 94 /** @cat Options affecting the heap. */ … … 97 98 ULONG cbResHeapMax; /* Maxiumem residentheapsize. */ 98 99 }; 100 #pragma pack() 101 99 102 100 103 /******************************************************************************* 101 104 * Global Variables * 102 105 *******************************************************************************/ 103 extern struct options options; /* defined in d32globals.c */ 106 extern struct options options; /* defined in d32globals.c */ 107 #if defined(__IBMC__) || defined(__IBMCPP__) 108 #pragma map( options , "_options" ) 109 #endif 104 110 105 111 #endif -
trunk/src/win32k/include/probkrnl.h
r2838 r2898 1 /* $Id: probkrnl.h,v 1.1 0 2000-02-21 09:24:00bird Exp $1 /* $Id: probkrnl.h,v 1.11 2000-02-25 18:15:06 bird Exp $ 2 2 * 3 3 * Include file for ProbKrnl. … … 61 61 62 62 63 /* 64 * Database of kernel symbols. 65 */ 66 #pragma pack(1) 67 typedef struct 68 { 69 unsigned short usBuild; /* Build number */ 70 unsigned char chType; /* R, H, A */ 71 unsigned char fSMP; /* TRUE / FALSE */ 72 unsigned char cObjects; /* Count of objects */ 73 struct 74 { 75 unsigned char iObject; /* Object number. */ 76 unsigned long offObject; /* offset into object of the symbol. */ 77 } aSyms[NBR_OF_KRNLIMPORTS]; 78 79 } KRNLDBENTRY, *PKRNLDBENTRY; 80 #pragma pack() 81 82 63 83 64 84 /******************************************************************************* … … 67 87 *******************************************************************************/ 68 88 extern IMPORTKRNLSYM _aImportTab[NBR_OF_KRNLIMPORTS]; /* 'aImportTab' in PrbKrnl.c */ 69 extern unsigned long int _ulBuild; /* 'ulBuild' in PrbKrnl.c */89 extern unsigned short int _usBuild; /* 'ulBuild' in PrbKrnl.c */ 70 90 extern unsigned short int _usVerMajor; /* 'usVerMajor' in PrbKrnl.c */ 71 91 extern unsigned short int _usVerMinor; /* 'usVerMinor' in PrbKrnl.c */ 92 extern KRNLDBENTRY aKrnlSymDB[]; /* defined in symdb.c (for 16-bit usage) */ 93 extern KRNLDBENTRY _aKrnlSymDB[]; /* defined in symdb.c (for 32-bit usage) */ 72 94 73 #ifdef INCL_16 /* 16-bit only */ 95 96 #if defined(INCL_16) && defined(MAX_DISKDD_CMD) /* 16-bit only */ 74 97 int ProbeKernel(PRPINITIN pReqPack); 75 98 #endif -
trunk/src/win32k/win32k.txt
r1750 r2898 1 x.0 Win32k.sys - native OS/2 PE-"loader"1 2.3.0 Win32k.sys - native OS/2 PE-"loader" 2 2 ---------------------------------------- 3 3 … … 5 5 executables by implementing a Ring 0 on-the-fly converter. The converter is 6 6 Pe2Lx.exe. So, everything that works with Pe2Lx will probably work with 7 win32k.sys. And vice versa, when Pe2lx don't make it, win32k.sys won't either.7 win32k.sys. And vice versa, when Pe2lx can't handle it, win32k.sys won't either. 8 8 9 9 You may wonder how you may run a Win32 program using a device driver. You … … 22 22 23 23 24 x.1 WARNING25 ----------- 24 2.3.1 WARNING 25 ------------- 26 26 27 27 The Win32k.sys is quite alpha software and any bugs which haven't been found … … 37 37 38 38 39 x.2 Requirements40 ---------------- 39 2.3.2 Requirements 40 ------------------ 41 41 42 42 Win32k should work on any Warp 4 or Warp Server for e-business installations 43 which Odin32 works on. It requires only one thing, a kernel symbol file. The 44 kernel symbol is looked for in \OS2\PDPSI\PMDF\WARP4 and 45 \OS2\PDPSI\PMDF\WARP45_U/S. All warp 4 and WE4eB installations should have 46 those direcotries (we hope). It is updated when you install a new fixpack - so 47 there is really nothing to worry about for the common user. 43 which Odin32 works on. It no longer requires a kernel file for non-debug 44 kernels. Win32k does now contain a "database" for the most recent retail 45 kernels. Currently this is: 46 Warp 4 fp#5 -> fp#12 47 Aurora GA 48 Warp 3 fp#32-> fp#42 49 50 If the running kernel is not found in the "database" or is a debug kernel 51 wink32.sys will look for symbolfiles as it allways has. 52 If you use the -s:<symfile> argument the given symbol file will be 53 investigated before the database is searched. 54 55 NOTE! It hasn't been fully verified that all the different national fixpaks 56 have the same symbols as the us-english ones. Feedback on this issue is 57 appreciated. 48 58 49 59 For those playing with debug-kernels, make sure that OS2KRNL.SYM is matching 50 the running kernel, while this file too is investigated. (The complete list 51 is found in src\Win32k\dev16\probkrnl.c,apszSym[] - odin32 source tree.) 60 the running kernel. 52 61 53 62 54 x.2.1 Warp 355 ------------ 63 2.3.2.1 Warp 3 64 -------------- 56 65 57 Win32k is not tested with Warp 3. It is supposed to work with Warp 3 provided58 that the os2krnl.sym file is present. Warp Server 4 have this, common Warp 3 59 don't. 66 Win32k is not tested with Warp 3. It is _supposed_ to work with Warp 3 67 provided you are running fixpack 32 or later. 68 (Fixpack 32 + y2kclock.exe is required for Y2K readyness anyway so...) 60 69 61 70 62 x.3 Installation63 ---------------- 71 2.3.3 Installation 72 ------------------ 64 73 65 74 To use Win32k.sys you have to add the following line into your config.sys: … … 69 78 directory. 70 79 71 After doing this you'll have to reboot your machine to load the driver. During80 After doing this, you'll have to reboot your machine to load the driver. During 72 81 the boot process you will on a successful installation see some lines of 73 82 technical info and finally a line saying: 74 83 'Win32k.sys succesfully initiated!' 75 84 76 If you don't see the line above something is wrong !85 If you don't see the line above something is wrong. 77 86 78 87 79 x.4 Win32k parameters 80 --------------------- 88 2.3.4 Win32k parameters 89 ----------------------- 90 91 The Capitalized letters are the one which is tested for when identifying the 92 argument. 81 93 82 94 There are some useful parameters for Win32k: 83 -Q Quiet driver initiation. (Default is verbose (-V) initiation.) 84 -V Verbose driver initiation. Default. 85 -S:<filename> Full path to the current OS/2 kernel symbole file. 86 -K:<filename> Full path to the running OS/2 kernel. 95 -Quited Quiet driver initiation. 96 Default: disabled (ie. -V) 97 98 -Verbose Verbose driver initiation. 99 Default: enabled 100 101 -S:<filename> Full path to the current OS/2 kernel symbol file. 102 When this is specified the given 103 Default: symbol "database" and default locations are searched. 104 105 Logging parameters: 106 -L<:E|:D> Enables/Disables logging. 107 Default: disabled. 108 109 -C<1|2> Which com-port to log to. 110 Default: -C2 111 112 -W<1|2|3|4> Warning/info level for PE loader. (This is warnings and info 113 which is published thru the com-port as logging information.) 114 Default: -W0 115 116 Heap parameters: 117 -HEAPMax: Maximum swappable heap size in bytes. 118 Default: 512KB 119 120 -Heapinit: Initial heapsize in bytes. 121 Default: 16MB 122 123 -RESHEAPMax: Maximum resident heap size in bytes. 124 Default: 256KB 125 126 -Resheapinit: Initial resident in bytes. 127 Default: 16MB 128 129 -SCript<:Y|:N> Enable / disable UNIX script support. 130 Default: Enabled. 131 132 Obsolete: 133 -K:<filename> Ignored. Win32k scans the kernel image in memory! 87 134 88 135 89 x.5 Rings - Ring 0 / Ring 390 --------------------------- 136 2.3.5 Rings - Ring 0 / Ring 3 137 ----------------------------- 91 138 92 139 FYI. Ring 0 is the most priveleged level of execution in OS/2. The OS/2 kernel 93 and device drivers execute at this level, while user applications execute sin140 and device drivers execute at this level, while user applications execute in 94 141 Ring 3, the least priveleged executing level. 95 142
Note:
See TracChangeset
for help on using the changeset viewer.