1*c0b5d9fbSchristos /* $NetBSD: DLLMain.c,v 1.6 2022/09/23 12:15:36 christos Exp $ */ 2e2b1b9c0Schristos 3e2b1b9c0Schristos /* 4e2b1b9c0Schristos * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5e2b1b9c0Schristos * 6*c0b5d9fbSchristos * SPDX-License-Identifier: MPL-2.0 7*c0b5d9fbSchristos * 8e2b1b9c0Schristos * This Source Code Form is subject to the terms of the Mozilla Public 9e2b1b9c0Schristos * License, v. 2.0. If a copy of the MPL was not distributed with this 1073584a28Schristos * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11e2b1b9c0Schristos * 12e2b1b9c0Schristos * See the COPYRIGHT file distributed with this work for additional 13e2b1b9c0Schristos * information regarding copyright ownership. 14e2b1b9c0Schristos */ 15e2b1b9c0Schristos 16e2b1b9c0Schristos #include <signal.h> 179742fdb4Schristos #include <windows.h> 18e2b1b9c0Schristos 19e2b1b9c0Schristos /* 20e2b1b9c0Schristos * Called when we enter the DLL 21e2b1b9c0Schristos */ 229742fdb4Schristos __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)239742fdb4Schristos DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { 24e2b1b9c0Schristos switch (fdwReason) { 25e2b1b9c0Schristos /* 26e2b1b9c0Schristos * The DLL is loading due to process 27e2b1b9c0Schristos * initialization or a call to LoadLibrary. 28e2b1b9c0Schristos */ 29e2b1b9c0Schristos case DLL_PROCESS_ATTACH: 30e2b1b9c0Schristos break; 31e2b1b9c0Schristos 32e2b1b9c0Schristos /* The attached process creates a new thread. */ 33e2b1b9c0Schristos case DLL_THREAD_ATTACH: 34e2b1b9c0Schristos break; 35e2b1b9c0Schristos 36e2b1b9c0Schristos /* The thread of the attached process terminates. */ 37e2b1b9c0Schristos case DLL_THREAD_DETACH: 38e2b1b9c0Schristos break; 39e2b1b9c0Schristos 40e2b1b9c0Schristos /* 41e2b1b9c0Schristos * The DLL is unloading from a process due to 42e2b1b9c0Schristos * process termination or a call to FreeLibrary. 43e2b1b9c0Schristos */ 44e2b1b9c0Schristos case DLL_PROCESS_DETACH: 45e2b1b9c0Schristos break; 46e2b1b9c0Schristos 47e2b1b9c0Schristos default: 48e2b1b9c0Schristos break; 49e2b1b9c0Schristos } 50e2b1b9c0Schristos return (TRUE); 51e2b1b9c0Schristos } 52