这游戏以前分析过,本贴再写得详细一些。+ z) I$ G7 f. l) t" k
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
% p9 ^: v8 e" G0 y. L3 I0 {注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
. j/ n. m) c; u: r$ G5 b" ~
# ]' T% a3 K, B6 H参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.3 F) `) [! V0 n4 n i+ D
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;$ Z. }* c' o/ f0 F+ e; m: d
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
& ]+ D2 T1 H z% P# E" p% g4 R7 p& b - STDMETHOD_(ULONG,Release) (THIS) PURE;
1 J% S7 V( D0 o1 e6 a- y - STDMETHOD(Compact)(THIS) PURE;+ |3 T5 P; ^% Q
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;8 t) i% O/ K3 i5 V. c7 m8 @
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
. E+ Z) r% G6 i2 v9 |7 Q+ K+ D - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 . D" K% w% S& {' R* ^
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 1 H: g; g& Z& H8 G* z; e) d
) J( ]( v$ {# h! T. N; X& c+ C5 ~
- G. i1 J3 v; b5 B. P7 U$ `2 ?" L9 B& i! u c) i, c7 \
- V* j0 q) I! J7 @0 J) R- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================! ]; R8 q7 w' k! Y, e* n) c. b
- .text:24BC2CD2- U4 r: h3 v" ?1 F# m. f: ^0 r
- .text:24BC2CD2 ; Attributes: bp-based frame: e, x# y: t( e% Z' t/ k, X3 x
- .text:24BC2CD2
5 q& Y3 T: [- a6 l: ]+ m - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p G8 G0 {, e) R2 z2 w- {6 i
- .text:24BC2CD2
- L" T/ z J' b" v$ d4 i3 ` - .text:24BC2CD2 Dst = dword ptr -90h
+ \/ v$ {1 q8 Q8 e9 M( Z- I - .text:24BC2CD2 var_8C = dword ptr -8Ch
- I% D# P+ r1 o4 k - .text:24BC2CD2 var_28 = dword ptr -28h1 @$ g- W; ?* C6 J5 m' V
- .text:24BC2CD2 var_24 = dword ptr -24h
6 K; C; _- T" V; G - .text:24BC2CD2 var_20 = dword ptr -20h- P4 t5 g6 C4 e( t7 r
- .text:24BC2CD2 var_1C = dword ptr -1Ch
1 f# w! i4 X# g" N! B( U. j M' w - .text:24BC2CD2 var_18 = dword ptr -18h" @ I. J) `0 c: B
- .text:24BC2CD2 ppv = dword ptr -14h8 o4 \0 u M2 U; e0 \8 c9 A, }
- .text:24BC2CD2 var_10 = dword ptr -10h
! }$ w2 R" a8 g) l - .text:24BC2CD2 var_C = dword ptr -0Ch
5 L! {/ I6 M% U# K - .text:24BC2CD2 var_8 = dword ptr -8
+ t3 | \" D( U8 U2 i - .text:24BC2CD2 hLibModule = dword ptr -4) @% ^3 U$ |" i9 _6 T
- .text:24BC2CD2
! y# d# V7 W; k - .text:24BC2CD2 push ebp) X- I# @/ a2 O/ Y( @% f7 T
- .text:24BC2CD3 mov ebp, esp
3 o* d- g6 w: Y' w* F - .text:24BC2CD5 sub esp, 90h
7 R0 A# [. H. I - .text:24BC2CDB push ebx
( @4 e8 Y# Z) m5 O - .text:24BC2CDC mov ebx, ds:LoadLibraryA
0 w. H$ Q& k& I. D; m - .text:24BC2CE2 push esi
; g" M* W9 w% w4 T6 z" n, s - .text:24BC2CE3 push edi) {% m( o& I9 q
- .text:24BC2CE4 xor edi, edi& z! w; A8 f. a6 C/ {
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
! d0 ]" `- r$ H) o) H9 ^ - .text:24BC2CEB mov [ebp+var_8], edi
4 F/ X$ g* F: e7 Y. \' q+ K) i) V - .text:24BC2CEE mov [ebp+var_1C], edi
6 d- H7 o- G& h0 Z0 u, w - .text:24BC2CF1 mov [ebp+var_C], edi2 T& C: L4 b" B# [& Z
- .text:24BC2CF4 mov [ebp+var_10], edi
: y" C- Z! W" A( C - .text:24BC2CF7 mov [ebp+var_18], edi& Z0 x, R- o* L! M' N# {% x7 m
- .text:24BC2CFA call ebx ; LoadLibraryA0 `0 Q9 e( v- c7 e0 h
- .text:24BC2CFC mov esi, eax9 a- k; h; d/ Y2 ^/ }7 K2 x
- .text:24BC2CFE cmp esi, edi
8 ?' _. j8 Z$ S# e, A* b; | - .text:24BC2D00 mov [ebp+hLibModule], esi- @" K% b& U# t
- .text:24BC2D03 jnz short loc_24BC2D0F% O' D7 K3 ^$ w) y
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"$ C% B! x3 U' ?- A! k4 Z$ `
- .text:24BC2D0A jmp loc_24BC2E6D
% @: T1 |5 g6 c - .text:24BC2D0F ; ---------------------------------------------------------------------------
4 r5 K$ r! b% s* Y - .text:24BC2D0F
! |) P% {0 F# T) Y - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
& \% e, ` R% w) T$ \: M3 x - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"0 m6 H# h. N7 L3 X; h( j D$ a* a9 B
- .text:24BC2D14 push esi ; hModule r8 q- H, a7 ]; @/ S
- .text:24BC2D15 call ds:GetProcAddress
3 j+ r) C5 J) W" [3 C7 `0 W - .text:24BC2D1B cmp eax, edi2 e ~8 f W+ D% G. P
- .text:24BC2D1D jnz short loc_24BC2D30
" e8 Q; C- `1 a! q* i - .text:24BC2D1F push esi ; hLibModule4 P+ U$ H3 A; y9 o
- .text:24BC2D20 call ds:FreeLibrary
. U6 N1 C% B' _ - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...9 E2 _7 s9 w1 p& A
- .text:24BC2D2B jmp loc_24BC2E6D b, J5 Y: j9 F; \8 F
- .text:24BC2D30 ; ---------------------------------------------------------------------------
( }. V* s( ]- \# X+ R# `1 r0 |) { - .text:24BC2D30' z& _) X' D" A
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j$ c8 G0 |8 z* O- r% N
- .text:24BC2D30 lea ecx, [ebp+var_8]* z4 K; B$ ~& o8 B% x5 u
- .text:24BC2D33 push edi
6 m0 Z, j: y, [" E' |1 l% h" b8 x - .text:24BC2D34 push ecx, `1 Z( N; E% [/ d1 }
- .text:24BC2D35 push edi
2 z4 K6 @+ H9 _5 u: T' v - .text:24BC2D36 call eax4 f, q0 P% ^% o+ O& ]0 l7 D8 u
- .text:24BC2D38 test eax, eax! R9 i3 Z2 Q# l. w& v: i) l
- .text:24BC2D3A jge short loc_24BC2D4D
+ s y+ r+ p _ - .text:24BC2D3C push esi ; hLibModule* j% P" f, Z6 p( Y
- .text:24BC2D3D call ds:FreeLibrary
9 d' D/ h# g1 c" ?* Y$ Y' B - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
3 B& B1 S6 ]3 ?% ~ - .text:24BC2D48 jmp loc_24BC2E6D3 I7 c% ~6 j3 W3 u3 O) i" v' ]
- .text:24BC2D4D ; ---------------------------------------------------------------------------2 @$ I( L5 q5 h% i% P7 | {1 {7 d
- .text:24BC2D4D
& l/ L9 v. t' w - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
: C2 b/ @" m% A - .text:24BC2D4D mov eax, [ebp+var_8]& U9 W1 J6 |: @
- .text:24BC2D50 lea edx, [ebp+var_1C]' O6 ]/ i3 i. z. ^0 Q; x
- .text:24BC2D53 push edx
8 g3 R" I0 c3 L" b( u% d/ F( Y - .text:24BC2D54 push offset unk_24BC4470
- f! ?7 X5 z7 q7 y! y& A - .text:24BC2D59 mov ecx, [eax]
( Y' I& E: ~7 T) ^9 f3 m; |1 z% ]" E - .text:24BC2D5B push eax5 ~* [0 |( s6 P0 {
- .text:24BC2D5C call dword ptr [ecx]
. G. ^% `0 G7 @5 S' T3 M7 v6 `: W - .text:24BC2D5E test eax, eax
( B+ ~& k9 y; o% @1 S3 H - .text:24BC2D60 jge short loc_24BC2D87- V6 A' n- V4 d% o
- .text:24BC2D62 mov eax, [ebp+var_8]
' ?& r/ N8 o; H5 V4 v - .text:24BC2D65 push eax
g2 t, ~3 k: w - .text:24BC2D66 mov ecx, [eax]
0 d' o; u7 \8 p: b' X - .text:24BC2D68 call dword ptr [ecx+8]
0 V2 J; h+ d! H5 ~+ a& j. M% @" h - .text:24BC2D6B push esi ; hLibModule/ p0 o1 _$ Y3 i) D7 g! b; L' M
- .text:24BC2D6C call ds:FreeLibrary
( ]) }, {9 u: T& X - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n": w8 k) W7 ^+ T/ R+ J9 {7 ?
- .text:24BC2D77 call ds:OutputDebugStringA
4 {3 }: u6 E6 ~5 M - .text:24BC2D7D mov eax, 100h' B/ j3 j1 r% `
- .text:24BC2D82 jmp loc_24BC3011
0 Q# L4 r9 _3 y! L8 L3 [5 w - .text:24BC2D87 ; ---------------------------------------------------------------------------1 u! E. ?+ B& m
- .text:24BC2D87
; M( z. _) O) f: b - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j; E' c5 C& O1 U& X- [6 n( q
- .text:24BC2D87 mov eax, [ebp+var_1C]9 z t8 ]7 j' w2 ]1 p
- .text:24BC2D8A push eax; X( @5 e2 Q3 d' X5 A: G7 \/ g) _
- .text:24BC2D8B mov ecx, [eax]0 A; A. U( W% w d6 w( E/ N0 a
- .text:24BC2D8D call dword ptr [ecx+8]
( N: J# z/ M1 W; x7 Y& L7 K - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"8 d' W7 K0 C0 w# ~# [/ j
- .text:24BC2D95 call ebx ; LoadLibraryA7 v! C e* H. W' k. I# q6 [' O" b
- .text:24BC2D97 mov esi, eax
. U k$ X: v/ E* J2 `) \. n" v9 N - .text:24BC2D99 cmp esi, edi: c$ ?% b8 i. S0 |
- .text:24BC2D9B jnz short loc_24BC2DB6
- M4 V C3 C6 n$ l/ `7 j - .text:24BC2D9D mov eax, [ebp+var_8]
X' c$ j1 E6 p. Z1 S+ a - .text:24BC2DA0 push eax
" H- T0 M+ c4 {/ M- L - .text:24BC2DA1 mov ecx, [eax]
& y$ v) \, D4 b - .text:24BC2DA3 call dword ptr [ecx+8]: B/ H( _3 o' V3 L8 w- z& I$ d
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule7 V9 F/ w9 s) w8 d
- .text:24BC2DA9 call ds:FreeLibrary
1 E2 A1 ]( W* Z - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
. j7 g5 Q$ i L w - .text:24BC2DB4 jmp short loc_24BC2DE2
# i: l) H$ M2 y$ ]3 I5 H/ ~7 [2 ]! } - .text:24BC2DB6 ; ---------------------------------------------------------------------------
% H* q4 N2 O8 a - .text:24BC2DB64 q1 K, e5 `; a
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
4 s1 N" a- J% m3 v4 E - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
/ Z; d0 R( R2 g, e o7 ] - .text:24BC2DBB push esi ; hModule; b/ L" [7 J) U
- .text:24BC2DBC call ds:GetProcAddress& l& `, Y4 y3 d. S+ [' ]2 E* Q
- .text:24BC2DC2 push esi ; hLibModule5 A) N# m2 A/ f1 q
- .text:24BC2DC3 mov esi, ds:FreeLibrary5 @% O. F5 {6 l
- .text:24BC2DC9 test eax, eax
9 W; @9 ], B1 i$ U9 {; o - .text:24BC2DCB jnz short loc_24BC2DF2" E4 [5 D! c" J0 l' r
- .text:24BC2DCD call esi ; FreeLibrary
% U# D2 Y7 z6 ]% k8 }3 B - .text:24BC2DCF mov eax, [ebp+var_8]/ f+ C+ n$ j1 x3 E8 ^: Q
- .text:24BC2DD2 push eax
8 r& O, g! e: Q$ Q/ Q6 b3 n - .text:24BC2DD3 mov ecx, [eax]
+ c3 D* D( p* v2 e% |7 P* b - .text:24BC2DD5 call dword ptr [ecx+8]+ _5 l( J Q" C( g4 m2 g
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule% {0 b* l' l' b
- .text:24BC2DDB call esi ; FreeLibrary
, ~ D* X% o* U# [( K/ l) t( ^ - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
( P& X; g# T. y0 L/ ` - .text:24BC2DE2
9 j2 q8 C; `7 o2 l }' P' w$ i+ p - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
" h9 Y8 T9 I# |& [, _) e, o, Y+ D - .text:24BC2DE2 call ds:OutputDebugStringA, T6 O c! q* w( G7 o: E
- .text:24BC2DE8 mov eax, 200h/ `2 D5 ^2 F5 B: g3 x* a
- .text:24BC2DED jmp loc_24BC3011
9 {- t) S+ O, c" C( e% k - .text:24BC2DF2 ; ---------------------------------------------------------------------------
3 q2 [' h; T! U' Z5 Y* r) U5 d/ Q - .text:24BC2DF2( ^: c5 B; `9 u: `& n
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j( R- o* E" h5 l% |& n' n) Q& ~9 v
- .text:24BC2DF2 call esi ; FreeLibrary6 _4 G k3 P8 b, u5 J3 ^! q
- .text:24BC2DF4 push 6Ch ; Size
, q3 {: e( u- ^; N( w; Z( y, ~ - .text:24BC2DF6 lea eax, [ebp+Dst]' H. k3 A! M9 k4 U: H. G$ _
- .text:24BC2DFC push edi ; Val
8 t: I0 ?9 H @ - .text:24BC2DFD push eax ; Dst
; _; O8 S+ @( X/ b1 {6 m - .text:24BC2DFE call memset& X; u/ S5 @- P0 q/ b
- .text:24BC2E03 mov eax, [ebp+var_8]
! t3 T$ P8 v& y! }) ]/ e - .text:24BC2E06 add esp, 0Ch; U# M; H5 _2 A$ M/ J1 [
- .text:24BC2E09 mov [ebp+Dst], 6Ch. n5 x7 R5 G3 Q$ j2 z0 ^; m# H
- .text:24BC2E13 mov [ebp+var_8C], 10 @5 t9 q7 w$ ?* ^# n3 o
- .text:24BC2E1D mov [ebp+var_28], 200h5 h+ D! J8 k; y! w6 w' H) M& L+ C3 C: P
- .text:24BC2E24 mov ecx, [eax]
; v/ F: A5 n8 i- p* e - .text:24BC2E26 push 8
3 M% o3 A; ^5 W - .text:24BC2E28 push edi$ Q& R, r0 K7 q" J
- .text:24BC2E29 push eax
. F2 ^% ^0 g- V' y; i: o - .text:24BC2E2A call dword ptr [ecx+50h]
0 e( T/ E; h1 j$ A9 _2 E - .text:24BC2E2D test eax, eax% Z+ I' s( }( f! [. ` ] l
- .text:24BC2E2F mov eax, [ebp+var_8]
: U" h. A+ J- M4 ]# k - .text:24BC2E32 mov ecx, [eax]
. {: M- y# u+ L+ H: N4 _/ S6 T$ | - .text:24BC2E34 jge short loc_24BC2E464 _% Y, Q0 K. ?0 H0 C6 z
- .text:24BC2E36 push eax
' W5 g ^- ?/ W* h( O. o - .text:24BC2E37 call dword ptr [ecx+8]% F+ K3 b) _) ]' R I
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule6 C& D" `4 @0 i N+ S, V
- .text:24BC2E3D call esi ; FreeLibrary
) g) b( k3 b5 O" V% G6 w - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n": [( _8 \4 U0 K) y- u5 [
- .text:24BC2E44 jmp short loc_24BC2E6D$ E; S6 c# S- u% V* o i
- .text:24BC2E46 ; ---------------------------------------------------------------------------
+ U: v$ I4 Z# }" { - .text:24BC2E46
% i/ ^4 G2 d: U8 l I( p3 x6 T - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j8 C1 l. F$ \2 L# w) V
- .text:24BC2E46 lea edx, [ebp+var_C]
- J. z [% K E2 J' B# v3 y O8 f% ? - .text:24BC2E49 push edi
4 S& n5 ^5 m- J - .text:24BC2E4A push edx! D' @& \, }0 v5 O
- .text:24BC2E4B lea edx, [ebp+Dst]
$ `. Z+ J8 @+ v - .text:24BC2E51 push edx5 i) `8 f9 [! Q; I2 r- o
- .text:24BC2E52 push eax
0 C, l8 S( y7 T6 o) E" \ - .text:24BC2E53 call dword ptr [ecx+18h]4 l; R, [8 V" O! v! O
- .text:24BC2E56 test eax, eax
2 S5 q9 r" @/ ^: f) ~" V% C - .text:24BC2E58 jge short loc_24BC2E7A* ^6 I- [& B: X6 o
- .text:24BC2E5A mov eax, [ebp+var_8]
! W# V! h A. F& W6 h, N - .text:24BC2E5D push eax
) z3 N6 u6 D6 x - .text:24BC2E5E mov ecx, [eax]
7 _) ]5 N, {5 L% |/ R - .text:24BC2E60 call dword ptr [ecx+8]8 J; ]$ a$ n$ l
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
: R: n( U; v( v3 o; [8 j - .text:24BC2E66 call esi ; FreeLibrary
6 V9 P1 L) ~3 T, n9 W( g - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"& M% ~0 J a5 t/ v# Y/ Q
- .text:24BC2E6D6 D6 ]1 G' M0 z0 Y1 o2 H" Y
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
, M. i' g0 s$ ]+ S/ {! c: x" S - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...' k' v) r; D3 k6 @, L" P; q
- .text:24BC2E6D call ds:OutputDebugStringA
* X1 U; D/ Q0 W* q - .text:24BC2E73 xor eax, eax
5 w) U! g7 P2 F - .text:24BC2E75 jmp loc_24BC3011
! ~7 k5 h6 h) D L( K( V) A# u' G - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 2 j6 m4 m( v6 C3 ?! {
4 c2 [! W7 C8 n5 `! l7 t2 B5 Z) v) v& b0 W$ ]
|