| 1 | /* $Id: kLdr-win.c 3573 2007-08-31 04:09:23Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * kLdr - The Dynamic Loader, Windows Specifics.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@anduin.net>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of kLdr.
|
|---|
| 10 | *
|
|---|
| 11 | * kLdr is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU General Public License as published by
|
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * kLdr 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
|
|---|
| 19 | * GNU General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU General Public License
|
|---|
| 22 | * along with kLdr; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | /*******************************************************************************
|
|---|
| 30 | * Header Files *
|
|---|
| 31 | *******************************************************************************/
|
|---|
| 32 | #include <Windows.h>
|
|---|
| 33 |
|
|---|
| 34 | #include <k/kLdr.h>
|
|---|
| 35 | #include "kLdrInternal.h"
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | /**
|
|---|
| 39 | * The DLL main function.
|
|---|
| 40 | *
|
|---|
| 41 | * @returns TRUE / FALSE.
|
|---|
| 42 | * @param hDllHandle The dll handle.
|
|---|
| 43 | * @param dwReason The reason we're being called.
|
|---|
| 44 | * @param lpReserved Reserved.
|
|---|
| 45 | */
|
|---|
| 46 | BOOL __stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved)
|
|---|
| 47 | {
|
|---|
| 48 | switch (dwReason)
|
|---|
| 49 | {
|
|---|
| 50 | case DLL_PROCESS_ATTACH:
|
|---|
| 51 | {
|
|---|
| 52 | int rc = kldrInit();
|
|---|
| 53 | return rc == 0;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | case DLL_PROCESS_DETACH:
|
|---|
| 57 | kldrTerm();
|
|---|
| 58 | return TRUE;
|
|---|
| 59 |
|
|---|
| 60 | case DLL_THREAD_ATTACH:
|
|---|
| 61 | {
|
|---|
| 62 | //int rc = kLdrDyldThreadAttach();
|
|---|
| 63 | //return rc == 0;
|
|---|
| 64 | return TRUE;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | case DLL_THREAD_DETACH:
|
|---|
| 68 | //kLdrDyldThreadDetach();
|
|---|
| 69 | return TRUE;
|
|---|
| 70 |
|
|---|
| 71 | default:
|
|---|
| 72 | return FALSE;
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|