这游戏以前分析过,本贴再写得详细一些。
) {8 V; b# n4 \3 o, C7 _2 ?这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,$ `6 A" d' a" M2 H' ]+ N- g( V
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
) E. m4 ^4 }6 c% @: R7 o! _; n, h8 W( [3 d$ J7 \, e& Z1 G- \
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.& }2 ^+ i, t( a: N" U
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
$ f' I2 r/ v; g - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
1 \0 V7 w7 Q+ V% F& L' M - STDMETHOD_(ULONG,Release) (THIS) PURE;
4 Y4 K% x; e% D, G& b - STDMETHOD(Compact)(THIS) PURE;
W; ?# n# ?4 H$ k4 ? - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
( w: d, x; V- C' a- d5 c# f3 L - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
% i$ k. o2 G! R& P6 @) t! H - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
' u- g/ @$ l) S+ g; m以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
1 c: J b- P/ o6 z( `3 D P; c8 k! m- Q2 q+ d" i( o9 l
, ]; _# ?+ W2 R- ~5 ]
V& T0 W" O) t
: V) e3 H8 r. l4 ~3 G* H- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================- ^- N) W, K8 k5 F% G- v$ N
- .text:24BC2CD22 X8 m; N6 l+ Y
- .text:24BC2CD2 ; Attributes: bp-based frame) T t/ R5 \7 c f. v# V
- .text:24BC2CD2 I& E; i; N; V0 Y' f1 Q) ?: t& P0 K
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
/ @# v0 U5 R# e - .text:24BC2CD25 o9 n) T/ t: X \# j* u
- .text:24BC2CD2 Dst = dword ptr -90h# ~. e2 ?2 g! N [6 @: b" }+ y
- .text:24BC2CD2 var_8C = dword ptr -8Ch
0 d5 V, q) I- | J; I V( [ - .text:24BC2CD2 var_28 = dword ptr -28h
. f; A1 X0 A/ z" ]4 n8 n - .text:24BC2CD2 var_24 = dword ptr -24h
! ^9 R" u7 z$ Z) A+ Q% a) n - .text:24BC2CD2 var_20 = dword ptr -20h
3 g: U6 W) _ X/ u; X - .text:24BC2CD2 var_1C = dword ptr -1Ch
0 u. b+ B/ x, y: t7 h O7 c; G3 V - .text:24BC2CD2 var_18 = dword ptr -18h; k& O' J& k" M. _6 D
- .text:24BC2CD2 ppv = dword ptr -14h
: a/ C; q5 L7 R5 V$ k - .text:24BC2CD2 var_10 = dword ptr -10h
# i. Z9 B/ G/ b# T/ O - .text:24BC2CD2 var_C = dword ptr -0Ch. T9 P1 k$ r9 [$ [: w
- .text:24BC2CD2 var_8 = dword ptr -8
8 b/ g9 k! m: l1 J" U - .text:24BC2CD2 hLibModule = dword ptr -4! A/ f% d& u- U; v
- .text:24BC2CD2
: D3 Q/ V1 W1 b) d - .text:24BC2CD2 push ebp. n: r2 X, m0 r& s3 k: a
- .text:24BC2CD3 mov ebp, esp5 c5 i$ F+ Q- e8 H3 }+ `3 B
- .text:24BC2CD5 sub esp, 90h/ ]) s- h" h; h! _) M8 ^' E3 o
- .text:24BC2CDB push ebx
" m, g8 z7 R, z) U3 v$ Y - .text:24BC2CDC mov ebx, ds:LoadLibraryA
, t9 f6 e1 ^% J. M - .text:24BC2CE2 push esi/ ~+ `# O! H6 N" K& w$ a- N7 g4 v
- .text:24BC2CE3 push edi
8 ^4 X7 O3 ?+ I& j5 @3 R( J - .text:24BC2CE4 xor edi, edi. m5 v& n8 o: T! J
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
& B5 f! V# \9 H2 m$ f# t- P5 o# s - .text:24BC2CEB mov [ebp+var_8], edi; ^! f d5 N) t/ r7 w) P
- .text:24BC2CEE mov [ebp+var_1C], edi- Q3 k* O3 E5 `! P7 \' H. Z1 V8 u+ V
- .text:24BC2CF1 mov [ebp+var_C], edi3 \: g9 a" v! v) ]% L. t% _4 u
- .text:24BC2CF4 mov [ebp+var_10], edi9 G6 E. x e \; B& y* E. t& [7 K) D
- .text:24BC2CF7 mov [ebp+var_18], edi
: _ g7 S7 B% T+ C1 A. H, J( i - .text:24BC2CFA call ebx ; LoadLibraryA1 L1 I0 i) y: s; |" k
- .text:24BC2CFC mov esi, eax
( e3 r* g. X( q4 ]' Y& j) R - .text:24BC2CFE cmp esi, edi0 o o, U7 h2 b' b& X1 d" M
- .text:24BC2D00 mov [ebp+hLibModule], esi) f) c8 @1 o8 L8 @3 \
- .text:24BC2D03 jnz short loc_24BC2D0F# o" ~& R' ^& o. o; z
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"! `0 \5 _! v7 a& x. O" F
- .text:24BC2D0A jmp loc_24BC2E6D
$ Z$ p, E8 N+ [, j - .text:24BC2D0F ; ---------------------------------------------------------------------------
0 s$ W5 I+ N% [* [ - .text:24BC2D0F
0 i6 {+ T% g/ d9 F0 v - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j. D' u+ Q& C# r
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"- K0 |7 i3 w3 v3 F% ^8 P
- .text:24BC2D14 push esi ; hModule9 h" m5 F& _4 N8 K
- .text:24BC2D15 call ds:GetProcAddress# n/ U# v' i- l* h( }
- .text:24BC2D1B cmp eax, edi2 Z; d& l; {' K3 Z
- .text:24BC2D1D jnz short loc_24BC2D300 G! K2 f, i- T$ t) ~
- .text:24BC2D1F push esi ; hLibModule
" q! O! h, g6 F/ N1 v' a" ^ y - .text:24BC2D20 call ds:FreeLibrary
% p& u# h! k9 y: ]$ m0 C( h& T - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
f8 }; ?' _7 j6 U1 |9 Q - .text:24BC2D2B jmp loc_24BC2E6D
( i& p% B' G/ c$ F4 R; } - .text:24BC2D30 ; ---------------------------------------------------------------------------2 K0 b9 ^# X8 E* K& m. I$ e
- .text:24BC2D30
3 |0 I% B. |7 @: f4 C; N6 H+ y8 }, X - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j* V" d, z# J: V
- .text:24BC2D30 lea ecx, [ebp+var_8]
6 ^' G( M( K# }, v+ T: u0 g - .text:24BC2D33 push edi, F7 q' ?. i3 N
- .text:24BC2D34 push ecx
' u+ T8 O: |: L/ D) ]% L, y - .text:24BC2D35 push edi: Z3 c) O a2 h9 ]& t, o
- .text:24BC2D36 call eax5 j7 {9 _ d3 T1 ~9 M, v' U, N
- .text:24BC2D38 test eax, eax
& S' _7 g' u9 q8 M' a$ _" j) Y - .text:24BC2D3A jge short loc_24BC2D4D7 g/ r) ]8 v W! X) {3 d0 k7 v
- .text:24BC2D3C push esi ; hLibModule3 Q4 P% Z0 c8 M4 w0 _, y% G+ N( a
- .text:24BC2D3D call ds:FreeLibrary6 R* \/ C' M! o$ {1 Q+ `8 ~
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
8 U0 L0 m% l* C; t2 U0 Z - .text:24BC2D48 jmp loc_24BC2E6D
4 y2 M7 S0 X: r& T: G - .text:24BC2D4D ; ---------------------------------------------------------------------------8 r, f: M1 ~: l% U
- .text:24BC2D4D: G. L+ U$ Q$ b0 p& g
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
6 U T$ o" y& C9 @6 P. I. v - .text:24BC2D4D mov eax, [ebp+var_8]* c9 p6 f6 a4 X }
- .text:24BC2D50 lea edx, [ebp+var_1C]) k, j- ? m, O7 {! x1 h W$ G3 j
- .text:24BC2D53 push edx' c" ~! }9 [' Y3 G2 T% n
- .text:24BC2D54 push offset unk_24BC44708 N; N$ S9 e1 f" {, [
- .text:24BC2D59 mov ecx, [eax]7 i7 `$ P2 `9 x* k" O
- .text:24BC2D5B push eax
3 y# I8 \( R. h8 w, @1 I- a. K - .text:24BC2D5C call dword ptr [ecx]
' q7 N* X- S6 n" h% t - .text:24BC2D5E test eax, eax D7 Y3 S: {, n
- .text:24BC2D60 jge short loc_24BC2D87
7 C: D8 h1 d# @ m+ l. k - .text:24BC2D62 mov eax, [ebp+var_8]& @( B! K$ O4 _; |, H
- .text:24BC2D65 push eax
0 o7 F8 k. D5 S0 {3 x# j9 L - .text:24BC2D66 mov ecx, [eax]7 l9 J7 C, r3 a: n2 M* Y/ a
- .text:24BC2D68 call dword ptr [ecx+8]& b: a, C: O. ~/ t9 H4 B/ d
- .text:24BC2D6B push esi ; hLibModule0 n# K, O( R. {+ f
- .text:24BC2D6C call ds:FreeLibrary3 G/ W, ^/ z3 k/ ~( J1 E, w! l3 D
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"! C) z: S6 X$ y! I N
- .text:24BC2D77 call ds:OutputDebugStringA
2 U1 F. ?; q1 n$ \% G5 A8 _& j/ ` - .text:24BC2D7D mov eax, 100h+ w m4 |; R- |; K
- .text:24BC2D82 jmp loc_24BC3011
; a l( h6 n1 m) ?' ]" x& O& t" K - .text:24BC2D87 ; ---------------------------------------------------------------------------/ S2 f! O: g) n" r w3 i
- .text:24BC2D87
" @$ ]! B/ j$ l& J - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
6 ]& Y# O a! @+ d2 G - .text:24BC2D87 mov eax, [ebp+var_1C]! L, g; J8 n. x, w7 Q! o" d
- .text:24BC2D8A push eax$ e0 Q% M: H1 j0 H. W9 Z
- .text:24BC2D8B mov ecx, [eax]8 W/ K' {& ?5 o- v6 I: g
- .text:24BC2D8D call dword ptr [ecx+8]+ S: C- ]7 }2 l& u6 b9 k e
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"- F) Q5 |- m# |3 y6 l/ ?
- .text:24BC2D95 call ebx ; LoadLibraryA, x: ?4 |6 ]3 q6 ?7 R
- .text:24BC2D97 mov esi, eax
$ y* h% R Z& L! G9 Z) b; V. ] - .text:24BC2D99 cmp esi, edi$ b# L2 k8 {! f! a
- .text:24BC2D9B jnz short loc_24BC2DB63 s7 f% ]0 d4 ^
- .text:24BC2D9D mov eax, [ebp+var_8]( ]* L! x) L" n# c
- .text:24BC2DA0 push eax
% r$ k5 d0 W- E5 H3 X; c - .text:24BC2DA1 mov ecx, [eax]
( y; r! w, |6 [( U0 u - .text:24BC2DA3 call dword ptr [ecx+8]1 R/ T, E6 [) o+ K, r- T
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule2 S2 N, N; \# M/ x/ W, D
- .text:24BC2DA9 call ds:FreeLibrary: J# G8 t2 G- ]9 a |
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
1 ~; ~- G( r- y - .text:24BC2DB4 jmp short loc_24BC2DE2
' D0 n5 y. f/ _) V! C - .text:24BC2DB6 ; ---------------------------------------------------------------------------
( G( e& W; r' r* n4 m - .text:24BC2DB6
7 p% ^) j9 c9 s" @5 }) a - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j% H: h' J" q* X$ c& f
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"9 o* v$ {- X& w5 g% b
- .text:24BC2DBB push esi ; hModule
/ ?$ t. O* K& U! ~' d( b - .text:24BC2DBC call ds:GetProcAddress0 r; A+ w W8 x2 p) O0 m* n( Y, s
- .text:24BC2DC2 push esi ; hLibModule
: v% b" Q5 [) s( N r, s; ~ - .text:24BC2DC3 mov esi, ds:FreeLibrary
) C3 c/ Y( I7 f# A' t4 n - .text:24BC2DC9 test eax, eax
" f7 U% G9 e% q! ?$ c# z - .text:24BC2DCB jnz short loc_24BC2DF20 U5 K- `- k: b! K2 `5 V: y" I8 T
- .text:24BC2DCD call esi ; FreeLibrary
3 _( [% d* Z' m) ]" Q9 E - .text:24BC2DCF mov eax, [ebp+var_8]
8 _/ Y1 @ x# x% k* Z7 i - .text:24BC2DD2 push eax/ c3 X. q! {2 l7 U0 O8 w
- .text:24BC2DD3 mov ecx, [eax]4 ]2 F) t9 G' s$ G6 [! p
- .text:24BC2DD5 call dword ptr [ecx+8]
4 n7 z* h4 J! ]6 }* Y9 ] - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule7 a5 h- |8 D: h) S
- .text:24BC2DDB call esi ; FreeLibrary
- k6 y" a9 \; w1 ~/ P3 w& } - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...: R, w6 s! F5 O% ]. U) b
- .text:24BC2DE2# ]; ]1 p/ V( n0 a" k8 w
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
5 k9 N) d/ d$ J4 u - .text:24BC2DE2 call ds:OutputDebugStringA
1 g( ~! ~/ T! o# v - .text:24BC2DE8 mov eax, 200h+ J. E7 X8 C6 X% H% d% C
- .text:24BC2DED jmp loc_24BC3011
9 e6 c: ?) J& w, h6 z/ B. c" v - .text:24BC2DF2 ; ---------------------------------------------------------------------------# F& `+ y- n: G8 u" _
- .text:24BC2DF2
4 y" i6 n, d+ C# d9 p: Y - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
6 x9 p' a0 P, L8 n" e5 N4 _- b" r - .text:24BC2DF2 call esi ; FreeLibrary' M. s; M( C& }$ H' g' _
- .text:24BC2DF4 push 6Ch ; Size: D A2 N5 w1 i, X+ ~
- .text:24BC2DF6 lea eax, [ebp+Dst]
* v- B, x+ V$ d* p* z. H3 t6 P - .text:24BC2DFC push edi ; Val+ Q8 x7 M$ ^6 E3 Y
- .text:24BC2DFD push eax ; Dst
# b1 s( w* S4 J - .text:24BC2DFE call memset$ d2 D5 n* a. _
- .text:24BC2E03 mov eax, [ebp+var_8]& ^0 ]2 {. w$ l3 w
- .text:24BC2E06 add esp, 0Ch
8 t6 G) z/ T! ?& v M4 z - .text:24BC2E09 mov [ebp+Dst], 6Ch! C6 k, M" ?$ p3 v# a
- .text:24BC2E13 mov [ebp+var_8C], 1) K/ J' b" Q( K4 u4 g; S
- .text:24BC2E1D mov [ebp+var_28], 200h
; d) M; M* Q8 e. {$ [ - .text:24BC2E24 mov ecx, [eax]$ k; U- Y: P% o1 ~ ]
- .text:24BC2E26 push 8* R+ K% g4 S2 z* P5 S# X* A9 t
- .text:24BC2E28 push edi
' I) s: j% K- U0 V, j% y7 Y - .text:24BC2E29 push eax
4 B5 u- P9 g+ t* f z - .text:24BC2E2A call dword ptr [ecx+50h]
# b; G7 n3 f1 E2 S. f - .text:24BC2E2D test eax, eax5 U( @. ?2 o7 Z- g7 Z9 F5 R
- .text:24BC2E2F mov eax, [ebp+var_8]
$ n- J/ ?8 @$ a- C9 n; K$ _ - .text:24BC2E32 mov ecx, [eax]/ ^& N& P& A$ R, | P" A" p
- .text:24BC2E34 jge short loc_24BC2E46
4 C0 j0 r, w0 b$ v2 Y* K" q" M - .text:24BC2E36 push eax
" P, q' h+ h- Q2 e# c6 k - .text:24BC2E37 call dword ptr [ecx+8]
1 c+ w" w3 n6 ^( U w - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
2 I) n, W8 p: K$ G, Y - .text:24BC2E3D call esi ; FreeLibrary7 H% q" E4 u4 Q' A: R- R; ? V
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
" _9 J% e2 I. A( | - .text:24BC2E44 jmp short loc_24BC2E6D- }( r5 x; ~: g- |# O/ u2 V
- .text:24BC2E46 ; ---------------------------------------------------------------------------
+ M+ J9 D# O V% }* ?5 W/ \4 Z - .text:24BC2E46* ^! ^* p! p9 c- w6 U
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j O2 A6 I$ a: C/ m
- .text:24BC2E46 lea edx, [ebp+var_C]* k( l4 |! t" k
- .text:24BC2E49 push edi/ Q" E6 ^3 y" ^- a# P. O
- .text:24BC2E4A push edx& L. C; P+ R9 q+ W5 k1 z
- .text:24BC2E4B lea edx, [ebp+Dst]9 g U& P* X7 z3 C; V
- .text:24BC2E51 push edx5 S. B7 o# U5 Q& ~8 R8 Q- _; G
- .text:24BC2E52 push eax$ _% m5 ^' r; ?7 E6 `$ {
- .text:24BC2E53 call dword ptr [ecx+18h]$ K" {6 C% `8 D- M- s
- .text:24BC2E56 test eax, eax% V4 b4 T: E0 w! g
- .text:24BC2E58 jge short loc_24BC2E7A
( d# K' s2 E+ w - .text:24BC2E5A mov eax, [ebp+var_8]
8 L% n q8 T( l# [ - .text:24BC2E5D push eax- }1 g2 E! w! v5 n
- .text:24BC2E5E mov ecx, [eax]8 p1 x3 Z( ?. Y/ _
- .text:24BC2E60 call dword ptr [ecx+8]5 R, y1 t8 O3 e
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
) R. L: o4 `1 k2 g, \: y - .text:24BC2E66 call esi ; FreeLibrary
& b3 {! j; i9 ~% A7 B - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
: \- e0 H5 h$ ^# {: K; b! q - .text:24BC2E6D
1 u0 I! T$ \# e9 z7 p - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
: C! G" C7 O/ N3 F+ T - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
1 B9 @7 R5 f, r: }* ^ - .text:24BC2E6D call ds:OutputDebugStringA, ?5 t! B2 ]" k7 T
- .text:24BC2E73 xor eax, eax
- s" t/ V" g5 Q3 X3 @ - .text:24BC2E75 jmp loc_24BC3011 i8 t& e D1 Q8 r
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 6 t4 x5 G1 }* Z+ C% i/ A
1 e$ r; S. |9 t& L6 }
+ Y4 z! f0 ^) E/ C4 A |