<?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>pigfoot's weblog &#187; Windows</title>
	<atom:link href="http://weblog.pigfoot.org/pigfoot/category/dev/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://weblog.pigfoot.org/pigfoot</link>
	<description>We should forget about small efficiencies -- Donald Knuth</description>
	<lastBuildDate>Fri, 30 Jul 2010 02:51:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Cool picture of all the new Vista Icons</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/09/26/cool-picture-of-all-the-new-vista-icons/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/09/26/cool-picture-of-all-the-new-vista-icons/#comments</comments>
		<pubDate>Tue, 26 Sep 2006 07:46:27 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/09/26/cool-picture-of-all-the-new-vista-icons/</guid>
		<description><![CDATA[Cool picture of all the new Vista Icons. Besides, here is a tutorial from MSDN on how Microsoft makes their Windows XP icons.]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://www.istartedsomething.com/20060924/vista-fitted-nearly-finished/">Cool picture of all the new Vista Icons</a>.</p>
<p><a href="http://www.istartedsomething.com/wp-content/uploads/2006/09/vista256.jpg"><img id="image678" alt="Windows Vista 256x256 high-resolution icons" class="pigfoot" src="http://www.istartedsomething.com/wp-content/uploads/2006/09/vista256_s.jpg" /></a></p>
<p>Besides, here is a tutorial from <a target="_blank" href="http://digg.com/design/How_Microsoft_makes_their_Icons">MSDN</a> on <a target="_blank" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/winxpicons.asp">how Microsoft makes their Windows XP icons</a>.</p>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=372&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/09/26/cool-picture-of-all-the-new-vista-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elevate through ShellExecute</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/09/26/elevate-through-shellexecute/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/09/26/elevate-through-shellexecute/#comments</comments>
		<pubDate>Tue, 26 Sep 2006 07:19:52 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/09/26/elevate-through-shellexecute/</guid>
		<description><![CDATA[Elevate through ShellExecute, from Vista Compatibility Team Blog. We often get the question how to elevate a process through ShellExecute. From the docs it is not immediately clear. The trick is passing in &#8220;runas&#8221; in the lpVerb. Here is a snippet to run notepad elevated. #include &#8220;stdafx.h&#8221; #include &#8220;windows.h&#8221; #include &#8220;shellapi.h&#8221; int _tmain(int argc, _TCHAR* [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://blogs.msdn.com/vistacompatteam/archive/2006/09/25/771232.aspx">Elevate through ShellExecute</a>, from <a target="_blank" href="http://blogs.msdn.com/vistacompatteam/default.aspx">Vista Compatibility Team Blog</a>.</p>
<blockquote><p>
We often get the question how to elevate a process through ShellExecute. From the <a target="_blank" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecuteex.asp">docs</a> it is not immediately clear. The trick is passing in &#8220;runas&#8221; in the lpVerb.</p>
<p>Here is a snippet to run notepad elevated.
</p></blockquote>
<p><font face="Courier New">#include &#8220;stdafx.h&#8221;<br />
#include &#8220;windows.h&#8221;<br />
#include &#8220;shellapi.h&#8221;</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;SHELLEXECUTEINFO shExecInfo;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.fMask = NULL;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.hwnd = NULL;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.lpVerb = L&#8221;</font><font color="#ff0000">runas</font><font face="Courier New">&#8220;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.lpFile = L&#8221;notepad.exe&#8221;;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.lpParameters = NULL;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.lpDirectory = NULL;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.nShow = SW_MAXIMIZE;<br />
&nbsp;&nbsp;&nbsp;&nbsp;shExecInfo.hInstApp = NULL;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;ShellExecuteEx(&#038;shExecInfo);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
}</font></p>
<p>Here is some screenshot:</p>
<p><img title="RunAS" alt="RunAS" src="http://static.flickr.com/85/253107952_5991252368.jpg" /></p>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=371&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/09/26/elevate-through-shellexecute/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Peer to Peer (p2p) in Windows Vista &#8211; People Near Me API</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/09/07/peer-to-peer-p2p-in-windows-vista-people-near-me-api/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/09/07/peer-to-peer-p2p-in-windows-vista-people-near-me-api/#comments</comments>
		<pubDate>Thu, 07 Sep 2006 08:43:09 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/09/07/wi-fi-fingerprints-the-end-of-mac-spoofing-2/</guid>
		<description><![CDATA[Peer to Peer (p2p) in Windows Vista &#8211; People Near Me API from ebooth&#8217;s blog. The overview of the p2p APIs available in Windows Vista is: PNRP (Peer Name Resolution Protocol) is like server-less DNS. It allows clients to register secured and unsecured peer names that can be resolved over the internet. Currently large data [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://blogs.msdn.com/ebooth/archive/2006/09/07/743527.aspx">Peer to Peer (p2p) in Windows Vista &#8211; People Near Me API</a> from <a target="_blank" href="http://blogs.msdn.com/ebooth/">ebooth&#8217;s blog</a>.</p>
<p>The overview of the p2p APIs available in Windows Vista is:</p>
<ul>
<li><strong>PNRP</strong> (Peer Name Resolution Protocol) is like server-less DNS. It allows clients to register secured and unsecured peer names that can be resolved over the internet. Currently large data centers are required to host services that PNRP has the potential to replace. PNRP gives people the ability to discover a friend and see their presence online and then play a game or work on a project together.</li>
<li><strong>PNM</strong> (People Near Me) allows for dynamic discovery and invitation of computers running Windows Vista on the same subnet or Ad-hoc wireless. This means you can play games with people in the airport, swap photos with your friends or collaborate with colleagues. For example Windows Meeting Space uses PNM.</li>
<li><strong>Peer Naming API</strong> allows email providers to tie PNRP names to email addresses. Then any program that uses the WinSock APIs can resolve registered email addresses. This means you can literally ping a friend or put their email address where you would have to put an IP address in a game.</li>
<li><strong>Graphing</strong> is a mesh networking API. It allows groups of people to share information and collaborate. A game could create a mesh of online players so that it could do server-less match making. Or an evangelism team could collaborate on a document without having to upload the latest copy to a server.</li>
<li><strong>Grouping</strong> is the security component of Graphing. It allows for a group to be administrated, so that membership and permissions can be restricted. Think of Grouping and Graphing as a database in the cloud.</li>
<li><strong>Peer Channel</strong> is the only managed API in the P2P API suite. It allows for mesh replication instead of mesh collaboration.</li>
<li><strong>Application Invite</strong> (AppInvite) allows a user to invite another user to use a collaboration application. Any application can register with the invite API and when a user sends an invite to use that application the application will be launched by Windows Vista. Windows Meeting Space is an example of an application that uses AppInvite.</li>
<li><strong>Contacts API</strong> allows the creation and administration of p2p contacts.</li>
<li><strong>Serverless Presence</strong>: Gets contact presence information.</li>
</ul>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=356&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/09/07/peer-to-peer-p2p-in-windows-vista-people-near-me-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Buffering in HTTP.SYS</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/08/21/buffering-in-httpsys/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/08/21/buffering-in-httpsys/#comments</comments>
		<pubDate>Mon, 21 Aug 2006 05:43:57 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/08/21/buffering-in-httpsys/</guid>
		<description><![CDATA[Buffering in HTTP.SYS, from Windows Core Networking Team&#8217;s blog. 故事內容是這樣的. IIS 5.0 之前是用 WinSock 來 implement, 這樣預設會打開 buffering 機制, 到了 Windows 2003 的 IIS 6.0 開始, 則改由 HTTP.SYS 來負責. 這樣反而會遇到 performance 下降的問題. 主要的理由我猜是 Nagle&#8217;s Algorithm. 現在的 socket 實作預設都會打開 TCP 的 Nagle&#8217;s Algorithm. 這個演算法簡單的說, 就是利用 delay ack 來減少網路上所傳輸 packet 量, 進而增加 TCP 的 performance. 不幸的是, Nagle&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://blogs.msdn.com/wndp/archive/2006/08/15/http_sys_buffering.aspx">Buffering in HTTP.SYS</a>, from <a target="_blank" href="http://blogs.msdn.com/wndp/">Windows Core Networking Team&#8217;s blog</a>.</p>
<p>故事內容是這樣的. <acronym title="Shipped with Windows NT, Windows 2000 Server family">IIS 5.0 之前</acronym>是用 WinSock 來 implement, 這樣預設會打開 buffering 機制, 到了 Windows 2003 的 IIS 6.0 開始, 則改由 HTTP.SYS 來負責. 這樣反而會遇到 performance 下降的問題.</p>
<p>主要的理由我猜是  <a target="_blank" href="http://en.wikipedia.org/wiki/Nagle's_Algorithm">Nagle&#8217;s Algorithm</a>. 現在的 socket 實作預設都會打開 TCP 的 <a target="_blank" href="http://en.wikipedia.org/wiki/Nagle's_Algorithm">Nagle&#8217;s Algorithm</a>. 這個演算法簡單的說, 就是利用 delay ack 來減少網路上所傳輸 packet 量, 進而增加 TCP 的 performance. 不幸的是, Nagle&#8217;s Algorithm 對於小 packet 的幫助比較明顯, 大 packet 反而會有 latency 拉長的反效果. 換句話說, 對於一次傳輸大量資料的網路程式, 應該要 disable Nagle&#8217;s Algorithm 會有比較好的 performance.</p>
<p>目前在 Windows 2003 SP1 之後有一個 <a target="_blank" href="http://en.wikipedia.org/wiki/Workaround">workaround</a> 的辦法, 就是<a target="_blank" href="http://windowssdk.msdn.microsoft.com/en-us/library/ms688021.aspx">利用 HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA 這個 flag</a>. 雖然說還有另一個 flag 是 HTTP_SEND_RESPONSE_FLAG_ENABLE_NAGLING, 表示預設應該是 disable Nagle&#8217;s Algorithm, 不過我還是很好奇, 為甚麼預設明明 disable Nagle&#8217;s Algorithm, performance 沒上去的原因, 和一般網路程式 enable Nagle&#8217;s Algorithm 一樣呢?</p>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=333&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/08/21/buffering-in-httpsys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Create a Self-Restartable Application</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/08/16/how-to-create-a-self-restartable-application/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/08/16/how-to-create-a-self-restartable-application/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 03:43:07 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/08/16/how-to-create-a-self-restartable-application/</guid>
		<description><![CDATA[How To Create a Self-Restartable Application, from CodeProject. This article describes the way to add restarting support to your Win32 applications. Key pointer is as followings: Old Instance Create a Mutex and create a new process with command retrieved by GetModuleFileName(). g_RA_hMutexOtherRestarting = ::CreateMutex( NULL, TRUE, RA_MUTEX_OTHER_RESTARTING); TCHAR szAppPath[MAX_PATH] = {0}; ::GetModuleFileName(NULL, szAppPath, MAX_PATH); CreateProcess(NULL, [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://www.codeproject.com/threads/RestartableApp.asp">How To Create a Self-Restartable Application</a>, from <a target="_blank" href="http://www.codeproject.com/">CodeProject</a>.</p>
<p>This article describes the way to add restarting support to your Win32 applications. Key pointer is as followings:</p>
<p>Old Instance Create a Mutex and create a new process with command retrieved by GetModuleFileName().</p>
<pre style="font-size: 11px">g_RA_hMutexOtherRestarting = ::CreateMutex( NULL, TRUE, RA_MUTEX_OTHER_RESTARTING);
TCHAR szAppPath[MAX_PATH] = {0};
::GetModuleFileName(NULL, szAppPath, MAX_PATH);
CreateProcess(NULL, szAppPath, NULL, NULL, FALSE, 0, NULL, NULL, &#038;si, &#038;pi);</pre>
<p>New Instance wait for this mutex for release which means old instance has been dead.</p>
<pre style="font-size: 11px">// Releasing mutex signal that process finished
DWORD dwWaitResult = WaitForSingleObject(g_RA_hMutexOtherRestarting, 0);
if (dwWaitResult == WAIT_TIMEOUT)
::ReleaseMutex(g_RA_hMutexOtherRestarting);
::CloseHandle(g_RA_hMutexOtherRestarting);</pre>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=330&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/08/16/how-to-create-a-self-restartable-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[MFC] CString Management</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/07/05/mfc-cstring-management/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/07/05/mfc-cstring-management/#comments</comments>
		<pubDate>Wed, 05 Jul 2006 05:28:13 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/07/05/mfc-cstring-management/</guid>
		<description><![CDATA[CString Management, from CodeProject. CStrings are a useful data type. They greatly simplify a lot of operations in MFC, making it much more convenient to do string manipulation. However, there are some special techniques to using CStrings, particularly hard for people coming from a pure-C background to learn. This essay discusses some of these techniques. [...]]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://www.codeproject.com/string/cstringmgmt.asp">CString Management</a>, from <a target="_blank" href="http://www.codeproject.com/">CodeProject</a>.</p>
<blockquote><p>CStrings are a useful data type. They greatly simplify a lot of operations in MFC, making it much more convenient to do string manipulation. However, there are some special techniques to using CStrings, particularly hard for people coming from a pure-C background to learn. This essay discusses some of these techniques.</p>
<p>Much of what you need to do is pretty straightforward. This is not a complete tutorial on CStrings, but captures the most common basic questions</p></blockquote>
<p>From this article, we can learn how to effectively use CStrings.</p>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=284&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/07/05/mfc-cstring-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VC Add-ins: WTL Helper</title>
		<link>http://weblog.pigfoot.org/pigfoot/2006/06/12/vc-add-ins-wtl-helper/</link>
		<comments>http://weblog.pigfoot.org/pigfoot/2006/06/12/vc-add-ins-wtl-helper/#comments</comments>
		<pubDate>Mon, 12 Jun 2006 05:23:15 +0000</pubDate>
		<dc:creator>pigfoot</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://weblog.pigfoot.org/pigfoot/2006/06/12/vc-add-ins-wtl-helper/</guid>
		<description><![CDATA[WTL Helper, from CodeProject. Add-in for MS VC++.NET 2003 that helps to insert message handlers for WTL.]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://www.codeproject.com/macro/WTLHelper.asp">WTL Helper</a>, from <a target="_blank" href="http://www.codeproject.com/macro/WTLHelper.asp">CodeProject</a>.</p>
<p>Add-in for MS VC++.NET 2003 that helps to insert message handlers for <a target="_blank" href="http://wtl.sourceforge.net/">WTL</a>.</p>
<img src="http://weblog.pigfoot.org/pigfoot/?ak_action=api_record_view&id=263&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://weblog.pigfoot.org/pigfoot/2006/06/12/vc-add-ins-wtl-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
