这游戏以前分析过,本贴再写得详细一些。
r4 o7 {# w* r6 @这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
1 L! o9 f2 Q0 Q7 J注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
9 l0 \7 [. W3 `5 j) T( `
6 G7 b9 Z8 I( d& k参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
/ |5 m: f2 Z* M U" y1 R- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
( f: c1 E6 e, E; ?- _8 F0 t - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
0 Y/ q2 }+ b: h7 j ~- R O - STDMETHOD_(ULONG,Release) (THIS) PURE;
. k/ d T% F: \ - STDMETHOD(Compact)(THIS) PURE;% i+ s ~2 y% J' v$ |) J9 {/ C) B
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;/ T$ o; U; k+ d7 t* u' n6 }
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
- H, k* u9 d& ^" Q3 D6 Y) r, Z - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 ( ~6 V, F2 a+ }0 a
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
- R9 [5 C3 v i; V5 x# I+ u; a
$ w& f; S! H" s) s2 C) `, A5 S. M2 _: y, ]1 I7 R8 Y% _( d
) v F) I; Z1 w% ?" E0 E/ k
0 V: {, G2 `7 A( f/ d6 b- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================1 u( A$ h) z: L W* U0 S
- .text:24BC2CD2' J5 P# p- W+ t* I* ^
- .text:24BC2CD2 ; Attributes: bp-based frame
1 a8 u* o: t: b5 c- k3 B - .text:24BC2CD2. [2 h9 A* D' Y; P% Y
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p& z- @6 v- o& X
- .text:24BC2CD22 ~6 A G8 [. r) Y. X
- .text:24BC2CD2 Dst = dword ptr -90h
. `* G; b+ B9 T* E - .text:24BC2CD2 var_8C = dword ptr -8Ch# S1 v8 i* y( L1 i0 h, c
- .text:24BC2CD2 var_28 = dword ptr -28h
! W6 ^. ^! g4 k2 s( G - .text:24BC2CD2 var_24 = dword ptr -24h
% C- Y N& v, {; ^/ ~ - .text:24BC2CD2 var_20 = dword ptr -20h4 Q1 ^ d; X, ^ H4 T$ ]) U' S# c# C
- .text:24BC2CD2 var_1C = dword ptr -1Ch
% C* [) Z7 S; F! D9 o - .text:24BC2CD2 var_18 = dword ptr -18h" @/ U! H' \* E0 ~1 r
- .text:24BC2CD2 ppv = dword ptr -14h
: r3 C% N3 |& h: J* D" ^, { - .text:24BC2CD2 var_10 = dword ptr -10h
* `0 V: L' l8 K b - .text:24BC2CD2 var_C = dword ptr -0Ch" d' G" Z2 F: `$ U
- .text:24BC2CD2 var_8 = dword ptr -8
3 M6 s- b* n4 R7 W% Q - .text:24BC2CD2 hLibModule = dword ptr -4: ^" g* ?2 c' r# q/ a
- .text:24BC2CD2
( l% s- H5 @6 |9 q - .text:24BC2CD2 push ebp
% H4 V* d4 K8 j+ h1 X3 D& Q- v - .text:24BC2CD3 mov ebp, esp
S4 m0 y- r. n" H! D. X; e$ R - .text:24BC2CD5 sub esp, 90h) a5 X, U! Z( j% S
- .text:24BC2CDB push ebx6 O: E: p0 K, r# |/ _$ L- U8 J' L8 F* x
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
4 \: x& h$ J# d6 Y - .text:24BC2CE2 push esi: e: j! X% p" U2 F
- .text:24BC2CE3 push edi7 o) h6 F* S! d; Z$ v+ z2 S3 W
- .text:24BC2CE4 xor edi, edi8 L" }! E$ x$ P) t
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
0 N" `" j) ]* N! r - .text:24BC2CEB mov [ebp+var_8], edi
% N2 X: q' L* A+ k- ?- A. ] - .text:24BC2CEE mov [ebp+var_1C], edi- R8 A) l" j1 ^
- .text:24BC2CF1 mov [ebp+var_C], edi
Z8 J5 Q( p& q! E0 F - .text:24BC2CF4 mov [ebp+var_10], edi) U# R7 d1 U5 }! c( f; v" g5 j/ X
- .text:24BC2CF7 mov [ebp+var_18], edi \4 Q) d* g& j7 e, G1 r/ r
- .text:24BC2CFA call ebx ; LoadLibraryA6 ~/ J' @ s% M( R e/ z
- .text:24BC2CFC mov esi, eax
- f( W3 ~$ V0 s - .text:24BC2CFE cmp esi, edi: k' Y( f% }& _/ e& u
- .text:24BC2D00 mov [ebp+hLibModule], esi; O, C I) x6 @7 L4 p# X
- .text:24BC2D03 jnz short loc_24BC2D0F+ V& D' `0 I+ O E
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
8 g: O- U1 N/ \$ s2 A8 | - .text:24BC2D0A jmp loc_24BC2E6D* N; J, ^+ y! ?4 ]# Y# q
- .text:24BC2D0F ; ---------------------------------------------------------------------------
n' q5 d0 \' _# y3 i+ C - .text:24BC2D0F, v A! o+ [' I/ X# k4 N
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j) @$ a; |6 G0 r8 e9 w2 _( K
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"% r6 d# p9 k( z& U
- .text:24BC2D14 push esi ; hModule
# ?- u7 W% r8 F" w* d. { - .text:24BC2D15 call ds:GetProcAddress
P, m* k% N9 Z - .text:24BC2D1B cmp eax, edi
5 f* h3 A9 w" y+ }8 ]# Y0 H3 D - .text:24BC2D1D jnz short loc_24BC2D304 Z" O, u1 s3 n+ |
- .text:24BC2D1F push esi ; hLibModule
. G ^5 L5 g* ?; X: i, P8 q7 ~4 J6 M - .text:24BC2D20 call ds:FreeLibrary5 e& G+ v& c% e& W) `$ s4 _& F( e7 \
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
4 M0 R. r" @( l O+ ^ - .text:24BC2D2B jmp loc_24BC2E6D
+ `$ s7 d# \9 }/ Q* O - .text:24BC2D30 ; ---------------------------------------------------------------------------
K* a5 L7 s* h% M4 T3 G/ y* ` - .text:24BC2D30
0 F& _- ~4 m- v7 s _+ O - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
/ ^$ l/ p, v6 d- C - .text:24BC2D30 lea ecx, [ebp+var_8]/ K. {5 i8 A6 I1 Q" e7 M' B
- .text:24BC2D33 push edi
% A; e, j0 B- D ^6 j& D - .text:24BC2D34 push ecx! o+ h t3 y+ F) O
- .text:24BC2D35 push edi
3 V( g1 j4 ~6 L5 S' v0 K - .text:24BC2D36 call eax
: ?% j) }4 Z; P6 J1 u% E, g - .text:24BC2D38 test eax, eax
( f, a( a" [8 b' k$ @2 P* b9 q - .text:24BC2D3A jge short loc_24BC2D4D) k, a+ i" ~1 C
- .text:24BC2D3C push esi ; hLibModule/ f3 y3 h9 Z$ S% I! _2 l! Q
- .text:24BC2D3D call ds:FreeLibrary! ] F& |- r0 B. K0 H- Z: ~
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
( s3 S! `$ _6 p: T1 c' Z - .text:24BC2D48 jmp loc_24BC2E6D* ?& z, F2 N+ [7 f6 p1 V) B
- .text:24BC2D4D ; ---------------------------------------------------------------------------% e+ t, d" I& ]! F
- .text:24BC2D4D" D4 p; I8 M; D/ M. S; R
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j1 n! _. L3 E- V# `* u. h
- .text:24BC2D4D mov eax, [ebp+var_8]8 u1 p+ N- j+ k3 U% J6 b
- .text:24BC2D50 lea edx, [ebp+var_1C]/ s( ~) A, A5 p: n/ @6 l* R" F# [
- .text:24BC2D53 push edx
* J" U/ A! i/ q+ A- O - .text:24BC2D54 push offset unk_24BC4470
* S! x" @0 W* [( L) k# }0 a - .text:24BC2D59 mov ecx, [eax]2 X9 q# `9 H% S" e
- .text:24BC2D5B push eax
+ I# t( a3 A5 @- s% J: v: h - .text:24BC2D5C call dword ptr [ecx]
' P- N# q, F$ s! [- ^& G - .text:24BC2D5E test eax, eax& ^9 J1 @7 Y2 n; j* m/ H
- .text:24BC2D60 jge short loc_24BC2D87
/ C7 _6 {5 `7 X2 j, Z2 | - .text:24BC2D62 mov eax, [ebp+var_8]
0 I( h% h" ^1 U4 @% I. ]$ X) g - .text:24BC2D65 push eax4 q/ k' u. V# ?0 o, o. A
- .text:24BC2D66 mov ecx, [eax]* G' q& X/ w' Q2 _+ V
- .text:24BC2D68 call dword ptr [ecx+8]
5 p, }/ J0 E+ ?. G9 J - .text:24BC2D6B push esi ; hLibModule* x) Y$ B) }9 [( l+ {
- .text:24BC2D6C call ds:FreeLibrary
i, \" ^9 T# P# s3 y- J - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
S6 U6 v4 p) v - .text:24BC2D77 call ds:OutputDebugStringA
) M8 _/ X8 K1 [$ {7 }) V- y+ F - .text:24BC2D7D mov eax, 100h
& X, G. p$ U8 Z: B9 Z6 ~7 F. r - .text:24BC2D82 jmp loc_24BC30115 U* { Y; ?! c3 H% K9 t/ D: s8 Z
- .text:24BC2D87 ; ---------------------------------------------------------------------------2 B; z1 C0 s4 R1 L- _
- .text:24BC2D87
' n: `! O: _* F; b% P! ]/ F+ d* S - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j! Z2 g! U4 k, E- f+ s- `7 b
- .text:24BC2D87 mov eax, [ebp+var_1C]+ R+ m# `4 a) N( h% @
- .text:24BC2D8A push eax
0 G9 r$ k/ m. Q - .text:24BC2D8B mov ecx, [eax]
# J" ?" D- K, G0 o! b Q: `3 M( s - .text:24BC2D8D call dword ptr [ecx+8]
- H+ c$ `# X4 z5 p) |- ~7 Q - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"& }0 L* u4 f; p8 g% f- Q% E
- .text:24BC2D95 call ebx ; LoadLibraryA
. E: n% N/ a6 \ k - .text:24BC2D97 mov esi, eax
' ]+ h8 V# k1 `( u. a4 } u - .text:24BC2D99 cmp esi, edi; \ X8 ~7 S7 [- [3 e
- .text:24BC2D9B jnz short loc_24BC2DB6
# l8 Q4 S6 I) j! m- A - .text:24BC2D9D mov eax, [ebp+var_8]
# I7 @' j1 e1 x! T# J9 P: h3 \ - .text:24BC2DA0 push eax
C- g. }$ `6 L0 m( r2 P4 ^ - .text:24BC2DA1 mov ecx, [eax]( H _( u% K; Q# c/ d. E/ n
- .text:24BC2DA3 call dword ptr [ecx+8]
6 d* ?8 d* W! H4 {) i, [9 L - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule; |. X5 K. `# Z3 N4 r
- .text:24BC2DA9 call ds:FreeLibrary
; m: c0 L& N3 E - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
4 G5 w7 a F5 Z7 n - .text:24BC2DB4 jmp short loc_24BC2DE2( u" K6 Q# w7 Z$ l
- .text:24BC2DB6 ; ---------------------------------------------------------------------------
; G. p& P, Z, |: p( `" n - .text:24BC2DB63 s2 k2 h7 L- `: J8 ^+ x! l7 @
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j. n6 Z \# u) x2 M- [9 A
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
# {1 |- g1 w$ R( q1 N3 t1 c( O - .text:24BC2DBB push esi ; hModule
- Y: s. Y* C7 C. O2 r+ F: K - .text:24BC2DBC call ds:GetProcAddress. a9 U% e) W" `% R$ f; N1 t
- .text:24BC2DC2 push esi ; hLibModule2 `9 s2 m1 N) @( p" |8 S: k
- .text:24BC2DC3 mov esi, ds:FreeLibrary1 A, A# h j# y
- .text:24BC2DC9 test eax, eax
4 Z" A& S. q) J - .text:24BC2DCB jnz short loc_24BC2DF2
d* ^# z! Y* ]% U+ ~/ E- W' D% H$ B - .text:24BC2DCD call esi ; FreeLibrary
# d' N1 F1 w3 B3 h [" y - .text:24BC2DCF mov eax, [ebp+var_8]
, P4 m" E' L! G! P& l0 Z1 o - .text:24BC2DD2 push eax
9 U5 J+ e3 i9 @ - .text:24BC2DD3 mov ecx, [eax]
; d0 @) z7 L9 _7 j4 {# p2 n! b - .text:24BC2DD5 call dword ptr [ecx+8]
% B* x/ I9 q) A9 V - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
2 ]" K+ ^8 o/ Q - .text:24BC2DDB call esi ; FreeLibrary3 ^* {6 ~' N& |6 M' P6 U! O
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
9 k. n% ~. ], ~5 P - .text:24BC2DE20 H5 L6 c" V& s9 J$ l
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
7 M' u- w( K# G+ L; a - .text:24BC2DE2 call ds:OutputDebugStringA
3 o6 f8 Z b7 t, z3 E& T- _% Y - .text:24BC2DE8 mov eax, 200h
" y0 s2 S3 G! \( l - .text:24BC2DED jmp loc_24BC3011
: i/ g8 q8 i5 W2 E; c, V0 @ - .text:24BC2DF2 ; ---------------------------------------------------------------------------+ p$ o; ]" c. B+ t7 [1 z
- .text:24BC2DF2
2 h3 W- h2 u! q - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j# q% H8 b$ \$ `+ g: |
- .text:24BC2DF2 call esi ; FreeLibrary2 ~+ }9 {% C" T* o9 w: g, A
- .text:24BC2DF4 push 6Ch ; Size
) Y, _3 v1 _, U$ C - .text:24BC2DF6 lea eax, [ebp+Dst]
/ @$ ~7 V/ l" ~; `$ c# g7 \ - .text:24BC2DFC push edi ; Val* w2 G% C0 E' q$ e( w% R, v
- .text:24BC2DFD push eax ; Dst3 @- ?! t U$ I/ @
- .text:24BC2DFE call memset6 T x- \& [1 \( G4 l3 P) p
- .text:24BC2E03 mov eax, [ebp+var_8]! c; N* J! f P' u3 ]9 n; u( o$ \
- .text:24BC2E06 add esp, 0Ch
. P8 D3 ~! [; |) v, @2 c! w3 \# j - .text:24BC2E09 mov [ebp+Dst], 6Ch
8 A, Z! Z' ^4 x5 A J - .text:24BC2E13 mov [ebp+var_8C], 1: j# @( D$ e% A' ~( Z5 m8 P7 x
- .text:24BC2E1D mov [ebp+var_28], 200h
3 M5 R8 w# t. Y) Y* U9 n, v% h - .text:24BC2E24 mov ecx, [eax]- N' S6 C1 U Z
- .text:24BC2E26 push 8
6 W5 ]* d- @1 o) i1 s1 p4 c* o - .text:24BC2E28 push edi0 C* J" r1 p" S, p! [
- .text:24BC2E29 push eax
3 Y- O, `8 t B - .text:24BC2E2A call dword ptr [ecx+50h]
2 T, F2 j0 p, ?/ }; L - .text:24BC2E2D test eax, eax5 m, p6 k! M/ o; Q! T0 M* |
- .text:24BC2E2F mov eax, [ebp+var_8]
: }, e$ F, L+ ^5 I, {: p' _ - .text:24BC2E32 mov ecx, [eax]6 i! Z3 o8 e2 O7 g+ ~ Q
- .text:24BC2E34 jge short loc_24BC2E46 O1 Z+ Z7 E7 p L
- .text:24BC2E36 push eax
/ Q! g' z; w4 W& \) | y - .text:24BC2E37 call dword ptr [ecx+8]0 L( e1 J( w4 Z/ b6 D/ {
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule# T; [- ?" k; B7 w
- .text:24BC2E3D call esi ; FreeLibrary; \: K7 b' O2 U7 ~6 l9 V* a
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"3 C; N4 Z3 m* f
- .text:24BC2E44 jmp short loc_24BC2E6D
; W8 V0 m- |0 a: d - .text:24BC2E46 ; ---------------------------------------------------------------------------
3 N0 m2 X& J$ \ - .text:24BC2E46
6 J; O: A" R+ K# `0 `, B- a' } - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
; v4 y9 n d. [) I' A1 O b% O' z - .text:24BC2E46 lea edx, [ebp+var_C]
v6 o8 Z8 t+ { - .text:24BC2E49 push edi
' x6 L3 I; ~8 w4 P# b! D; R - .text:24BC2E4A push edx/ Z; Z: e( c; [" l+ c
- .text:24BC2E4B lea edx, [ebp+Dst]
& E- ], ]; U. }' Q- H& n- o8 n - .text:24BC2E51 push edx
; }, x% z( `3 B - .text:24BC2E52 push eax2 x& U$ t3 H/ Q% S! l) G7 }% h/ v
- .text:24BC2E53 call dword ptr [ecx+18h]3 f" g5 h( \6 W4 k
- .text:24BC2E56 test eax, eax
& [9 l G5 f! l+ j/ X - .text:24BC2E58 jge short loc_24BC2E7A
# t- k1 d' s/ y) _. U - .text:24BC2E5A mov eax, [ebp+var_8]. z5 [/ G2 w- T: B8 U3 z6 X# @ y
- .text:24BC2E5D push eax
# p$ G- [3 V' q - .text:24BC2E5E mov ecx, [eax]
) u/ r+ e+ `4 p0 v2 z - .text:24BC2E60 call dword ptr [ecx+8]
M. t8 C7 t1 l R" f - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule, ^& {' h+ s& \9 m+ y
- .text:24BC2E66 call esi ; FreeLibrary+ i. l: h2 l4 ^; ]# Y1 b
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
# U. Y, \/ J: \6 a0 Q - .text:24BC2E6D
" c/ `( [# n2 O( i* k6 S - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
( [1 ?( N8 I& X) Y% {" B4 T$ j2 { - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...- ]+ z; h: A1 `4 z- H: b
- .text:24BC2E6D call ds:OutputDebugStringA: C: m$ @3 R8 S9 e0 t
- .text:24BC2E73 xor eax, eax
- k- o6 f- A1 _, r: p - .text:24BC2E75 jmp loc_24BC3011% \4 v' K2 i! t- i4 O6 ~6 X
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 3 d; x7 n7 \# c; l" J+ `
2 |% M& @4 t" \" @: j" }
* n, A `8 a' _ |