这游戏以前分析过,本贴再写得详细一些。
6 ?) S( e$ X6 _) B- G: x/ G这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,$ b) j% Z& O2 N8 W5 N
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
" `- e0 n3 }1 t$ m+ K" A$ W7 x# [* P5 ?. V
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.) t( e" R: \5 E# W! w
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
& a* e; u; O- c3 B5 y2 [( p - STDMETHOD_(ULONG,AddRef) (THIS) PURE;: Z5 {) i: n) p7 z3 J
- STDMETHOD_(ULONG,Release) (THIS) PURE;
/ O/ x/ y8 p) ~$ a - STDMETHOD(Compact)(THIS) PURE;6 F" r+ b! Q0 c% d
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;1 q0 z) Q3 y x, I m
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
- r5 L5 }8 c" @) Y, ]' D - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 ( {$ @; s. \& j9 T# J0 Q3 H
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 3 y: M5 U) Q6 D9 p4 F$ V
* S, K4 G$ i& b t" q% u0 W b+ z
' s, Z9 w0 R! m. }1 K
' ]! @ d j5 u3 o8 u# q5 [4 ^$ M
- f8 U) H& _$ }- ~9 W- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
# P' n2 w$ A' t - .text:24BC2CD2
$ Y" Q6 Q9 w9 j3 `9 ]+ ], V - .text:24BC2CD2 ; Attributes: bp-based frame
- c' I7 e( j5 x1 h" [* U - .text:24BC2CD2
) M' g/ V0 O' Z6 E5 l, i - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p( A6 F; C% A9 Z& t
- .text:24BC2CD2
: ]) J9 J2 V. q - .text:24BC2CD2 Dst = dword ptr -90h! q+ F/ f, U* r% F; p) k8 z
- .text:24BC2CD2 var_8C = dword ptr -8Ch
4 Z: L! S( y8 X/ u. u6 s( K - .text:24BC2CD2 var_28 = dword ptr -28h( r" ^6 ]2 w6 N/ S
- .text:24BC2CD2 var_24 = dword ptr -24h
& A. m) w: t# S' }" _4 I- I6 } - .text:24BC2CD2 var_20 = dword ptr -20h3 K, l" q+ P( U0 m
- .text:24BC2CD2 var_1C = dword ptr -1Ch
0 r* a; W: ]! C9 \% h: N1 ?7 A - .text:24BC2CD2 var_18 = dword ptr -18h* s, d. b. @) A! X6 C9 V. \ m- J
- .text:24BC2CD2 ppv = dword ptr -14h
5 }- Z& {, {! n4 F" D, y - .text:24BC2CD2 var_10 = dword ptr -10h/ j- K2 r" d, @2 N, K# w
- .text:24BC2CD2 var_C = dword ptr -0Ch
! k" _6 e( F/ }: w - .text:24BC2CD2 var_8 = dword ptr -8
. _! U, d; b0 v+ m* G - .text:24BC2CD2 hLibModule = dword ptr -4
8 y& u$ {6 b2 W - .text:24BC2CD22 L( g5 |! ~6 b
- .text:24BC2CD2 push ebp$ s/ u- h% z/ @& A
- .text:24BC2CD3 mov ebp, esp
/ f' i& o# [: u+ _# u4 U - .text:24BC2CD5 sub esp, 90h& D; l- L0 u! U4 M7 p! l; Z
- .text:24BC2CDB push ebx6 t% s( v) ~! u7 Q
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
: _- O# m$ S4 i" x7 p& D - .text:24BC2CE2 push esi
9 U3 L) ~( u7 l - .text:24BC2CE3 push edi1 R% V3 o6 F/ {
- .text:24BC2CE4 xor edi, edi7 d; g, Z9 W N( j
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
* n/ T7 l9 U" W" C - .text:24BC2CEB mov [ebp+var_8], edi Q$ N3 t) v, E& W1 o& m0 {6 y
- .text:24BC2CEE mov [ebp+var_1C], edi
% s5 }/ ]7 f7 m& L/ m1 U6 o( K - .text:24BC2CF1 mov [ebp+var_C], edi; r9 p+ z0 W& C7 m
- .text:24BC2CF4 mov [ebp+var_10], edi
) j7 J ?# [* v( O- \6 D5 [6 s - .text:24BC2CF7 mov [ebp+var_18], edi+ l- ^. _# B- r+ [& K
- .text:24BC2CFA call ebx ; LoadLibraryA
: Y/ H, e4 O" B' `3 R) B5 O. [8 u0 z - .text:24BC2CFC mov esi, eax2 P# k( c8 Q& \0 y$ H; O" s
- .text:24BC2CFE cmp esi, edi; c" L. @; r9 A8 Q2 |/ q @' e* G
- .text:24BC2D00 mov [ebp+hLibModule], esi
2 h! x: P$ q$ {1 R* d - .text:24BC2D03 jnz short loc_24BC2D0F- K1 y( f3 k6 j! Z! Y* I
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
5 B1 a5 a ?) p" u& H1 ] - .text:24BC2D0A jmp loc_24BC2E6D
6 p9 V8 O# g; }: A" D; ~. Z6 s - .text:24BC2D0F ; ---------------------------------------------------------------------------
8 x) O+ d9 _9 a' F+ y - .text:24BC2D0F' _7 r3 p! h" M) n, h" g5 Y
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j1 s& u7 Y. K) s, l
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
$ b8 A1 r5 Q; s - .text:24BC2D14 push esi ; hModule) d( {) R' l& u+ _
- .text:24BC2D15 call ds:GetProcAddress
- @- U$ W" E1 c6 \# [ \+ ?7 r - .text:24BC2D1B cmp eax, edi
# i0 B% m; c' {, ?/ m - .text:24BC2D1D jnz short loc_24BC2D30
8 t: r4 ^& R+ I% q5 f - .text:24BC2D1F push esi ; hLibModule
/ h) B2 }+ U4 _: L! i- J - .text:24BC2D20 call ds:FreeLibrary8 d+ `) h4 L# i& q) R m5 m$ l
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...4 E! z+ D" U7 A
- .text:24BC2D2B jmp loc_24BC2E6D- V# l' j. K7 m
- .text:24BC2D30 ; ---------------------------------------------------------------------------
; Z3 w2 E' W) ~6 q - .text:24BC2D309 p2 x# P0 o3 I. a4 D, S8 a
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j6 P) |; M! X2 h9 ?' [$ {! ~
- .text:24BC2D30 lea ecx, [ebp+var_8]5 x, E- A, u$ c; ]
- .text:24BC2D33 push edi
( j4 c/ G4 I! c: k3 i" X% Q1 p+ G - .text:24BC2D34 push ecx
& G' W& _4 F: I6 j" e - .text:24BC2D35 push edi
1 \6 I( ^% q# G3 ]: Y - .text:24BC2D36 call eax4 |! j3 m& W4 ^! C
- .text:24BC2D38 test eax, eax
- c+ S% c3 e1 k/ A P- A - .text:24BC2D3A jge short loc_24BC2D4D) G: o8 e- E# }# H6 |' s4 }4 \
- .text:24BC2D3C push esi ; hLibModule$ ]$ p, y5 j- U% k' P/ ^$ d
- .text:24BC2D3D call ds:FreeLibrary
+ G2 S& K& j, ^, ]3 I1 M - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
' K( _) d( G- Y9 y - .text:24BC2D48 jmp loc_24BC2E6D
: b' h# m/ F- I9 _9 ?6 u - .text:24BC2D4D ; ---------------------------------------------------------------------------
3 D' Q3 E8 @6 c8 l1 ` - .text:24BC2D4D" M! w; R: v3 L6 c
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
! q# m- I( S: d) E6 U1 o - .text:24BC2D4D mov eax, [ebp+var_8]
& S# a( I1 e. w( F: U' i - .text:24BC2D50 lea edx, [ebp+var_1C]
" P/ [& T* J6 J4 o - .text:24BC2D53 push edx
, ~9 Q8 j3 x1 ~8 c) N3 K ~ - .text:24BC2D54 push offset unk_24BC4470
; h' J% c' |" G" O+ l: Z/ J8 t - .text:24BC2D59 mov ecx, [eax]
8 Z5 r# n9 s t [- } - .text:24BC2D5B push eax7 w N8 k# O% ^ k
- .text:24BC2D5C call dword ptr [ecx]
( ^0 f; R6 I4 L - .text:24BC2D5E test eax, eax
4 ^& B0 d% S# p! G7 d: T - .text:24BC2D60 jge short loc_24BC2D87
; G" z7 @9 S* T0 a& X& k( T - .text:24BC2D62 mov eax, [ebp+var_8]% k5 a+ ~" ~. f. S4 v
- .text:24BC2D65 push eax
$ p/ Y# @4 N- f+ c. N1 n - .text:24BC2D66 mov ecx, [eax]
$ w2 Q$ o9 l' F. w - .text:24BC2D68 call dword ptr [ecx+8]
, S' h7 F; H/ G a; G- u0 | - .text:24BC2D6B push esi ; hLibModule/ v' ^$ ^4 i# h. m6 ]
- .text:24BC2D6C call ds:FreeLibrary
- q9 X S$ h8 V7 c9 i- ` - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"8 O7 i+ g8 m3 `. i8 _. k
- .text:24BC2D77 call ds:OutputDebugStringA# l% [) K# L. c/ G
- .text:24BC2D7D mov eax, 100h+ X$ m2 b8 K1 ?. D8 i7 N
- .text:24BC2D82 jmp loc_24BC3011' F$ Y$ Q* p/ N$ h7 I0 B5 D' U
- .text:24BC2D87 ; ---------------------------------------------------------------------------3 m+ W; p$ _( Y; @
- .text:24BC2D87
9 p) L: y2 T( C) U& e: N2 q - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
9 `& r% P6 M5 @0 ^6 ]; M- h - .text:24BC2D87 mov eax, [ebp+var_1C]
& a _6 `9 [7 t" c7 c( q - .text:24BC2D8A push eax/ J* K8 K- _3 W5 Q( l+ Y5 D
- .text:24BC2D8B mov ecx, [eax]( A- ~9 Z9 n( @- l! f
- .text:24BC2D8D call dword ptr [ecx+8]
1 s* {& `( J/ m3 V/ g0 E - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"! U3 a# F9 ?, q1 z/ s! @8 B
- .text:24BC2D95 call ebx ; LoadLibraryA7 {- F5 ~, f; F6 T8 Q) A9 B
- .text:24BC2D97 mov esi, eax
7 K _6 E" V5 T- m - .text:24BC2D99 cmp esi, edi9 r3 ? h8 p3 I- A* c" N" D
- .text:24BC2D9B jnz short loc_24BC2DB6" @, A1 x' X2 R* l% W, x9 X
- .text:24BC2D9D mov eax, [ebp+var_8]; O% J1 B7 s) p3 F+ z% M5 r
- .text:24BC2DA0 push eax: l( L0 w% M# Y; j' A& d$ l
- .text:24BC2DA1 mov ecx, [eax]( z- D$ o) b8 P
- .text:24BC2DA3 call dword ptr [ecx+8]
0 c/ z8 X- i2 I8 q' a, @ - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule7 e5 x7 n E) q; R l9 j. J1 S! e
- .text:24BC2DA9 call ds:FreeLibrary6 j# C$ {8 Z8 o2 x e
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
, k. Z6 M2 N7 j& y" ~ M4 T j - .text:24BC2DB4 jmp short loc_24BC2DE2
% N% ]' f' _3 r- N" m0 u% G$ ~: I - .text:24BC2DB6 ; --------------------------------------------------------------------------- ^+ l0 R. }( W- T
- .text:24BC2DB6
6 V0 x3 l' ~, u, s6 W3 l! D9 c - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j4 A) w7 T8 Q& k5 z F5 s$ u8 I
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"* U' U8 q) @/ V0 w1 W
- .text:24BC2DBB push esi ; hModule
) t) f& v; E! I* A4 h( {. v - .text:24BC2DBC call ds:GetProcAddress6 W. C5 [' y7 _: u# I. ?8 M
- .text:24BC2DC2 push esi ; hLibModule
$ [2 W" V: f9 E2 v6 G - .text:24BC2DC3 mov esi, ds:FreeLibrary
5 r. t/ [& M5 i% ^( r - .text:24BC2DC9 test eax, eax
: g: n. Z! _' R( g) j# {- \/ R - .text:24BC2DCB jnz short loc_24BC2DF2
/ o9 S! c6 v* f - .text:24BC2DCD call esi ; FreeLibrary/ g0 A7 u" u9 Q8 y5 T& y0 e* T
- .text:24BC2DCF mov eax, [ebp+var_8]
9 X5 M) t2 {' ?3 H* q - .text:24BC2DD2 push eax
e9 x( e0 i5 S/ `) n - .text:24BC2DD3 mov ecx, [eax]% @/ ~* N6 Y& X4 x. _4 \
- .text:24BC2DD5 call dword ptr [ecx+8]
: n& D* M% y- d7 h1 V U - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule; D: y' _/ n/ O+ M3 Q
- .text:24BC2DDB call esi ; FreeLibrary
) Z; W/ _0 m, z: l! A - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
1 k' D8 j$ [% i j$ ?) F' Q - .text:24BC2DE2
, f9 n" K7 r# C6 o7 V) j/ L - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
% B6 b8 t5 l3 }: W" V( K+ x& b) M - .text:24BC2DE2 call ds:OutputDebugStringA
' i- s, I( L. U" m - .text:24BC2DE8 mov eax, 200h
& r4 R- G- S; ~" S; ~2 ^& k7 T - .text:24BC2DED jmp loc_24BC3011
! t8 r5 g3 f+ e5 D6 ^ W - .text:24BC2DF2 ; ---------------------------------------------------------------------------0 B5 S k8 k+ Z8 w5 v. @
- .text:24BC2DF2! u) L! f6 c( ?+ T4 T
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
7 c1 F1 C6 ?2 C; L. P - .text:24BC2DF2 call esi ; FreeLibrary v, U: O8 ], x1 Z6 `7 o9 {
- .text:24BC2DF4 push 6Ch ; Size
' B# x" }5 C- S0 W6 p0 Q3 N% e# j: \ - .text:24BC2DF6 lea eax, [ebp+Dst]$ G/ ^8 L+ \5 V' }' P; r
- .text:24BC2DFC push edi ; Val( m5 f' v t. i, f2 n
- .text:24BC2DFD push eax ; Dst
. M5 `' l8 w' y3 F1 y- T - .text:24BC2DFE call memset1 w- e- X1 q; Y
- .text:24BC2E03 mov eax, [ebp+var_8]% t+ ]7 ?+ e0 C" b# r' d! f0 L0 A
- .text:24BC2E06 add esp, 0Ch
$ s! r% Y% `! N' Q; b! z - .text:24BC2E09 mov [ebp+Dst], 6Ch
3 d0 d+ x- H9 @9 u' b* \+ b - .text:24BC2E13 mov [ebp+var_8C], 1
) v& p8 H1 ?. \% G. x - .text:24BC2E1D mov [ebp+var_28], 200h6 _) ?" F7 q$ @( N
- .text:24BC2E24 mov ecx, [eax]7 m) Q7 W0 N3 e! C
- .text:24BC2E26 push 8& |6 z$ r. O Q* B) Q% v
- .text:24BC2E28 push edi+ t# }) T( |8 A
- .text:24BC2E29 push eax
/ x, r4 V, A6 S) y- `% T+ d3 z. y1 q - .text:24BC2E2A call dword ptr [ecx+50h]# L. {% ?7 ?) t: w! P
- .text:24BC2E2D test eax, eax
/ Z" l/ y: i& u: n - .text:24BC2E2F mov eax, [ebp+var_8]9 h( R/ G* |3 `
- .text:24BC2E32 mov ecx, [eax]" s: m% k* b2 y6 X8 E2 s
- .text:24BC2E34 jge short loc_24BC2E46
" i, n# w+ @9 ^/ Z3 v - .text:24BC2E36 push eax
2 G5 B6 T t. r% F1 _' L - .text:24BC2E37 call dword ptr [ecx+8]: a% l; K* l" X3 {: d) H
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule4 b( K4 M1 [/ H( e, Z) M
- .text:24BC2E3D call esi ; FreeLibrary
$ z* _9 ^! P, r; I - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
) ] l0 _; B7 N+ k. b# m - .text:24BC2E44 jmp short loc_24BC2E6D
4 l; l/ Q) B0 u. t& h$ {! [1 ^ - .text:24BC2E46 ; ---------------------------------------------------------------------------
2 P, l$ n& g) X7 s; d& R$ T7 }- ^ - .text:24BC2E46. Q" P3 V, D0 B0 ]6 S, i* l* g( Q6 @
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
, y$ i6 D5 ^( W1 x- L$ h - .text:24BC2E46 lea edx, [ebp+var_C]
( W% l0 i; A2 K& J - .text:24BC2E49 push edi
% o0 y& d4 L" I - .text:24BC2E4A push edx5 F6 _7 h) p. c! C$ e4 A0 h& A- `1 P
- .text:24BC2E4B lea edx, [ebp+Dst]
5 o+ F! l# F1 n u+ z5 B' o! a - .text:24BC2E51 push edx
6 u0 z; m7 T( ~ - .text:24BC2E52 push eax6 D2 r- X; H" l2 r
- .text:24BC2E53 call dword ptr [ecx+18h]" V- r. \ s$ ~; Q9 i2 R
- .text:24BC2E56 test eax, eax. \( e7 K! z: h7 X
- .text:24BC2E58 jge short loc_24BC2E7A2 A/ ~2 a# x- A5 B4 ]1 g
- .text:24BC2E5A mov eax, [ebp+var_8]& m B5 ~( Q6 f8 o& v; L. s
- .text:24BC2E5D push eax
9 c- M2 Q7 z* }& B9 S0 t - .text:24BC2E5E mov ecx, [eax]4 {" X. Z! D2 D9 q: k
- .text:24BC2E60 call dword ptr [ecx+8]
+ K+ ] R4 z- D3 Y6 I - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
c% P4 U4 U3 Z( s7 d - .text:24BC2E66 call esi ; FreeLibrary
0 H( e0 i% j. H% [# T# I) S - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
X0 H6 S( [7 N+ i U' ^ - .text:24BC2E6D
! F: S8 U9 K5 {9 J- ?. b - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
# Q" c' M) f. h4 l; M - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
' p7 ?* Y0 i U& g: s! o - .text:24BC2E6D call ds:OutputDebugStringA
6 z# F/ }4 h8 d) r8 \! c! I; n - .text:24BC2E73 xor eax, eax
8 c0 W* m, f1 c% U - .text:24BC2E75 jmp loc_24BC3011
1 G) D- a8 p! ?- F - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
{" `& Z' C+ Y- Q; i
9 ?3 f7 {$ H3 s. k6 O% ?! }5 p) _5 [8 d! L) E' Q
|