[6430] | 1 | /* $Id: mkcalltab.c,v 1.8 2001-07-31 21:35:30 bird Exp $
|
---|
[4347] | 2 | *
|
---|
| 3 | * Description: Generates the calltab.asm from aImportTab.
|
---|
| 4 | *
|
---|
| 5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
| 6 | *
|
---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
| 10 |
|
---|
| 11 | /*******************************************************************************
|
---|
| 12 | * Defined Constants And Macros *
|
---|
| 13 | *******************************************************************************/
|
---|
| 14 | /* Disable logging */
|
---|
| 15 | #define NOLOGGING 1
|
---|
| 16 |
|
---|
| 17 | #define fclose(a) DosClose(a)
|
---|
| 18 | #define SEEK_SET FILE_BEGIN
|
---|
| 19 | #define SEEK_END FILE_END
|
---|
| 20 |
|
---|
| 21 | #define WORD unsigned short int
|
---|
| 22 | #define DWORD unsigned long int
|
---|
| 23 |
|
---|
| 24 | #define INCL_BASE
|
---|
| 25 | #define INCL_DOS
|
---|
| 26 | #define INCL_NOPMAPI
|
---|
[5086] | 27 | #define INCL_OS2KRNL_LDR
|
---|
[4347] | 28 |
|
---|
| 29 | /*******************************************************************************
|
---|
| 30 | * Header Files *
|
---|
| 31 | *******************************************************************************/
|
---|
| 32 | #include <os2.h>
|
---|
| 33 |
|
---|
| 34 | #include <strat2.h>
|
---|
| 35 | #include <reqpkt.h>
|
---|
| 36 |
|
---|
| 37 | #include "devSegDf.h"
|
---|
| 38 | #undef DATA16_INIT
|
---|
| 39 | #define DATA16_INIT
|
---|
| 40 | #undef CODE16_INIT
|
---|
| 41 | #define CODE16_INIT
|
---|
| 42 | #include "os2krnl.h" /* must be included before dev1632.h! */
|
---|
| 43 | #include "probkrnl.h"
|
---|
| 44 | #include "dev1632.h"
|
---|
| 45 | #include "vprntf16.h"
|
---|
| 46 |
|
---|
| 47 | /*******************************************************************************
|
---|
| 48 | * Global Variables *
|
---|
| 49 | *******************************************************************************/
|
---|
| 50 | /* dummy replacement for SymDB.c */
|
---|
| 51 | KRNLDBENTRY DATA16_INIT aKrnlSymDB[] = {{0}};
|
---|
| 52 |
|
---|
| 53 | /*******************************************************************************
|
---|
| 54 | * External Functions *
|
---|
| 55 | *******************************************************************************/
|
---|
| 56 | extern int kstrlen(const char *psz);
|
---|
| 57 |
|
---|
| 58 | /*******************************************************************************
|
---|
| 59 | * Internal Functions *
|
---|
| 60 | *******************************************************************************/
|
---|
| 61 | void syntax(void);
|
---|
| 62 | int GenerateCalltab(void);
|
---|
| 63 | int GenerateTstFakers(void);
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * MkCalltab program.
|
---|
| 67 | *
|
---|
| 68 | * Output to stdout the calltab assembly code.
|
---|
| 69 | *
|
---|
| 70 | */
|
---|
| 71 | int main(int argc, char **argv)
|
---|
| 72 | {
|
---|
| 73 | if (argc != 2)
|
---|
| 74 | {
|
---|
| 75 | syntax();
|
---|
| 76 | return -1;
|
---|
| 77 | }
|
---|
| 78 | if (argv[1][0] == 'c')
|
---|
| 79 | return GenerateCalltab();
|
---|
| 80 | else if (argv[1][0] == 't')
|
---|
| 81 | return GenerateTstFakers();
|
---|
| 82 | else
|
---|
| 83 | {
|
---|
| 84 | syntax();
|
---|
| 85 | return -2;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | return 0;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | /**
|
---|
| 93 | * Display syntax.
|
---|
| 94 | */
|
---|
| 95 | void syntax(void)
|
---|
| 96 | {
|
---|
| 97 | printf16("Incorrect parameter!\n"
|
---|
| 98 | "Syntax: mkcalltab.exe <tab>\n"
|
---|
| 99 | " Where <tab> is either calltab or tstfakers.\n"
|
---|
| 100 | );
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | /**
|
---|
| 105 | * Generate calltab.asm.
|
---|
| 106 | * It's contents is written to stdout.
|
---|
| 107 | */
|
---|
| 108 | int GenerateCalltab(void)
|
---|
| 109 | {
|
---|
| 110 | int i;
|
---|
| 111 |
|
---|
| 112 | /*
|
---|
| 113 | * Write Start of file.
|
---|
| 114 | */
|
---|
[6430] | 115 | printf16("; $Id: mkcalltab.c,v 1.8 2001-07-31 21:35:30 bird Exp $\n"
|
---|
[4347] | 116 | ";\n"
|
---|
| 117 | "; Autogenerated calltab file.\n"
|
---|
| 118 | ";\n"
|
---|
| 119 | "; Generate: mkcalltab.exe > ldr\calltab.asm\n"
|
---|
| 120 | ";\n"
|
---|
| 121 | "; Copyright (c) 1998-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)\n"
|
---|
| 122 | ";\n"
|
---|
| 123 | "; Project Odin Software License can be found in LICENSE.TXT\n"
|
---|
| 124 | ";\n"
|
---|
| 125 | " .386p\n"
|
---|
| 126 | "\n"
|
---|
| 127 | "\n"
|
---|
| 128 | ";\n"
|
---|
| 129 | "; Include files\n"
|
---|
| 130 | ";\n"
|
---|
| 131 | " include devsegdf.inc\n"
|
---|
| 132 | "\n"
|
---|
| 133 | "\n"
|
---|
| 134 | ";\n"
|
---|
| 135 | "; Exported symbols\n"
|
---|
| 136 | ";\n"
|
---|
| 137 | " public callTab\n"
|
---|
[5185] | 138 | " public callTab16\n"
|
---|
[4347] | 139 | " public auFuncs\n"
|
---|
| 140 | "\n"
|
---|
| 141 | "\n"
|
---|
| 142 | ";\n"
|
---|
| 143 | "; Constants\n"
|
---|
| 144 | ";\n"
|
---|
| 145 | "OVERLOAD32_PROLOG EQU 14h\n"
|
---|
[5185] | 146 | "OVERLOAD16_PROLOG EQU 14h\n"
|
---|
[4347] | 147 | "IMPORT32_PROLOG EQU 08h\n"
|
---|
| 148 | "NRIMPORT32_PROLOG EQU 06h\n"
|
---|
| 149 | "IMPORT16_PROLOG EQU 08h\n"
|
---|
| 150 | "NRIMPORT16_PROLOG EQU 07h\n"
|
---|
[6277] | 151 | "IMPORTH16_PROLOG EQU 08h\n"
|
---|
| 152 | "IMPORTHNR16_PROLOG EQU 07h\n"
|
---|
[4347] | 153 | "\n"
|
---|
| 154 | "\n"
|
---|
| 155 | ";\n"
|
---|
| 156 | "; Macros\n"
|
---|
| 157 | ";\n"
|
---|
| 158 | "\n"
|
---|
| 159 | "; Macro which makes a function overload calltable entry\n"
|
---|
| 160 | "FnOverload32Entry macro fnname\n"
|
---|
| 161 | " public fnname\n"
|
---|
| 162 | " fnname proc near\n"
|
---|
| 163 | " db OVERLOAD32_PROLOG dup(0cch)\n"
|
---|
| 164 | " fnname endp\n"
|
---|
| 165 | "endm\n"
|
---|
| 166 | "\n"
|
---|
| 167 | "; Macro which makes a function overload calltable entry\n"
|
---|
| 168 | "FnOverload16Entry macro fnname\n"
|
---|
| 169 | " public fnname\n"
|
---|
[5185] | 170 | " public &fnname&_off\n"
|
---|
| 171 | " public &fnname&_sel\n"
|
---|
[4347] | 172 | " fnname proc near\n"
|
---|
| 173 | " db OVERLOAD16_PROLOG dup(0cch)\n"
|
---|
| 174 | " fnname endp\n"
|
---|
[5185] | 175 | " &fnname&_off dw 0\n"
|
---|
| 176 | " &fnname&_sel dw 0\n"
|
---|
[4347] | 177 | "endm\n"
|
---|
| 178 | "\n"
|
---|
| 179 | "; Macro which makes a function calltable entry\n"
|
---|
| 180 | "FnImport32Entry macro fnname\n"
|
---|
| 181 | " public fnname\n"
|
---|
| 182 | " fnname proc near\n"
|
---|
| 183 | " db IMPORT32_PROLOG dup(0cch)\n"
|
---|
| 184 | " fnname endp\n"
|
---|
| 185 | "endm\n"
|
---|
[6430] | 186 | "\n");
|
---|
| 187 | printf16("; Macro which makes a function calltable entry\n"
|
---|
[4347] | 188 | "FnNRImport32Entry macro fnname\n"
|
---|
| 189 | " public fnname\n"
|
---|
| 190 | " fnname proc near\n"
|
---|
| 191 | " db NRIMPORT32_PROLOG dup(0cch)\n"
|
---|
| 192 | " fnname endp\n"
|
---|
| 193 | " f&fnname& dw 0\n"
|
---|
| 194 | "endm\n"
|
---|
| 195 | "\n"
|
---|
| 196 | "; Macro which makes a function calltable entry\n"
|
---|
| 197 | "FnImport16Entry macro fnname\n"
|
---|
| 198 | " public fnname\n"
|
---|
| 199 | " fnname proc near\n"
|
---|
| 200 | " db IMPORT16_PROLOG dup(0cch)\n"
|
---|
| 201 | " fnname endp\n"
|
---|
| 202 | "endm\n"
|
---|
| 203 | "\n"
|
---|
| 204 | "; Macro which makes a function calltable entry\n"
|
---|
[6277] | 205 | "FnHybrid16Entry macro fnname\n"
|
---|
| 206 | " public fnname\n"
|
---|
| 207 | " fnname proc near\n"
|
---|
| 208 | " db IMPORTH16_PROLOG dup(0cch)\n"
|
---|
| 209 | " fnname endp\n"
|
---|
| 210 | "endm\n"
|
---|
| 211 | "\n"
|
---|
| 212 | "; Macro which makes a function calltable entry\n"
|
---|
[4347] | 213 | "FnNRImport16Entry macro fnname\n"
|
---|
| 214 | " public fnname\n"
|
---|
| 215 | " fnname proc near\n"
|
---|
| 216 | " db NRIMPORT16_PROLOG dup(0cch)\n"
|
---|
| 217 | " fnname endp\n"
|
---|
| 218 | " f&fnname& db 0\n"
|
---|
| 219 | "endm\n"
|
---|
| 220 | "\n");
|
---|
| 221 | printf16("; Macro which makes a variable calltable entry.\n"
|
---|
| 222 | "VariableEntry macro varname\n"
|
---|
| 223 | " public p&varname&\n"
|
---|
| 224 | " p&varname& dd 0\n"
|
---|
| 225 | " public &varname&_offObject\n"
|
---|
| 226 | " &varname&_offObject dd 0\n"
|
---|
| 227 | " public _fp&varname&\n"
|
---|
| 228 | " _fp&varname& dd 0\n"
|
---|
| 229 | " public &varname&_sel\n"
|
---|
| 230 | " &varname&_sel dw 0\n"
|
---|
| 231 | " dw 0cch ;alignment\n"
|
---|
| 232 | "endm\n"
|
---|
| 233 | "\n"
|
---|
| 234 | "\n"
|
---|
[5247] | 235 | "CODE32 segment\n"
|
---|
| 236 | " ;assume cs:CODE32, ds:flat, ss:nothing\n"
|
---|
[4347] | 237 | " assume ds:flat, ss:nothing\n"
|
---|
| 238 | ";\n"
|
---|
| 239 | "; callTab is an array of function prologs with a jump to the real function\n"
|
---|
| 240 | "; and pointers to real variables.\n"
|
---|
| 241 | ";\n"
|
---|
| 242 | "; Imported and Overrided OS/2 kernel functions are called thru this table.\n"
|
---|
| 243 | "; Imported OS/2 kernel variables are accessed thru this table.\n"
|
---|
| 244 | ";\n"
|
---|
| 245 | "callTab:\n");
|
---|
| 246 |
|
---|
| 247 | /*
|
---|
[5185] | 248 | * Process aImportTab - all but 16-bit overrides.
|
---|
[4347] | 249 | */
|
---|
| 250 | for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
|
---|
| 251 | {
|
---|
[6277] | 252 | if (!EPT16Proc(aImportTab[i]) && !EPTProcImportHybrid(aImportTab[i]))
|
---|
[5185] | 253 | {
|
---|
| 254 | char *pszMacro = (aImportTab[i].fType & EPT_VARIMPORT) ?
|
---|
| 255 | "VariableEntry"
|
---|
| 256 | : ( (aImportTab[i].fType & EPT_PROCIMPORT) ?
|
---|
| 257 | ( (aImportTab[i].fType & EPT_NOT_REQ) ?
|
---|
| 258 | (EPT16BitEntry(aImportTab[i]) ? "FnNRImport16Entry" : "FnNRImport32Entry")
|
---|
| 259 | : (EPT16BitEntry(aImportTab[i]) ? "FnImport16Entry" : "FnImport32Entry"))
|
---|
| 260 | : (EPT16BitEntry(aImportTab[i]) ? "FnOverload16Entry" : "FnOverload32Entry"));
|
---|
| 261 | char *pszName = &aImportTab[i].achName[(aImportTab[i].fType & EPT_VARIMPORT) && aImportTab[i].achName[0] == '_'];
|
---|
| 262 | char *pszExtra = (aImportTab[i].fType & EPT_WRAPPED) ? "_wrapped" : aImportTab[i].achExtra;
|
---|
[4347] | 263 |
|
---|
[5185] | 264 | /*
|
---|
| 265 | * Variable or Function?
|
---|
| 266 | */
|
---|
| 267 | printf16("%s<%s%s>%*.s;%d\n",
|
---|
| 268 | pszMacro,
|
---|
| 269 | pszName,
|
---|
| 270 | pszExtra,
|
---|
| 271 | 45 - 2 - kstrlen(pszMacro) - aImportTab[i].cchName - kstrlen(pszExtra),
|
---|
| 272 | "",
|
---|
| 273 | i);
|
---|
| 274 | }
|
---|
[4347] | 275 | }
|
---|
| 276 |
|
---|
| 277 | /*
|
---|
[5185] | 278 | * Write End of Calltab and start of callTab16.
|
---|
[4347] | 279 | */
|
---|
| 280 | printf16("\n"
|
---|
[5247] | 281 | "CODE32 ENDS\n"
|
---|
[4347] | 282 | "\n"
|
---|
| 283 | "\n"
|
---|
[5225] | 284 | "CODE16 SEGMENT\n"
|
---|
[5185] | 285 | " assume ds:nothing, ss:nothing\n"
|
---|
| 286 | ";\n"
|
---|
| 287 | "; callTab16 is an array of function prologs with a jump to the real function\n"
|
---|
| 288 | "; for 16-bit overrides.\n"
|
---|
| 289 | ";\n"
|
---|
| 290 | "; Overrided 16-bit OS/2 kernel functions are called thru this table.\n"
|
---|
| 291 | ";\n"
|
---|
| 292 | "callTab16:\n"
|
---|
| 293 |
|
---|
| 294 | );
|
---|
| 295 |
|
---|
| 296 | /*
|
---|
| 297 | * Process aImportTab - 16 bit overrides.
|
---|
| 298 | */
|
---|
| 299 | for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
|
---|
| 300 | {
|
---|
| 301 | if (EPT16Proc(aImportTab[i]))
|
---|
| 302 | {
|
---|
| 303 | printf16("FnOverload16Entry<%s>%*.s;%d\n",
|
---|
| 304 | aImportTab[i].achName,
|
---|
| 305 | 45 - 2 - 17 - aImportTab[i].cchName,
|
---|
| 306 | "",
|
---|
| 307 | i);
|
---|
| 308 | }
|
---|
[6277] | 309 | else if (EPT16ProcImportH(aImportTab[i]))
|
---|
| 310 | {
|
---|
| 311 | printf16("FnHybrid16Entry<%s>%*.s;%d\n",
|
---|
| 312 | aImportTab[i].achName,
|
---|
| 313 | 45 - 2 - 17 - aImportTab[i].cchName,
|
---|
| 314 | "",
|
---|
| 315 | i);
|
---|
| 316 | }
|
---|
[5185] | 317 | }
|
---|
| 318 |
|
---|
| 319 |
|
---|
| 320 | /*
|
---|
| 321 | * Write End of Calltab and start of auFuncs.
|
---|
| 322 | */
|
---|
| 323 | printf16("\n"
|
---|
[5225] | 324 | "CODE16 ENDS\n"
|
---|
[5185] | 325 | "\n"
|
---|
| 326 | "\n"
|
---|
[4347] | 327 | "DATA32 SEGMENT\n"
|
---|
| 328 | " assume ds:nothing, es:nothing\n"
|
---|
| 329 | "\n"
|
---|
| 330 | ";\n"
|
---|
| 331 | "; Function table for overloader and nop functions.\n"
|
---|
| 332 | "; Used by importTabInit() in d32init.c.\n"
|
---|
| 333 | ";\n"
|
---|
| 334 | "auFuncs:\n"
|
---|
| 335 | );
|
---|
| 336 |
|
---|
| 337 | /*
|
---|
| 338 | * Process aImportTab to generate auFuncs.
|
---|
| 339 | */
|
---|
| 340 | for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
|
---|
| 341 | {
|
---|
| 342 | char * pszSeg = (EPT32BitEntry(aImportTab[i]) ? "32" : "16");
|
---|
| 343 | char * pszPrefix = (aImportTab[i].achName[0] == '_' ? "_" : "");
|
---|
| 344 | char * pszName = (*pszPrefix != '\0' ? &aImportTab[i].achName[1] : &aImportTab[i].achName[0]);
|
---|
| 345 |
|
---|
[6277] | 346 | if (EPT16Proc(aImportTab[i]) && !EPTProcImportHybrid(aImportTab[i]))
|
---|
[4347] | 347 | { /* Overload procedure (Overloader function) */
|
---|
[5185] | 348 | #if 1
|
---|
| 349 | printf16(" extrn %smy%s%s : FAR\n"
|
---|
| 350 | " dw offset CODE%s:%smy%s%s\n"
|
---|
| 351 | " dw seg CODE%s:%smy%s%s\n",
|
---|
| 352 | pszPrefix,
|
---|
| 353 | pszName,
|
---|
| 354 | aImportTab[i].achExtra,
|
---|
| 355 | pszSeg,
|
---|
| 356 | pszPrefix,
|
---|
| 357 | pszName,
|
---|
| 358 | aImportTab[i].achExtra,
|
---|
| 359 | pszSeg,
|
---|
| 360 | pszPrefix,
|
---|
| 361 | pszName,
|
---|
| 362 | aImportTab[i].achExtra);
|
---|
| 363 | #else
|
---|
| 364 | printf16(" extrn %smy%s%s : FAR\n"
|
---|
| 365 | " dd far ptr CODE%s:%smy%s%s\n",
|
---|
| 366 | pszPrefix,
|
---|
| 367 | pszName,
|
---|
| 368 | aImportTab[i].achExtra,
|
---|
| 369 | pszSeg,
|
---|
| 370 | pszPrefix,
|
---|
| 371 | pszName,
|
---|
| 372 | aImportTab[i].achExtra);
|
---|
| 373 | #endif
|
---|
| 374 | }
|
---|
[6277] | 375 | else if (!(aImportTab[i].fType & (EPT_PROCIMPORT | EPT_PROCIMPORTH |EPT_VARIMPORT | EPT_NOT_REQ)))
|
---|
[5185] | 376 | { /* Overload procedure (Overloader function) */
|
---|
[4347] | 377 | printf16(" extrn %smy%s%s : NEAR\n"
|
---|
| 378 | " dd offset FLAT:CODE%s:%smy%s%s\n",
|
---|
| 379 | pszPrefix,
|
---|
| 380 | pszName,
|
---|
| 381 | aImportTab[i].achExtra,
|
---|
| 382 | pszSeg,
|
---|
| 383 | pszPrefix,
|
---|
| 384 | pszName,
|
---|
| 385 | aImportTab[i].achExtra);
|
---|
| 386 | }
|
---|
[6277] | 387 | else if ((aImportTab[i].fType & (EPT_NOT_REQ | EPT_VARIMPORT | EPT_PROCIMPORT | EPT_PROCIMPORTH)) == (EPT_NOT_REQ | EPT_PROCIMPORT))
|
---|
[4347] | 388 | { /* Not required imported function (NOP function) */
|
---|
| 389 | printf16(" extrn %snop%s%s : NEAR\n"
|
---|
| 390 | " dd offset FLAT:CODE%s:%snop%s%s\n",
|
---|
| 391 | pszPrefix,
|
---|
| 392 | pszName,
|
---|
| 393 | aImportTab[i].achExtra,
|
---|
| 394 | pszSeg,
|
---|
| 395 | pszPrefix,
|
---|
| 396 | pszName,
|
---|
| 397 | aImportTab[i].achExtra);
|
---|
| 398 | }
|
---|
| 399 | else
|
---|
| 400 | printf16(" dd 0h\n");
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 | /*
|
---|
| 404 | * Write End of file.
|
---|
| 405 | */
|
---|
| 406 | printf16("\n"
|
---|
| 407 | "DATA32 ENDS\n"
|
---|
| 408 | "\n"
|
---|
| 409 | "END\n");
|
---|
| 410 |
|
---|
| 411 |
|
---|
| 412 | return 0;
|
---|
| 413 | }
|
---|
| 414 |
|
---|
| 415 |
|
---|
| 416 | /**
|
---|
| 417 | * Generate the (test\)TstFakers.c file.
|
---|
| 418 | * It's contents is written to stdout.
|
---|
| 419 | */
|
---|
| 420 | int GenerateTstFakers(void)
|
---|
| 421 | {
|
---|
| 422 | int i;
|
---|
| 423 |
|
---|
| 424 | /*
|
---|
| 425 | * Write Start of file.
|
---|
| 426 | */
|
---|
[6430] | 427 | printf16("/* $Id: mkcalltab.c,v 1.8 2001-07-31 21:35:30 bird Exp $\n"
|
---|
[4347] | 428 | " *\n"
|
---|
| 429 | " * Autogenerated TstFakers.c file.\n"
|
---|
| 430 | " *\n"
|
---|
| 431 | " * Generate: mkcalltab.exe fake > test\TstFakers.c\n"
|
---|
| 432 | " *\n"
|
---|
| 433 | " * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)\n"
|
---|
| 434 | " *\n"
|
---|
| 435 | " * Project Odin Software License can be found in LICENSE.TXT\n"
|
---|
| 436 | " *\n"
|
---|
| 437 | " */\n"
|
---|
| 438 | "\n"
|
---|
| 439 | "\n"
|
---|
| 440 | "/*******************************************************************************\n"
|
---|
| 441 | "* Defined Constants And Macros *\n"
|
---|
| 442 | "*******************************************************************************/\n"
|
---|
| 443 | "#define INCL_NOPMAPI\n"
|
---|
| 444 | "#define LDR_INCL_INITONLY\n"
|
---|
| 445 | "#define INCL_OS2KRNL_ALL\n"
|
---|
| 446 | "\n"
|
---|
| 447 | "/*******************************************************************************\n"
|
---|
| 448 | "* Header Files *\n"
|
---|
| 449 | "*******************************************************************************/\n"
|
---|
| 450 | "#include <os2.h>\n"
|
---|
| 451 | "\n"
|
---|
| 452 | "#include \"devSegDf.h\"\n"
|
---|
| 453 | "#include \"OS2Krnl.h\"\n"
|
---|
| 454 | "#include \"dev1632.h\"\n"
|
---|
| 455 | "#include \"dev32.h\"\n"
|
---|
| 456 | "#include \"dev32hlp.h\"\n"
|
---|
| 457 | "#include \"probkrnl.h\"\n"
|
---|
| 458 | "#include \"ldr.h\"\n"
|
---|
| 459 | "#include \"test.h\"\n"
|
---|
| 460 | "\n"
|
---|
| 461 | "\n"
|
---|
| 462 | "TSTFAKER aTstFakers[NBR_OF_KRNLIMPORTS] =\n"
|
---|
| 463 | "{\n");
|
---|
| 464 |
|
---|
| 465 | /*
|
---|
| 466 | * Process aImportTab.
|
---|
| 467 | */
|
---|
| 468 | for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
|
---|
| 469 | {
|
---|
| 470 | int iSeg = EPT16BitEntry(aImportTab[i]) ?
|
---|
| 471 | ((aImportTab[i].fType & EPT_VARIMPORT) ? 4 : 2)
|
---|
| 472 | : ((aImportTab[i].fType & EPT_VARIMPORT) ? 3 : 1);
|
---|
| 473 | const char *psz = aImportTab[i].achName[0] == '_' ?
|
---|
| 474 | &aImportTab[i].achName[1]
|
---|
| 475 | : &aImportTab[i].achName[0];
|
---|
| 476 |
|
---|
| 477 | /*
|
---|
| 478 | * Variable or Function?
|
---|
| 479 | */
|
---|
| 480 | printf16(" {(unsigned)%sfake%s,%*.s%d}%s\n",
|
---|
| 481 | (aImportTab[i].fType & EPT_VARIMPORT) ? "&" : "",
|
---|
| 482 | psz,
|
---|
| 483 | 45 - 21 - kstrlen(psz) - ((aImportTab[i].fType & EPT_VARIMPORT) == EPT_VARIMPORT),
|
---|
| 484 | "",
|
---|
| 485 | iSeg,
|
---|
| 486 | i + 1 == NBR_OF_KRNLIMPORTS ? "" : ",");
|
---|
| 487 | }
|
---|
| 488 |
|
---|
| 489 | /*
|
---|
| 490 | * Write End of file.
|
---|
| 491 | */
|
---|
| 492 | printf16("};\n"
|
---|
| 493 | "\n");
|
---|
| 494 |
|
---|
| 495 | return 0;
|
---|
| 496 | }
|
---|
| 497 |
|
---|