这游戏以前分析过,本贴再写得详细一些。
1 V7 z; R' o8 g6 D+ r7 @- p& i这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,5 ^0 n& p2 K# h0 G& ^
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。& S" i4 f4 {! }$ b& M* v; b
* w8 F+ z- F# o6 }" P参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
, g( h4 [) m% ?$ E! ?( U( L+ g- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;+ x9 J4 c: Y: [. S- f. ~3 R2 N
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;; Z# |& \$ ~/ C. j3 y& ?
- STDMETHOD_(ULONG,Release) (THIS) PURE;
' Z2 X2 d; @/ i# @3 } - STDMETHOD(Compact)(THIS) PURE;# m8 ]3 s0 ~- U _' M3 v
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;7 m3 o' X, }4 e8 m6 e$ n
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;8 H: D. ^# k& T. q4 a
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 7 M F+ q4 f# @
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
9 U9 d' P9 S3 @. \0 A; h! N" ^" {: O+ h! \" R6 H
3 H, x* a/ e& m9 K9 @* }
0 Y+ i6 f; J/ w4 h
# a+ E; d6 N; p* O+ y+ s3 u7 ]2 ^- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
" M7 a+ D3 x1 f0 O - .text:24BC2CD2: H- @& x, H$ g6 B# E
- .text:24BC2CD2 ; Attributes: bp-based frame
D+ V, b. V/ d& c1 e; e/ y4 B - .text:24BC2CD2
# I) j1 F Y3 k, M8 Y4 K - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
* s+ u/ S8 ~: ?0 o - .text:24BC2CD26 j2 A' n( I3 B. P
- .text:24BC2CD2 Dst = dword ptr -90h5 g7 y! u* z' o% Q" \
- .text:24BC2CD2 var_8C = dword ptr -8Ch
2 p$ }6 s- ~$ z2 P2 R$ h# J - .text:24BC2CD2 var_28 = dword ptr -28h, Q+ Z, c- F- A- ~! i% o7 R
- .text:24BC2CD2 var_24 = dword ptr -24h
8 L' |) G2 p* [ - .text:24BC2CD2 var_20 = dword ptr -20h5 x7 X9 u F1 i
- .text:24BC2CD2 var_1C = dword ptr -1Ch
" [3 _+ a6 F( |( P1 p0 ? - .text:24BC2CD2 var_18 = dword ptr -18h% A' p8 E7 u" k( r+ F) h) D
- .text:24BC2CD2 ppv = dword ptr -14h; `/ o( i* C2 _( @
- .text:24BC2CD2 var_10 = dword ptr -10h/ U2 i2 C/ A' y- e' {" Z( K7 L
- .text:24BC2CD2 var_C = dword ptr -0Ch
X8 x: J, S, a% @% p - .text:24BC2CD2 var_8 = dword ptr -8
( I' N/ v* h! \( ~% t7 b) ?2 k# ~7 ] - .text:24BC2CD2 hLibModule = dword ptr -45 V/ i. k* n% ^! R
- .text:24BC2CD2/ z I7 }. L0 K1 d: ~. }" l8 \* a
- .text:24BC2CD2 push ebp }; ^. Y5 f/ B! R, V$ G$ D
- .text:24BC2CD3 mov ebp, esp
% ~/ K* y, q i1 [$ R9 r2 o - .text:24BC2CD5 sub esp, 90h/ _7 F4 T# j# T. L
- .text:24BC2CDB push ebx
+ Q% d k) A K: j. m - .text:24BC2CDC mov ebx, ds:LoadLibraryA0 k: M! E& \ ~5 a
- .text:24BC2CE2 push esi
/ O% g' T9 X5 H' f+ k' B" D0 o( B - .text:24BC2CE3 push edi
I$ V7 Q/ N: ]' Y - .text:24BC2CE4 xor edi, edi
* ]9 X# k( d; w- n) s6 E - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"( s- a2 l1 D [: x
- .text:24BC2CEB mov [ebp+var_8], edi9 t3 g5 P$ A: S: q7 j5 s1 N% ?
- .text:24BC2CEE mov [ebp+var_1C], edi
5 K+ i* E6 Z3 A' D; Y - .text:24BC2CF1 mov [ebp+var_C], edi
. [" s2 [+ R# l- e% V" ^. e+ S - .text:24BC2CF4 mov [ebp+var_10], edi: d5 s5 e1 `! T! c
- .text:24BC2CF7 mov [ebp+var_18], edi: [ x4 ]) n4 R7 F" I8 f& a& W: a( T
- .text:24BC2CFA call ebx ; LoadLibraryA
: S% g) [& o' n4 p9 P; S4 f - .text:24BC2CFC mov esi, eax
# |- S0 w K+ I( c - .text:24BC2CFE cmp esi, edi* S+ s- k4 c7 v9 l
- .text:24BC2D00 mov [ebp+hLibModule], esi& x" m y' j2 [- a
- .text:24BC2D03 jnz short loc_24BC2D0F
# Y E& _3 g7 h3 y3 N) b - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n") d3 h7 \: U) D: o+ A3 @" |
- .text:24BC2D0A jmp loc_24BC2E6D
" P# {) [0 w/ C+ s" y) } - .text:24BC2D0F ; ---------------------------------------------------------------------------
/ i' f5 F8 q% b - .text:24BC2D0F
9 d) V) [- m: n9 [2 A u+ e - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
( F+ H ?: u1 _, Q - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"/ g7 h* H0 M* K7 S: b
- .text:24BC2D14 push esi ; hModule
/ @4 w' e) c+ J$ M - .text:24BC2D15 call ds:GetProcAddress
- ?) t) I" I6 B - .text:24BC2D1B cmp eax, edi
6 d) t/ J' {5 N8 K - .text:24BC2D1D jnz short loc_24BC2D30
& a4 x8 Z; h3 O# F' N! f9 p$ @ - .text:24BC2D1F push esi ; hLibModule
6 R( O& {( T+ w1 J" c9 A. _ - .text:24BC2D20 call ds:FreeLibrary
- b4 a. e c2 a - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
' v! Q2 z3 |2 G( V$ i7 U( H, g - .text:24BC2D2B jmp loc_24BC2E6D( W- i# K% z, O7 D3 o; A# @
- .text:24BC2D30 ; ---------------------------------------------------------------------------, y/ p' \1 \ f/ T
- .text:24BC2D30, z' K6 ^/ Y- N x( K
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j- Q6 b( Q( o" o2 {6 B
- .text:24BC2D30 lea ecx, [ebp+var_8]
/ q* N5 L2 V5 l4 |' L D7 W - .text:24BC2D33 push edi
" u) ]- k: ~; S& m9 y - .text:24BC2D34 push ecx
: M8 Y. D5 ^! Z$ a& q9 y5 ~1 E4 N% P - .text:24BC2D35 push edi
9 Y k) T, A S6 V4 c+ u - .text:24BC2D36 call eax
- @: J [% {) P& R& C8 x2 S - .text:24BC2D38 test eax, eax
: L* k! }- i# M. ?+ |- p, d- E! e2 g - .text:24BC2D3A jge short loc_24BC2D4D
3 ~' W' ~$ J- S" s - .text:24BC2D3C push esi ; hLibModule
% U$ ^# A9 L$ m9 A3 k9 S- A - .text:24BC2D3D call ds:FreeLibrary( C% ~! w9 F, U" r- r- v ^, n
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"2 Y6 U: e) L) x; l9 Z1 v4 z
- .text:24BC2D48 jmp loc_24BC2E6D" c' o3 B x: w1 M: n* ]
- .text:24BC2D4D ; ---------------------------------------------------------------------------
* ]: U# a5 a# h! R8 ? - .text:24BC2D4D/ M. q6 i6 q& H4 F$ s) ]
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j l: c: W: A9 ^$ E
- .text:24BC2D4D mov eax, [ebp+var_8]
2 Q/ S0 z' M$ e- {" S9 D& ]; W - .text:24BC2D50 lea edx, [ebp+var_1C]. n: G5 r. y8 t! X" \3 u' f
- .text:24BC2D53 push edx
, f, A. b. Q! O) i4 v - .text:24BC2D54 push offset unk_24BC4470
- h7 H) |% X E* e/ Z2 G$ u2 |7 n0 o - .text:24BC2D59 mov ecx, [eax]
3 x4 y5 h. o2 H& l) j - .text:24BC2D5B push eax
; n, K% H ] \ - .text:24BC2D5C call dword ptr [ecx]; i) b/ a( ?4 e/ M! B
- .text:24BC2D5E test eax, eax& t) ]' l F" [2 N1 x+ i6 R. h
- .text:24BC2D60 jge short loc_24BC2D87* u* T/ ]4 A8 N! Z- `
- .text:24BC2D62 mov eax, [ebp+var_8]
! _: U) R; Q9 d5 Y; C$ N' a' \9 Q - .text:24BC2D65 push eax0 \# q, J7 f8 o8 N u6 q0 u
- .text:24BC2D66 mov ecx, [eax]3 z4 \% d, H3 l
- .text:24BC2D68 call dword ptr [ecx+8]
1 o1 J% q% S4 Z* E! \4 L5 y - .text:24BC2D6B push esi ; hLibModule
7 b" e: n! }1 N+ @. j8 { - .text:24BC2D6C call ds:FreeLibrary
3 i' h2 q. e# Z d: M - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
' ^- R' s; e- |2 U& p$ ~ - .text:24BC2D77 call ds:OutputDebugStringA$ z! ]/ h7 [( f: L6 x! b
- .text:24BC2D7D mov eax, 100h& Z+ m, Q1 _9 L3 B# q' E0 q P
- .text:24BC2D82 jmp loc_24BC3011$ B# R9 W; T4 a5 P; Y
- .text:24BC2D87 ; ---------------------------------------------------------------------------- L- a9 r; R3 J o9 D/ |" \' o0 f
- .text:24BC2D87 v9 g2 f. M2 M
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
7 j2 x5 X0 u `( I# f - .text:24BC2D87 mov eax, [ebp+var_1C]
( A9 _: Q. V' V2 K; w9 p6 i$ P4 H - .text:24BC2D8A push eax6 L- N) w! ?" E6 b1 K# {/ P9 U
- .text:24BC2D8B mov ecx, [eax]+ k/ u9 i: [( d" W4 j( A( k
- .text:24BC2D8D call dword ptr [ecx+8]/ H; j* S, h$ C) J
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
9 |* Q n: ~# h# v+ L1 P8 }* u - .text:24BC2D95 call ebx ; LoadLibraryA
! N5 G+ c7 \# ?8 g% z. b - .text:24BC2D97 mov esi, eax
7 K# l+ {# `( k - .text:24BC2D99 cmp esi, edi4 w! @1 D1 L+ C& p
- .text:24BC2D9B jnz short loc_24BC2DB6$ Q# Z' N1 B$ W' p' E, t9 Y2 a
- .text:24BC2D9D mov eax, [ebp+var_8]8 d% Q8 b z9 M' i) Z
- .text:24BC2DA0 push eax
1 V z/ T( T, [0 |; o - .text:24BC2DA1 mov ecx, [eax]- i% ?/ ?7 x3 E! `4 E5 f0 A
- .text:24BC2DA3 call dword ptr [ecx+8]3 U" m+ ]- Y* G% e2 g5 i( H% `
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule+ S1 e1 l/ R0 X! ~/ J3 O4 f
- .text:24BC2DA9 call ds:FreeLibrary' A1 }* ?8 v$ D" n5 T% n
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
) X* u. }/ J } - .text:24BC2DB4 jmp short loc_24BC2DE2
; d7 H+ P2 o/ {: T- j - .text:24BC2DB6 ; ---------------------------------------------------------------------------4 h5 h4 ]1 ^0 c; s" s/ B& ?
- .text:24BC2DB60 M/ x, t9 @, g0 ^. G
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
' A4 ]$ j5 G6 `$ T) C' s9 g - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
3 f- K$ j# D8 m8 N$ x - .text:24BC2DBB push esi ; hModule! m9 l( g$ ?- R# s; F
- .text:24BC2DBC call ds:GetProcAddress0 j6 F; \; ]+ p* H9 s/ z
- .text:24BC2DC2 push esi ; hLibModule" y5 G5 J8 x* ?4 H' q2 C8 Z
- .text:24BC2DC3 mov esi, ds:FreeLibrary5 r: q" }5 H3 ~# _( ]
- .text:24BC2DC9 test eax, eax
7 j( g3 \+ ?7 t! F, e - .text:24BC2DCB jnz short loc_24BC2DF20 F+ k) v* V7 h3 q* P- ^
- .text:24BC2DCD call esi ; FreeLibrary
9 x* I- X% k/ l; D N; n- D) g - .text:24BC2DCF mov eax, [ebp+var_8]
9 Q3 F0 [5 I: q1 ^ C - .text:24BC2DD2 push eax
5 r8 V% E. @7 x7 [$ D - .text:24BC2DD3 mov ecx, [eax]
# H+ ?3 @3 X2 | u* [ - .text:24BC2DD5 call dword ptr [ecx+8]
1 l x7 w! S) d( v9 Z8 w1 W - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
' `& k: {" t1 @( _0 Y+ K+ X, s - .text:24BC2DDB call esi ; FreeLibrary' u7 l5 n! q) g1 h
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...# q) i4 G2 v# Q. G( r5 j
- .text:24BC2DE20 f6 X! Y" r1 D' ^: R
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
- e! z0 [! J. M - .text:24BC2DE2 call ds:OutputDebugStringA6 c2 U5 l, |$ b
- .text:24BC2DE8 mov eax, 200h- F6 I9 |7 C7 H
- .text:24BC2DED jmp loc_24BC3011
P4 c. s5 T0 x0 Q/ ` - .text:24BC2DF2 ; ---------------------------------------------------------------------------
$ }/ J9 U2 ]9 O& N1 W4 n - .text:24BC2DF21 R% T. c# ~- F4 w! A2 |6 s
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
) ]; ?% a- Z4 y7 u/ `- P2 R f8 R - .text:24BC2DF2 call esi ; FreeLibrary8 G9 p! o' k" ^( n) c) T
- .text:24BC2DF4 push 6Ch ; Size! |7 ^- C$ v( \$ z. l" r: G- ^
- .text:24BC2DF6 lea eax, [ebp+Dst]
% i( C& G* F* } - .text:24BC2DFC push edi ; Val7 a# H7 w3 {* T9 o7 V- b# O
- .text:24BC2DFD push eax ; Dst
% h: h3 H) l; u. A. {8 \ - .text:24BC2DFE call memset
! ^8 }6 O$ e/ P" J4 }: t+ D - .text:24BC2E03 mov eax, [ebp+var_8]( V. U# X% Q: o" L
- .text:24BC2E06 add esp, 0Ch+ u9 z. X" ~& A/ r0 `( e
- .text:24BC2E09 mov [ebp+Dst], 6Ch
* D+ ~; G% T: i) V5 C$ f5 h - .text:24BC2E13 mov [ebp+var_8C], 1* l4 @# \. e1 F0 X/ ]( |2 r
- .text:24BC2E1D mov [ebp+var_28], 200h. }/ ]) p6 l+ ~2 `1 @
- .text:24BC2E24 mov ecx, [eax]
' \8 n- V; S! K# h6 n0 o - .text:24BC2E26 push 8
+ D4 [4 J6 B$ Z% A2 {: a7 f' { - .text:24BC2E28 push edi
4 G) R2 q8 R1 ^' G( |5 i& o; W - .text:24BC2E29 push eax: ]' `9 k0 o8 P3 H# \
- .text:24BC2E2A call dword ptr [ecx+50h]
; ~) v+ p' I4 J2 h) J; { - .text:24BC2E2D test eax, eax
4 T+ x: Z) R$ E6 _! ~: h - .text:24BC2E2F mov eax, [ebp+var_8]
z! s7 j8 X' [0 i, H2 U, q - .text:24BC2E32 mov ecx, [eax]" }) q% y' u! v6 J
- .text:24BC2E34 jge short loc_24BC2E46
9 M/ Q' j7 X+ i' Q( w7 j# r; c - .text:24BC2E36 push eax$ C6 ]! Z/ q9 c" Y: A# u
- .text:24BC2E37 call dword ptr [ecx+8]
; L% Y0 ~4 M5 w% d: i - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule/ Z2 S2 m' U0 j
- .text:24BC2E3D call esi ; FreeLibrary; K5 U7 t$ D" g- G( g' u
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
3 ]: d z# ?6 O9 }4 ~2 ] - .text:24BC2E44 jmp short loc_24BC2E6D
5 \. B8 | h7 Q: I& S, A - .text:24BC2E46 ; ---------------------------------------------------------------------------
2 R" ?' P. ^# q+ e7 H - .text:24BC2E46
7 u$ B! U& k: q" k- I3 P - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j* P2 x; G0 [1 e' R: Z- ?( \8 P
- .text:24BC2E46 lea edx, [ebp+var_C]
6 S' @# ^. ^: b- J+ ?4 y) C/ f - .text:24BC2E49 push edi1 R; s* z1 W2 D
- .text:24BC2E4A push edx3 V. m+ h/ ^/ U3 i' [ Q' f
- .text:24BC2E4B lea edx, [ebp+Dst]9 e( Y! [1 |/ H( m* o4 R; G6 W. m N
- .text:24BC2E51 push edx
8 f$ y' W+ v" o/ G$ C - .text:24BC2E52 push eax" |, J/ T" P1 E2 _! R% M- X
- .text:24BC2E53 call dword ptr [ecx+18h]
2 O6 @, f- p' k. e, u - .text:24BC2E56 test eax, eax# V- V/ v3 a" p0 k- p% ~ L
- .text:24BC2E58 jge short loc_24BC2E7A( k+ L0 T, U. R$ m
- .text:24BC2E5A mov eax, [ebp+var_8]" n3 D2 T+ J1 M" M+ V h3 m
- .text:24BC2E5D push eax; x: f1 y( p# ?+ Z
- .text:24BC2E5E mov ecx, [eax]
5 Q1 Q8 {1 d* f {/ L0 X* x - .text:24BC2E60 call dword ptr [ecx+8]
! w1 q6 z& U& Q! T6 M - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule# I) N# y( j* ]5 P8 {( q, Y+ d
- .text:24BC2E66 call esi ; FreeLibrary: t7 A$ ~, {" x1 l( _
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
8 Q1 C$ T3 y' C/ ^1 U - .text:24BC2E6D( [/ r( G) z3 d$ m
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
* e p. c4 t- M2 X - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
+ }' b- a, U! ^" e k - .text:24BC2E6D call ds:OutputDebugStringA z, `+ D+ I, J9 L+ n
- .text:24BC2E73 xor eax, eax, j$ v2 l# R- V0 P% V% p1 y
- .text:24BC2E75 jmp loc_24BC3011' L4 f: t' W. L1 C
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ! `; t- b7 q# ` X
3 S, o9 Z) L0 }$ ^8 R( m
) f' ^& V( M; B# H6 o |