这游戏以前分析过,本贴再写得详细一些。
4 n4 \' z+ t8 J6 E$ i这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
0 \* k% R2 X& X+ D注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。( I# q6 P. B' G2 O5 u! s5 [
1 B8 _+ u2 `! C* y6 G- I
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.: t4 I% P2 ?7 r5 @" U! t
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE; F4 a9 |$ j: Y! m
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
" K; O$ F8 `4 a' N1 G5 B - STDMETHOD_(ULONG,Release) (THIS) PURE;' q( ~9 F, W! f
- STDMETHOD(Compact)(THIS) PURE;2 M5 c* e) I% h2 p7 x. [1 e
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;7 `$ G# y4 s1 z2 [1 z
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;7 J8 u3 h8 S. c1 X4 |" Z3 @& {# F
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 ; p2 h: H7 r9 a [, B% U$ K1 k
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
( T' z* \% W3 a6 x' {; J. }. Y2 H8 `+ |" X. C" [
' D5 G! X! p, K/ U% K/ e8 m. a
2 p' w/ e& O4 r" n' R
* e$ b% Z* C6 x& O/ c3 A0 y, g8 c- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
9 ^, X! j' H+ u) | - .text:24BC2CD2 `! C4 s: [/ s3 Y5 }
- .text:24BC2CD2 ; Attributes: bp-based frame7 e) F. Q$ ~# k0 ~* j, ~
- .text:24BC2CD2
& t/ a. i9 \6 m$ m# C - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p) y* r N$ T$ | M" d4 s
- .text:24BC2CD22 N% } h4 j/ r" q
- .text:24BC2CD2 Dst = dword ptr -90h/ U% F9 U4 [) ~6 K9 l+ w2 I; c" h
- .text:24BC2CD2 var_8C = dword ptr -8Ch2 M6 D/ a8 Q% L9 X0 _
- .text:24BC2CD2 var_28 = dword ptr -28h
O1 d- ]- O4 d - .text:24BC2CD2 var_24 = dword ptr -24h
" i/ \" [* H$ ^# Z( E7 T8 x - .text:24BC2CD2 var_20 = dword ptr -20h
( [" a8 K, {/ d - .text:24BC2CD2 var_1C = dword ptr -1Ch
% R% O) D2 _) C/ x# X - .text:24BC2CD2 var_18 = dword ptr -18h" O: [+ T& a' q" c
- .text:24BC2CD2 ppv = dword ptr -14h
, \9 M8 R, l3 k6 l z) L; ? - .text:24BC2CD2 var_10 = dword ptr -10h
, q( F& {- I; Q2 @+ ]0 s" u; E - .text:24BC2CD2 var_C = dword ptr -0Ch
2 c5 R1 S, ?" T- y$ o$ { - .text:24BC2CD2 var_8 = dword ptr -8
7 A" y4 N4 g+ K$ {4 d! t - .text:24BC2CD2 hLibModule = dword ptr -4
) [6 W& W8 J0 S. k B* e/ {6 q* H - .text:24BC2CD2" H. u; \) F& q, R
- .text:24BC2CD2 push ebp
6 [% S: k* y% |9 u - .text:24BC2CD3 mov ebp, esp# T+ Z( W a/ ]( }/ Z2 ~
- .text:24BC2CD5 sub esp, 90h; x0 _# c0 E! {+ g w
- .text:24BC2CDB push ebx
2 |' a; h/ w" c - .text:24BC2CDC mov ebx, ds:LoadLibraryA
5 J5 L* Y* ? O% F+ | - .text:24BC2CE2 push esi
8 Y! X* s( B* p. g% R, J2 F! i - .text:24BC2CE3 push edi+ N- n6 t- ^5 `0 }
- .text:24BC2CE4 xor edi, edi
) X& \" Z0 q# N6 K* l - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"% n. A% N7 I2 Z, W
- .text:24BC2CEB mov [ebp+var_8], edi
5 \+ p" v. M, W+ s- ?6 l) B$ D - .text:24BC2CEE mov [ebp+var_1C], edi; j6 `: Q6 C/ D6 a& ?( v$ d
- .text:24BC2CF1 mov [ebp+var_C], edi
% P( [5 X/ }4 ]! @ - .text:24BC2CF4 mov [ebp+var_10], edi
: G' ^; R. [, {" k+ C( h - .text:24BC2CF7 mov [ebp+var_18], edi
1 Y( a* ]' F8 u - .text:24BC2CFA call ebx ; LoadLibraryA( W! e7 V0 Z$ }* w( V
- .text:24BC2CFC mov esi, eax
% b9 u! O8 H" W# L: e - .text:24BC2CFE cmp esi, edi
2 c. x# K$ i3 Y# A. C5 M5 Y - .text:24BC2D00 mov [ebp+hLibModule], esi9 B4 d _/ F7 P: g! r6 m: G
- .text:24BC2D03 jnz short loc_24BC2D0F
" V+ m# U/ U2 ]: ~ - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
" v- p0 c. y. r( |% p3 y - .text:24BC2D0A jmp loc_24BC2E6D
0 l% i, }; G6 ?' [ P - .text:24BC2D0F ; ---------------------------------------------------------------------------
9 V6 U5 r0 v& k6 w* u7 T. y4 c - .text:24BC2D0F4 y4 d( x+ i( v
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j+ h8 f. H9 `$ s; O* J- k
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
; z B2 X) {; I" L* Q - .text:24BC2D14 push esi ; hModule$ \9 l! Y" B. d# M
- .text:24BC2D15 call ds:GetProcAddress
: W; I& N/ J- f - .text:24BC2D1B cmp eax, edi# |% A" R" ~. k: L% n( n
- .text:24BC2D1D jnz short loc_24BC2D30: b7 e( Z+ @: V6 K
- .text:24BC2D1F push esi ; hLibModule# y( _2 u% V# l
- .text:24BC2D20 call ds:FreeLibrary
, `7 \0 S. v; W" K7 x0 | - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
$ q4 ~! b( V3 P% K6 W5 n- ` - .text:24BC2D2B jmp loc_24BC2E6D* \4 H$ V0 ^ k3 F n% \
- .text:24BC2D30 ; ---------------------------------------------------------------------------+ H: p; x8 @: F# @* F
- .text:24BC2D30" @6 V: q4 B# u& _3 V& q: {
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
( x" h/ S0 @* s' O( U. \ - .text:24BC2D30 lea ecx, [ebp+var_8]+ m4 a; s% b+ `2 i
- .text:24BC2D33 push edi& F1 |4 K8 z. o9 F; b$ z! u
- .text:24BC2D34 push ecx) \+ ^- k: Q& j: D
- .text:24BC2D35 push edi q% q3 W' p h! n/ h t
- .text:24BC2D36 call eax
7 L- r. z0 T. e W: E - .text:24BC2D38 test eax, eax$ @# @) p. Q s3 G( D
- .text:24BC2D3A jge short loc_24BC2D4D( G2 K( n5 {/ }
- .text:24BC2D3C push esi ; hLibModule* Q* k8 w+ o' x
- .text:24BC2D3D call ds:FreeLibrary1 R8 I4 ^7 o3 w% @
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"5 J4 R! l: k+ `. o1 r# e
- .text:24BC2D48 jmp loc_24BC2E6D
6 V: U/ t5 c/ R7 C - .text:24BC2D4D ; ---------------------------------------------------------------------------
! ~% r7 H" P7 I1 X! D1 G - .text:24BC2D4D
; S' t$ [+ I2 f4 a - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
4 z- d* K; w' @1 }) J' l0 D - .text:24BC2D4D mov eax, [ebp+var_8]& C8 F1 ]1 Y5 u% X; g' Y# `. i
- .text:24BC2D50 lea edx, [ebp+var_1C]
7 L8 r6 E' w9 p5 Z3 ~3 B - .text:24BC2D53 push edx
& ^" l' p8 N/ b' f - .text:24BC2D54 push offset unk_24BC4470
5 r) [* ^+ E" p - .text:24BC2D59 mov ecx, [eax]
7 v) n8 _9 J' m4 G - .text:24BC2D5B push eax
: J6 Z/ ^ m$ F - .text:24BC2D5C call dword ptr [ecx]
% l* ?9 [& N8 O7 K+ r8 K% s$ [' W9 |4 y - .text:24BC2D5E test eax, eax
# _& ^! i) }) }2 x/ W, l! e( ~* p - .text:24BC2D60 jge short loc_24BC2D87
f8 r& M; @$ ~/ R* \) \ - .text:24BC2D62 mov eax, [ebp+var_8]
5 y7 E& E- y3 ^, b5 \" n( b - .text:24BC2D65 push eax3 U% o0 q( T4 J- T
- .text:24BC2D66 mov ecx, [eax]; _+ t# U1 r; _7 R, p; D
- .text:24BC2D68 call dword ptr [ecx+8]" \' D( c5 W Q+ b
- .text:24BC2D6B push esi ; hLibModule
0 X+ \) ~0 H' J - .text:24BC2D6C call ds:FreeLibrary
* R8 ]! }5 D3 t/ V: K - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
5 C) k `. g' `* [4 o2 l2 m - .text:24BC2D77 call ds:OutputDebugStringA9 C0 Y( n& j! O! |4 k
- .text:24BC2D7D mov eax, 100h% y# o- d2 c8 i& J9 b! u% r
- .text:24BC2D82 jmp loc_24BC30117 R, g0 U/ |1 u8 U8 o) a, Q/ y8 B
- .text:24BC2D87 ; ---------------------------------------------------------------------------% c& y# [! p5 U' f$ I
- .text:24BC2D87
4 F5 j3 \+ m' K' P - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
- C3 ~, [3 L6 h t - .text:24BC2D87 mov eax, [ebp+var_1C] \8 Y. e: I; d, k9 Y' s* I
- .text:24BC2D8A push eax
& _) \1 d; t- q8 D, a9 K - .text:24BC2D8B mov ecx, [eax]
- Y2 G J2 z0 d) }* p. t - .text:24BC2D8D call dword ptr [ecx+8]8 Y! M6 Z7 o M8 D- ~% G' H
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
+ Z( P# i6 A% h4 n( L( z" Q - .text:24BC2D95 call ebx ; LoadLibraryA
) ~& C& V3 T" I q) i - .text:24BC2D97 mov esi, eax
( ^2 b( A; w1 v& ~8 _$ h - .text:24BC2D99 cmp esi, edi
! `( x2 v9 ~/ g5 D - .text:24BC2D9B jnz short loc_24BC2DB6; R3 U1 ?" W5 o) @# Z
- .text:24BC2D9D mov eax, [ebp+var_8]
_) v6 q, P# @8 H- u - .text:24BC2DA0 push eax
~+ i% z' z% p/ u- p - .text:24BC2DA1 mov ecx, [eax]3 I6 G2 z( ^: m
- .text:24BC2DA3 call dword ptr [ecx+8]0 N. r9 [' w' Y& {1 p/ ~$ p8 k
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule4 r/ K& W5 K. P8 \ K
- .text:24BC2DA9 call ds:FreeLibrary) a( C: X& j( u4 l# v0 j, m) C: P
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
# I0 s9 H$ A* G9 F1 Q& g# A9 O - .text:24BC2DB4 jmp short loc_24BC2DE2
7 s. J- o3 G& x+ z2 m8 w - .text:24BC2DB6 ; ---------------------------------------------------------------------------
% f! d. Y4 h r4 ~: b5 a - .text:24BC2DB6! g k3 s: J# D3 H
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
6 q) @( r& @2 ]7 l; t5 Z. |0 t - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"7 m7 d8 }9 ]8 {8 s% D
- .text:24BC2DBB push esi ; hModule3 ~. r9 G q5 o+ r$ T
- .text:24BC2DBC call ds:GetProcAddress) ?: E6 W: }6 m2 L8 c
- .text:24BC2DC2 push esi ; hLibModule/ G, h1 c* W3 a
- .text:24BC2DC3 mov esi, ds:FreeLibrary# P4 u# ]/ k6 F5 B2 U
- .text:24BC2DC9 test eax, eax
- K" k1 H8 b# j# G$ y) \+ T - .text:24BC2DCB jnz short loc_24BC2DF2
: u* F5 H4 ?, x- y+ l1 m- G - .text:24BC2DCD call esi ; FreeLibrary
0 f4 F8 f$ S' [- q - .text:24BC2DCF mov eax, [ebp+var_8]
) ^1 B: A' C. } K& \! B0 } - .text:24BC2DD2 push eax
3 U% \. U5 x7 I/ ~- @2 j+ r0 i - .text:24BC2DD3 mov ecx, [eax]
5 I2 U) g# E. k1 Q: A% v - .text:24BC2DD5 call dword ptr [ecx+8]
6 }" g% u9 `# _( U- d - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
: K9 |7 a6 b1 P$ }& f. V - .text:24BC2DDB call esi ; FreeLibrary0 a8 F2 T; ^$ D* j I
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
8 K1 U$ Q4 k; ^, w( q - .text:24BC2DE2
3 p7 {8 U, H" \ i - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j: o7 A. H) I6 v0 t4 v' P# h6 Y
- .text:24BC2DE2 call ds:OutputDebugStringA F0 ]: h$ D; H
- .text:24BC2DE8 mov eax, 200h0 q# E- K! Y$ Y- L0 I7 r3 L
- .text:24BC2DED jmp loc_24BC3011
u! t( y# a1 s/ d - .text:24BC2DF2 ; ---------------------------------------------------------------------------
2 W! C4 r c5 d5 Q - .text:24BC2DF2! Q) |$ J( ?( n- \5 ?& f; a# m: Y
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j, T- g2 @7 _% P$ L- ^5 u; D
- .text:24BC2DF2 call esi ; FreeLibrary( b7 A( L/ t7 j) L
- .text:24BC2DF4 push 6Ch ; Size; K/ X$ P/ x5 p! x6 d$ S% d2 L k
- .text:24BC2DF6 lea eax, [ebp+Dst]% S2 `# i" t, O% G% ]
- .text:24BC2DFC push edi ; Val' i% g- C4 Q( b* {) ~$ t6 C# p
- .text:24BC2DFD push eax ; Dst
- n1 k$ }1 P) n1 Z: ?4 k - .text:24BC2DFE call memset5 A6 ? f( D6 _0 W, v# J
- .text:24BC2E03 mov eax, [ebp+var_8]
* V9 M8 k: i/ \5 ?8 W% C# l! R, v' y - .text:24BC2E06 add esp, 0Ch
2 l2 W; S1 _, ^& e0 a - .text:24BC2E09 mov [ebp+Dst], 6Ch
6 a- i; F" V6 m5 n% l1 c - .text:24BC2E13 mov [ebp+var_8C], 13 h5 u/ T# I ?
- .text:24BC2E1D mov [ebp+var_28], 200h
/ I' b. _& z& m9 M - .text:24BC2E24 mov ecx, [eax]' J; l" h6 ?6 |8 ]2 r) n& X7 r
- .text:24BC2E26 push 8
4 y. I7 A1 g; u6 U' i1 } - .text:24BC2E28 push edi
0 S* D0 c. D( G5 S O - .text:24BC2E29 push eax9 G/ U# Y0 g, x" ?8 L- g- ^6 l
- .text:24BC2E2A call dword ptr [ecx+50h]5 y: s: a9 T* q
- .text:24BC2E2D test eax, eax* O1 M" n% I$ M0 E# k& B$ N$ \
- .text:24BC2E2F mov eax, [ebp+var_8]
# A) a, m2 V" a' ^8 r+ G - .text:24BC2E32 mov ecx, [eax]- ?- K. M" C$ L( q
- .text:24BC2E34 jge short loc_24BC2E46
4 Y2 m3 @5 Z; {+ u! U! P - .text:24BC2E36 push eax
7 Z6 R% ]* C! D/ W - .text:24BC2E37 call dword ptr [ecx+8]
: d/ t5 ] n. r+ @! X) Z - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule# U) Y$ q5 h4 a
- .text:24BC2E3D call esi ; FreeLibrary% f. ?6 v `, p b
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
- |+ f; N/ @& ]1 S/ ~; ^7 S - .text:24BC2E44 jmp short loc_24BC2E6D
/ B t: t6 K; \, T$ s" m9 l - .text:24BC2E46 ; ---------------------------------------------------------------------------
8 _ C% B2 f0 m! y! S' M0 [ - .text:24BC2E46
. A1 U* x+ h0 L- O- M! F$ z1 d - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
% F4 A: G; i, r5 J2 K% h$ X - .text:24BC2E46 lea edx, [ebp+var_C]
4 X3 T4 V$ S3 [7 V, g - .text:24BC2E49 push edi, p5 s7 d5 k V( S* h! P1 }8 \' n
- .text:24BC2E4A push edx0 m* {3 m. ~9 V& V! [
- .text:24BC2E4B lea edx, [ebp+Dst]
8 c* p1 d0 @3 Z, {0 E/ k - .text:24BC2E51 push edx7 g: E: @) `! R# \# h) A1 p4 Q
- .text:24BC2E52 push eax
: Y% P2 }+ y5 b4 Y9 n7 u7 C - .text:24BC2E53 call dword ptr [ecx+18h]' f* Q; G' |# d9 m$ t- {
- .text:24BC2E56 test eax, eax
1 W7 u. t- I+ `& d: D - .text:24BC2E58 jge short loc_24BC2E7A
7 m0 y# }9 J. B- d2 ]# v$ @ - .text:24BC2E5A mov eax, [ebp+var_8] B% w/ r2 r$ ]# P. i" j
- .text:24BC2E5D push eax
; y) b/ ~1 u4 ]8 F - .text:24BC2E5E mov ecx, [eax]+ k/ X1 y9 Z# s' W- F$ E2 e7 e* E
- .text:24BC2E60 call dword ptr [ecx+8]" b: l2 E4 y- C: i7 [0 _5 o% w
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule4 I; Q* J2 \: V9 h5 M7 g' W4 r
- .text:24BC2E66 call esi ; FreeLibrary+ u$ p+ l& d4 u# E) _6 y
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
/ W+ L: j4 R+ M/ C. L7 f7 S8 N - .text:24BC2E6D
; t3 x! W, d7 _5 U* E - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
* x. k x4 {; F: m: m3 B - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
# a" n! N9 L @ - .text:24BC2E6D call ds:OutputDebugStringA
! v( e D$ ?& o4 _5 ~+ l - .text:24BC2E73 xor eax, eax% a- J# e9 y' E0 L( G4 ]( L6 i
- .text:24BC2E75 jmp loc_24BC3011# f* w) F0 H& b: t5 l+ ^
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 6 t6 N! R8 \1 |) f
6 G5 Q6 X/ Q/ M' C' G5 @4 x$ d5 R8 K' S0 |
|