Assembly Language for Beginners

(Jeff_L) #1

8.4. HACKING WINDOWS CLOCK


Figure 8.10:Resource Hacker

OK, what we know? How to draw a clock hand? All they are started at the middle of circle, ending with its
border. Hence, wemustcalculatecoordinatesofapointoncircle’sborder. Fromschool-levelmathematics
we may recall that we have to use sine/cosine functions to draw circle, or at least square root. There are
no such things inTIMEDATE.CPL, at least at first glance. But, thanks to Microsoft debugging PDB files, I
can find a function namedCAnalogClock::DrawHand(), which callsGdiplus::Graphics::DrawLine()at least
twice.


Here is its code:


.text:6EB9DBC7 ; private: enum Gdiplus::Status thiscall CAnalogClock::_DrawHand(class⤦
ÇGdiplus::Graphics , int, struct ClockHand const &, class Gdiplus::Pen )
.text:6EB9DBC7 ?_DrawHand@CAnalogClock@@AAE?⤦
ÇAW4Status@Gdiplus@@PAVGraphics@3@HABUClockHand@@PAVPen@3@@Z proc near
.text:6EB9DBC7 ; CODE XREF: CAnalogClock::_ClockPaint(⤦
ÇHDC__ *)+163
.text:6EB9DBC7 ; CAnalogClock::_ClockPaint(HDC
*)+18B
.text:6EB9DBC7
.text:6EB9DBC7 var_10 = dword ptr -10h
.text:6EB9DBC7 var_C = dword ptr -0Ch
.text:6EB9DBC7 var_8 = dword ptr -8
.text:6EB9DBC7 var_4 = dword ptr -4
.text:6EB9DBC7 arg_0 = dword ptr 8
.text:6EB9DBC7 arg_4 = dword ptr 0Ch
.text:6EB9DBC7 arg_8 = dword ptr 10h
.text:6EB9DBC7 arg_C = dword ptr 14h
.text:6EB9DBC7
.text:6EB9DBC7 mov edi, edi
.text:6EB9DBC9 push ebp
.text:6EB9DBCA mov ebp, esp
.text:6EB9DBCC sub esp, 10h
.text:6EB9DBCF mov eax, [ebp+arg_4]
.text:6EB9DBD2 push ebx
.text:6EB9DBD3 push esi

Free download pdf