Code:
foo:\>cd
C:\Documents and Settings\Admin\My Documents\ollydbg2beta\odbg201\odbg201
foo:\>cdb -c "uf /c Findmemory ;" ollydbg.exe
0:000> cdb: Reading initial command 'uf /c Findmemory ;'
ollydbg!Findmemory (00458de4)
ollydbg!Findmemory+0x2b (00458e0f):
call to ollydbg!Listmemory (00458f4c)
ollydbg!Findmemory+0x5c (00458e40):
call to ollydbg!Findsorteddata (00418738)
0:000> ub 458e0f l2
ollydbg!Findmemory+0x22:
00458e06 833d7861580000 cmp dword ptr [ollydbg!scheme+0x32f4 (00586178)],0
00458e0d 7405 je ollydbg!Findmemory+0x30 (00458e14)
0:000> u 458e0f l2
ollydbg!Findmemory+0x2b:
00458e0f e838010000 call ollydbg!Listmemory (00458f4c)
00458e14 8b15445e5d00 mov edx,dword ptr [ollydbg!memory+0x60 (005d5e44)]
0:000> .echo so 586178 holds the flag for refresh lets check where it gets inite
d must be with a mov lets check mov first
0:000> # mov*586178 401000
ollydbg!Getexportfrommemory+0x34ea:
00416c4a c7057861580001000000 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],1
0:000> # mov*586178
ollydbg!Cmdinfo+0x2b9d:
0044a3c1 890d78615800 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],ecx
0:000>
ollydbg!Getselectorinfo+0x536:
0044fade c7057861580001000000 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],1
0:000>
ollydbg!Checkfordebugevent+0x56e6:
004569ee c7057861580001000000 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],1
0:000>
ollydbg!Listmemory+0xb:
00458f57 a378615800 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],eax
0:000>
^ Memory access error in '# mov*586178'
0:000>
quit and retart with breaks enabled and a debugee for debugger
Code:
foo:\>cdb -c "bp 416c4a;bp 44fade;bp 4569ee;g;" ollydbg.exe calc.exe
so yes it sets the flag on debug event on case 4 Module Refresh
Code:
0:000> r eip
eip=00416c4a
0:000> .lastevent
Last event: 1378.1530: Hit breakpoint 0
debugger time: Sat Mar 29 10:59:41.015 2014 (UTC + 5:30)
0:000> bl 0
0 e 00416c4a 0001 (0001) 0:**** ollydbg!Getexportfrommemory+0x34ea
0:000> u 00416c4a l1
ollydbg!Getexportfrommemory+0x34ea:
00416c4a c7057861580001000000 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],1
0:000> kb
ChildEBP RetAddr Args to Child
WARNING: Stack unwind information not available. Following frames may be wrong.
0013ae94 00416c9d 02510000 0013aebc 00000000 ollydbg!Getexportfrommemory+0x34ea
0013be6c 0044fac0 02510000 005d5568 02580000 ollydbg!Getexportfrommemory+0x353d
0013be84 00451f03 00000001 14950d32 00000001 ollydbg!Getselectorinfo+0x518
0013f278 004105f2 00000000 004f6198 00151eec ollydbg!Checkfordebugevent+0xbfb
0013ff88 004f1067 00400000 00000000 00151eec ollydbg!Setstatus+0x677e
0013ffc0 7c817077 00000000 00000000 7ffde000 ollydbg!T+0x128a3
0013fff0 00000000 00401000 00000000 78746341 kernel32!BaseProcessStart+0x23
0:000>
disable the first bp (recursive hits ) and g
Code:
0:000> bd 0
0:000> g
Breakpoint 1 hit
0:000> r eip;.lastevent; u eip l1;kb
eip=0044fade
Last event: 1378.1530: Hit breakpoint 1
ollydbg!Getselectorinfo+0x536:
0044fade c7057861580001000000 mov dword ptr [ollydbg!scheme+0x32f4 (00586178)],1
ChildEBP RetAddr Args to Child
WARNING: Stack unwind information not available. Following frames may be wrong.
0013be84 00451f03 00000001 14950d32 00000001 ollydbg!Getselectorinfo+0x536
0013f278 004105f2 00000000 004f6198 00151eec ollydbg!Checkfordebugevent+0xbfb
0013ff88 004f1067 00400000 00000000 00151eec ollydbg!Setstatus+0x677e
0013ffc0 7c817077 00000000 00000000 7ffde000 ollydbg!T+0x128a3
0013fff0 00000000 00401000 00000000 78746341 kernel32!BaseProcessStart+0x23
0:000>
updating memory window does not get us a break either when running or paused even enabling bp 0 does not result in a hit
so this flag is never updated directly it seems at least not with mov
either a bug or we need to branch off and find all referances including mov reg cont mov [reg] ,1 and other esetoric constructs like xor eax,eax , inc eax # times until it is the required const mov [reg] , 1
