这游戏以前分析过,本贴再写得详细一些。
3 o9 \8 H1 J1 l, w: X这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
5 a9 B# m+ ~5 f1 p3 I( y: Z注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
& V- ^0 X- c" Z U; k4 W
, z# s" P1 C( |; v: o9 n2 Z参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
1 V# `+ X+ a# i* `! r8 T- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;5 b) a2 m, i8 q" b! f! R6 h
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;; V& `, Y1 v8 [ U1 D) m
- STDMETHOD_(ULONG,Release) (THIS) PURE;. M3 y9 i" S/ ?8 |8 t' `3 |9 t
- STDMETHOD(Compact)(THIS) PURE;
: {0 a/ s3 N, Q1 N/ X% H5 ?/ D - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
7 W. W. q( |6 m) \ - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
; C0 p! H1 H, D* U8 Y4 S2 s5 p* ^ - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 6 Z w! W; M0 J# P( m' G
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 1 P! K9 d6 x- Z7 r
% U3 n" V3 r( a1 F) [5 [
]7 P& j0 M. e3 V$ L1 i U. q/ _. L- J& V
- 5 |9 r# e+ W0 R$ B6 S) b, _
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
( K6 J: c4 F5 N+ k2 W- \ - .text:24BC2CD2
$ u5 P& [0 Z* C) t: ~( p - .text:24BC2CD2 ; Attributes: bp-based frame
; ~1 s$ ^' V; d" v - .text:24BC2CD2* i: z$ G! K% F2 Z0 S
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p# q2 {6 u& ]4 U# F8 t, G3 \
- .text:24BC2CD2
8 ^. G& C2 Q% R( S) W8 g/ I - .text:24BC2CD2 Dst = dword ptr -90h! F, J, _. e- t5 w% O" f
- .text:24BC2CD2 var_8C = dword ptr -8Ch
( O1 S3 U1 ^. X9 P% w - .text:24BC2CD2 var_28 = dword ptr -28h6 l5 w0 {$ Q5 d" a9 y& X
- .text:24BC2CD2 var_24 = dword ptr -24h
" M, @9 d' q- A& d0 _ - .text:24BC2CD2 var_20 = dword ptr -20h
' K8 c( ?0 F! B8 A! K s - .text:24BC2CD2 var_1C = dword ptr -1Ch- d- X5 k# q' k; n. b* a, x Z$ ?
- .text:24BC2CD2 var_18 = dword ptr -18h0 u+ y' j B- I' H0 Q/ J& S3 ^
- .text:24BC2CD2 ppv = dword ptr -14h/ T' X+ [* V& b2 _% o
- .text:24BC2CD2 var_10 = dword ptr -10h1 ^$ T @- [- l6 ~
- .text:24BC2CD2 var_C = dword ptr -0Ch4 ]3 D( j5 h0 m- x s/ K
- .text:24BC2CD2 var_8 = dword ptr -8
5 f6 R8 l5 d8 X+ F: W3 l - .text:24BC2CD2 hLibModule = dword ptr -4! O. l* ~: x, o9 Y0 A
- .text:24BC2CD2% t @8 h3 L+ ?6 @9 E+ m6 o
- .text:24BC2CD2 push ebp
0 y5 R" a7 G! I. ? - .text:24BC2CD3 mov ebp, esp
/ ~5 F/ ~1 `& }" Y' |5 K - .text:24BC2CD5 sub esp, 90h1 }) b) u0 e; m C( r/ E
- .text:24BC2CDB push ebx* s( v E/ n% v3 R. ]
- .text:24BC2CDC mov ebx, ds:LoadLibraryA6 l% S! `% _9 }6 K0 N5 c8 L6 x$ E
- .text:24BC2CE2 push esi
. |9 o' Y# s/ f& Q - .text:24BC2CE3 push edi$ |. F, t$ Q" R
- .text:24BC2CE4 xor edi, edi/ H' S! [! k9 ^ f6 e- N9 d
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
" L1 V+ ?- q5 Z4 o6 u - .text:24BC2CEB mov [ebp+var_8], edi/ S( ]6 t" N- R& I4 L
- .text:24BC2CEE mov [ebp+var_1C], edi
) i# P) \0 Q5 d$ D0 { - .text:24BC2CF1 mov [ebp+var_C], edi6 j! H* c# k, C
- .text:24BC2CF4 mov [ebp+var_10], edi
0 g8 O/ S6 g: W6 ^ - .text:24BC2CF7 mov [ebp+var_18], edi
2 A# z4 `! M9 f - .text:24BC2CFA call ebx ; LoadLibraryA( ~0 X" ?8 n ~; W1 E( {* X2 n
- .text:24BC2CFC mov esi, eax
' D2 _! g3 m' J: e8 D1 k: V# L - .text:24BC2CFE cmp esi, edi* h$ p# R9 N. {* S
- .text:24BC2D00 mov [ebp+hLibModule], esi
4 G2 _5 i+ n3 _( @$ b9 D- p - .text:24BC2D03 jnz short loc_24BC2D0F
7 p Q' P5 z' a3 s! | - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"( U. x* _0 u* h. [
- .text:24BC2D0A jmp loc_24BC2E6D, ?8 N9 t# P! B% Q4 ^
- .text:24BC2D0F ; ---------------------------------------------------------------------------& x& c9 o X, O6 E: G
- .text:24BC2D0F0 ?' G# I) W7 w1 e0 D& Q
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j6 H8 G- F# ^. b) x8 J l/ B: F
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
/ ?1 x' D7 |9 ~/ b. c" l) ] - .text:24BC2D14 push esi ; hModule
* k$ b6 u. Z9 t' D9 t6 _ - .text:24BC2D15 call ds:GetProcAddress
% y( R! Q6 D9 @' P: x1 ~- ~ - .text:24BC2D1B cmp eax, edi
7 z; g) V; }, C m( ]+ L" u - .text:24BC2D1D jnz short loc_24BC2D30
t# S3 V8 O% F; y; ?9 Z - .text:24BC2D1F push esi ; hLibModule
' P- I) B: a0 q+ r/ r, u - .text:24BC2D20 call ds:FreeLibrary
7 J/ F8 ?2 x* n, R X - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...1 P4 W: u9 Y }7 M) Y3 z7 |* ^
- .text:24BC2D2B jmp loc_24BC2E6D" n9 @+ Z/ @9 e8 k1 O
- .text:24BC2D30 ; ---------------------------------------------------------------------------
; t7 i, c) x2 M& g Z- X - .text:24BC2D306 q, J) O# ?6 e. u4 \& `
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j; `; |* P& f9 v/ ^
- .text:24BC2D30 lea ecx, [ebp+var_8]
+ i+ b. B% c1 o - .text:24BC2D33 push edi
# f! x' N, C; d1 s+ W! O1 D - .text:24BC2D34 push ecx
$ ~+ }7 f6 i% b I& G7 h' S - .text:24BC2D35 push edi3 N# {* ^, U% Y& Q6 D3 I3 m& w) M
- .text:24BC2D36 call eax
, a1 o4 P4 E0 E - .text:24BC2D38 test eax, eax/ C/ T. `( e6 j+ U9 }
- .text:24BC2D3A jge short loc_24BC2D4D) V- P ?) j+ Y0 b
- .text:24BC2D3C push esi ; hLibModule4 o6 O2 C; B3 ^3 n
- .text:24BC2D3D call ds:FreeLibrary- t" E- n, ?: i& m# N( R
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"* s" {, ~( r% n# B
- .text:24BC2D48 jmp loc_24BC2E6D! N+ c6 P6 N4 E2 }/ D& T" Y
- .text:24BC2D4D ; ---------------------------------------------------------------------------# P. M0 b! T. I @- u3 }2 b
- .text:24BC2D4D
; v8 `* D+ Q0 ]5 U5 e - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j- ?4 v: X8 ~. U" {8 t) |( \* E7 b
- .text:24BC2D4D mov eax, [ebp+var_8]
0 f" p3 j3 x/ ]# U - .text:24BC2D50 lea edx, [ebp+var_1C]
g( u3 V2 o: H& R! W- ? - .text:24BC2D53 push edx R' s: z( o7 ` L
- .text:24BC2D54 push offset unk_24BC44705 i6 O$ u, i; c
- .text:24BC2D59 mov ecx, [eax]
# K$ I& c: a. F( o: I0 x9 a - .text:24BC2D5B push eax B' @, F* q. {! x/ `
- .text:24BC2D5C call dword ptr [ecx]$ z2 X, t0 y' d2 X7 q
- .text:24BC2D5E test eax, eax7 h' q* E9 Y/ _+ c& T0 g0 X
- .text:24BC2D60 jge short loc_24BC2D87. |* Y$ Z" E/ q2 n3 Q9 G
- .text:24BC2D62 mov eax, [ebp+var_8]
% N; ^2 C9 o0 z8 x - .text:24BC2D65 push eax4 M# r7 J3 Z: K( t. Y9 t
- .text:24BC2D66 mov ecx, [eax]& e9 g% t6 N0 x$ j, Q# R% v- z8 b( R
- .text:24BC2D68 call dword ptr [ecx+8], O; O! I; h: r6 q* m) d N2 \6 m
- .text:24BC2D6B push esi ; hLibModule
+ _6 Y8 W" ?% g Y9 R* b0 ?, v - .text:24BC2D6C call ds:FreeLibrary9 X/ J% I' _1 T- H) S, w
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"# [- ^( R( @3 Z3 P
- .text:24BC2D77 call ds:OutputDebugStringA
9 @, M& X1 ]& D5 X; z' R5 z* i0 L* Q - .text:24BC2D7D mov eax, 100h
4 v6 R) |- h+ V- z* A: ~ ?9 E: L - .text:24BC2D82 jmp loc_24BC3011
, p- {0 G) a$ ~1 ]! } - .text:24BC2D87 ; ---------------------------------------------------------------------------. _3 R4 n5 O# z
- .text:24BC2D87
9 k _1 W! X. v ^" P - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j# o4 `& m9 S% F9 C/ U" s }
- .text:24BC2D87 mov eax, [ebp+var_1C]
0 q9 ~4 F6 I: h% B/ I - .text:24BC2D8A push eax; i9 X$ [3 J: ?9 E7 r
- .text:24BC2D8B mov ecx, [eax]+ N6 ?9 z2 R- b$ A5 b- H
- .text:24BC2D8D call dword ptr [ecx+8]
8 T& d; H. r1 ]+ z9 {5 \ - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
% z7 g9 g" }7 ? - .text:24BC2D95 call ebx ; LoadLibraryA
) a8 |# V6 s& g0 m& A! i - .text:24BC2D97 mov esi, eax$ D9 U# E7 I; M* D# P' V, Y0 p
- .text:24BC2D99 cmp esi, edi
! @) |* O$ d: Q% `* P - .text:24BC2D9B jnz short loc_24BC2DB6
/ f! f: D [* z5 N1 f+ U - .text:24BC2D9D mov eax, [ebp+var_8]4 ~! {) p6 w. s7 F) q
- .text:24BC2DA0 push eax
9 z1 h9 p r9 M W7 e8 y" c - .text:24BC2DA1 mov ecx, [eax]+ l" y1 ]! r: y; L' b
- .text:24BC2DA3 call dword ptr [ecx+8] \2 D: u5 i) g
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule0 j) N. n( d. K+ C# J- L3 V
- .text:24BC2DA9 call ds:FreeLibrary
: q1 ~+ ^$ ^& W! K) ] - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
) ~9 U# ~9 A, _- I - .text:24BC2DB4 jmp short loc_24BC2DE2* |; F* |: J; g6 [4 n
- .text:24BC2DB6 ; ---------------------------------------------------------------------------
% {; b5 y, e8 H2 Z8 E, f. _5 o - .text:24BC2DB64 f7 M0 |2 N+ Y+ [+ ^0 ~$ e
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
2 C$ g4 l0 k( n/ b, \3 p$ s% K - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
' x4 ~+ y. T! |3 g - .text:24BC2DBB push esi ; hModule
4 F- ] f* R% V1 }) n2 f - .text:24BC2DBC call ds:GetProcAddress3 i' J m( b/ m
- .text:24BC2DC2 push esi ; hLibModule, {# H# h4 X# L
- .text:24BC2DC3 mov esi, ds:FreeLibrary
- q5 t$ j' N$ [ - .text:24BC2DC9 test eax, eax$ E) e/ u7 ?1 `' R, h/ t$ D
- .text:24BC2DCB jnz short loc_24BC2DF2
1 P9 D8 J5 p, |, \6 u - .text:24BC2DCD call esi ; FreeLibrary
) Z) t. D# T. P; L$ B - .text:24BC2DCF mov eax, [ebp+var_8]" Q) S9 _% I t; w! E/ h& {
- .text:24BC2DD2 push eax- N) U, m+ X9 z/ ?5 ^
- .text:24BC2DD3 mov ecx, [eax]
8 J4 D1 k5 P% B. k* F/ t5 b - .text:24BC2DD5 call dword ptr [ecx+8]2 l$ g! Y2 I6 X6 @8 ?
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
6 x( d& O( g) L' {' _- i' m# [ - .text:24BC2DDB call esi ; FreeLibrary- \; z- }3 b. p0 C4 x0 }* l
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
. C) E, c* A- h: X4 {; D1 U - .text:24BC2DE2% b! F4 s# t* z7 }! |+ h( ?) ` r
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
2 a; l( [" O3 o% ]2 c3 U - .text:24BC2DE2 call ds:OutputDebugStringA
8 a8 w) b" V% R [1 S - .text:24BC2DE8 mov eax, 200h
$ g9 r" ^0 l I- | - .text:24BC2DED jmp loc_24BC30116 @) g5 R3 E$ P v8 \$ F
- .text:24BC2DF2 ; ---------------------------------------------------------------------------) `! k- v! g1 i) R
- .text:24BC2DF2/ J* Z0 s5 }: b3 @5 r* p
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
& K: r, x, H) J- v* O - .text:24BC2DF2 call esi ; FreeLibrary; ]* j Y/ F% a: U( f( Y% Z& d5 S5 S
- .text:24BC2DF4 push 6Ch ; Size
4 s9 q1 y0 S1 Y - .text:24BC2DF6 lea eax, [ebp+Dst]# U) x9 c! ?7 Z/ m# U% T
- .text:24BC2DFC push edi ; Val
- U8 s" S" c, T. H0 |0 ~ - .text:24BC2DFD push eax ; Dst
' l4 f* c! O# l& |' h - .text:24BC2DFE call memset- m# d, f/ C% F( F1 x
- .text:24BC2E03 mov eax, [ebp+var_8], R$ c6 B$ ^) ~2 b/ X# P, A. C
- .text:24BC2E06 add esp, 0Ch
; u! @6 Y z# f6 X% _2 u - .text:24BC2E09 mov [ebp+Dst], 6Ch: k# B# V& P5 l1 }% W& T% m& c
- .text:24BC2E13 mov [ebp+var_8C], 1
4 f) d- P8 m0 v2 y( k" U5 P( o - .text:24BC2E1D mov [ebp+var_28], 200h5 P0 S D( ~8 {% }1 O( Z& E
- .text:24BC2E24 mov ecx, [eax]
+ K' V5 P; G( F; h, i9 H8 o - .text:24BC2E26 push 8% A. t0 j* n0 n- }
- .text:24BC2E28 push edi+ M1 W4 y# ]9 j: o
- .text:24BC2E29 push eax
9 n7 e' x; H# P% i - .text:24BC2E2A call dword ptr [ecx+50h]# _3 T/ n4 @: g- z& Q; f7 O
- .text:24BC2E2D test eax, eax
, G* o# S# H: W, x, h - .text:24BC2E2F mov eax, [ebp+var_8]# ]1 `! w4 |4 d2 b7 y5 j
- .text:24BC2E32 mov ecx, [eax]6 c! ]0 o0 X* j' U9 n6 s7 z
- .text:24BC2E34 jge short loc_24BC2E46
' f; R. j; b2 b1 }+ R3 I9 H - .text:24BC2E36 push eax# l* l7 e1 G6 P3 k- S
- .text:24BC2E37 call dword ptr [ecx+8]- _2 `1 d! i: v0 L. {
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule- \, o H; A" \! p3 M6 i, I
- .text:24BC2E3D call esi ; FreeLibrary. [( I+ O0 Y2 |+ G- D7 l; o/ L
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"2 U* e" K3 q% t! K8 A9 j) N
- .text:24BC2E44 jmp short loc_24BC2E6D2 |: {* f, m* ^0 Q) ]
- .text:24BC2E46 ; ---------------------------------------------------------------------------* ^0 p9 a U+ s. W8 A
- .text:24BC2E46
% m9 a8 } O1 I) C+ X - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j( |% Z7 u2 i" J% c& A' |
- .text:24BC2E46 lea edx, [ebp+var_C]
! d% g* F4 a1 B4 G8 N6 g - .text:24BC2E49 push edi6 ~ U1 D# p* K7 }. V
- .text:24BC2E4A push edx
! ]. J4 H, b# d1 H1 s, C - .text:24BC2E4B lea edx, [ebp+Dst]9 _. o' A* ^6 {( w0 y% j
- .text:24BC2E51 push edx
8 j9 Q5 j+ Q% c7 } - .text:24BC2E52 push eax
]& O, ^/ B- `4 E; k9 O3 W" @8 S - .text:24BC2E53 call dword ptr [ecx+18h]
" h( I4 T. D; t1 }+ B/ b - .text:24BC2E56 test eax, eax; m1 v) @5 {: _+ X' r
- .text:24BC2E58 jge short loc_24BC2E7A
4 {! _4 V7 ]2 C2 W7 f7 H6 Z - .text:24BC2E5A mov eax, [ebp+var_8]; H- x& G. K: C7 z; P+ W% L" p) m
- .text:24BC2E5D push eax6 Q7 Y- O! U+ L" e$ t
- .text:24BC2E5E mov ecx, [eax]
$ R3 V. ]2 z7 i- E; R, B5 v. E - .text:24BC2E60 call dword ptr [ecx+8]
" t, a' d$ T: N$ p4 @$ X% {( y - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule6 g1 u" b* n7 B# L: f& u
- .text:24BC2E66 call esi ; FreeLibrary, p: O! l: y* D: ^+ i
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
# A$ G+ |/ s2 S& \ - .text:24BC2E6D
. C- O1 `# x z% }6 Y( |% E, ` - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
r+ B% s+ L, \: { - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...4 `8 s! T0 U( J1 S
- .text:24BC2E6D call ds:OutputDebugStringA
! l/ @- K0 N4 Y: x - .text:24BC2E73 xor eax, eax G- @! ^2 [4 l0 h, W
- .text:24BC2E75 jmp loc_24BC3011
2 s/ A4 s4 Y0 p" v - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 4 [2 H, c+ O/ g) N7 t' L' T0 H: N
' ^/ p) F- [+ P+ L, f
, b0 p# G3 G3 e# Z4 {+ [1 R0 l |