这游戏以前分析过,本贴再写得详细一些。
! F! w( l Z: ?; ?这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
) q- B4 f3 c- x/ Y注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
5 z/ J1 v* J5 x& \/ y% W; G
& `+ X5 N* e0 g1 D参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
& i* ^" i% ^) G- q- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;' m# @2 C) D; O* _+ V$ u. Q
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
4 u6 E+ t2 X9 h! { S9 F - STDMETHOD_(ULONG,Release) (THIS) PURE;
9 Y% r& n7 W0 n2 F U6 d) X3 w - STDMETHOD(Compact)(THIS) PURE;, I9 O- c$ K$ E1 E- y8 {! b
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;: {9 ~/ _( W5 R5 b! p8 E
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
( [5 m' ~: g- ~) V1 U$ Z' B - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 1 _3 ]" }- t) M( j) V
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
@$ V. m7 ]2 H/ a/ ~1 }: c9 S- j
2 z' H/ s; z- P2 ?6 a
; S/ v1 E! l) m* x) O* _* U+ Q! y" k
- 8 H7 M0 f B' j6 y: |- e
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
0 s; f+ r$ [! l - .text:24BC2CD22 D! k6 d2 y# I W2 t9 | D
- .text:24BC2CD2 ; Attributes: bp-based frame. ?1 l1 x+ L1 M; Q7 S
- .text:24BC2CD2
9 ]' K4 d$ \" u7 j$ I$ ~ - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
% B4 q# h3 c h! c3 m4 I: @9 e - .text:24BC2CD2
% F( a3 z) ~3 P& Q - .text:24BC2CD2 Dst = dword ptr -90h" D! {. P, N C, ~
- .text:24BC2CD2 var_8C = dword ptr -8Ch
7 a" r- @5 X# `3 j' u) D - .text:24BC2CD2 var_28 = dword ptr -28h2 ~. A) Y" n& ~) W: ~7 s
- .text:24BC2CD2 var_24 = dword ptr -24h5 b5 f9 n8 I. |( X! ]; ?
- .text:24BC2CD2 var_20 = dword ptr -20h+ C% _0 E# X) u& f# E* N
- .text:24BC2CD2 var_1C = dword ptr -1Ch
6 _! d) o% ^$ \* C! v. F - .text:24BC2CD2 var_18 = dword ptr -18h4 O* ]* f$ ?9 i9 e: B+ }
- .text:24BC2CD2 ppv = dword ptr -14h
* M) e# h B5 i* ~6 F: U - .text:24BC2CD2 var_10 = dword ptr -10h; v- R7 W* m' A1 I( R- R3 x
- .text:24BC2CD2 var_C = dword ptr -0Ch$ b# I$ j, w V% f7 ^/ L
- .text:24BC2CD2 var_8 = dword ptr -86 K9 C3 ~6 k8 }# ^
- .text:24BC2CD2 hLibModule = dword ptr -4
7 N6 P% P0 C% C6 O& X M1 S" i: F - .text:24BC2CD2
5 B9 \! a' `6 x8 h4 X - .text:24BC2CD2 push ebp
& Z; I7 {: O: P7 g- b - .text:24BC2CD3 mov ebp, esp
. i5 L( N/ ^6 Y - .text:24BC2CD5 sub esp, 90h0 E# l, Q% H; I& r
- .text:24BC2CDB push ebx# y& k' c$ P' J5 v. I
- .text:24BC2CDC mov ebx, ds:LoadLibraryA6 A7 X3 j+ V# ^% h' d
- .text:24BC2CE2 push esi
# D6 |% x! W# [! A7 C: s$ t - .text:24BC2CE3 push edi" K8 z4 x B0 O }. p% y2 d
- .text:24BC2CE4 xor edi, edi E$ s: U' J H
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"$ X8 r& B- z& m$ R( u7 U% g
- .text:24BC2CEB mov [ebp+var_8], edi3 Z& y5 Q% l) S
- .text:24BC2CEE mov [ebp+var_1C], edi* s+ M; U7 C; _3 m( R& Z7 Q
- .text:24BC2CF1 mov [ebp+var_C], edi
% m+ t! h" y& K# F( T( b) j - .text:24BC2CF4 mov [ebp+var_10], edi
) v# M8 F) |: u; m - .text:24BC2CF7 mov [ebp+var_18], edi
* Q# [' B C. _2 I. _; E+ [ - .text:24BC2CFA call ebx ; LoadLibraryA! \8 ]0 O2 K4 A& ?$ g5 \- L( X+ a
- .text:24BC2CFC mov esi, eax# h4 b2 T. z6 D) ^6 M" U
- .text:24BC2CFE cmp esi, edi
7 B. ]2 L& b/ h: P2 k% G - .text:24BC2D00 mov [ebp+hLibModule], esi
! k4 M4 w, ~) c$ G" [% P - .text:24BC2D03 jnz short loc_24BC2D0F
0 Y$ u; ^* G# k( j1 O - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"2 Z+ m- i4 a/ a8 z+ P8 A1 i. a) m/ U
- .text:24BC2D0A jmp loc_24BC2E6D4 ]# ^5 l( O+ w9 m7 c* `
- .text:24BC2D0F ; ---------------------------------------------------------------------------/ i7 o7 V3 M& J- X! X
- .text:24BC2D0F
' h. n6 U: e( f. r+ ]7 o2 G - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j2 ^+ r6 c7 e- {" d; w
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"$ R8 |8 [: j# ?( f/ L1 ~( T
- .text:24BC2D14 push esi ; hModule
8 z! m& r+ G, o - .text:24BC2D15 call ds:GetProcAddress
5 k% a/ D6 d4 y7 b - .text:24BC2D1B cmp eax, edi! U) u4 B- b8 n
- .text:24BC2D1D jnz short loc_24BC2D30 }/ \. m8 j9 [4 s8 n; Y0 ^
- .text:24BC2D1F push esi ; hLibModule2 X. K* H0 q$ u1 A9 e& r6 `; [
- .text:24BC2D20 call ds:FreeLibrary) E% C* ^* k" m) Z) A9 r0 H
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...7 B4 ?% |7 _1 K- k/ G, F
- .text:24BC2D2B jmp loc_24BC2E6D* S# l0 K( @7 e: Y* q
- .text:24BC2D30 ; ---------------------------------------------------------------------------$ D8 O' F" [/ ^4 L; K4 ^
- .text:24BC2D30
" U5 [' [! {1 E+ w1 D1 _: H/ O - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
) A4 @: t# p2 ~. m7 f; V2 s/ d - .text:24BC2D30 lea ecx, [ebp+var_8]" r- z9 o2 L! d9 \1 j
- .text:24BC2D33 push edi
, j* Y [1 |3 G$ q. F - .text:24BC2D34 push ecx
, }. {& y: |& p - .text:24BC2D35 push edi
. _5 L5 i. [6 A0 s4 q# d7 ^ - .text:24BC2D36 call eax
% j/ Y3 a ]1 A6 o, c* E - .text:24BC2D38 test eax, eax( j- K; K! |4 u3 z' V( ^
- .text:24BC2D3A jge short loc_24BC2D4D7 }6 m- g- l7 v" p Y6 K- q
- .text:24BC2D3C push esi ; hLibModule
6 v: `4 p" M. b- R9 \5 H - .text:24BC2D3D call ds:FreeLibrary: w2 m, X8 C& _' h8 D
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
" b3 C9 r( v! E( X8 P$ R8 E4 R - .text:24BC2D48 jmp loc_24BC2E6D) J, ?. b! W$ N6 {4 w" Q
- .text:24BC2D4D ; ---------------------------------------------------------------------------6 w# s, ?) Q4 i; }
- .text:24BC2D4D3 Y8 G, ^+ c/ }4 v2 X+ @0 i2 G
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
+ E0 G7 Z% N2 B! K% F# _0 p( A7 {; X6 C - .text:24BC2D4D mov eax, [ebp+var_8]) T7 U1 o! c' M& U. i) i
- .text:24BC2D50 lea edx, [ebp+var_1C]
- d$ ?0 k# l) \( i& x2 H5 B( d5 G0 A - .text:24BC2D53 push edx' z2 S+ y+ B5 a1 z
- .text:24BC2D54 push offset unk_24BC4470
+ a% \' J3 j! ?* h+ C - .text:24BC2D59 mov ecx, [eax]! p. v" Y$ O, w) s/ o# C- T1 w
- .text:24BC2D5B push eax* y3 x0 u! v4 i: |
- .text:24BC2D5C call dword ptr [ecx]
1 Z T$ o6 R. A9 Q# i! k - .text:24BC2D5E test eax, eax$ t+ a$ b2 ^3 L. w
- .text:24BC2D60 jge short loc_24BC2D87
$ O2 v3 W6 g8 W3 E; Q& K - .text:24BC2D62 mov eax, [ebp+var_8]
6 d/ F# z1 g( E! E' M - .text:24BC2D65 push eax
5 m- i% T T- j6 W6 |7 q - .text:24BC2D66 mov ecx, [eax]
" b* Q+ M6 ], P - .text:24BC2D68 call dword ptr [ecx+8]
5 l, \' _! [- A. m% n9 V! m6 ~9 T' _ - .text:24BC2D6B push esi ; hLibModule$ T% q( b1 `) ?; v9 M4 Y+ e. u/ b
- .text:24BC2D6C call ds:FreeLibrary
5 F# {6 q. P, K# M. r* _ - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"8 f( Z/ H' A. i8 D V% i$ M
- .text:24BC2D77 call ds:OutputDebugStringA
& R& E+ G) e2 M+ C; r - .text:24BC2D7D mov eax, 100h" x5 [5 A- t- _( P* A
- .text:24BC2D82 jmp loc_24BC3011
% @$ l0 B) q% ~, E- { - .text:24BC2D87 ; ---------------------------------------------------------------------------
- X i1 b U% D2 H1 `9 w% l - .text:24BC2D87; _- H) J3 B: p" `# e" H1 ^
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j% }/ e3 Q9 O( e: e
- .text:24BC2D87 mov eax, [ebp+var_1C]
0 O; R) ^9 f& g9 |2 ~" Q5 |# h' U - .text:24BC2D8A push eax/ z# i7 b1 l. S' j. O, \
- .text:24BC2D8B mov ecx, [eax]+ K; A3 o" d4 L, ^* d6 \: |
- .text:24BC2D8D call dword ptr [ecx+8]9 t8 Q" U& I, T
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"8 M* k+ p- ^- I3 l+ h. I" O6 N( M
- .text:24BC2D95 call ebx ; LoadLibraryA
! ^8 f& z, B: _7 e5 Z* m - .text:24BC2D97 mov esi, eax
4 ]2 Z0 M* M1 n4 L+ D - .text:24BC2D99 cmp esi, edi, a4 `/ }$ ` q. Y0 s" @) [ Z
- .text:24BC2D9B jnz short loc_24BC2DB6+ w! t1 m5 s, _
- .text:24BC2D9D mov eax, [ebp+var_8]0 y0 w: W6 ]+ k8 u7 H+ D- x3 }8 t
- .text:24BC2DA0 push eax# T+ D) r/ i' e3 x0 u3 A& e
- .text:24BC2DA1 mov ecx, [eax]
; R2 I1 E) k# _7 p9 A n: d - .text:24BC2DA3 call dword ptr [ecx+8]
* {6 q: Q4 ]# r - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
; I, Q6 n' j! j9 M# q - .text:24BC2DA9 call ds:FreeLibrary6 }" U& {+ O$ j4 T) [
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n", B9 T, u+ {( T3 N8 K4 e
- .text:24BC2DB4 jmp short loc_24BC2DE2( T6 f/ {) o( I, b3 ]" q0 U- c
- .text:24BC2DB6 ; ---------------------------------------------------------------------------; f2 M- a& p+ b: b1 N% n: ]5 c6 p
- .text:24BC2DB6 a5 c4 N9 D/ J' ^% O; y
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j: M7 H# A* ?' p
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"1 w7 o: Z7 _6 v. d: ?+ t ]* Q
- .text:24BC2DBB push esi ; hModule
/ E) C5 z3 ~! W - .text:24BC2DBC call ds:GetProcAddress
# b6 G+ t% X4 J2 \/ q - .text:24BC2DC2 push esi ; hLibModule
. _1 ?. R% O3 Y" H& n - .text:24BC2DC3 mov esi, ds:FreeLibrary( q1 x( z6 D7 f
- .text:24BC2DC9 test eax, eax
- s3 t1 e3 W# A" ? L! U - .text:24BC2DCB jnz short loc_24BC2DF2
2 `% @1 H B; P, i8 G, q - .text:24BC2DCD call esi ; FreeLibrary0 V* E v, m! U' H0 v& B) |$ a
- .text:24BC2DCF mov eax, [ebp+var_8]
$ [/ O( d" ?5 c3 Y - .text:24BC2DD2 push eax
& Y- ]" D5 K( I# q - .text:24BC2DD3 mov ecx, [eax]1 a, Y% @, t- h; v' D
- .text:24BC2DD5 call dword ptr [ecx+8]: g& W4 ]9 w7 f% \
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule, d- X# q6 J1 v1 T- m
- .text:24BC2DDB call esi ; FreeLibrary/ J2 e! l' c" A+ M
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...; }, z% ^2 u d
- .text:24BC2DE27 V- t5 H0 b" u! ~' @
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j( M9 y( E G/ s6 u9 w! V& `
- .text:24BC2DE2 call ds:OutputDebugStringA
; c$ O& T1 x. q3 a) z- p* i - .text:24BC2DE8 mov eax, 200h' w, M2 b2 G# q! B
- .text:24BC2DED jmp loc_24BC3011
6 B( s' @) h E - .text:24BC2DF2 ; ---------------------------------------------------------------------------
$ x* G7 B! [; k( o/ F* P& ] - .text:24BC2DF2
1 R2 j# \6 _2 f" B2 R- c1 E! i - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j. x) @5 u3 ?2 ]2 X
- .text:24BC2DF2 call esi ; FreeLibrary
, r2 y$ s& b \ - .text:24BC2DF4 push 6Ch ; Size' K$ @1 z$ B4 @ D" I
- .text:24BC2DF6 lea eax, [ebp+Dst]
' u7 b+ w6 A& a: H; ~/ v% i - .text:24BC2DFC push edi ; Val
/ _" |& r9 s# _4 c. y; U1 D4 R - .text:24BC2DFD push eax ; Dst
# K( K* u* Z: T. g* J - .text:24BC2DFE call memset+ O9 {& x6 `0 |9 |
- .text:24BC2E03 mov eax, [ebp+var_8]
4 f9 @" ^7 q& v& W - .text:24BC2E06 add esp, 0Ch t/ T. ]4 D, D c' x
- .text:24BC2E09 mov [ebp+Dst], 6Ch+ J9 f) e& }, z' E
- .text:24BC2E13 mov [ebp+var_8C], 18 @# c! @( V% L
- .text:24BC2E1D mov [ebp+var_28], 200h
- n% j7 x8 }, d - .text:24BC2E24 mov ecx, [eax]/ V4 N* T; X+ v' b; O3 x
- .text:24BC2E26 push 85 a4 Z! d: T; v1 ]$ k( M8 {$ ?
- .text:24BC2E28 push edi5 I Z7 i% Z( g1 v3 R3 c% l! O7 ^
- .text:24BC2E29 push eax, o1 t d; L$ c" ^" b; C
- .text:24BC2E2A call dword ptr [ecx+50h]
% T2 e' K% |' E1 ? - .text:24BC2E2D test eax, eax
0 ?2 c; s, ]7 E, ]0 H: I0 | - .text:24BC2E2F mov eax, [ebp+var_8]
3 p3 V/ _( G2 l1 V& g - .text:24BC2E32 mov ecx, [eax]2 k4 T$ y" U1 }& H) K0 z( {
- .text:24BC2E34 jge short loc_24BC2E46
' Q! u$ h" n2 Z7 q - .text:24BC2E36 push eax9 Q) L- `8 f" Y, k
- .text:24BC2E37 call dword ptr [ecx+8]1 P6 ^1 }. p+ p0 O- I
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
7 D5 a e! O8 i - .text:24BC2E3D call esi ; FreeLibrary
% h6 Y& v) e& n7 c. x* M7 X$ q/ A - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
) K7 R! S- ]9 c5 w% j - .text:24BC2E44 jmp short loc_24BC2E6D
) Y* c( c/ ~6 T* H' { - .text:24BC2E46 ; ---------------------------------------------------------------------------
' t0 l0 `0 T1 ?8 ^* y1 Z4 h - .text:24BC2E46
! g1 f( J& w/ l) t. M- {: ] - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j; c ^ t, O$ S9 e! ]2 U
- .text:24BC2E46 lea edx, [ebp+var_C]
. g- A! O$ J& V8 w1 o; g - .text:24BC2E49 push edi
' o" K* B$ N7 k4 W - .text:24BC2E4A push edx
7 M5 y& {& R8 N, H5 }3 [) f+ @ - .text:24BC2E4B lea edx, [ebp+Dst]5 t" e" J4 C# l4 }& B
- .text:24BC2E51 push edx0 w' J" Z$ g2 k: d8 y# c/ c8 E9 B
- .text:24BC2E52 push eax8 p. n' o, ]0 q
- .text:24BC2E53 call dword ptr [ecx+18h]+ S8 l8 f- L/ I5 b( _* v( \
- .text:24BC2E56 test eax, eax# n6 ?! Q( v/ C$ t
- .text:24BC2E58 jge short loc_24BC2E7A% J0 p$ ]& Z _: w2 {5 @
- .text:24BC2E5A mov eax, [ebp+var_8]
3 M4 n6 Y6 I, f r - .text:24BC2E5D push eax1 }0 K+ h: F& K3 z z/ x
- .text:24BC2E5E mov ecx, [eax]
, Z6 w; [( L4 F) p - .text:24BC2E60 call dword ptr [ecx+8]
! r* m. `0 w9 N/ a - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
! E: n/ j6 K. `' C) R+ U; K9 B - .text:24BC2E66 call esi ; FreeLibrary
0 e9 i$ K! C0 Q7 J+ J. c* l$ [0 ]/ ] - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"5 J; f7 X# I3 b% _, i9 b. @8 K9 d
- .text:24BC2E6D
, Q. T* I9 \% q6 h' L$ |& T: u: Q - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j7 z W# i% s3 H! p7 M: ?! {
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...0 W8 M" }: c2 Y6 K
- .text:24BC2E6D call ds:OutputDebugStringA
3 A& {) G# F, g7 d - .text:24BC2E73 xor eax, eax
- ^! z. b6 T v( t6 i3 ~% C - .text:24BC2E75 jmp loc_24BC30115 ]1 C/ y+ p- i7 w+ X$ E* J, I
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 : s9 w+ Z5 ?9 Y% ^2 c9 I+ E' [- j" f
# B) E% e" p9 u
; f/ n! |. U" _. V4 `" K# u4 L |