/* $Id: kLdr-win.c 2865 2006-11-10 04:46:45Z bird $ */ /** @file * * kLdr - The Dynamic Loader, Windows Specifics. * * Copyright (c) 2006 knut st. osmundsen * * * This file is part of kLdr. * * kLdr is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * kLdr is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with kLdr; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /******************************************************************************* * Header Files * *******************************************************************************/ #include #include #include "kLdrInternal.h" #include "kLdrHlp.h" /** * The DLL main function. * * @returns TRUE / FALSE. * @param hDllHandle The dll handle. * @param dwReason The reason we're being called. * @param lpReserved Reserved. */ BOOL __stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: { int rc = kldrInit(); return rc == 0; } case DLL_PROCESS_DETACH: kldrTerm(); return TRUE; case DLL_THREAD_ATTACH: { //int rc = kLdrDyldThreadAttach(); //return rc == 0; return TRUE; } case DLL_THREAD_DETACH: //kLdrDyldThreadDetach(); return TRUE; default: return FALSE; } }