这游戏以前分析过,本贴再写得详细一些。" s! h1 T. z% i* ?1 T
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
, F4 h: ~; A5 F" ~注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。& g4 }8 Q' N& h6 U
) Q9 l- [5 [$ H# R8 P6 }
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.0 d: G& b/ i( n( Q
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
! I% z, H b* `' o6 o" I6 o - STDMETHOD_(ULONG,AddRef) (THIS) PURE;7 c4 J* s& Q/ E' B9 O
- STDMETHOD_(ULONG,Release) (THIS) PURE;* i- V/ @* l; k5 k/ H
- STDMETHOD(Compact)(THIS) PURE;
6 ]* R- O2 A- A - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;( \0 l' I$ f# A. w8 V2 u. C
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
% R l2 U- }5 j* T0 m. e" x2 E - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
$ d; S3 J% O1 t以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 ) z) E" D5 [$ {
2 n6 y5 L$ K. K( c& v
, T, n" X4 z- F# C6 ^9 ^/ f+ C* K2 a$ u: N3 D
6 u3 ~ \4 ^: T( M! J4 Q: T s- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================/ A- N% h2 A5 j& W D$ V+ r6 Z
- .text:24BC2CD2
+ b8 @2 k" r& a% W6 C" i7 c' P - .text:24BC2CD2 ; Attributes: bp-based frame7 O1 f& |. \# A! I+ ^* {* b
- .text:24BC2CD2
" T& [! S6 q: U( E4 E* D, [7 | U/ G, f - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
6 G4 p7 S* i5 L: U& n5 a+ L - .text:24BC2CD2
7 F7 \1 o9 M' F& _" R* k - .text:24BC2CD2 Dst = dword ptr -90h
) M3 i. K, ?- K j+ W9 l) A - .text:24BC2CD2 var_8C = dword ptr -8Ch
/ J( M k8 b8 X; {7 { - .text:24BC2CD2 var_28 = dword ptr -28h
' v* _' l7 B$ n8 x5 i: C - .text:24BC2CD2 var_24 = dword ptr -24h2 u' N2 w5 ^; D% {3 Y! o' ]! d9 w
- .text:24BC2CD2 var_20 = dword ptr -20h. i+ x5 h# d/ U0 z3 y: K
- .text:24BC2CD2 var_1C = dword ptr -1Ch& q6 w- ^2 [$ i" U& X7 _. c
- .text:24BC2CD2 var_18 = dword ptr -18h
+ I( e5 C8 E7 x/ d G, K& l - .text:24BC2CD2 ppv = dword ptr -14h, Z7 h) c9 N1 O% H" f, v
- .text:24BC2CD2 var_10 = dword ptr -10h
( |9 I- V( o! w# t1 n$ l A - .text:24BC2CD2 var_C = dword ptr -0Ch; L0 z* @& X- J1 r/ q' k6 z9 g
- .text:24BC2CD2 var_8 = dword ptr -84 @4 ^* w( T1 x
- .text:24BC2CD2 hLibModule = dword ptr -4
- r. T! V( n$ P5 C0 F7 n0 f" l7 T - .text:24BC2CD2
: i$ i% n3 C! [ - .text:24BC2CD2 push ebp% h2 H7 d- f) o
- .text:24BC2CD3 mov ebp, esp4 O; H/ A# |' {3 ?8 @) ?) ]( n7 f
- .text:24BC2CD5 sub esp, 90h" M" m i0 ^0 L) o8 x
- .text:24BC2CDB push ebx" }4 M* X) {- {8 b& \0 p. |' t
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
/ n4 ]& P* O: P J9 {" F6 n - .text:24BC2CE2 push esi1 P: R: z# v f8 i
- .text:24BC2CE3 push edi0 U2 I o* W5 s: ^; P& I
- .text:24BC2CE4 xor edi, edi0 f9 X! V& E" X) {; S- g9 G
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"$ t) t( K! b; C5 P8 o
- .text:24BC2CEB mov [ebp+var_8], edi
( ]; d. x+ a, N% ] - .text:24BC2CEE mov [ebp+var_1C], edi
1 U. }' `, V, X }2 H- \ - .text:24BC2CF1 mov [ebp+var_C], edi! ~2 a1 c, ?2 a" ?
- .text:24BC2CF4 mov [ebp+var_10], edi
# J% N7 J5 [; k, B! z/ z+ P - .text:24BC2CF7 mov [ebp+var_18], edi! P' \) g+ i. z1 W
- .text:24BC2CFA call ebx ; LoadLibraryA
( i* T5 a% I; S; b) D7 r - .text:24BC2CFC mov esi, eax6 [& D: l1 Y1 n# U+ k [
- .text:24BC2CFE cmp esi, edi/ u0 q# Z5 `/ q+ c$ y% d9 l
- .text:24BC2D00 mov [ebp+hLibModule], esi2 |) G; K) `7 R) E& z
- .text:24BC2D03 jnz short loc_24BC2D0F
% O' u: B* r, l5 C4 Y8 B - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
1 @5 d+ L, ]' I9 Q; v - .text:24BC2D0A jmp loc_24BC2E6D
9 v4 y' U) I" _3 }- T( u - .text:24BC2D0F ; ---------------------------------------------------------------------------0 T+ Y$ a) R, R0 q/ Z. K- U
- .text:24BC2D0F0 ~; j* L0 G5 x+ {8 X% o
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j1 i/ d4 \* T5 P: e1 [
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"# L+ K( I) S. z n7 O
- .text:24BC2D14 push esi ; hModule( P% g5 n% @- m* A. E" W
- .text:24BC2D15 call ds:GetProcAddress q9 p" ^6 _8 H- {/ W
- .text:24BC2D1B cmp eax, edi
' P% V4 j. Y: t5 l - .text:24BC2D1D jnz short loc_24BC2D303 J2 k& Z; r/ F/ [- O: f
- .text:24BC2D1F push esi ; hLibModule
& P5 n# J3 u0 h4 B - .text:24BC2D20 call ds:FreeLibrary2 Z6 b3 _5 k5 K0 Q9 W
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...# h% Q) k3 P% m* |5 W
- .text:24BC2D2B jmp loc_24BC2E6D
' F) x: n1 J7 X8 h3 T7 q - .text:24BC2D30 ; ---------------------------------------------------------------------------
+ ~# D* V! _3 [" i0 _5 r - .text:24BC2D30
8 Z) b6 u" D- f9 F; d - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j/ R' F. i; x' W z' c
- .text:24BC2D30 lea ecx, [ebp+var_8]
6 W# Y& p, F3 n% J& f: m# o6 e - .text:24BC2D33 push edi
7 x9 u' G% Z5 D0 e* g2 i - .text:24BC2D34 push ecx5 D/ O+ U# h! d4 }3 q6 c
- .text:24BC2D35 push edi- U; B, a& m1 Z+ A* A. \9 ^
- .text:24BC2D36 call eax
& K+ D: `3 w7 H# X - .text:24BC2D38 test eax, eax8 V% J3 X3 g8 u
- .text:24BC2D3A jge short loc_24BC2D4D
) i- ]: Y0 A; L( `: V# o& V - .text:24BC2D3C push esi ; hLibModule
/ q& Y, ?3 Q0 S$ n5 N5 V' J - .text:24BC2D3D call ds:FreeLibrary
4 N9 ?' Q- N7 w! l8 a& [' w) ^ - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"2 T( q! F9 r0 @, Y5 ~
- .text:24BC2D48 jmp loc_24BC2E6D7 i' \: F- U$ p9 }9 Y( \5 m; A" G8 q
- .text:24BC2D4D ; ---------------------------------------------------------------------------
: z) F) k4 E/ U8 z. T - .text:24BC2D4D
- R5 N! Y3 U8 J- d1 ]7 p0 S* x: A - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
. E; z( R) K6 L, p- u - .text:24BC2D4D mov eax, [ebp+var_8]; f! s) R& Y* a0 s ]
- .text:24BC2D50 lea edx, [ebp+var_1C]" L. O# x: Q* [& S9 @5 ]
- .text:24BC2D53 push edx2 n- x. G* B% y8 j& @
- .text:24BC2D54 push offset unk_24BC4470( D. }8 a6 d7 w1 @* O% k
- .text:24BC2D59 mov ecx, [eax]+ h7 S2 X9 @1 G/ A; \1 l. d' d
- .text:24BC2D5B push eax- x! y) |/ \4 R1 z0 n+ P
- .text:24BC2D5C call dword ptr [ecx]
, B0 l2 J0 b8 @9 e) V! h$ ` - .text:24BC2D5E test eax, eax
2 k! A9 v) `& o* |' V - .text:24BC2D60 jge short loc_24BC2D877 k2 W" O5 S w& H
- .text:24BC2D62 mov eax, [ebp+var_8]
$ A+ J3 o5 `4 u: b, N, j) p - .text:24BC2D65 push eax+ \* |% b* ?% n" d
- .text:24BC2D66 mov ecx, [eax]2 F1 Y* V, P+ g* X) s
- .text:24BC2D68 call dword ptr [ecx+8]
( B" G I5 \; g$ _ - .text:24BC2D6B push esi ; hLibModule
. j& h0 h% a$ L. n: S& B4 P - .text:24BC2D6C call ds:FreeLibrary5 S1 a; [: ~& x0 y8 R# [+ M6 O
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
# n: o! }% [/ n! I2 U5 d - .text:24BC2D77 call ds:OutputDebugStringA
; K }) Z) [4 A" f x$ Y - .text:24BC2D7D mov eax, 100h- G9 T3 I' B5 ?8 H: p
- .text:24BC2D82 jmp loc_24BC3011
: q5 m0 j& d' D4 s2 U8 |7 p - .text:24BC2D87 ; ---------------------------------------------------------------------------& e+ [& r U0 W/ f3 y5 ?+ g
- .text:24BC2D87: _& f+ ?' Y4 ?7 C4 o" ?% K
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j* i' b7 ]0 K. s3 m- \/ V* s
- .text:24BC2D87 mov eax, [ebp+var_1C] w; P( y8 U. q2 i* [/ P; N' [1 j! t
- .text:24BC2D8A push eax& u" N1 ~- T" D9 F
- .text:24BC2D8B mov ecx, [eax]+ k* k0 f& _; G
- .text:24BC2D8D call dword ptr [ecx+8]. c" N( T) A. q# X
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"- c' o' F3 Z# v+ u: T: }
- .text:24BC2D95 call ebx ; LoadLibraryA
" D* G5 }3 f/ v+ W/ [ - .text:24BC2D97 mov esi, eax
: r- j7 p" Z" }7 W8 _5 _ - .text:24BC2D99 cmp esi, edi
: D; [( X. d) g! I4 d - .text:24BC2D9B jnz short loc_24BC2DB6
* Q& e! R9 C2 k( m5 N7 ] - .text:24BC2D9D mov eax, [ebp+var_8]6 E+ b# w' D5 s( a( G8 K
- .text:24BC2DA0 push eax# `4 h# V* C. I) f7 n- }7 |7 i
- .text:24BC2DA1 mov ecx, [eax]
! \" t' Q' E |: B/ X u9 k - .text:24BC2DA3 call dword ptr [ecx+8]
( l5 [* [4 m3 Y# @9 f( G - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
3 M" l9 K1 a! H0 F3 U1 r( M - .text:24BC2DA9 call ds:FreeLibrary: y' r5 O1 {+ I) |( x# E5 D) h
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"2 W1 f$ x+ u5 e( W* h: Q1 b
- .text:24BC2DB4 jmp short loc_24BC2DE2
1 a. q C# Y/ i q - .text:24BC2DB6 ; ---------------------------------------------------------------------------
1 x1 F( |* R- C- Q7 S0 L - .text:24BC2DB60 S- W0 B7 R+ D
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j5 a3 o2 m7 n3 f* L7 c
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"( S2 Q _& i( S* c
- .text:24BC2DBB push esi ; hModule
0 C6 |( M4 d5 C# D - .text:24BC2DBC call ds:GetProcAddress f! ?6 z/ \! v5 q- C8 p
- .text:24BC2DC2 push esi ; hLibModule; o; M* `9 u6 a/ Y% O
- .text:24BC2DC3 mov esi, ds:FreeLibrary! j- e, B; A% d$ \4 A9 U8 @# r5 t1 }' |
- .text:24BC2DC9 test eax, eax
& @, Z: X x. t2 B9 f' l - .text:24BC2DCB jnz short loc_24BC2DF2
. U! i1 F2 F/ h* {( P - .text:24BC2DCD call esi ; FreeLibrary2 p' Y7 e, _- X/ A( A' S! H0 w
- .text:24BC2DCF mov eax, [ebp+var_8]9 E W2 f9 `. B! r9 ]- r/ Z& Q
- .text:24BC2DD2 push eax
] G, g- I T, W* c - .text:24BC2DD3 mov ecx, [eax]: V6 e4 T" [: B( y! E% A
- .text:24BC2DD5 call dword ptr [ecx+8]
; B4 b$ l+ ~& Z& Q! V# H - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule# p ?. N! `: ?6 r9 |7 m
- .text:24BC2DDB call esi ; FreeLibrary- g9 S' H- m0 a7 x) o3 g) ^
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
5 p( x) ?& m/ Y7 G! d8 b - .text:24BC2DE2
8 }6 O3 {' ~! E" s( t- r - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j9 Y% {' Z4 [7 j {( n+ v; `
- .text:24BC2DE2 call ds:OutputDebugStringA
& H, D H, Y% [+ d3 T: G! j' k - .text:24BC2DE8 mov eax, 200h
1 T8 [/ x( p$ V - .text:24BC2DED jmp loc_24BC3011' c. q" H; U6 P- i& s, k- f
- .text:24BC2DF2 ; ---------------------------------------------------------------------------! |/ @: B! z. Z: s( \; r2 g' a* O
- .text:24BC2DF2. u* c/ _. Y5 x" {* n7 ?( f
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j* I8 V1 h; z, ^5 M( V- L
- .text:24BC2DF2 call esi ; FreeLibrary1 }7 O" \# O) ?% I) @- t
- .text:24BC2DF4 push 6Ch ; Size. [) q1 u+ Z& p4 |: ^
- .text:24BC2DF6 lea eax, [ebp+Dst]
0 c' u6 \! ?9 l: v3 Y3 V3 |% L - .text:24BC2DFC push edi ; Val
8 {9 y7 H2 V) S% G - .text:24BC2DFD push eax ; Dst' ^ M& N4 f4 s0 Z% ^) |
- .text:24BC2DFE call memset
" A& I7 c3 z/ u* Q# g1 D - .text:24BC2E03 mov eax, [ebp+var_8]
5 C! s* j& G5 R7 \) x - .text:24BC2E06 add esp, 0Ch
' H6 o, }8 L) k7 I+ g - .text:24BC2E09 mov [ebp+Dst], 6Ch8 O- \# a6 x) J2 U2 e8 X; s) s
- .text:24BC2E13 mov [ebp+var_8C], 1
" _; [& N/ \. X - .text:24BC2E1D mov [ebp+var_28], 200h! x5 t! f5 I$ u/ e2 ~2 E. A2 ^6 g
- .text:24BC2E24 mov ecx, [eax]9 f9 x6 H) D. R/ P$ i
- .text:24BC2E26 push 8
& [3 x q- N3 H9 Y: U2 p9 W* K$ B - .text:24BC2E28 push edi9 a) y4 J1 l: v' |- u
- .text:24BC2E29 push eax
. ] I: s$ q$ Z- k) [2 J2 t8 ]7 v - .text:24BC2E2A call dword ptr [ecx+50h]
2 f. ~8 X2 ?9 v: h! O - .text:24BC2E2D test eax, eax
/ P# y' b8 n4 U5 d% R - .text:24BC2E2F mov eax, [ebp+var_8]5 y0 L/ \6 Q6 n1 k
- .text:24BC2E32 mov ecx, [eax]8 o- G; K- [- N( L
- .text:24BC2E34 jge short loc_24BC2E464 W# B- G6 ~# L0 O
- .text:24BC2E36 push eax
s9 A# u, E- l( o& C4 B - .text:24BC2E37 call dword ptr [ecx+8]
7 U/ \3 P5 z' Q, N, D1 L0 h' b - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
S& L% m; f1 e- j+ S% m1 f - .text:24BC2E3D call esi ; FreeLibrary8 Y2 ^- X: L4 b3 f
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
" T X* g$ r: z - .text:24BC2E44 jmp short loc_24BC2E6D
0 Q" E8 ?" U; r2 ~9 p& i7 f - .text:24BC2E46 ; ---------------------------------------------------------------------------
. A! y: a R) G, A8 s2 V - .text:24BC2E46! |: [2 j! t1 J% I$ m
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
& ~5 X, v( i) q3 w2 e$ ? m" w - .text:24BC2E46 lea edx, [ebp+var_C]6 _9 l2 h9 p( J0 _0 S& |
- .text:24BC2E49 push edi* x7 d6 d. V8 u0 w) h9 Z! _
- .text:24BC2E4A push edx$ ]+ a1 I/ }4 ~: G2 P3 {' e' m8 E) s
- .text:24BC2E4B lea edx, [ebp+Dst]
6 V7 z' Z: t( n, S; q2 A% L/ g - .text:24BC2E51 push edx
8 z2 {1 b2 i- N2 C0 b4 f - .text:24BC2E52 push eax
% H) @1 @5 q+ c; a* D0 G* m - .text:24BC2E53 call dword ptr [ecx+18h]
8 F' V. r& i" ^- E2 P% @( \1 d - .text:24BC2E56 test eax, eax! l2 a, K+ ?8 i6 {/ D
- .text:24BC2E58 jge short loc_24BC2E7A
* Q8 M( o3 D) ]% p - .text:24BC2E5A mov eax, [ebp+var_8]
+ e- W& h/ }7 b - .text:24BC2E5D push eax
9 T0 N" |# W0 u - .text:24BC2E5E mov ecx, [eax]" Q* W: p7 k* ?; w: K. ~$ }/ U
- .text:24BC2E60 call dword ptr [ecx+8]
! e! I: c& y* U# _ - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
- i$ n% I# N5 o! c* p - .text:24BC2E66 call esi ; FreeLibrary/ r3 _, E d8 Q7 }5 r
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
. \5 F, {2 h& y6 ^+ Z - .text:24BC2E6D
$ S7 B @( L9 e9 I( f - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
& \# i, k; U: p& G. } - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...( E+ e5 p& k3 k8 U, @' c
- .text:24BC2E6D call ds:OutputDebugStringA
! }; e$ L4 q8 Y; |4 P - .text:24BC2E73 xor eax, eax
+ }' |2 g: t! z4 ?( o( p - .text:24BC2E75 jmp loc_24BC3011. d5 K. [$ i! ]- S6 F1 j) |" Z
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
9 a! ]0 Z" Y! \* g6 P& B
+ y0 w' y0 V4 E; {; L
4 ~/ ]; b2 i* Z4 t. ^& q7 @! i |