这游戏以前分析过,本贴再写得详细一些。5 W2 S5 ?4 n& W) F$ H8 a, B" A5 M
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,7 p# D, u, o. i( b* J5 {! Z
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。& E$ R7 O6 v- T/ E3 A3 ^6 Y1 P
' R! s' O6 O1 e* m! T/ y0 u$ l参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
" o( j, ?: _* ?. D- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
6 [" @, {/ x6 v7 d( c - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ C1 I3 [7 d0 V, g1 I6 ?' M - STDMETHOD_(ULONG,Release) (THIS) PURE;9 A9 g+ f; U6 y5 N' r8 _
- STDMETHOD(Compact)(THIS) PURE; n# O: ~- k1 q" \6 P& _+ t9 F
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
+ x- \+ T; G3 A- j! ?! { - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;# @& L' p9 }; V# h; R- J
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 2 d4 i. \7 x; M! P) I B
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 m1 K* f9 }' n0 y0 m9 v+ O
* c; `$ R7 t. y4 C+ _& P4 C7 X' b% C8 p- S
$ \/ F3 d+ A. S$ }2 B
4 |6 Q: O/ Y4 }6 C- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
& k; K/ J! Q0 }8 d- _5 }5 a - .text:24BC2CD2
4 ~ N n5 D2 N% t; M - .text:24BC2CD2 ; Attributes: bp-based frame. E4 j1 X' q% M" g' v& ^
- .text:24BC2CD2
6 i* p0 K7 o$ p- {' ~1 r - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p4 |, @4 |, t; q
- .text:24BC2CD2
5 m6 ^; ^' p9 R9 i - .text:24BC2CD2 Dst = dword ptr -90h
& u4 L7 h. z5 j - .text:24BC2CD2 var_8C = dword ptr -8Ch3 `2 t5 P) p+ \: g) }# [# q1 i
- .text:24BC2CD2 var_28 = dword ptr -28h6 [7 ?" ^5 \7 K w0 v$ o; ?
- .text:24BC2CD2 var_24 = dword ptr -24h
9 g y ? {/ v4 Y - .text:24BC2CD2 var_20 = dword ptr -20h
" ~( @, A& O7 U5 e - .text:24BC2CD2 var_1C = dword ptr -1Ch' }; g' c. v8 m9 f* C! E% b
- .text:24BC2CD2 var_18 = dword ptr -18h
+ `$ Y) c2 N3 {# x& g7 r - .text:24BC2CD2 ppv = dword ptr -14h& O, X' Z- J- U
- .text:24BC2CD2 var_10 = dword ptr -10h
3 C6 t: C2 g1 B3 P. F - .text:24BC2CD2 var_C = dword ptr -0Ch
3 ]$ S, \. P3 R - .text:24BC2CD2 var_8 = dword ptr -88 L3 k* j$ |! P( w, R* J8 I9 O
- .text:24BC2CD2 hLibModule = dword ptr -4
0 x+ M/ ?7 z8 K! \- K - .text:24BC2CD2* u. s( D* h3 ?$ B. Q8 {5 q* C- }
- .text:24BC2CD2 push ebp
0 i/ g+ d+ w4 @; ^4 N - .text:24BC2CD3 mov ebp, esp
' \# c& P! M d& w. V u3 W7 ` - .text:24BC2CD5 sub esp, 90h/ E! k, e8 U8 }3 V) P
- .text:24BC2CDB push ebx
' N6 c6 w6 z4 q* U/ k4 B4 B - .text:24BC2CDC mov ebx, ds:LoadLibraryA) r8 U3 c3 c0 S4 e( |
- .text:24BC2CE2 push esi
7 X2 k) ]! J5 s7 C - .text:24BC2CE3 push edi
8 o0 g2 B: j/ F7 t) T - .text:24BC2CE4 xor edi, edi' N% Z. C7 z& H2 t+ z. j7 e+ x
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"& x" ?6 j- u5 j ?5 X
- .text:24BC2CEB mov [ebp+var_8], edi
m. V1 R; H9 _# x - .text:24BC2CEE mov [ebp+var_1C], edi5 t) W6 ~5 X. [) a
- .text:24BC2CF1 mov [ebp+var_C], edi3 E: v8 b" g! S$ j+ O8 W* p
- .text:24BC2CF4 mov [ebp+var_10], edi/ ]! n% [6 X( S+ Y. l
- .text:24BC2CF7 mov [ebp+var_18], edi
5 ~" f6 A3 q* h0 Q3 Y+ K/ N - .text:24BC2CFA call ebx ; LoadLibraryA! Q( a9 h9 v, O+ Q4 e/ e8 @
- .text:24BC2CFC mov esi, eax0 `' e/ i0 V2 C7 _0 J3 w
- .text:24BC2CFE cmp esi, edi
9 m1 i" y: \6 B: O8 Z - .text:24BC2D00 mov [ebp+hLibModule], esi
3 W! k5 |9 W; o- a ]' T - .text:24BC2D03 jnz short loc_24BC2D0F6 J4 O a/ y% k
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"/ e B4 M; G/ U: n% V
- .text:24BC2D0A jmp loc_24BC2E6D
! p+ S* i9 w9 Q, v8 c - .text:24BC2D0F ; ---------------------------------------------------------------------------8 b3 ]+ w+ t8 J I3 d
- .text:24BC2D0F i" z' n& I1 F* L+ T, m
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
' {# s- t: d6 Y - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
6 r5 f8 U1 T3 Z" l- R* u( H2 l0 b - .text:24BC2D14 push esi ; hModule6 j! s3 ?1 X9 s- e* x
- .text:24BC2D15 call ds:GetProcAddress
- o1 K- I) ^9 H6 S& x3 V0 t! J - .text:24BC2D1B cmp eax, edi
2 Z( E: \1 P- l# j' _ - .text:24BC2D1D jnz short loc_24BC2D30& K, d+ E1 q2 \" V. v( j
- .text:24BC2D1F push esi ; hLibModule" ]4 H1 V+ C0 q- ~0 J ]5 \
- .text:24BC2D20 call ds:FreeLibrary
- {; B U& c( a2 f# B, j9 W - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
4 w9 o- E- R {7 @, Z; s! h0 b - .text:24BC2D2B jmp loc_24BC2E6D
' |( b7 i- H5 T$ i3 d2 M2 L. f - .text:24BC2D30 ; ---------------------------------------------------------------------------; B, E6 Z7 q" n1 K/ c
- .text:24BC2D30
' m. F, ?& U7 M8 t- M/ i+ ] Q! T - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
3 {& B! s* C; N( c" |/ ~: ?8 t- Y - .text:24BC2D30 lea ecx, [ebp+var_8]6 u3 | C" p& P
- .text:24BC2D33 push edi. ?( w. _) {9 N5 a6 T" \
- .text:24BC2D34 push ecx" ~) t$ M$ s- e, G
- .text:24BC2D35 push edi# C: f& }/ Z" H$ R" `" ^7 ~
- .text:24BC2D36 call eax
0 s: ~( x( D9 q - .text:24BC2D38 test eax, eax: b1 s9 x8 ^" Y. _" J( ~& w5 n0 q
- .text:24BC2D3A jge short loc_24BC2D4D$ {- Z& B9 }' p# }/ K6 U
- .text:24BC2D3C push esi ; hLibModule2 T. n$ u4 v3 z# M/ P/ Y$ P7 S
- .text:24BC2D3D call ds:FreeLibrary
0 ?" O$ d; f4 E, c/ d9 d - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
[/ O+ y, B. g' J* v b - .text:24BC2D48 jmp loc_24BC2E6D
* q& b! Y; h) A2 B g! V - .text:24BC2D4D ; ---------------------------------------------------------------------------; G, P) [" O% j& O
- .text:24BC2D4D* L+ c+ ?8 B. i" D6 T; {
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
: [9 S6 z S, r8 o* d$ ^ - .text:24BC2D4D mov eax, [ebp+var_8]0 H9 U5 C9 `* q/ V7 K, b9 W& j \7 w
- .text:24BC2D50 lea edx, [ebp+var_1C]1 z# f% b: s) g- p9 P
- .text:24BC2D53 push edx$ V, W S2 l0 t
- .text:24BC2D54 push offset unk_24BC4470! `5 {2 u/ r) H0 s3 W9 x: X! k
- .text:24BC2D59 mov ecx, [eax]
5 i0 o' o7 ~2 ~; @& W - .text:24BC2D5B push eax
7 _5 g% P! u' B9 q, _) _; f - .text:24BC2D5C call dword ptr [ecx]
8 D- M" A# \1 ?) ^7 I- x. g - .text:24BC2D5E test eax, eax
0 C: M R6 C4 {- O6 _- ~; o) e - .text:24BC2D60 jge short loc_24BC2D87. |$ a: E4 z* C) F! ]( D& n
- .text:24BC2D62 mov eax, [ebp+var_8]6 N9 M; E/ B& a& G
- .text:24BC2D65 push eax
6 p4 |) l, G4 k6 X: [' ] - .text:24BC2D66 mov ecx, [eax]
9 {: D9 a p( d, q - .text:24BC2D68 call dword ptr [ecx+8]
, W) y. g5 O; W% j! p- _ - .text:24BC2D6B push esi ; hLibModule
+ F1 M4 Z7 Q0 j) ? - .text:24BC2D6C call ds:FreeLibrary5 w+ o& W2 p n
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
& b( l& C, M) C - .text:24BC2D77 call ds:OutputDebugStringA
6 ^! c; Q8 f; m0 l( q - .text:24BC2D7D mov eax, 100h- ~- I2 ~( F( G2 C1 z
- .text:24BC2D82 jmp loc_24BC3011
: v- J& l2 C( j7 m0 b - .text:24BC2D87 ; ---------------------------------------------------------------------------2 o) W- x0 ?+ O: j i
- .text:24BC2D87
/ ?" U! r' p- Q% n/ O9 @ - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j5 A6 w% A0 b4 N( ]: x8 V4 N3 j0 a
- .text:24BC2D87 mov eax, [ebp+var_1C]8 k4 L" e/ b1 _. k5 l
- .text:24BC2D8A push eax
; p y+ [- x/ W# P - .text:24BC2D8B mov ecx, [eax]5 Q8 z1 p% l) i3 [% K) p( S
- .text:24BC2D8D call dword ptr [ecx+8]6 u! I6 o5 v8 P: e( P5 c# r) R* ~
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"7 a% c7 ] X: n: `6 n& Y
- .text:24BC2D95 call ebx ; LoadLibraryA& s: i( U; a2 n z2 l
- .text:24BC2D97 mov esi, eax: N0 X" n" X. k
- .text:24BC2D99 cmp esi, edi# g6 b2 H/ J) M$ S( k5 @9 w2 J
- .text:24BC2D9B jnz short loc_24BC2DB6$ R9 l6 K Y# ]5 x6 v
- .text:24BC2D9D mov eax, [ebp+var_8]
* B7 R& M' X) v. i* x - .text:24BC2DA0 push eax3 M8 q+ P+ |- H' @) {+ S
- .text:24BC2DA1 mov ecx, [eax]
- Q$ f# U ]! [ - .text:24BC2DA3 call dword ptr [ecx+8]" e' i" S4 x& L |" O! r% l0 P
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule( ~- F2 p3 x1 X( P" p# |
- .text:24BC2DA9 call ds:FreeLibrary
$ ]. }& g. S2 B4 z - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"& S, Q! l/ [4 m1 @) I
- .text:24BC2DB4 jmp short loc_24BC2DE21 C1 E u9 Z1 E) q: {1 R
- .text:24BC2DB6 ; ---------------------------------------------------------------------------
2 ]4 a' y% B/ x' d4 m - .text:24BC2DB69 `1 X6 a" C# H" l( r. B( R) ^
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
! A$ [" z; V; Q# H# M* u6 ^ - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"- b% ~+ x# u7 S) F+ a& e7 O/ I
- .text:24BC2DBB push esi ; hModule: F/ M" ~7 E7 A, y+ q
- .text:24BC2DBC call ds:GetProcAddress
; ^+ F L* |0 r' p$ ^ - .text:24BC2DC2 push esi ; hLibModule
" x: E3 p. {0 V: c$ o$ B - .text:24BC2DC3 mov esi, ds:FreeLibrary, K, C' i4 Q6 p' j5 m5 _0 j
- .text:24BC2DC9 test eax, eax' T$ f. t' f" g. f: }0 L" T5 `
- .text:24BC2DCB jnz short loc_24BC2DF2# q+ U8 g Z- {6 P! s7 m* D9 d
- .text:24BC2DCD call esi ; FreeLibrary) n) l4 R9 f; W1 q
- .text:24BC2DCF mov eax, [ebp+var_8]8 F7 V+ }% Q3 I& z
- .text:24BC2DD2 push eax
/ N2 e5 y! r: M6 w - .text:24BC2DD3 mov ecx, [eax]
7 L1 |& C7 G& Q - .text:24BC2DD5 call dword ptr [ecx+8]" D* o* C: D# p+ w3 z+ Z" p' t
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
) |+ x# k! y4 `$ I - .text:24BC2DDB call esi ; FreeLibrary+ w. j# g; p% L9 M
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
# U. |# C& w0 C6 L% \3 A - .text:24BC2DE2- G5 C7 k# \+ m# ?* f) ]3 }
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
4 T" I( i" g1 e( l - .text:24BC2DE2 call ds:OutputDebugStringA
- y' Z: T2 I; @6 W, c% x - .text:24BC2DE8 mov eax, 200h0 l$ S3 g5 U# s$ J5 E. @* f, W
- .text:24BC2DED jmp loc_24BC3011
! r$ a }$ c5 U, ?/ f - .text:24BC2DF2 ; ---------------------------------------------------------------------------
; X- P/ B0 V+ u# x1 b - .text:24BC2DF2
. U% [9 }: S3 I* c/ ^7 G - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j8 o6 e4 M. ~" W) r" J$ a4 y2 B
- .text:24BC2DF2 call esi ; FreeLibrary2 i9 h, u# u! T+ y' ^5 r1 G$ P! B
- .text:24BC2DF4 push 6Ch ; Size( m3 O1 Q# ?" t6 a" @9 ?" h w
- .text:24BC2DF6 lea eax, [ebp+Dst]0 }0 X& H6 k. D' N' z6 x4 z
- .text:24BC2DFC push edi ; Val4 R! N6 U* z. `2 _+ |, v
- .text:24BC2DFD push eax ; Dst
* H% i o( Z3 l5 l - .text:24BC2DFE call memset2 f- P2 N( q- {+ e) X6 z @
- .text:24BC2E03 mov eax, [ebp+var_8]
: S4 \ C, q, t& Z, q - .text:24BC2E06 add esp, 0Ch; M+ d! D0 {( H1 h& q
- .text:24BC2E09 mov [ebp+Dst], 6Ch7 ?" d8 s+ _4 L2 u. ~
- .text:24BC2E13 mov [ebp+var_8C], 1+ L; I; ~" `9 b3 p6 S
- .text:24BC2E1D mov [ebp+var_28], 200h
7 {0 Y# L0 d3 b: Q; ^7 Y+ ]! m - .text:24BC2E24 mov ecx, [eax]
7 q3 |& t: W( Z( c - .text:24BC2E26 push 8
& u* z8 O$ J! Q, ]+ l7 s9 B. ^ - .text:24BC2E28 push edi
1 v2 a" M: k* j- }! p8 P0 |- @ - .text:24BC2E29 push eax' I, o& l4 i; Q" Q, D1 q) i
- .text:24BC2E2A call dword ptr [ecx+50h]
5 @; H; N0 N4 _% b - .text:24BC2E2D test eax, eax
7 R ]; D: R+ @. c9 P# d - .text:24BC2E2F mov eax, [ebp+var_8]3 j% X1 K+ r" ]. I: i! J
- .text:24BC2E32 mov ecx, [eax]! u/ I$ N3 \% n. l- v
- .text:24BC2E34 jge short loc_24BC2E46
( H6 i' i* r% Y1 F2 }9 k3 D6 I7 R - .text:24BC2E36 push eax
9 m: S8 J/ N- N: w' y( h - .text:24BC2E37 call dword ptr [ecx+8]7 Q+ [# F" g( p/ T- l( f2 \# j
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule3 X3 l5 O5 S" z! b5 x# T. r, }
- .text:24BC2E3D call esi ; FreeLibrary# A0 o) U( \, r4 T: [) ]; }7 O
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
* G1 z! C- }% x6 W" W - .text:24BC2E44 jmp short loc_24BC2E6D4 k5 W1 Z$ X* `3 L4 h7 p
- .text:24BC2E46 ; ---------------------------------------------------------------------------
& i/ _& n7 s( m - .text:24BC2E46' R4 `3 J9 ]; H, H: {
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j1 Q3 j/ ~! b- L. S3 w% G. I" s- q
- .text:24BC2E46 lea edx, [ebp+var_C]
0 A2 y' ~: Y# R3 O3 K' z$ ~ - .text:24BC2E49 push edi5 p3 \* }# @ ]
- .text:24BC2E4A push edx
5 q- z- E. Y! @+ |: }" M/ _& I - .text:24BC2E4B lea edx, [ebp+Dst], _6 a) H2 M1 N2 E' `
- .text:24BC2E51 push edx( H3 d8 z7 A3 Q# q; t" h2 G, @
- .text:24BC2E52 push eax, B& q6 H$ h- _* K) T9 f0 s
- .text:24BC2E53 call dword ptr [ecx+18h]
8 h2 H2 b) d' @( n - .text:24BC2E56 test eax, eax
7 Q; X2 h: c* X! x1 S4 m - .text:24BC2E58 jge short loc_24BC2E7A( C1 h6 n' m w+ [
- .text:24BC2E5A mov eax, [ebp+var_8]* o5 ^5 N9 a1 S q" U; f8 a" I
- .text:24BC2E5D push eax. y6 ]7 S$ b6 y" q
- .text:24BC2E5E mov ecx, [eax]
4 }( Q) O( a0 C( u3 z - .text:24BC2E60 call dword ptr [ecx+8]! Q# }5 z# l2 b q Y
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
5 _: W: Y/ N. ~3 t. J - .text:24BC2E66 call esi ; FreeLibrary, P) I" X- @6 L8 Y3 _- |
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
. s1 y7 G' N/ d/ H' _# }4 R/ z- [ - .text:24BC2E6D
4 K" `3 a" r6 Q1 W; a+ H" S- b - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j# c6 P2 c8 x1 R" z
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...) @ Q5 [8 k& \3 b4 Q
- .text:24BC2E6D call ds:OutputDebugStringA
7 q/ T0 D2 w/ J/ m" C - .text:24BC2E73 xor eax, eax4 [4 K% K% O; R0 r. b
- .text:24BC2E75 jmp loc_24BC30115 e3 I$ A3 E7 s; x
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
3 d; l, Z# r. ^( @" N
5 e* n% e; v0 h6 v( ^1 e. p8 k3 j" l: e0 [
|