C:\>systeminfo | findstr /b /i /c:"os name" /c:"os version"
OS Name: Microsoft Windows XP Professional
OS Version: 5.1.2600 Service Pack 3 Build 2600
C:\>C:\WINDOWS\system32\cmd.exe /k C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinD
DK\7600.16385.1\ fre x86 WLH
OACR monitor running already
C:\WinDDK\7600.16385.1>md civa & cd civa & prompt civa:\$g
civa:\>dir /b & copy f:\masm32\icztutes\tute02\test\msgbox.asm . & dir /b
1 file(s) copied.
msgbox.asm
civa:\>type msgbox.asm
.386
.model flat, stdcall
option casemap:none
include f:\masm32\include\windows.inc
include f:\masm32\include\kernel32.inc
include f:\masm32\include\user32.inc
includelib f:\masm32\lib\user32.lib
includelib f:\masm32\lib\kernel32.lib
.data
MsgCaption db "Iczelion's tutorial no.2",0
MsgBoxText db "Win32 Assembly is Great!",0
.code
start:
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,NULL
end start
civa:\>ml /c /coff msgbox.asm
Microsoft (R) Macro Assembler Version 9.00.30729.207 <--- brand new shiny ml
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: msgbox.asm
f:\masm32\include\windows.inc(17530) : error A2138:invalid data initializer
get latest
windows.inc from hutch and replace old (windows.inc is now
2 files look at masm32 subforum
civa:\>ml /c /coff msgbox.asm
Microsoft (R) Macro Assembler Version 9.00.30729.207
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: msgbox.asm
civa:\>dir /b
msgbox.asm
msgbox.obj
civa:\>Link /SUBSYSTEM:WINDOWS /ALIGN:4096 /FILEALIGN:4096 "msgbox.obj"
Microsoft (R) Incremental Linker Version 9.00.30729.207
Copyright (C) Microsoft Corporation. All rights reserved.
LINK : warning LNK4108: /ALIGN specified without /DRIVER; image may not run
civa:\>dir /b
msgbox.asm
msgbox.exe
msgbox.obj
civa:\>dir msgbox.exe
Volume in drive C has no label.
Volume Serial Number is 9836-92E3
Directory of C:\WinDDK\7600.16385.1\civa
14/07/2011 11:11 16,384 msgbox.exe
1 File(s) 16,384 bytes
0 Dir(s) 3,541,442,560 bytes free
civa:\>msgbox.exe
civa:\>msgbox.exe
civa:\>f:\windbg\cdb.exe -c ".writemem msgbox_dump.exe 0x400000 L?4000
;q" -pn msgbox.exe
Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.
*** wait with pending attach
Symbol search path is: SRV*F:\symbols*http://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 00400000 00404000 C:\WinDDK\7600.16385.1\civa\msgbox.exe
ModLoad: 7c900000 7c9b2000 C:\WINDOWS\system32\ntdll.dll
ModLoad: 7c800000 7c8f6000 C:\WINDOWS\system32\kernel32.dll
ModLoad: 64d00000 64d34000 C:\Program Files\Alwil Software\Avast5\snxhk.dll
ModLoad: 7e410000 7e4a1000 C:\WINDOWS\system32\user32.dll
ModLoad: 77f10000 77f59000 C:\WINDOWS\system32\GDI32.dll
ModLoad: 76390000 763ad000 C:\WINDOWS\system32\IMM32.DLL
ModLoad: 77dd0000 77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e70000 77f02000 C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fe0000 77ff1000 C:\WINDOWS\system32\Secur32.dll
ModLoad: 5ad70000 5ada8000 C:\WINDOWS\system32\uxtheme.dll
ModLoad: 77c10000 77c68000 C:\WINDOWS\system32\msvcrt.dll
ModLoad: 74720000 7476c000 C:\WINDOWS\system32\MSCTF.dll
ModLoad: 77b40000 77b62000 C:\WINDOWS\system32\apphelp.dll
ModLoad: 755c0000 755ee000 C:\WINDOWS\system32\msctfime.ime
ModLoad: 774e0000 7761d000 C:\WINDOWS\system32\ole32.dll
ModLoad: 605d0000 605d9000 C:\WINDOWS\system32\mslbui.dll
ModLoad: 77120000 771ab000 C:\WINDOWS\system32\OLEAUT32.DLL
(c24.920): Break instruction exception - code 80000003 (first chance)
eax=7ffdf000 ebx=00000001 ecx=00000002 edx=00000003 esi=00000004 edi=00000005
eip=7c90120e esp=003effcc ebp=003efff4 iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000246
ntdll!DbgBreakPoint:
7c90120e cc int 3
0:001> cdb: Reading initial command '.writemem msgbox_dump.exe 0x400000 L?4000;q
'
Writing 4000 bytes........
quit:
civa:\>dir /b
msgbox.asm
msgbox.exe
msgbox.obj
msgbox_dump.exe
civa:\>dir msgbox*.exe
Volume in drive C has no label.
Volume Serial Number is 9836-92E3
Directory of C:\WinDDK\7600.16385.1\civa
14/07/2011 11:11 16,384 msgbox.exe
14/07/2011 11:14 16,384 msgbox_dump.exe
2 File(s) 32,768 bytes
0 Dir(s) 3,541,426,176 bytes free
civa:\>fc /b msgbox.exe msgbox_dump.exe
Comparing files msgbox.exe and MSGBOX_DUMP.EXE
00002000: 76 12
00002001: 20 CB
00002002: 00 81
00002003: 00 7C
00002008: 5C EA
00002009: 20 07
0000200A: 00 45
0000200B: 00 7E
civa:\>msgbox_dump.exe
civa:\>
voila dump and run without any patch
btw why does it run even when there are obvious differences ? find answer
civa:\>cd ..
civa:\>rd /s /q civa
civa:\>