这游戏以前分析过,本贴再写得详细一些。
, M5 t& E* X( q Z* g这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
. Y9 J! M, d$ G% J% x) x注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
. {; w" f9 c s! z! S U: ^6 P1 X* T7 D* J o) f" `
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
$ H/ ]0 v/ c6 z9 [- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
; s" s: y$ N/ }9 d# ~ - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
- W) f9 U* i: p3 N- f* m7 a h/ ^ - STDMETHOD_(ULONG,Release) (THIS) PURE;; `3 Q) F4 L" S0 G3 o4 k
- STDMETHOD(Compact)(THIS) PURE;5 w/ K6 E& o) ^+ R" @. @( v% U4 ~1 {
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
5 m& x- Q! e; | - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
- `1 i3 q$ g6 u( v - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
: a) ^. i% S9 M2 @! G以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 9 l4 W6 t2 J7 v" V1 U
/ B+ o6 v7 @ f) U# b! _2 B7 d* _1 I
$ i6 ~4 h1 D3 L/ c/ ]
- 4 l1 x1 \# J% R8 z s* w. k& K( n
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
* V n3 Q0 q$ y. f. u) v - .text:24BC2CD2
8 t4 x9 N% v* E( O# v! K - .text:24BC2CD2 ; Attributes: bp-based frame' D8 h! M1 _) y& K2 s
- .text:24BC2CD2
3 [' a3 _! ~2 |& H2 ~ - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
% l+ c7 R. p1 r* S0 _- u, f$ S - .text:24BC2CD2
+ h+ J% a/ S+ k4 h$ k4 [ - .text:24BC2CD2 Dst = dword ptr -90h* n2 [" i6 v+ D' A. j$ O+ a" `
- .text:24BC2CD2 var_8C = dword ptr -8Ch; [3 h* _( @4 p( q3 N2 v0 ^6 \, c
- .text:24BC2CD2 var_28 = dword ptr -28h
0 k6 `: S, _- R) w* p - .text:24BC2CD2 var_24 = dword ptr -24h
1 q1 B7 h3 h) ?0 g+ }+ Y - .text:24BC2CD2 var_20 = dword ptr -20h" f5 Y/ o# {* E5 v& K
- .text:24BC2CD2 var_1C = dword ptr -1Ch
( s, P2 x) \8 M" b - .text:24BC2CD2 var_18 = dword ptr -18h! z& _! n8 c N: y% U3 I# _
- .text:24BC2CD2 ppv = dword ptr -14h5 K# Z% W# v/ i3 w6 P
- .text:24BC2CD2 var_10 = dword ptr -10h- g& Q) _! N) u
- .text:24BC2CD2 var_C = dword ptr -0Ch: v: z: j8 ~1 Y `# m1 P
- .text:24BC2CD2 var_8 = dword ptr -86 B1 u1 x3 }/ ?9 A1 D
- .text:24BC2CD2 hLibModule = dword ptr -4! b( x$ r' h" M$ x9 p g9 N
- .text:24BC2CD2; j9 A6 D1 N; `& G# E
- .text:24BC2CD2 push ebp
, b. t5 N, U4 I$ v: Y4 I& o - .text:24BC2CD3 mov ebp, esp) S$ D- t: {) Q$ n6 J) i4 m
- .text:24BC2CD5 sub esp, 90h3 j# O7 j: z' c( H4 V7 d
- .text:24BC2CDB push ebx3 m, z+ [' r* f) x- Q% q
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
. E( ?2 u* d |: }2 g- q - .text:24BC2CE2 push esi6 ~/ N: ]( Q6 _7 V7 i. E
- .text:24BC2CE3 push edi3 Y. c7 |3 m7 l* P$ L0 ^4 B
- .text:24BC2CE4 xor edi, edi
) a) U' t: O% P2 c+ n - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"& O/ Q0 ?2 [( v* Z) X( P
- .text:24BC2CEB mov [ebp+var_8], edi
0 l7 x" i# s- [: w - .text:24BC2CEE mov [ebp+var_1C], edi# E2 `: j$ P9 }* I9 C% V
- .text:24BC2CF1 mov [ebp+var_C], edi
f% y. }' A1 L - .text:24BC2CF4 mov [ebp+var_10], edi
+ X$ i/ k8 C2 X% u/ e - .text:24BC2CF7 mov [ebp+var_18], edi
5 T6 E9 a& N# z - .text:24BC2CFA call ebx ; LoadLibraryA
" w! V6 o7 b5 { - .text:24BC2CFC mov esi, eax
# ]! n8 w4 Z3 h - .text:24BC2CFE cmp esi, edi
% f" L/ f, j) E4 b; ]6 K. Y/ r - .text:24BC2D00 mov [ebp+hLibModule], esi: n* ^# O0 [1 k) ^" \
- .text:24BC2D03 jnz short loc_24BC2D0F
4 n, f& d/ `* P; {4 q - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"+ F1 }2 q4 k0 B
- .text:24BC2D0A jmp loc_24BC2E6D$ K, @; c- ?+ w; K, g
- .text:24BC2D0F ; ---------------------------------------------------------------------------
# F2 {1 i% _4 [! I1 Q - .text:24BC2D0F3 y+ Q& B" d: |& ^) F
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
6 ~3 E7 v3 k2 O5 C - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
3 a0 I, ?, ~3 _& A5 b; z - .text:24BC2D14 push esi ; hModule
4 D- k* b- g. Y, {3 D: c% L7 ^ - .text:24BC2D15 call ds:GetProcAddress
& e3 e; \, a4 ^: _- v! }6 O" r - .text:24BC2D1B cmp eax, edi
7 K3 ^& m( X( Z+ u, n' X - .text:24BC2D1D jnz short loc_24BC2D30: e! R# h3 h) L
- .text:24BC2D1F push esi ; hLibModule
( W1 u/ O% j% i5 m+ Z6 D - .text:24BC2D20 call ds:FreeLibrary
. h1 Y3 B' x# P7 C5 Y; w - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
, ~! w6 a/ p5 k0 n) X0 c - .text:24BC2D2B jmp loc_24BC2E6D
& G$ }* |3 V. U5 }& j1 N6 t - .text:24BC2D30 ; ---------------------------------------------------------------------------5 e' ^% A; q4 v, F) {. D+ P
- .text:24BC2D30
. |9 w# x$ Z# x5 C - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j& o( l @# q) O/ V. ?6 F
- .text:24BC2D30 lea ecx, [ebp+var_8]% ?9 Y. Y, r& y z! P$ H. z
- .text:24BC2D33 push edi4 a, f, D0 C: w5 ~' |/ T0 T
- .text:24BC2D34 push ecx
* O( U1 S: K9 e$ y$ @* c* C, s - .text:24BC2D35 push edi
! K3 s# {: S( m& M" x - .text:24BC2D36 call eax1 Z' z8 o2 v- l+ }2 Y: G
- .text:24BC2D38 test eax, eax
! X1 x* u( ]2 ~* [4 i, ~ - .text:24BC2D3A jge short loc_24BC2D4D
3 w# r; d2 r3 ^ n( M9 V% { - .text:24BC2D3C push esi ; hLibModule
. k% v6 M( P6 J! q! v - .text:24BC2D3D call ds:FreeLibrary
( F; A [! {$ Q! L9 y6 C - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
' R' t O. w( y# s# ^5 G - .text:24BC2D48 jmp loc_24BC2E6D* z) E( h/ ~" ^: j; Q) Q X
- .text:24BC2D4D ; ---------------------------------------------------------------------------
9 h, q2 V9 x: p* A. N - .text:24BC2D4D
, X/ Z. ]0 s' p: `8 ? - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
- _+ n' ~: W u - .text:24BC2D4D mov eax, [ebp+var_8]
4 }/ b' r+ U# T* F3 h1 z - .text:24BC2D50 lea edx, [ebp+var_1C]8 _6 V6 v+ {# m c
- .text:24BC2D53 push edx% ~! K, X4 X& Q
- .text:24BC2D54 push offset unk_24BC4470
1 s- {8 `- J; |* K" Y - .text:24BC2D59 mov ecx, [eax]
4 W! k2 z) |6 G7 g, h) j) V: w2 L - .text:24BC2D5B push eax4 ~1 }) O% }& j3 s
- .text:24BC2D5C call dword ptr [ecx]: O) m. i, t. l7 M
- .text:24BC2D5E test eax, eax5 o$ T( e+ D* ?! ~
- .text:24BC2D60 jge short loc_24BC2D87) T3 L8 u. q ]% X* J' d
- .text:24BC2D62 mov eax, [ebp+var_8]
- z6 ?! n) r9 [4 ], ~% M - .text:24BC2D65 push eax$ Z3 {* ?# \. y9 a& T; H8 }4 E
- .text:24BC2D66 mov ecx, [eax] Z" d* j8 _, N( c( Z" D
- .text:24BC2D68 call dword ptr [ecx+8]
5 @" B3 e1 R# x! D" ^! X! K T - .text:24BC2D6B push esi ; hLibModule2 N4 n4 U2 T3 @' t# I* ^* u
- .text:24BC2D6C call ds:FreeLibrary
, B0 b, j' V7 _# _7 r1 ]2 @3 [# N - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"6 B0 l% \% F) s0 D
- .text:24BC2D77 call ds:OutputDebugStringA7 u) b5 s" a, b/ ]9 e& y" T- y
- .text:24BC2D7D mov eax, 100h8 n$ m1 I. h. [6 D% A
- .text:24BC2D82 jmp loc_24BC3011
$ a4 N- \$ X: _4 Y - .text:24BC2D87 ; ---------------------------------------------------------------------------
- M0 }& _2 o8 a0 Z8 x) Q+ Q - .text:24BC2D87
( {- e) v g& R# B - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j- N) J5 j7 h' }0 _5 S0 `' e$ D3 }5 Y
- .text:24BC2D87 mov eax, [ebp+var_1C]% @5 ^! o) c: K' ^% c( ` Q
- .text:24BC2D8A push eax8 V5 o" ?# \& [% P( [1 w
- .text:24BC2D8B mov ecx, [eax]* O6 b. W/ ~; G+ o7 D! t& ]
- .text:24BC2D8D call dword ptr [ecx+8]* K! q6 y# {: J9 \( x6 C
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"+ @$ E) {3 K L, o# L
- .text:24BC2D95 call ebx ; LoadLibraryA8 [7 L$ v1 o$ a* H. u/ a
- .text:24BC2D97 mov esi, eax
- j' B3 S. h' ^. C; |( h& z; |' @ - .text:24BC2D99 cmp esi, edi
' {1 @2 W, }, U+ D. _: F9 Z7 P - .text:24BC2D9B jnz short loc_24BC2DB6) z1 [* Q$ i$ c: H8 r
- .text:24BC2D9D mov eax, [ebp+var_8]
F6 Z. y! y/ t - .text:24BC2DA0 push eax0 b0 U6 O0 w& ]& t, ~, t9 @
- .text:24BC2DA1 mov ecx, [eax]5 F4 K& M( A5 }4 S* {3 Y
- .text:24BC2DA3 call dword ptr [ecx+8]
3 E& e7 X$ U. G4 R$ s, t+ c1 W - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
2 I" c7 E4 o8 b; }6 n* e7 _# Y - .text:24BC2DA9 call ds:FreeLibrary+ n/ I! H" u. z/ r
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
! o9 C; H- k6 ~ w& D - .text:24BC2DB4 jmp short loc_24BC2DE2
% U) S% ^1 p$ x6 D2 n - .text:24BC2DB6 ; ---------------------------------------------------------------------------
2 t$ R3 M9 q8 z4 r$ @/ y* T/ E - .text:24BC2DB6% n; k4 I6 i. N! t
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
- J' K& A* B) | - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"- H) s. e. [5 ?4 w
- .text:24BC2DBB push esi ; hModule4 f# E3 Z. @0 y3 f7 ^* `
- .text:24BC2DBC call ds:GetProcAddress
7 S+ B4 n! e* H6 N; N - .text:24BC2DC2 push esi ; hLibModule
( o. G$ ~( e/ u0 q3 B9 H - .text:24BC2DC3 mov esi, ds:FreeLibrary4 o8 ~+ |/ J% Z) Y
- .text:24BC2DC9 test eax, eax
7 L% ~' V5 A+ X: |) K. w L1 q - .text:24BC2DCB jnz short loc_24BC2DF2& g5 a* T/ u3 l) S, b/ o0 A0 M
- .text:24BC2DCD call esi ; FreeLibrary9 I6 s9 s+ \2 ^" I6 Q" J
- .text:24BC2DCF mov eax, [ebp+var_8]0 d, [/ _; j! [- h7 D
- .text:24BC2DD2 push eax: P4 [+ W% K. n
- .text:24BC2DD3 mov ecx, [eax]- x" e; c7 i1 Z N( R @. P
- .text:24BC2DD5 call dword ptr [ecx+8]
7 r5 V6 G9 }4 r3 M& D7 _ - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule5 G) R( k# D' G* w6 L, f
- .text:24BC2DDB call esi ; FreeLibrary j) `+ M: |4 d+ Q; P; V( O
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
$ |8 x S' i: S2 K% @) M - .text:24BC2DE2, O6 [0 U3 q: D( c
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j, h: z$ ]9 ~6 R; K4 H7 |4 C
- .text:24BC2DE2 call ds:OutputDebugStringA* z' E5 y' U! q4 E! Y) S
- .text:24BC2DE8 mov eax, 200h
7 l4 B6 K: _ ^4 i2 q - .text:24BC2DED jmp loc_24BC30111 R4 P% f* Q1 U1 m# \
- .text:24BC2DF2 ; ---------------------------------------------------------------------------7 L5 @0 B X9 I# h* C
- .text:24BC2DF2
5 E" r& G6 e( s5 k% J' [ - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
( j! u/ e1 S) s+ k - .text:24BC2DF2 call esi ; FreeLibrary9 V" W4 M6 ~9 f. o4 _7 K; s
- .text:24BC2DF4 push 6Ch ; Size) B8 \" ^! z9 U; ~& }
- .text:24BC2DF6 lea eax, [ebp+Dst]# X$ ^4 s1 R# G; S
- .text:24BC2DFC push edi ; Val' W" [1 L: W2 d' c0 l- M0 X
- .text:24BC2DFD push eax ; Dst1 l; Q, v; v/ Z4 h# C, w( W
- .text:24BC2DFE call memset
/ }* k, N" m( T, d! R: b {1 {% U - .text:24BC2E03 mov eax, [ebp+var_8]7 c5 i' L0 B1 F- v) g) \; X
- .text:24BC2E06 add esp, 0Ch7 J- N" y* _, w) {9 z2 r
- .text:24BC2E09 mov [ebp+Dst], 6Ch
- W! G3 ?- f2 k- B K - .text:24BC2E13 mov [ebp+var_8C], 19 @" R9 }8 e1 c
- .text:24BC2E1D mov [ebp+var_28], 200h: @; m2 b0 |" h# E5 L3 r0 H
- .text:24BC2E24 mov ecx, [eax]
5 W2 g! E' [$ w6 ^+ m9 d$ s - .text:24BC2E26 push 8+ _. w& ^- |5 z( w2 ~
- .text:24BC2E28 push edi
9 v V# @" P; o - .text:24BC2E29 push eax- F* ?' O& K3 W7 l
- .text:24BC2E2A call dword ptr [ecx+50h]
% Y! l* G$ O1 L% M. N - .text:24BC2E2D test eax, eax
7 O# [0 ^& |6 W$ Y8 n! k8 z |4 O7 g - .text:24BC2E2F mov eax, [ebp+var_8]
4 L$ y8 A6 d% u$ V - .text:24BC2E32 mov ecx, [eax]0 R a0 U: a* x3 T
- .text:24BC2E34 jge short loc_24BC2E46
$ S; F* q) k) \ \1 N1 T& D - .text:24BC2E36 push eax
) A: |! l# j$ R7 n" N! b+ k* `5 m - .text:24BC2E37 call dword ptr [ecx+8]
' g+ M' ^2 ^5 [2 h- F7 u, Y - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule: n' }/ u% l4 h+ G& p" ?
- .text:24BC2E3D call esi ; FreeLibrary5 o; n2 h2 O9 p! j; R! V* |' r
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
! o0 ]# `( E4 X& _2 R - .text:24BC2E44 jmp short loc_24BC2E6D, T' i/ c- W# O5 M! `& D
- .text:24BC2E46 ; ---------------------------------------------------------------------------
+ Y: j0 e8 L: {, u1 e7 _+ Q6 ? - .text:24BC2E46
6 [ A) l6 Q& R4 b% o* `" y: ` - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
; F9 R) R+ R+ e0 @; B( }9 c - .text:24BC2E46 lea edx, [ebp+var_C]
4 j3 k6 e" c6 q1 f# a! j5 W* }+ z - .text:24BC2E49 push edi- v3 U8 {; @: ]9 h& g
- .text:24BC2E4A push edx1 C, u! d5 d! c; m3 ^& q
- .text:24BC2E4B lea edx, [ebp+Dst]
6 a7 ^7 z2 }- K0 s% Z. F( J9 {' S - .text:24BC2E51 push edx& C5 c& u K+ y$ q- m% ?# I, I
- .text:24BC2E52 push eax
5 C" A# y0 R |3 q) F2 A - .text:24BC2E53 call dword ptr [ecx+18h]
2 m: m! g( b- ]& p - .text:24BC2E56 test eax, eax
) r$ I1 ^: C! | - .text:24BC2E58 jge short loc_24BC2E7A* B q$ q/ T- K; [& |% F2 f+ E
- .text:24BC2E5A mov eax, [ebp+var_8]7 q! V4 T( g/ }% F
- .text:24BC2E5D push eax
4 u* y8 e) q$ k - .text:24BC2E5E mov ecx, [eax]" e% \% L# Y7 E8 ~" q. L
- .text:24BC2E60 call dword ptr [ecx+8]
+ v0 u. P0 j8 P% Y, i - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
# @! p/ y# X7 { - .text:24BC2E66 call esi ; FreeLibrary( Z( L: P) n: \% D* s |. C( p# q
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n": X; K) R6 s, q
- .text:24BC2E6D) c/ z% @( G+ T
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
4 ~0 t" O% ] p4 D3 S" F/ O. e - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
3 G5 R. ]0 H* d& W9 T8 e) o8 C) F7 ?7 a - .text:24BC2E6D call ds:OutputDebugStringA
! f9 J: T! J/ j - .text:24BC2E73 xor eax, eax
3 n0 a7 u2 ]6 u0 Q! E( W7 A - .text:24BC2E75 jmp loc_24BC3011
u- ]# }& l! n; E& H - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
& D8 M+ W7 s* h- ]* l: G4 V/ P' K0 i! p
D$ N% }8 c- w l/ s/ C2 \
|