Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's right. You have to hook the function CreateFileA/W in kernel32.dll to monitor the acces. Do you want to hook these APIs in your own process or in an other process? If you want to hook functions in your own process you can use</p> <pre><code>void *DetourFunc(BYTE *src, const BYTE *dst, const int len) { BYTE *jmp = (BYTE*)malloc(5+len); DWORD dwback; VirtualProtect(src,len,PAGE_READWRITE,&amp;dwback); memcpy(jmp,src,len); jmp += len; jmp[0] = 0xE9; *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5; src[0] = 0xE9; *(DWORD*)(src+1) = (DWORD)(dst - src) - 5; VirtualProtect(src,len,dwback,&amp;dwback); return (jmp-len); } </code></pre> <p>for it. These function detours the function src (f.e. MessageBoxA()) to function dst. As len you can use 5. It returns a function pointer to the original function. An example call:</p> <pre><code>typedef int (WINAPI *__MessageBox)( __in_opt HWND hWnd, __in_opt LPCTSTR lpText, __in_opt LPCTSTR lpCaption, __in UINT uType ); __MessageBox _MessageBox; int cMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) { //here you can change anything you want return _MessageBox(hWnd,lpText,lpCaption,uType); } int main(void) { BYTE *hookfunc = (BYTE*)GetProcAddress(LoadLibrary("user32.dll"),"MessageBoxA"); _MessageBox = (__MessageBox)DetourFunc(hookfunc,(BYTE*)cMessageBox,5); return 0; } </code></pre> <p>That's an usermode hook. If you want to do this systemwide I would use a device driver. Here is a tutorial about this. <a href="http://www.codeproject.com/KB/system/driverdev.aspx" rel="nofollow">http://www.codeproject.com/KB/system/driverdev.aspx</a></p> <p>And if you are using VC++ compile in multibyte mode ;). If you want to hook in an other process just google DLL-Injection ;).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload