这游戏以前分析过,本贴再写得详细一些。
# |- v7 E) a$ s& g9 h这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
/ O5 @+ C3 C* t) M( A注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。& @) W' u& h% q6 P# d' z0 ]
9 A* Q3 K- ?$ C- T! l参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
; N7 h* \7 }4 ^" X( m- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
# u; G7 ` k6 L: O8 }# M - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
5 L, v" V; f+ \2 U - STDMETHOD_(ULONG,Release) (THIS) PURE;' q% `1 b, j/ O) y" Y2 n) K) C
- STDMETHOD(Compact)(THIS) PURE;
3 N5 L& W' k; E B5 H - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;3 y9 a8 |! f2 i7 C) _" D% u; r
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;( J8 j) j! E9 y6 m
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
& Z& d5 J8 u) s3 q8 O7 J$ F% W以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
/ O5 e- o* u4 b7 d, w
+ H& B" } W( w- x% E0 F) A! O2 A; l$ h- a
2 P" |) k: ]0 Y6 [! G3 m( h0 s. g
! v2 e: o/ N) y- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
' h. r( S% l' N) _3 R - .text:24BC2CD2' N. Y' c: C2 p# L# t3 |. s; O- r
- .text:24BC2CD2 ; Attributes: bp-based frame
- z: q: K9 N/ m - .text:24BC2CD2
/ j2 t1 }% Y% U# a8 ]& }8 L* ` - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p. v4 U- @1 Z8 ?/ z
- .text:24BC2CD2& y( g) }. F' n8 P
- .text:24BC2CD2 Dst = dword ptr -90h
% G( A, D- J, F" ~& \ - .text:24BC2CD2 var_8C = dword ptr -8Ch
; _% E9 ]+ U1 ` ?+ s: b; F% e - .text:24BC2CD2 var_28 = dword ptr -28h8 k# e$ F) A3 ~: l, }: `& Q
- .text:24BC2CD2 var_24 = dword ptr -24h7 z. D6 K6 G+ N+ k
- .text:24BC2CD2 var_20 = dword ptr -20h
1 _* P# Y# I4 A - .text:24BC2CD2 var_1C = dword ptr -1Ch8 n |$ e1 n7 H8 J
- .text:24BC2CD2 var_18 = dword ptr -18h
* R" v: `3 R/ V( ~1 _5 x - .text:24BC2CD2 ppv = dword ptr -14h3 [4 o5 ?0 K5 n. m1 l
- .text:24BC2CD2 var_10 = dword ptr -10h
0 o) ?7 B3 T3 Q% _ - .text:24BC2CD2 var_C = dword ptr -0Ch1 ?5 c, d- k( Z) z8 H0 e; P
- .text:24BC2CD2 var_8 = dword ptr -89 G% ]& a8 x: s- t: U' B! g
- .text:24BC2CD2 hLibModule = dword ptr -4
2 j8 f) h H d9 a - .text:24BC2CD27 [: s; L+ @2 {, Q' c7 r( X/ J2 k& @
- .text:24BC2CD2 push ebp9 ~8 q) a( W/ \; j, ?
- .text:24BC2CD3 mov ebp, esp
+ p: a) J/ @' a1 H" Q - .text:24BC2CD5 sub esp, 90h2 \& D0 w- K1 A# V
- .text:24BC2CDB push ebx2 C7 s! t/ @! W& f2 D/ Y0 c& H6 ` E. @
- .text:24BC2CDC mov ebx, ds:LoadLibraryA$ P/ @7 I, Z2 s, K
- .text:24BC2CE2 push esi
9 e, p" J' A5 t' `* ^ - .text:24BC2CE3 push edi
3 U' h% l. Z+ e1 R - .text:24BC2CE4 xor edi, edi+ @6 L/ d/ ~* p# o6 h6 S
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"% b' P) z8 W, H; T0 N/ `6 q
- .text:24BC2CEB mov [ebp+var_8], edi1 r/ _1 Q. D1 ?* V
- .text:24BC2CEE mov [ebp+var_1C], edi) [# ~$ a+ K0 W4 {$ Z
- .text:24BC2CF1 mov [ebp+var_C], edi% ~7 _6 { o N' T6 f1 N
- .text:24BC2CF4 mov [ebp+var_10], edi
9 `& Z+ D; o( c; X& k - .text:24BC2CF7 mov [ebp+var_18], edi$ i5 K3 s* |% h; Q& o' [# b2 ^- J
- .text:24BC2CFA call ebx ; LoadLibraryA
6 \* L/ ~4 w( J$ O - .text:24BC2CFC mov esi, eax* I# R3 t# c/ c% D
- .text:24BC2CFE cmp esi, edi
/ |! y# i" H( | - .text:24BC2D00 mov [ebp+hLibModule], esi
5 L+ i* D% r9 ?7 `: X - .text:24BC2D03 jnz short loc_24BC2D0F
' } i* h) E" J, g O; P - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
& `2 t7 n) P) o- ]! p; R) C# t - .text:24BC2D0A jmp loc_24BC2E6D
" F/ f( c" n# V( L6 C6 n# g4 I - .text:24BC2D0F ; ---------------------------------------------------------------------------
4 a6 {9 v& \* C - .text:24BC2D0F2 b9 r2 I( b% I& \7 z
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
3 H: j; F( E% [; z3 V - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate") _! N; u1 x! U w$ l
- .text:24BC2D14 push esi ; hModule& i0 D1 Y) U3 Z$ I5 j
- .text:24BC2D15 call ds:GetProcAddress
) t' i) G" t+ G; Q; K+ M9 G9 o/ p# z - .text:24BC2D1B cmp eax, edi' }/ p0 M5 B) h8 w: e
- .text:24BC2D1D jnz short loc_24BC2D30! i& s4 J' ?: E6 s
- .text:24BC2D1F push esi ; hLibModule
; N# s3 e( {$ Z! t6 I- V - .text:24BC2D20 call ds:FreeLibrary) g4 v7 _; B$ @
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
; g+ S- \" U4 m- X- V - .text:24BC2D2B jmp loc_24BC2E6D
1 E. K% C! _, u/ _; g - .text:24BC2D30 ; ---------------------------------------------------------------------------
+ k3 w; y2 J) l- z, w - .text:24BC2D30
9 ^ _; K* L7 p% ^9 J - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j5 g( s$ _5 v# |- D. L# q, Y
- .text:24BC2D30 lea ecx, [ebp+var_8]$ r% |6 K6 _9 {# Z" p3 C# k. \
- .text:24BC2D33 push edi
0 a2 Z" f% A: T$ @0 \ - .text:24BC2D34 push ecx, S* B! r$ B8 d' a: `
- .text:24BC2D35 push edi
" g v" q n* X1 ~. ` - .text:24BC2D36 call eax6 z) W: k$ ~! T9 a! w0 s }
- .text:24BC2D38 test eax, eax8 W. n( V# {' M- S6 ~8 l- A
- .text:24BC2D3A jge short loc_24BC2D4D+ Q4 w( {3 {4 a* Z3 O2 p
- .text:24BC2D3C push esi ; hLibModule
: _$ k" ^7 y4 B7 Y# [ - .text:24BC2D3D call ds:FreeLibrary$ x) R" W& b8 S2 K3 v d0 W
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"% W F( @+ F# G& `1 u; v$ `
- .text:24BC2D48 jmp loc_24BC2E6D& R+ U+ y( [+ X& f( S8 ^/ @1 E: x
- .text:24BC2D4D ; ---------------------------------------------------------------------------
$ A0 }9 n) o! f4 T/ T5 | - .text:24BC2D4D2 }1 z: M0 o4 x, P. ~, Z6 j* a
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j( C" R9 u: a( ?- c0 C4 G
- .text:24BC2D4D mov eax, [ebp+var_8]
! P2 g: @( V2 n - .text:24BC2D50 lea edx, [ebp+var_1C]( V. F. _6 _; n- v, V5 V
- .text:24BC2D53 push edx
: [0 s6 {/ p& X2 t$ q. Z% @ - .text:24BC2D54 push offset unk_24BC4470
# p3 W% a g A2 X) Y, _: ]8 y8 r - .text:24BC2D59 mov ecx, [eax]
3 W( i! [0 S" w9 M3 J0 H0 \& l8 O - .text:24BC2D5B push eax
+ x6 X7 r2 f: T0 k3 U9 e) h - .text:24BC2D5C call dword ptr [ecx]
* [% L4 @% ^' ?5 J9 m, V6 c - .text:24BC2D5E test eax, eax7 n+ e* U5 i" ]* Z3 v) }
- .text:24BC2D60 jge short loc_24BC2D877 q; k h; g1 E. i o2 }5 w
- .text:24BC2D62 mov eax, [ebp+var_8]
, [1 H2 c3 y. y9 M! f - .text:24BC2D65 push eax6 M5 Q: I8 t; {, d5 ` E& }
- .text:24BC2D66 mov ecx, [eax]6 r4 Y: J, T5 O* a2 c1 T
- .text:24BC2D68 call dword ptr [ecx+8]
( f5 h; O5 r1 }( Z0 e! T - .text:24BC2D6B push esi ; hLibModule
1 U3 B* k. Y* g8 C2 J, }' J* W+ }! m - .text:24BC2D6C call ds:FreeLibrary
# `. L3 ^! {: ^% N! I7 V6 X - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"5 q* v8 s! {0 W0 H5 N* S5 `
- .text:24BC2D77 call ds:OutputDebugStringA
+ s; g7 G5 S1 B- L% Q - .text:24BC2D7D mov eax, 100h2 X2 `: H0 N6 W! A% O
- .text:24BC2D82 jmp loc_24BC3011
3 J$ X5 n: _0 r% h$ x, L - .text:24BC2D87 ; ---------------------------------------------------------------------------
3 W3 U, ]0 m1 j( \& B - .text:24BC2D870 N/ t# v2 U% `6 n" X1 U
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
^, W* d7 a* E - .text:24BC2D87 mov eax, [ebp+var_1C]
9 ?( k" G! U' ^3 ] r$ W$ } - .text:24BC2D8A push eax0 L9 t/ D4 Y9 A
- .text:24BC2D8B mov ecx, [eax]
6 Y- O+ L* u6 t - .text:24BC2D8D call dword ptr [ecx+8]
! d! G7 T+ e' z& [; P - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"0 X# u1 p4 e5 ]. A
- .text:24BC2D95 call ebx ; LoadLibraryA! z) O1 @& i2 y; K. ~
- .text:24BC2D97 mov esi, eax
]( r# Y' q$ {! W- n - .text:24BC2D99 cmp esi, edi
" W: \7 \* w7 [, [/ ?; K& N% r( Q - .text:24BC2D9B jnz short loc_24BC2DB6
: w/ C6 ]- L8 R7 J, J& I - .text:24BC2D9D mov eax, [ebp+var_8]
7 ~/ t- H( L/ }/ | - .text:24BC2DA0 push eax- T- h" J7 p" W" V, `3 k2 b
- .text:24BC2DA1 mov ecx, [eax]
4 s/ ~) ?; ]6 r - .text:24BC2DA3 call dword ptr [ecx+8]
& M% ^' x. n* N5 F3 d - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule6 J+ m. o8 f9 H; |' D3 X3 `
- .text:24BC2DA9 call ds:FreeLibrary. H% o2 V" b- m R8 k+ }* w; l
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"4 K2 D6 B: {4 R1 p& N/ z& M
- .text:24BC2DB4 jmp short loc_24BC2DE20 \4 J. K: [0 G, }& w( h4 c
- .text:24BC2DB6 ; --------------------------------------------------------------------------- q6 S. p: I: p0 a* m
- .text:24BC2DB6
( J9 b9 X2 C2 F9 t+ O' v: Q - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j# u( Q" i" d4 J' i* n
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
9 V2 R! v- C0 G% l - .text:24BC2DBB push esi ; hModule
1 |4 g. u' ~. z4 D& c - .text:24BC2DBC call ds:GetProcAddress
0 K ^4 r. B* D% ]* q; b: | - .text:24BC2DC2 push esi ; hLibModule" j0 ^; t" Z0 W2 t& ^, f6 T# I# I
- .text:24BC2DC3 mov esi, ds:FreeLibrary
$ O! D' Z" B5 n+ u1 W, E. y2 z - .text:24BC2DC9 test eax, eax% k* F: E) d# `' A9 l, t
- .text:24BC2DCB jnz short loc_24BC2DF2
+ G4 z7 X8 Z, R; Y! J7 D - .text:24BC2DCD call esi ; FreeLibrary
( D, Q! J/ x9 _, m! m( P" f" ^( ^ - .text:24BC2DCF mov eax, [ebp+var_8]' U& J ^- A; ]' [* e5 y8 G
- .text:24BC2DD2 push eax
: x$ _% R& X5 o7 K - .text:24BC2DD3 mov ecx, [eax]
! ^7 a0 l/ a g' _ - .text:24BC2DD5 call dword ptr [ecx+8], K1 |9 ^9 O5 v# h2 K
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
& w- G, d) v' X8 a1 U' v) i8 L - .text:24BC2DDB call esi ; FreeLibrary* Q# M# J0 h: h
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...! V8 B/ O- x$ s: ]
- .text:24BC2DE2
8 C- O* u! L# z0 Q3 S* n& }& f9 j- ^ - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
x3 \8 u) T( F4 F5 M8 n8 ? - .text:24BC2DE2 call ds:OutputDebugStringA
" \' q1 u- q, z1 Q) H+ Z4 Y. C. [ - .text:24BC2DE8 mov eax, 200h/ ^- b, c m' k) \8 I" x+ Z7 N
- .text:24BC2DED jmp loc_24BC30112 o1 ]9 b) J0 c2 Z# `
- .text:24BC2DF2 ; ---------------------------------------------------------------------------) s; L. Q$ h: `/ o$ \
- .text:24BC2DF2
+ Y% m \. B5 L. ~) G - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
& ?) t" D6 R1 w' F3 ` - .text:24BC2DF2 call esi ; FreeLibrary! h& k; B, i1 |$ t- w4 [$ C: `$ w# {
- .text:24BC2DF4 push 6Ch ; Size
. H) n1 W. G+ I- d - .text:24BC2DF6 lea eax, [ebp+Dst]
3 G4 D* B* R% ~) ^7 E - .text:24BC2DFC push edi ; Val- ~$ [' w7 f: w1 Y1 m; b
- .text:24BC2DFD push eax ; Dst
1 `$ Y- a7 @8 ^3 U' t# Z - .text:24BC2DFE call memset
* D; k; G) j; z, C5 L/ {2 G/ N - .text:24BC2E03 mov eax, [ebp+var_8]4 R, |9 E4 O6 R: C
- .text:24BC2E06 add esp, 0Ch
0 u' ^! X1 T, \1 j+ a- U5 ~8 ~+ g - .text:24BC2E09 mov [ebp+Dst], 6Ch8 C3 a& i" P8 ?, C
- .text:24BC2E13 mov [ebp+var_8C], 17 t# c d- d5 h6 c
- .text:24BC2E1D mov [ebp+var_28], 200h1 N& i1 a' \- q1 N( I3 y( V4 `' m8 }
- .text:24BC2E24 mov ecx, [eax]
# X$ R$ c, m( ~6 A - .text:24BC2E26 push 83 U6 i4 g& @4 o& B8 T' n( ]6 v' P
- .text:24BC2E28 push edi
, p z# `2 O" B9 C8 P - .text:24BC2E29 push eax2 k4 a6 M/ }5 D1 x% b
- .text:24BC2E2A call dword ptr [ecx+50h]1 }" }1 V) r- u# Z
- .text:24BC2E2D test eax, eax- r' R) t; I- ~/ S: f
- .text:24BC2E2F mov eax, [ebp+var_8]2 A1 a9 X3 g2 q5 {$ i) N+ u- E
- .text:24BC2E32 mov ecx, [eax]4 a' q$ |& M) R7 Y
- .text:24BC2E34 jge short loc_24BC2E46
. t# ?1 r6 m. _ - .text:24BC2E36 push eax! v9 u9 F( H1 Y0 A, V: C4 P; r
- .text:24BC2E37 call dword ptr [ecx+8] k" \+ S1 S" [1 V3 c& B
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
9 ^4 T) B5 E4 S) c4 W - .text:24BC2E3D call esi ; FreeLibrary& z4 l M/ h8 K4 e4 ]
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"/ r7 q9 Q9 b2 T
- .text:24BC2E44 jmp short loc_24BC2E6D; b. | d! ]$ E- w& M
- .text:24BC2E46 ; ---------------------------------------------------------------------------: s9 S3 V2 O+ k8 B' b5 S) x0 L
- .text:24BC2E46
" U1 {& R' R& B$ j6 ? - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j( e6 w: C/ F- n+ ~3 h V7 a% a) f
- .text:24BC2E46 lea edx, [ebp+var_C]
9 Q( B" p% i( s$ d+ R - .text:24BC2E49 push edi
; d$ U! s4 o3 E4 c" L - .text:24BC2E4A push edx0 x; _. v6 E# ?9 O( [3 l- X9 M
- .text:24BC2E4B lea edx, [ebp+Dst]
6 [: k. A0 r7 |6 r+ G# ?+ G - .text:24BC2E51 push edx
5 n- A* f' q( e! I* P - .text:24BC2E52 push eax' C& ]/ L- S- ]/ E; t
- .text:24BC2E53 call dword ptr [ecx+18h]
9 r' t8 L1 `6 l0 s7 y1 ]2 W - .text:24BC2E56 test eax, eax
! \$ R9 T6 Z) ?2 v - .text:24BC2E58 jge short loc_24BC2E7A9 h& {% f' M9 a, k( [8 `% h
- .text:24BC2E5A mov eax, [ebp+var_8]' w2 N$ v o) G/ G, k
- .text:24BC2E5D push eax
- f/ S+ S \) r5 | - .text:24BC2E5E mov ecx, [eax]
+ S/ Y, p" T$ L7 D- H - .text:24BC2E60 call dword ptr [ecx+8]
# D- z/ O3 r. S6 m/ \ - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule2 T" M/ ^- R# u- j
- .text:24BC2E66 call esi ; FreeLibrary& o0 _2 e9 C4 H9 ~
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
D# W/ b R. Q# P - .text:24BC2E6D
- q# M G. }6 o! I - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j1 g% `3 K, d9 B& U
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
4 L2 N0 H# m7 }2 j. T3 L% ] - .text:24BC2E6D call ds:OutputDebugStringA; `. u4 U( Z) X7 a! m3 r d
- .text:24BC2E73 xor eax, eax
! f% _+ I7 S) h: u( o$ m7 G - .text:24BC2E75 jmp loc_24BC3011 l! k4 w! L5 r. {2 l
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 2 p0 |3 H5 H5 }" r& h% b# D
& w' t, J( a" B
6 a q" T7 \7 g |