1 | /* $Id: tstExeMainStub.c 2 2007-11-16 16:07:14Z bird $ */
|
---|
2 | /** @file
|
---|
3 | * kLdr testcase - DLL Stub.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (c) 2006-2007 knut st. osmundsen <[email protected]>
|
---|
8 | *
|
---|
9 | * This file is part of kStuff.
|
---|
10 | *
|
---|
11 | * kStuff is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU Lesser General Public
|
---|
13 | * License as published by the Free Software Foundation; either
|
---|
14 | * version 2.1 of the License, or (at your option) any later version.
|
---|
15 | *
|
---|
16 | * kStuff is distributed in the hope that it will be useful,
|
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * Lesser General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU Lesser General Public
|
---|
22 | * License along with kStuff; if not, write to the Free Software
|
---|
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
24 | *
|
---|
25 | */
|
---|
26 |
|
---|
27 | /*******************************************************************************
|
---|
28 | * Header Files *
|
---|
29 | *******************************************************************************/
|
---|
30 | #include "tst.h"
|
---|
31 |
|
---|
32 | #if K_OS == K_OS_OS2
|
---|
33 | # define INCL_BASE
|
---|
34 | # include <os2.h>
|
---|
35 |
|
---|
36 | #elif K_OS == K_OS_WINDOWS
|
---|
37 | /* nothing */
|
---|
38 |
|
---|
39 | #elif K_OS == K_OS_NT
|
---|
40 | # include <ddk/ntapi.h> /** @todo fix the nt port. */
|
---|
41 |
|
---|
42 | #else
|
---|
43 | # error "port me"
|
---|
44 | #endif
|
---|
45 |
|
---|
46 |
|
---|
47 | extern int main();
|
---|
48 |
|
---|
49 |
|
---|
50 | #if K_OS == K_OS_OS2
|
---|
51 | /**
|
---|
52 | * OS/2 'main'.
|
---|
53 | */
|
---|
54 | ULONG _System OS2Main(HMODULE hmod, ULONG fFlag, ULONG ulReserved, PSZ pszzEnv, PSZ pszzCmdLine)
|
---|
55 | {
|
---|
56 | int rc;
|
---|
57 | rc = main();
|
---|
58 | return rc;
|
---|
59 | }
|
---|
60 |
|
---|
61 | #elif K_OS == K_OS_WINDOWS
|
---|
62 | /**
|
---|
63 | * Windows'main'
|
---|
64 | */
|
---|
65 | int WindowsMain(void)
|
---|
66 | {
|
---|
67 | int rc;
|
---|
68 | rc = main();
|
---|
69 | return rc;
|
---|
70 | }
|
---|
71 |
|
---|
72 | #elif K_OS == K_OS_NT
|
---|
73 | /**
|
---|
74 | * Windows NT 'main'
|
---|
75 | */
|
---|
76 | VOID NtProcess(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved)
|
---|
77 | {
|
---|
78 | int rc;
|
---|
79 | rc = main();
|
---|
80 | /* (no way around this) */
|
---|
81 | for (;;)
|
---|
82 | ZwTerminateProcess(NtCurrentProcess(), rc);
|
---|
83 | }
|
---|
84 |
|
---|
85 | #else
|
---|
86 | # error "port me"
|
---|
87 | #endif
|
---|
88 |
|
---|
89 |
|
---|