这游戏以前分析过,本贴再写得详细一些。$ H+ @' L B9 n" R# i+ X4 u
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,8 }% l$ i. f$ |! X( y! [ M6 p, m
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
3 ]' ]0 M# V8 P& ]' K |& D5 G6 t4 c3 m7 W
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.7 y+ A' L) U* l+ Y
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;6 l' f1 L- `! e# P1 z
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;6 j" t; ^9 ]' M3 h
- STDMETHOD_(ULONG,Release) (THIS) PURE;6 M% |! ~/ v" R
- STDMETHOD(Compact)(THIS) PURE;2 a9 Z7 ^8 ~; Q- a5 H/ Q5 @
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;* H$ b9 A# l4 w2 F- s
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
7 v7 _$ |6 R4 W- {1 X0 i# C) i - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
! ^$ Y* [, o8 P5 d; x以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 * E3 T E* Q+ g3 O! }( M
" r$ V6 S6 u: Z+ |
% `& D4 `4 H: C8 ~. i, ]) s9 y( o, J9 `9 `1 S% H
- ' Y" f& M3 n9 n# U( d
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
7 b9 Q1 p: D8 V6 w' ^. n, E5 s - .text:24BC2CD2
0 \, m$ v" o j x5 @ - .text:24BC2CD2 ; Attributes: bp-based frame+ U/ B4 p' Z/ z1 O9 Q5 |; P
- .text:24BC2CD2! v* f' Y! @+ O. @4 L. Y
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
+ N# ~- {4 m6 a3 r6 @ - .text:24BC2CD2
, d) T. U K4 ^# h9 ~7 S - .text:24BC2CD2 Dst = dword ptr -90h, `3 w. w2 O! S( ~2 E/ v9 v
- .text:24BC2CD2 var_8C = dword ptr -8Ch0 j4 S; Z6 T2 z# z3 D
- .text:24BC2CD2 var_28 = dword ptr -28h/ t) G/ H* I' _, l: p' y
- .text:24BC2CD2 var_24 = dword ptr -24h3 t7 a& j$ ~/ ~2 B, C! r2 I) L
- .text:24BC2CD2 var_20 = dword ptr -20h
4 A$ i2 g3 D6 H: T - .text:24BC2CD2 var_1C = dword ptr -1Ch" \$ |9 e- f% I! P' P1 I- d2 {
- .text:24BC2CD2 var_18 = dword ptr -18h( k0 O8 X5 [3 a1 e8 p, @
- .text:24BC2CD2 ppv = dword ptr -14h( l$ A1 l9 r- s6 s
- .text:24BC2CD2 var_10 = dword ptr -10h4 }5 p2 H1 Z/ S1 d
- .text:24BC2CD2 var_C = dword ptr -0Ch) w3 `8 |' J, Q1 S+ P
- .text:24BC2CD2 var_8 = dword ptr -8
/ u/ x2 t5 u. P - .text:24BC2CD2 hLibModule = dword ptr -4( {' a1 ]6 F2 Z& D; U* K. _
- .text:24BC2CD2
! f2 E# g7 V* L" ? t - .text:24BC2CD2 push ebp
6 h3 s( D$ I+ U - .text:24BC2CD3 mov ebp, esp' L6 U. P/ D% W1 r- d" ~+ o- G; y
- .text:24BC2CD5 sub esp, 90h
" O: U/ k5 m ~5 T - .text:24BC2CDB push ebx
$ U" i: ~! N, y; X3 z - .text:24BC2CDC mov ebx, ds:LoadLibraryA
. R$ ?5 }& O2 p) b6 O$ x( f - .text:24BC2CE2 push esi2 n! u) Y6 S' `' I( a$ R" z; Q& H
- .text:24BC2CE3 push edi
( z% K, Y9 k5 O6 ~ - .text:24BC2CE4 xor edi, edi9 {. X( Z* A+ Q Q& h
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"* O( P5 K4 L( O- _, T
- .text:24BC2CEB mov [ebp+var_8], edi" [, M1 h6 o2 _& {/ c
- .text:24BC2CEE mov [ebp+var_1C], edi7 ]* w# _# R) q. p; c
- .text:24BC2CF1 mov [ebp+var_C], edi1 n# K& {/ l5 @. O1 ]
- .text:24BC2CF4 mov [ebp+var_10], edi/ K1 p' M( \9 N. e, }( C
- .text:24BC2CF7 mov [ebp+var_18], edi
; d6 ]# ]. a3 P8 k, U5 F - .text:24BC2CFA call ebx ; LoadLibraryA
5 x% c/ Z8 n9 ?7 t - .text:24BC2CFC mov esi, eax
& U2 V1 x+ C1 e$ z- T - .text:24BC2CFE cmp esi, edi0 J) f: w. p% g0 k6 a
- .text:24BC2D00 mov [ebp+hLibModule], esi
' M" n4 s0 l0 ]/ A2 d - .text:24BC2D03 jnz short loc_24BC2D0F
0 m9 F7 v( B4 |4 o( g - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
$ h F/ ]( f! ^8 }1 }0 d - .text:24BC2D0A jmp loc_24BC2E6D6 T0 E) l4 O- u) Y1 `! q3 i9 O
- .text:24BC2D0F ; ---------------------------------------------------------------------------
4 M8 c# Q. ]8 Z" H: _ - .text:24BC2D0F2 D* ~4 \5 }+ f
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j. z0 g; U8 s4 L% n# q* D4 [% n% G2 g
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
6 r3 l* s9 c! c/ K% l- l- ? - .text:24BC2D14 push esi ; hModule, W1 V6 s2 G3 m2 m
- .text:24BC2D15 call ds:GetProcAddress @ X4 _/ S$ T" u4 E, Z7 W7 T! ~8 i
- .text:24BC2D1B cmp eax, edi
) H# S4 o0 E+ I - .text:24BC2D1D jnz short loc_24BC2D308 T: E0 h* ^: [
- .text:24BC2D1F push esi ; hLibModule; S% b' i) G" t3 Y5 s" u) ]. }
- .text:24BC2D20 call ds:FreeLibrary& ~: z8 ]" q* x5 |; ^0 k
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...- G- a$ J( N8 i2 q1 n- d3 e
- .text:24BC2D2B jmp loc_24BC2E6D9 d% b E$ [3 W3 |6 n. x
- .text:24BC2D30 ; ---------------------------------------------------------------------------# I6 m8 @: ?( b3 |. O4 t9 L
- .text:24BC2D30. h0 s) N4 T1 D( I2 p) t
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j5 {' {, p5 _; ]. ]
- .text:24BC2D30 lea ecx, [ebp+var_8]
0 k5 J4 R1 {5 @2 j2 ` - .text:24BC2D33 push edi
6 K! e* P" A% ?. D$ y# |& w8 T - .text:24BC2D34 push ecx
0 P( f- \1 P) b0 _' m - .text:24BC2D35 push edi
p2 u v1 ^: c1 n; t - .text:24BC2D36 call eax o6 Q. ^; d/ v2 v e* ~! ~! Q( D
- .text:24BC2D38 test eax, eax% w3 E0 w( y' }" l( W1 ^
- .text:24BC2D3A jge short loc_24BC2D4D
/ l5 K1 a8 `9 s - .text:24BC2D3C push esi ; hLibModule
/ k/ @0 x; x5 ]5 F5 S+ ^ - .text:24BC2D3D call ds:FreeLibrary4 c) |( v: e% `# ^- I
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"2 t0 y: b# r% }) A
- .text:24BC2D48 jmp loc_24BC2E6D
; I1 f2 U {. L8 D! s - .text:24BC2D4D ; ---------------------------------------------------------------------------4 L/ l# U; \& i o7 G' U$ k! ]
- .text:24BC2D4D0 D0 T9 L) T, j) `1 q2 \# J6 [
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j) e1 w& K- o8 v9 H( @
- .text:24BC2D4D mov eax, [ebp+var_8]
( j8 z0 j6 a1 o; O: R' D7 u - .text:24BC2D50 lea edx, [ebp+var_1C]
1 z' M r+ s" J3 H. m( M5 m! @ - .text:24BC2D53 push edx
9 |" |$ ?' q l2 \( M/ ^$ b _ - .text:24BC2D54 push offset unk_24BC4470+ O% D8 H9 y, {1 U! b# s5 }+ e* {
- .text:24BC2D59 mov ecx, [eax]5 O. A9 z% \( f) k
- .text:24BC2D5B push eax. w+ M9 X" C5 K
- .text:24BC2D5C call dword ptr [ecx]' g$ @( f$ w6 `1 R& r
- .text:24BC2D5E test eax, eax
8 V/ z& N* O* a+ A$ ` - .text:24BC2D60 jge short loc_24BC2D87( @ i4 B3 z5 f/ _& E
- .text:24BC2D62 mov eax, [ebp+var_8]
+ o* L' e- G3 n3 I$ D - .text:24BC2D65 push eax2 ]* v5 M6 X4 T% {8 S0 t
- .text:24BC2D66 mov ecx, [eax]
0 Y+ F o7 b. @- u! N - .text:24BC2D68 call dword ptr [ecx+8]
5 c& O9 q4 Y- }4 R& j - .text:24BC2D6B push esi ; hLibModule% M7 [/ J2 M& ?/ q
- .text:24BC2D6C call ds:FreeLibrary5 ?$ [1 l- W- z9 Z/ O+ k
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
, \5 N7 n; @5 z; m - .text:24BC2D77 call ds:OutputDebugStringA
) Q. u* ]0 d3 Z. \* w* x p - .text:24BC2D7D mov eax, 100h
2 C" k# Z5 a6 p; [ - .text:24BC2D82 jmp loc_24BC3011
7 n4 A: W/ b- K* B2 t - .text:24BC2D87 ; ---------------------------------------------------------------------------
/ F% p4 q* |# p+ \9 r* B" E7 a: b - .text:24BC2D87& P. {3 D2 R8 h* l o& i
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
6 D/ X1 x; O* X3 W - .text:24BC2D87 mov eax, [ebp+var_1C]
0 j5 v, a9 R X7 y' P- r; y - .text:24BC2D8A push eax
) [+ I! g0 S5 q, ~# x- ^( c - .text:24BC2D8B mov ecx, [eax]
X3 M% |, s7 K7 s& J$ X+ B6 Q - .text:24BC2D8D call dword ptr [ecx+8]1 c6 l. U1 V s' K
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"$ s5 K$ o' F' w
- .text:24BC2D95 call ebx ; LoadLibraryA
" t6 g; q7 c# f" x- ` - .text:24BC2D97 mov esi, eax
+ _/ o. [8 F0 r! r, \ - .text:24BC2D99 cmp esi, edi
5 I/ }2 d2 i+ g" ?' M - .text:24BC2D9B jnz short loc_24BC2DB6
& b1 R- n2 X* V) g - .text:24BC2D9D mov eax, [ebp+var_8]
+ m1 E" H/ j9 X$ |/ C3 K! ] - .text:24BC2DA0 push eax# E2 Z3 t6 Y, S- l F* {1 M
- .text:24BC2DA1 mov ecx, [eax]
3 D) b% U; |9 q" w) ^7 u, B - .text:24BC2DA3 call dword ptr [ecx+8]( j s3 \: Y) d
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
8 |/ q/ p' T( Q7 w" q - .text:24BC2DA9 call ds:FreeLibrary3 @, c* o; s3 b7 D* H
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
; l, H( _( s/ j- k [ - .text:24BC2DB4 jmp short loc_24BC2DE2
: o& ?; \& c7 V# V - .text:24BC2DB6 ; ---------------------------------------------------------------------------
_( j9 R/ U$ I" j3 x: w3 k - .text:24BC2DB6
) l$ c) Q, B6 ]$ G! q) m - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
8 d( o. @5 p' ]# A a - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
9 S0 X: a8 X+ u* A# j) S - .text:24BC2DBB push esi ; hModule
1 g0 F, d6 o0 E( L - .text:24BC2DBC call ds:GetProcAddress
" Y1 E" L( E2 H2 S1 n3 y - .text:24BC2DC2 push esi ; hLibModule( n l. B! i: l; [! Y- w( U
- .text:24BC2DC3 mov esi, ds:FreeLibrary
" I4 |# U& T! Z1 g, T {; i - .text:24BC2DC9 test eax, eax
3 b$ z1 R4 b. A - .text:24BC2DCB jnz short loc_24BC2DF2/ @, _; V, L( M
- .text:24BC2DCD call esi ; FreeLibrary0 P6 C8 l2 y. D* W9 ?
- .text:24BC2DCF mov eax, [ebp+var_8]# |# o6 K/ h9 u
- .text:24BC2DD2 push eax W# `6 p' `3 i, p4 r- V# v
- .text:24BC2DD3 mov ecx, [eax]
) l8 Y4 u' b- b! H - .text:24BC2DD5 call dword ptr [ecx+8]9 ~) F/ W* H* X }% d9 |9 `
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule; k/ {8 S, C6 A; u! {
- .text:24BC2DDB call esi ; FreeLibrary
8 k7 f, Y5 X7 S3 }/ w4 T+ y- l0 g5 { - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...1 z" v* ~* U" H/ l
- .text:24BC2DE24 r( [4 L5 T, K# R/ q6 q; e
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
a3 B" ~+ [* E3 L4 B( `& k5 T - .text:24BC2DE2 call ds:OutputDebugStringA" a" ^8 K& b- R$ t5 ^
- .text:24BC2DE8 mov eax, 200h* H# K$ B3 U$ v' Y
- .text:24BC2DED jmp loc_24BC3011) ~! a" `/ d8 m# r6 |0 O8 L$ O
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
0 k& v0 Q: i( r; b - .text:24BC2DF2 D( a2 {/ P) k. q# \* L. x
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j1 D% A+ X k9 ~ h8 j" W. {2 [; h, [
- .text:24BC2DF2 call esi ; FreeLibrary
) g# [8 d) O q: R - .text:24BC2DF4 push 6Ch ; Size
+ T# @/ ]& _! R% Y% ?& p; \ - .text:24BC2DF6 lea eax, [ebp+Dst]: c9 w, Q1 M! w. t( K( u) [6 E! C8 v
- .text:24BC2DFC push edi ; Val
" C+ p* G- p" A8 _; z% h* a9 M - .text:24BC2DFD push eax ; Dst: a; O+ i/ O% J; \7 w# d( m
- .text:24BC2DFE call memset
. Y5 J6 Y1 i" c% }! F - .text:24BC2E03 mov eax, [ebp+var_8]1 l! p+ i8 l( D" M+ z9 H$ ]4 ?
- .text:24BC2E06 add esp, 0Ch! r) @- o+ A' ^" H9 K( |2 |+ b
- .text:24BC2E09 mov [ebp+Dst], 6Ch- P7 q$ F* r+ D& F; G6 b7 D$ R
- .text:24BC2E13 mov [ebp+var_8C], 1
( I" U6 M5 T9 L) P) B: C; Z - .text:24BC2E1D mov [ebp+var_28], 200h
; n( R8 N# _0 n. f( f - .text:24BC2E24 mov ecx, [eax]
& [0 W. g7 [! e2 D+ g! J - .text:24BC2E26 push 8* ~( ]9 c: I: `+ G
- .text:24BC2E28 push edi; G# A: [: h. Y7 \) ], A
- .text:24BC2E29 push eax4 ~" L. Z# \+ o
- .text:24BC2E2A call dword ptr [ecx+50h]1 P/ x7 i O$ o! R& G: b+ h
- .text:24BC2E2D test eax, eax0 p2 B1 Q b+ m
- .text:24BC2E2F mov eax, [ebp+var_8]& q6 J% s3 E( N7 w3 \5 N, D8 c
- .text:24BC2E32 mov ecx, [eax]: \' i* z0 D" G6 F) |1 @# i M
- .text:24BC2E34 jge short loc_24BC2E46# O/ E# `& Y. T& Z8 v
- .text:24BC2E36 push eax
5 @, ^' Q7 `/ g" V$ t7 u# ? - .text:24BC2E37 call dword ptr [ecx+8]
_5 R9 Z8 Z" J" u1 x - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule: i* q4 z+ W0 P/ s4 |
- .text:24BC2E3D call esi ; FreeLibrary
5 h" s/ b9 e4 k c0 _5 A/ o! Q - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
% T( H4 ^4 w/ O# ~% P9 L - .text:24BC2E44 jmp short loc_24BC2E6D
7 T+ R3 ^# S4 b! d7 r$ u, I, z - .text:24BC2E46 ; --------------------------------------------------------------------------- M: b% t7 q3 ~$ r
- .text:24BC2E46
6 ^! E# h* ]. K - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
! F! \7 `) a$ J9 Q ^ - .text:24BC2E46 lea edx, [ebp+var_C]
5 D' W/ x3 w, r" A - .text:24BC2E49 push edi
; y4 k* w0 ~& ~( b! z. W) }0 `$ ^1 g - .text:24BC2E4A push edx/ O+ E$ U" r6 X6 w! q2 k* U& b
- .text:24BC2E4B lea edx, [ebp+Dst]
: C* L: Q3 |8 R+ W0 g; T3 U# D - .text:24BC2E51 push edx
R$ P6 `- m; l1 x - .text:24BC2E52 push eax, I( @. O. ]5 O `/ r$ R: f/ S- {1 I
- .text:24BC2E53 call dword ptr [ecx+18h]
0 T6 y1 E7 Q! p* } - .text:24BC2E56 test eax, eax! ~! j; P! Y! r: N* f
- .text:24BC2E58 jge short loc_24BC2E7A
! V4 C# k3 e6 m$ D8 E& V7 u2 B - .text:24BC2E5A mov eax, [ebp+var_8]
9 t" P2 w3 ?- K x2 } - .text:24BC2E5D push eax
; t8 b& g- H) ~, g$ T( y( G - .text:24BC2E5E mov ecx, [eax]
% L9 M8 t `& W4 Q, U1 p9 w- F - .text:24BC2E60 call dword ptr [ecx+8] f# |+ [* W! X" J
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
' e: t# A0 c5 _. D+ X" D) F9 v9 m - .text:24BC2E66 call esi ; FreeLibrary& z& Z: H1 X( r( `. n- @& q
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"9 n2 r6 y8 K# [: a2 ^
- .text:24BC2E6D* }) ^) P1 D* T( q
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
) l" b' d& }' a: Y. N2 q' l - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...; S- I. U6 H2 w
- .text:24BC2E6D call ds:OutputDebugStringA
' R6 R0 R8 D8 l9 J - .text:24BC2E73 xor eax, eax
0 A+ K3 H( ^! ^+ n# m- q - .text:24BC2E75 jmp loc_24BC3011
# E6 `- q, m5 i! X& g' I1 ^7 l, s- u - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
( r( a/ Y- K% Y1 O5 I7 Z3 f9 `' @* o2 p' m8 d* ?8 b
, B* T4 }' j! m2 J d) T |