diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-22 17:14:55 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-09-22 17:14:55 +0000 |
commit | d8967087af559a43f1801e3e89411d570cbb3110 (patch) | |
tree | b6596526a66c1aa8b80bab769cc7fd5472b327a8 /plugins/KeyboardNotify | |
parent | d867e44172947b51b34d60a672673dffd771a304 (diff) |
plugins cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@6185 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/KeyboardNotify')
-rw-r--r-- | plugins/KeyboardNotify/KeyboardNotify_10.vcxproj | 10 | ||||
-rw-r--r-- | plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/KeyboardNotify/KeyboardNotify_11.vcxproj | 10 | ||||
-rw-r--r-- | plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/EnumProc.cpp | 187 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/EnumProc.h | 3 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/ignore.cpp | 6 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/keyboard.cpp | 14 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/main.cpp | 40 | ||||
-rw-r--r-- | plugins/KeyboardNotify/src/options.cpp | 6 |
10 files changed, 48 insertions, 240 deletions
diff --git a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj index 5963e895dd..97af99ea28 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj +++ b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj @@ -86,7 +86,7 @@ <SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
</Link>
<ResourceCompile>
@@ -106,7 +106,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -130,7 +130,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -157,7 +157,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -174,6 +174,8 @@ </ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\Common.h" />
+ <ClInclude Include="src\constants.h" />
+ <ClInclude Include="src\EnumProc.h" />
<ClInclude Include="src\flash.h" />
<ClInclude Include="src\ignore.h" />
<ClInclude Include="src\keyboard.h" />
diff --git a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters index b30f7b3ad3..d348818f46 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters +++ b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters @@ -39,6 +39,12 @@ <ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\constants.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\EnumProc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\EnumProc.cpp">
diff --git a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj index 0e9879f5d3..3728b41dde 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj +++ b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj @@ -90,7 +90,7 @@ <SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProfileDir)..\..\bin11\lib</AdditionalLibraryDirectories>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
@@ -111,7 +111,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -135,7 +135,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -161,7 +161,7 @@ <ExceptionHandling>false</ExceptionHandling>
</ClCompile>
<Link>
- <AdditionalDependencies>comctl32.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>comctl32.lib;UxTheme.lib;VdmDbg.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -177,6 +177,8 @@ </ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\Common.h" />
+ <ClInclude Include="src\constants.h" />
+ <ClInclude Include="src\EnumProc.h" />
<ClInclude Include="src\flash.h" />
<ClInclude Include="src\ignore.h" />
<ClInclude Include="src\keyboard.h" />
diff --git a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters index b30f7b3ad3..d348818f46 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters +++ b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters @@ -39,6 +39,12 @@ <ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\constants.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\EnumProc.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\EnumProc.cpp">
diff --git a/plugins/KeyboardNotify/src/EnumProc.cpp b/plugins/KeyboardNotify/src/EnumProc.cpp index 8681f7d1ba..0277bdd351 100644 --- a/plugins/KeyboardNotify/src/EnumProc.cpp +++ b/plugins/KeyboardNotify/src/EnumProc.cpp @@ -24,193 +24,42 @@ BOOL WINAPI Enum16(DWORD, WORD, WORD, TCHAR *, TCHAR *, LPARAM); // Globals
-extern double dWinVer;
-extern BOOL bWindowsNT;
extern PROCESS_LIST ProcessList;
-HINSTANCE hInstLib, hInstLib2;
-HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD, DWORD);
-BOOL (WINAPI *lpfProcess32First)(HANDLE, LPPROCESSENTRY32);
-BOOL (WINAPI *lpfProcess32Next)(HANDLE, LPPROCESSENTRY32);
-BOOL (WINAPI *lpfEnumProcesses)(DWORD *, DWORD, DWORD *);
-BOOL (WINAPI *lpfEnumProcessModules)(HANDLE, HMODULE *, DWORD, LPDWORD);
-DWORD (WINAPI *lpfGetModuleBaseName)(HANDLE, HMODULE, LPTSTR, DWORD);
-INT (WINAPI *lpfVDMEnumTaskWOWEx)(DWORD, TASKENUMPROCEX, LPARAM);
-
-
-void LoadProcsLibrary(void)
-{
- if (bWindowsNT && dWinVer < 5) {
-
- if (!(hInstLib = LoadLibraryA("PSAPI.DLL")))
- return;
-
- if (!(hInstLib2 = LoadLibraryA("VDMDBG.DLL")))
- return;
-
- lpfEnumProcesses = (BOOL (WINAPI *)(DWORD *, DWORD, DWORD*)) GetProcAddress(hInstLib, "EnumProcesses");
- lpfEnumProcessModules = (BOOL (WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD)) GetProcAddress(hInstLib, "EnumProcessModules");
- lpfGetModuleBaseName = (DWORD (WINAPI *)(HANDLE, HMODULE, LPTSTR, DWORD)) GetProcAddress(hInstLib, "GetModuleBaseNameA");
-
- lpfVDMEnumTaskWOWEx = (INT (WINAPI *)(DWORD, TASKENUMPROCEX, LPARAM)) GetProcAddress(hInstLib2, "VDMEnumTaskWOWEx");
- } else {
-
- if (!(hInstLib = LoadLibraryA("Kernel32.DLL")))
- return;
-
- if (bWindowsNT && !(hInstLib2 = LoadLibraryA("VDMDBG.DLL")))
- return;
-
- lpfCreateToolhelp32Snapshot = (HANDLE (WINAPI *)(DWORD,DWORD)) GetProcAddress(hInstLib, "CreateToolhelp32Snapshot");
- lpfProcess32First = (BOOL (WINAPI *)(HANDLE,LPPROCESSENTRY32)) GetProcAddress(hInstLib, "Process32First");
- lpfProcess32Next = (BOOL (WINAPI *)(HANDLE,LPPROCESSENTRY32)) GetProcAddress(hInstLib, "Process32Next");
-
- if (bWindowsNT)
- lpfVDMEnumTaskWOWEx = (INT (WINAPI *)(DWORD, TASKENUMPROCEX, LPARAM)) GetProcAddress(hInstLib2, "VDMEnumTaskWOWEx");
- }
-}
-
-
-void UnloadProcsLibrary(void)
-{
- if (hInstLib)
- FreeLibrary(hInstLib);
- if (hInstLib2)
- FreeLibrary(hInstLib2);
-
- hInstLib = hInstLib = NULL;
- lpfCreateToolhelp32Snapshot = NULL;
- lpfProcess32First = NULL;
- lpfProcess32Next = NULL;
- lpfEnumProcesses = NULL;
- lpfEnumProcessModules = NULL;
- lpfGetModuleBaseName = NULL;
- lpfVDMEnumTaskWOWEx = NULL;
-}
-
-
BOOL areThereProcessesRunning(void)
{
HANDLE hSnapShot = NULL;
LPDWORD lpdwPIDs = NULL;
PROCESSENTRY32 procentry;
BOOL bFlag;
- DWORD dwSize;
- DWORD dwSize2;
- DWORD dwIndex;
- HMODULE hMod;
- HANDLE hProcess;
- TCHAR szFileName[MAX_PATH+1];
if (!ProcessList.count) // Process list is empty
return FALSE;
- // If Windows NT 4.0
- if (bWindowsNT && dWinVer < 5) {
-
- if (!lpfEnumProcesses || !lpfEnumProcessModules || !lpfGetModuleBaseName || !lpfVDMEnumTaskWOWEx)
- return FALSE;
-
- //
- // Call the PSAPI function EnumProcesses to get all of the ProcID's currently in the system.
- //
- // NOTE: In the documentation, the third parameter of EnumProcesses is named cbNeeded, which implies that you
- // can call the function once to find out how much space to allocate for a buffer and again to fill the buffer.
- // This is not the case. The cbNeeded parameter returns the number of PIDs returned, so if your buffer size is
- // zero cbNeeded returns zero.
- //
- // NOTE: The "HeapAlloc" loop here ensures that we actually allocate a buffer large enough for all the
- // PIDs in the system.
- //
- dwSize2 = 256 * sizeof(DWORD);
- do {
- if (lpdwPIDs) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- dwSize2 *= 2;
- }
- if (!(lpdwPIDs = (LPDWORD)HeapAlloc(GetProcessHeap(), 0, dwSize2)))
- return FALSE;
- if (!lpfEnumProcesses(lpdwPIDs, dwSize2, &dwSize)) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- return FALSE;
- }
- } while (dwSize == dwSize2);
-
- // How many ProcID's did we get?
- dwSize /= sizeof(DWORD);
-
- // Loop through each ProcID.
- for (dwIndex = 0; dwIndex < dwSize; dwIndex++) {
- TCHAR *szFileNameAux;
- szFileName[0] = '\0';
-
- // Open the process (if we can... security does not permit every process in the system to be opened).
- hProcess = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, lpdwPIDs[dwIndex]);
- if (hProcess) {
- // Here we call EnumProcessModules to get only the first module in the process. This will be the
- // EXE module for which we will retrieve the name.
- if (lpfEnumProcessModules(hProcess, &hMod, sizeof(hMod), &dwSize2)) {
- // Get the module name
- if (!lpfGetModuleBaseName(hProcess, hMod, szFileName, sizeof(szFileName)))
- szFileName[0] = '\0';
- }
- CloseHandle(hProcess);
- }
- szFileNameAux = filename(szFileName);
-
- // Search szFileName in user-defined list
- if (findFilename(szFileNameAux)) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- return TRUE;
- }
-
- // Did we just bump into an NTVDM?
- if (!_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
- BOOL bFound = FALSE;
-
- // Enum the 16-bit stuff.
- lpfVDMEnumTaskWOWEx(lpdwPIDs[dwIndex], (TASKENUMPROCEX) Enum16, (LPARAM)&bFound);
-
- // Did we find any user-defined process?
- if (bFound) {
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
- return TRUE;
- }
- }
- }
- HeapFree(GetProcessHeap(), 0, lpdwPIDs);
-
- // If any OS other than Windows NT 4.0.
- } else {
-
- if (!lpfProcess32Next || !lpfProcess32First || !lpfCreateToolhelp32Snapshot)
- return FALSE;
-
- // Get a handle to a Toolhelp snapshot of all processes.
- if ((hSnapShot = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) == INVALID_HANDLE_VALUE)
- return FALSE;
+ // Get a handle to a Toolhelp snapshot of all processes.
+ if ((hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)) == INVALID_HANDLE_VALUE)
+ return FALSE;
- // While there are processes, keep looping.
- for (procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=lpfProcess32First(hSnapShot, &procentry); bFlag; procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=lpfProcess32Next(hSnapShot, &procentry)) {
- TCHAR *szFileNameAux = filename(procentry.szExeFile);
+ // While there are processes, keep looping.
+ for (procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=Process32First(hSnapShot, &procentry); bFlag; procentry.dwSize=sizeof(PROCESSENTRY32), bFlag=Process32Next(hSnapShot, &procentry)) {
+ TCHAR *szFileNameAux = filename(procentry.szExeFile);
- // Search szFileName in user-defined list
- if (findFilename(szFileNameAux))
- return TRUE;
+ // Search szFileName in user-defined list
+ if (findFilename(szFileNameAux))
+ return TRUE;
- // Did we just bump into an NTVDM?
- if (lpfVDMEnumTaskWOWEx && !_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
- BOOL bFound = FALSE;
+ // Did we just bump into an NTVDM?
+ if (!_wcsicmp(szFileNameAux, L"NTVDM.EXE")) {
+ BOOL bFound = FALSE;
- // Enum the 16-bit stuff.
- lpfVDMEnumTaskWOWEx(procentry.th32ProcessID, (TASKENUMPROCEX)Enum16, (LPARAM)&bFound);
+ // Enum the 16-bit stuff.
+ VDMEnumTaskWOWEx(procentry.th32ProcessID, (TASKENUMPROCEX)Enum16, (LPARAM)&bFound);
- // Did we find any user-defined process?
- if (bFound)
- return TRUE;
- }
- }
+ // Did we find any user-defined process?
+ if (bFound)
+ return TRUE;
+ }
}
return FALSE;
diff --git a/plugins/KeyboardNotify/src/EnumProc.h b/plugins/KeyboardNotify/src/EnumProc.h index 3770d7b694..489ce06fd6 100644 --- a/plugins/KeyboardNotify/src/EnumProc.h +++ b/plugins/KeyboardNotify/src/EnumProc.h @@ -21,7 +21,4 @@ typedef struct { TCHAR **szFileName;
} PROCESS_LIST;
-
-void LoadProcsLibrary(void);
-void UnloadProcsLibrary(void);
BOOL areThereProcessesRunning(void);
diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 074b1236b9..645ea4b192 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -25,10 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static const DWORD ignoreIdToPf1[IGNOREEVENT_MAX] = {PF1_IMRECV, PF1_URLRECV, PF1_FILERECV, 0xFFFFFFFF};
-extern double dWinVer;
-extern BOOL bWindowsNT;
-
-
static DWORD GetMask(HANDLE hContact)
{
DWORD mask = db_get_dw(hContact, KEYBDMODULE, "Mask1", (DWORD)(-1));
@@ -214,7 +210,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA TranslateDialogDefault(hwndDlg);
{ int i;
HIMAGELIST hIml;
- hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ((bWindowsNT && dWinVer >= 5.01)?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, 3+IGNOREEVENT_MAX, 3+IGNOREEVENT_MAX);
+ hIml=ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 3+IGNOREEVENT_MAX, 3+IGNOREEVENT_MAX);
ImageList_AddIcon(hIml, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SMALLDOT)));
ImageList_AddIcon(hIml, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_FILLEDBLOB)));
ImageList_AddIcon(hIml, LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_EMPTYBLOB)));
diff --git a/plugins/KeyboardNotify/src/keyboard.cpp b/plugins/KeyboardNotify/src/keyboard.cpp index b0a6761738..3ce6d8cba3 100644 --- a/plugins/KeyboardNotify/src/keyboard.cpp +++ b/plugins/KeyboardNotify/src/keyboard.cpp @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Common.h"
// Globals
-extern BOOL bWindowsNT;
extern BYTE bEmulateKeypresses;
HANDLE hKbdDev[10] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
@@ -51,9 +50,6 @@ BOOL OpenKeyboardDevice() int i = 0;
TCHAR aux1[MAX_PATH+1], aux2[MAX_PATH+1];
- if (!bWindowsNT)
- return TRUE;
-
do {
mir_sntprintf(aux1, SIZEOF(aux1), _T("Kbd%d"), i);
mir_sntprintf(aux2, SIZEOF(aux2), _T("\\Device\\KeyboardClass%d"), i);
@@ -77,13 +73,6 @@ BOOL ToggleKeyboardLights(BYTE byte) if (bEmulateKeypresses)
return keypresses_ToggleKeyboardLights(byte);
- if (!bWindowsNT) {
- outportb(0x60, 0xED);
- Sleep(10);
- outportb(0x60, byte);
- return TRUE;
- }
-
InputBuffer.UnitId = 0;
InputBuffer.LedFlags = byte;
@@ -98,9 +87,6 @@ void CloseKeyboardDevice() int i = 0;
TCHAR aux[MAX_PATH+1];
- if (!bWindowsNT)
- return;
-
do {
if (hKbdDev[i] != INVALID_HANDLE_VALUE)
CloseHandle(hKbdDev[i]);
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index b961c3b132..860b03ae92 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -68,9 +68,6 @@ BYTE bEmulateKeypresses = 0; DWORD dwLastInput = 0;
POINT lastGlobalMousePos = {0, 0};
-static BOOL (WINAPI * MyGetLastInputInfo)(PLASTINPUTINFO);
-
-
BYTE bFlashOnMsg;
BYTE bFlashOnURL;
BYTE bFlashOnFile;
@@ -104,9 +101,6 @@ BYTE bTrillianLedsOther; PROTOCOL_LIST ProtoList = {0, NULL};
PROCESS_LIST ProcessList = {0, NULL};
-double dWinVer;
-BOOL bWindowsNT;
-
int nWaitDelay;
unsigned int nExternCount = 0;
BOOL bFlashingEnabled = TRUE;
@@ -178,25 +172,10 @@ BOOL checkOpenWindow(HANDLE hContact) return FALSE;
}
-
-BOOL IsSaverOnNT4()
-{
- HDESK hd = OpenDesktop(_T("screen-saver"), 0, FALSE, MAXIMUM_ALLOWED);
-
- if(hd == NULL)
- return GetLastError()==ERROR_ACCESS_DENIED;
-
- CloseDesktop(hd);
- return TRUE;
-}
-
-
BOOL isScreenSaverRunning()
{
BOOL screenSaverIsRunning=FALSE;
- if (bWindowsNT && dWinVer < 5) return IsSaverOnNT4();
-
SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, &screenSaverIsRunning, FALSE);
return screenSaverIsRunning;
}
@@ -208,8 +187,6 @@ BOOL isWorkstationLocked() HDESK hd;
char buf[MAX_PATH];
- if (!bWindowsNT) return FALSE;
-
hd = OpenInputDesktop(0, FALSE, MAXIMUM_ALLOWED); /* if it fails then the workstation is prolly locked anyway */
if (hd == NULL) return TRUE;
GetUserObjectInformation(hd, UOI_NAME, buf, sizeof(buf), NULL); /* if we got it (hmm,) get a name */
@@ -410,11 +387,11 @@ static void FlashThreadFunction() if ((bFlashUntil & UNTIL_NBLINKS) && GetTickCount() > (dwFlashStarted + wBlinksNumber * 1000))
break;
if (bFlashUntil & UNTIL_REATTENDED) {
- if (bMirandaOrWindows == ACTIVE_WINDOWS && MyGetLastInputInfo && !bEmulateKeypresses) {
+ if (bMirandaOrWindows == ACTIVE_WINDOWS && !bEmulateKeypresses) {
LASTINPUTINFO lii;
ZeroMemory(&lii, sizeof(lii));
lii.cbSize = sizeof(lii);
- MyGetLastInputInfo(&lii);
+ GetLastInputInfo(&lii);
dwLastInput = lii.dwTime;
}
if (dwLastInput > dwEventStarted)
@@ -706,7 +683,7 @@ void LoadSettings(void) bFlashOnOther = db_get_b(NULL, KEYBDMODULE, "onother", DEF_SETTING_OTHER);
bFullScreenMode = db_get_b(NULL, KEYBDMODULE, "fscreenmode", DEF_SETTING_FSCREEN);
bScreenSaverRunning = db_get_b(NULL, KEYBDMODULE, "ssaverrunning", DEF_SETTING_SSAVER);
- bWorkstationLocked = (bWindowsNT ? db_get_b(NULL, KEYBDMODULE, "wstationlocked", DEF_SETTING_LOCKED):0);
+ bWorkstationLocked = db_get_b(NULL, KEYBDMODULE, "wstationlocked", DEF_SETTING_LOCKED);
bProcessesAreRunning = db_get_b(NULL, KEYBDMODULE, "procsrunning", DEF_SETTING_PROCS);
bWorkstationActive = db_get_b(NULL, KEYBDMODULE, "wstationactive", DEF_SETTING_ACTIVE);
bFlashIfMsgOpen = db_get_b(NULL, KEYBDMODULE, "ifmsgopen", DEF_SETTING_IFMSGOPEN);
@@ -776,8 +753,6 @@ void GetWindowsVersion(void) if (!GetVersionEx((OSVERSIONINFO *)&osvi))
osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS;
}
- bWindowsNT = osvi.dwPlatformId==VER_PLATFORM_WIN32_NT;
- dWinVer = osvi.dwMajorVersion + osvi.dwMinorVersion / 10.0;
}
@@ -869,12 +844,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
TCHAR eventPrefix[MAX_PATH+1], eventName[MAX_PATH+1];
- LoadProcsLibrary();
- if (bWindowsNT && dWinVer >= 5)
- MyGetLastInputInfo = (BOOL (WINAPI *)(PLASTINPUTINFO)) GetProcAddress(GetModuleHandle(_T("user32")), "GetLastInputInfo");
- else
- MyGetLastInputInfo = NULL;
-
createProtocolList();
LoadSettings();
@@ -972,7 +941,6 @@ extern "C" __declspec(dllexport) int Unload(void) RestoreLEDState();
CloseKeyboardDevice();
- UnloadProcsLibrary();
destroyProcessList();
destroyProtocolList();
@@ -989,7 +957,7 @@ int HookWindowsHooks() if (bFlashUntil & UNTIL_REATTENDED)
switch (bMirandaOrWindows) {
case ACTIVE_WINDOWS:
- if (!MyGetLastInputInfo || bEmulateKeypresses) {
+ if (bEmulateKeypresses) {
if (hMouseHook == NULL)
hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, 0, GetCurrentThreadId());
if (hKeyBoardHook == NULL)
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index e72491c63a..54064e9065 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -40,8 +40,6 @@ void destroyXstatusListAux(void); extern HINSTANCE hInst;
-extern double dWinVer;
-extern BOOL bWindowsNT;
extern BYTE bFlashOnMsg;
extern BYTE bFlashOnURL;
@@ -317,8 +315,6 @@ INT_PTR CALLBACK DlgProcBasicOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg, IDC_FSCREEN, bFullScreenMode ? BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SSAVER, bScreenSaverRunning ? BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LOCKED, bWorkstationLocked ? BST_CHECKED:BST_UNCHECKED);
- if (!bWindowsNT)
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOCKED), FALSE);
CheckDlgButton(hwndDlg, IDC_PGMS, bProcessesAreRunning ? BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_ACTIVE, bWorkstationActive ? BST_CHECKED:BST_UNCHECKED);
@@ -1362,7 +1358,7 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count)
imageCount += XstatusListAux[i].count;
- hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), (bWindowsNT && dWinVer >= 5.01?ILC_COLOR32:ILC_COLOR16)|ILC_MASK, imageCount, imageCount);
+ hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, imageCount, imageCount);
TreeView_SetImageList(hwndTree, hImageList, TVSIL_NORMAL);
ImageList_AddIcon(hImageList, hIconAux=(HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0));
|