<?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>Matthieu Suiche&#039;s blog &#187; On the fly</title>
	<atom:link href="http://www.msuiche.net/category/on-the-fly/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.msuiche.net</link>
	<description>Happiness only real when shared.</description>
	<lastBuildDate>Thu, 26 Aug 2010 09:14:04 +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>Hey people ! Happy new year from a lazy man 2.0 :-)</title>
		<link>http://www.msuiche.net/2009/01/02/hey-people-happy-new-year-from-a-lazy-man-20/</link>
		<comments>http://www.msuiche.net/2009/01/02/hey-people-happy-new-year-from-a-lazy-man-20/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 17:18:59 +0000</pubDate>
		<dc:creator>Matthieu Suiche</dc:creator>
				<category><![CDATA[On the fly]]></category>

		<guid isPermaLink="false">http://www.msuiche.net/?p=91</guid>
		<description><![CDATA[I was looking for the shortest way to wish to people I know happy new year for 2009. Here is a flowchart to explain what&#8217;s going on just after I press the &#8220;Publish&#8221; wordpress button. As you can see I use WordPress, Twitter, and Facebook technology &#8212; that&#8217;s pretty useless but that&#8217;s funny :-) Update<a href="http://www.msuiche.net/2009/01/02/hey-people-happy-new-year-from-a-lazy-man-20/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<p>I was looking for the shortest way to wish to people I know happy new year for 2009.</p>
<p>Here is a flowchart to explain what&#8217;s going on just after I press the &#8220;Publish&#8221; wordpress button.</p>
<p><a href="http://www.msuiche.net/wp-content/uploads/2009/01/bon.png"><img src="http://www.msuiche.net/wp-content/uploads/2009/01/bon.png" alt="" title="bon" class="aligncenter size-medium wp-image-100" width="523" height="393"/></a></p>
<p>As you can see I use WordPress, Twitter, and Facebook technology &#8212; that&#8217;s pretty useless but that&#8217;s funny :-)</p>
<p>Update will be show as &#8220;Blog [new]: #title# ( http://tinyurl.com/xxxxxx )&#8221;. It means I&#8217;ve free 98 (140 &#8211; 42) characters to wish you happy new year!</p>
<p><strong>* Tools/Plugins:</strong><br />
<a href="http://blog.victoriac.net/blog/twitter-updater">Twitter updater plugin for WordPress</a><br />
<a href="http://apps.facebook.com/twitter/">Facebook application to update facebook status from Twitter</a></p>
<p><strong>PS.</strong>I&#8217;m not dead and I&#8217;ll soonly publish an update(1.2.1) for win32dd to fix a bug with multi-core computers and Microsoft crashdump file generation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.msuiche.net/2009/01/02/hey-people-happy-new-year-from-a-lazy-man-20/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Interrupt Debug Service (0x2D), Boot loader, Vista 64bits (On the fly)</title>
		<link>http://www.msuiche.net/2007/03/10/interrupt-debug-service-0x2d-boot-loader-vista-64bits-on-the-fly/</link>
		<comments>http://www.msuiche.net/2007/03/10/interrupt-debug-service-0x2d-boot-loader-vista-64bits-on-the-fly/#comments</comments>
		<pubDate>Sat, 10 Mar 2007 17:32:24 +0000</pubDate>
		<dc:creator>Matthieu Suiche</dc:creator>
				<category><![CDATA[On the fly]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.msuiche.net/2007/03/10/interrupt-debug-service-0x2d-boot-loader-vista-64bits-on-the-fly/</guid>
		<description><![CDATA[DebugPrint proc near mov r9d, r8d mov r8d, edx mov dx, [rcx] mov rcx, [rcx+8] mov eax, 1 int 2Dh ; Internal routine for MSDOS (IRET) int 3 ; Trap to Debugger retn DebugPrint endp DebugPrompt proc near mov r9w, [rdx+2] mov r8, [rdx+8] mov dx, [rcx] mov rcx, [rcx+8] mov eax, 2 int 2Dh<a href="http://www.msuiche.net/2007/03/10/interrupt-debug-service-0x2d-boot-loader-vista-64bits-on-the-fly/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>
 DebugPrint      proc near
                 mov     r9d, r8d
                 mov     r8d, edx
                 mov     dx, [rcx]
                 mov     rcx, [rcx+8]
                 mov     eax, 1
                 int     2Dh             ; Internal routine for MSDOS (IRET)
                 int     3               ; Trap to Debugger
                 retn
 DebugPrint      endp

 DebugPrompt     proc near
                 mov     r9w, [rdx+2]
                 mov     r8, [rdx+8]
                 mov     dx, [rcx]
                 mov     rcx, [rcx+8]
                 mov     eax, 2
                 int     2Dh             ; Internal routine for MSDOS (IRET)
                 int     3               ; Trap to Debugger
                 retn
 DebugPrompt     endp

 DebugService2   proc near
                 mov     eax, r8d
                 int     2Dh             ; Internal routine for MSDOS (IRET)
                 int     3               ; Trap to Debugger
                 retn
 DebugService2   endp

 BlBdStart+11C:
                 lea     rdx, [rsp+78h+var_28]
                 lea     rcx, [rsp+78h+var_58]
                 mov     r8d, 3
                 call    DebugService2

BlBdStop        proc near
                 lea     rdx, [rax-28h]
                 mov     r8d, 4
                 xor     ecx, ecx
		[...]
                 call    DebugService2

typedef enum _STATUS_DEBUG_SERVICE {
STATUS_PRINT = 1,
STATUS_PROMPT = 2,
STATUS_START = 3,
STATUS_STOP = 4
} STATUS_DEBUG_SERVICE;
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.msuiche.net/2007/03/10/interrupt-debug-service-0x2d-boot-loader-vista-64bits-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interrupts, Boot Loader, Vista 64bits (On the fly)</title>
		<link>http://www.msuiche.net/2007/03/10/interrupts-boot-loader-vista-64bits-on-the-fly/</link>
		<comments>http://www.msuiche.net/2007/03/10/interrupts-boot-loader-vista-64bits-on-the-fly/#comments</comments>
		<pubDate>Sat, 10 Mar 2007 16:21:49 +0000</pubDate>
		<dc:creator>Matthieu Suiche</dc:creator>
				<category><![CDATA[On the fly]]></category>
		<category><![CDATA[Reverse Engineering]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.msuiche.net/2007/03/10/interrupts-boot-loader-vista-64bits-on-the-fly/</guid>
		<description><![CDATA[I&#8217;ve to do something to save me from idling while a software is rescuing my HDD. That&#8217;s why I&#8217;m gonna write short post about the boot loader and the interrupts initialization. By the way, I add a new category called &#8220;On the fly&#8221; for post like that which are more or less RCE Memento (interessting<a href="http://www.msuiche.net/2007/03/10/interrupts-boot-loader-vista-64bits-on-the-fly/">&#160;&#160;[ Read More ]</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve to do something to save me from idling while a software is rescuing my HDD.</p>
<p>That&#8217;s why I&#8217;m gonna write short post about the boot loader and the interrupts initialization.<br />
By the way, I add a new category called &#8220;On the fly&#8221; for post like that which are more or less RCE Memento (interessting or not ::)).<br />
If I had to explain it I&#8217;d answer &#8220;no blabla just code. don&#8217;t read but analyse.&#8221;</p>
<p>This article covers where the interrupts 0&#215;1, 0&#215;3, 0&#215;6, 0xD, 0xE, 0x2C, 0x2D are initialized inside the bootloader.</p>
<p>For reminding, I&#8217;ve rewritten some things :</p>
<p><code></p>
<pre>
//
// 63                             32            16               0
// +------------------------------+------------------------------+
// +           OffsetLow          +   HighLow    +   HighHigh    +
// +------------------------------+------------------------------+
//

typedef struct _KIDT_ENTRY {     // (sizeof=0x10)
	unsigned short wOffsetHighHigh;  // +0x00
	unsigned short Reserved02;       // +0x02
	unsigned short Reserved04;       // +0x04
	unsigned short wOffsetHighLow;   // +0x06
	unsigned long dwOffsetLow;       // +0x08
	unsigned long Reserved0C;        // +0x0C
} KIDT_ENTRY;

typedef enum _INTERRUPT_ID{
    NONE=-1,
   DIVIDE_ERROR=0,			// 0x00
   SINGLE_STEP,				// 0x01
   NMI_INTERRUPT,				// 0x02
   BREAKPOINT,				// 0x03
   OVERFLOW,				// 0x04
   BOUND,					// 0x05
   INVALID_OPCODE,			// 0x6
   NPX_NOT_AVAILABLE,			// 0x07
   DOUBLE_FAULT,				// 0x08
   NPX_SEGMENT_OVERRUN,			// 0x09
   INVALID_TSS,				// 0x0A
   SEGMENT_NOT_PRESENT,			// 0x0B
   STACK,					// 0x0C
   GENERAL_PROTECTION,			// 0x0D
   PAGE,					// 0x0E
   RESERVED,				// 0x0F
   FLOATING_ERROR,			// 0x10
   ALIGNMENT,				// 0x11
   MACHINE_CHECK,				// 0x12
   XMM_EXCEPTION,				// 0x13
   //
   // Other Critical Interrupts
   //
   APC=0x1F,				// 0x1F
   RAISE_ASSERTION=0x2C,		// 0x2C
   DEBUG_SERVICE=0x2D,			// 0x2D
   DPC=0x2F,				// 0x2F
   IPI=0xE1					// 0xE1
} INTERRUPT_ID;
</pre>
<p></code></p>
<p>Firstly, we have to know these to function inside the &#8220;.text&#8221; section.</p>
<p><strong><br />
Function : ArchGetIdtRegister<br />
XREF: BdInstallTrapVectors, BlpArchInitialize</strong><br />
<code></p>
<pre>ArchGetIdtRegister proc near
                 sidt    qword ptr [rcx]
                 retn
ArchGetIdtRegister endp
</pre>
<p></code></p>
<p><strong>Function : ArchSetIdtRegister<br />
XREF: BdInstallTrapVectors, BlpArchInitialize</strong><br />
<code></p>
<pre>ArchSetIdtRegister proc near
                 lidt    qword ptr [rcx]
                 retn
ArchGetIdtRegister endp
</pre>
<p></code></p>
<p>Let&#8217;s look at the XREF&#8217;s functions.</p>
<p><strong>BdInstallTrapVectors</strong><br />
<code></p>
<pre>
BdInstallTrapVectors proc near          ; CODE XREF: BlBdInitialize+20D

 var_18          = qword ptr -18h

                 sub     rsp, 38h
                 lea     rcx, [rsp+38h+var_18]
                 call    ArchGetIdtRegister
                 mov     r11, [rsp+38h+var_18+2]
                 mov     r9w, 10h
                 mov     [r11+12h], r9w
                 mov     r8w, 8E00h
                 lea     rax, BdTrap01
                 <strong>mov     [r11+10h], ax   ; 0x10/(16 = sizeof(_KIDT_ENTRY)) = 0x1</strong>
                 mov     [r11+14h], r8w
                 mov     rcx, rax
                 shr     rcx, 10h
                 shr     rax, 20h
                 mov     [r11+16h], cx
                 mov     [r11+18h], eax
                 mov     rdx, [rsp+38h+var_18+2]
                 mov     [rdx+32h], r9w
                 mov     [rdx+34h], r8w
                 lea     rax, BdTrap03
                 <strong>mov     [rdx+30h], ax   ; 0x30/(16 = sizeof(_KIDT_ENTRY)) = 0x3</strong>
                 mov     rcx, rax
                 shr     rax, 20h
                 mov     [rdx+38h], eax
                 shr     rcx, 10h
                 lea     rax, BdTrap0d
                 mov     [rdx+36h], cx
                 mov     rdx, [rsp+38h+var_18+2]
                 mov     rcx, rax
                 <strong>mov     [rdx+0D0h], ax  ; 0x0D/(16 = sizeof(_KIDT_ENTRY)) = 0x0D</strong>
                 mov     [rdx+0D2h], r9w
                 mov     [rdx+0D4h], r8w
                 shr     rcx, 10h
                 shr     rax, 20h
                 mov     [rdx+0D6h], cx
                 mov     [rdx+0D8h], eax
                 mov     rdx, [rsp+38h+var_18+2]
                 mov     [rdx+0E2h], r9w
                 mov     [rdx+0E4h], r8w
                 lea     rax, BdTrap0e
                 <strong>mov     [rdx+0E0h], ax  ; 0xE0/(16 = sizeof(_KIDT_ENTRY)) = 0x0E</strong>
                 mov     rcx, rax
                 shr     rax, 20h
                 mov     [rdx+0E8h], eax
                 shr     rcx, 10h
                 lea     rax, BdTrap2c
                 mov     [rdx+0E6h], cx
                 mov     rdx, [rsp+38h+var_18+2]
                 mov     rcx, rax
                 <strong>mov     [rdx+2C0h], ax  ; 0x2C0/(16 = sizeof(_KIDT_ENTRY)) = 0x2C</strong>
                 mov     [rdx+2C2h], r9w
                 mov     [rdx+2C4h], r8w
                 shr     rcx, 10h
                 shr     rax, 20h
                 mov     [rdx+2C6h], cx
                 mov     [rdx+2C8h], eax
                 mov     rdx, [rsp+38h+var_18+2]
                 lea     rax, BdTrap2d
                 mov     [rdx+2D2h], r9w
                 mov     [rdx+2D4h], r8w
                 mov     rcx, rax
                 <strong>mov     [rdx+2D0h], ax  ; 0x2D0/(16 = sizeof(_KIDT_ENTRY)) = 0x2D</strong>
                 shr     rax, 20h
                 shr     rcx, 10h
                 mov     [rdx+2D8h], eax
                 mov     [rdx+2D6h], cx
                 lea     rcx, [rsp+38h+var_18]
                 call    ArchSetIdtRegister
                 add     rsp, 38h
                 retn
BdInstallTrapVectors endp
</pre>
<p></code></p>
<p><strong>InitializeLibrary</strong><br />
<code></p>
<pre>
BlpArchInitialize proc near             ; CODE XREF: InitializeLibrary+12A

 IdtEntry        = qword ptr -18h

                 sub     rsp, 38h

                 cmp     ecx, 1
                 jnz     _exit

                 lea     rcx, [rsp+38h+IdtEntry]
                 call    ArchGetIdtRegister
                 mov     r11, [rsp+38h+IdtEntry+2]
                 lea     rax, ArchTrapNoProcess
                 <strong>mov     [r11+30h], ax   ; 0x30/(16 = sizeof(_KIDT_ENTRY)) = 0x3
                 mov     word ptr [r11+32h], 10h
                 mov     word ptr [r11+34h], 8E00h
                 mov     r8, rax
                 mov     rdx, rax
                 shr     r8, 10h
                 shr     rdx, 20h
                 mov     [r11+36h], r8w
                 mov     [r11+38h], edx
                 mov     rcx, [rsp+38h+IdtEntry+2]
                 </strong><strong>mov     [rcx+2C0h], ax  ; 0x2C0/(16 = sizeof(_KIDT_ENTRY)) = 0x2C
                 mov     [rcx+2C6h], r8w
                 mov     [rcx+2C8h], edx
                 mov     word ptr [rcx+2C2h], 10h
                 mov     word ptr [rcx+2C4h], 8E00h
                 mov     rcx, [rsp+38h+IdtEntry+2]
                 </strong><strong>mov     [rcx+2D0h], ax  ; 0x2D0/(16 = sizeof(_KIDT_ENTRY)) = 0x2D</strong>
                 mov     [rcx+2D6h], r8w
                 mov     [rcx+2D8h], edx
                 mov     word ptr [rcx+2D2h], 10h
                 mov     word ptr [rcx+2D4h], 8E00h
                 lea     rcx, [rsp+38h+IdtEntry]
                 call    ArchSetIdtRegister

 _exit:
                 xor     eax, eax
                 add     rsp, 38h
                 retn

BlpArchInitialize endp
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.msuiche.net/2007/03/10/interrupts-boot-loader-vista-64bits-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

