[2878] | 1 | /* $Id: tstExeMainStub.c 3601 2007-10-29 00:21:13Z bird $ */
|
---|
[2873] | 2 | /** @file
|
---|
| 3 | * kLdr testcase - DLL Stub.
|
---|
[3601] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
| 7 | * Copyright (c) 2006-2007 knut st. osmundsen <bird-kStuff-spam@anduin.net>
|
---|
[2873] | 8 | *
|
---|
[3601] | 9 | * This file is part of kStuff.
|
---|
[2873] | 10 | *
|
---|
[3601] | 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.
|
---|
[2873] | 15 | *
|
---|
[3601] | 16 | * kStuff is distributed in the hope that it will be useful,
|
---|
[2873] | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
[3601] | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 19 | * Lesser General Public License for more details.
|
---|
[2873] | 20 | *
|
---|
[3601] | 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
|
---|
[2873] | 24 | *
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | /*******************************************************************************
|
---|
| 28 | * Header Files *
|
---|
| 29 | *******************************************************************************/
|
---|
| 30 | #include "tst.h"
|
---|
| 31 |
|
---|
[3584] | 32 | #if K_OS == K_OS_OS2
|
---|
[2873] | 33 | # define INCL_BASE
|
---|
| 34 | # include <os2.h>
|
---|
| 35 |
|
---|
[3584] | 36 | #elif K_OS == K_OS_WINDOWS
|
---|
[2875] | 37 | /* nothing */
|
---|
[2873] | 38 |
|
---|
[3584] | 39 | #elif K_OS == K_OS_NT
|
---|
[2873] | 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 |
|
---|
[3584] | 50 | #if K_OS == K_OS_OS2
|
---|
[2873] | 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 |
|
---|
[3584] | 61 | #elif K_OS == K_OS_WINDOWS
|
---|
[2873] | 62 | /**
|
---|
[2876] | 63 | * Windows'main'
|
---|
[2873] | 64 | */
|
---|
[2875] | 65 | int WindowsMain(void)
|
---|
[2873] | 66 | {
|
---|
| 67 | int rc;
|
---|
| 68 | rc = main();
|
---|
| 69 | return rc;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
[3584] | 72 | #elif K_OS == K_OS_NT
|
---|
[2873] | 73 | /**
|
---|
[2876] | 74 | * Windows NT 'main'
|
---|
[2873] | 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 |
|
---|