这游戏以前分析过,本贴再写得详细一些。
* \: F( P. q$ |/ { q* `这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
8 J4 l/ X- d. Y8 |& S注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
. }5 s3 x/ x- C3 i8 V _1 a0 @- r7 F
. U7 `9 d2 [* X0 H" b参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.2 e$ @' [ F& L" D
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;& [- |9 [3 |9 Q9 z: ^
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;0 d! _. ]* }& h& w* z$ }
- STDMETHOD_(ULONG,Release) (THIS) PURE;! [1 R( X/ W8 @8 o# m
- STDMETHOD(Compact)(THIS) PURE;
5 T: O. D$ g4 d; h3 N/ ~ - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;" o- \- B7 o# X: K
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
% Y: s, @6 K- ]. I: r. b - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 + y8 W- o6 n3 A
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 & L# t. h- D% M
2 t" X$ V, a) e6 T* I3 d7 |- N& J; T, \4 d Q0 C
t: P$ G" Z& A3 l, `2 @+ n
" @6 I6 [" g0 ]. q R+ _- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
$ E. G6 `$ h5 f4 u# g1 f7 v( A5 D - .text:24BC2CD2
+ w7 `. I; x% ` - .text:24BC2CD2 ; Attributes: bp-based frame5 ~+ v8 @( W# p: A; l b
- .text:24BC2CD2 z) g: l7 c/ Y8 J
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p( }+ Y8 C2 l: Y! v( p' F: Z( r
- .text:24BC2CD26 c1 o" V, B$ ?9 H
- .text:24BC2CD2 Dst = dword ptr -90h7 l; I% c& B2 S4 c( \
- .text:24BC2CD2 var_8C = dword ptr -8Ch# j$ `( P, V1 E7 T8 m8 ?
- .text:24BC2CD2 var_28 = dword ptr -28h
9 ]! d6 x2 r& m9 J - .text:24BC2CD2 var_24 = dword ptr -24h* O* s$ O& W+ h5 f- B
- .text:24BC2CD2 var_20 = dword ptr -20h8 w+ w9 e( F4 F6 n8 J7 O
- .text:24BC2CD2 var_1C = dword ptr -1Ch7 N0 G, I7 w6 ^! g+ B" V n+ V/ f% {
- .text:24BC2CD2 var_18 = dword ptr -18h
" p/ V$ r- M& V' f - .text:24BC2CD2 ppv = dword ptr -14h
1 M5 q& H9 i% x - .text:24BC2CD2 var_10 = dword ptr -10h
, W0 T' {7 a; l7 }6 Q8 `8 I - .text:24BC2CD2 var_C = dword ptr -0Ch
9 a+ t$ x& X( c - .text:24BC2CD2 var_8 = dword ptr -8
& i ?) S, I& B0 Z r4 | - .text:24BC2CD2 hLibModule = dword ptr -47 O; o0 B' C2 w
- .text:24BC2CD2
: i5 w( A `9 v) D - .text:24BC2CD2 push ebp$ [" t. G- N. u7 d5 }0 A
- .text:24BC2CD3 mov ebp, esp3 V+ v! {# }4 k+ ?8 `0 g: x$ `
- .text:24BC2CD5 sub esp, 90h$ O' }9 @& ?( v' T) \# A$ q
- .text:24BC2CDB push ebx
& w$ _8 Z3 O2 Z ]) A/ l! c! `: i! w - .text:24BC2CDC mov ebx, ds:LoadLibraryA
, g2 o; ?' J% _ - .text:24BC2CE2 push esi
8 G0 j# D: D# k" c0 l! P - .text:24BC2CE3 push edi
% w! ~0 ~* v: R4 Q; @ - .text:24BC2CE4 xor edi, edi0 M" T& I8 P [ \0 f1 j
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"7 x3 L2 I5 W* T# I) l; F# ]
- .text:24BC2CEB mov [ebp+var_8], edi3 D9 D3 o; ?; W& W! t q, o/ ?
- .text:24BC2CEE mov [ebp+var_1C], edi
5 J8 r, D. a8 p" U! h; n% ~ - .text:24BC2CF1 mov [ebp+var_C], edi+ D5 U! S7 d9 S) o7 }: y/ R
- .text:24BC2CF4 mov [ebp+var_10], edi
, E0 ^) P0 c$ f; r+ r5 r5 U: f - .text:24BC2CF7 mov [ebp+var_18], edi
* K/ k, X. e/ b5 L- s - .text:24BC2CFA call ebx ; LoadLibraryA
! _, M, x8 B& W - .text:24BC2CFC mov esi, eax+ E* E' q! e1 f6 |% Q8 E
- .text:24BC2CFE cmp esi, edi
6 x, R6 o. \) u3 ~" L - .text:24BC2D00 mov [ebp+hLibModule], esi" L2 {8 d/ J e8 K* D
- .text:24BC2D03 jnz short loc_24BC2D0F
: x5 [- A: `. _5 d - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
" x/ g* ]0 H2 O. Y9 b5 j5 [+ E5 a - .text:24BC2D0A jmp loc_24BC2E6D
9 H+ R# ~$ J& T. ~ - .text:24BC2D0F ; ---------------------------------------------------------------------------
: _) c. Z. n4 M1 k - .text:24BC2D0F
7 L d! h. d( p, A9 a& U - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
5 g! W0 I' Z0 A% p2 f& [ - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"- O) ~8 ?2 [6 b" ^; {
- .text:24BC2D14 push esi ; hModule' ^0 y/ V' j5 ^ @! _
- .text:24BC2D15 call ds:GetProcAddress' y, p1 X# a: v
- .text:24BC2D1B cmp eax, edi
: F: Z& [% B( X0 {4 T2 v" P2 L - .text:24BC2D1D jnz short loc_24BC2D30
7 b2 n5 a% I" j# g - .text:24BC2D1F push esi ; hLibModule
/ V* a: u" H7 I - .text:24BC2D20 call ds:FreeLibrary
( d9 Y% I% a& O4 B9 g - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
6 \" }$ x6 n+ _1 H- [ - .text:24BC2D2B jmp loc_24BC2E6D% O: i4 D: L4 u( Z5 N' p
- .text:24BC2D30 ; ---------------------------------------------------------------------------2 I$ U( d3 g2 B2 z5 X, W
- .text:24BC2D30, `) T) a! n/ G4 n; z
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
( o) A; m/ ]9 }! p& L - .text:24BC2D30 lea ecx, [ebp+var_8]1 m4 x# O% r% g" U! u5 U9 W) u
- .text:24BC2D33 push edi
7 F3 F& x) I: K - .text:24BC2D34 push ecx% t% s) q! ?+ R( J b0 H
- .text:24BC2D35 push edi6 k6 i9 g( ] W/ `' ]
- .text:24BC2D36 call eax L6 q5 Y: S1 x
- .text:24BC2D38 test eax, eax5 u( P; Y& v$ ~! J/ F1 O
- .text:24BC2D3A jge short loc_24BC2D4D+ B% v& b0 ]) _; N: s/ \
- .text:24BC2D3C push esi ; hLibModule
, ^ O; P8 t' m I - .text:24BC2D3D call ds:FreeLibrary3 O8 m4 G$ B1 v6 ?
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n" `7 ^7 | b& M% n, U. n* r. |
- .text:24BC2D48 jmp loc_24BC2E6D; X9 o: I' i% `8 p8 K3 A; W
- .text:24BC2D4D ; ---------------------------------------------------------------------------
8 Y' J7 G P; b; U( Z - .text:24BC2D4D
- l1 M4 ~7 Y z - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j) X/ z3 C1 a+ B, C3 I
- .text:24BC2D4D mov eax, [ebp+var_8]+ r+ `7 B( A9 u
- .text:24BC2D50 lea edx, [ebp+var_1C]! F. i& `2 F- K* c. k
- .text:24BC2D53 push edx3 ]( P: @, k3 g/ F2 y* s+ i3 B6 S8 a
- .text:24BC2D54 push offset unk_24BC4470
6 U* S( i. u$ ]5 g6 c9 v9 x - .text:24BC2D59 mov ecx, [eax]
% I# U# v* }' c# A/ a( B2 y - .text:24BC2D5B push eax
, C2 r: P) x& h* W, ?8 g - .text:24BC2D5C call dword ptr [ecx]
, _# A& y: B6 p0 h' w4 a$ o - .text:24BC2D5E test eax, eax
' Z2 t5 m) z- Q! x - .text:24BC2D60 jge short loc_24BC2D87$ H3 x4 |3 l1 N# V9 ~
- .text:24BC2D62 mov eax, [ebp+var_8]! y" x8 I: s9 k# T2 S4 e. e
- .text:24BC2D65 push eax$ o5 E* `8 {) o+ v, r
- .text:24BC2D66 mov ecx, [eax]/ D' Y6 J6 P O; D, o3 b
- .text:24BC2D68 call dword ptr [ecx+8]0 d7 C* \$ f* P8 j
- .text:24BC2D6B push esi ; hLibModule5 h' ~3 o+ i9 `7 e0 u: i' T5 ?# U
- .text:24BC2D6C call ds:FreeLibrary
6 Y* E; t0 \" M, w - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"' B1 I$ a V, c) ?
- .text:24BC2D77 call ds:OutputDebugStringA
) u& \7 V' v7 K1 y! ` - .text:24BC2D7D mov eax, 100h
: c, I d+ I H/ q7 S3 D! Y - .text:24BC2D82 jmp loc_24BC30116 B9 [! C! `4 _( z
- .text:24BC2D87 ; ---------------------------------------------------------------------------: B% ~5 ~0 G9 e
- .text:24BC2D87( f8 p) J3 g3 ~, n& }# J6 F
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j1 I0 Q% z$ B% W
- .text:24BC2D87 mov eax, [ebp+var_1C]3 j- Q6 Y# x9 }2 | e3 n0 }
- .text:24BC2D8A push eax
& K9 w9 ~* T5 O - .text:24BC2D8B mov ecx, [eax]1 p5 o/ ~6 X) l! a
- .text:24BC2D8D call dword ptr [ecx+8]/ ]5 I( r9 ~* _& @
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"3 O2 H5 h3 o3 Q0 R
- .text:24BC2D95 call ebx ; LoadLibraryA* k2 h+ w& G2 |3 M2 m
- .text:24BC2D97 mov esi, eax/ h' E. ]7 O; c( O3 B* x9 z
- .text:24BC2D99 cmp esi, edi
{( U" b: l; X- U - .text:24BC2D9B jnz short loc_24BC2DB6) p1 `! m$ F \" ]5 c! ?, s
- .text:24BC2D9D mov eax, [ebp+var_8]" m7 O$ n# z: M* b
- .text:24BC2DA0 push eax; w& z; d6 H; T( M. [# l
- .text:24BC2DA1 mov ecx, [eax]
1 ?- s& Z3 j1 o* G* K" Y- ` - .text:24BC2DA3 call dword ptr [ecx+8]- x3 |$ m0 f) y+ i
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule! L o6 n( g: y
- .text:24BC2DA9 call ds:FreeLibrary& r! ?5 p+ {0 O
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n") g2 [& ^. T( {/ ]1 ]( |+ `2 A& E
- .text:24BC2DB4 jmp short loc_24BC2DE2
1 L$ [2 k( D: { - .text:24BC2DB6 ; ---------------------------------------------------------------------------" p; f" t {- e; ]" G" u8 H5 ~
- .text:24BC2DB6
6 t x; s- b' b4 |3 U1 ]8 o8 C - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j% {: q4 s. k& C2 e4 F% V# p" N
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"8 D6 e6 I4 |' ]+ l% z4 M, w
- .text:24BC2DBB push esi ; hModule
6 c% w" U3 O% ^ - .text:24BC2DBC call ds:GetProcAddress
% i8 K9 i F9 R$ Y* s+ L1 x d - .text:24BC2DC2 push esi ; hLibModule! Y; B6 K$ k9 z2 w8 W
- .text:24BC2DC3 mov esi, ds:FreeLibrary
' d6 N# t* A, z- |( X - .text:24BC2DC9 test eax, eax" c) f/ ]) ]) D6 l$ }
- .text:24BC2DCB jnz short loc_24BC2DF2
" z+ V4 E* }: t' R3 T - .text:24BC2DCD call esi ; FreeLibrary+ y Q) u) Z+ C- O* T5 A& m
- .text:24BC2DCF mov eax, [ebp+var_8]
* S! K* S( a1 z) C" r( |. W - .text:24BC2DD2 push eax
- l6 G- d4 E2 y7 y1 f, m - .text:24BC2DD3 mov ecx, [eax]
+ z8 T/ T& k! R% W% g7 R% \9 _( c; B& [ - .text:24BC2DD5 call dword ptr [ecx+8]
# i7 x% c' \+ x: j3 r- z/ H - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
' m3 M f7 Y6 [3 W/ C - .text:24BC2DDB call esi ; FreeLibrary
+ d! C% B* w6 G' ] - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"..." i- e4 v5 S9 F9 {) {$ A1 f
- .text:24BC2DE2
+ l" Z4 ], F7 _, h- o: s: s - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j: [4 H7 O: d# ?. L* y# {3 b
- .text:24BC2DE2 call ds:OutputDebugStringA' S$ K( z* @ k3 t; X
- .text:24BC2DE8 mov eax, 200h
+ y0 |! n0 R0 z: F - .text:24BC2DED jmp loc_24BC30116 V& b z8 d* u: z! B/ r
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
- |1 d$ T8 A- e9 s8 h$ [6 s, g - .text:24BC2DF22 O% b& T4 `! F2 d1 T) q! Q' k& ]4 r* K
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j3 M5 U7 Q1 ^) f1 x) y% _! z' o' [
- .text:24BC2DF2 call esi ; FreeLibrary6 ~5 U& \5 z, s
- .text:24BC2DF4 push 6Ch ; Size/ _1 q; M3 X& D: E. B
- .text:24BC2DF6 lea eax, [ebp+Dst]
6 U. c& _+ k) f4 C, F" t, k - .text:24BC2DFC push edi ; Val
$ W3 _ J7 p+ y+ a6 S1 m9 U: B - .text:24BC2DFD push eax ; Dst
! Y( } ~7 z8 N2 o. }4 |6 ^* x - .text:24BC2DFE call memset- D$ B9 H5 `7 g7 A) u$ |+ @4 ^
- .text:24BC2E03 mov eax, [ebp+var_8]4 p: K: z1 g# D4 J- T
- .text:24BC2E06 add esp, 0Ch
6 S" i1 b# ~3 R n. d - .text:24BC2E09 mov [ebp+Dst], 6Ch
5 K1 k/ W8 I$ q/ w - .text:24BC2E13 mov [ebp+var_8C], 19 p4 S4 i7 f; P
- .text:24BC2E1D mov [ebp+var_28], 200h
, S: l6 d: \4 S# S4 C; G- P& d O - .text:24BC2E24 mov ecx, [eax]
7 u q* I. v- W. g W - .text:24BC2E26 push 8
5 Z1 |* Q' U2 ~3 I - .text:24BC2E28 push edi/ `! ]1 [! C" |% A
- .text:24BC2E29 push eax6 ~+ O! w' {( z/ k
- .text:24BC2E2A call dword ptr [ecx+50h]. `' ~/ ^0 F" ^$ e1 k( b
- .text:24BC2E2D test eax, eax
; d: A9 A' @- S0 M - .text:24BC2E2F mov eax, [ebp+var_8]1 v0 Q2 L2 T7 m* a
- .text:24BC2E32 mov ecx, [eax]( a- |# M3 ?- L2 N$ m
- .text:24BC2E34 jge short loc_24BC2E46
# T9 H4 o0 \/ G- F - .text:24BC2E36 push eax
& n: f( q% @- `9 n5 u - .text:24BC2E37 call dword ptr [ecx+8]
+ n$ O; J: P! f1 J. o/ y r( x - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule% G% }6 J; Q0 T, N- s
- .text:24BC2E3D call esi ; FreeLibrary
& \3 D! E7 @& E% }/ P6 l - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n", A1 a8 \: b, K; u
- .text:24BC2E44 jmp short loc_24BC2E6D
' K4 i3 _' D" X" z - .text:24BC2E46 ; ---------------------------------------------------------------------------
* y) n" N; Z8 I4 c+ j, b& D - .text:24BC2E46
) Q4 r0 ^7 T( n; ^- J1 b2 j - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j$ T5 D5 j6 |2 Y! j& }+ F
- .text:24BC2E46 lea edx, [ebp+var_C]* {; [5 M. a( L; q
- .text:24BC2E49 push edi
4 d& z7 k- G0 O7 F- B - .text:24BC2E4A push edx
6 f; K' T+ G* |9 M) u* f - .text:24BC2E4B lea edx, [ebp+Dst]1 n0 V- X8 ^; }) j4 n9 r& f
- .text:24BC2E51 push edx
S* p/ T t1 }% A$ I0 D - .text:24BC2E52 push eax/ w" ?7 B7 @2 l$ N! g
- .text:24BC2E53 call dword ptr [ecx+18h]# g( B. z6 R8 U7 i" d+ H8 I3 o
- .text:24BC2E56 test eax, eax
0 U( s3 g0 E; u; i: P" q; l - .text:24BC2E58 jge short loc_24BC2E7A
/ g# D# i8 C0 x! H - .text:24BC2E5A mov eax, [ebp+var_8]! g# L7 ^ V ~- K
- .text:24BC2E5D push eax
% t" p+ K d: L' Z0 r/ W! v) @ - .text:24BC2E5E mov ecx, [eax]( i6 M3 b+ d2 P# j9 d+ m
- .text:24BC2E60 call dword ptr [ecx+8]
: n; {* k$ e$ e5 m, C2 S+ ^ - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule: }7 ]- N6 d: M0 V v
- .text:24BC2E66 call esi ; FreeLibrary% }/ {. D' n, J1 \
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
, s8 \( q7 U f - .text:24BC2E6D
, D% d# o; |( H% N8 l) U - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
3 ?4 Y, ~( ?- X1 P5 @ - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
2 Z3 \ X; N' R, i* F7 \ - .text:24BC2E6D call ds:OutputDebugStringA
; f- i5 C* X }4 f9 V( W1 ~ - .text:24BC2E73 xor eax, eax% N1 X# y( r- y% V
- .text:24BC2E75 jmp loc_24BC3011* X! w# {0 x$ A J7 ?/ t8 s
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
4 q# w; e3 m8 ]+ W) i9 B! C% Q. w/ G* Q. T. ^
, f8 K' ^3 E& o3 D7 \3 L8 h8 q |