1 | /* $Id: ntdll.cpp,v 1.4 1999-12-18 20:01:14 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | *
|
---|
5 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
6 | * Win32 NT Runtime / NTDLL for OS/2
|
---|
7 | *
|
---|
8 | * Copyright 1998, 1999 Patrick Haller (phaller@gmx.net)
|
---|
9 | *
|
---|
10 | * @(#) ntdll.cpp 1.0.1 1999/05/08 SvL: Changes for compilation with Wine headers
|
---|
11 | * 1.0.0 1998/05/20 PH Start from WINE/NTDLL.C
|
---|
12 | *
|
---|
13 | * NT basis DLL
|
---|
14 | *
|
---|
15 | * Copyright 1996 Marcus Meissner
|
---|
16 | * Copyright 1998 Patrick Haller (adapted for win32os2)
|
---|
17 | */
|
---|
18 |
|
---|
19 | /* Changes to the original NTDLL.C from the WINE project
|
---|
20 |
|
---|
21 | - includes replaced by the win32os2 standard includes
|
---|
22 | - replaced WINAPI by WIN32API
|
---|
23 | - moved in some string functions
|
---|
24 | - replaced HANDLE32 by HANDLE
|
---|
25 | - lstrlen32A -> OS2lstrlenA
|
---|
26 | - lstrlen32W -> OS2lstrlenW
|
---|
27 | */
|
---|
28 |
|
---|
29 | /*****************************************************************************
|
---|
30 | * Includes *
|
---|
31 | *****************************************************************************/
|
---|
32 |
|
---|
33 | #include <os2win.h>
|
---|
34 | #include <winnt.h>
|
---|
35 | #include <ntdef.h>
|
---|
36 | #include <builtin.h>
|
---|
37 | #include <stdlib.h>
|
---|
38 | #include <string.h>
|
---|
39 | #include <ctype.h>
|
---|
40 | #include "misc.h"
|
---|
41 | #include "unicode.h"
|
---|
42 |
|
---|
43 | #include "ntdll.h"
|
---|
44 |
|
---|
45 |
|
---|
46 | /*****************************************************************************
|
---|
47 | * Types & Defines *
|
---|
48 | *****************************************************************************/
|
---|
49 |
|
---|
50 | #define NTSTATUS DWORD
|
---|
51 |
|
---|
52 | //SvL: per process heap for NTDLL
|
---|
53 | HANDLE NTDLL_hHeap = 0;
|
---|
54 |
|
---|
55 | /*****************************************************************************
|
---|
56 | * Name : DbgPrint
|
---|
57 | * Purpose : print a debug line to somewhere?
|
---|
58 | * Parameters:
|
---|
59 | * Variables :
|
---|
60 | * Result :
|
---|
61 | * Remark : NTDLL.21
|
---|
62 | * Status : UNTESTED STUB
|
---|
63 | *
|
---|
64 | * Author : Patrick Haller [Tue, 1999/06/01 09:00]
|
---|
65 | *****************************************************************************/
|
---|
66 | void __cdecl DbgPrint(LPCSTR lpcstrFormat,LPVOID args)
|
---|
67 | {
|
---|
68 | UCHAR szBuffer[600]; // as in original NTDLL.DLL
|
---|
69 | int rc;
|
---|
70 |
|
---|
71 | rc = wvsnprintfA((LPSTR)szBuffer,
|
---|
72 | sizeof(szBuffer),
|
---|
73 | lpcstrFormat,
|
---|
74 | (va_list)args);
|
---|
75 |
|
---|
76 | dprintf(("NTDLL: DbgPrint[%s]\n",
|
---|
77 | szBuffer));
|
---|
78 |
|
---|
79 | //@@@PH raise debug exception if running in debugger
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | BOOL WINAPI NTDLL_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
---|
84 | {
|
---|
85 | dprintf(("NTDLL_LibMain: 0x%x 0x%lx %p\n", hinstDLL, fdwReason, lpvReserved));
|
---|
86 |
|
---|
87 | switch (fdwReason) {
|
---|
88 | case DLL_PROCESS_ATTACH:
|
---|
89 | NTDLL_hHeap = HeapCreate(0, 0x10000, 0);
|
---|
90 | break;
|
---|
91 | case DLL_PROCESS_DETACH:
|
---|
92 | HeapDestroy(NTDLL_hHeap);
|
---|
93 | NTDLL_hHeap = 0;
|
---|
94 | break;
|
---|
95 | case DLL_THREAD_ATTACH:
|
---|
96 | break;
|
---|
97 | case DLL_THREAD_DETACH:
|
---|
98 | break;
|
---|
99 | default:
|
---|
100 | break;
|
---|
101 | }
|
---|
102 | return TRUE;
|
---|
103 | }
|
---|
104 |
|
---|