这游戏以前分析过,本贴再写得详细一些。
3 E2 [! {2 u% l7 f1 }这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,3 J# k0 [2 [. X! W5 @; l4 b. F* [1 } M6 Y
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。2 ?' P: |- p8 Z+ p/ J% M
: K Y6 [6 ]9 d参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.7 E$ A3 _4 H) @" O
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;) Z$ U0 F2 m( u) L! q0 y; E
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;: A5 @& p* B. @8 M" o, D
- STDMETHOD_(ULONG,Release) (THIS) PURE;0 r' ~# o$ U8 Q0 Q5 N7 x
- STDMETHOD(Compact)(THIS) PURE;' R, @! S; i) q) r$ u( ]
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
- R# r6 U6 k' q1 B" z5 A - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;5 }9 U/ G9 ] H: ^
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 * b/ z) R! }" I2 a
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
" W) o" _# ?/ ~$ ~. z# p- n: q
$ x3 j4 `7 Q; z: S
0 ]9 u9 ]. u6 w
) \/ G. E5 M) J* f* f+ L- h- & H9 L9 p5 l A5 j( d, ^5 ~
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
" {$ a. e; T( \& J/ W, M) f - .text:24BC2CD21 T+ }/ @7 ?4 e
- .text:24BC2CD2 ; Attributes: bp-based frame
/ J+ N+ _: l, h2 A5 L7 u' ?7 y, P - .text:24BC2CD2
2 |/ e) d2 I# m" ~& q" S - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p4 b9 F/ B/ v* v4 F) n2 v
- .text:24BC2CD23 h: B# Q4 {( r k* U
- .text:24BC2CD2 Dst = dword ptr -90h
5 _7 M( Z- Q; G2 q - .text:24BC2CD2 var_8C = dword ptr -8Ch
; D! q/ y& w2 o( s2 \2 [. S - .text:24BC2CD2 var_28 = dword ptr -28h
% F" j* l6 @5 x) L - .text:24BC2CD2 var_24 = dword ptr -24h3 Z, ?. K' \, _1 O& r1 ~
- .text:24BC2CD2 var_20 = dword ptr -20h
/ w, o. X. R9 y7 Q2 ? - .text:24BC2CD2 var_1C = dword ptr -1Ch9 D& a( H q O8 ]5 f i
- .text:24BC2CD2 var_18 = dword ptr -18h
0 W$ x) m7 q( Z+ |; t8 k$ o( g& y; W' p - .text:24BC2CD2 ppv = dword ptr -14h
. l5 W" H! g* b. e+ ? - .text:24BC2CD2 var_10 = dword ptr -10h
6 J4 y( S" V5 p, I8 L+ C# a- k# } - .text:24BC2CD2 var_C = dword ptr -0Ch
6 I; R; ?& Q5 J - .text:24BC2CD2 var_8 = dword ptr -89 x; G" p8 h9 U% U3 O
- .text:24BC2CD2 hLibModule = dword ptr -4
6 t8 p. ?, Z0 Z. K% d" M0 U7 u - .text:24BC2CD2* t/ p" [6 k' r5 v, d" Y! d6 l) ]
- .text:24BC2CD2 push ebp
- V2 } u5 ]0 N: W4 ]' p7 t/ Z - .text:24BC2CD3 mov ebp, esp
3 g( _7 s: A% J4 s3 N8 E - .text:24BC2CD5 sub esp, 90h' E( u+ |& p% D
- .text:24BC2CDB push ebx; [# a' o. z& D" X k4 Z& A
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
4 e9 p9 e3 a% Z; A! f, k, l1 c - .text:24BC2CE2 push esi
# p9 i3 I( M* q/ D9 O4 s# }8 } - .text:24BC2CE3 push edi* J) b* {+ ~3 ]. m5 ?- J* h p
- .text:24BC2CE4 xor edi, edi% Z7 H9 ~: R) T8 z
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"5 G$ _2 G* c" V6 y+ p
- .text:24BC2CEB mov [ebp+var_8], edi0 J& _# t3 ]( e+ m
- .text:24BC2CEE mov [ebp+var_1C], edi9 ?' V% U% n% k1 q
- .text:24BC2CF1 mov [ebp+var_C], edi" z5 H9 p, N! ^( ]2 r
- .text:24BC2CF4 mov [ebp+var_10], edi
' D% q( j: ~% R - .text:24BC2CF7 mov [ebp+var_18], edi1 B$ n0 P1 x) l+ B, R5 r- U/ E
- .text:24BC2CFA call ebx ; LoadLibraryA& }- K5 a1 f9 Y4 e4 Q- z
- .text:24BC2CFC mov esi, eax
" c" W$ i3 _6 d% { - .text:24BC2CFE cmp esi, edi% a& _/ X0 B1 Y; @6 t8 ]( t
- .text:24BC2D00 mov [ebp+hLibModule], esi
* S/ R' M6 u$ A# L/ T - .text:24BC2D03 jnz short loc_24BC2D0F
7 V: `2 [( o; A3 O8 m - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"/ z+ X4 E9 _6 }7 x: I1 g: g- |# S
- .text:24BC2D0A jmp loc_24BC2E6D& ^7 {( C L$ l' g2 b
- .text:24BC2D0F ; ---------------------------------------------------------------------------
' o* B4 n+ ^/ j" k* ?+ Q$ ?+ E - .text:24BC2D0F
0 D& x5 d, P8 @! D0 f- I f: u - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
# V* f+ ?( E# L - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
! }! ]+ H/ ?0 Y; y+ l; }, \ - .text:24BC2D14 push esi ; hModule
/ s, W3 G. F. u4 d( w - .text:24BC2D15 call ds:GetProcAddress+ V& D; Q( J4 x
- .text:24BC2D1B cmp eax, edi
% k; o1 E1 \4 ?9 c$ a - .text:24BC2D1D jnz short loc_24BC2D30
* Z! C ^- ?9 }' V6 i! G: H, x - .text:24BC2D1F push esi ; hLibModule
! a" K2 A9 ^) w7 ~; v. C - .text:24BC2D20 call ds:FreeLibrary
: z9 O; u0 R- ?/ f - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
: \8 ]: K5 d/ g& J - .text:24BC2D2B jmp loc_24BC2E6D
2 @: B2 u; ^/ a+ R, h - .text:24BC2D30 ; ---------------------------------------------------------------------------
, w( X4 }9 h u8 c: U ] - .text:24BC2D308 }9 P9 V4 Y+ y4 S$ T: D
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
' c% ^- M! Z; y# F+ U - .text:24BC2D30 lea ecx, [ebp+var_8]
& `. c2 {6 ?4 Q: F - .text:24BC2D33 push edi+ b. g2 G* Y" y M1 M& B
- .text:24BC2D34 push ecx. m% K; f. ?0 r
- .text:24BC2D35 push edi
9 D8 y+ a+ v7 { M5 F - .text:24BC2D36 call eax: {' s9 O4 r1 z$ Q. `% y# h
- .text:24BC2D38 test eax, eax
% M, H. v# O( p* f5 x3 c% k9 e - .text:24BC2D3A jge short loc_24BC2D4D; [9 J) r5 [8 }" n8 |
- .text:24BC2D3C push esi ; hLibModule* H. D$ L6 |7 ~ X3 ?1 P
- .text:24BC2D3D call ds:FreeLibrary
$ {6 @- z0 E' v8 Z- h9 X$ X( E. I - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"' M) V/ B" E$ {- |+ j, D7 V: J
- .text:24BC2D48 jmp loc_24BC2E6D& b/ a/ X% t8 M f4 Y' D
- .text:24BC2D4D ; ---------------------------------------------------------------------------
5 k$ u& u+ U8 D6 p - .text:24BC2D4D
3 ?9 H" [& W" m3 _ - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
' a1 q$ C" m2 y9 {3 Q5 s4 W, d% t- @3 y - .text:24BC2D4D mov eax, [ebp+var_8]
]9 u/ V3 v2 B5 ?! n9 S - .text:24BC2D50 lea edx, [ebp+var_1C]
0 f$ s0 p2 R. p( y, c - .text:24BC2D53 push edx1 i- u% G/ i5 j; A$ t" I
- .text:24BC2D54 push offset unk_24BC4470
6 C2 W" r8 d5 q3 M4 U2 v1 y - .text:24BC2D59 mov ecx, [eax]
, _0 `1 E7 U3 M( a - .text:24BC2D5B push eax
( t# o; e, x9 k2 H% ]2 n - .text:24BC2D5C call dword ptr [ecx]. O' Y! }( n$ J! ~
- .text:24BC2D5E test eax, eax
* a# W& P" D+ m - .text:24BC2D60 jge short loc_24BC2D873 F( v' M( {6 P* p4 b9 u
- .text:24BC2D62 mov eax, [ebp+var_8]2 ~6 E |4 a& R/ Z0 l; p. X
- .text:24BC2D65 push eax* o% v8 j5 S% x e2 U; [; ]! ^
- .text:24BC2D66 mov ecx, [eax]
* ` N K" z9 _: I6 b - .text:24BC2D68 call dword ptr [ecx+8]3 ~5 z1 B, F0 R9 h- y. m% E" A; ?; M
- .text:24BC2D6B push esi ; hLibModule9 v: p# l$ n$ D3 t
- .text:24BC2D6C call ds:FreeLibrary
% Q$ j# ?& B: B) H E - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
! y2 E5 f4 h! t3 u& D E - .text:24BC2D77 call ds:OutputDebugStringA
8 ?3 L& x7 y* | - .text:24BC2D7D mov eax, 100h
) l8 k) W! E5 M* c4 P) }2 `! c - .text:24BC2D82 jmp loc_24BC3011
* q0 _9 \$ \5 t4 d/ J+ i0 I& }+ F - .text:24BC2D87 ; ---------------------------------------------------------------------------+ x+ r' f7 Y2 E) l/ l
- .text:24BC2D87+ M! [' E# r' t# H: k
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j. D3 O2 I3 {6 @ j- u0 Z2 y
- .text:24BC2D87 mov eax, [ebp+var_1C]6 T9 R6 r( J4 t* p5 |: H% Q, m
- .text:24BC2D8A push eax8 P# N s, s0 M
- .text:24BC2D8B mov ecx, [eax]/ _) c Q, a2 ?2 U5 X+ Q( q. T; x
- .text:24BC2D8D call dword ptr [ecx+8]
" O7 i& O. |0 R: P0 M - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
0 k N& n2 \- P S - .text:24BC2D95 call ebx ; LoadLibraryA( g: O% e) n5 c
- .text:24BC2D97 mov esi, eax' T1 F. b l7 _7 X" `9 H* o
- .text:24BC2D99 cmp esi, edi' _0 ~& U% K0 T, C N
- .text:24BC2D9B jnz short loc_24BC2DB6
" o# w1 I% \. P% v- B- o" I - .text:24BC2D9D mov eax, [ebp+var_8]* Y$ N7 k9 o! r
- .text:24BC2DA0 push eax9 e) W# u! [+ C: f
- .text:24BC2DA1 mov ecx, [eax]9 U# H# D9 s+ q4 \9 p
- .text:24BC2DA3 call dword ptr [ecx+8]8 ?+ s, g7 f* {: g. Q7 t& \
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
9 ^( I) f4 H/ b& a3 e5 }: W; S6 w* m. H - .text:24BC2DA9 call ds:FreeLibrary7 q' [9 L9 t" ?" G% q4 a' ]
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
& o& ?, _8 O$ ~; |; x4 E - .text:24BC2DB4 jmp short loc_24BC2DE2
8 w8 s, ^6 _0 S5 F% @2 W - .text:24BC2DB6 ; ---------------------------------------------------------------------------
9 ^/ R- A+ N- Z8 X - .text:24BC2DB6 p5 ]% a+ G9 P% V# `) y; F- Q) e; V) B
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
) f& w) x2 b( C: [: R: Z3 U - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"! b; X! `' O. C- u8 c
- .text:24BC2DBB push esi ; hModule
( r* u, L$ M4 V& R( N$ e5 } - .text:24BC2DBC call ds:GetProcAddress
: L, z% X7 b5 I+ i/ W3 J - .text:24BC2DC2 push esi ; hLibModule) @8 {' D n5 C; L; h! k5 U
- .text:24BC2DC3 mov esi, ds:FreeLibrary4 w; ? z# I' D. M* d! l ^
- .text:24BC2DC9 test eax, eax2 G# j5 O( e2 q! @
- .text:24BC2DCB jnz short loc_24BC2DF21 ?+ W& t y. _4 |! p9 V0 W: a, E& W
- .text:24BC2DCD call esi ; FreeLibrary; x5 |" P( _2 U
- .text:24BC2DCF mov eax, [ebp+var_8]
9 y; f, J) n5 N - .text:24BC2DD2 push eax
, ]4 @% S# u/ q4 M0 \8 h9 H( H - .text:24BC2DD3 mov ecx, [eax]6 R- J2 j; Q. y. ~2 I
- .text:24BC2DD5 call dword ptr [ecx+8]/ u: O5 W% w) W8 e
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
( ` S4 ~8 ^' [6 ^; U* F# l - .text:24BC2DDB call esi ; FreeLibrary
# q1 m9 Z/ x" K - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...9 X! v9 o; [ h6 O8 a8 B+ [/ R# @
- .text:24BC2DE2
1 d1 y* n: U, ?3 U) p - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j. ]+ X+ D9 t# P/ b
- .text:24BC2DE2 call ds:OutputDebugStringA* K8 K1 U: E! _6 M4 [5 n/ K0 i$ Z
- .text:24BC2DE8 mov eax, 200h
~4 e6 e2 Q& Z - .text:24BC2DED jmp loc_24BC3011. l3 B6 u6 y( }- E/ a
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
# a$ z0 O2 i. m; o1 m) K - .text:24BC2DF2
8 x O0 q4 K5 T, h - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
1 D& d1 e9 l/ e0 Q. j- z - .text:24BC2DF2 call esi ; FreeLibrary
2 W8 H5 X6 {8 N$ t. Y - .text:24BC2DF4 push 6Ch ; Size
+ a! {5 L3 E# {( f( E( k; |& U - .text:24BC2DF6 lea eax, [ebp+Dst]2 q; P1 P" e) \2 G- O. X. ], ?
- .text:24BC2DFC push edi ; Val
- T2 s6 T- O# D* `5 P - .text:24BC2DFD push eax ; Dst
! R* |( r! Y: g7 E+ T - .text:24BC2DFE call memset
3 l' E7 e: L% V, y* [# e# D9 | - .text:24BC2E03 mov eax, [ebp+var_8]( A1 d& N3 L" x# _8 N% ^" \! ~
- .text:24BC2E06 add esp, 0Ch- _, X) r+ ]. k
- .text:24BC2E09 mov [ebp+Dst], 6Ch- g; \ O8 q! A, v* l! P# H
- .text:24BC2E13 mov [ebp+var_8C], 1+ B9 r! y3 G% |' u# @
- .text:24BC2E1D mov [ebp+var_28], 200h' t2 r5 H4 M( H# S* B" m% T4 W
- .text:24BC2E24 mov ecx, [eax]' Q/ W6 N! a/ S$ J$ A- h$ c2 @
- .text:24BC2E26 push 8
; C3 i+ X3 C- W* \) b' U3 ?6 v8 L - .text:24BC2E28 push edi
* u( I; D& u4 @0 }* f/ r' C - .text:24BC2E29 push eax& j4 c$ i$ _3 h7 i
- .text:24BC2E2A call dword ptr [ecx+50h]
; k) p9 o O0 g" W) g1 n! C - .text:24BC2E2D test eax, eax
6 z. h+ t- i! S: B - .text:24BC2E2F mov eax, [ebp+var_8]
; d& Q( M0 Z! v3 G% I9 L. c - .text:24BC2E32 mov ecx, [eax]
( x0 Y2 N# r( S. U" h1 E - .text:24BC2E34 jge short loc_24BC2E461 [# O% @9 i+ k |
- .text:24BC2E36 push eax4 @) m* i( e, c" v% s' d( @; m4 v
- .text:24BC2E37 call dword ptr [ecx+8], A$ J) t$ k& o% {' M
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule1 E5 L' B' z" g' |4 J
- .text:24BC2E3D call esi ; FreeLibrary
% l9 K4 c9 m8 t - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"7 ]5 q1 I5 V0 u- G" Z/ }6 k
- .text:24BC2E44 jmp short loc_24BC2E6D
% l$ [0 e; i+ v% j( k5 b) q u/ y) | b - .text:24BC2E46 ; ---------------------------------------------------------------------------
; y r: S. [ u - .text:24BC2E46/ f1 Y3 B$ ~* K/ w+ { Z1 q
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
* Z$ d1 u1 V( y7 _# G' X, n - .text:24BC2E46 lea edx, [ebp+var_C]( s1 I5 u- r; @5 C2 E5 k
- .text:24BC2E49 push edi
0 U" f2 V( P) h2 x$ G& L - .text:24BC2E4A push edx
- V2 E* Q) b+ { - .text:24BC2E4B lea edx, [ebp+Dst]& e; p8 e( @5 @* [
- .text:24BC2E51 push edx3 ~ F9 E- {: e/ f
- .text:24BC2E52 push eax: T5 s: Z. ^) T, q/ K& Q
- .text:24BC2E53 call dword ptr [ecx+18h]
7 R7 D" y' Z0 X4 R - .text:24BC2E56 test eax, eax t0 a9 s) P; e. F
- .text:24BC2E58 jge short loc_24BC2E7A
$ g5 c+ I! J( C1 D/ \: t1 q - .text:24BC2E5A mov eax, [ebp+var_8]
; D1 m5 p- U4 V. t - .text:24BC2E5D push eax$ q1 ^9 W6 ]8 M
- .text:24BC2E5E mov ecx, [eax]
2 U @2 d% k( J1 B/ W0 j# m7 V3 I - .text:24BC2E60 call dword ptr [ecx+8]
1 k! Q! w1 L/ _5 W6 f! ^ f2 x8 D* d" Z3 | - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
( q" A2 F+ Y0 I% U3 V - .text:24BC2E66 call esi ; FreeLibrary
* O K5 h( G! L- n: o - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"+ \ W. d" U5 ~
- .text:24BC2E6D
0 [. @- J! \: Y; y& M L1 x - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
* f! c0 ~, k/ `- ]) Y - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...4 D, \: ~7 l, |- d: o" q
- .text:24BC2E6D call ds:OutputDebugStringA
- Y$ {) U( z6 g+ ^: G7 k1 U - .text:24BC2E73 xor eax, eax5 o5 U! O8 o9 p7 U; {) ]4 }1 g
- .text:24BC2E75 jmp loc_24BC3011
' ~6 A4 A9 [7 W$ I6 _/ |- s; e - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
! X3 r0 @, x5 n+ {' X+ \7 {8 ^& O4 d# E6 j( n
9 z3 f4 i2 p" _ |