这游戏以前分析过,本贴再写得详细一些。
% q- {2 w) E Q) L$ d7 Y# j这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
5 D! i$ ?" M( S' j Q% ^: S注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。& X/ o R* G9 Q4 C5 b8 b# p' B
* ?/ B& k' m7 H% u# h" e( ?$ w参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
* E1 Q& e! u# Q8 D- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
. n% s! I- y$ k; T/ j3 W( ` - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
0 @' N+ t7 M' o. x- [ U - STDMETHOD_(ULONG,Release) (THIS) PURE;
. z8 S8 P/ h# C - STDMETHOD(Compact)(THIS) PURE;. X6 I3 V' _8 z9 E3 ]* F
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
1 C8 H- Y/ V3 e8 e+ R - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
0 z( {/ a7 Y$ L$ U( j0 N8 g. p - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
) ] j0 U7 Y1 P* ? F) m& U以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 6 f/ T- m# A; {) v0 n2 s
: z% @+ ]1 S5 g E$ M
j2 o6 h3 C9 Y* z1 N1 W% b
: h1 l1 n+ T6 ]% }, F- 3 I, q9 p9 U. }# q% H% n
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================4 ~! g* Q! b$ v/ q* H( I5 p
- .text:24BC2CD2
i% E# \9 i1 z( B0 F - .text:24BC2CD2 ; Attributes: bp-based frame
( B) ` j) l, D: {. n - .text:24BC2CD24 Z9 U4 F5 {1 L9 R1 z G
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p( S, g- P: q, S# d. X8 a
- .text:24BC2CD2
6 n, a+ N' R( n7 E - .text:24BC2CD2 Dst = dword ptr -90h# D% w9 w0 K' w9 W- w# \6 u
- .text:24BC2CD2 var_8C = dword ptr -8Ch
1 h2 _# P w( C" ~0 D6 c - .text:24BC2CD2 var_28 = dword ptr -28h9 ^' ^$ n7 J" g" J2 u+ u# d
- .text:24BC2CD2 var_24 = dword ptr -24h
- p1 j, [. D( H$ z3 b: ^ - .text:24BC2CD2 var_20 = dword ptr -20h! l$ g, Z! W3 w) S$ p6 D# w
- .text:24BC2CD2 var_1C = dword ptr -1Ch; \/ R$ z" a# q# Q7 ]5 Y
- .text:24BC2CD2 var_18 = dword ptr -18h
, _: j" y# a! u - .text:24BC2CD2 ppv = dword ptr -14h. r) ~6 x5 ~( E: N P9 s' y$ Q
- .text:24BC2CD2 var_10 = dword ptr -10h, S* C1 T2 M) p' g
- .text:24BC2CD2 var_C = dword ptr -0Ch
" k+ i7 P, f2 v! e3 K( B- u4 F - .text:24BC2CD2 var_8 = dword ptr -8
' z ~; K$ u* F$ P9 n5 Z; s - .text:24BC2CD2 hLibModule = dword ptr -4
, V& O0 v9 J7 r3 T - .text:24BC2CD2
/ j$ h( B1 p9 y$ S - .text:24BC2CD2 push ebp$ B H# v w% x: e x
- .text:24BC2CD3 mov ebp, esp. `. B& ]: X" C) q, k$ v2 s7 ~
- .text:24BC2CD5 sub esp, 90h
) r* B b, o f - .text:24BC2CDB push ebx' B. a: D* b" {4 l
- .text:24BC2CDC mov ebx, ds:LoadLibraryA' S; ?2 n+ X5 i: u
- .text:24BC2CE2 push esi. Q% \7 J, _1 h
- .text:24BC2CE3 push edi
' k; h6 c& X8 G$ }: y8 O6 G6 a& ^ - .text:24BC2CE4 xor edi, edi7 q+ h" B6 d O
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
4 K% X( k) |) v' A1 ?! I# Z - .text:24BC2CEB mov [ebp+var_8], edi, L7 }4 x9 ]$ Q" z$ y
- .text:24BC2CEE mov [ebp+var_1C], edi
' ?/ d/ K* B; g - .text:24BC2CF1 mov [ebp+var_C], edi2 b- d4 x* ?! c5 }# V9 F" [0 U
- .text:24BC2CF4 mov [ebp+var_10], edi
|6 }3 X0 _, b9 ~ - .text:24BC2CF7 mov [ebp+var_18], edi
2 s' d' g- p! f8 D - .text:24BC2CFA call ebx ; LoadLibraryA9 o$ F: l% l1 P
- .text:24BC2CFC mov esi, eax
0 [' ~" ]/ j0 h& L* T+ u4 K - .text:24BC2CFE cmp esi, edi
1 q0 b/ T- i: v8 g/ C0 t - .text:24BC2D00 mov [ebp+hLibModule], esi
0 z: P9 c8 U. A4 A1 a. v2 m% ? - .text:24BC2D03 jnz short loc_24BC2D0F5 F0 h* K4 |) }: v3 F
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"6 q' n9 `- v. a9 M! n
- .text:24BC2D0A jmp loc_24BC2E6D, X6 H# a, p. s2 V7 x4 J- I" s( k& k
- .text:24BC2D0F ; ---------------------------------------------------------------------------( _* t* s3 @9 q2 Q' w
- .text:24BC2D0F, a: S2 v- v! C
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
, B& c0 P0 b% w1 w& b1 m - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
0 x9 _! @) [7 h! |+ _! T' E - .text:24BC2D14 push esi ; hModule/ H, ]. K) P5 `' m+ n7 ?/ h
- .text:24BC2D15 call ds:GetProcAddress d% k, F7 K: b" n! K
- .text:24BC2D1B cmp eax, edi
0 V+ r7 `) V& I, t8 L - .text:24BC2D1D jnz short loc_24BC2D30
/ K% |# d4 _2 D- p# A - .text:24BC2D1F push esi ; hLibModule
- T+ T8 A, t; g+ H9 q" t$ a1 v9 I6 n - .text:24BC2D20 call ds:FreeLibrary
; @/ i& J/ @' G7 w - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
) r% h3 [* v( k* I) z - .text:24BC2D2B jmp loc_24BC2E6D
" G. {! n3 N9 b. S - .text:24BC2D30 ; ---------------------------------------------------------------------------; G# \; `1 G/ v+ H6 B0 A, H& _
- .text:24BC2D30" j! m4 R6 J5 M% t! c! G! A
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j8 a. M$ E0 _; a: r l5 E, D0 n
- .text:24BC2D30 lea ecx, [ebp+var_8]; p# {4 ^& T* G/ Q' a* F
- .text:24BC2D33 push edi
1 @/ t4 _. b& \6 N9 R+ U - .text:24BC2D34 push ecx
) d2 }+ d. x' J - .text:24BC2D35 push edi5 }) n5 |" P% r$ B6 i/ i' O, i& x
- .text:24BC2D36 call eax3 ?+ X. p2 _0 z1 A: q
- .text:24BC2D38 test eax, eax
% K# v* R6 E1 ~1 W - .text:24BC2D3A jge short loc_24BC2D4D) F9 }3 e ?. P6 u
- .text:24BC2D3C push esi ; hLibModule) k% W0 A6 I! e, m9 I
- .text:24BC2D3D call ds:FreeLibrary
$ _) ^: M9 C( |+ |6 J- A - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n") w/ o6 }! F; ^; K! R
- .text:24BC2D48 jmp loc_24BC2E6D
. O7 w1 T: z0 h$ ^* f, P$ v! d - .text:24BC2D4D ; ---------------------------------------------------------------------------
$ h+ m c% A3 W5 I- z/ w - .text:24BC2D4D
5 @. U0 J( U" D9 g - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j4 u8 H' o9 c0 x ^ n. U
- .text:24BC2D4D mov eax, [ebp+var_8]
2 A- v8 t8 Q5 c$ E% N- E; @ - .text:24BC2D50 lea edx, [ebp+var_1C]$ X, R, r+ q, G. ~$ t9 E
- .text:24BC2D53 push edx, v) o1 W- `5 E( M
- .text:24BC2D54 push offset unk_24BC4470; C2 A; c; m1 C) F$ f
- .text:24BC2D59 mov ecx, [eax]1 a5 ?' @/ M: F! C8 b. m5 c4 n
- .text:24BC2D5B push eax3 C8 r6 V2 S( U0 f
- .text:24BC2D5C call dword ptr [ecx]8 z6 I- D, D& W9 j0 B
- .text:24BC2D5E test eax, eax* ~ r$ P4 H5 x2 l' O- M0 b4 G8 R
- .text:24BC2D60 jge short loc_24BC2D87% H2 B% E) a9 U$ h- n1 u( q( z6 o
- .text:24BC2D62 mov eax, [ebp+var_8]& U! \( a1 c7 @1 `
- .text:24BC2D65 push eax
2 [( J3 ^4 D) N6 L8 R( ^! C - .text:24BC2D66 mov ecx, [eax]+ o; p$ _9 W6 X4 V( \# A) p/ B
- .text:24BC2D68 call dword ptr [ecx+8]
) F3 Z" c0 y1 P7 W/ J* { - .text:24BC2D6B push esi ; hLibModule
7 {4 M& y4 `0 T - .text:24BC2D6C call ds:FreeLibrary; K& D( E, N5 I# p; R8 n0 e v
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"9 S' D& g9 w8 v8 D
- .text:24BC2D77 call ds:OutputDebugStringA! C+ O8 ?0 T) `+ P; O* X; W' K
- .text:24BC2D7D mov eax, 100h
6 L; S$ D4 W" o% n0 l5 n - .text:24BC2D82 jmp loc_24BC3011
) m0 A3 i6 p# X# [. H6 u% K - .text:24BC2D87 ; ---------------------------------------------------------------------------
0 u. p9 U3 J1 |3 | - .text:24BC2D87" b$ \/ t+ Z7 ]0 @
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
6 D+ E& r6 t0 Q Y# p - .text:24BC2D87 mov eax, [ebp+var_1C]6 i- r( ?$ H' G
- .text:24BC2D8A push eax0 n( O3 z) h, c5 m+ `
- .text:24BC2D8B mov ecx, [eax]
2 x+ R# J. u1 | y1 S, N! j - .text:24BC2D8D call dword ptr [ecx+8]
; p) K' y1 }7 k. r - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"2 {' f: P9 N x! H1 s
- .text:24BC2D95 call ebx ; LoadLibraryA
# |+ i6 ~: q* B$ _) k5 c1 u7 g - .text:24BC2D97 mov esi, eax
- `) P% I {! s$ d$ B - .text:24BC2D99 cmp esi, edi
% P6 v N- A" Z4 ]9 m# Y; v - .text:24BC2D9B jnz short loc_24BC2DB6
' Y, |* g& I4 I" C R e, _ - .text:24BC2D9D mov eax, [ebp+var_8]* Y& N9 ^+ m7 w2 `1 R9 q; K3 i
- .text:24BC2DA0 push eax
! z* j. D% d2 ^. f: ^9 z - .text:24BC2DA1 mov ecx, [eax]* j# C$ u" y& o# }: s* ~
- .text:24BC2DA3 call dword ptr [ecx+8]
+ z* |& p9 \% s( w# }7 Y4 I - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule7 B, ^7 k) Y2 j. A
- .text:24BC2DA9 call ds:FreeLibrary
$ L5 z8 `5 c0 m1 T' z9 | - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
- {- M! i% [( c' {7 b$ L% L1 [) B - .text:24BC2DB4 jmp short loc_24BC2DE2
0 N5 b4 v$ ^) P6 M' O - .text:24BC2DB6 ; ---------------------------------------------------------------------------
2 h1 P& N4 V5 H1 {+ n0 M$ g - .text:24BC2DB64 ^( Y: K2 O+ Q: L/ K& k
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j- S; u" K7 _. v2 W" j
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"$ h6 e# P3 ~. P$ {) }* U
- .text:24BC2DBB push esi ; hModule
* i9 K( R L9 O; f1 e - .text:24BC2DBC call ds:GetProcAddress/ ~/ N) I; j3 Y% d* ^% E0 z, e
- .text:24BC2DC2 push esi ; hLibModule5 S9 y. X1 Y) F4 z
- .text:24BC2DC3 mov esi, ds:FreeLibrary
- P. \/ C' ^( e+ P; d5 k: X - .text:24BC2DC9 test eax, eax' _: w7 W; p+ S/ h$ U
- .text:24BC2DCB jnz short loc_24BC2DF22 ?* G1 r$ U* k: D7 V( W1 ~
- .text:24BC2DCD call esi ; FreeLibrary. x# d5 w) b! x4 \
- .text:24BC2DCF mov eax, [ebp+var_8]
* ^) v2 a7 q: n( y6 m* Y- Z) K - .text:24BC2DD2 push eax
, w2 k1 C- B2 o - .text:24BC2DD3 mov ecx, [eax]. i7 O5 ~1 ~4 f6 h0 @' s' g
- .text:24BC2DD5 call dword ptr [ecx+8] a( K9 H1 h* K
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule' w$ i6 L$ T% t6 ]4 J) m3 k
- .text:24BC2DDB call esi ; FreeLibrary' a) o0 _6 A4 Q% Q* ]/ ?- g; q
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
! j: }. H+ }2 e. W9 | - .text:24BC2DE2: V) N9 R' ?3 f- i
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j2 X# I" E$ z/ Z
- .text:24BC2DE2 call ds:OutputDebugStringA2 ?6 `4 Y" V0 v: ^* u
- .text:24BC2DE8 mov eax, 200h5 x: |6 D4 L1 x( P" q, F7 V4 J5 j9 t i
- .text:24BC2DED jmp loc_24BC30114 g$ Z; v; h! C5 ~# T( @
- .text:24BC2DF2 ; ---------------------------------------------------------------------------+ X: y2 w' C4 ^
- .text:24BC2DF2
; G+ ]. \& N2 I1 Z- s: c - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j# j4 F$ A% y4 Y
- .text:24BC2DF2 call esi ; FreeLibrary+ m1 X' X; ~) n1 ~
- .text:24BC2DF4 push 6Ch ; Size& p% g! V' B* P
- .text:24BC2DF6 lea eax, [ebp+Dst]
$ c. F1 f: b1 f; F$ T+ g: \ - .text:24BC2DFC push edi ; Val
: l. r& {+ D2 b8 e: n% U- B4 h Y - .text:24BC2DFD push eax ; Dst( m( ~- Q! F+ k& P2 c: y: b
- .text:24BC2DFE call memset
4 H" u& ?3 d4 w$ ?, M( k - .text:24BC2E03 mov eax, [ebp+var_8]
# C' ]8 T5 I4 `' \ - .text:24BC2E06 add esp, 0Ch; [$ G- }8 G: D/ ?3 S- s
- .text:24BC2E09 mov [ebp+Dst], 6Ch
8 F/ n4 C o, r# I( ]7 m6 X - .text:24BC2E13 mov [ebp+var_8C], 1
- K, K- T$ f, r! l4 s" x. U5 N - .text:24BC2E1D mov [ebp+var_28], 200h
: T: i, [, X: }% h6 j. o - .text:24BC2E24 mov ecx, [eax]+ T+ _+ A: `9 q# ?
- .text:24BC2E26 push 8) F8 s3 e3 O/ v$ U% g) r
- .text:24BC2E28 push edi0 W; M% m! R1 F8 G1 Y3 N2 W$ ~
- .text:24BC2E29 push eax
( |' ^, F K* S' R - .text:24BC2E2A call dword ptr [ecx+50h]
3 [2 U. s9 L, J! u# G8 U% T( m% D - .text:24BC2E2D test eax, eax
7 g' I0 ]( R/ f' b8 m - .text:24BC2E2F mov eax, [ebp+var_8] M* G- A& W- J: e$ a
- .text:24BC2E32 mov ecx, [eax]! I; M. @( N7 u' B& I! a; g
- .text:24BC2E34 jge short loc_24BC2E46# N3 U; _2 F! r
- .text:24BC2E36 push eax
& U1 a6 N' ^2 B1 Z3 v0 h" p - .text:24BC2E37 call dword ptr [ecx+8]
% s9 B; V2 }% d - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule) n8 q$ k {6 I. u: [+ V
- .text:24BC2E3D call esi ; FreeLibrary/ z& L3 \- e8 i6 W/ W- g" S
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
4 P' A; t6 o" v5 Y5 Q) P - .text:24BC2E44 jmp short loc_24BC2E6D5 Q! @: d v4 Q
- .text:24BC2E46 ; ---------------------------------------------------------------------------$ |+ ?+ X7 @' k! p2 m) g- c; \. U" y
- .text:24BC2E46
/ }+ i; ^" w: L1 } - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j! {, B+ _2 i# a6 h9 D
- .text:24BC2E46 lea edx, [ebp+var_C], c$ G3 }. u7 A1 s3 l7 N
- .text:24BC2E49 push edi4 |$ a7 u5 J* R' \
- .text:24BC2E4A push edx
! r5 e$ c. s9 o8 e; L/ Z, S- p - .text:24BC2E4B lea edx, [ebp+Dst]
$ n. k$ O0 U: v" n+ M: z - .text:24BC2E51 push edx
1 q6 ^2 T4 E3 V* x; p o# s - .text:24BC2E52 push eax
. R n6 O/ q+ E, C - .text:24BC2E53 call dword ptr [ecx+18h]3 m/ J/ V* Z/ p+ T$ z7 s
- .text:24BC2E56 test eax, eax' A9 @2 ?( U6 X7 z' t* v: i
- .text:24BC2E58 jge short loc_24BC2E7A2 p4 R3 m% u! c$ o9 U% ]
- .text:24BC2E5A mov eax, [ebp+var_8] }& v) \ z( {) T& c
- .text:24BC2E5D push eax l6 [/ }9 `4 c0 x2 W+ O9 R
- .text:24BC2E5E mov ecx, [eax]
; h4 @- x+ F! u u6 ? O - .text:24BC2E60 call dword ptr [ecx+8]
5 A( W: z/ R6 h - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
* }6 Y: X5 G9 c$ i1 |: G - .text:24BC2E66 call esi ; FreeLibrary& V9 B1 l0 {! {/ o
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
\6 R* s$ ~% e2 c5 e/ a- V - .text:24BC2E6D# E% A! |# h1 _0 F( @' Z9 P7 X
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j# E R! L# ]( X) f* c |, }8 h
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
2 h& I* H7 s; b0 [ - .text:24BC2E6D call ds:OutputDebugStringA: E2 {' u& W, g& U% r
- .text:24BC2E73 xor eax, eax
" R; \! O) Z5 A - .text:24BC2E75 jmp loc_24BC3011
( F! i3 j# b3 A$ F! S - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 / w5 o) s+ p5 r4 a) t
- ]( C$ Y& M' L' ]+ b: V
k1 p0 a7 ?$ ^0 }8 O" |4 n |