Update of /cvsroot/netrek/client/netrekxp/src/winkey In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23922/src/winkey Added Files: winkey.cpp winkey.def winkey.dsp winkey.dsw Log Message: Update to version 4.4.0.3 --- NEW FILE: winkey.cpp --- #define WIN32_LEAN_AND_MEAN #define STRICT #include <windows.h> #pragma data_seg(".shared") HHOOK g_hMsgHook = NULL; HHOOK g_hKeyHook = NULL; int g_iFlags = NULL; #pragma data_seg() const int KILL_WINKEY = 0x0001; const int KILL_CTRLESC = 0x0002; const int KILL_COMBOS = 0x0004; const int KILL_CONTEXT = 0x0008; LRESULT CALLBACK Msg_HookProc (int iCode, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK Key_HookProc (int iCode, WPARAM wParam, LPARAM lParam); extern "C" __declspec(dllexport) void __fastcall Kill (int iFlags); extern "C" BOOL __stdcall _DllMainCRTStartup (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/) { if (fdwReason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls (hinstDLL); } return TRUE; } LRESULT CALLBACK Msg_HookProc (int iCode, WPARAM wParam, LPARAM lParam) { if (wParam != PM_NOREMOVE && iCode >= 0) { if (((MSG*)lParam)->message == WM_SYSCOMMAND && ((MSG*)lParam)->wParam == SC_TASKLIST) { if ((g_iFlags & KILL_WINKEY) && !(g_iFlags & KILL_CTRLESC) && !((GetAsyncKeyState (VK_CONTROL) & 32768) && (GetAsyncKeyState (VK_ESCAPE) & 32768))) { ((MSG*)lParam)->message = WM_NULL; } else if ((g_iFlags & KILL_WINKEY) && (g_iFlags & KILL_CTRLESC)) { ((MSG*)lParam)->message = WM_NULL; } else if (!(g_iFlags & KILL_WINKEY) && (g_iFlags & KILL_CTRLESC) && GetAsyncKeyState (VK_CONTROL) && GetAsyncKeyState (VK_ESCAPE)) { ((MSG*)lParam)->message = WM_NULL; } } else if (((MSG*)lParam)->message == WM_CONTEXTMENU && GetAsyncKeyState (VK_APPS) && (g_iFlags & KILL_CONTEXT)) { ((MSG*)lParam)->message = WM_NULL; } else if (((MSG*)lParam)->message == WM_HOTKEY && (LOWORD(((MSG*)lParam)->lParam) & MOD_WIN) && (g_iFlags & KILL_COMBOS)) { ((MSG*)lParam)->message = WM_NULL; } } return CallNextHookEx (g_hMsgHook, iCode, wParam, lParam); } LRESULT CALLBACK Key_HookProc (int iCode, WPARAM wParam, LPARAM lParam) { if (iCode != HC_NOREMOVE && iCode >= 0) { if ((wParam == VK_LWIN || wParam == VK_RWIN) && (g_iFlags & KILL_COMBOS)) { return 1; } if (wParam == VK_APPS && (g_iFlags & KILL_CONTEXT)) { return 1; } } return CallNextHookEx (g_hKeyHook, iCode, wParam, lParam); } extern "C" __declspec(dllexport) void __fastcall Kill (int iFlags) { if(iFlags) { g_iFlags = iFlags; HINSTANCE hInst = GetModuleHandle ("winkey.dll"); if ((iFlags & KILL_WINKEY) || (iFlags & KILL_CTRLESC)) { g_hMsgHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)Msg_HookProc, hInst, 0); } if ((iFlags & KILL_CONTEXT) || (iFlags & KILL_COMBOS)) { g_hKeyHook = SetWindowsHookEx (WH_KEYBOARD, (HOOKPROC)Key_HookProc, hInst, 0); if (!g_hMsgHook) { g_hMsgHook = SetWindowsHookEx (WH_GETMESSAGE, (HOOKPROC)Msg_HookProc, hInst, 0); } } return; } if (g_hMsgHook) { UnhookWindowsHookEx (g_hMsgHook); } if (g_hKeyHook) { UnhookWindowsHookEx (g_hKeyHook); } } --- NEW FILE: winkey.dsw --- Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "winkey"=.\winkey.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### --- NEW FILE: winkey.def --- EXPORTS Kill @1 NONAME --- NEW FILE: winkey.dsp --- # Microsoft Developer Studio Project File - Name="winkey" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=winkey - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "winkey.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "winkey.mak" CFG="winkey - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "winkey - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "winkey - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "winkey - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "\netrek_files\tmp\winkey\Release" # PROP Intermediate_Dir "\netrek_files\tmp\winkey\Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /G6 /Gr /W3 /O2 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /GF /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib /SECTION:.shared,rws /out:"\netrek_files\netrek\bitmaps\winkey.dll" !ELSEIF "$(CFG)" == "winkey - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "\netrek_files\tmp\winkey\Debug" # PROP Intermediate_Dir "\netrek_files\tmp\winkey\Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /entry:"_DllMainCRTStartup" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib /pdbtype:sept /SECTION:.shared,rws /out:"\netrek_files\netrek\bitmaps\winkey.dll" # SUBTRACT LINK32 /pdb:none !ENDIF # Begin Target # Name "winkey - Win32 Release" # Name "winkey - Win32 Debug" # Begin Source File SOURCE=.\winkey.cpp # End Source File # Begin Source File SOURCE=.\winkey.def # End Source File # End Target # End Project