<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Library &#187; hook</title>
	<atom:link href="http://www.ucosoft.com/tag/hook/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ucosoft.com</link>
	<description>Free Source Code and Program Tips</description>
	<lastBuildDate>Thu, 22 Jul 2010 05:17:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to hook the file related event</title>
		<link>http://www.ucosoft.com/how-to-hook-the-file-related-event.html</link>
		<comments>http://www.ucosoft.com/how-to-hook-the-file-related-event.html#comments</comments>
		<pubDate>Fri, 22 Jun 2007 03:29:35 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[How-to]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/2007/06/22/how-to-hook-the-file-related-event.html</guid>
		<description><![CDATA[How to hook the file related event? It depends on what you need to do when such an event takes places. If what you just want to be notified, FindFirstChangeNotification and ReadDirectoryChanges are enough. If you need to intercept adn affect the operation somehow, I have heard it can be done with a kenerl-level driver(Filesystem [...]]]></description>
			<content:encoded><![CDATA[<p>How to hook the file related event?</p>
<p>It depends on what you need to do when such an event takes places. If what you just want to be notified, <B>FindFirstChangeNotification</B> and <B>ReadDirectoryChanges</B> are enough.</p>
<p>If you need to intercept adn affect the operation somehow, I have heard it can be done with a kenerl-level driver(Filesystem Driver), but I have no experience about it.</p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/api" title="API" rel="tag">API</a>, <a href="http://www.ucosoft.com/tag/file" title="File" rel="tag">File</a>, <a href="http://www.ucosoft.com/tag/hook" title="hook" rel="tag">hook</a>, <a href="http://www.ucosoft.com/tag/how-to" title="How-to" rel="tag">How-to</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/how-to-hook-the-file-related-event.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install global hook without dll</title>
		<link>http://www.ucosoft.com/install-global-hook-without-dll.html</link>
		<comments>http://www.ucosoft.com/install-global-hook-without-dll.html#comments</comments>
		<pubDate>Wed, 03 Jan 2007 09:14:37 +0000</pubDate>
		<dc:creator>support</dc:creator>
				<category><![CDATA[Win32/MFC]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[message]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/66.html</guid>
		<description><![CDATA[Chinese version author: peach@newsmth.net Userally, when you install a global hook, you need a dll. But now, you can install WH_KEYBOARD_LL or WH_MOUSE_LL global hook without dll&#8217;s help. The following code was tested under win2k3. And I it will also run on 2k/xp. #define _WIN32_WINNT 0400 #define STRICT #define WIN32_LEAN_AND_MEAN #include #include #include DWORD g_main_tid [...]]]></description>
			<content:encoded><![CDATA[<p><P>Chinese version author: peach@newsmth.net</P><br />
<P>Userally, when you install a global hook, you need a dll. But now, you can install WH_KEYBOARD_LL or WH_MOUSE_LL global hook without dll&#8217;s help.</P><br />
<P>The following code was tested under win2k3. And I it will also run on 2k/xp.
<p>
<span id="more-66"></span><br />
<coolcode lang="cpp" linenum="no" download="src_hook_without_dll.c"><br />
#define _WIN32_WINNT    0400<br />
#define STRICT<br />
#define WIN32_LEAN_AND_MEAN</p>
<p>#include <stdio.h><br />
#include <stdlib.h><br />
#include <windows.h></p>
<p>DWORD   g_main_tid  = 0;<br />
HHOOK   g_kb_hook   = 0;</p>
<p>BOOL CALLBACK con_handler (DWORD)<br />
    {<br />
        PostThreadMessage (g_main_tid, WM_QUIT, 0, 0);<br />
        return TRUE;<br />
    };</p>
<p>LRESULT CALLBACK kb_proc (int code, WPARAM w, LPARAM l)</p>
<p>    {<br />
        PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)l;<br />
        const char *info = NULL;<br />
        if (w == WM_KEYDOWN)<br />
            info = &#8220;key dn&#8221;;<br />
        else if (w == WM_KEYUP)<br />
            info = &#8220;key up&#8221;;<br />
        else if (w == WM_SYSKEYDOWN)<br />
            info = &#8220;sys key dn&#8221;;<br />
        else if (w == WM_SYSKEYUP)<br />
            info = &#8220;sys key up&#8221;;</p>
<p>        printf (&#8220;%s &#8211; vkCode [%04x], scanCode [%04x]\n&#8221;,<br />
            info, p->vkCode, p->scanCode);<br />
        //  always call next hook<br />
        return CallNextHookEx (g_kb_hook, code, w, l);</p>
<p>    };</p>
<p>int main (void)<br />
    {<br />
        g_main_tid = GetCurrentThreadId ();<br />
        SetConsoleCtrlHandler (&#038;con_handler, TRUE);</p>
<p>        g_kb_hook = SetWindowsHookEx (<br />
            WH_KEYBOARD_LL,<br />
            &#038;kb_proc,<br />
            GetModuleHandle (NULL), //ã€€It shouldn&#8217;t be NULL, or will fail<br />
            0);</p>
<p>        if (g_kb_hook == NULL)</p>
<p>        {<br />
            fprintf (stderr,<br />
                &#8220;SetWindowsHookEx failed with error %d\n&#8221;,<br />
                ::GetLastError ());<br />
            return 0;<br />
        };</p>
<p>        // The message loop is necesarry</p>
<p>        MSG msg;<br />
        while (GetMessage (&#038;msg, NULL, 0, 0))<br />
        {<br />
            TranslateMessage (&#038;msg);<br />
            DispatchMessage (&#038;msg);<br />
        };<br />
        UnhookWindowsHookEx (g_kb_hook);<br />
        return 0;<br />
    };<br />
</coolcode></p>

	Tags: <strong><a href="http://www.ucosoft.com/tag/dll" title="dll" rel="tag">dll</a>, <a href="http://www.ucosoft.com/tag/hook" title="hook" rel="tag">hook</a>, <a href="http://www.ucosoft.com/tag/message" title="message" rel="tag">message</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/install-global-hook-without-dll.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ucoSpy,a system enhancement tool like spy++</title>
		<link>http://www.ucosoft.com/ucospy.html</link>
		<comments>http://www.ucosoft.com/ucospy.html#comments</comments>
		<pubDate>Wed, 22 Nov 2006 08:21:30 +0000</pubDate>
		<dc:creator>hamo</dc:creator>
				<category><![CDATA[Project]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[ucosoft]]></category>

		<guid isPermaLink="false">http://www.ucosoft.com/archives/27.html</guid>
		<description><![CDATA[Introduce ucoSpy is a system enhancement application, used to view various attributes of windows or controls, and copy multiple contents that can&#8217;t be normally copied as well, such as passwords hidden as asteroids, and a TreeView. And ucoSpy can give a report the tree relationship of the windows and their child control. Main features ucoSpy [...]]]></description>
			<content:encoded><![CDATA[<h1><a name="introduce">Introduce</a></h1>
<p> <strong>ucoSpy</strong> is a system enhancement application, used to view various attributes of windows or controls, and copy multiple contents that can&rsquo;t be normally copied as well, such as passwords hidden as asteroids, and a TreeView. And <strong>ucoSpy</strong> can  give a report the tree relationship of the windows and their child control.  </p>
<h1><a name="main_features">Main features</a></h1>
<div>
<p>  <strong>ucoSpy</strong> is designed with the architecture of <em>plug-in</em>. So everyone can write theie plugin to enhance <strong>ucoSpy</strong>. Acturally, the main function is provied by the plugin <strong>CmnWnd.pgx</strong>. </p>
<p> All the data are stored in xml format. </p>
</div>
<h1><a name="todo_list">Todo list</a></h1>
<div>
<ul>
<li>
<div> Get the password content from the ie window. (web page in <acronym title="Internet Explorer">IE</acronym> is not a normal wnd)</div>
</li>
<li>
<div> Get the detail data of <em>listview</em> and <em>treeview</em>. (since <acronym title="Microsoft">MS</acronym> has forbidden to get the item data from the other process, we have to use WriteProcessMemory and ReadProcessMemory.)</div>
</li>
<li>
<div> Result report. (with xslt or css to format the xml data)</div>
</li>
</ul>
</div>
<h1><a name="introduce"></a></h1>

	Tags: <strong><a href="http://www.ucosoft.com/tag/hook" title="hook" rel="tag">hook</a>, <a href="http://www.ucosoft.com/tag/project" title="Project" rel="tag">Project</a>, <a href="http://www.ucosoft.com/tag/ucosoft" title="ucosoft" rel="tag">ucosoft</a></strong><br />
]]></content:encoded>
			<wfw:commentRss>http://www.ucosoft.com/ucospy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

