这游戏以前分析过,本贴再写得详细一些。* L2 e# S/ N5 Q. H
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
/ |7 ?. j( C5 U注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。; ^' B3 N2 [& Q& S1 k1 ~* h
3 m0 p6 ^* a4 B. C* R参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
+ Q+ H9 o2 M, J& j. y- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
+ a* e7 O2 Z: O' F B - STDMETHOD_(ULONG,AddRef) (THIS) PURE;+ H: i T6 C( i4 Y
- STDMETHOD_(ULONG,Release) (THIS) PURE;
" d3 c1 J' K9 }! |, z+ ]4 M - STDMETHOD(Compact)(THIS) PURE;. U9 D% s" T4 y
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
% o+ k: G' Q3 _ - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;7 p9 M0 s6 _( y6 w- w U/ c, q8 K
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
3 C& w: X5 L; S* x以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
, {) }( M: j0 k
- a5 N0 [0 b8 ^
" G9 {3 l* }; a, r. o
: }$ ?! y c6 P; ?: \- j- # y. n- J2 a- k2 ^- H( f6 ~- A
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================0 {+ N( d5 N5 J* A# g
- .text:24BC2CD2( D$ M7 z2 ^, x4 D$ ]& |/ X
- .text:24BC2CD2 ; Attributes: bp-based frame
7 j! G9 q6 U7 e9 E - .text:24BC2CD2. V, x- t& z, G) E e* F, `
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p4 ~. A. v! H- w3 Q
- .text:24BC2CD2# q; E! d" ?9 E9 G2 q! a, w
- .text:24BC2CD2 Dst = dword ptr -90h
6 j9 d. j! t4 t# O - .text:24BC2CD2 var_8C = dword ptr -8Ch; G! u* W- F) r, t' X
- .text:24BC2CD2 var_28 = dword ptr -28h4 N, O0 L; v7 |/ P* H( i
- .text:24BC2CD2 var_24 = dword ptr -24h
! [' _# U' J9 c: S# J0 _. s - .text:24BC2CD2 var_20 = dword ptr -20h
0 x- b N, s1 |0 K0 I - .text:24BC2CD2 var_1C = dword ptr -1Ch8 d0 C3 @4 M! b+ n- r
- .text:24BC2CD2 var_18 = dword ptr -18h
$ @# v5 S+ m* ^9 F - .text:24BC2CD2 ppv = dword ptr -14h3 M! v8 \$ g* |3 o9 g
- .text:24BC2CD2 var_10 = dword ptr -10h9 q+ O2 S6 n1 e( l* m
- .text:24BC2CD2 var_C = dword ptr -0Ch
9 t8 ?7 m3 E% D- }. z - .text:24BC2CD2 var_8 = dword ptr -82 Z7 }8 `; {* L* ?
- .text:24BC2CD2 hLibModule = dword ptr -4; E4 n- P# C i# F9 p* d2 d* Y
- .text:24BC2CD2
G! Q) }3 t6 B9 z - .text:24BC2CD2 push ebp
0 _. i1 |( v% T, I" M' Z9 `$ O - .text:24BC2CD3 mov ebp, esp$ p; l5 P' _0 A3 b5 A9 P
- .text:24BC2CD5 sub esp, 90h
( v" F: h/ Z" I! k& V3 n& Z - .text:24BC2CDB push ebx
: P- m- l' w9 p8 k- r: i* L* M; ~: T) C - .text:24BC2CDC mov ebx, ds:LoadLibraryA
; i- m0 n. ]2 [) G0 _3 f f - .text:24BC2CE2 push esi3 s* Z: @# Q9 j8 J. w
- .text:24BC2CE3 push edi" i7 F, d2 e+ q! U
- .text:24BC2CE4 xor edi, edi
& o( C0 Y; C/ N* ^0 j( h0 m - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
# f8 W5 C& e9 u( z - .text:24BC2CEB mov [ebp+var_8], edi4 ^' M" ~5 ~8 Q5 r! j& k
- .text:24BC2CEE mov [ebp+var_1C], edi
2 S) J# \' s u% N4 \ - .text:24BC2CF1 mov [ebp+var_C], edi: V' D% [. K2 G* M r. F
- .text:24BC2CF4 mov [ebp+var_10], edi8 n) m2 D6 w, H( \1 N
- .text:24BC2CF7 mov [ebp+var_18], edi
; k7 ~$ a; |! D - .text:24BC2CFA call ebx ; LoadLibraryA
' R/ ?6 k8 B9 _, _; } - .text:24BC2CFC mov esi, eax
$ Y/ t3 k- I+ q: y4 k - .text:24BC2CFE cmp esi, edi
# H5 [5 G8 U( ?/ v* o4 K - .text:24BC2D00 mov [ebp+hLibModule], esi+ A( H9 g* `$ t( A I
- .text:24BC2D03 jnz short loc_24BC2D0F
% @" X, \9 c1 [9 ], E. C3 E% r - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
5 A6 }3 \. n2 i% T+ X4 p1 e; q - .text:24BC2D0A jmp loc_24BC2E6D
8 ]- g* c: a9 D3 `# J1 r8 y+ | - .text:24BC2D0F ; ---------------------------------------------------------------------------
8 p0 ]* ^0 Z9 V3 T- [& S4 d3 A - .text:24BC2D0F3 G) P5 c* _9 S" x. b& [! G% c
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j: f+ t$ R) i# N: }1 h
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
; [; e& v" b( ~1 T - .text:24BC2D14 push esi ; hModule! M& w6 f7 b5 I8 W
- .text:24BC2D15 call ds:GetProcAddress" I! O8 K5 t3 C4 `
- .text:24BC2D1B cmp eax, edi
5 _% n- F+ o! N/ \# z/ g - .text:24BC2D1D jnz short loc_24BC2D30
3 Q) H G6 b1 B, o - .text:24BC2D1F push esi ; hLibModule
7 A2 s+ r6 J3 c# @% y - .text:24BC2D20 call ds:FreeLibrary6 W5 b! L5 _, S5 T% k, B
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
6 n5 C) R4 U/ } - .text:24BC2D2B jmp loc_24BC2E6D
7 I1 r: Z H# M - .text:24BC2D30 ; ---------------------------------------------------------------------------
0 `. Z6 n& Z" C# U; K, I8 }3 w - .text:24BC2D30& i) N2 [" G; W- ~! z% e. f' B7 P
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
3 M7 R& v$ I% F# S - .text:24BC2D30 lea ecx, [ebp+var_8]4 r- g9 H3 B! s0 U
- .text:24BC2D33 push edi" ]! V8 K- }- K5 T& u B; u
- .text:24BC2D34 push ecx& a1 }$ W5 c4 a
- .text:24BC2D35 push edi/ p) t& f y$ s, h7 w
- .text:24BC2D36 call eax: ?0 Z( `2 j6 z: y4 `! k
- .text:24BC2D38 test eax, eax
0 w7 z6 Z" i% c% r/ [7 H6 I - .text:24BC2D3A jge short loc_24BC2D4D
. G6 y: t! y" q' M# b, w: m - .text:24BC2D3C push esi ; hLibModule& E0 J/ r/ }, G2 }
- .text:24BC2D3D call ds:FreeLibrary& S; {6 c5 m- Q) v9 s4 B7 V) v* C
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
3 R/ ^* {! a* r# C2 H - .text:24BC2D48 jmp loc_24BC2E6D
! C* s6 b( i, z; N6 m( e* I+ b- Y9 w& ^ - .text:24BC2D4D ; ---------------------------------------------------------------------------( V9 }" Z' F/ A; e& @5 {) U
- .text:24BC2D4D! P8 r4 A- M- c, }
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j- {( E' B8 q1 V
- .text:24BC2D4D mov eax, [ebp+var_8]! R4 c( E# {0 D" n" }" ^9 q
- .text:24BC2D50 lea edx, [ebp+var_1C]2 j5 ^$ h' W5 t% x) h: m% U
- .text:24BC2D53 push edx
3 q- G1 t% B, |7 j - .text:24BC2D54 push offset unk_24BC4470: V* s2 n9 I' D& o
- .text:24BC2D59 mov ecx, [eax]
+ k2 e6 }. B; n) Q1 K' k( H" R2 y6 R - .text:24BC2D5B push eax6 K- [' g* I* O3 O3 X
- .text:24BC2D5C call dword ptr [ecx]- r* Q2 C4 h7 K3 A
- .text:24BC2D5E test eax, eax, t+ y! G- B$ q; y9 s
- .text:24BC2D60 jge short loc_24BC2D87
1 Y3 k% L5 c# H( X3 Q! x$ ] - .text:24BC2D62 mov eax, [ebp+var_8]( v+ d1 b5 ~& u; R% @6 \
- .text:24BC2D65 push eax
" L7 X1 L8 G) a3 X! B - .text:24BC2D66 mov ecx, [eax]
% m3 Q9 h2 V' z5 N3 W. K - .text:24BC2D68 call dword ptr [ecx+8]
" |4 q- S* v. y2 D0 T t - .text:24BC2D6B push esi ; hLibModule
/ A& i* Q1 L+ Y# x0 v$ e; u5 L/ i! u - .text:24BC2D6C call ds:FreeLibrary
3 `( d) a ]3 c% p9 ~. v" f: K" O - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
5 U& `. I) n/ P! h7 O1 m - .text:24BC2D77 call ds:OutputDebugStringA( T0 j Z. R: A9 m9 ^" ]2 c
- .text:24BC2D7D mov eax, 100h1 p7 o5 { L- i$ X8 Z9 d0 W
- .text:24BC2D82 jmp loc_24BC3011
" z1 Y; D& z3 N - .text:24BC2D87 ; ---------------------------------------------------------------------------
; I- t" f/ G8 P; S9 Y7 P - .text:24BC2D87
# I1 [4 U/ o" B - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j9 N% Y5 [+ z8 W4 ^ R' ]* t" m- A
- .text:24BC2D87 mov eax, [ebp+var_1C]) D t4 a. W3 x: r* W3 c7 ^9 n( T
- .text:24BC2D8A push eax
+ p9 b- ~+ W" C2 g, b8 d6 c+ L - .text:24BC2D8B mov ecx, [eax]
! `. w2 W& l: O' P5 ?$ t - .text:24BC2D8D call dword ptr [ecx+8]
, g' `; j: ]) E* b1 y% [) | - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"1 @8 s# p9 f. f+ K
- .text:24BC2D95 call ebx ; LoadLibraryA5 g- v& g" {' q4 D- M( }
- .text:24BC2D97 mov esi, eax
! _, v7 Z: c' x0 R7 Y - .text:24BC2D99 cmp esi, edi6 }) X4 C/ d5 z3 S4 K" D
- .text:24BC2D9B jnz short loc_24BC2DB6
3 u* G6 Z; q) K' F - .text:24BC2D9D mov eax, [ebp+var_8]) w3 f* U. f* u# Z! z
- .text:24BC2DA0 push eax
" |. f$ N. i; v- h+ R* J8 h - .text:24BC2DA1 mov ecx, [eax]
( z3 @" O2 z. n) e - .text:24BC2DA3 call dword ptr [ecx+8]9 x9 g4 [% Q& x2 a w3 w9 N6 q/ k7 Z
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
! C. @' T O- l* t ` - .text:24BC2DA9 call ds:FreeLibrary
! S' U0 a: q" h& s - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
: d9 [; v/ d$ h: W+ B1 N9 L - .text:24BC2DB4 jmp short loc_24BC2DE2' {7 C- e2 c2 _0 l4 q$ b
- .text:24BC2DB6 ; ---------------------------------------------------------------------------
* r( _# H- d3 I' y) ^0 y - .text:24BC2DB6+ }& q& [4 e, K4 ?* z
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
' M% f1 H- v- x5 S - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
1 P0 {, f) B9 e! O- o3 M# j - .text:24BC2DBB push esi ; hModule
# n6 }6 G4 S) } - .text:24BC2DBC call ds:GetProcAddress
+ ?0 x$ R$ l0 S0 f; i6 g8 l8 L - .text:24BC2DC2 push esi ; hLibModule
4 G* N! h; S& M* V5 [$ t% t9 N - .text:24BC2DC3 mov esi, ds:FreeLibrary
5 c" }1 a! X" c/ i+ ^( ]4 l - .text:24BC2DC9 test eax, eax1 a; N9 D1 R4 b0 M: P e
- .text:24BC2DCB jnz short loc_24BC2DF2! s' i( v, B- H' V% ?
- .text:24BC2DCD call esi ; FreeLibrary
7 M7 `2 R2 D( A1 ^+ L/ q( i - .text:24BC2DCF mov eax, [ebp+var_8]6 [; D: a9 w" n, o0 A3 q! z$ |
- .text:24BC2DD2 push eax
' h: j& k( c7 f6 D9 ^: s - .text:24BC2DD3 mov ecx, [eax]7 H" ^& l. b" U5 Z `5 p
- .text:24BC2DD5 call dword ptr [ecx+8]
' Z/ M+ }4 Y& M7 Y3 D) K - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule- P" v w4 P, H& T1 B
- .text:24BC2DDB call esi ; FreeLibrary
/ m$ J" g% Q9 M: J: z - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...$ y" F3 b: L8 H0 E9 l: c; K4 @0 J* E
- .text:24BC2DE2
6 t3 z- |+ U# b! i" C - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
2 ?; U4 u6 v8 n5 E" _* S* X0 ^ - .text:24BC2DE2 call ds:OutputDebugStringA
" A* k% k! g* k4 t* w: [, E - .text:24BC2DE8 mov eax, 200h
9 w Y/ n3 _! z! j( z - .text:24BC2DED jmp loc_24BC3011
8 L1 |) P) @# H5 F% P - .text:24BC2DF2 ; ---------------------------------------------------------------------------7 a3 u+ v% E( b$ S( @
- .text:24BC2DF2+ G- Q9 s E* O, B# E- ]- g
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j9 ^5 [8 } J+ G: A9 g
- .text:24BC2DF2 call esi ; FreeLibrary, q0 M" H# C7 w/ j A' O% w
- .text:24BC2DF4 push 6Ch ; Size
* `$ N6 v4 \1 N; d% j- d2 M6 d/ E/ } - .text:24BC2DF6 lea eax, [ebp+Dst]
+ q7 v3 x; k( L; h# G* P - .text:24BC2DFC push edi ; Val3 Q z9 {2 z$ b9 z) M
- .text:24BC2DFD push eax ; Dst
7 t4 Q* a9 e: S$ a' c - .text:24BC2DFE call memset3 @9 d) Y. c2 a3 S. Y) D. V
- .text:24BC2E03 mov eax, [ebp+var_8]
$ a. g/ m _. }" Q) N) H - .text:24BC2E06 add esp, 0Ch
; \) Z# p7 K: u: r# W - .text:24BC2E09 mov [ebp+Dst], 6Ch
7 w0 E& @4 R8 c! ^$ J1 R6 u; p - .text:24BC2E13 mov [ebp+var_8C], 1
# `; {2 U+ x6 m/ L - .text:24BC2E1D mov [ebp+var_28], 200h
: O9 K- f5 c& r: Z0 l ^: L# Y - .text:24BC2E24 mov ecx, [eax]
, _; b. o/ m. j1 ?8 h - .text:24BC2E26 push 8
. Z- `9 H; {! ^6 C - .text:24BC2E28 push edi3 q* b0 m3 O) F, e; T) P6 I" T
- .text:24BC2E29 push eax
, X& @' q/ E, \: w# f. N* a } - .text:24BC2E2A call dword ptr [ecx+50h]0 n S7 G S& C6 H2 T f" R+ H3 Z4 m
- .text:24BC2E2D test eax, eax
- ]; N0 J' J6 T( O, |- n* m - .text:24BC2E2F mov eax, [ebp+var_8]+ [0 G1 G+ W+ j
- .text:24BC2E32 mov ecx, [eax]) R5 W0 \" `. B( M4 F
- .text:24BC2E34 jge short loc_24BC2E46
2 @( i+ e0 W& u, |! t9 ?" H - .text:24BC2E36 push eax7 W$ w5 X( J! v. K* J
- .text:24BC2E37 call dword ptr [ecx+8]; n9 M! {3 D% W
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule# H' G' l% Y. L( L, W
- .text:24BC2E3D call esi ; FreeLibrary
& Q$ v% B1 D/ o2 O2 l/ |( ? - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
) J! S/ U) J1 B& _ - .text:24BC2E44 jmp short loc_24BC2E6D. C. L6 p7 `- l# f! i2 b& {3 l
- .text:24BC2E46 ; ---------------------------------------------------------------------------: `5 \$ L4 Q V4 V+ c: F
- .text:24BC2E46
2 f# b6 o! F: Q2 |! M$ D' l - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
+ a6 s0 b; H1 P/ z5 j l - .text:24BC2E46 lea edx, [ebp+var_C]
: }/ n4 o( p4 F1 @8 n% O - .text:24BC2E49 push edi* X/ ?7 A& G! H7 I' k* o
- .text:24BC2E4A push edx
+ u1 @# P& S1 }5 u. K' P - .text:24BC2E4B lea edx, [ebp+Dst]2 _% |9 ]% f) @* a! C# `
- .text:24BC2E51 push edx! @1 n) ]* \' {& E2 ?7 V+ O8 p
- .text:24BC2E52 push eax
* Q, x1 j7 B3 Y - .text:24BC2E53 call dword ptr [ecx+18h]7 J6 [9 G y; M2 x: K1 a; G
- .text:24BC2E56 test eax, eax
" d4 @; _9 N$ Z( ` - .text:24BC2E58 jge short loc_24BC2E7A/ R5 w3 L2 T; O$ S
- .text:24BC2E5A mov eax, [ebp+var_8]& ^0 w+ p$ U9 ~7 c
- .text:24BC2E5D push eax
% j/ Z' r% S, r+ V, Y2 H8 P0 y - .text:24BC2E5E mov ecx, [eax]; D# d0 ]6 d& `+ i, y
- .text:24BC2E60 call dword ptr [ecx+8]% q3 {/ W' E% B
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
$ ]9 ~7 i% H. \/ P" S - .text:24BC2E66 call esi ; FreeLibrary
+ H2 m, p# t+ v* J* n/ i0 t - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"; ]! T' u% p/ Z; G
- .text:24BC2E6D
' N. [* V `7 g7 _ - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
& C/ B& V# T n% w) Q3 T - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
R9 S5 M1 x5 R; K - .text:24BC2E6D call ds:OutputDebugStringA
/ J) ?' @6 O! G! j# s - .text:24BC2E73 xor eax, eax
, S- x" r4 a+ ? - .text:24BC2E75 jmp loc_24BC3011
0 _" e1 p/ c" y* U8 \5 _ - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 : f/ Y/ w' A" x6 E
+ Y2 N5 e& e4 _5 \) H1 w
8 }$ C9 W$ e# |" C% _ |