<?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>kichik's blog &#187; NSIS</title>
	<atom:link href="http://kichik.net/category/nsis/feed/" rel="self" type="application/rss+xml" />
	<link>http://kichik.net</link>
	<description>Random incoherent rambling about stuff</description>
	<lastBuildDate>Mon, 12 Jul 2010 14:40:31 +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>Pragmatic variant</title>
		<link>http://kichik.net/2008/11/29/pragmatic-variant/</link>
		<comments>http://kichik.net/2008/11/29/pragmatic-variant/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 12:17:02 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[NSIS]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://kichik.net/?p=92</guid>
		<description><![CDATA[As mentioned in my previous post, I have been working on incorporating some more features into WinVer.nsh. Every little change in this header file requires testing on all possible versions and configurations of Windows. Being the Poor Open Source DeveloperTM that I am, I do not have sufficient resources to assemble a full-blown testing farm [...]]]></description>
			<content:encoded><![CDATA[<div><p>As mentioned in my <a href="http://kichik.net/2008/11/23/voodoo-fabrication/">previous post</a>, I have been working on incorporating some more features into WinVer.nsh. Every little change in this header file requires testing on all possible versions and configurations of Windows. Being the Poor Open Source Developer<sup><small>TM</small></sup> that I am, I do not have sufficient resources to assemble a full-blown testing farm with every possible version of Windows on every possible hardware configuration. Instead, I have to settle for a bunch of virtual machines I have collected over the years. It is pretty decent, but has no standards and doesn&#8217;t cover every possible version. Still, it does its job well and has proven itself very effective.</p>
<p>Obviously, be it a farm or a mere collection of virtual machines, testing on so many different configurations carries with it a hefty fine. Testing a single line change could waste almost an hour. Imagine the time it would take to test, fix, retest, fix and retest again a complete rewrite of WinVer.nsh. As fascinating as that empirical scientific experiment would have been, I was reluctant to find out. Laziness, in this case, proved to be a very practical solution.</p>
<p>WinVer.nsh tests do not really need the entire operation system and its behavior as it relies on nothing but 4 parameters. All it requires is the return values of GetVersionEx for OSVERSIONINFO and OSVERSIONINFOEX. For nothing more than 312 bytes, I have to wait until Windows Vista decides it wants to execute my test, Windows NT4 gracefuly connects to my network, Windows ME wakes up on the right side of the bed and doesn&#8217;t crash, Windows Server 2008 installs again after its license has expired and Windows 95&#8230;. Actually, that one works pretty well. So why wait?</p>
<p>Instead, I&#8217;ve created a little harvester that collects those 312 bytes, ran it on all of my machines and mustered the results into one <a href="http://nsis.svn.sourceforge.net/viewvc/nsis/NSIS/trunk/Source/Tests/winver.nsi?view=markup">huge script</a> that tests every aspect of WinVer.nsh using every possible configuration of Windows in a few seconds. It required adding a hooking option to WinVer.nsh, but with the new !ifmacrondef, that was easy enough.</p>
<p>Currently, the script tests:</p>
<ul>
<li>Windows 95 OSR B</li>
<li>Windows 98</li>
<li>Windows ME</li>
<li>Windows NT4 (SP1, SP6)</li>
<li>Windows 2000 (SP0, SP4)</li>
<li>Windows XP (SP2, SP3)</li>
<li>Windows XP x64 (SP1)</li>
<li>Windows Vista (SP0)</li>
<li>Windows Server 2008 (SP1)</li>
</ul>
<p>If you have access to a configuration not listed here, please run the <a href="http://nsis.svn.sourceforge.net/viewvc/nsis/NSIS/trunk/Source/Tests/winver.nsi?view=markup">harvester</a> and send me the results. More specifically, I could really use Windows 2003 and Windows Vista SP1. My Windows Vista installation simply refuses the upgrade to SP1. Again.</p>
<p>The test script also includes a hexdump of those 312 bytes for every configuration so anyone performing similar tests for another reason doesn&#8217;t have to parse the NSIS syntax. Feel free to use it for your testing.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2008/11/29/pragmatic-variant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Voodoo fabrication</title>
		<link>http://kichik.net/2008/11/23/voodoo-fabrication/</link>
		<comments>http://kichik.net/2008/11/23/voodoo-fabrication/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 22:35:46 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/?p=77</guid>
		<description><![CDATA[Last week I&#8217;ve decided it&#8217;s time to apply a few long overdue patches some people have submitted. The main issue with patches is that the patch submitter and patch applier are never the same person, unless you&#8217;re on lithium in which case the code is bound to be intriguing any way you spin it. But [...]]]></description>
			<content:encoded><![CDATA[<div><p>Last week I&#8217;ve decided it&#8217;s time to apply a few long overdue patches some people have submitted. The main issue with patches is that the patch submitter and patch applier are never the same person, unless you&#8217;re on lithium in which case the code is bound to be intriguing any way you spin it. But the lack of clear coding guidelines or my code review process is a whole other topic.</p>
<p>One of the patches was Anders&#8217; WinVer.nsh patch for Windows Server 2008 support along with some other nifty little features. You would think this would be a pretty simple patch, but Microsoft had a surprise for us in this case. I admire Microsoft for their dedication for backward compatibility and basic API coherence, but in this case of version detection, they got it a bit mixed up. There are three API functions to get the version, two of them work on all versions of Windows and one of them has two operation modes. To get special features information there&#8217;s another completely unrelated inconspicuous function. The format of the returned data depends on the version and on operation mode used. In short, it&#8217;s a bag full of fun and games and there&#8217;s never a dull moment testing every little change on every possible configuration of Windows.</p>
<p>For the original version of WinVer.nsh, I used the simplistic GetVersion API which requires about 3 lines of code. Later on a patch was submitted to support verification of service pack numbers which required the usage of GetVersionEx&#8217;s two modes of operation. This required quite a bit more code, but that code was only used when SP were specifically checked. With the latest patch for Windows Server 2008 support, the simplistic API was no longer enough and a full blown function using every possible API and doing a lot of math and bit shuffling was required. And therein lies the catch.</p>
<p>As we yet to have developed real code optimization mechanisms, code duplication makes the installer bigger and bigger is not better in this case. The code could go into a function which will be called by every usage of WinVer.nsh, but that would mean a warning will be generated in case the function is never called because it can&#8217;t be optimized. A requirement to declare the usage of WinVer.nsh could be added, but that would break the number one rule I&#8217;ve learned from Microsoft &#8211; backward compatibility. All three issues are on the top 10 frequently asked questions list and getting my costumers a reason to ask them even frequently-er is not in my wish list.</p>
<p>As the code size grew bigger WinVer.nsh, I started pondering of a way to solve this. The obvious solution would be adding code optimization and that&#8217;s already functioning neatly in my beloved <a href="http://nsis.svn.sourceforge.net/viewvc/nsis/NSIS/branches/nobjs/">nobjs branch</a> that&#8217;s sadly not yet ready for prime time. And so I had to think of another idea that could work with the current branch and so Artificial Functions were conceived. Instead of letting the compiler create the function, I&#8217;ve used some of the lesser known features to create them on my own. A combination of runtime and compile-time black magia using both old and new features allowed me to get rid of the code duplication.</p>
<p>To make sure the code of the function isn&#8217;t inserted more than once, the good old !ifndef-!define-!endif combo is used. But the function can be called from more than one scope and so it must be globally locatable. Exactly for this purpose, global labels were added over six years ago. However, that&#8217;s not all as the function must somehow return control to the original code that called it. To do this Return is used at the end of the function&#8217;s code and Call is used to treat the global label as a function and build a stack frame for it. Last but not least, we have to do deal with uninstaller functions that can&#8217;t jump to code in the installer as they don&#8217;t share the same code. The new __UNINSTALL__ definition saves the day and helps differentiate installer&#8217;s and uninstaller&#8217;s code.</p>
<pre class="nsis"><span style="color: #000066; font-weight:bold;">!macro</span> CallArtificialFunction <span style="color: #000066;">NAME</span>
  <span style="color: #000066; font-weight:bold;">!ifndef</span> __UNINSTALL__
    <span style="color: #000066; font-weight:bold;">!define</span> CallArtificialFunction_TYPE inst
  <span style="color: #000066; font-weight:bold;">!else</span>
    <span style="color: #000066; font-weight:bold;">!define</span> CallArtificialFunction_TYPE uninst
  <span style="color: #000066; font-weight:bold;">!endif</span>
  <span style="color: #000099;">Call</span> :.<span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span>$<span style="">&#123;</span>CallArtificialFunction_TYPE<span style="">&#125;</span></span>
  <span style="color: #000066; font-weight:bold;">!ifndef</span> <span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span>$<span style="">&#123;</span>CallArtificialFunction_TYPE<span style="">&#125;</span></span>_DEFINED
    <span style="color: #000099;">Goto</span> <span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span>$<span style="">&#123;</span>CallArtificialFunction_TYPE<span style="">&#125;</span></span>_DONE
    <span style="color: #000066; font-weight:bold;">!define</span> <span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span>$<span style="">&#123;</span>CallArtificialFunction_TYPE<span style="">&#125;</span></span>_DEFINED
    .<span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span>$<span style="">&#123;</span>CallArtificialFunction_TYPE<span style="">&#125;</span></span>:
      <span style="color: #000066; font-weight:bold;">!insertmacro</span> <span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span></span>
    <span style="color: #000099;">Return</span>
    <span style="color: #660000;">$<span style="">&#123;</span><span style="color: #000066;">NAME</span><span style="">&#125;</span>$<span style="">&#123;</span>CallArtificialFunction_TYPE<span style="">&#125;</span></span>_DONE:
  <span style="color: #000066; font-weight:bold;">!endif</span>
  <span style="color: #000066; font-weight:bold;">!undef</span> CallArtificialFunction_TYPE
<span style="color: #000066; font-weight:bold;">!macroend</span></pre>
<p>When combined all together, it not only solves the code size issue for WinVer.nsh, but also rids the world of two very frequently asked questions about our standard library. It took a few good hours, but after converting FileFunc.nsh, TextFunc.nsh and WordFunc.nsh to use the new Artificial Functions; there&#8217;s no longer a need to use forward decelerations for those commonly used functions and calling them in uninstaller code is no different than calling them in the installer.</p>
<pre class="nsis"><span style="color: #000066; font-weight:bold;">!include</span> <span style="color: #660066;">&quot;FileFunc.nsh&quot;</span>
<span style="color: #000066; font-weight:bold;">!insertmacro</span> GetFileExt
<span style="color: #000066; font-weight:bold;">!insertmacro</span> un.GetParent
<span style="color: #000066;">Section</span> Install
     <span style="color: #660000;">$<span style="">&#123;</span>GetFileExt<span style="">&#125;</span></span> <span style="color: #660066;">&quot;C:\My Downloads\Index.html&quot;</span> <span style="color: #660000;">$R0</span>
<span style="color: #000066;">SectionEnd</span>
<span style="color: #000066;">Section</span> un.Install
     <span style="color: #660000;">$<span style="">&#123;</span>un.GetParent<span style="">&#125;</span></span> <span style="color: #660066;">&quot;C:\My Downloads\Index.html&quot;</span> <span style="color: #660000;">$R0</span>
<span style="color: #000066;">SectionEnd</span></pre>
<p>Goes on a diet and elegantly transforms into:</p>
<pre class="nsis"><span style="color: #000066; font-weight:bold;">!include</span> <span style="color: #660066;">&quot;FileFunc.nsh&quot;</span>
<span style="color: #000066;">Section</span> Install
     <span style="color: #660000;">$<span style="">&#123;</span>GetFileExt<span style="">&#125;</span></span> <span style="color: #660066;">&quot;C:\My Downloads\Index.html&quot;</span> <span style="color: #660000;">$R0</span>
<span style="color: #000066;">SectionEnd</span>
<span style="color: #000066;">Section</span> un.Install
     <span style="color: #660000;">$<span style="">&#123;</span>GetParent<span style="">&#125;</span></span> <span style="color: #660066;">&quot;C:\My Downloads\Index.html&quot;</span> <span style="color: #660000;">$R0</span>
<span style="color: #000066;">SectionEnd</span></pre>
<p>I love it. This trick is so sinister. It reminds me of the days Don Selkirk and Dave Laundon worked on LogicLib. Coming to an installer near you this Christmas.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2008/11/23/voodoo-fabrication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dominical update</title>
		<link>http://kichik.net/2008/03/30/dominical-update/</link>
		<comments>http://kichik.net/2008/03/30/dominical-update/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 22:51:22 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2008/03/30/dominical-update/</guid>
		<description><![CDATA[9 out of 10 open-source experts advocate frequent releases. We, the simple people, don&#8217;t know better and should listen to the experts. Sadly, we simpletons still don&#8217;t know how to read and so the fine print eludes us. While we all may be good and obedient developers, the users don&#8217;t care for our frequent releases [...]]]></description>
			<content:encoded><![CDATA[<div><p>9 out of 10 open-source experts advocate frequent releases. We, the simple people, don&#8217;t know better and should listen to the experts. Sadly, we simpletons still don&#8217;t know how to read and so the fine print eludes us. While we all may be good and obedient developers, the users don&#8217;t care for our frequent releases squashing our colossus bugs and featuring our shiny new toys. As frequent our releases are as frequent the reports of bugs long ago fixed and features that shined and sparkled at ancient times but are now filled with rust.</p>
<p>Ghost versions of the past haunt us daily while users refuse to upgrade. Our innovative forefathers, suffering immensely from this plague, had uncovered the great potential of automatic updates. No longer is the user able to flee his ordained destiny. Fate shall pop-up and fulfill itself even with the absence of user interaction.</p>
<p>But even this sparsely applied method carries its own set of fine prints. Boiler plate implementation includes a web server containing the latest version number or even a server-side script that ever so nicely checks for the user whether his version is expectedly old. As with everything else, here too success brings failure. As faithful users gather their masses around our monthly-polished releases, the web server begins to break down. Most web servers, especially those that poor open-source developers can afford, do not offer load balancing and will easily succumb to the sheer amount of bandwidth generated by thousands of users performing even the simplest of GET requests.</p>
<p>Enter DNS. The Domain Name System is a distributed and globally cached system that basically maps domain names such as <em>nsis.latest-version.org</em> into numbers such as  <em>2.36.0.0</em>. And it gets even better &#8212; foreign sources report there are free DNS servers out there, waiting to be used. Services such as <a href="http://dyndns.org/">dyndns.org</a> offer a simple HTTP based API that sets new IP to a free domain name. Creating a new version notification service is as simple as creating a new free domain, updating it every time a new version is released, calling <em>inet_addr</em> when the client-side loads and comparing the result to the current version.</p>
<p>This free and simple solution provides many advantages over conventional HTTP based version check.</p>
<ul>
<li>Automatic load balancing with servers all over the world.</li>
<li>Simple code with no need for complex HTTP libraries.</li>
<li>No need for relatively heavy HTTP operations for both client and server.</li>
<li>HTTP proxies do not get in the way.</li>
<li>Firewalls and the entire security fiasco usually overlook DNS.</li>
</ul>
<p>And as always, there are disadvantages.</p>
<ul>
<li>Updates take time to propagate.</li>
<li>Only 3 bytes of information.</li>
</ul>
<p>Make sure you set the first byte to <em>127 </em>to make sure the IP associated with your update domain is invalid. This way, whoever is at <em>2.36.0.0</em> won&#8217;t get any unwelcome traffic.</p>
<p>I am probably not the first to think of this, but it is a cool idea nonetheless. I&#8217;m so going to implement this for the next version of NSIS! <img src='http://kichik.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2008/03/30/dominical-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mediacentric</title>
		<link>http://kichik.net/2008/02/08/mediacentric/</link>
		<comments>http://kichik.net/2008/02/08/mediacentric/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 18:03:09 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2008/02/08/mediacentric/</guid>
		<description><![CDATA[Over a year has passed since the NSIS Media menace. Mostly good things have happened since. I figured this could be a good time to recap and summarize. Download.com no longer contains NSIS Media infected downloads. I&#8217;ve received no response for my queries, so I assume I had nothing to do with it. NSIS Media [...]]]></description>
			<content:encoded><![CDATA[<div><p>Over a year has passed since the NSIS Media menace. Mostly good things have happened since. I figured this could be a good time to recap and summarize.</p>
<ul>
<li>Download.com no longer contains NSIS Media infected downloads. I&#8217;ve received no response for my queries, so I assume I had nothing to do with it.</li>
<li>NSIS Media malware update servers are no longer operational.</li>
<li>I have received only one e-mail complaining about NSIS Media over the last year, compared to the dozens before I&#8217;ve released the remover.</li>
<li>My remover was downloaded approximately 10,000 times from my website and probably a bit more from other websites as well.</li>
<li>My lawsuit has failed miserably. I was trying to get back at Opensoft/Openwares and all of their Vanuatu-based friends with the help of the <a href="http://www.softwarefreedom.org/">Software Freedom Law Foundation</a>. We tried to track down someone we could sue, but failed. After a few unanswered queries and answers pointing at multiple directions from various related companies, the search was sadly brought to a halt.</li>
<li>I was contacted by <a href="http://www.f-secure.com/">F-Secure</a> for details of NSIS Media. I seem to recall there were more companies that asked for my help, but I can&#8217;t find the e-mails proving it.</li>
<li>Most anti-virus or malware removal applications I&#8217;ve tested find only the most common infections of NSIS Media and skip the rarer DLL files.</li>
<li>Opensoft is still up to <a href="http://xvidcodec.net/">no</a> <a href="http://www.download.com/XviD-Video-Codec/3000-2140_4-10651549.html?tag=lst-1">good</a>.</li>
<li><a href="http://www.openwares.org/">Openwares</a> is still alive and kicking, spreading malware and using NSIS but no sane user will surf to that website.</li>
<li>I have received no <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=kichik%40users%2esourceforge%2enet&amp;no_shipping=2&amp;no_note=1&amp;tax=0&amp;currency_code=USD&amp;lc=IL&amp;bn=PP%2dDonationsBF&amp;charset=UTF%2d8">donations</a> for my research or for creating the remover.</li>
<li>I still don&#8217;t make 1000$ a day <img src='http://kichik.net/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </li>
</ul>
<p>So there you have it &#8212; the story of a deceased malware. I&#8217;d like to think I took at least a small part of its demise.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2008/02/08/mediacentric/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Bigotry</title>
		<link>http://kichik.net/2008/02/08/bigotry/</link>
		<comments>http://kichik.net/2008/02/08/bigotry/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 17:10:28 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://kichik.net/2008/02/08/bigotry/</guid>
		<description><![CDATA[Ladies and gentlemen, we interrupt the silence schedule to bring you shocking news. Hatred has reared its ugly head on the forsaken grounds of our dear old friend &#8212; Windows 98. It appears the bigots have set a new target for their cynical and non-politically-correct persecution. Big-boned dialogs and initialization-limited rectangulars are shamelessly discriminated against [...]]]></description>
			<content:encoded><![CDATA[<div><p>Ladies and gentlemen, we interrupt the silence schedule to bring you shocking news. Hatred has reared its ugly head on the forsaken grounds of our dear old friend &#8212; Windows 98. It appears the bigots have set a new target for their cynical and non-politically-correct persecution. Big-boned dialogs and initialization-limited rectangulars are shamelessly discriminated against and abused for no acceptable reason. Exceptions, overflow errors, division errors and antique dialogs were thrown at the victims, reports say. We were unable to get comments from the alleged bigots.</p>
<p>We were unable to get pictures from the event, but luckily, it can be easily <a href="http://sourceforge.net/support/tracker.php?aid=1889720">reproduced</a>.</p>
<pre class="php">BOOL CALLBACK proc<span style="color: #66cc66;">&#40;</span>HWND h, UINT m, WPARAM w, LPARAM l<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">FALSE</span>;
<span style="color: #66cc66;">&#125;</span>
int main<span style="color: #66cc66;">&#40;</span>int argc, char* argv<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
  char dt<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">24</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">0</span>,<span style="color: #66cc66;">&#125;</span>;
  RECT r = <span style="color: #66cc66;">&#123;</span><span style="color: #cc66cc;">32757</span>,<span style="color: #66cc66;">&#125;</span>;
  HWND dlg = CreateDialogIndirect<span style="color: #66cc66;">&#40;</span>
    GetModuleHandle<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #66cc66;">&#41;</span>,
    <span style="color: #66cc66;">&#40;</span>LPDLGTEMPLATE<span style="color: #66cc66;">&#41;</span> dt,
    <span style="color: #cc66cc;">0</span>,
    proc<span style="color: #66cc66;">&#41;</span>;
  MapDialogRect<span style="color: #66cc66;">&#40;</span>dlg, &amp;r<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// BOOM!</span>
  <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2008/02/08/bigotry/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Atomic codes</title>
		<link>http://kichik.net/2007/06/16/atomic-codes/</link>
		<comments>http://kichik.net/2007/06/16/atomic-codes/#comments</comments>
		<pubDate>Sat, 16 Jun 2007 19:02:38 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2007/06/16/atomic-codes/</guid>
		<description><![CDATA[I had some fun today trying to figure out why Banner likes to hang around with .NET so much so it wouldn&#8217;t even leave. I found out that while being destroyed, something tries to send messages to the main dialog. But the main dialog is busy with destroying the banner. I added exactly two iterations [...]]]></description>
			<content:encoded><![CDATA[<div><p>I had some fun today trying to figure out why <a href="http://forums.winamp.com/showthread.php?s=&amp;threadid=270838">Banner likes to hang around with .NET</a> so much so it wouldn&#8217;t even leave. I found out that while being destroyed, something tries to send messages to the main dialog. But the main dialog is busy with destroying the banner. I added exactly two iterations of the famous win32 message loop and everything started working. I still don&#8217;t know why those messages are sent or why it&#8217;s so important they&#8217;ll be answered before the banner is destroyed or even why it happens just with the .NET installer. And don&#8217;t even ask about different synchronization methods that make it tick. So far, I&#8217;ve found only smoke signals and the fire extinguisher won&#8217;t last much longer.</p>
<p>Of all the signals, I liked the message loop the most. It actually points to something I&#8217;ve done wrong. I&#8217;ve starved the main dialog&#8217;s thread while creating a modeless dialog as its child. That&#8217;s why I dug in further into those two iterations of the loop and those two messages that it processes. It turns out both of them had the same identifier &#8211; 0xc0c3. Now that&#8217;s no regular WM_ message&#8230; That&#8217;s a message registered with RegisterWindowMessage. But which message is it? That&#8217;s where the fun starts. There&#8217;s no GetRegisteredWindowMessage API available and nothing on the topic comes out on Google.</p>
<p>So with no leads to follow I started digging. Normally, to give a certain string a specific value in Windows, an atom is created. And indeed, 0xc0c3 is in the range of named atoms. To make things even simpler, in WINE, RegisterWindowMessage simply calls GlobalAddAtom, casts ATOM to UINT and returns. Great, then GetAtomName or GlobalGetAtomName should do the trick. Only reality isn&#8217;t as bright as WINE would like us to think. It turns out RegisterWindowMessage uses a different atom table for its messages. But which atom table and how can you even specify a table with GetAtomName?</p>
<p>To specify a table, a low-level access to RtlLookupAtomInAtomTable is required. But that function is deep inside ntoskrnl.exe. So, up one level and you get NtUserGetAtomName which uses the same atom table as NtUserAddAtom which is the function RegisterWindowMessage calls. But that&#8217;s inside win32k.sys&#8230; Luckily, user32.dll already handles that. It has a stub that calls NtUserGetAtomName at 0x7E41FA8E. Some playing around with the second parameter which turns out to be UNICODE_STRING and the atomic table is in hands&#8217; reach.</p>
<p>Engines off, coding fingers down, digging complete and the message name is <strong>MSUIM.Msg.Private</strong>. That too gets little to none results on Google, but who cares&#8230; Debugging is fun <img src='http://kichik.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For any of you who&#8217;d ever want to convert a registered message into a readable name, here&#8217;s the NSIS code. Replace 0xc0c3 with the message identifier and 0x7E41FA8E with user32!NtUserGetAtomName and you&#8217;re good to go.</p>
<pre class="nsis"><span style="color: #666666; font-style: italic;"># the atom</span>
<span style="color: #000099;">StrCpy</span> <span style="color: #660000;">$<span style="">2</span></span> 0xc0c3
<span style="color: #666666; font-style: italic;">;System::Call user32::RegisterWindowMessage(t'test_message')i.r2</span>
<span style="color: #666666; font-style: italic;"># create UNICODE_STRING</span>
<span style="color: #000099;">System</span>::<span style="color: #003399;">Alloc </span><span style="">1008</span>
<span style="color: #000099;">Pop</span> <span style="color: #660000;">$R0</span>
<span style="color: #000099;">StrCpy</span> <span style="color: #660000;">$R1</span> <span style="">0</span>
<span style="color: #000099;">StrCpy</span> <span style="color: #660000;">$R2</span> <span style="">1000</span>
<span style="color: #000099;">IntOp</span> <span style="color: #660000;">$R3</span> <span style="color: #660000;">$R0</span> + <span style="">8</span>
<span style="color: #000099;">System</span>::<span style="color: #003399;">Call </span>*<span style="color: #660000;">$R0</span><span style="">&#40;</span>&amp;i2R1,&amp;i2R2,iR3<span style="">&#41;</span>
<span style="color: #666666; font-style: italic;"># call NtUserGetAtomName</span>
<span style="color: #000099;">System</span>::<span style="color: #003399;">Call </span>::0x7E41FA8E<span style="">&#40;</span>ir2,iR0<span style="">&#41;</span>i.r1?e
<span style="color: #666666; font-style: italic;"># parse UNICODE_STRING</span>
<span style="color: #000099;">System</span>::<span style="color: #003399;">Call </span>*<span style="color: #660000;">$R0</span><span style="">&#40;</span>&amp;i2.r4,&amp;i2.r3,w.r0<span style="">&#41;</span>
<span style="color: #666666; font-style: italic;"># print details</span>
<span style="color: #000099;">DetailPrint</span> <span style="color: #660066;">&quot;user atom's name is $0&quot;</span>
<span style="color: #000099;">DetailPrint</span> <span style="color: #660066;">&quot;length is $4 (???)&quot;</span>
<span style="color: #000099;">DetailPrint</span> <span style="color: #660066;">&quot;NtUserGetAtomName returned $1&quot;</span>
<span style="color: #000099;">Pop</span> <span style="color: #660000;">$<span style="">1</span></span>
<span style="color: #000099;">DetailPrint</span> <span style="color: #660066;">&quot;GetLastError() = $1&quot;</span>
<span style="color: #666666; font-style: italic;"># done</span>
<span style="color: #000099;">System</span>::<span style="color: #003399;">Free </span><span style="color: #660000;">$R0</span></pre>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2007/06/16/atomic-codes/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Missed evil files</title>
		<link>http://kichik.net/2007/01/13/missed-evil-files/</link>
		<comments>http://kichik.net/2007/01/13/missed-evil-files/#comments</comments>
		<pubDate>Sat, 13 Jan 2007 20:51:49 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2007/01/13/missed-evil-files/</guid>
		<description><![CDATA[I tried looking for a newer version of NSIS Media by visiting their latest update server. I came out empty handed, which was bad news for my research but great news for the rest of the world. Just to make sure I got it right, I visited the old update server once again. I was [...]]]></description>
			<content:encoded><![CDATA[<div><p>I tried looking for a newer version of NSIS Media by visiting their latest <a href="http://serv.messdot.com/media/5124/">update server</a>. I came out empty handed, which was bad news for my research but great news for the rest of the world. Just to make sure I got it right, I visited the <a href="http://servedby.mediaplace.tv/media/5684/">old update server</a> once again. I was in for a surprise when it served me b10.bin for downloading. As you may recall from one of the earlier posts, I originally downloaded only [ab][1-9]. Seeing as it suddenly served b10.bin, I upgraded my download script and found some more evil files.</p>
<blockquote style="font-family: monospace"><p>atixim.dll<br />
avirpa.dll<br />
javadsa.dll<br />
kbdicp.dll<br />
msabdx.dll<br />
msrrwvb.dll<br />
schuu52e.dll<br />
xmlfef32.dll</p></blockquote>
<p>I&#8217;ve updated my <a href="http://kichik.net/2006/12/15/nsis-media-remover/">NSIS Media Remover</a> to detect and remove those as well. I&#8217;ve also updated the <a href="http://kichik.net/nsis/nsis_media.7z">samples archive</a>, though it still doesn&#8217;t contain any of the old version DLL files.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2007/01/13/missed-evil-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NSIS Media Remover</title>
		<link>http://kichik.net/2006/12/15/nsis-media-remover/</link>
		<comments>http://kichik.net/2006/12/15/nsis-media-remover/#comments</comments>
		<pubDate>Fri, 15 Dec 2006 17:01:49 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2006/12/15/nsis-media-remover/</guid>
		<description><![CDATA[I&#8217;ve assembled everything I&#8217;ve learned the past few weeks about NSIS Media into one simple and effortless application that should completely remove it. NSIS Media Remover removes installed files and registry keys. 93 101 known DLL files installed into the system folder C:\Program Files\Common Files\NSIS folder Firefox nsis.jar extension Many registry keys CLSIDs Shell extensions [...]]]></description>
			<content:encoded><![CDATA[<div><p>I&#8217;ve assembled everything I&#8217;ve learned the past few weeks about NSIS Media into one simple and effortless application that should completely remove it. <strong><a href="http://kichik.net/nsis/NSIS%20Media%20Remover.exe">NSIS Media Remover</a></strong> removes installed files and registry keys.</p>
<ul>
<li><strike>93</strike> 101 known DLL files installed into the system folder</li>
<li>C:\Program Files\Common Files\NSIS folder</li>
<li>Firefox nsis.jar extension</li>
<li>Many registry keys
<ul>
<li>CLSIDs</li>
<li>Shell extensions</li>
<li>txtfile context menu handler</li>
<li>Overlay icon handlers</li>
<li>Software\NSIS\Media</li>
<li>Software\IAN</li>
<li>Add/Remove entry</li>
</ul>
</li>
</ul>
<p><strong>NSIS Media Remover</strong> is provided without any warranty. Its source code is available in the tool itself. Hit the View Source Code button to get it.</p>
<p align="center" style="font-size: 130%"><strong><a href="http://kichik.net/nsis/NSIS%20Media%20Remover.exe">Download NSIS Media Remover</a></strong></p>
<p style="font-family: monospace; font-size: 80%"><strong>md5:    </strong>7778c19e9df725d20a30fe42f425589d<br />
<strong> sha1: </strong>9eb42afbf75fd97555cc5260b3d24f33a6dec622</p>
<p>While creating this tool, I&#8217;ve found more exciting new facts about this pest. One of which is that apparently, CNET were fooled into serving the downloads on <a href="http://download.com/">download.com</a>. The installers check to see if the computer belongs to download sites, anti-virus companies and even Cydoor prior to installing the pest.</p>
<p><strong>Update:</strong> version 1.1 was released on January 13th, 2007 with 8 more files missed in the original research.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2006/12/15/nsis-media-remover/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
		<item>
		<title>Even more evil files</title>
		<link>http://kichik.net/2006/12/15/even-more-evil-files/</link>
		<comments>http://kichik.net/2006/12/15/even-more-evil-files/#comments</comments>
		<pubDate>Fri, 15 Dec 2006 12:53:00 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2006/12/15/even-more-evil-files/</guid>
		<description><![CDATA[While searching for the complete list of registry keys used by NSIS Media, I found yet another update server for an even older version. Only this server seems a bit different, it&#8217;s for removal of NSIS Media. Its output contains a URL for an installer that removes a lot of files and registry keys I [...]]]></description>
			<content:encoded><![CDATA[<div><p>While searching for the complete list of registry keys used by NSIS Media, I found yet another <a href="http://safe.w2kserver2.com/">update server</a> for an even older version. Only this server seems a bit different, it&#8217;s for removal of NSIS Media. Its output contains a URL for an <a href="http://safe.w2kserver2.com/remove.exe">installer</a> that removes a lot of files and registry keys I haven&#8217;t ever seen.</p>
<blockquote style="font-family: monospace"><p>auole4.dll<br />
aviprope.dll<br />
brwe042.dll<br />
cabext32.dll<br />
cagt041.dll<br />
cryptdbe.dll<br />
direjmod.dll<br />
dobj01e.dll<br />
dspmode.dll<br />
dsq052e.dll<br />
edk052.dll<br />
iccext.dll<br />
icmmext.dll<br />
mail052e.dll<br />
msgetm.dll<br />
msgsple.dll<br />
msmsgre.dll<br />
mssfdr.dll<br />
ntext052.dll<br />
ntfssetx.dll<br />
prtmde3.dll<br />
shllimgd.dll<br />
slpube03.dll<br />
splsrv4.dll<br />
syncmte.dll<br />
tragte.dll<br />
vidcpl2.dll<br />
vlcx052.dll<br />
wint042e.dll</p></blockquote>
<p>Expect a complete NSIS Media remover very soon&#8230;</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2006/12/15/even-more-evil-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More evil files</title>
		<link>http://kichik.net/2006/12/09/more-evil-files/</link>
		<comments>http://kichik.net/2006/12/09/more-evil-files/#comments</comments>
		<pubDate>Sat, 09 Dec 2006 17:40:57 +0000</pubDate>
		<dc:creator>kichik</dc:creator>
				<category><![CDATA[NSIS]]></category>

		<guid isPermaLink="false">http://kichik.net/2006/12/09/more-evil-files/</guid>
		<description><![CDATA[I just found another list of DLL files used by NSIS Media. The script used in their updated installers first removes the old DLL files. It renames them to temporary names and deletes all of their registry keys. Along with the previous list, I believe this makes a complete list of all DLL files used [...]]]></description>
			<content:encoded><![CDATA[<div><p>I just found another list of DLL files used by NSIS Media. The script used in their updated installers first removes the old DLL files. It renames them to temporary names and deletes all of their registry keys. Along with the <a href="http://kichik.net/2006/12/02/mr-angry-pants/">previous list</a>, I believe this makes a complete list of all DLL files used by NSIS Media.</p>
<blockquote style="font-family: monospace"><p>bsdeff32.dll<br />
java52e.dll<br />
krnsvr32.dll<br />
mkdesk32.dll<br />
mkdesk32.dll<br />
mscron32.dll<br />
msidext.dll<br />
msrvdrv.dll<br />
msscsi.dll<br />
mssvide.dll<br />
msxmlu.dll<br />
mtxcdru.dll<br />
netstrap42.dll<br />
nvrssid.dll<br />
odbcpc32.dll<br />
oleac32.dll<br />
olescope.dll<br />
uuiedes.dll<br />
windexserv.dll<br />
winsdev.dll<br />
winsdrv.dll<br />
wmbmd.dll<br />
wmddsb.dll<br />
wmdmb32.dll<br />
wmidext.dll<br />
wmproxt.dll<br />
wmsql32.dll<br />
wmudrv.dll</p></blockquote>
<blockquote style="font-family: monospace"><p>~fdgar.tmp<br />
~fdgdr.tmp<br />
~fdger.tmp<br />
~fdgfr.tmp<br />
~fdgir.tmp<br />
~fdgor.tmp<br />
~fdgpr.tmp<br />
~fdgqr.tmp<br />
~fdgrr.tmp<br />
~fdgsr.tmp<br />
~fdgtr.tmp<br />
~fdgur.tmp<br />
~fdgwr.tmp<br />
~fdgyr.tmp<br />
~isdat.tmp<br />
~isddt.tmp<br />
~isdet.tmp<br />
~isdft.tmp<br />
~isdit.tmp<br />
~isdot.tmp<br />
~isdpt.tmp<br />
~isdqt.tmp<br />
~isdrt.tmp<br />
~isdst.tmp<br />
~isdtt.tmp<br />
~isdut.tmp<br />
~isdwt.tmp<br />
~isdyt.tmp</p></blockquote>
</div>]]></content:encoded>
			<wfw:commentRss>http://kichik.net/2006/12/09/more-evil-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
