// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

#include "KeystrokeNoise.h"

// Usage instructions:
// Either manually load this DLL from your application using LoadLibrary(),
// or add it to the APPINIT key to be loaded by all GUI processes:
// HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs

BOOL APIENTRY DllMain( HMODULE hModule,				// handle to the DLL module
                       DWORD  ul_reason_for_call,	// one of the codes below
                       LPVOID lpReserved )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		// As an optimization, prevent thread attach/detach notifications to our DLL:
		DisableThreadLibraryCalls(hModule);

		// Consider not running this code in the context of DllMain, but 
		// instead by scheduling an APC with QueueUserAPC?
		
		InitializeKeystrokeNoise();
		OutputDebugString(TEXT("    [KeystrokeNoiseDLL::DllMain] Initialization complete.\n"));
		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}

