这游戏以前分析过,本贴再写得详细一些。
9 ~. F. {4 ^! j$ O" x2 g这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,3 W0 K, w( T* Y/ F E
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。4 ?, [) I9 e" K0 r
, m" b i' H; i' ?1 Y
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
" g l, E- e5 G0 }# n8 P8 Q& w- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;4 p2 K- U, r; p. N) t
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
0 W" q! P/ b( J0 J5 y - STDMETHOD_(ULONG,Release) (THIS) PURE;
* O" y" r/ {. w, g( A# A - STDMETHOD(Compact)(THIS) PURE;6 o! s5 r) S* ?9 O
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;( U2 R$ R( s A: K3 }
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
$ S4 b. e, l6 t$ a! h6 } - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 6 E3 z4 a2 r0 b
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
% {* y5 V7 O% `- J/ R9 i% r4 X5 W2 |5 h" n
" ^# u) t- ^1 h
: x; s! ~8 P0 l* ?8 {5 ?7 G
# S7 K1 O4 ^# f& X% |8 w- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
+ U, k% z- u2 z; R - .text:24BC2CD2& ]0 w& d) e/ Y
- .text:24BC2CD2 ; Attributes: bp-based frame
5 y1 w5 P) |( H: h3 ?% i - .text:24BC2CD2$ O: }* E! i. G
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p. O) w+ P! W$ L* S$ E" f
- .text:24BC2CD2
2 R" [) X' U: i* V - .text:24BC2CD2 Dst = dword ptr -90h. A4 a# ^/ c/ S2 }! J/ y
- .text:24BC2CD2 var_8C = dword ptr -8Ch
+ t9 w3 E1 t7 e& E5 F - .text:24BC2CD2 var_28 = dword ptr -28h
* I& a' e! R4 K# z% S - .text:24BC2CD2 var_24 = dword ptr -24h
& f) k9 w a( [1 d/ z: Z6 s - .text:24BC2CD2 var_20 = dword ptr -20h) \2 m& w9 I' v' c. E9 x3 t' U
- .text:24BC2CD2 var_1C = dword ptr -1Ch
) T J% U" C6 W( C1 A - .text:24BC2CD2 var_18 = dword ptr -18h n r% o# U. a
- .text:24BC2CD2 ppv = dword ptr -14h
% m6 o1 A$ X1 F9 H3 \ - .text:24BC2CD2 var_10 = dword ptr -10h5 M( o" Q8 o5 y3 t) T: {/ @
- .text:24BC2CD2 var_C = dword ptr -0Ch3 x# v# e& H x3 |
- .text:24BC2CD2 var_8 = dword ptr -8! S: U& k) S! r+ E' i
- .text:24BC2CD2 hLibModule = dword ptr -4
/ A5 D9 b4 C0 u6 c( ]. n3 y - .text:24BC2CD2
% K2 B8 g$ N3 |' K1 } - .text:24BC2CD2 push ebp
0 v f+ t g& X9 X8 R - .text:24BC2CD3 mov ebp, esp
( _; y% B, s8 T" [ - .text:24BC2CD5 sub esp, 90h
- g/ j+ M1 j) P8 j( S - .text:24BC2CDB push ebx
5 O2 t. t- Y) A; @4 O2 O - .text:24BC2CDC mov ebx, ds:LoadLibraryA
H# h3 {/ w- a" a$ D4 X - .text:24BC2CE2 push esi
( L7 @) {/ t& S) |# r# r% w - .text:24BC2CE3 push edi
/ n4 @- W; r# S# A - .text:24BC2CE4 xor edi, edi
6 Z3 W( D7 t0 M+ w7 S - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
; p8 k- @, g: D/ k' d# z* e - .text:24BC2CEB mov [ebp+var_8], edi
+ P4 g) n8 f/ K - .text:24BC2CEE mov [ebp+var_1C], edi8 H# f# i# S! `2 M
- .text:24BC2CF1 mov [ebp+var_C], edi$ l0 e0 i+ ]) Y- e; p: y9 U1 B
- .text:24BC2CF4 mov [ebp+var_10], edi; y, U8 I* u5 ~/ j+ `' A2 R
- .text:24BC2CF7 mov [ebp+var_18], edi# y1 |8 m2 X6 u# Z) d
- .text:24BC2CFA call ebx ; LoadLibraryA
4 q; N# S& U) N1 v { - .text:24BC2CFC mov esi, eax
1 O+ h6 N% F2 o# O, Z& X. j - .text:24BC2CFE cmp esi, edi
3 f( S$ c$ J0 ^) q3 P1 T - .text:24BC2D00 mov [ebp+hLibModule], esi8 A1 _3 j" N* P
- .text:24BC2D03 jnz short loc_24BC2D0F
. n6 G* N" _7 ?9 m9 _3 E# L - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"& f% W: K1 E, C* {- k2 V
- .text:24BC2D0A jmp loc_24BC2E6D& `3 x+ h: A# ~3 ]3 }, N" U
- .text:24BC2D0F ; ---------------------------------------------------------------------------
6 f& E4 d2 f9 a% } - .text:24BC2D0F
2 d" I8 M' Q6 C( g& T9 S0 _ - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j7 l( I1 H/ z% i7 S8 }( y2 Z
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"1 c; H. t" p% q* ^0 w
- .text:24BC2D14 push esi ; hModule
( O0 H) e9 C2 @; q' @ I* p1 N - .text:24BC2D15 call ds:GetProcAddress
) \0 g! @5 s7 A2 j$ V* I6 L2 m. ?0 ? - .text:24BC2D1B cmp eax, edi
! F( R' [0 T2 h% ]7 A& K& h$ ^ ` - .text:24BC2D1D jnz short loc_24BC2D301 `0 R9 r) g, K( g
- .text:24BC2D1F push esi ; hLibModule
) k' }% F5 `; }, k7 n2 k* ?& j - .text:24BC2D20 call ds:FreeLibrary/ d+ | ^% g6 |5 q9 C# r% `6 t, W
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...! f- p& U e/ q4 G( J: B
- .text:24BC2D2B jmp loc_24BC2E6D A3 C6 h w& e Z( K6 C& j# v
- .text:24BC2D30 ; ---------------------------------------------------------------------------. M2 j2 s- s% d+ K
- .text:24BC2D30% U& D: n: b" ]8 O$ ~4 h9 C
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j, y$ n( q" k" y, |) N
- .text:24BC2D30 lea ecx, [ebp+var_8]$ R5 v7 i) [) o
- .text:24BC2D33 push edi7 C$ k# f9 S: w! w2 C" f1 h) ?* w
- .text:24BC2D34 push ecx
; N. w, G* R; H l! H5 O - .text:24BC2D35 push edi1 i1 |# ?0 p8 U9 I- r r
- .text:24BC2D36 call eax4 C& O, z% t' a- F2 D% j. S
- .text:24BC2D38 test eax, eax
4 o$ g, E1 P; k+ e) Y1 G: W - .text:24BC2D3A jge short loc_24BC2D4D
2 Y; F( T. x1 O% v1 T, h9 v, {. { - .text:24BC2D3C push esi ; hLibModule" O2 o" c) @- v5 b* p/ O
- .text:24BC2D3D call ds:FreeLibrary+ w: U) D/ J( X/ Q* ~
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
2 o8 l+ h/ ^. F - .text:24BC2D48 jmp loc_24BC2E6D
" r* `" m, M, b& j - .text:24BC2D4D ; ---------------------------------------------------------------------------, g. E2 G f$ a# E
- .text:24BC2D4D$ t# X' v K6 w& J( i+ k9 q
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
N: J( R5 p7 C! c/ O+ R3 k - .text:24BC2D4D mov eax, [ebp+var_8]; i# R0 D* K4 i( V2 J
- .text:24BC2D50 lea edx, [ebp+var_1C]" F: L- [4 E4 p) @, H; ]; t
- .text:24BC2D53 push edx
- u4 \. ], ]. n8 v' Q" N - .text:24BC2D54 push offset unk_24BC4470
7 r8 f% Q% z5 o7 K/ A- S- R - .text:24BC2D59 mov ecx, [eax]# m" C* I, b1 o; L8 `# q
- .text:24BC2D5B push eax9 h8 L/ `6 l5 C+ Y+ y# M
- .text:24BC2D5C call dword ptr [ecx]
& s$ ^& w/ D" ]( { - .text:24BC2D5E test eax, eax6 w0 v# O9 r+ ]3 }
- .text:24BC2D60 jge short loc_24BC2D87
9 v. e( ~# O- ~4 {, q8 y" p2 Q - .text:24BC2D62 mov eax, [ebp+var_8]2 W7 l. u9 {4 u. a6 Q/ S1 r7 a4 C
- .text:24BC2D65 push eax
. B! T, a/ C2 @; V, w; E; H) U - .text:24BC2D66 mov ecx, [eax]
& l9 J2 i/ T( W- @ - .text:24BC2D68 call dword ptr [ecx+8]6 c, _' P ]$ H* ]& D5 M- C
- .text:24BC2D6B push esi ; hLibModule# L3 _; l+ K. k6 v$ w" r* o
- .text:24BC2D6C call ds:FreeLibrary, h- t1 o' _% q1 {! v# J
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"8 C A9 X6 r2 u* d$ C& t* D# N: p+ w
- .text:24BC2D77 call ds:OutputDebugStringA
" l& _% Y# b7 E1 O" n3 K s' F - .text:24BC2D7D mov eax, 100h& Q* [) {/ I0 L
- .text:24BC2D82 jmp loc_24BC3011
5 B% ^* c4 I3 l3 z3 r - .text:24BC2D87 ; ---------------------------------------------------------------------------5 l) ~( P! l4 g$ L+ b# n5 V7 ]
- .text:24BC2D87# K# w% Q* h' H# b5 C" X- k
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
! ~: J9 Y# G+ S3 H5 {1 o1 ^ - .text:24BC2D87 mov eax, [ebp+var_1C], e; ] h6 m- h, A5 M: y% f( F
- .text:24BC2D8A push eax6 P; ?0 l. s7 @2 w! Z! ]# Q( c
- .text:24BC2D8B mov ecx, [eax]3 T- Z! b7 r& K, L8 R g; S% I& e) w1 U
- .text:24BC2D8D call dword ptr [ecx+8]0 H5 i+ W6 J* N. a! t' [6 f
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"* a% M0 {% n9 b2 A; Z
- .text:24BC2D95 call ebx ; LoadLibraryA
$ e- N5 Y' F3 P) n8 H& m) O) I - .text:24BC2D97 mov esi, eax
( y0 s9 E$ I# K h4 j1 u' \% C: E - .text:24BC2D99 cmp esi, edi
; Y5 _/ _( Y/ o' d X% ] - .text:24BC2D9B jnz short loc_24BC2DB6) c @9 _: [* g2 s- M5 T. n0 L
- .text:24BC2D9D mov eax, [ebp+var_8]
" h1 P5 e" e! G4 |' S' I& Q - .text:24BC2DA0 push eax
6 G# U+ e1 Q: j: F - .text:24BC2DA1 mov ecx, [eax]0 t. O. I1 S8 l/ V: I. e
- .text:24BC2DA3 call dword ptr [ecx+8]; |4 T5 K) u/ P4 J6 \ c u
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
2 n' S" R1 _$ c* Y& Q - .text:24BC2DA9 call ds:FreeLibrary
# Q/ i$ D- ^# G: L& X# ~ - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
6 D# _; q/ G! ]$ ~8 T: N - .text:24BC2DB4 jmp short loc_24BC2DE2( z- a4 i2 `! m$ o" J: ^
- .text:24BC2DB6 ; ---------------------------------------------------------------------------& _) Y7 X' O* S0 G3 T; H2 A+ \
- .text:24BC2DB6
' f6 Q8 l: A9 Y5 H ^2 p% A - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j, C" D. F B5 H# j/ d7 {0 q
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
7 L; H) l r: N3 I; E& F - .text:24BC2DBB push esi ; hModule
E- A1 L/ |! C1 G3 o - .text:24BC2DBC call ds:GetProcAddress& Z" h3 n. \2 |' l
- .text:24BC2DC2 push esi ; hLibModule; v9 T5 j- Z- X2 P$ Z
- .text:24BC2DC3 mov esi, ds:FreeLibrary1 l; J% ^' S* r8 y$ @9 e! s
- .text:24BC2DC9 test eax, eax7 p/ n: K" `, s* j4 K
- .text:24BC2DCB jnz short loc_24BC2DF2
2 K: Z0 i# @ }/ @+ f- F; V - .text:24BC2DCD call esi ; FreeLibrary
/ M) u* ]) Q& e9 A - .text:24BC2DCF mov eax, [ebp+var_8], K! g, X8 x$ S( M7 u
- .text:24BC2DD2 push eax, A* @" J( f5 b- O% j; Y
- .text:24BC2DD3 mov ecx, [eax]# f8 H9 c& [3 y1 n
- .text:24BC2DD5 call dword ptr [ecx+8]. x- _/ J9 v. I5 s
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule9 ~1 y$ z+ f4 f8 \ \4 z, R
- .text:24BC2DDB call esi ; FreeLibrary Z: `, m3 a/ I3 K* {% K5 T6 Y
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
" c/ \# O4 A$ e# {! R# ` - .text:24BC2DE2
4 L8 N: O( K1 W, f - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j5 H' V r3 l. B0 e$ n9 ~ L
- .text:24BC2DE2 call ds:OutputDebugStringA" K6 q" _: o8 R
- .text:24BC2DE8 mov eax, 200h
7 q+ b4 Z5 l' h - .text:24BC2DED jmp loc_24BC3011
2 _1 ^4 q3 B& L5 j5 K. k* E# P - .text:24BC2DF2 ; ---------------------------------------------------------------------------
3 p4 b& W# }% U, W, y% n$ A7 T! {! b# j - .text:24BC2DF28 H- W" B9 `$ G
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j8 b' K- d) S4 M/ ~" \
- .text:24BC2DF2 call esi ; FreeLibrary
, v9 X! Y' n0 q) z: e - .text:24BC2DF4 push 6Ch ; Size
$ N' q# ~& ~& t& [( L - .text:24BC2DF6 lea eax, [ebp+Dst]) N$ K; o4 p" }
- .text:24BC2DFC push edi ; Val
$ U, e! ^/ O9 z' M - .text:24BC2DFD push eax ; Dst
+ O; s) Z# A# A - .text:24BC2DFE call memset
% {; `$ r: @$ P" ^9 ~ - .text:24BC2E03 mov eax, [ebp+var_8]: V |, `$ Y( L4 K& j. B4 N' J' C. Z9 H) M
- .text:24BC2E06 add esp, 0Ch
2 d( y# G: w2 r; a# j1 h4 k& x- Z - .text:24BC2E09 mov [ebp+Dst], 6Ch V4 R% e9 G% W% \; I- g; x
- .text:24BC2E13 mov [ebp+var_8C], 1
# k' r& J$ N- X1 v - .text:24BC2E1D mov [ebp+var_28], 200h
6 V/ j, V3 }* d6 w - .text:24BC2E24 mov ecx, [eax]. G6 E1 x; x$ I5 \2 l
- .text:24BC2E26 push 8" F" O$ Q, K* ^) }- V, _- E
- .text:24BC2E28 push edi
$ z4 S; u& o; {6 X - .text:24BC2E29 push eax7 q9 U7 X) C3 O- U v
- .text:24BC2E2A call dword ptr [ecx+50h]
& d! w3 y6 d# G - .text:24BC2E2D test eax, eax
! `$ ~& [, _, Z - .text:24BC2E2F mov eax, [ebp+var_8]
, ~) G( J( k7 d: V: P5 l - .text:24BC2E32 mov ecx, [eax]) J0 [+ }+ V* ~( e p8 I1 u5 L
- .text:24BC2E34 jge short loc_24BC2E46
. Y! H$ ]7 @ }! D* X+ v# a - .text:24BC2E36 push eax. j4 A+ B2 }% U4 A2 ?7 k. f7 l: }
- .text:24BC2E37 call dword ptr [ecx+8]0 u9 _1 W% g ]. _- A: h$ I, _- @
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
8 `; s. D, z5 ]) c - .text:24BC2E3D call esi ; FreeLibrary* o2 `' d* D% R F
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"7 K! a& K; o: W1 O. ]! N
- .text:24BC2E44 jmp short loc_24BC2E6D5 w2 B. u# j/ Y- G
- .text:24BC2E46 ; ---------------------------------------------------------------------------* ?& q; W1 G4 g5 G, j! V4 A
- .text:24BC2E46
% x3 P# b% b1 t6 k9 R7 `5 Z - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
4 A. Q6 x# w; ^' J - .text:24BC2E46 lea edx, [ebp+var_C]' |) k3 e& A1 B/ C S
- .text:24BC2E49 push edi8 j5 C- s/ `" |
- .text:24BC2E4A push edx" h! J4 w- m+ c1 j) `: J
- .text:24BC2E4B lea edx, [ebp+Dst]% k0 U- T: B @ ?8 R/ t+ t
- .text:24BC2E51 push edx
: w: p: w: I: d" f - .text:24BC2E52 push eax
: f) v3 Z2 k# D$ |( m4 s5 g - .text:24BC2E53 call dword ptr [ecx+18h]
% f+ w6 d8 }) L; E( z - .text:24BC2E56 test eax, eax$ N2 k/ w6 [: F( e2 P
- .text:24BC2E58 jge short loc_24BC2E7A( S* u% H x9 Q& m9 W7 R) t" K. \
- .text:24BC2E5A mov eax, [ebp+var_8]" \ [/ F9 t- ?
- .text:24BC2E5D push eax" x3 l9 T, @. F9 Q
- .text:24BC2E5E mov ecx, [eax]! m! ?4 a7 W1 g, Z0 {2 t
- .text:24BC2E60 call dword ptr [ecx+8]: p0 y8 l, b4 o! E+ |
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
7 g( E+ I/ D8 ^4 ^' r! l3 | - .text:24BC2E66 call esi ; FreeLibrary
" R& A X8 t" U0 N8 N! W7 w - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
' O3 b" B- G/ w8 |" Z5 v - .text:24BC2E6D% b6 O6 h. R& e* L
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
( q7 _6 f/ R4 e* q9 e# J, |% a - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...5 Z0 x* |0 N# G! E6 k) }# h
- .text:24BC2E6D call ds:OutputDebugStringA
1 q4 o+ u8 W3 f- \, z/ ]; ^ - .text:24BC2E73 xor eax, eax
2 D5 O6 I# m* e) D* I( u, m - .text:24BC2E75 jmp loc_24BC3011" F: \& u2 i0 j2 L0 u4 Y
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ' t* b" c% o7 E: `( S
/ N* S! Z! M& t! g N3 L4 C# I J6 W
5 u3 T) f$ w: y2 I* L3 Z
|