source:
trunk/src/odincrt/initterm.cpp
| Last change on this file was 21916, checked in by , 14 years ago | |
|---|---|
| File size: 1.2 KB | |
| Rev | Line | |
|---|---|---|
| [438] | 1 | /* |
| [21916] | 2 | * ODINCRT DLL entry point |
| [438] | 3 | * |
| 4 | * Copyright 1998 Sander van Leeuwen | |
| 5 | * Copyright 1998 Peter Fitzsimmons | |
| 6 | * | |
| 7 | * Project Odin Software License can be found in LICENSE.TXT | |
| 8 | */ | |
| 9 | ||
| 10 | #define INCL_DOSMODULEMGR | |
| 11 | #define INCL_DOSPROCESS | |
| [5472] | 12 | #define INCL_DOSERRORS |
| [21538] | 13 | #include <os2wrap.h> // Odin32 OS/2 api wrappers |
| [2649] | 14 | #include <exitlist.h> |
| [5130] | 15 | #include <initdll.h> |
| [438] | 16 | |
| [21916] | 17 | ULONG SYSTEM DLL_Init(ULONG hModule) |
| [438] | 18 | { |
| [21538] | 19 | #ifdef WITH_KLIB |
| [21916] | 20 | /* |
| 21 | * We need to reserve memory for the executable image | |
| 22 | * before initiating any heaps. Lets do reserve 32MBs | |
| 23 | */ | |
| 24 | PVOID pvReserved = NULL; | |
| 25 | DosAllocMem(&pvReserved, 32*1024*1024, PAG_READ); | |
| [21538] | 26 | #endif |
| [438] | 27 | |
| [21916] | 28 | if (DLL_InitDefault(hModule) == -1) |
| 29 | return -1; | |
| [438] | 30 | |
| [21538] | 31 | #if 1 |
| 32 | /* | |
| 33 | * Experimental console hack. Sets apptype to PM anyhow. | |
| 34 | * First Dll to be initiated should now allways be OdinCrt! | |
| 35 | * So include odincrt first! | |
| 36 | */ | |
| [4818] | 37 | PPIB pPIB; |
| 38 | PTIB pTIB; | |
| [21916] | 39 | APIRET rc = DosGetInfoBlocks(&pTIB, &pPIB); |
| [4818] | 40 | if (rc != NO_ERROR) |
| [21916] | 41 | return -1; |
| [4818] | 42 | pPIB->pib_ultype = 3; |
| [21538] | 43 | #endif |
| [21916] | 44 | |
| 45 | #ifdef WITH_KLIB | |
| 46 | /* cleanup - hacking is done */ | |
| 47 | DosFreeMem(pvReserved); | |
| 48 | #endif | |
| 49 | ||
| 50 | return EXITLIST_ODINCRT; | |
| [4818] | 51 | } |
| 52 | ||
| [21916] | 53 | void SYSTEM DLL_Term(ULONG hModule) |
| [4818] | 54 | { |
| [21916] | 55 | DLL_TermDefault(hModule); |
| [4818] | 56 | } |
| 57 |
Note:
See TracBrowser
for help on using the repository browser.
