这游戏以前分析过,本贴再写得详细一些。
3 o: O' c5 m2 x1 X1 m- a这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
8 C! R( S c4 u7 D注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。/ T4 X; }: _6 g3 _+ U! m7 r4 N
' X: r; Z6 e8 b
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
: v* F( o% }7 F- c$ j$ G( u& [- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
* l" W: Q! z' _% u) b) v - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
\) |. N1 w q& B7 S: z' C - STDMETHOD_(ULONG,Release) (THIS) PURE;
4 ^( V2 m$ C$ R9 T: h9 G: q - STDMETHOD(Compact)(THIS) PURE;
4 J! s8 ~/ G4 o% U1 K& v1 ] - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;0 H5 |5 B- z% T: J" E0 Y1 r" j H
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
' x: Y; ] s1 p( o! P3 P/ o( I8 g - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 , w* e9 K- Z; R, h+ r
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
`9 @. T6 @. n6 e9 g6 |
+ Q% S; e. _% z9 o
I4 x4 N4 p( ^8 J
4 Z" _" F3 T0 j8 a' \2 s/ }
2 s- {' F7 E4 m' t' |- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
9 _# P2 C0 k5 `/ M1 }# \ - .text:24BC2CD2( q8 u7 q! p/ h* ]
- .text:24BC2CD2 ; Attributes: bp-based frame
4 a4 T2 W+ m6 O; O+ y s N0 t, c - .text:24BC2CD2
# B$ z- n, n$ c' a - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
7 h! J, O0 x8 o4 m - .text:24BC2CD2
V" k, w! a8 s" w - .text:24BC2CD2 Dst = dword ptr -90h/ Z* C5 F) y2 G! e6 A$ I
- .text:24BC2CD2 var_8C = dword ptr -8Ch
9 B1 r; P" }+ y: `* v - .text:24BC2CD2 var_28 = dword ptr -28h9 r2 s% ~+ }" J1 W0 B
- .text:24BC2CD2 var_24 = dword ptr -24h! E( J8 X" w& F |+ f
- .text:24BC2CD2 var_20 = dword ptr -20h/ E X: j/ O; a' |- @
- .text:24BC2CD2 var_1C = dword ptr -1Ch& j; N" r2 h1 N# ^! M5 U
- .text:24BC2CD2 var_18 = dword ptr -18h/ X' d$ x' F4 n" I- W) h
- .text:24BC2CD2 ppv = dword ptr -14h) x8 R4 j' f. \5 I
- .text:24BC2CD2 var_10 = dword ptr -10h1 W5 C4 Z# @% O2 ^
- .text:24BC2CD2 var_C = dword ptr -0Ch
' z. ^: _# B1 x2 W2 m; n - .text:24BC2CD2 var_8 = dword ptr -8
6 C) }7 [5 x6 n, |+ X - .text:24BC2CD2 hLibModule = dword ptr -4. ?" @( r4 g/ f; s
- .text:24BC2CD28 a! M$ f% E7 W S6 ~
- .text:24BC2CD2 push ebp) @2 }: V. @3 N& f N
- .text:24BC2CD3 mov ebp, esp
7 x% R; ]/ T9 H" o - .text:24BC2CD5 sub esp, 90h
: [. E1 Z: a: T3 V4 C - .text:24BC2CDB push ebx) Q* [) b, H( q( { I
- .text:24BC2CDC mov ebx, ds:LoadLibraryA+ Q5 B" H1 ? j$ ]+ t9 d9 W, O0 Y
- .text:24BC2CE2 push esi+ K. x9 r2 r1 m7 m5 A
- .text:24BC2CE3 push edi& ]1 f5 x4 v4 M. C7 w7 S3 [9 M2 ^
- .text:24BC2CE4 xor edi, edi
# n. E7 l1 G1 @# `; D$ G - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL": M; D9 j) H/ l: F0 e8 [
- .text:24BC2CEB mov [ebp+var_8], edi, v$ a# J; o. G% M
- .text:24BC2CEE mov [ebp+var_1C], edi! c. o: E+ d( _+ j5 P8 I
- .text:24BC2CF1 mov [ebp+var_C], edi
' k- h9 _& }5 A' D. Y - .text:24BC2CF4 mov [ebp+var_10], edi) _5 ]' j+ ?4 [& U6 q! Q
- .text:24BC2CF7 mov [ebp+var_18], edi) Y U2 W" ~1 ]: P- d, g' b1 Q- j
- .text:24BC2CFA call ebx ; LoadLibraryA
p. |7 u9 O' V1 G - .text:24BC2CFC mov esi, eax9 S N% m: N/ O% @0 q H3 {0 C. b+ m
- .text:24BC2CFE cmp esi, edi
s: `& E' G3 D, ~) d- V2 n - .text:24BC2D00 mov [ebp+hLibModule], esi
7 b8 ?, T" Z$ @3 b P - .text:24BC2D03 jnz short loc_24BC2D0F
$ M! I8 S/ b% W& c, ]4 s* t# ] - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
" ]; L% y h2 R9 Z9 W' i0 G - .text:24BC2D0A jmp loc_24BC2E6D
7 V. G& B% ]0 Y( ] - .text:24BC2D0F ; ---------------------------------------------------------------------------% E9 T6 u f$ Q
- .text:24BC2D0F
6 ` S' H7 E/ U - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j4 W7 L/ ?, f' K/ S' Y
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"( H/ j: t0 ]5 u1 H
- .text:24BC2D14 push esi ; hModule' N# w' a& B4 k" o
- .text:24BC2D15 call ds:GetProcAddress/ e+ ?* Y8 i0 x6 q
- .text:24BC2D1B cmp eax, edi
. k+ v T/ x% Z" d* A6 B' ?6 L, O - .text:24BC2D1D jnz short loc_24BC2D30
+ b4 n- n; m; _! K& r - .text:24BC2D1F push esi ; hLibModule
& g" B+ R7 r: _/ T* q: x - .text:24BC2D20 call ds:FreeLibrary/ F; C( q7 I% P: q5 Y
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
0 I, u+ S5 b; V! H2 T - .text:24BC2D2B jmp loc_24BC2E6D: a) z0 {5 v: _' v
- .text:24BC2D30 ; ---------------------------------------------------------------------------
8 D# m% t4 a! ^0 t - .text:24BC2D30
0 ^# E/ n9 ^+ I+ p4 `& a/ C - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j. z' {( f4 q. x$ ~9 v
- .text:24BC2D30 lea ecx, [ebp+var_8]
. W% _& |8 \. a( L2 M" X+ |! n4 u1 _ - .text:24BC2D33 push edi
6 Q/ G S8 Z+ N9 n - .text:24BC2D34 push ecx7 W, J( K& o2 e3 `0 M
- .text:24BC2D35 push edi3 n V( |8 d- @6 k0 E* m
- .text:24BC2D36 call eax8 ?/ C. e! C7 T
- .text:24BC2D38 test eax, eax
% M+ i H# K* L& o) U" b - .text:24BC2D3A jge short loc_24BC2D4D! v v# D8 y [
- .text:24BC2D3C push esi ; hLibModule
) b V/ T! T! H$ u3 ~. _; V) F - .text:24BC2D3D call ds:FreeLibrary
+ g+ C, j8 h) W* D$ I5 H+ E - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
6 l8 q9 d$ p5 E2 s7 t6 F - .text:24BC2D48 jmp loc_24BC2E6D
1 G$ ]+ n& @* n5 M0 m - .text:24BC2D4D ; ---------------------------------------------------------------------------: q# @8 F7 J( s# ` [. L7 d c
- .text:24BC2D4D' K$ E+ o2 Y5 \$ g) L
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
8 W) X g. Q: T" p8 v - .text:24BC2D4D mov eax, [ebp+var_8]
6 J3 l3 \8 v, R6 ]8 o - .text:24BC2D50 lea edx, [ebp+var_1C]
3 l2 b7 @4 E! i4 A. V: B: }8 a - .text:24BC2D53 push edx
/ U% \% E0 k+ _, O: K0 B - .text:24BC2D54 push offset unk_24BC4470/ c% m0 [6 U- J! m" `
- .text:24BC2D59 mov ecx, [eax]5 J% n6 c+ T0 G7 d% r
- .text:24BC2D5B push eax
, L; [ X# A9 |; z- P2 p - .text:24BC2D5C call dword ptr [ecx]
+ F8 D j7 T" O) F - .text:24BC2D5E test eax, eax* F# Z6 k3 D2 W$ N/ G% ]/ Z0 ~ d9 e
- .text:24BC2D60 jge short loc_24BC2D87
5 ]/ w& }! Z( K5 O6 p - .text:24BC2D62 mov eax, [ebp+var_8]
# [2 D3 M; l" T2 D9 @. C - .text:24BC2D65 push eax
N% K# M8 V+ j - .text:24BC2D66 mov ecx, [eax]
5 ^) U* [% O6 J/ v3 d& i% g, { - .text:24BC2D68 call dword ptr [ecx+8]/ {* V$ j6 `7 p& u0 c3 e2 q
- .text:24BC2D6B push esi ; hLibModule9 C6 b1 }5 f9 k% _. i
- .text:24BC2D6C call ds:FreeLibrary" m; z1 e0 M h/ P6 f9 F+ I
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"- \- b% b* |+ p/ `2 \. v1 f
- .text:24BC2D77 call ds:OutputDebugStringA. _5 \; z1 h# o& z! {9 l
- .text:24BC2D7D mov eax, 100h# H/ U/ [+ d( n- o
- .text:24BC2D82 jmp loc_24BC30115 H4 Y0 w# E5 V
- .text:24BC2D87 ; ---------------------------------------------------------------------------
- N+ W# b8 \" j1 o+ w) ` - .text:24BC2D87
' y5 f% V* }9 O8 E - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j8 C% z9 P& i9 v- _
- .text:24BC2D87 mov eax, [ebp+var_1C]
& U+ B2 d4 G C- o0 N - .text:24BC2D8A push eax
$ n. g/ p* \$ L8 p4 z - .text:24BC2D8B mov ecx, [eax]2 b. h8 Z$ M0 d/ @/ C( J$ E3 D- i
- .text:24BC2D8D call dword ptr [ecx+8]! K$ i# h$ n* k$ a. w
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL" @) \( f' @+ q; P- X
- .text:24BC2D95 call ebx ; LoadLibraryA
! f+ k5 A+ d. ^3 ?# b - .text:24BC2D97 mov esi, eax* p" ~9 I8 N, y( F3 m0 a+ P, q9 V
- .text:24BC2D99 cmp esi, edi6 R* i) {0 p6 E
- .text:24BC2D9B jnz short loc_24BC2DB6
" D% _9 u0 a& T6 X9 U" P; [ - .text:24BC2D9D mov eax, [ebp+var_8], ?6 X/ m& d" Y' ?5 d
- .text:24BC2DA0 push eax0 E% H/ N0 u+ q L3 V# y: D3 b
- .text:24BC2DA1 mov ecx, [eax]
2 P/ u& @5 N8 V7 ^' ~ - .text:24BC2DA3 call dword ptr [ecx+8]
/ O w, a; r% n# x" H% l - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
( j9 [) {1 N3 m: C3 V - .text:24BC2DA9 call ds:FreeLibrary
" A9 u B4 V; {+ m) b( |0 m) ? - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"7 M# D9 j, S9 j$ P" }, N6 c+ f
- .text:24BC2DB4 jmp short loc_24BC2DE2: ]; `7 }1 d0 s0 H7 e' b0 h
- .text:24BC2DB6 ; ---------------------------------------------------------------------------7 w4 O+ ~5 {1 g. M9 _- p
- .text:24BC2DB6
: F4 J& C) N- x6 S - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
/ u* O9 r; h) \ ?' ~5 G - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA" {: C# c) [* c- ^8 z s) e* [$ x
- .text:24BC2DBB push esi ; hModule$ T3 r8 R* `# c# t6 E: e y6 F
- .text:24BC2DBC call ds:GetProcAddress- T( K; R4 z' L" q/ v/ f
- .text:24BC2DC2 push esi ; hLibModule
' Q$ e8 B3 k" }4 {* ]/ Q2 F - .text:24BC2DC3 mov esi, ds:FreeLibrary
. p0 B; G/ m2 e - .text:24BC2DC9 test eax, eax
' a2 w$ [1 d' X) |. p) I - .text:24BC2DCB jnz short loc_24BC2DF2
, N8 t" y3 S9 A1 L: I - .text:24BC2DCD call esi ; FreeLibrary) \% d B) K$ r1 i8 s4 v5 J
- .text:24BC2DCF mov eax, [ebp+var_8]
* E/ ^# k6 D P# J& {8 {/ O - .text:24BC2DD2 push eax
L) ^* |3 I% _2 \* P2 O - .text:24BC2DD3 mov ecx, [eax]; w9 p% _! h& ~. `! J( n
- .text:24BC2DD5 call dword ptr [ecx+8] l6 N7 X5 L# k L$ F2 S1 n
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule. e, I5 B% k# M& B
- .text:24BC2DDB call esi ; FreeLibrary% o2 V3 Y& a5 ^$ j' I! R3 c
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...+ r- @3 ~: ^1 n; p7 m9 M* ], J
- .text:24BC2DE2
, D; E) s1 l9 d - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
9 _ A. c3 _1 i9 a0 P9 f4 f& e4 S5 P - .text:24BC2DE2 call ds:OutputDebugStringA
7 z) |! g% y1 m- P7 z3 c4 @ - .text:24BC2DE8 mov eax, 200h; b8 h) C9 v# v/ F
- .text:24BC2DED jmp loc_24BC3011- q& T5 y/ z' { s* @$ r
- .text:24BC2DF2 ; ---------------------------------------------------------------------------: |' }: A! I+ E9 w
- .text:24BC2DF2
9 ]& U" J# [7 k3 z2 ]& u; r - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
$ \4 N: m/ y7 _3 O2 I* g8 R - .text:24BC2DF2 call esi ; FreeLibrary/ w2 r! M j& ^3 Q1 p9 |4 ?8 ?
- .text:24BC2DF4 push 6Ch ; Size
0 |2 b2 X T/ U1 L9 X9 \8 L - .text:24BC2DF6 lea eax, [ebp+Dst]
1 K& | M3 D: F4 u& x6 U' R - .text:24BC2DFC push edi ; Val! n' \2 @. E) T+ n& C' C [
- .text:24BC2DFD push eax ; Dst" |" x u v2 F0 B; U
- .text:24BC2DFE call memset- N' q4 S6 l6 y4 l: y. @
- .text:24BC2E03 mov eax, [ebp+var_8]: t: x8 I& ?& ~9 O7 }, l) g! L! P
- .text:24BC2E06 add esp, 0Ch( L- ]8 G0 i3 x+ _* D* _
- .text:24BC2E09 mov [ebp+Dst], 6Ch
$ _$ x. T# _% ~6 R5 g- L: W$ D - .text:24BC2E13 mov [ebp+var_8C], 1+ @! k$ V3 P- ?/ V2 U9 k1 Y5 d# r
- .text:24BC2E1D mov [ebp+var_28], 200h: N1 ]0 C& E! J9 F1 v! B$ Y! p
- .text:24BC2E24 mov ecx, [eax]8 M: `0 \4 V: r
- .text:24BC2E26 push 8
, u+ w; A' C7 I2 z" | - .text:24BC2E28 push edi2 @- d7 n% x+ m$ f# g; v# [& M6 \8 t
- .text:24BC2E29 push eax* N, A( ^! |4 M9 W
- .text:24BC2E2A call dword ptr [ecx+50h]. j6 O( Y- d; `. f
- .text:24BC2E2D test eax, eax0 w; }; c) m# o' N) e$ f
- .text:24BC2E2F mov eax, [ebp+var_8]; u0 @5 b1 b( b) I
- .text:24BC2E32 mov ecx, [eax]
# M( y6 x2 R2 e& `' i1 k - .text:24BC2E34 jge short loc_24BC2E46 `1 B, l# _# L' W+ ^
- .text:24BC2E36 push eax8 a! q- C1 I* W% }" B0 z
- .text:24BC2E37 call dword ptr [ecx+8]
6 }1 l. b5 s9 n, E) k' O& [3 `# @ - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
2 Q' `5 P, @: }& ~4 a* u - .text:24BC2E3D call esi ; FreeLibrary
3 o4 U8 s3 T4 v, j2 j - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
/ v; ]* ~# E/ b2 k6 o, Z - .text:24BC2E44 jmp short loc_24BC2E6D
" I; r! B/ H/ e& s- b - .text:24BC2E46 ; ---------------------------------------------------------------------------/ G' O# f0 W$ O# f5 Y$ S
- .text:24BC2E46
$ X, E4 F1 B( v' `# U6 h: b G+ |/ q - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
$ K1 I: c# P7 x4 L, z: Q - .text:24BC2E46 lea edx, [ebp+var_C]
2 U/ r% N7 s" | - .text:24BC2E49 push edi
" m) |. K. V S( x - .text:24BC2E4A push edx
! R2 N/ S2 J1 `# g1 b& m h+ p - .text:24BC2E4B lea edx, [ebp+Dst]6 J) u7 z7 W4 ]+ f5 ^; c% ]$ `+ r
- .text:24BC2E51 push edx+ b" ]. X7 U* ~) h
- .text:24BC2E52 push eax
q7 G1 k4 h- E2 b2 G3 G7 w - .text:24BC2E53 call dword ptr [ecx+18h]8 G6 E; v$ \3 k3 ]
- .text:24BC2E56 test eax, eax
/ x, q# Q( L0 _1 E( B8 v - .text:24BC2E58 jge short loc_24BC2E7A
( a+ D# J5 M. @' n% @ - .text:24BC2E5A mov eax, [ebp+var_8]
1 p% S {4 C- T+ v - .text:24BC2E5D push eax
# N" T! i' h+ {8 a s+ S; O - .text:24BC2E5E mov ecx, [eax]: P# n* F* I9 L
- .text:24BC2E60 call dword ptr [ecx+8]
' W5 s* V. o( _6 o! q8 x5 z - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule: S* J) `- W7 \1 p) p( p
- .text:24BC2E66 call esi ; FreeLibrary
9 ?( e! |( A3 Q) r: p- E - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
7 t5 B' W* B9 w- r ` - .text:24BC2E6D) @. P- L z4 a2 U
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
: n1 P! e9 o6 `! I9 P# Q - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
5 O; S2 |0 `; C/ o+ D. [, k2 k, C5 D - .text:24BC2E6D call ds:OutputDebugStringA
* A3 t$ z' Y: j9 ]' l; D - .text:24BC2E73 xor eax, eax& j o4 _$ |3 ]: f8 T0 V
- .text:24BC2E75 jmp loc_24BC3011
5 E: M8 b8 {/ s' I3 c - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ! _4 b3 M+ S7 ?, f' J( E# h$ x
2 E: m; _: {7 \0 c2 m9 |
/ H, p+ R: v- z& H) e& [ |