<?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>PELock Blog &#187; VMware</title>
	<atom:link href="http://www.pelock.com/blog/tag/vmware/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pelock.com/blog</link>
	<description>Assembler, software protection, code obfuscation and other crazy stuff.</description>
	<lastBuildDate>Fri, 04 Apr 2008 11:05:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VMware detection (anti-debugging trick against TRW)</title>
		<link>http://www.pelock.com/blog/2007/04/15/vmware-detection-anti-debugging-trick-against-trw/</link>
		<comments>http://www.pelock.com/blog/2007/04/15/vmware-detection-anti-debugging-trick-against-trw/#comments</comments>
		<pubDate>Sun, 15 Apr 2007 19:44:26 +0000</pubDate>
		<dc:creator>Bartosz</dc:creator>
				<category><![CDATA[Assembler]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://www.pelock.com/blog/2007/04/15/vmware-detection-anti-debugging-trick-against-trw/</guid>
		<description><![CDATA[Some of the anti-debugging tricks can be used to detect VMware, one of them is an old anti TRW (TRW was a popular debugger in 9x days) trick...]]></description>
			<content:encoded><![CDATA[<p>Some of the anti-debugging tricks can be used to detect VMware, one of them is an old anti <a href="http://www.softpedia.com/get/Programming/Debuggers-Decompilers-Dissasemblers/TRW.shtml">TRW</a> (TRW was a popular debugger in 9x days) trick.</p>
<p>This anti-debugging trick works fine on a real Windows 9x installations (95, 98, ME) but it raises an exception under VMware (while reading IDT entry).</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">BOOL IsVMware9xTrw<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// detect NT/XP/Vista</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span>GetVersion<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">&amp;</span> <span style="color: #208080;">0x80000000</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">return</span> FALSE<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #666666;">// detect VMWare (anti debugging trick against TRW)</span>
    <span style="color: #666666;">// VMware isn't detected with vm acceleration disabled</span>
    __try
    <span style="color: #008000;">&#123;</span>
        __asm
        <span style="color: #008000;">&#123;</span>
            sub    esp, <span style="color: #0000dd;">6</span>
            sidt   fword ptr <span style="color: #008000;">&#91;</span>esp<span style="color: #008000;">&#93;</span>
            pop    ax
            pop    eax
            mov    al, byte ptr <span style="color: #008000;">&#91;</span>eax <span style="color: #000040;">+</span> 00Eh<span style="color: #008000;">&#93;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    __except<span style="color: #008000;">&#40;</span>EXCEPTION_EXECUTE_HANDLER<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">return</span> TRUE<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">return</span> FALSE<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Binaries and source code:<br />
<a href="http://www.pelock.com/download.php?f=vmware_trw.zip">http://www.pelock.com/download.php?f=vmware_trw.zip</a> (18 kB)</p>
<p>Please test this code on your own systems and tell me about the results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelock.com/blog/2007/04/15/vmware-detection-anti-debugging-trick-against-trw/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
