这游戏以前分析过,本贴再写得详细一些。
i+ |& e! r2 h( ~* P7 G+ l这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
/ L1 \- t. i- Q5 ?注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。" v/ B5 t: ?# g+ c1 ~
" P& Z& v- ]' ?0 B" w; X4 L1 `
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
3 U8 b8 }. O6 ~: p- a- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
0 b; ?4 c7 ~ D- f7 ? - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
6 y9 o/ _# ~8 q5 O) y - STDMETHOD_(ULONG,Release) (THIS) PURE;' R" v j9 ?0 t, t
- STDMETHOD(Compact)(THIS) PURE;$ x3 j+ ]+ U! m5 S3 t
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
6 T6 j+ r i0 k5 x2 @! l, B - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;6 c' [- i9 y: J) Z$ y2 K
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
% m0 K; u% b* n0 p以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
( v1 b* J) N' o+ F) H" G- t. e9 P7 Q$ d" Z7 u! g% d& h
6 M) P$ ~0 m: n/ S7 Q0 W8 ^* ^
1 g/ V) _; Z7 y) |1 b0 h! k- # v& j/ S( j# G9 P. u
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================9 S" @3 N) `, a v- r, [: w L. S
- .text:24BC2CD2
0 J9 F6 E# i+ n, K8 m O X7 B - .text:24BC2CD2 ; Attributes: bp-based frame& Y4 O9 i: M1 Y! A3 g
- .text:24BC2CD2
8 {+ C9 I4 k+ O; Y% @3 Q7 Q6 ^) b - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
3 K1 V/ x: \" R7 D" J& U - .text:24BC2CD2
# {" f+ R- M9 V( h& O! D - .text:24BC2CD2 Dst = dword ptr -90h& M9 w# [( h1 n. X7 G
- .text:24BC2CD2 var_8C = dword ptr -8Ch! s; |/ c6 r x; {0 b. Q/ l
- .text:24BC2CD2 var_28 = dword ptr -28h1 Z3 B6 g( p, e' q+ ]: j2 R
- .text:24BC2CD2 var_24 = dword ptr -24h* S3 a# X* `# }. Y
- .text:24BC2CD2 var_20 = dword ptr -20h
0 X% h3 N6 W. E - .text:24BC2CD2 var_1C = dword ptr -1Ch
/ D& v( w& ~2 T6 E$ R - .text:24BC2CD2 var_18 = dword ptr -18h
6 u. S6 e7 g, i% ~, { - .text:24BC2CD2 ppv = dword ptr -14h1 v, U1 p+ |/ m6 g) j2 q; d! }$ c
- .text:24BC2CD2 var_10 = dword ptr -10h2 G: _7 [* x# j) m" ]+ b; G
- .text:24BC2CD2 var_C = dword ptr -0Ch& e" }. H) { R5 ?' g
- .text:24BC2CD2 var_8 = dword ptr -8
% S# R/ f3 Z# L, s+ D" V% _5 q - .text:24BC2CD2 hLibModule = dword ptr -4
3 x6 C9 M4 {' B9 j - .text:24BC2CD2
* U4 \" x. P- ]6 b1 f' q2 R* X9 z - .text:24BC2CD2 push ebp
4 Q8 k/ l2 ?5 |6 }6 r$ A5 M" v1 ? - .text:24BC2CD3 mov ebp, esp
. k9 k4 n* P" s - .text:24BC2CD5 sub esp, 90h4 d; `- X, m5 @4 R# P
- .text:24BC2CDB push ebx
7 t# n. \0 ?6 S* O4 ` - .text:24BC2CDC mov ebx, ds:LoadLibraryA0 ^; z. E1 K# ~9 o# P/ q
- .text:24BC2CE2 push esi" _6 v! {) _- {7 y) N
- .text:24BC2CE3 push edi
6 i0 a* D: d( d - .text:24BC2CE4 xor edi, edi
+ g+ T' ?* S+ u4 T) |9 ~ - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
) t; \$ z) V0 w+ i9 a - .text:24BC2CEB mov [ebp+var_8], edi8 G2 d& W5 ] B5 T( A( t1 G0 j; [
- .text:24BC2CEE mov [ebp+var_1C], edi" p8 v9 w- ]( c: Q$ n/ o# `
- .text:24BC2CF1 mov [ebp+var_C], edi0 T6 N: R/ }9 b. ?2 Q* k
- .text:24BC2CF4 mov [ebp+var_10], edi
" q; o T( p* P4 T. s$ w - .text:24BC2CF7 mov [ebp+var_18], edi# A; p) E% M- e& V+ ^) N7 ]
- .text:24BC2CFA call ebx ; LoadLibraryA7 \8 L5 W! o* c' H. f/ j
- .text:24BC2CFC mov esi, eax
' j3 X; Y( ?4 C7 n% g+ L+ C2 E - .text:24BC2CFE cmp esi, edi2 w" R0 X+ H1 i' Y( s# B
- .text:24BC2D00 mov [ebp+hLibModule], esi6 D/ X$ a0 z, C0 Y( X+ j; f
- .text:24BC2D03 jnz short loc_24BC2D0F
7 o/ c7 M% z: y2 T$ s( r - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
4 Z* S/ b6 R( t( j3 z$ t7 p1 k- j - .text:24BC2D0A jmp loc_24BC2E6D
1 E$ Z" Q b) l* H; u - .text:24BC2D0F ; ---------------------------------------------------------------------------
+ D6 E: P( h# {0 H) J1 i - .text:24BC2D0F* s" q. ?/ M8 [; s$ ^
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
3 y/ @$ n. [' J) x: M- P4 J - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
. L& s+ c) Y! A' L0 ^ - .text:24BC2D14 push esi ; hModule9 W& V0 t- |' E% D
- .text:24BC2D15 call ds:GetProcAddress7 c. B' C6 j& k" ^( R
- .text:24BC2D1B cmp eax, edi w8 A3 y) i; N- K7 k
- .text:24BC2D1D jnz short loc_24BC2D30
j' ^& n8 ?) ?0 @ - .text:24BC2D1F push esi ; hLibModule# x. F# h( ] ?7 s5 e4 d% a
- .text:24BC2D20 call ds:FreeLibrary8 A: D0 M t% y8 d) C' m2 i# K
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...- _# x% S) L3 e
- .text:24BC2D2B jmp loc_24BC2E6D
) Q& @2 l. E4 m0 g6 c+ j - .text:24BC2D30 ; ---------------------------------------------------------------------------7 @! j: b9 D5 t% g2 E
- .text:24BC2D30
/ y( s- C1 e7 m) V6 v. Z' Z - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
* v- H- a2 w5 e6 @$ W0 W; W5 m! r# s - .text:24BC2D30 lea ecx, [ebp+var_8]
- O* w" E* f9 z0 V J - .text:24BC2D33 push edi9 o/ S$ D' {; p: x4 i8 ^1 U
- .text:24BC2D34 push ecx6 @% S) i5 k! |7 V
- .text:24BC2D35 push edi
- _2 U( E& R7 Z4 O2 K1 N1 K; _ - .text:24BC2D36 call eax
) {% G; n4 J/ K8 [7 U - .text:24BC2D38 test eax, eax
: |8 |# f- }2 Q8 V3 k$ Y - .text:24BC2D3A jge short loc_24BC2D4D
; k, V: S7 S3 f% B, X6 c - .text:24BC2D3C push esi ; hLibModule
, m5 u9 _% V9 I* g5 u6 H# k - .text:24BC2D3D call ds:FreeLibrary' ?( J8 I% Y' h# R
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
7 v- F3 i' d0 ^: k1 X+ ~8 K - .text:24BC2D48 jmp loc_24BC2E6D
) x5 m1 u# {2 V - .text:24BC2D4D ; ---------------------------------------------------------------------------, z5 B$ E/ H/ o. `
- .text:24BC2D4D7 N; h7 e5 B a
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
9 H* V/ D. w# j9 M* } - .text:24BC2D4D mov eax, [ebp+var_8]% Q4 d4 A, B8 e6 A
- .text:24BC2D50 lea edx, [ebp+var_1C]5 \7 c' a6 u! a! o! O' }
- .text:24BC2D53 push edx- @: f3 Q. j2 S! B- O6 m1 ~
- .text:24BC2D54 push offset unk_24BC4470
. s) n$ q i: I% c4 |$ M - .text:24BC2D59 mov ecx, [eax]
! a$ m4 }* y2 H' H - .text:24BC2D5B push eax9 c1 e5 X- c! d w/ G! V6 r
- .text:24BC2D5C call dword ptr [ecx]$ S. L- |1 c& M5 T. Y
- .text:24BC2D5E test eax, eax6 d. ~% o3 z3 M* R& Z
- .text:24BC2D60 jge short loc_24BC2D879 r" U8 Z1 E( f) D
- .text:24BC2D62 mov eax, [ebp+var_8]
" }, S- R6 J, \/ D5 O# D - .text:24BC2D65 push eax7 J- ^% ^& `# }* u1 U' F
- .text:24BC2D66 mov ecx, [eax]1 Q/ I& \* [) e" F1 j9 I. g
- .text:24BC2D68 call dword ptr [ecx+8]
$ F, n) T; c- K9 p) w Y - .text:24BC2D6B push esi ; hLibModule
4 I& P9 ~7 a* I$ G - .text:24BC2D6C call ds:FreeLibrary$ r L) M1 L' {$ @( ?( t$ X
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
/ `$ u& d( ]# @5 Q8 G/ @ - .text:24BC2D77 call ds:OutputDebugStringA
; Q" @& d1 C0 ~* ~ - .text:24BC2D7D mov eax, 100h& G# F6 c) k: }9 g1 P, j9 l% z
- .text:24BC2D82 jmp loc_24BC3011
; D9 i4 v, i& t, _( E) k - .text:24BC2D87 ; ---------------------------------------------------------------------------5 X6 Z1 M% }% k p7 { o
- .text:24BC2D87
2 X$ A8 o5 t6 j8 \9 W - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j2 \! E9 w5 U( l3 B
- .text:24BC2D87 mov eax, [ebp+var_1C]& F& ]. f# V6 R" _4 r, z
- .text:24BC2D8A push eax: O" w5 h* _: V' s% J* T
- .text:24BC2D8B mov ecx, [eax]$ ~) A+ h/ f$ ]$ m9 H
- .text:24BC2D8D call dword ptr [ecx+8]
/ z' Q$ a# ?- _% `5 q8 u - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"0 ^1 O# M( m) d
- .text:24BC2D95 call ebx ; LoadLibraryA
/ A0 M, @# ^2 }* o4 P% q& g6 A - .text:24BC2D97 mov esi, eax0 e" g% ]4 a4 m' Q0 v1 ^9 ~* \
- .text:24BC2D99 cmp esi, edi1 ?) l2 G& j) j, `
- .text:24BC2D9B jnz short loc_24BC2DB6' F7 X9 x1 ]5 M2 D. Q+ j
- .text:24BC2D9D mov eax, [ebp+var_8]7 D) g3 n# a' N4 u
- .text:24BC2DA0 push eax
* \2 ~. h, ?9 F2 \$ C# j, y - .text:24BC2DA1 mov ecx, [eax]& g' z9 y/ Z% W6 y9 j) `
- .text:24BC2DA3 call dword ptr [ecx+8]
) J+ r. W. y2 d9 z D' T9 t- |$ [; g - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule5 H8 J: x8 |( M) [4 |
- .text:24BC2DA9 call ds:FreeLibrary( ?5 G6 }) T5 C8 Q( u5 R
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"% Z1 m6 Z0 v X$ C. X
- .text:24BC2DB4 jmp short loc_24BC2DE23 \& I8 R& e* H( H
- .text:24BC2DB6 ; ---------------------------------------------------------------------------
' b: r( [" n+ D# E: O - .text:24BC2DB6
) S6 u' g6 e) b1 _' x. A; X& T - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j$ k' w( m3 c" w$ r5 a2 c3 s
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
* L# b% b: f4 p$ s - .text:24BC2DBB push esi ; hModule
1 h4 x; J' w% a( c* g! a - .text:24BC2DBC call ds:GetProcAddress6 o. s3 F( P( Z- s/ P& q3 Z
- .text:24BC2DC2 push esi ; hLibModule
3 b0 n$ U4 h; h& D - .text:24BC2DC3 mov esi, ds:FreeLibrary* z9 a9 w" h6 W% W" p
- .text:24BC2DC9 test eax, eax; v9 y9 L- r* G- z, D
- .text:24BC2DCB jnz short loc_24BC2DF2
; Y2 X9 Z' X4 b- P. u7 W5 P - .text:24BC2DCD call esi ; FreeLibrary
, W$ s5 n4 Y2 Q" m+ v, L$ W1 ` - .text:24BC2DCF mov eax, [ebp+var_8]
/ ~5 r/ s) ]+ h) ^6 V - .text:24BC2DD2 push eax
, [& }: g# _+ v - .text:24BC2DD3 mov ecx, [eax]
7 s6 h" }6 X5 M# U% ?# f4 ]# C' @ - .text:24BC2DD5 call dword ptr [ecx+8]- ]7 v1 q% X; J/ `6 U* x! u# x6 D+ u
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule, S8 l3 Z5 S# B; n
- .text:24BC2DDB call esi ; FreeLibrary3 H+ Z. S \ u/ c9 f9 N/ z
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r".... G( i% S- _: [7 k2 d
- .text:24BC2DE28 H* h8 _2 k& v* H% ~
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
& H* m% J1 y; d9 Z% n. L& J9 o - .text:24BC2DE2 call ds:OutputDebugStringA
! s+ H" X2 l% n+ Y. w7 H) Y5 I; _ - .text:24BC2DE8 mov eax, 200h
+ n9 J1 ]* ~! S) }1 C - .text:24BC2DED jmp loc_24BC30110 ^: [9 U: ~" z6 x- G) n1 a
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
* Z( q; P" Z9 ~9 G. G! Q( B0 f5 O - .text:24BC2DF2
1 |; j* n* F6 K/ z - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
$ F" M/ [# M0 y' E* X9 K% t - .text:24BC2DF2 call esi ; FreeLibrary
7 w: E: X) T$ N: C; C - .text:24BC2DF4 push 6Ch ; Size
* U' x6 x6 e. x3 P% {8 i+ P - .text:24BC2DF6 lea eax, [ebp+Dst]
7 _$ o' h; @( A* P! V: s$ k - .text:24BC2DFC push edi ; Val
% p( U7 v! ~/ U, U - .text:24BC2DFD push eax ; Dst
0 G% K! m$ L$ G7 }5 v' \) k - .text:24BC2DFE call memset
9 U: \/ m3 |4 _$ L - .text:24BC2E03 mov eax, [ebp+var_8]. _& G& w- `6 @
- .text:24BC2E06 add esp, 0Ch
+ c9 y' O) N2 \! Y - .text:24BC2E09 mov [ebp+Dst], 6Ch
; w6 n- f, F3 M - .text:24BC2E13 mov [ebp+var_8C], 1- J: z; V, W% t: B
- .text:24BC2E1D mov [ebp+var_28], 200h/ [# i D8 W+ f3 J. r
- .text:24BC2E24 mov ecx, [eax]
. v' O- u; y+ ]6 S0 V+ A5 C; J - .text:24BC2E26 push 8
4 ~# `6 M9 a; v5 P - .text:24BC2E28 push edi' g0 C2 \4 Y1 x/ _' a
- .text:24BC2E29 push eax
! R2 S& ~, H: ?- g8 k2 O, x- ^ - .text:24BC2E2A call dword ptr [ecx+50h]
: T: P( m+ W3 m+ i6 d3 I6 A - .text:24BC2E2D test eax, eax
4 s2 j4 ~+ |) j4 q" x - .text:24BC2E2F mov eax, [ebp+var_8]
. r9 @3 I/ o/ N' a) Z - .text:24BC2E32 mov ecx, [eax]
9 l! S, f3 a* u1 u+ h - .text:24BC2E34 jge short loc_24BC2E46
( \/ `0 S0 ~; B( m3 F- ^6 x - .text:24BC2E36 push eax n* a* X0 M6 ]; N. k
- .text:24BC2E37 call dword ptr [ecx+8]3 y; ?: I0 |5 `4 A1 i
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule: ]5 D" u+ b& L
- .text:24BC2E3D call esi ; FreeLibrary9 K( P; |& u+ @8 W+ ?
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
7 p6 q$ S( y$ Z: q% t! Q - .text:24BC2E44 jmp short loc_24BC2E6D
* Z$ D- R/ a0 w/ w - .text:24BC2E46 ; ---------------------------------------------------------------------------% M: r4 j$ H' K# i1 L; ]
- .text:24BC2E46, c: q* I: s4 x( @3 {
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j; i, ]# G# V& Z' a5 G# q( P
- .text:24BC2E46 lea edx, [ebp+var_C]6 \3 U3 l1 k, e
- .text:24BC2E49 push edi& ~( J/ U9 W: y8 H- W; V4 T, h
- .text:24BC2E4A push edx
5 \! c( ^" ^# T0 _+ K- m - .text:24BC2E4B lea edx, [ebp+Dst]* V% Q) Q1 r7 z! m
- .text:24BC2E51 push edx! ]0 Z K+ j' U$ e" V
- .text:24BC2E52 push eax9 v; m# _. W4 ]6 ~* Q7 f8 |4 B- T
- .text:24BC2E53 call dword ptr [ecx+18h]
6 @; M' r' Y2 [/ a - .text:24BC2E56 test eax, eax' R- F9 C3 t- O l' I
- .text:24BC2E58 jge short loc_24BC2E7A3 D- n: r- o3 `& S/ J9 n
- .text:24BC2E5A mov eax, [ebp+var_8]
! ^) V' i( r3 N# }8 F/ C - .text:24BC2E5D push eax
' }/ w! e* B' E+ N) O; V - .text:24BC2E5E mov ecx, [eax]
0 u# f& C6 ? p$ S' U4 ~, d - .text:24BC2E60 call dword ptr [ecx+8]
/ o4 ^- i7 k! `) t! W- X - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule+ d% p. B, C& U1 l5 Y+ a
- .text:24BC2E66 call esi ; FreeLibrary
! c+ c; L% ^4 q - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
, ^5 u. M; J6 U - .text:24BC2E6D
- x$ O& p8 e# V$ f - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
) F) ^! m$ u8 u N* F" [ - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
5 i P3 f0 E# P! U+ n0 z& d3 k - .text:24BC2E6D call ds:OutputDebugStringA
/ g+ F# \( Y0 I8 j - .text:24BC2E73 xor eax, eax
) q5 c& r2 S6 r. U" _. x6 v - .text:24BC2E75 jmp loc_24BC3011
; W7 j3 A( R. r - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
( D4 N3 C; g' |- v1 G- i# y1 m
6 h4 u1 i' x8 O9 }7 B( s4 f* k4 n7 s4 h* r$ c t0 N9 k5 N
|