Remove obsolete files

This commit is contained in:
2015-10-18 16:26:40 +01:00
parent 6851268cf3
commit 7c1284333f
74 changed files with 0 additions and 4067 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

View File

@@ -1,35 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MsgHook", "MsgHook\MsgHook.vcxproj", "{8E038A94-7D02-49E9-B9F6-5224D9D11225}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SetMsgHook", "SetMsgHook\SetMsgHook.vcxproj", "{34A73B55-8A93-4FB5-83CE-7759C1D23348}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Debug|Win32.ActiveCfg = Debug|Win32
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Debug|Win32.Build.0 = Debug|Win32
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Debug|x64.ActiveCfg = Debug|x64
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Debug|x64.Build.0 = Debug|x64
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Release|Win32.ActiveCfg = Release|Win32
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Release|Win32.Build.0 = Release|Win32
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Release|x64.ActiveCfg = Release|x64
{8E038A94-7D02-49E9-B9F6-5224D9D11225}.Release|x64.Build.0 = Release|x64
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Debug|Win32.ActiveCfg = Debug|Win32
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Debug|Win32.Build.0 = Debug|Win32
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Debug|x64.ActiveCfg = Debug|Win32
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Release|Win32.ActiveCfg = Release|Win32
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Release|Win32.Build.0 = Release|Win32
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Release|x64.ActiveCfg = Release|Win32
{34A73B55-8A93-4FB5-83CE-7759C1D23348}.Release|x64.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -1,261 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
// MsgHook.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
//to fix export declaration had to add .def file
LRESULT CALLBACK CwpHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
COPYDATASTRUCT CDS;
HEVENT Event;
CDS.dwData = 0;
CDS.cbData = sizeof(Event);
CDS.lpData = &Event;
//if (nCode == HC_ACTION)
{
//For WH_CALLWNDPROC hook a pointer to a CWPSTRUCT structure that contains details about the message.
CWPSTRUCT *cwps = (CWPSTRUCT *)lParam;
Event.hWnd = cwps->hwnd;
Event.lParam = cwps->lParam;
Event.wParam = cwps->wParam;
Event.nCode = cwps->message;
Event.dwHookType = WH_CALLWNDPROC;
memset((void *)&Event.wParamStr, '\0', sizeof(TCHAR) * 25);
memset((void *)&Event.lParamStr, '\0', sizeof(TCHAR) * 25);
bool errorFlg = false;
if (cwps->message == WM_SETTEXT && cwps->lParam != 0 && cwps->wParam == 0)
{
if (IsWindowUnicode(Event.hWnd))
{
_tcsncpy_s(Event.lParamStr, 25, (const wchar_t*)Event.lParam, _TRUNCATE);
}
else
{
int asciiSize = (int)strlen((const char*)Event.lParam);
int unicodeSize = (int)_tcslen((const wchar_t*)Event.lParam);
if (unicodeSize > asciiSize)
_tcsncpy_s(Event.lParamStr, 25, (const wchar_t*)Event.lParam, _TRUNCATE);
else
{
int tstrLen = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)cwps->lParam, (int)strlen((LPCSTR)cwps->lParam), NULL, 0); //get t len
if (tstrLen > 24)
tstrLen = 24;
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)cwps->lParam, (int)strlen((LPCSTR)cwps->lParam), Event.lParamStr, tstrLen); // convert char to tchar
}
}
}
//printf("debug: sending to hwnd (%ld) msg %d, wParam %ld, lParam %ld\n", pData->g_hWnd, Event.nCode, Event.wParam, Event.lParam);
if (cwps->hwnd != pData->g_hWnd)
{
BOOL bRes = (BOOL)SendMessage(pData->g_hWnd, WM_COPYDATA, 0, (LPARAM)(VOID*)&CDS); // ask the controlling program if the hook should be passed
}
}
return CallNextHookEx(pData->g_CwpHook, nCode, wParam, lParam); // pass hook to next handler
//return bRes; // Don't tell the other hooks about this message.
}
LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
COPYDATASTRUCT CDS;
HEVENT Event;
CDS.dwData = 0;
CDS.cbData = sizeof(Event);
CDS.lpData = &Event;
if (nCode >=0 && nCode == HC_ACTION)
{
//For WH_GETMESSAGE hook a pointer to a MSG structure that contains details about the message.
MSG *msg = (MSG *)lParam;
Event.hWnd = msg->hwnd;
Event.lParam = msg->lParam;
Event.wParam = msg->wParam;
Event.nCode = msg->message;
Event.dwHookType = WH_GETMESSAGE;
memset((void *)&Event.wParamStr, '\0', sizeof(TCHAR) * 25);
memset((void *)&Event.lParamStr, '\0', sizeof(TCHAR) * 25);
//if (msg->message == WM_SETTEXT && msg->lParam != 0)
// _tcscpy_s(Event.lParamStr, 25, (const wchar_t*)Event.lParam);
//if (msg->message == WM_COMMAND || msg->message == WM_MENUCOMMAND) //infinite loop?
if (msg->hwnd != pData->g_hWnd)
{
BOOL bRes = (BOOL)SendMessage(pData->g_hWnd, WM_COPYDATA, 0, (LPARAM)(VOID*)&CDS); // ask the controlling program if the hook should be passed
}
}
return CallNextHookEx(pData->g_MsgHook, nCode, wParam, lParam); // pass hook to next handler
//return bRes; // Don't tell the other hooks about this message.
}
//support for 32-bit/64-bit apps means the dll might be different to match the process we want to see
extern "C" __declspec(dllexport) BOOL SetCustomMsgHookDll(const TCHAR * hookDll, const char * hookDllProcName)
{
HMODULE dll = LoadLibrary(hookDll); //should provide full dll path and filename
if (dll == NULL)
{
TCHAR errorStr[200];
_stprintf_s(errorStr, _T("Error loading hook library %s"), hookDll);
MessageBox(0, errorStr, _T("Set Hook Dll Error"), 0);
return false;
}
HOOKPROC addr = (HOOKPROC)GetProcAddress(dll, hookDllProcName); //should provide the 'CwpHookProc'
if (addr == NULL)
{
char errorStr[200];
sprintf_s(errorStr, "Error loading hook library procedure %s", hookDllProcName);
MessageBoxA(0, errorStr, "Set Hook Dll Error", 0);
return false;
}
pData->g_hInstance = dll;
pData->g_CwpHookProc = addr;
return true;
}
extern "C" __declspec(dllexport) BOOL SetMsgHook(HWND callerHWnd, DWORD threadId)
{
// if(bStartingProcess) // if we're just starting the DLL for the first time,
{
pData->g_hWnd = callerHWnd; // remember the windows and hook handle for further instances
if (pData->g_CwpHookProc == NULL)
pData->g_CwpHookProc = (HOOKPROC)CwpHookProc;
pData->g_CwpHook = SetWindowsHookEx(WH_CALLWNDPROC, pData->g_CwpHookProc, (HINSTANCE)pData->g_hInstance, threadId);
//pData->g_MsgHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)MsgHookProc, (HINSTANCE)pData->g_hInstance, threadId);
if (pData->g_CwpHook == NULL) {
TCHAR tmp[100];
_stprintf_s(tmp, _T("Last Error # %ld on threadId %ld"), GetLastError(), threadId);
MessageBox(0, tmp, _T("Set Hook Error"), 0);
}
return (pData->g_CwpHook != NULL); //pData->g_CwpHook != NULL &&
}
/*else
{
//MessageBox(0, _T("Error: Not starting process"), _T("Set Hook Error"), 0);
return false;
}*/
}
extern "C" __declspec(dllexport) HHOOK GetCurrentHookHandle()
{
return pData->g_CwpHook; //if NULL hook isn't running
}
extern "C" __declspec(dllexport) void SetGlobalDLLInstance(HANDLE dllInstance)
{
pData->g_hInstance = dllInstance;
}
extern "C" __declspec(dllexport) BOOL RemoveHook()
{
if (pData == NULL)
return false;
if(pData->g_MsgHook) // if the hook is defined
{
UnhookWindowsHookEx(pData->g_MsgHook);
pData->g_MsgHook = NULL;
}
if(pData->g_CwpHook) // if the hook is defined
{
BOOL ret = UnhookWindowsHookEx(pData->g_CwpHook);
pData->g_hWnd = NULL; // reset data
pData->g_CwpHook = NULL;
pData->g_CwpHookProc = NULL;
return ret;
}
return false;
}
//testing if process 64 bit, needed to verify this dll can hook & attach to target process
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
extern "C" __declspec(dllexport) BOOL IsCurrentProcess64Bit()
{
return IsProcess64Bit(_getpid());
}
extern "C" __declspec(dllexport) BOOL IsProcess64Bit(DWORD procId)
{
SYSTEM_INFO stInfo;
GetNativeSystemInfo(&stInfo); // if native system is x86 skip wow64 test
if (stInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
return false; //printf( "Processor Architecture: Intel x86\n");
BOOL bIsWow64 = FALSE;
//IsWow64Process is not available on all supported versions of Windows.
//Use GetModuleHandle to get a handle to the DLL that contains the function
//and GetProcAddress to get a pointer to the function if available.
fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
if(fnIsWow64Process != NULL)
{
HANDLE procHandle = NULL;//GetCurrentProcess();
procHandle = OpenProcess(PROCESS_QUERY_INFORMATION, false, procId);
if (!fnIsWow64Process(procHandle, &bIsWow64))
{
//handle error
}
CloseHandle(procHandle);
if (bIsWow64) // NOT a native 64bit process
return false;
return true;// is a native 64bit process
}
return false; //some error finding function "IsWow64Process" assume not 64-bit
}
extern "C" __declspec(dllexport) DWORD GetProcessMainThreadId(DWORD procId)
{
#ifndef MAKEULONGLONG
#define MAKEULONGLONG(ldw, hdw) ((ULONGLONG(hdw) << 32) | ((ldw) & 0xFFFFFFFF))
#endif
#ifndef MAXULONGLONG
#define MAXULONGLONG ((ULONGLONG)~((ULONGLONG)0))
#endif
DWORD dwMainThreadID = 0;
ULONGLONG ullMinCreateTime = MAXULONGLONG;
//includes all threads in the system
HANDLE hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hThreadSnap != INVALID_HANDLE_VALUE) {
THREADENTRY32 th32;
th32.dwSize = sizeof(THREADENTRY32);
BOOL bOK = TRUE;
//Enumerate all threads in the system and filter on th32OwnerProcessID = pid
for (bOK = Thread32First(hThreadSnap, &th32); bOK ; bOK = Thread32Next(hThreadSnap, &th32)) {
//if (th32.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(th32.th32OwnerProcessID)) {
if (th32.th32OwnerProcessID == procId && (th32.dwSize >= FIELD_OFFSET(THREADENTRY32, th32OwnerProcessID) + sizeof(th32.th32OwnerProcessID))) {
//_tprintf(_T("DEBUG Enumerate Process (%ld) Thread Id: %ld\n"), procId, th32.th32ThreadID);
HANDLE hThread = OpenThread(THREAD_QUERY_INFORMATION, TRUE, th32.th32ThreadID);
if (hThread) {
FILETIME afTimes[4] = {0};
if (GetThreadTimes(hThread, &afTimes[0], &afTimes[1], &afTimes[2], &afTimes[3])) {
ULONGLONG ullTest = MAKEULONGLONG(afTimes[0].dwLowDateTime, afTimes[0].dwHighDateTime);
if (ullTest && ullTest < ullMinCreateTime) { //check each thread's creation time
ullMinCreateTime = ullTest;
dwMainThreadID = th32.th32ThreadID; // let it be main thread
}
}
CloseHandle(hThread); //must close opened thread
}
}
}
#ifndef UNDER_CE
CloseHandle(hThreadSnap); //close thread snapshot
#else
CloseToolhelp32Snapshot(hThreadSnap); //close thread snapshot
#endif
}
return dwMainThreadID; //returns main thread id or returns 0 if can't find it
}

View File

@@ -1,5 +0,0 @@
LIBRARY MsgHook
EXPORTS
CwpHookProc @1
MsgHookProc @2

View File

@@ -1,196 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8E038A94-7D02-49E9-B9F6-5224D9D11225}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MsgHook</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MSGHOOK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>MsgHook.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MSGHOOK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>MsgHook.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MSGHOOK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>MsgHook.def</ModuleDefinitionFile>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\MsgHook$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MSGHOOK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>MsgHook.def</ModuleDefinitionFile>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\MsgHook$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="..\SetMsgHook\bin\SetMsgHook32.exe" />
<None Include="..\SetMsgHook\bin\SetMsgHook64.exe" />
<None Include="binary1.bin" />
<None Include="MsgHook.def" />
<None Include="MsgHookTest.ico" />
<None Include="ReadMe.txt" />
<None Include="small.ico" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="MsgLookup.h" />
<ClInclude Include="org_synthuse_MsgHook.h" />
<ClInclude Include="ResExtract.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
</ClCompile>
<ClCompile Include="MsgHook.cpp" />
<ClCompile Include="MsgHookWindow.cpp" />
<ClCompile Include="org_synthuse_MsgHook.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MsgHookTest.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="MsgHookTest.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="small.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="MsgHook.def">
<Filter>Source Files</Filter>
</None>
<None Include="binary1.bin">
<Filter>Resource Files</Filter>
</None>
<None Include="..\SetMsgHook\bin\SetMsgHook64.exe" />
<None Include="..\SetMsgHook\bin\SetMsgHook32.exe" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="org_synthuse_MsgHook.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MsgLookup.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ResExtract.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MsgHook.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="org_synthuse_MsgHook.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MsgHookWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MsgHookTest.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

View File

@@ -1,635 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
// MsgHookTest.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include "MsgLookup.h"
#include "ResExtract.h"
//#include "MsgHookTest.h"
//#include "MsgHook.h"
#define MAX_LOADSTRING 100
// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
HWND mainHwnd = NULL;
HMENU mainMenu = NULL;
#define TXTBOX_LIMIT 700000
HWND txtbox = NULL;
HWND targetHwnd = NULL;
DWORD targetPid = 0;
const int txtboxSpacing = 2;
long msgCount = 0;
//message filters flags
bool filterWmCommand = false;
bool filterWmNotify = false;
bool filterCustom = false;
bool filterAbove = false;
TCHAR dll32bitName[500] = _T("");
TCHAR dll64bitName[500] = _T("");
char dllProcName[500] = "CwpHookProc";
//#define MAX_TEST_SIZE 100
//TCHAR targetClassname[MAX_TEST_SIZE] = _T("Notepad");
TCHAR targetProcessId[MAX_TEST_SIZE] = _T("");
TCHAR targetClassname[MAX_TEST_SIZE] = _T("");
TCHAR targetHwndStr[MAX_TEST_SIZE] = _T("");
TCHAR testWmSettextL[MAX_TEST_SIZE] = _T("This is a test");
TCHAR testWmSettextW[MAX_TEST_SIZE] = _T("0");
TCHAR testWmCommandL[MAX_TEST_SIZE] = _T("0");
TCHAR testWmCommandW[MAX_TEST_SIZE] = _T("1");
TCHAR customMsgStr[MAX_TEST_SIZE] = _T("WM_SETTEXT");
const int hotkeyIdOffset = 0;
const int pauseHotKey = 'P'; //P
bool isPaused = false;
// Forward declarations of functions included in this code module:
int APIENTRY StartWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK DlgProc(HWND, UINT, WPARAM, LPARAM);
void AppendText(HWND txtHwnd, LPCTSTR newText)
{
if (isPaused)
return;
DWORD len = GetWindowTextLength(txtHwnd);
if (len > (TXTBOX_LIMIT - 500))
{//need to truncate the beginning so the text doesn't go past it's limit
SendMessage(txtHwnd, EM_SETSEL, 0, 20000);
SendMessage(txtHwnd, EM_REPLACESEL, 0, (LPARAM)_T(""));
len = GetWindowTextLength(txtHwnd);
}
//DWORD l,r;
//SendMessage(txtHwnd, EM_GETSEL,(WPARAM)&l,(LPARAM)&r);
SendMessage(txtHwnd, EM_SETSEL, len, len);
SendMessage(txtHwnd, EM_REPLACESEL, 0, (LPARAM)newText);
len = GetWindowTextLength(txtHwnd);
SendMessage(txtHwnd, EM_SETSEL, len, len);
//SendMessage(txtHwnd, EM_SETSEL,l,r);
}
void InitMsgFiltersAndLookup()
{
if (!filterWmCommand && !filterAbove && !filterWmNotify && !filterCustom)
InitializeMsgLookup();
else
{
int allowList[4];
for (int i = 0; i < 4; i ++)
allowList[i] = -1;
if (filterWmCommand) {
AppendText(txtbox, _T("filtering on WM_COMMAND & WM_MENUCOMMAND\r\n"));
allowList[0] = WM_COMMAND;
allowList[1] = WM_MENUCOMMAND;
}
if (filterWmNotify)
{
AppendText(txtbox, _T("filtering on WM_NOTIFY\r\n"));
allowList[2] = WM_NOTIFY;
}
//if (filterAbove)
// allowList[0] = WM_COMMAND;
if (filterCustom && _tcslen(customMsgStr) > 0)
{
InitializeMsgLookup(); //initialize full msg list and do reverse lookup based on custom filter string
for (int x = 0; x < MAX_MSG_LOOKUP; x++)
{
if (_tcscmp(customMsgStr, MSG_LOOKUP[x]) == 0) {
TCHAR tmp[100];
_stprintf_s(tmp, _T("filtering on %s (%d)\r\n"), customMsgStr, x);
AppendText(txtbox, tmp);
allowList[3] = x;
}
}
}
InitializeMsgLookup(allowList, 4);
}
}
void StartMessageHook()
{
AppendText(txtbox, _T("Starting Message Hook\r\n"));
//targetHwnd = FindWindow(targetClassname, NULL);
TCHAR tmp[500];
DWORD tid = 0;
if (_tcscmp(targetHwndStr, _T("")) != 0) //if target HWND was used
{
TCHAR *stopStr;
targetHwnd = (HWND)_tcstol(targetHwndStr, &stopStr, 10);
tid = GetWindowThreadProcessId(targetHwnd, NULL);
_stprintf_s(tmp, _T("Target Handle: %ld, and Thread Id: %ld\r\n"), targetHwnd, tid);
}
targetPid = 0;
if (_tcscmp(targetProcessId, _T("")) != 0) //if target pid was used
{
TCHAR *stopStr;
targetPid = (DWORD)_tcstol(targetProcessId, &stopStr, 10);
tid = GetProcessMainThreadId(targetPid);
_stprintf_s(tmp, _T("Target PId: %ld, and Thread Id: %ld\r\n"), targetPid, tid);
}
InitMsgFiltersAndLookup();
//InitializeMsgLookup();
AppendText(txtbox, tmp);
//block self/global msg hook
if (tid == 0) {
AppendText(txtbox, _T("Target thread not found\r\n"));
return;
}
if (targetPid != 0) // handle various types of bit matching
{
BOOL current64bit = IsCurrentProcess64Bit();
if (IsProcess64Bit(targetPid) && current64bit)
{
_stprintf_s(tmp, _T("Target PId (%ld) is a matching 64 bit process\r\n"), targetPid);
SetCustomMsgHookDll(dll64bitName, dllProcName);
}
else if(!IsProcess64Bit(targetPid) && !current64bit)
{
_stprintf_s(tmp, _T("Target PId (%ld) is a matching 32 bit process\r\n"), targetPid);
SetCustomMsgHookDll(dll32bitName, dllProcName);
}
else
{
if (current64bit)
_stprintf_s(tmp, _T("Target PId (%ld) is a not matching 64 bit process.\r\n"), targetPid);
else
_stprintf_s(tmp, _T("Target PId (%ld) is a not matching 32 bit process.\r\n"), targetPid);
AppendText(txtbox, tmp);
TCHAR *dllname = dll32bitName;
TCHAR *exename = _T("SetMsgHook32.exe");
int setMsgHookRes = IDR_SETMH32;
if (IsProcess64Bit(targetPid))
{
dllname = dll64bitName;
exename = _T("SetMsgHook64.exe");
setMsgHookRes = IDR_SETMH64;
}
_tcscat_s(tmp, 500, _T("Do you wish to open a new matching Message Hook Window?"));
int mbResult = MessageBox(mainHwnd, tmp, _T("Message Hook"), MB_ICONQUESTION | MB_YESNO);
if (mbResult == IDNO)
return ;
_stprintf_s(tmp, _T("%s %s 0 %d"), exename, dllname, targetPid);
RunResource(setMsgHookRes, tmp);
//EnableMenuItem(mainMenu, ID_FILE_STOPHOOK, MF_ENABLED);
//EnableMenuItem(mainMenu, ID_FILE_STARTHOOK, MF_DISABLED | MF_GRAYED);
_tcscat_s(tmp, 500, _T("\r\n"));
AppendText(txtbox, tmp);
PostQuitMessage(2);
return;
}
AppendText(txtbox, tmp);
}
if (SetMsgHook(mainHwnd, tid))
{
EnableMenuItem(mainMenu, ID_FILE_STOPHOOK, MF_ENABLED);
EnableMenuItem(mainMenu, ID_FILE_STARTHOOK, MF_DISABLED | MF_GRAYED);
AppendText(txtbox, _T("Hook successfully initialized\r\n"));
}
else
AppendText(txtbox, _T("Hook failed to initialize\r\n"));
}
void StopMessageHook()
{
EnableMenuItem(mainMenu, ID_FILE_STOPHOOK, MF_DISABLED | MF_GRAYED);
EnableMenuItem(mainMenu, ID_FILE_STARTHOOK, MF_ENABLED);
AppendText(txtbox, TEXT("Stopping Message Hook\r\n"));
//KillHook();
RemoveHook();
msgCount = 0;
}
bool OnCopyData(COPYDATASTRUCT* pCopyDataStruct) // WM_COPYDATA lParam will have this struct
{
if( pCopyDataStruct->cbData!=sizeof(HEVENT))
return false;
HEVENT Event;
memcpy(&Event, (HEVENT*)pCopyDataStruct->lpData, sizeof(HEVENT)); // transfer data to internal variable
if (Event.dwHookType == WH_KEYBOARD)
{
//KBDLLHOOKSTRUCT* pkh = (KBDLLHOOKSTRUCT*) Event.lParam;
//char tmp[50];
//return wkvn->KeyboardData(pkh->vkCode,Event.wParam);
}
else if (Event.dwHookType == WH_MOUSE)
{
//MSLLHOOKSTRUCT* pmh = (MSLLHOOKSTRUCT*) Event.lParam;
//char tmp[50];
//if (Event.wParam == WM_LBUTTONDOWN)
// return wkvn->MouseClickData(1,true);
// else
// return wkvn->MouseMoveData(pmh->pt.x,pmh->pt.y);
}
else if (Event.dwHookType == WH_CALLWNDPROC)
{
TCHAR *msgName = _T("unknown");
if (Event.nCode < MAX_MSG_LOOKUP)
msgName = MSG_LOOKUP[Event.nCode];
else
{
if (!filterAbove)
return false;
}
if (_tcscmp(msgName, _T("")) != 0)
{
++msgCount;
TCHAR msgHwndClassname[20];
GetClassName(Event.hWnd, msgHwndClassname, 20);
TCHAR tmp[200];
_stprintf_s(tmp, _T("<%07ld> hwnd: %ld (%s), msg: %s (%ld), wparam: '%s'[%ld], lparam: '%s'{%ld}\r\n"), msgCount, Event.hWnd, msgHwndClassname, msgName, Event.nCode, Event.wParamStr, Event.wParam, Event.lParamStr,Event.lParam);
AppendText(txtbox, tmp);
}
}
return false;
}
void SendWmSettext() //ID_TESTMSGS_WM
{
//SetWindowText(targetHwnd, _T("This is a test"));
//TCHAR txt[] = _T("This is a test");
TCHAR *stopStr;
long wparam = _tcstol(testWmSettextW, &stopStr, 10);
SendMessage(targetHwnd, WM_SETTEXT, wparam, (LPARAM)testWmSettextL);
//PostMessage(targetHwnd, WM_SETTEXT, 0 , (LPARAM)txt);
}
void SendWmCommand() //ID_TESTMSGS_WM
{
TCHAR *stopStr;
HWND sendHwnd = targetHwnd;
if (_tcscmp(targetHwndStr, _T("")) != 0)
{
sendHwnd = (HWND)_tcstol(targetHwndStr, &stopStr, 10);
}
long wparam = _tcstol(testWmCommandW, &stopStr, 10);
long lparam = _tcstol(testWmCommandL, &stopStr, 10);
SendMessage(sendHwnd, WM_COMMAND, wparam, lparam);
/*
TCHAR tmp[500];
_stprintf_s(tmp, _T("hook handle %ld\r\n"), (long)GetCurrentHookHandle());
AppendText(txtbox, tmp); */
}
void HotKeyPressed(WPARAM wParam)
{
//AppendText(txtbox, _T("hotkey test"));
if (wParam == (pauseHotKey + hotkeyIdOffset))
{
if (!isPaused)
{
AppendText(txtbox, _T("Paused\r\n"));
isPaused = true;
}
else
{
isPaused = false;
AppendText(txtbox, _T("Unpaused\r\n"));
}
}
}
extern "C" __declspec(dllexport) void CreateMsgHookWindow(LPTSTR lpCmdLine)
{
//StartWinMain(GetModuleHandle(NULL), NULL, lpCmdLine, SW_SHOW);
StartWinMain((HINSTANCE)pData->g_hInstance, NULL, lpCmdLine, SW_SHOW);
}
int APIENTRY StartWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
// get this Dlls path, by default set both 32 and 64 bit names the same
if (_tcscmp(dll32bitName, _T("")) == 0 && _tcscmp(dll64bitName, _T("")) == 0)
{
HMODULE hm = NULL;
if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,(LPCWSTR) &StartWinMain, &hm))
{
int ret = GetLastError();
fprintf(stderr, "GetModuleHandle returned %d\n", ret);
}
GetModuleFileName(hm, dll32bitName, sizeof(dll32bitName));
GetModuleFileName(hm, dll64bitName, sizeof(dll64bitName));
//MessageBox(0, dll32bitname, dll64bitname, 0);
}
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_MSGHOOKTEST, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MSGHOOKTEST));
if (lpCmdLine != NULL) //process command line args
{
if (_tcslen(lpCmdLine) > 0)
{
TCHAR *stopStr;
targetPid = (DWORD)_tcstol(lpCmdLine, &stopStr, 10);
_stprintf_s(targetProcessId, _T("%ld"), (long)targetPid);
StartMessageHook();
}
}
// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
//if (msg.message == WM_HOTKEY)
// HotKeyPressed(msg.wParam);
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
UnregisterHotKey(mainHwnd, pauseHotKey + hotkeyIdOffset);
return (int) msg.wParam;
}
//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
// function that was added to Windows 95. It is important to call this function
// so that the application will get 'well formed' small icons associated
// with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MSGHOOKICO));
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_MSGHOOKTEST);
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassEx(&wcex);
}
//
// FUNCTION: InitInstance(HINSTANCE, int)
//
// PURPOSE: Saves instance handle and creates main window
//
// COMMENTS:
//
// In this function, we save the instance handle in a global variable and
// create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, 700, 300, NULL, NULL, hInstance, NULL);
if (!hWnd) {
DWORD lastErr = GetLastError();
printf("Error Creating Window %d\n", lastErr);
_tprintf(_T("Window Class Name: %s, Instance: %ld\n"), szWindowClass, (long)hInstance);
return FALSE;
}
mainHwnd = hWnd;
RECT rect;
GetClientRect(hWnd, &rect);
// make the txtbox edit control almost the same size as the parent window
//WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL
txtbox = CreateWindow(TEXT("Edit"),TEXT(""), WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_VSCROLL | ES_AUTOVSCROLL | ES_READONLY,
txtboxSpacing, txtboxSpacing,rect.right-(txtboxSpacing*2), rect.bottom-(txtboxSpacing*2), hWnd, NULL, NULL, NULL);
SendMessage(txtbox, EM_SETLIMITTEXT, (WPARAM)TXTBOX_LIMIT, 0);
HFONT hFont = CreateFont(14, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET,
OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"));
SendMessage(txtbox, WM_SETFONT, (WPARAM)hFont, TRUE);
mainMenu = GetMenu(mainHwnd);
EnableMenuItem(mainMenu, ID_FILE_STOPHOOK, MF_DISABLED | MF_GRAYED);
RegisterHotKey(mainHwnd, pauseHotKey + hotkeyIdOffset, MOD_NOREPEAT | MOD_SHIFT | MOD_CONTROL, pauseHotKey);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
//set always on top
SetWindowPos(mainHwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE| SWP_NOMOVE);
return TRUE;
}
//
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
// PURPOSE: Processes messages for the main window.
//
// WM_COMMAND - process the application menu
// WM_PAINT - Paint the main window
// WM_DESTROY - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CREATE:
//appendText(txtbox, TEXT("test\r\n"));
break;
case WM_COPYDATA:
return (OnCopyData((COPYDATASTRUCT *) lParam));
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case ID_FILE_STARTHOOK:
StartMessageHook();
break;
case ID_FILE_STOPHOOK:
StopMessageHook();
break;
case ID_TESTMSGS_WM:
SendWmSettext();
break;
case ID_TESTMSGS_WMCOM:
SendWmCommand();
break;
case ID_PROC64TEST:
if (_tcscmp(targetProcessId, _T("")) != 0) //if target pid was used
{
TCHAR tmp[500];
TCHAR *stopStr;
targetPid = (DWORD)_tcstol(targetProcessId, &stopStr, 10);
BOOL current64bit = IsCurrentProcess64Bit();
if (IsProcess64Bit(targetPid) && current64bit)
_stprintf_s(tmp, _T("Target pid (%ld) is a matching 64 bit process\r\n"), targetPid);
else if(!IsProcess64Bit(targetPid) && !current64bit)
_stprintf_s(tmp, _T("Target pid (%ld) is a matching 32 bit process\r\n"), targetPid);
else if (IsProcess64Bit(targetPid))
_stprintf_s(tmp, _T("Target pid (%ld) is 64 bit process\r\n"), targetPid);
else
_stprintf_s(tmp, _T("Target pid (%ld) is 32 bit process\r\n"), targetPid);
AppendText(txtbox, tmp);
//ExtractResource(IDR_SETMH32, _T("SetMsgHook32.exe"));
//_stprintf_s(tmp, _T(" %s %ld %d"), dll32bitName, (long)mainHwnd, targetPid);
//RunResource(IDR_SETMH32, tmp);
//MessageBox(0, , _T("64 bit Test"), 0);
}
break;
case ID_FILE_SETTINGS:
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hWnd, DlgProc);
break;
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, DlgProc);
break;
case ID_FILE_CLEAR:
SetWindowText(txtbox, _T(""));
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_HOTKEY:
HotKeyPressed(wParam);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
EndPaint(hWnd, &ps);
break;
case WM_SIZE:
{ //resize the txtbox when the parent window size changes
int nWidth = LOWORD(lParam);
int nHeight = HIWORD(lParam);
SetWindowPos(txtbox, HWND_NOTOPMOST, txtboxSpacing, txtboxSpacing, nWidth-(txtboxSpacing*2), nHeight-(txtboxSpacing*2), SWP_NOZORDER|SWP_NOMOVE);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// Message handler for about box.
INT_PTR CALLBACK DlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
//IDC_EDIT1
//SendDlgItemMessage(hDlg, IDC_EDIT1, WM_SETTEXT, 0 , (LPARAM)targetClassname);
SendDlgItemMessage(hDlg, IDC_TARGETPID, WM_SETTEXT, 0 , (LPARAM)targetProcessId);
if (filterWmCommand)
SendDlgItemMessage(hDlg, IDC_CHECK_CMD, BM_SETCHECK, BST_CHECKED, 0);
if (filterWmNotify)
SendDlgItemMessage(hDlg, IDC_CHECK_NOT, BM_SETCHECK, BST_CHECKED, 0);
if (filterAbove)
SendDlgItemMessage(hDlg, IDC_CHECK_ABO, BM_SETCHECK, BST_CHECKED, 0);
if (filterCustom)
SendDlgItemMessage(hDlg, IDC_CUSTOMCHK, BM_SETCHECK, BST_CHECKED, 0);
SendDlgItemMessage(hDlg, IDC_WMCOMW, WM_SETTEXT, 0 , (LPARAM)testWmCommandW);
SendDlgItemMessage(hDlg, IDC_WMCOML, WM_SETTEXT, 0 , (LPARAM)testWmCommandL);
SendDlgItemMessage(hDlg, IDC_WMSETW, WM_SETTEXT, 0 , (LPARAM)testWmSettextW);
SendDlgItemMessage(hDlg, IDC_WMSETL, WM_SETTEXT, 0 , (LPARAM)testWmSettextL);
SendDlgItemMessage(hDlg, IDC_HWND, WM_SETTEXT, 0 , (LPARAM)targetHwndStr);
SendDlgItemMessage(hDlg, IDC_CUSTOMMSG, WM_SETTEXT, 0 , (LPARAM)customMsgStr);
}
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK) //only save on OK
{
//GetDlgItemText(hDlg, IDC_EDIT1, targetClassname, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_TARGETPID, targetProcessId, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_WMCOMW, testWmCommandW, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_WMCOML, testWmCommandL, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_WMSETW, testWmSettextW, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_WMSETL, testWmSettextL, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_HWND, targetHwndStr, MAX_TEST_SIZE);
GetDlgItemText(hDlg, IDC_CUSTOMMSG, customMsgStr, MAX_TEST_SIZE);
// check filter options
filterWmCommand = (SendDlgItemMessage(hDlg, IDC_CHECK_CMD, BM_GETCHECK, 0, 0) == BST_CHECKED); // the hard way
filterWmNotify = (IsDlgButtonChecked(hDlg, IDC_CHECK_NOT) == BST_CHECKED);// the easy way
filterAbove = (IsDlgButtonChecked(hDlg, IDC_CHECK_ABO) == BST_CHECKED);
filterCustom = (IsDlgButtonChecked(hDlg, IDC_CUSTOMCHK) == BST_CHECKED);
InitMsgFiltersAndLookup();
}
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}

View File

@@ -1,250 +0,0 @@
#include "stdafx.h"
// MSG Array LOOKUP
const int MAX_MSG_LOOKUP = 1024;
const int MAX_MSG_NAME = 21;
TCHAR MSG_LOOKUP[MAX_MSG_LOOKUP][MAX_MSG_NAME] = {
};
//void InitializeMsgLookup() below
void InitializeMsgLookup(int allowList[], int allowSize)
{
for (int i = 0 ; i < MAX_MSG_LOOKUP ; i++)
{
bool allowFlg = true;
if (allowSize > 0)
allowFlg = false;
for (int a = 0 ; a < allowSize ; a++)
if (allowList[a] == i)
allowFlg = true;
if (!allowFlg)
{
memset((void *)&MSG_LOOKUP[i], '\0', sizeof(TCHAR) * MAX_MSG_NAME); //blank it
continue;
}
switch (i)
{
case WM_NULL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NULL")); break;
case WM_CREATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CREATE")); break;
case WM_DESTROY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DESTROY")); break;
case WM_MOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOVE")); break;
case WM_SIZE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SIZE")); break;
case WM_ACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ACTIVATE")); break;
case WM_SETFOCUS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETFOCUS")); break;
case WM_KILLFOCUS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KILLFOCUS")); break;
case WM_ENABLE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENABLE")); break;
case WM_SETREDRAW: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETREDRAW")); break;
case WM_SETTEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETTEXT")); break;
case WM_GETTEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETTEXT")); break;
case WM_GETTEXTLENGTH: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETTEXTLENGTH")); break;
case WM_PAINT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PAINT")); break;
case WM_CLOSE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CLOSE")); break;
case WM_QUERYENDSESSION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYENDSESSION")); break;
case WM_QUIT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUIT")); break;
case WM_QUERYOPEN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYOPEN")); break;
case WM_ERASEBKGND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ERASEBKGND")); break;
case WM_SYSCOLORCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSCOLORCHANGE")); break;
case WM_ENDSESSION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENDSESSION")); break;
case 0x17: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSTEMERROR")); break;
case WM_SHOWWINDOW: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SHOWWINDOW")); break;
case 0x19: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLOR")); break;
case WM_WININICHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_WININICHANGE")); break;
//case WM_SETTINGCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETTINGCHANGE")); break;
case WM_DEVMODECHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DEVMODECHANGE")); break;
case WM_ACTIVATEAPP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ACTIVATEAPP")); break;
case WM_FONTCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_FONTCHANGE")); break;
case WM_TIMECHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_TIMECHANGE")); break;
case WM_CANCELMODE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CANCELMODE")); break;
case WM_SETCURSOR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETCURSOR")); break;
case WM_MOUSEACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEACTIVATE")); break;
case WM_CHILDACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHILDACTIVATE")); break;
case WM_QUEUESYNC: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUEUESYNC")); break;
case WM_GETMINMAXINFO: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETMINMAXINFO")); break;
case WM_PAINTICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PAINTICON")); break;
case WM_ICONERASEBKGND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ICONERASEBKGND")); break;
case WM_NEXTDLGCTL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NEXTDLGCTL")); break;
case WM_SPOOLERSTATUS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SPOOLERSTATUS")); break;
case WM_DRAWITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DRAWITEM")); break;
case WM_MEASUREITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MEASUREITEM")); break;
case WM_DELETEITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DELETEITEM")); break;
case WM_VKEYTOITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_VKEYTOITEM")); break;
case WM_CHARTOITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHARTOITEM")); break;
case WM_SETFONT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETFONT")); break;
case WM_GETFONT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETFONT")); break;
case WM_SETHOTKEY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETHOTKEY")); break;
case WM_GETHOTKEY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETHOTKEY")); break;
case WM_QUERYDRAGICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYDRAGICON")); break;
case WM_COMPAREITEM: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COMPAREITEM")); break;
case WM_COMPACTING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COMPACTING")); break;
case WM_WINDOWPOSCHANGING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_WINDOWPOSCHANGING")); break;
case WM_WINDOWPOSCHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_WINDOWPOSCHANGED")); break;
case WM_POWER: _tcscpy_s(MSG_LOOKUP[i], _T("WM_POWER")); break;
case WM_COPYDATA: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COPYDATA")); break;
case WM_CANCELJOURNAL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CANCELJOURNAL")); break;
case WM_NOTIFY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NOTIFY")); break;
case WM_INPUTLANGCHANGEREQUEST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INPUTLANGCHANGERE")); break;
case WM_INPUTLANGCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INPUTLANGCHANGE")); break;
case WM_TCARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_TCARD")); break;
case WM_HELP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HELP")); break;
case WM_USERCHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_USERCHANGED")); break;
case WM_NOTIFYFORMAT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NOTIFYFORMAT")); break;
case WM_CONTEXTMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CONTEXTMENU")); break;
case WM_STYLECHANGING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_STYLECHANGING")); break;
case WM_STYLECHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_STYLECHANGED")); break;
case WM_DISPLAYCHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DISPLAYCHANGE")); break;
case WM_GETICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETICON")); break;
case WM_SETICON: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SETICON")); break;
case WM_NCCREATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCCREATE")); break;
case WM_NCDESTROY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCDESTROY")); break;
case WM_NCCALCSIZE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCCALCSIZE")); break;
case WM_NCHITTEST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCHITTEST")); break;
case WM_NCPAINT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCPAINT")); break;
case WM_NCACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCACTIVATE")); break;
case WM_GETDLGCODE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_GETDLGCODE")); break;
case WM_NCMOUSEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMOUSEMOVE")); break;
case WM_NCLBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCLBUTTONDOWN")); break;
case WM_NCLBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCLBUTTONUP")); break;
case WM_NCLBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCLBUTTONDBLCLK")); break;
case WM_NCRBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCRBUTTONDOWN")); break;
case WM_NCRBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCRBUTTONUP")); break;
case WM_NCRBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCRBUTTONDBLCLK")); break;
case WM_NCMBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMBUTTONDOWN")); break;
case WM_NCMBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMBUTTONUP")); break;
case WM_NCMBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMBUTTONDBLCLK")); break;
//case WM_KEYFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYFIRST")); break;
case WM_KEYDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYDOWN")); break;
case WM_KEYUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYUP")); break;
case WM_CHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHAR")); break;
case WM_DEADCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DEADCHAR")); break;
case WM_SYSKEYDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSKEYDOWN")); break;
case WM_SYSKEYUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSKEYUP")); break;
case WM_SYSCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSCHAR")); break;
case WM_SYSDEADCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSDEADCHAR")); break;
case WM_KEYLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_KEYLAST")); break;
case WM_IME_STARTCOMPOSITION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_STARTCOMPOSIT")); break;
case WM_IME_ENDCOMPOSITION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_ENDCOMPOSITIO")); break;
case WM_IME_COMPOSITION: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_COMPOSITION")); break;
//case WM_IME_KEYLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_KEYLAST")); break;
case WM_INITDIALOG: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INITDIALOG")); break;
case WM_COMMAND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COMMAND")); break;
case WM_SYSCOMMAND: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SYSCOMMAND")); break;
case WM_TIMER: _tcscpy_s(MSG_LOOKUP[i], _T("WM_TIMER")); break;
case WM_HSCROLL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HSCROLL")); break;
case WM_VSCROLL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_VSCROLL")); break;
case WM_INITMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INITMENU")); break;
case WM_INITMENUPOPUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_INITMENUPOPUP")); break;
case WM_MENUSELECT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MENUSELECT")); break;
case WM_MENUCHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MENUCHAR")); break;
case WM_ENTERIDLE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENTERIDLE")); break;
case WM_CTLCOLORMSGBOX: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORMSGBOX")); break;
case WM_CTLCOLOREDIT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLOREDIT")); break;
case WM_CTLCOLORLISTBOX: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORLISTBOX")); break;
case WM_CTLCOLORBTN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORBTN")); break;
case WM_CTLCOLORDLG: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORDLG")); break;
case WM_CTLCOLORSCROLLBAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORSCROLLBAR")); break;
case WM_CTLCOLORSTATIC: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CTLCOLORSTATIC")); break;
//case WM_MOUSEFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEFIRST")); break;
case WM_MOUSEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEMOVE")); break;
case WM_LBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_LBUTTONDOWN")); break;
case WM_LBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_LBUTTONUP")); break;
case WM_LBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_LBUTTONDBLCLK")); break;
case WM_RBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RBUTTONDOWN")); break;
case WM_RBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RBUTTONUP")); break;
case WM_RBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RBUTTONDBLCLK")); break;
case WM_MBUTTONDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MBUTTONDOWN")); break;
case WM_MBUTTONUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MBUTTONUP")); break;
case WM_MBUTTONDBLCLK: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MBUTTONDBLCLK")); break;
case WM_MOUSEWHEEL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEWHEEL")); break;
case WM_MOUSEHWHEEL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEHWHEEL")); break;
case WM_PARENTNOTIFY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PARENTNOTIFY")); break;
case WM_ENTERMENULOOP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENTERMENULOOP")); break;
case WM_EXITMENULOOP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_EXITMENULOOP")); break;
case WM_NEXTMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NEXTMENU")); break;
case WM_SIZING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SIZING")); break;
case WM_CAPTURECHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CAPTURECHANGED")); break;
case WM_MOVING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOVING")); break;
case WM_POWERBROADCAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_POWERBROADCAST")); break;
case WM_DEVICECHANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DEVICECHANGE")); break;
case WM_MDICREATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDICREATE")); break;
case WM_MDIDESTROY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIDESTROY")); break;
case WM_MDIACTIVATE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIACTIVATE")); break;
case WM_MDIRESTORE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIRESTORE")); break;
case WM_MDINEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDINEXT")); break;
case WM_MDIMAXIMIZE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIMAXIMIZE")); break;
case WM_MDITILE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDITILE")); break;
case WM_MDICASCADE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDICASCADE")); break;
case WM_MDIICONARRANGE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIICONARRANGE")); break;
case WM_MDIGETACTIVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIGETACTIVE")); break;
case WM_MDISETMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDISETMENU")); break;
case WM_ENTERSIZEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ENTERSIZEMOVE")); break;
case WM_EXITSIZEMOVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_EXITSIZEMOVE")); break;
case WM_DROPFILES: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DROPFILES")); break;
case WM_MDIREFRESHMENU: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MDIREFRESHMENU")); break;
case WM_IME_SETCONTEXT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_SETCONTEXT")); break;
case WM_IME_NOTIFY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_NOTIFY")); break;
case WM_IME_CONTROL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_CONTROL")); break;
case WM_IME_COMPOSITIONFULL: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_COMPOSITIONFU")); break;
case WM_IME_SELECT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_SELECT")); break;
case WM_IME_CHAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_CHAR")); break;
case WM_IME_KEYDOWN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_KEYDOWN")); break;
case WM_IME_KEYUP: _tcscpy_s(MSG_LOOKUP[i], _T("WM_IME_KEYUP")); break;
case WM_MOUSEHOVER: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSEHOVER")); break;
case WM_NCMOUSELEAVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_NCMOUSELEAVE")); break;
case WM_MOUSELEAVE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_MOUSELEAVE")); break;
case WM_CUT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CUT")); break;
case WM_COPY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COPY")); break;
case WM_PASTE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PASTE")); break;
case WM_CLEAR: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CLEAR")); break;
case WM_UNDO: _tcscpy_s(MSG_LOOKUP[i], _T("WM_UNDO")); break;
case WM_RENDERFORMAT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RENDERFORMAT")); break;
case WM_RENDERALLFORMATS: _tcscpy_s(MSG_LOOKUP[i], _T("WM_RENDERALLFORMATS")); break;
case WM_DESTROYCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DESTROYCLIPBOARD")); break;
case WM_DRAWCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DRAWCLIPBOARD")); break;
case WM_PAINTCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PAINTCLIPBOARD")); break;
case WM_VSCROLLCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_VSCROLLCLIPBOARD")); break;
case WM_SIZECLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_SIZECLIPBOARD")); break;
case WM_ASKCBFORMATNAME: _tcscpy_s(MSG_LOOKUP[i], _T("WM_ASKCBFORMATNAME")); break;
case WM_CHANGECBCHAIN: _tcscpy_s(MSG_LOOKUP[i], _T("WM_CHANGECBCHAIN")); break;
case WM_HSCROLLCLIPBOARD: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HSCROLLCLIPBOARD")); break;
case WM_QUERYNEWPALETTE: _tcscpy_s(MSG_LOOKUP[i], _T("WM_QUERYNEWPALETTE")); break;
case WM_PALETTEISCHANGING: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PALETTEISCHANGING")); break;
case WM_PALETTECHANGED: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PALETTECHANGED")); break;
case WM_HOTKEY: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HOTKEY")); break;
case WM_PRINT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PRINT")); break;
case WM_PRINTCLIENT: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PRINTCLIENT")); break;
case WM_HANDHELDFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HANDHELDFIRST")); break;
case WM_HANDHELDLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_HANDHELDLAST")); break;
case WM_PENWINFIRST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PENWINFIRST")); break;
case WM_PENWINLAST: _tcscpy_s(MSG_LOOKUP[i], _T("WM_PENWINLAST")); break;
case 0x390: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COALESCE_FIRST")); break;
case 0x39F: _tcscpy_s(MSG_LOOKUP[i], _T("WM_COALESCE_LAST")); break;
case 0x3E0: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_FIRST")); break;
//case 0x3E0: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_INITIATE")); break;
case 0x3E1: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_TERMINATE")); break;
case 0x3E2: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_ADVISE")); break;
case 0x3E3: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_UNADVISE")); break;
case 0x3E4: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_ACK")); break;
case 0x3E5: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_DATA")); break;
case 0x3E6: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_REQUEST")); break;
case 0x3E7: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_POKE")); break;
case 0x3E8: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_EXECUTE")); break;
//case 0x3E8: _tcscpy_s(MSG_LOOKUP[i], _T("WM_DDE_LAST")); break;
//case : _tcscpy_s(MSG_LOOKUP[i], _T("")); break;
default:
memset((void *)&MSG_LOOKUP[i], '\0', sizeof(TCHAR) * MAX_MSG_NAME);
//_tcscpy_s(MSG_LOOKUP[i], 20, _T(""));
break;
}
}
}
void InitializeMsgLookup()
{
int allowList[1];
allowList[0] = -1;
InitializeMsgLookup(allowList, 0);
}

View File

@@ -1,48 +0,0 @@
========================================================================
DYNAMIC LINK LIBRARY : MsgHook Project Overview
========================================================================
AppWizard has created this MsgHook DLL for you.
This file contains a summary of what you will find in each of the files that
make up your MsgHook application.
MsgHook.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
MsgHook.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
MsgHook.cpp
This is the main DLL source file.
When created, this DLL does not export any symbols. As a result, it
will not produce a .lib file when it is built. If you wish this project
to be a project dependency of some other project, you will either need to
add code to export some symbols from the DLL so that an export library
will be produced, or you can set the Ignore Input Library property to Yes
on the General propert page of the Linker folder in the project's Property
Pages dialog box.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named MsgHook.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,86 +0,0 @@
//This function will extract a binary resource.
//
//IDR_SETMH64 BINARY MOVEABLE PURE "..\\SetMsgHook\\bin\\SetMsgHook64.exe"
//IDR_SETMH32 BINARY MOVEABLE PURE "..\\SetMsgHook\\bin\\SetMsgHook32.exe"
#include "stdafx.h"
void ExtractResource(const WORD nID, LPCTSTR szFilename)
{
const HINSTANCE hInstance = (HINSTANCE)pData->g_hInstance;//GetModuleHandle(NULL);
HRSRC hResource = FindResource(hInstance, MAKEINTRESOURCE(nID), _T("BINARY"));// _ASSERTE(hResource);
if (hResource == NULL) // no resource found.
{
//MessageBoxA(0, "error, no resource found", "error", 0);
printf("error, resource %d not found\n", nID);
return;
}
HGLOBAL hFileResource = LoadResource(hInstance, hResource);// _ASSERTE(hFileResource);
LPVOID lpFile = LockResource(hFileResource);
DWORD dwSize = SizeofResource(hInstance, hResource);
// Open the file and filemap
HANDLE hFile = CreateFile(szFilename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE hFilemap = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, dwSize, NULL);
// Get a pointer to write to
LPVOID lpBaseAddress = MapViewOfFile(hFilemap, FILE_MAP_WRITE, 0, 0, 0);
// Write the file
CopyMemory(lpBaseAddress, lpFile, dwSize);
// Unmap the file and close the handles
UnmapViewOfFile(lpBaseAddress);
CloseHandle(hFilemap);
CloseHandle(hFile);
}
void RunResource(const WORD nID, LPWSTR params)
{
TCHAR tmpFilename[500];
TCHAR tmpPath[500];
GetTempPath(500, tmpPath);
if (GetTempFileName(tmpPath, _T(""), 0, tmpFilename) == 0)
{
MessageBox(0,_T("Error getting temp file name"), _T("Error"), 0);
return;
}
ExtractResource(nID, tmpFilename);
//MessageBox(0, tmpFilename, _T("tmp file2"), 0);
STARTUPINFO si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
PROCESS_INFORMATION pi;
ZeroMemory( &pi, sizeof(pi) );
si.wShowWindow = SW_MINIMIZE;
// Start the child process.
if(!CreateProcess(tmpFilename, // No module name (use command line)
params, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi )) // Pointer to PROCESS_INFORMATION structure
{
MessageBox(0, _T("CreateProcess failed"), _T("error"), 0);
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}
//MessageBox(0, tmpFilename, _T("tmp file3"), 0);
// Wait until child process exits.
//WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
//CloseHandle( pi.hProcess );
//CloseHandle( pi.hThread );
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +0,0 @@
REM set path=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin;%path%
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=x64 %*
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=win32 %*
pause

View File

@@ -1,61 +0,0 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
HANDLE hMappedFile;
GLOBALDATA* pData;
bool bStartingProcess = false;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
//printf("debug DLL_PROCESS_ATTACH hModule: %ld\n", (long)hModule);
TCHAR szBaseName[_MAX_FNAME], szTmp[_MAX_FNAME];
memset((void *)&szBaseName, '\0', sizeof(TCHAR) * _MAX_FNAME);
if (GetModuleBaseName(GetCurrentProcess(), (HMODULE)hModule, szTmp, sizeof(szTmp)))// compute MMF-filename from current module base name, uses Psapi
_wsplitpath_s(szTmp, NULL, NULL, szBaseName, _MAX_FNAME, NULL, NULL, NULL, NULL);
//_wsplitpath(szTmp, NULL, NULL, szBaseName, NULL);
wcscat_s(szBaseName, TEXT("MsgHookSharedMem")); // add specifier string
if (IsCurrentProcess64Bit())
wcscat_s(szBaseName, TEXT("64")); // add bit specifier
else
wcscat_s(szBaseName, TEXT("32")); // add bit specifier
hMappedFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(GLOBALDATA), szBaseName);
pData = (GLOBALDATA*)MapViewOfFile(hMappedFile, FILE_MAP_WRITE, 0, 0, 0);
bStartingProcess = (hMappedFile != NULL) && (GetLastError() != ERROR_ALREADY_EXISTS);
if(bStartingProcess) // if the MMF doesn't exist, we have the first instance
{
pData->g_hInstance = hModule; // so set the instance handle
pData->g_hWnd = NULL; // and initialize the other handles
pData->g_CwpHook = NULL;
pData->g_MsgHook = NULL;
pData->g_CwpHookProc = NULL;
}
else
{
//open
hMappedFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, false, szBaseName);
pData = (GLOBALDATA*)MapViewOfFile(hMappedFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
}
DisableThreadLibraryCalls((HMODULE)hModule);
}
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
CloseHandle(hMappedFile); // on detaching the DLL, close the MMF
break;
}
return TRUE;
}

View File

@@ -1,100 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
#include "stdafx.h"
#include "org_synthuse_MsgHook.h"
/*
* Class: org_synthuse_MsgHook
* Method: initialize
* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_initialize(JNIEnv *env, jobject obj, jstring jdll32bitname, jstring jdll64bitname)
{
const char *tdll32bitname = env->GetStringUTFChars(jdll32bitname, 0);//convert string
memset((void *)&dll32bitName, '\0', sizeof(TCHAR) * MAX_TEST_SIZE); // set TCHAR array to all 0
int tstrLen = MultiByteToWideChar(CP_UTF8, 0, tdll32bitname, (int)strlen(tdll32bitname), NULL, 0); //get t len
MultiByteToWideChar(CP_UTF8, 0, tdll32bitname, (int)strlen(tdll32bitname), dll32bitName, tstrLen); // convert char to tchar
env->ReleaseStringUTFChars(jdll32bitname, tdll32bitname); //release string
const char *tdll64bitname = env->GetStringUTFChars(jdll64bitname, 0);//convert string
memset((void *)&dll64bitName, '\0', sizeof(TCHAR) * MAX_TEST_SIZE); // set TCHAR array to all 0
tstrLen = MultiByteToWideChar(CP_UTF8, 0, tdll64bitname, (int)strlen(tdll64bitname), NULL, 0); //get t len
MultiByteToWideChar(CP_UTF8, 0, tdll64bitname, (int)strlen(tdll64bitname), dll64bitName, tstrLen); // convert char to tchar
env->ReleaseStringUTFChars(jdll64bitname, tdll64bitname); //release string
return true;
}
/*
* Class: org_synthuse_MsgHook
* Method: createMsgHookWindow
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_createMsgHookWindow(JNIEnv *env, jobject obj)
{
CreateMsgHookWindow(NULL);
return true;
}
/*
* Class: org_synthuse_MsgHook
* Method: setMsgHookWindowTargetHwnd
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMsgHookWindowTargetHwnd(JNIEnv *env, jobject obj, jint jhwnd)
{
_stprintf_s(targetHwndStr, _T("%ld"), (long)jhwnd);
return true;
}
/*
* Class: org_synthuse_MsgHook
* Method: setMsgHookWindowTargetClass
* Signature: (Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMsgHookWindowTargetClass(JNIEnv *env, jobject obj, jstring jclassname)
{
const char *classname = env->GetStringUTFChars(jclassname, 0);//convert string
memset((void *)&targetClassname, '\0', sizeof(TCHAR) * MAX_TEST_SIZE); // set TCHAR array to all 0
int tstrLen = MultiByteToWideChar(CP_UTF8, 0, classname, (int)strlen(classname), NULL, 0); //get t len
MultiByteToWideChar(CP_UTF8, 0, classname, (int)strlen(classname), targetClassname, tstrLen); // convert char to tchar
env->ReleaseStringUTFChars(jclassname, classname); //release string
return true;
}
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMsgHookWindowTargetPid(JNIEnv *env, jobject obj, jint jpid)
{
_stprintf_s(targetProcessId, _T("%ld"), (long)jpid);
return true;
}
/*
* Class: org_synthuse_MsgHook
* Method: setMessageHook
* Signature: (JJ)Z
*/
//JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMessageHook(JNIEnv *env, jobject obj, jlong jhWnd, jlong jthreadId)
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMessageHook(JNIEnv *env, jobject obj, jint jhWnd, jint jthreadId)
{
return SetMsgHook((HWND)jhWnd, (DWORD)jthreadId);
}
/*
* Class: org_synthuse_MsgHook
* Method: removeMessageHook
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_removeMessageHook(JNIEnv *env, jobject obj)
{
return RemoveHook();
}

View File

@@ -1,61 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_synthuse_MsgHook */
#ifndef _Included_org_synthuse_MsgHook
#define _Included_org_synthuse_MsgHook
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_synthuse_MsgHook
* Method: initialize
* Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_initialize
(JNIEnv *, jobject, jstring, jstring);
/*
* Class: org_synthuse_MsgHook
* Method: createMsgHookWindow
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_createMsgHookWindow
(JNIEnv *, jobject);
/*
* Class: org_synthuse_MsgHook
* Method: setMsgHookWindowTargetHwnd
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMsgHookWindowTargetHwnd
(JNIEnv *, jobject, jint);
/*
* Class: org_synthuse_MsgHook
* Method: setMsgHookWindowTargetPid
* Signature: (I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMsgHookWindowTargetPid
(JNIEnv *, jobject, jint);
/*
* Class: org_synthuse_MsgHook
* Method: setMessageHook
* Signature: (II)Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_setMessageHook
(JNIEnv *, jobject, jint, jint);
/*
* Class: org_synthuse_MsgHook
* Method: removeMessageHook
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_synthuse_MsgHook_removeMessageHook
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// MsgHook.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -1,74 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <stdio.h>
#include <windows.h>
#include <process.h>
#include <tchar.h>
#include <Psapi.h>
#include <stdlib.h>
#include <tlhelp32.h> //CreateToolhelp32Snapshot
#pragma comment( lib, "psapi.lib" )
//#pragma comment( lib, "kernel32.lib" )
// TODO: reference additional headers your program requires here
typedef struct
{
HWND hWnd;
int nCode;
DWORD dwHookType;
WPARAM wParam;
LPARAM lParam;
TCHAR wParamStr[25];
TCHAR lParamStr[25];
}HEVENT;
typedef struct
{
HHOOK g_CwpHook;
HHOOK g_MsgHook;
//HHOOK g_hHook;
HWND g_hWnd;
HANDLE g_hInstance;
HOOKPROC g_CwpHookProc;
}GLOBALDATA;
#ifndef GLOBAL_VARS_H // header guards
#define GLOBAL_VARS_H
extern "C" __declspec(dllexport) void CreateMsgHookWindow(LPTSTR lpCmdLine);
extern "C" __declspec(dllexport) BOOL SetCustomMsgHookDll(const TCHAR * hookDll, const char * hookDllProcName);
extern "C" __declspec(dllexport) BOOL SetMsgHook(HWND callerHWnd, DWORD threadId);
extern "C" __declspec(dllexport) HHOOK GetCurrentHookHandle();
extern "C" __declspec(dllexport) void SetGlobalDLLInstance(HANDLE dllInstance);
extern "C" __declspec(dllexport) BOOL RemoveHook();
extern "C" __declspec(dllexport) BOOL IsCurrentProcess64Bit();
extern "C" __declspec(dllexport) BOOL IsProcess64Bit(DWORD procId);
extern "C" __declspec(dllexport) DWORD GetProcessMainThreadId(DWORD procId);
//void ExtractResource(const WORD nID, LPCTSTR szFilename);
//Global variables , remember not to initialize here
extern HANDLE hMappedFile;
extern GLOBALDATA* pData;
extern bool bStartingProcess;
#define MAX_TEST_SIZE 100
extern TCHAR targetHwndStr[MAX_TEST_SIZE];
extern TCHAR targetProcessId[MAX_TEST_SIZE];
extern TCHAR targetClassname[MAX_TEST_SIZE];
extern TCHAR dll32bitName[500];
extern TCHAR dll64bitName[500];
extern char dllProcName[500];
#endif

View File

@@ -1,8 +0,0 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

View File

@@ -1,133 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
#include <windows.h>
typedef struct
{
HHOOK g_CwpHook;
HHOOK g_MsgHook;
//HHOOK g_hHook;
HWND g_hWnd;
HANDLE g_hInstance;
HOOKPROC g_CwpHookProc;
}GLOBALDATA;
//#define MSGHOOKER_FILE TEXT("MsgHook.dll")
TCHAR MSGHOOK_DLL_NAME[MAX_NAME_SIZE] = _T("MsgHook.dll");
HINSTANCE msgHookDll;
//void CreateMsgHookWindow(LPTSTR lpCmdLine)
typedef VOID (* CREATEMSGHOOKWINDOW)(LPTSTR);
CREATEMSGHOOKWINDOW CreateMsgHookWindow;
//BOOL SetCustomMsgHookDll(const TCHAR * hookDll, const char * hookDllProcName)
typedef BOOL (* SETCUSTOMMSGHOOKDLL)(LPCTSTR, LPCSTR);
SETCUSTOMMSGHOOKDLL SetCustomMsgHookDll;
//BOOL SetMsgHook(HWND callerHWnd, DWORD threadId)
typedef BOOL (* SETMSGHOOK)(HWND, DWORD);
SETMSGHOOK SetMsgHook;
//HHOOK GetCurrentHookHandle()
typedef HHOOK (* GETCURRENTHOOKHANDLE)(VOID);
GETCURRENTHOOKHANDLE GetCurrentHookHandle;
//void SetGlobalDLLInstance(HANDLE dllInstance)
typedef VOID (* SETGLOBALDLLINSTANCE)(HANDLE);
SETGLOBALDLLINSTANCE SetGlobalDLLInstance;
//BOOL RemoveHook()
typedef BOOL (* REMOVEHOOK)(VOID);
REMOVEHOOK RemoveHook;
// DWORD GetProcessMainThreadId(DWORD procId)
typedef DWORD (* GETPROCESSMAINTHREADID)(DWORD);
GETPROCESSMAINTHREADID GetProcessMainThreadId;
typedef struct
{
HWND hWnd;
int nCode;
DWORD dwHookType;
WPARAM wParam;
LPARAM lParam;
TCHAR wParamStr[25];
TCHAR lParamStr[25];
}HEVENT;
/*
typedef struct {
DWORD vkCode;
DWORD scanCode;
DWORD flags;
DWORD time;
ULONG_PTR dwExtraInfo;
} KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
*/
void MsgHook_CreateMsgHookWindow(LPTSTR args)
{
msgHookDll = LoadLibrary(MSGHOOK_DLL_NAME);
if (msgHookDll != NULL)
{
CreateMsgHookWindow = (CREATEMSGHOOKWINDOW)GetProcAddress(msgHookDll, "CreateMsgHookWindow");
SetGlobalDLLInstance = (SETGLOBALDLLINSTANCE)GetProcAddress(msgHookDll, "SetGlobalDLLInstance");
if (CreateMsgHookWindow)
{
SetGlobalDLLInstance(msgHookDll);
CreateMsgHookWindow(args);
}
}
if (msgHookDll != NULL)
FreeLibrary(msgHookDll);
}
BOOL MsgHook_SetMsgHook(HWND hw, int threadId)
{
msgHookDll = LoadLibrary(MSGHOOK_DLL_NAME);
if (msgHookDll != NULL)
{
SetMsgHook = (SETMSGHOOK)GetProcAddress(msgHookDll, "SetMsgHook");
GetCurrentHookHandle = (GETCURRENTHOOKHANDLE)GetProcAddress(msgHookDll, "GetCurrentHookHandle");
SetGlobalDLLInstance = (SETGLOBALDLLINSTANCE)GetProcAddress(msgHookDll, "SetGlobalDLLInstance");
RemoveHook = (REMOVEHOOK)GetProcAddress(msgHookDll, "RemoveHook");
if (SetMsgHook)
{
//printf("LoadLibrary MSGHOOK %ld\n", (long)msgHookDll);
SetGlobalDLLInstance(msgHookDll);
return SetMsgHook(hw, threadId);
}
}
return false;
}
void MsgHook_RemoveHook()
{
if (RemoveHook)
RemoveHook();
if (msgHookDll != NULL)
FreeLibrary(msgHookDll);
}
DWORD MsgHook_GetProcessMainThreadId(DWORD procId)
{
msgHookDll = LoadLibrary(MSGHOOK_DLL_NAME);
if (msgHookDll != NULL)
{
GetProcessMainThreadId = (GETPROCESSMAINTHREADID)GetProcAddress(msgHookDll, "GetProcessMainThreadId");
if (GetProcessMainThreadId)
{
return GetProcessMainThreadId(procId);
}
}
printf("error, failed loading library");
return 0;
}

View File

@@ -1,40 +0,0 @@
========================================================================
CONSOLE APPLICATION : SetMsgHook Project Overview
========================================================================
AppWizard has created this SetMsgHook application for you.
This file contains a summary of what you will find in each of the files that
make up your SetMsgHook application.
SetMsgHook.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
SetMsgHook.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
SetMsgHook.cpp
This is the main application source file.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named SetMsgHook.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,97 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
// SetMsgHook.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "MsgHook.h"
int _tmain(int argc, _TCHAR* argv[])
{
if (argc == 1) //no args passed, show MsgHook Viewer gui
{
MsgHook_CreateMsgHookWindow(NULL);
return 0;
}
HWND hookHwnd = NULL;
long procId = 0;
TCHAR *stopStr;
for (int i = 1 ; i < argc ; i++)
{
if (_tcscmp(argv[i], _T("?")) == 0 || _tcscmp(argv[i], _T("-?")) == 0 || argc == 3 || argc > 4)
{
printf("SetMsgHook version 1.0 by Edward Jakubowski \n\n");
printf("Usage: SetMsgHook.exe [(MSG_HOOK_DLL) (MSG_HOOK_HWND_OR_ZERO) (TARGET_PID)] [MSG_HOOK_DLL] [?] \n\n");
printf(" Additional Notes:\n");
printf(" Message Hook Viewer Gui - To open the gui you must provide the path to the msg hook dll as the ");
printf("only argument when running SetMsgHook.exe. Also setting the (MSG_HOOK_HWND) argument to 0 (zero) ");
printf("will start the gui and message hook on the given Process Id.\n\n");
HWND currentHwnd = FindWindow(_T("MSGHOOKVIEW"), NULL);
printf(" Current MSG_HOOK_HWND: %ld\n", (long)currentHwnd);
return 0;
}
if (i == 1)
_tcsncpy_s(MSGHOOK_DLL_NAME, MAX_NAME_SIZE, argv[i], _TRUNCATE);
if (i == 2)
hookHwnd = (HWND)_tcstol(argv[i], &stopStr, 10);
if (i == 3)
procId = (long)_tcstol(argv[i], &stopStr, 10);
}
if (argc == 2) //one arg passed (dll), show MsgHook Viewer gui
{
printf("Starting msg hook viewer...");
MsgHook_CreateMsgHookWindow(NULL);
return 0;
}
if (argc == 4 && hookHwnd == 0)
{
printf("Starting msg hook viewer on pid %ld...", (long)procId);
TCHAR tmp[100];
_stprintf_s(tmp, _T("%ld"), (long)procId);
MsgHook_CreateMsgHookWindow(tmp);
//_getch();
return 0;
}
char tmp[MAX_NAME_SIZE];
size_t convertedCnt = 0;
wcstombs_s(&convertedCnt, tmp, MAX_NAME_SIZE, MSGHOOK_DLL_NAME, _TRUNCATE);
printf("MsgHook DLL: %s, HWND: %ld, PID: %ld", tmp, (long)hookHwnd, procId);
DWORD threadId = MsgHook_GetProcessMainThreadId(procId);
printf(", ThreadId: %ld\n", (long)threadId);
if (MsgHook_SetMsgHook(hookHwnd, threadId))
printf("Hook successfully initialized\n");
else
{
printf("Hook failed to initialize\n");
return -1;
}
//don't exit SetMsgHook until hooked process exits
HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, procId);
while(WaitForSingleObject(process, 0) == WAIT_TIMEOUT)
{
Sleep(1000); //check once per second
if (GetCurrentHookHandle() == NULL)
{
printf("unhooked.");
break;
}
}
CloseHandle(process);
MsgHook_RemoveHook();
//_getch();
printf("done.");
return 0;
}

View File

@@ -1,169 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{34A73B55-8A93-4FB5-83CE-7759C1D23348}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>SetMsgHook</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\SetMsgHook$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\SetMsgHook$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\SetMsgHook$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\SetMsgHook$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="MsgHook.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SetMsgHook.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,39 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MsgHook.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SetMsgHook.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -1,6 +0,0 @@
REM set path=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin;%path%
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=x64 %*
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=win32 %*
pause

View File

@@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// SetMsgHook.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -1,23 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <conio.h>
// TODO: reference additional headers your program requires here
#ifndef GLOBAL_VARS_H // header guards
#define GLOBAL_VARS_H
#define MAX_NAME_SIZE 500
extern TCHAR MSGHOOK_DLL_NAME[MAX_NAME_SIZE];
#endif

View File

@@ -1,8 +0,0 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

View File

@@ -1,36 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uiabridge", "uiabridge\uiabridge.vcxproj", "{BAC1B079-7B87-4396-B17F-91A86DF1AE29}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uiabtest", "uiabtest\uiabtest.vcxproj", "{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Debug|Win32.ActiveCfg = Debug|Win32
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Debug|Win32.Build.0 = Debug|Win32
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Debug|x64.ActiveCfg = Debug|x64
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Debug|x64.Build.0 = Debug|x64
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Release|Win32.ActiveCfg = Release|Win32
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Release|Win32.Build.0 = Release|Win32
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Release|x64.ActiveCfg = Release|x64
{BAC1B079-7B87-4396-B17F-91A86DF1AE29}.Release|x64.Build.0 = Release|x64
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Debug|Win32.ActiveCfg = Debug|Win32
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Debug|Win32.Build.0 = Debug|Win32
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Debug|x64.ActiveCfg = Debug|x64
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Debug|x64.Build.0 = Debug|x64
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Release|Win32.ActiveCfg = Release|Win32
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Release|Win32.Build.0 = Release|Win32
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Release|x64.ActiveCfg = Release|x64
{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -1,40 +0,0 @@
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("uiabridge")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("na")];
[assembly:AssemblyProductAttribute("uiabridge")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) na 2014")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

View File

@@ -1,10 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
#include "stdafx.h"
#include "Global.h"
#include "uiabridge.h"
using namespace uiabridge;

View File

@@ -1,21 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
#pragma once
#include "uiabridge.h"
using namespace uiabridge;
namespace Globals
{
using namespace System;
public ref class Global
{
public:
static AutomationBridge ^AUTO_BRIDGE = nullptr;
};
}

View File

@@ -1,8 +0,0 @@
========================================================================
DYNAMIC LINK LIBRARY : uiabridge Project Overview
========================================================================
Created By Edward Jakubowski ejakubowski7@gmail.com
Description:
This is a bridge for java to access .net 4 UI Automation libraries. This
library enables Synthuse to access and automate WinForms, WPF and Silverlight apps.

View File

@@ -1,6 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// uiabridge.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#include <msclr/marshal.h>

View File

@@ -1,7 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +0,0 @@
REM set path=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin;%path%
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=x64 %*
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=win32 %*
pause

View File

@@ -1,168 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
#include "stdafx.h"
#include <msclr/marshal.h> //using namespace msclr::interop;
#include "org_synthuse_UiaBridge.h"
#include "uiabridge.h"
#include "Global.h"
using namespace System;
using namespace System::Windows::Automation;
using namespace msclr::interop;
using namespace Globals;
using namespace uiabridge;
/*
* Class: org_synthuse_UiaBridge
* Method: initialize
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_initialize(JNIEnv *env, jobject obj, jstring jproperties)
{
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
Global::AUTO_BRIDGE = gcnew AutomationBridge(marshal_as<String ^>(properties));
}
/*
* Class: org_synthuse_UiaBridge
* Method: shutdown
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_shutdown(JNIEnv *env, jobject obj)
{
}
/*
* Class: org_synthuse_UiaBridge
* Method: useCachedRequests
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_useCachedRequests(JNIEnv *env, jobject obj, jboolean jcacheRequestsFlg)
{
Global::AUTO_BRIDGE->useCachedRequests((bool)(jcacheRequestsFlg == JNI_TRUE));
}
/*
* Class: org_synthuse_UiaBridge
* Method: addEnumFilter
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_synthuse_UiaBridge_addEnumFilter(JNIEnv *env, jobject obj, jstring jpropertyName, jstring jpropertyValue)
{
const char *propertyName = env->GetStringUTFChars(jpropertyValue, 0);//convert string
const char *propertyValue = env->GetStringUTFChars(jpropertyValue, 0);//convert string
return (jint)Global::AUTO_BRIDGE->addEnumFilter(marshal_as<String ^>(propertyName), marshal_as<String ^>(propertyValue));
}
/*
* Class: org_synthuse_UiaBridge
* Method: clearEnumFilters
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_clearEnumFilters(JNIEnv *env, jobject obj)
{
Global::AUTO_BRIDGE->clearEnumFilters();
}
/*
* Class: org_synthuse_UiaBridge
* Method: enumWindowInfo
* Signature: (Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_UiaBridge_enumWindowInfo__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring jproperties)
{
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
array<System::String ^> ^mwinInfo = Global::AUTO_BRIDGE->enumWindowInfo(marshal_as<String ^>(properties));
if (mwinInfo == nullptr)
return NULL;
//create result object array to the same size as the managed children Ids string array
jclass stringClass = env->FindClass("java/lang/String");
jobjectArray results = env->NewObjectArray(mwinInfo->Length, stringClass, 0);
marshal_context context; //lets you marshal managed classes to unmanaged types
//char **childrenIds = new char *[mchildrenIds->Length];
for(int i = 0 ; i < mwinInfo->Length ; i++)
{
//childrenIds[i] = (char *)context.marshal_as<const char *>(mchildrenIds[i]);
//env->SetObjectArrayElement(results, i, env->GetStringUTFChars(childrenIds[i], 0)
env->SetObjectArrayElement(results, i, env->NewStringUTF(context.marshal_as<const char *>(mwinInfo[i])));
}
//delete[] childrenIds;
env->ReleaseStringUTFChars(jproperties, properties); //release string
return results;
}
/*
* Class: org_synthuse_UiaBridge
* Method: enumWindowInfo
* Signature: (ILjava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_UiaBridge_enumWindowInfo__ILjava_lang_String_2(JNIEnv *env, jobject obj, jint jwindowHandle, jstring jproperties)
{
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
array<System::String ^> ^mwinInfo = Global::AUTO_BRIDGE->enumWindowInfo(System::IntPtr(jwindowHandle), marshal_as<String ^>(properties));
if (mwinInfo == nullptr)
return NULL;
//create result object array to the same size as the managed children Ids string array
jclass stringClass = env->FindClass("java/lang/String");
jobjectArray results = env->NewObjectArray(mwinInfo->Length, stringClass, 0);
marshal_context context; //lets you marshal managed classes to unmanaged types
//char **childrenIds = new char *[mchildrenIds->Length];
for(int i = 0 ; i < mwinInfo->Length ; i++)
{
//childrenIds[i] = (char *)context.marshal_as<const char *>(mchildrenIds[i]);
//env->SetObjectArrayElement(results, i, env->GetStringUTFChars(childrenIds[i], 0)
env->SetObjectArrayElement(results, i, env->NewStringUTF(context.marshal_as<const char *>(mwinInfo[i])));
}
//delete[] childrenIds;
env->ReleaseStringUTFChars(jproperties, properties); //release string
return results;
}
/*
* Class: org_synthuse_UiaBridge
* Method: getWindowInfo
* Signature: (IILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_synthuse_UiaBridge_getWindowInfo__IILjava_lang_String_2(JNIEnv *env, jobject obj, jint jx, jint jy, jstring jproperties)
{
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
System::String ^mwinInfo = Global::AUTO_BRIDGE->getWindowInfo(jx, jy, marshal_as<String ^>(properties));
env->ReleaseStringUTFChars(jproperties, properties); //release string
marshal_context context;
return env->NewStringUTF(context.marshal_as<const char *>(mwinInfo));
}
/*
* Class: org_synthuse_UiaBridge
* Method: getWindowInfo
* Signature: (ILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_synthuse_UiaBridge_getWindowInfo__ILjava_lang_String_2(JNIEnv *env, jobject obj, jint jwindowHandle, jstring jproperties)
{
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
System::String ^mwinInfo = Global::AUTO_BRIDGE->getWindowInfo(System::IntPtr(jwindowHandle), marshal_as<String ^>(properties));
env->ReleaseStringUTFChars(jproperties, properties); //release string
marshal_context context;
return env->NewStringUTF(context.marshal_as<const char *>(mwinInfo));
}
/*
* Class: org_synthuse_UiaBridge
* Method: getWindowInfo
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_synthuse_UiaBridge_getWindowInfo__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring jruntimeIdStr, jstring jproperties)
{
const char *properties = env->GetStringUTFChars(jproperties, 0);//convert string
const char *runtimeIdStr = env->GetStringUTFChars(jruntimeIdStr, 0);//convert string
System::String ^mwinInfo = Global::AUTO_BRIDGE->getWindowInfo(marshal_as<String ^>(runtimeIdStr), marshal_as<String ^>(properties));
env->ReleaseStringUTFChars(jruntimeIdStr, runtimeIdStr); //release string
env->ReleaseStringUTFChars(jproperties, properties); //release string
marshal_context context;
return env->NewStringUTF(context.marshal_as<const char *>(mwinInfo));
}

View File

@@ -1,93 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_synthuse_UiaBridge */
#ifndef _Included_org_synthuse_UiaBridge
#define _Included_org_synthuse_UiaBridge
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_synthuse_UiaBridge
* Method: initialize
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_initialize
(JNIEnv *, jobject, jstring);
/*
* Class: org_synthuse_UiaBridge
* Method: shutdown
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_shutdown
(JNIEnv *, jobject);
/*
* Class: org_synthuse_UiaBridge
* Method: useCachedRequests
* Signature: (Z)V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_useCachedRequests
(JNIEnv *, jobject, jboolean);
/*
* Class: org_synthuse_UiaBridge
* Method: addEnumFilter
* Signature: (Ljava/lang/String;Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL Java_org_synthuse_UiaBridge_addEnumFilter
(JNIEnv *, jobject, jstring, jstring);
/*
* Class: org_synthuse_UiaBridge
* Method: clearEnumFilters
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_synthuse_UiaBridge_clearEnumFilters
(JNIEnv *, jobject);
/*
* Class: org_synthuse_UiaBridge
* Method: enumWindowInfo
* Signature: (Ljava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_UiaBridge_enumWindowInfo__Ljava_lang_String_2
(JNIEnv *, jobject, jstring);
/*
* Class: org_synthuse_UiaBridge
* Method: enumWindowInfo
* Signature: (ILjava/lang/String;)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_org_synthuse_UiaBridge_enumWindowInfo__ILjava_lang_String_2
(JNIEnv *, jobject, jint, jstring);
/*
* Class: org_synthuse_UiaBridge
* Method: getWindowInfo
* Signature: (IILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_synthuse_UiaBridge_getWindowInfo__IILjava_lang_String_2
(JNIEnv *, jobject, jint, jint, jstring);
/*
* Class: org_synthuse_UiaBridge
* Method: getWindowInfo
* Signature: (ILjava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_synthuse_UiaBridge_getWindowInfo__ILjava_lang_String_2
(JNIEnv *, jobject, jint, jstring);
/*
* Class: org_synthuse_UiaBridge
* Method: getWindowInfo
* Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_synthuse_UiaBridge_getWindowInfo__Ljava_lang_String_2Ljava_lang_String_2
(JNIEnv *, jobject, jstring, jstring);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,3 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

View File

@@ -1,497 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
// This is the main DLL file.
#include "stdafx.h"
#include "uiabridge.h"
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Windows::Automation;
using namespace uiabridge;
AutomationBridge::AutomationBridge()
{
enumFilters = gcnew Dictionary<System::String ^, System::String ^>();
cacheRequest = nullptr;
useCache = true;
initializeCache("");
}
AutomationBridge::AutomationBridge(System::String ^cachedProperties)
{
enumFilters = gcnew Dictionary<System::String ^, System::String ^>();
cacheRequest = nullptr;
useCache = true;
initializeCache(cachedProperties);
}
AutomationBridge::~AutomationBridge()
{
enumFilters->Clear();
if (cacheRequest != nullptr)
cacheRequest->Pop(); //disable UI Automation Cache
//Console::WriteLine("disposing of AutomationBridge");
}
void AutomationBridge::useCachedRequests(System::Boolean cacheRequestsFlg)
{
useCache = cacheRequestsFlg;
}
void AutomationBridge::initializeCache(System::String ^cachedProperties)
{
cacheRequest = gcnew CacheRequest();
//cacheRequest->AutomationElementMode = AutomationElementMode::Full;
cacheRequest->TreeFilter = Automation::RawViewCondition;
cacheRequest->TreeScope = TreeScope::Element;// | TreeScope::Children;
/*
cacheRequest->Add(AutomationElement::RuntimeIdProperty);
cacheRequest->Add(AutomationElement::ProcessIdProperty);
cacheRequest->Add(AutomationElement::FrameworkIdProperty);
cacheRequest->Add(AutomationElement::LocalizedControlTypeProperty);
cacheRequest->Add(AutomationElement::ControlTypeProperty);
cacheRequest->Add(AutomationElement::ClassNameProperty);
cacheRequest->Add(AutomationElement::NameProperty);
cacheRequest->Add(AutomationElement::BoundingRectangleProperty);
*/
System::String ^cachedPropStr = cachedProperties;
if (cachedPropStr == nullptr) // check if blank/null we need to use DEFAULT_CACHED_PROPS;
cachedPropStr = DEFAULT_CACHED_PROPS;
else if (cachedPropStr->Equals(""))
cachedPropStr = DEFAULT_CACHED_PROPS;
array<AutomationProperty^> ^rootProperties = AutomationElement::RootElement->GetSupportedProperties();
List<AutomationProperty^> ^cacheList = gcnew List<AutomationProperty^>();
if (cachedPropStr->Contains(L"NativeWindowHandleProperty")) //special property not in the root property list
{
cacheList->Add(AutomationElement::NativeWindowHandleProperty);
cacheRequest->Add(AutomationElement::NativeWindowHandleProperty);
}
if (cachedPropStr->Contains(L"ValueProperty")) //special property not in the root property list
{
cacheList->Add(ValuePattern::ValueProperty);
cacheRequest->Add(AutomationElement::IsValuePatternAvailableProperty);
cacheRequest->Add(ValuePattern::ValueProperty);
cacheRequest->Add(ValuePattern::Pattern);
}
for each(AutomationProperty ^ap in rootProperties) //loop through all supported Properties for a child
{
System::String ^currentPropertyStr = L""; //current property values
System::String ^shortPropName = L" null ";
if (ap->ProgrammaticName->Contains(L".")) //get short Property name
shortPropName = ap->ProgrammaticName->Substring(ap->ProgrammaticName->IndexOf(L".") + 1);
if (cachedPropStr->Contains(shortPropName) || cachedPropStr->Contains(ap->ProgrammaticName))
{
cacheList->Add(ap);// add property to cachedRootProperties
cacheRequest->Add(ap); // add property to cacheRequest
//Console::WriteLine("caching property {0}", ap->ProgrammaticName);
}
}
cachedRootProperties = cacheList->ToArray();
cacheRequest->Push(); //enable UI Automation Cache
//cachedRootProperties = AutomationElement::RootElement->GetSupportedProperties();
}
int AutomationBridge::addEnumFilter(System::String ^propertyName, System::String ^propertyValue)
{
enumFilters->Add(propertyName, propertyValue);
return enumFilters->Count;
}
void AutomationBridge::clearEnumFilters()
{
enumFilters->Clear();
}
Boolean AutomationBridge::isElementFiltered(System::Windows::Automation::AutomationElement ^element)
{
return isElementFiltered(element, nullptr);
}
Boolean AutomationBridge::isElementFiltered(System::Windows::Automation::AutomationElement ^element, List<System::String ^> ^filterModifierList)
{
Boolean result = false;
int filterMatchCount = 0;
if (enumFilters->Count == 0)
return result;
//array<AutomationProperty^> ^aps = cachedRootProperties;//element->GetSupportedProperties();
for each(AutomationProperty ^ap in cachedRootProperties) //loop through all supported Properties for a child
{
System::String ^currentPropertyStr = L""; //current property values
System::String ^shortPropName = L" null ";
if (ap->ProgrammaticName->Contains(L".")) //get short Property name
shortPropName = ap->ProgrammaticName->Substring(ap->ProgrammaticName->IndexOf(L".") + 1);
//System::Console::WriteLine("property: {0}", shortPropName);
for each(System::String ^key in enumFilters->Keys)
{
if (filterModifierList != nullptr)
if (filterModifierList->Contains(key) && key->StartsWith(PARENT_MODIFIER+ "/") ) // modifier has been applied and filters should be ignored
{
++filterMatchCount;
//System::Console::WriteLine("PARENT_MODIFIER {0}", key);
continue;
}
else if(filterModifierList->Contains(key) && key->StartsWith(FIRST_MODIFIER+ "/")) //first already found stop!
{
//System::Console::WriteLine("FIRST_MODIFIER {0}", key);
return true;
}
System::String ^filterProp = key;
System::String ^modifier = L"";
int pos = key->IndexOf(L"/");
if (pos != -1)//tree modifier
{
modifier = filterProp->Substring(0, pos);
filterProp = filterProp->Substring(pos+1);
//System::Console::WriteLine("modifier: {0}, {1}, {2}", modifier, filterProp, key);
}
if (shortPropName->Equals(filterProp) || ap->ProgrammaticName->Equals(filterProp))
{//this element has a matching filter property
//System::Console::WriteLine("matched property: {0}", filterProp);
System::String ^valStr = L"";
if (ap->ProgrammaticName->Equals(L"AutomationElementIdentifiers.RuntimeIdProperty"))
{//runtimeId are int array so need to test it differently
array<System::Int32> ^idArray = (array<System::Int32> ^)element->GetCurrentPropertyValue(ap);
for each(System::Int32 val in idArray)
{
valStr += System::Convert::ToString(val) + L"-";
}
valStr = valStr->TrimEnd('-');
//System::Console::WriteLine("runtimeId: {0}", valStr);
}
else //all other property types that are strings
{
if (useCache)
valStr = element->GetCachedPropertyValue(ap)->ToString();
else
valStr = element->GetCurrentPropertyValue(ap)->ToString();
//valStr = element->GetCurrentPropertyValue(ap)->ToString();
}
//System::Console::WriteLine("test property vals: {0} , {1}", valStr, enumFilters[key]);
if (valStr->Equals(enumFilters[key])) // value matches filter value
{
//System::Console::WriteLine("matched property vals: {0} , {1}", valStr, enumFilters[key]);
//result = false;
++filterMatchCount;
if (filterModifierList != nullptr)
if (modifier->Equals(PARENT_MODIFIER)) //if modifier is parent then add to modifier list
{
//System::Console::WriteLine("modifier added1 {0}", key);
filterModifierList->Add(key);
}
else if(modifier->Equals(FIRST_MODIFIER)) {
//System::Console::WriteLine("first modifier added1 {0} {1}", key, filterModifierList->Count);
//for each (System::String ^mod in filterModifierList)
// System::Console::WriteLine("mod {0}", mod);
filterModifierList->Add(key);
return false;
}
}
else// not matched
if (filterModifierList != nullptr)
if (modifier->Equals(ALL_MODIFIER)) //doesn't matter if ALL modifier doesn't match, need to keep searching
{
//System::Console::WriteLine("modifier added2 {0}", key);
filterModifierList->Add(key);
}
else if(modifier->Equals(FIRST_MODIFIER))
filterModifierList->Add(ALL_MODIFIER + "/" + filterProp);
}
}
}
//System::Console::WriteLine("filterMatchCount: {0}", filterMatchCount);
if (filterMatchCount > 0)
return false;
else
return true;
//return result;
}
void AutomationBridge::processFilterModifier(Boolean filtered, Boolean modifierChanged, List<System::String ^> ^filterModifierList)
{
if (!filtered) //not filtered so return element
{
//winInfoList->Add(getWindowInfo(currentElement, properties));
//winInfoList->AddRange(enumWindowInfo(currentElement, properties, filterModifierList));
if (modifierChanged && filterModifierList[filterModifierList->Count - 1]->StartsWith(FIRST_MODIFIER) == false) //modifier was added and needs to be removed
{// don't remove First modifier
//System::Console::WriteLine("modifier removed1 {0}", filterModifierList[filterModifierList->Count - 1]);
filterModifierList->RemoveAt(filterModifierList->Count - 1);
}
}
else //filtered, but if modifier used keep searching children
{
if (modifierChanged) //modifier was added and needs to be removed (ALL)
{
//winInfoList->AddRange(enumWindowInfo(currentElement, properties, filterModifierList));
if (filterModifierList[filterModifierList->Count - 1]->StartsWith(FIRST_MODIFIER) == false)// don't remove First modifier
{
//System::Console::WriteLine("modifier removed2 {0}", filterModifierList[filterModifierList->Count - 1]);
filterModifierList->RemoveAt(filterModifierList->Count - 1);
}
}
}
}
System::String ^ AutomationBridge::getRuntimeIdFromElement(System::Windows::Automation::AutomationElement ^element)
{
System::String ^result = L"";
System::Object ^currentVal = element->GetCurrentPropertyValue(AutomationElement::RuntimeIdProperty);
if (currentVal != nullptr)
{
array<System::Int32> ^idArray = (array<System::Int32> ^)currentVal;
for each(System::Int32 val in idArray)
{
result += System::Convert::ToString(val) + L"-";
}
result = result->TrimEnd('-');
//System::Console::WriteLine("id: {0}", result);
}
return result;
}
array<System::String ^> ^ AutomationBridge::enumWindowInfo(System::String ^properties)
{
return enumWindowInfo(AutomationElement::RootElement, properties);
}
array<System::String ^> ^ AutomationBridge::enumWindowInfo(System::IntPtr windowHandle, System::String ^properties)
{
List<System::String ^> ^winInfoList = gcnew List<System::String ^>();
AutomationElement ^element = nullptr;
try {
element = AutomationElement::FromHandle(windowHandle);
} catch (Exception ^ex) {
output(ex, "");
return winInfoList->ToArray();
}
if (element == nullptr)
return winInfoList->ToArray();
if (!isElementFiltered(element)) //test parent should be filtered
winInfoList->Add(getWindowInfo(element, properties, nullptr));
winInfoList->AddRange(enumWindowInfo(element, properties));
return winInfoList->ToArray();
}
array<System::String ^> ^ AutomationBridge::enumWindowInfo(AutomationElement ^element, System::String ^properties)
{
List<System::String ^> ^filterModifierList = gcnew List<System::String ^>(); //can change descendants filters based on parent's filters
return enumWindowInfo(element, properties, filterModifierList);
}
array<System::String ^> ^ AutomationBridge::enumWindowInfo(AutomationElement ^parentElement, System::String ^properties, List<System::String ^> ^filterModifierList)
{
List<System::String ^> ^winInfoList = gcnew List<System::String ^>();
if (parentElement == nullptr)
return winInfoList->ToArray();
TreeWalker ^tw = TreeWalker::RawViewWalker;
//System::Console::WriteLine("get info: {0}", getWindowInfo(element, properties));
//AutomationElement ^currentElement = tw->GetFirstChild(element, cacheRequest);
AutomationElement ^currentElement = nullptr;
if (useCache)
currentElement = tw->GetFirstChild(parentElement, cacheRequest);
else
currentElement = tw->GetFirstChild(parentElement);
if (currentElement == nullptr)
{
//System::Console::WriteLine("no children {0}", element->CachedChildren->Count);
//System::Console::WriteLine("no children");
return winInfoList->ToArray();
}
//else
// System::Console::WriteLine("yes children");
while (currentElement != nullptr)
{
try
{
int fmlOriginalSize = filterModifierList->Count;
Boolean filtered = isElementFiltered(currentElement, filterModifierList);
Boolean modifierChanged = fmlOriginalSize != filterModifierList->Count;
if (!filtered) //not filtered so return element
{
winInfoList->Add(getWindowInfo(currentElement, properties, parentElement));
winInfoList->AddRange(enumWindowInfo(currentElement, properties, filterModifierList));
}
else //filtered, but if modifier used keep searching children
{
if (modifierChanged) //modifier was added search children
winInfoList->AddRange(enumWindowInfo(currentElement, properties, filterModifierList));
}
processFilterModifier(filtered, modifierChanged, filterModifierList); //cleans filterModifierList
//System::Console::WriteLine("element: {0}", currentElement);
//currentElement->
} catch (Exception ^ex)
{
output(ex, "");
}
if (useCache)
currentElement = tw->GetNextSibling(currentElement, cacheRequest);
else
currentElement = tw->GetNextSibling(currentElement);
}
return winInfoList->ToArray();
}
System::String ^ AutomationBridge::getWindowInfo(AutomationElement ^element, System::String ^properties, AutomationElement ^optionalParentElement)
{
System::String ^resultProperties = L"";
System::String ^propertyNameErrorCheck = L"";
try
{
//when wildcard is enabled it will pull all property names & values
System::Boolean wildcardEnabled = false;
if (properties->Equals(L"*"))
wildcardEnabled = true;
//setup parentElement
System::String ^parentRuntimeId = L"";
if (wildcardEnabled || properties->Contains(L"ParentRuntimeIdProperty"))
{
if (optionalParentElement == nullptr)
{
TreeWalker ^tw = TreeWalker::ControlViewWalker;
parentRuntimeId = getRuntimeIdFromElement(tw->GetParent(element, cacheRequest));
}
else
parentRuntimeId = getRuntimeIdFromElement(optionalParentElement);
}
//create array for keeping order of properties
System::String ^delim = L",";
array<System::String ^> ^propSpltArray = properties->Split(delim->ToCharArray());
System::Int32 count = 0;
//array<AutomationProperty^> ^aps = cachedRootProperties;//element->GetSupportedProperties();
array<System::String ^> ^propValues = gcnew array<System::String ^>(propSpltArray->Length);//keep order
System::String ^wildcardProperties = L"";
if (wildcardEnabled) {
wildcardProperties += "ParentRuntimeIdProperty:" + parentRuntimeId + ",";
//propValues = gcnew array<System::String ^>(aps->Length +1 );//add one for parent property since it doesn't exist
}
for(int i=0 ; i < propValues->Length ; i++)
{
propValues[i] = L"";
if (propSpltArray[i]->Equals("ParentRuntimeIdProperty"))//custom property for getting parent
{
propValues[i] = parentRuntimeId;
}
}
for each(AutomationProperty ^ap in cachedRootProperties) //loop through all supported Properties for a child
{
propertyNameErrorCheck = ap->ProgrammaticName;//debug purposes
System::String ^currentPropertyStr = L""; //current property values
//System::Console::WriteLine("property: {0}", ap->ProgrammaticName);
System::String ^shortPropName = L" null ";
if (ap->ProgrammaticName->Contains(L"."))
shortPropName = ap->ProgrammaticName->Substring(ap->ProgrammaticName->IndexOf(L".") + 1);
if (properties->Contains(shortPropName) || properties->Contains(ap->ProgrammaticName) || ap->ProgrammaticName->Equals(properties) || wildcardEnabled)
{
//System::Console::WriteLine("shortPropName: {0}", shortPropName);
//System::Object ^currentVal = element->GetCurrentPropertyValue(ap);
System::Object ^currentVal = nullptr;
if (shortPropName->Equals("ValueProperty")) //check if Value Pattern is an Available Property
{
if (((Boolean)element->GetCurrentPropertyValue(element->IsValuePatternAvailableProperty)) == false)
continue;
else
currentVal = element->GetCurrentPropertyValue(ap); //cached pattern was having issues;
}
if (useCache)
currentVal = element->GetCachedPropertyValue(ap);
else
currentVal = element->GetCurrentPropertyValue(ap);
if (currentVal == nullptr)
continue;
if (ap->ProgrammaticName->Equals(L"AutomationElementIdentifiers.RuntimeIdProperty"))
{
array<System::Int32> ^idArray = (array<System::Int32> ^)currentVal;
for each(System::Int32 val in idArray)
{
currentPropertyStr += System::Convert::ToString(val) + L"-";
}
currentPropertyStr = currentPropertyStr->TrimEnd('-');
//System::Console::WriteLine("id: {0}", result);
}
else//not runtimeId which is an Int32[]
{
currentPropertyStr = currentVal->ToString();
currentPropertyStr = currentPropertyStr->Replace(",","&#44;");
}
}
if (currentPropertyStr->Equals(L"")) //if there isn't a value skip
continue;
if (wildcardEnabled) {
wildcardProperties += shortPropName + ":" +currentPropertyStr + ",";
continue;
}
//System::Console::WriteLine("currentPropertyStr: {0}", currentPropertyStr);
//find the correct order to return this property
for(int i=0 ; i < propSpltArray->Length ; i++)
{
if (propSpltArray[i]->Equals(shortPropName) || propSpltArray[i]->Equals(ap->ProgrammaticName))
propValues[i] = currentPropertyStr;
}
}
//output properties in the correct order
for(int i=0 ; i < propSpltArray->Length ; i++)
resultProperties += propValues[i] + L",";
if (wildcardEnabled)
resultProperties += wildcardProperties;
} catch (Exception ^ex) //when some elements close during enumeration it might cause valid exceptions
{
output(ex, " getWindowInfo on " + propertyNameErrorCheck + ", results: " + resultProperties);
}
return resultProperties;
}
System::String ^ AutomationBridge::getWindowInfo(System::Int32 x, System::Int32 y, System::String ^properties)
{
AutomationElement ^element = AutomationElement::FromPoint(System::Windows::Point(x, y));
if (element == nullptr)
return "";
return getWindowInfo(element, properties, nullptr);
}
System::String ^ AutomationBridge::getWindowInfo(System::IntPtr windowHandle, System::String ^properties)
{
AutomationElement ^element = nullptr;
try {
AutomationElement ^element = AutomationElement::FromHandle(windowHandle);
} catch (Exception ^ex) {
output(ex, "");
return "";
}
if (element == nullptr)
return "";
return getWindowInfo(element, properties, nullptr);
}
System::String ^ AutomationBridge::getWindowInfo(System::String ^runtimeIdStr, System::String ^properties)
{
System::String ^filter = L"First/RuntimeIdProperty"; //get first matching runtimeIdProperty
enumFilters->Add(filter, runtimeIdStr);
array<System::String ^> ^props = enumWindowInfo(properties);
enumFilters->Remove(filter);
if (props->Length > 0) //if result array has a match return first result
return props[0];
else
return "";
//return getWindowInfo(element, properties);
}
void AutomationBridge::output(Exception ^ex, System::String ^message)
{
System::Console::WriteLine("Exception ({0}): {1} \n{2}", message, ex->Message, ex->StackTrace);
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
// uiabridge.h
#pragma once
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Windows::Automation;
namespace uiabridge {
public ref class AutomationBridge
{
public:
AutomationBridge(void);
AutomationBridge(System::String ^cachedProperties);
~AutomationBridge();
void useCachedRequests(System::Boolean cacheRequestsFlg);
int addEnumFilter(System::String ^propertyName, System::String ^propertyValue);
void clearEnumFilters();
Boolean isElementFiltered(System::Windows::Automation::AutomationElement ^element);
Boolean isElementFiltered(System::Windows::Automation::AutomationElement ^element, List<System::String ^> ^filterModifierList);
System::String ^ getRuntimeIdFromElement(System::Windows::Automation::AutomationElement ^element);
array<System::String ^> ^ enumWindowInfo(System::String ^properties);
array<System::String ^> ^ enumWindowInfo(System::IntPtr windowHandle, System::String ^properties);
array<System::String ^> ^ enumWindowInfo(AutomationElement ^element, System::String ^properties);
array<System::String ^> ^ enumWindowInfo(AutomationElement ^element, System::String ^properties, List<System::String ^> ^filterModifierList);
System::String ^ getWindowInfo(AutomationElement ^element, System::String ^properties, AutomationElement ^optionalParentElement);
System::String ^ getWindowInfo(System::Int32 x, System::Int32 y, System::String ^properties);
System::String ^ getWindowInfo(System::IntPtr windowHandle, System::String ^properties);
System::String ^ getWindowInfo(System::String ^runtimeIdStr, System::String ^properties);
static System::String ^ALL_MODIFIER = L"All";// find all matching elements of this filter
static System::String ^PARENT_MODIFIER = L"Parent";//find all children of this matching parent filter
static System::String ^FIRST_MODIFIER = L"First"; //find first element matching this filter then stop
static System::String ^DEFAULT_CACHED_PROPS = L"RuntimeIdProperty,ParentRuntimeIdProperty,NativeWindowHandleProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ControlTypeProperty,ClassNameProperty,NameProperty,BoundingRectangleProperty,ValueProperty";
private:
void initializeCache(System::String ^cachedProperties);
void output(Exception ^ex, System::String ^message);
Dictionary<System::String ^, System::String ^> ^enumFilters;
void AutomationBridge::processFilterModifier(Boolean filtered, Boolean modifierChanged, List<System::String ^> ^filterModifierList);
CacheRequest ^cacheRequest;
System::Boolean useCache;
array<AutomationProperty^> ^cachedRootProperties;
};
}

View File

@@ -1,182 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BAC1B079-7B87-4396-B17F-91A86DF1AE29}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>uiabridge</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\uiabridge$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>mkdir "$(ProjectDir)bin"
copy /Y "$(TargetPath)" "$(ProjectDir)bin\uiabridge$(PlatformArchitecture)$(TargetExt)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationClient" />
<Reference Include="UIAutomationClientsideProviders" />
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Global.h" />
<ClInclude Include="org_synthuse_UiaBridge.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="Stdafx.h" />
<ClInclude Include="uiabridge.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="Global.cpp" />
<ClCompile Include="org_synthuse_UiaBridge.cpp" />
<ClCompile Include="Stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="uiabridge.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="app.ico" />
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="uiabridge.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="org_synthuse_UiaBridge.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Global.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="uiabridge.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AssemblyInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="org_synthuse_UiaBridge.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Global.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="app.ico">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

View File

@@ -1,40 +0,0 @@
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("uiabtest")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("na")];
[assembly:AssemblyProductAttribute("uiabtest")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) na 2014")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

View File

@@ -1,35 +0,0 @@
========================================================================
APPLICATION : uiabtest Project Overview
========================================================================
AppWizard has created this uiabtest Application for you.
This file contains a summary of what you will find in each of the files that
make up your uiabtest application.
uiabtest.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.
uiabtest.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
similar extensions under a specific node (for e.g. ".cpp" files are associated with the
"Source Files" filter).
uiabtest.cpp
This is the main application source file.
AssemblyInfo.cpp
Contains custom attributes for modifying assembly metadata.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

View File

@@ -1,5 +0,0 @@
REM set path=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin;%path%
%WinDir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:configuration=release /p:platform=win32 %*
pause

View File

@@ -1,3 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by app.rc

View File

@@ -1,7 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// uiabtest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -1,11 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
// TODO: reference additional headers your program requires here
#include <stdio.h>
#include <conio.h>
#include <tchar.h>

View File

@@ -1,114 +0,0 @@
/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
// uiabtest.cpp : main project file.
#include "stdafx.h"
using namespace System;
using namespace System::Windows::Automation;
using namespace uiabridge;
void outputResults(array<System::String ^> ^winInfo)
{
System::IO::StreamWriter ^file = gcnew System::IO::StreamWriter("c:\\temp.txt");
for each(System::String ^prop in winInfo)
{
Console::WriteLine(prop);
file->WriteLine(prop);
}
file->Flush();
file->Close();
}
void runBasicTests(AutomationBridge ^ab, System::String ^propList)
{
array<System::String ^> ^winInfo = nullptr;
System::DateTime start;
System::Double seconds = 0;
start = System::DateTime::Now;
ab->clearEnumFilters();
ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
winInfo = ab->enumWindowInfo(propList);
//outputResults(winInfo);
seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total WinForm Elements: {0} in {1} seconds", winInfo->Length, seconds);
start = System::DateTime::Now;
ab->clearEnumFilters();
ab->addEnumFilter("Parent/FrameworkIdProperty", "WPF");
winInfo = ab->enumWindowInfo(propList);
//outputResults(winInfo);
seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total WPF Elements: {0} in {1} seconds", winInfo->Length, seconds);
start = System::DateTime::Now;
ab->clearEnumFilters();
winInfo = ab->enumWindowInfo(propList);
//outputResults(winInfo);
seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
Console::WriteLine(L"Total All Elements: {0} in {1} seconds", winInfo->Length, seconds);
Console::WriteLine(L"---------------------------------------");
}
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"UI Automation Bridge Test");
//System::String ^propList = L"RuntimeIdProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ClassNameProperty,NameProperty";
System::String ^propList = L"RuntimeIdProperty,ParentRuntimeIdProperty,NativeWindowHandleProperty,ProcessIdProperty,FrameworkIdProperty,LocalizedControlTypeProperty,ControlTypeProperty,ClassNameProperty,NameProperty,ValueProperty,BoundingRectangleProperty";
AutomationBridge ^ab = gcnew AutomationBridge(propList);
//System::String ^propList = L"RuntimeIdProperty,BoundingRectangleProperty";
Console::WriteLine(propList);
Console::WriteLine(L"\nCached Requests Enabled");
ab->useCachedRequests(true);//disable cache
runBasicTests(ab, propList);
runBasicTests(ab, propList);
runBasicTests(ab, propList);
Console::WriteLine(L"Cached Requests Disabled");
ab->useCachedRequests(false);//disable cache
runBasicTests(ab, propList);
runBasicTests(ab, propList);
runBasicTests(ab, propList);
//System::String ^winInfo1 = ab->getWindowInfo(System::IntPtr(3409618), propList);
//ab->addEnumFilter("Parent/ClassNameProperty", "Notepad");
//ab->addEnumFilter("First/RuntimeIdProperty", "42-4784952");
//ab->addEnumFilter("ClassNameProperty", "Notepad");
//ab->addEnumFilter("All/ClassNameProperty", "Edit");
//ab->addEnumFilter("All/LocalizedControlTypeProperty", "menu item");
//ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
//ab->addEnumFilter("Parent/FrameworkIdProperty", "WPF");
//ab->addEnumFilter("Parent/ClassNameProperty", "WindowsForms10.Window.8.app.0.2bf8098_r13_ad1");
//array<System::String ^> ^winInfo = ab->enumWindowInfo(propList); //L"*"
//ab->clearEnumFilters();
//ab->addEnumFilter("Parent/FrameworkIdProperty", "WinForm");
//array<System::String ^> ^winInfo = ab->enumWindowInfo(System::IntPtr(3409618), propList); //L"*"
//array<System::String ^> ^winInfo = ab->enumWindowInfo(System::IntPtr(12977932), propList); //L"*"
//Console::WriteLine("enumWindowInfo x,y: {0}", ab->getWindowInfo(100,100, propList); //L"*"
//outputResults(winInfo);
//Globals::Global::AUTO_BRIDGE->clearEnumFilters();
//winInfo = nullptr;
//winInfo = Globals::Global::AUTO_BRIDGE->enumWindowInfo(System::IntPtr(7603636), propList);
//Console::WriteLine("winInfo length: {0}", winInfo->Length);
//winInfo = Globals::Global::AUTO_BRIDGE->enumWindowInfo(System::IntPtr(7603636), propList);
//Console::WriteLine("winInfo length: {0}", winInfo->Length);
//Console::WriteLine("getWindowInfo RuntimeIdProperty: {0}", ab->getWindowInfo("42-4784952", propList));
//System::Threading::Thread::Sleep(10000); //10 seconds sleep
//array<System::String ^> ^winInfo2 = ab->enumWindowInfo(propList); //L"*"
//outputResults(winInfo2);
//System::Double seconds = System::Math::Round(System::DateTime::Now.Subtract(start).TotalSeconds, 4);
//Console::WriteLine(L"Total Elements: {0} in {1} seconds", winInfo->Length, seconds);
Console::WriteLine(L"press any key to exit");
_getch();//wait for user input
return 0;
}

View File

@@ -1,169 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7958D1B7-F169-40FA-A7A0-10E8E0F90CDA}</ProjectGuid>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword>
<RootNamespace>uiabtest</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationClient" />
<Reference Include="UIAutomationClientsideProviders" />
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<None Include="app.ico" />
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="uiabtest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\uiabridge\uiabridge.vcxproj">
<Project>{bac1b079-7b87-4396-b17f-91a86df1ae29}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
<None Include="app.ico">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="app.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="uiabtest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AssemblyInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>