1*00b67f09SDavid van Moolenbroek /* $NetBSD: DLLMain.c,v 1.4 2014/12/10 04:38:02 christos Exp $ */
2*00b67f09SDavid van Moolenbroek
3*00b67f09SDavid van Moolenbroek /*
4*00b67f09SDavid van Moolenbroek * Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
5*00b67f09SDavid van Moolenbroek * Copyright (C) 2001 Internet Software Consortium.
6*00b67f09SDavid van Moolenbroek *
7*00b67f09SDavid van Moolenbroek * Permission to use, copy, modify, and/or distribute this software for any
8*00b67f09SDavid van Moolenbroek * purpose with or without fee is hereby granted, provided that the above
9*00b67f09SDavid van Moolenbroek * copyright notice and this permission notice appear in all copies.
10*00b67f09SDavid van Moolenbroek *
11*00b67f09SDavid van Moolenbroek * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12*00b67f09SDavid van Moolenbroek * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13*00b67f09SDavid van Moolenbroek * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14*00b67f09SDavid van Moolenbroek * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15*00b67f09SDavid van Moolenbroek * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16*00b67f09SDavid van Moolenbroek * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*00b67f09SDavid van Moolenbroek * PERFORMANCE OF THIS SOFTWARE.
18*00b67f09SDavid van Moolenbroek */
19*00b67f09SDavid van Moolenbroek
20*00b67f09SDavid van Moolenbroek /* Id: DLLMain.c,v 1.6 2007/06/18 23:47:51 tbox Exp */
21*00b67f09SDavid van Moolenbroek
22*00b67f09SDavid van Moolenbroek #include <windows.h>
23*00b67f09SDavid van Moolenbroek #include <signal.h>
24*00b67f09SDavid van Moolenbroek
25*00b67f09SDavid van Moolenbroek /*
26*00b67f09SDavid van Moolenbroek * Called when we enter the DLL
27*00b67f09SDavid van Moolenbroek */
DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)28*00b67f09SDavid van Moolenbroek __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL,
29*00b67f09SDavid van Moolenbroek DWORD fdwReason, LPVOID lpvReserved)
30*00b67f09SDavid van Moolenbroek {
31*00b67f09SDavid van Moolenbroek switch (fdwReason)
32*00b67f09SDavid van Moolenbroek {
33*00b67f09SDavid van Moolenbroek /*
34*00b67f09SDavid van Moolenbroek * The DLL is loading due to process
35*00b67f09SDavid van Moolenbroek * initialization or a call to LoadLibrary.
36*00b67f09SDavid van Moolenbroek */
37*00b67f09SDavid van Moolenbroek case DLL_PROCESS_ATTACH:
38*00b67f09SDavid van Moolenbroek break;
39*00b67f09SDavid van Moolenbroek
40*00b67f09SDavid van Moolenbroek /*
41*00b67f09SDavid van Moolenbroek * The attached process creates a new thread.
42*00b67f09SDavid van Moolenbroek */
43*00b67f09SDavid van Moolenbroek case DLL_THREAD_ATTACH:
44*00b67f09SDavid van Moolenbroek break;
45*00b67f09SDavid van Moolenbroek
46*00b67f09SDavid van Moolenbroek /* The thread of the attached process terminates. */
47*00b67f09SDavid van Moolenbroek case DLL_THREAD_DETACH:
48*00b67f09SDavid van Moolenbroek break;
49*00b67f09SDavid van Moolenbroek
50*00b67f09SDavid van Moolenbroek /*
51*00b67f09SDavid van Moolenbroek * The DLL is unloading from a process due to
52*00b67f09SDavid van Moolenbroek * process termination or a call to FreeLibrary.
53*00b67f09SDavid van Moolenbroek */
54*00b67f09SDavid van Moolenbroek case DLL_PROCESS_DETACH:
55*00b67f09SDavid van Moolenbroek break;
56*00b67f09SDavid van Moolenbroek
57*00b67f09SDavid van Moolenbroek default:
58*00b67f09SDavid van Moolenbroek break;
59*00b67f09SDavid van Moolenbroek }
60*00b67f09SDavid van Moolenbroek return (TRUE);
61*00b67f09SDavid van Moolenbroek }
62*00b67f09SDavid van Moolenbroek
63