Hi!
I need help for my programmer in my company.
He work on Library.dll. It is a pure C++ hook library for Windows, which using easyhook.codeplex.com library for monitoring websites history.
That need:
1. Download easyhook
2. Create pure C++ win32 library project in Visual C++ 2008.
3. Create 2 export functions:
def file:
LIBRARY “Library”
EXPORTS
Start
Stop
Library.h:
#ifdef LIBRARY_EXPORTS
#define LIBRARY_API __declspec(dllexport)
#else
#define LIBRARY_API __declspec(dllimport)
#endif
LIBRARY_API int Start(void);
LIBRARY_API int Stop(void);
Library.cpp:
extern HINSTANCE hInstance;
#pragma data_seg(“Shared”)
HHOOK g_hHook = NULL;
#pragma data_seg()
#pragma comment(linker, “/section:Shared,rws”)
static
LRESULT
CALLBACK
HookProc(
int nCode,
WPARAM wParam,
LPARAM lParam
)
{
return CallNextHookEx(g_hHook, nCode, wParam, lParam);
}
LIBRARY_API int Start(void)
{
PleaseStop = FALSE;
g_hHook = SetWindowsHookEx(WH_GETMESSAGE, HookProc, hInstance, 0);
if (g_hHook == 0)
return GetLastError();
return 0;
}
LIBRARY_API int Stop(void)
{
if (!UnhookWindowsHookEx(g_hHook))
{
Sleep(1000);
if (!UnhookWindowsHookEx(g_hHook))
{
Sleep(1000);
UnhookWindowsHookEx(g_hHook);
}
}
PleaseStop = TRUE;
return 0;
}
3. Add 3 API loging functions with easyhook help:
// ExtTextOutW
DWORD ACLEntriesTimedExtTextOutW[1] = { (DWORD)-1 };
HOOK_TRACE_INFO g_hTimedExtTextOutWHook = {NULL};
BOOL WINAPI TimedExtTextOutW( __in HDC hdc, __in int x, __in int y, __in UINT options, __in_opt CONST RECT * lprect, __in_ecount(c) LPCWSTR lpString, __in UINT c, __in_ecount_opt(c) CONST INT * lpDx)
{
///store all text in log file
//…
return ExtTextOutW(hdc, x, y, options, lprect, lpString, c, lpDx);
}
// TextOutW
DWORD ACLEntriesTimedTextOutW[1] = { (DWORD)-1 };
HOOK_TRACE_INFO g_hTimedTextOutWHook = {NULL};
BOOL WINAPI TimedTextOutW( __in HDC hdc, __in int x, __in int y, __in_ecount(c) LPCWSTR lpString, __in int c)
{
///store all text in log file
//…
return TextOutW(hdc, x, y, lpString, c);
}
// getaddrinfo
DWORD ACLEntriesTimedgetaddrinfo[1] = { (DWORD)-1 };
HOOK_TRACE_INFO g_hTimedgetaddrinfoHook = {NULL};
INT
WSAAPI
Timedgetaddrinfo(
__in_opt PCSTR pNodeName,
__in_opt PCSTR pServiceName,
__in_opt const ADDRINFOA * pHints,
__deref_out PADDRINFOA * ppResult
)
{
//store all websites to log fil
//
//….
return getaddrinfo(
pNodeName,
pServiceName,
pHints,
ppResult);
}
4. Add initialization with easyhook:
//
// DllMain
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
//
// for hook
//
hInstance = hModule;
//
// EasyHook
//
if (LhInstallHook(
GetProcAddress(GetModuleHandleW(Gdi32), “ExtTextOutW”),
TimedExtTextOutW,
NULL,
&g_hTimedExtTextOutWHook) != 0)
return FALSE;
if (LhInstallHook( GetProcAddress(GetModuleHandleW(Gdi32), “TextOutW”),
TimedTextOutW,
NULL,
&g_hTimedTextOutWHook) != 0)
return FALSE;
if (LhInstallHook(GetProcAddress(GetModuleHandleW(Ws2_32), “getaddrinfo”), Timedgetaddrinfo, NULL, &g_hTimedgetaddrinfoHook) != 0)
return FALSE;
if (LhSetExclusiveACL(ACLEntriesTimedExtTextOutW, 1, &g_hTimedExtTextOutWHook) != 0)
return FALSE;
if (LhSetExclusiveACL(ACLEntriesTimedTextOutW, 1, &g_hTimedTextOutWHook) != 0)
return FALSE;
if (LhSetExclusiveACL(ACLEntriesTimedgetaddrinfo, 1, &g_hTimedgetaddrinfoHook) != 0)
return FALSE;
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
LhUninstallAllHooks();
LhWaitForPendingRemovals();
break;
}
return TRUE;
}
5. Compile for me dll. So, run this dll:
“rundll32.exe Library.dll Start”
6. I need all text which is draw in web page of Internet Explorer window. I need all web servers, which is typed in adress line of Internet Explorer (history). All data need store in txt file. For expample in C:log.txt
7. This difficalt for my programmers: I need like getaddrinfo logging for Mozilla Firefox last version with easyhook help.
8. This difficalt for my programmers: I need Like ExtTextOut and TextOut logging for another browsers. For Mozilla Firefox, Google Chrome, Opera last versions.
So I need:
pure C++ dll project without .NET framework, You can use ATL;
all web servers logging for Mozilla Firefox;
all web pages text logging for 4 browsers;
with easyhook help.
please setup 2 price (for 7 and for 8 sections).
thanks