这游戏以前分析过,本贴再写得详细一些。
+ t* ^: X5 T5 G/ ?这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
/ _! ]4 o2 ~8 j5 x7 Q5 ]注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
1 n) H' a: K4 W6 g: K% v# Z- b- k/ }# K F* R2 z4 ^0 b
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18./ g' D3 g9 q, v+ G
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
. ?1 L0 y+ \; c) R; r - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
& K, F- m8 E$ u, i: `" C) u+ u3 L - STDMETHOD_(ULONG,Release) (THIS) PURE;4 }! ^/ @: b4 J1 ?: H. T
- STDMETHOD(Compact)(THIS) PURE;4 R o7 S' R6 M" s6 Y2 w! q* x
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
6 ^% ~; l6 x/ N6 L2 G2 E - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
6 S6 I+ A: C. |5 ^4 r - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
% U; ]4 A ]+ c" l/ w以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 ) K4 [ s+ K: s; M* p% b0 F
' p; b) u7 h6 G1 Q7 r6 h" x5 N; v3 z0 E5 ^1 s+ i
# k4 T* X/ @5 z
% _. F3 d2 a$ s+ ^# E! @9 p- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================% q: y' u7 B3 @! o1 V+ |9 o
- .text:24BC2CD2
# [# j5 Z$ f/ A) W6 O0 u3 z - .text:24BC2CD2 ; Attributes: bp-based frame
7 l2 S. p0 P6 u: q6 ^9 B - .text:24BC2CD2
3 @" ^% t' y3 _6 j2 { - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p3 f2 z+ }2 m; Y
- .text:24BC2CD2$ R8 b" `8 z+ v9 g" G% j4 N% e
- .text:24BC2CD2 Dst = dword ptr -90h
% N$ F$ a2 f, U, h - .text:24BC2CD2 var_8C = dword ptr -8Ch2 o- X- L( B9 s/ X S
- .text:24BC2CD2 var_28 = dword ptr -28h
+ A8 t- a6 U* r# j4 x+ d - .text:24BC2CD2 var_24 = dword ptr -24h: ?# D- ~1 Y1 n7 k1 q3 U
- .text:24BC2CD2 var_20 = dword ptr -20h
. ]# C/ {) q; J, f - .text:24BC2CD2 var_1C = dword ptr -1Ch. z9 j* \, [: K
- .text:24BC2CD2 var_18 = dword ptr -18h8 \: M! z& \( n" T7 v3 E- ?& |
- .text:24BC2CD2 ppv = dword ptr -14h2 i$ Z, A* ]! \9 B7 @
- .text:24BC2CD2 var_10 = dword ptr -10h
s0 G$ V6 h4 Z( }5 o - .text:24BC2CD2 var_C = dword ptr -0Ch4 F/ r6 g, c; x* U( E
- .text:24BC2CD2 var_8 = dword ptr -8
6 O: A; g! J& h4 i - .text:24BC2CD2 hLibModule = dword ptr -4& w1 }& c$ E3 l# @1 E: e. B
- .text:24BC2CD2
, ^1 f! w. P4 X/ q( T o - .text:24BC2CD2 push ebp6 ]( I) Z3 Q( L# q4 d
- .text:24BC2CD3 mov ebp, esp
9 l& X3 o( a& L ?' T7 ?( H6 J9 @ - .text:24BC2CD5 sub esp, 90h
0 ?) r" G% C" a: ] - .text:24BC2CDB push ebx
$ M0 l* q% u* o" q" C3 ]$ R/ v3 _ - .text:24BC2CDC mov ebx, ds:LoadLibraryA1 A, L- c, q2 t& Y2 O- ~4 n
- .text:24BC2CE2 push esi
6 X- z4 w/ P5 V* N. B - .text:24BC2CE3 push edi* L% c9 q1 ~7 Q) q
- .text:24BC2CE4 xor edi, edi
3 Z1 q3 w5 P m( D" j8 u$ t2 ~ - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"* I+ S3 f' L+ B9 [
- .text:24BC2CEB mov [ebp+var_8], edi! J2 v6 ~5 i- `9 e4 i3 I7 I6 V
- .text:24BC2CEE mov [ebp+var_1C], edi) v' y+ a5 u; M
- .text:24BC2CF1 mov [ebp+var_C], edi
' @2 j3 S5 d9 k - .text:24BC2CF4 mov [ebp+var_10], edi! T: J$ x; O# m: B$ k2 m- q
- .text:24BC2CF7 mov [ebp+var_18], edi/ K Z, ~% M4 `; k% w9 }: H6 k
- .text:24BC2CFA call ebx ; LoadLibraryA4 `& P) u6 e- z6 y( C
- .text:24BC2CFC mov esi, eax
$ f7 f$ h& g; x3 [! L! F& q - .text:24BC2CFE cmp esi, edi
1 k. c, F! }# }& M' J; w - .text:24BC2D00 mov [ebp+hLibModule], esi
3 F1 M O2 J2 U; `) e) N6 Y6 | u - .text:24BC2D03 jnz short loc_24BC2D0F
, c& j. A* N) M S r9 `+ C# ?% { - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
; O% {* r/ l; i% E! z$ z7 T9 m- U( y - .text:24BC2D0A jmp loc_24BC2E6D% L! `* {' E+ I- ?3 Q5 w
- .text:24BC2D0F ; ---------------------------------------------------------------------------$ A' l4 e7 h) V6 |
- .text:24BC2D0F o p- \( t9 x- e# _; \
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
/ _6 r C! b6 B; U - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"' o% x) ^) n3 I$ i2 W# S$ e
- .text:24BC2D14 push esi ; hModule
( H( l5 _. Y$ f* [! @' C! a' A - .text:24BC2D15 call ds:GetProcAddress' p- W& ]9 u( o# L" X: `3 Z' e
- .text:24BC2D1B cmp eax, edi
5 U- P" Q9 {" _2 U( g, ] - .text:24BC2D1D jnz short loc_24BC2D30
5 ]- {4 s) E! d! P1 V3 ^3 E1 T" z - .text:24BC2D1F push esi ; hLibModule! e; O2 T7 U u9 T9 ?
- .text:24BC2D20 call ds:FreeLibrary3 O" @' _* @' W- c: o6 F
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
' q" P: ~8 s% S- u5 o - .text:24BC2D2B jmp loc_24BC2E6D8 Q* n3 U- L. u- d
- .text:24BC2D30 ; ---------------------------------------------------------------------------* |; |. c8 [' O0 O
- .text:24BC2D30
* r/ J$ d% z2 }9 c" j - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
9 n# f y6 e# H6 r - .text:24BC2D30 lea ecx, [ebp+var_8]8 `' g4 I! c7 c0 b% X# p2 E0 Z; O
- .text:24BC2D33 push edi
) S9 ~( I7 u: U, G+ f$ H5 M - .text:24BC2D34 push ecx, K5 a, l. Y* W: F A" |/ X9 I! l
- .text:24BC2D35 push edi* _+ |, O6 T8 Q, p% x
- .text:24BC2D36 call eax0 o* E/ x' |! G4 u/ o2 A
- .text:24BC2D38 test eax, eax
+ K( ~) n$ C1 a" w$ \/ [ - .text:24BC2D3A jge short loc_24BC2D4D
' }8 @: M) G# ]6 x& ? - .text:24BC2D3C push esi ; hLibModule7 Q, b+ F1 J- S. H
- .text:24BC2D3D call ds:FreeLibrary0 ?3 V; q! C' n' U
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
% s3 R E! ?; ]; d; A - .text:24BC2D48 jmp loc_24BC2E6D( i+ t+ A+ i- q
- .text:24BC2D4D ; ---------------------------------------------------------------------------$ d' a4 E% k7 m
- .text:24BC2D4D
3 H _' }6 B _; j- L* ~/ q/ p - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
- ]/ @7 }! x/ r6 } - .text:24BC2D4D mov eax, [ebp+var_8]
$ X. J0 }( L- @% j+ K% E - .text:24BC2D50 lea edx, [ebp+var_1C]- F H2 b) S) U, U1 P% K
- .text:24BC2D53 push edx
]+ L& L7 u2 a% A - .text:24BC2D54 push offset unk_24BC4470
+ {# a& K5 ~1 p" b$ o( i - .text:24BC2D59 mov ecx, [eax]
+ X$ o5 E' P7 r - .text:24BC2D5B push eax
& s' h) }- W/ [: R3 d' l" }: h - .text:24BC2D5C call dword ptr [ecx]
: l }/ J& p+ A) G( g$ Z0 \ - .text:24BC2D5E test eax, eax
8 b( E6 q4 g' I/ ]' g - .text:24BC2D60 jge short loc_24BC2D87
- i2 Q3 l6 }0 r - .text:24BC2D62 mov eax, [ebp+var_8]* e! {0 z" A/ Y+ R- C' _0 g0 [
- .text:24BC2D65 push eax* W& O9 q8 {7 z
- .text:24BC2D66 mov ecx, [eax]
4 |: K! [, l! U E- D; a( t1 k& L1 Q - .text:24BC2D68 call dword ptr [ecx+8]! t3 s3 A- l w+ M4 m+ `
- .text:24BC2D6B push esi ; hLibModule6 o1 c ?, f, W/ z& f
- .text:24BC2D6C call ds:FreeLibrary) G ?( P( o3 p+ ?5 x w2 }
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"& J1 z1 C' ?7 E+ ?# ^
- .text:24BC2D77 call ds:OutputDebugStringA" x/ l: g8 E$ \+ L5 ~$ i3 A6 t
- .text:24BC2D7D mov eax, 100h- \! v5 j$ r% P5 g% t
- .text:24BC2D82 jmp loc_24BC3011
: z# f6 a" n8 J- B0 S - .text:24BC2D87 ; ---------------------------------------------------------------------------
) F' {: c7 C- P3 ~ - .text:24BC2D87( \) k% L; A2 u9 G" @
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
8 W4 t- w8 ^ l- P j$ K0 w; i$ q - .text:24BC2D87 mov eax, [ebp+var_1C]
+ Y; d: Y0 N/ @7 e; i - .text:24BC2D8A push eax
1 ] B$ d$ x2 I+ `' {( a - .text:24BC2D8B mov ecx, [eax]8 a+ t+ [" D! O- h( C
- .text:24BC2D8D call dword ptr [ecx+8] w7 B$ Y8 E' _0 Z6 L
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"; K" g( B: s7 C
- .text:24BC2D95 call ebx ; LoadLibraryA
4 Q5 B x `+ c% O. Y4 T - .text:24BC2D97 mov esi, eax
# B# U9 w. U4 M8 K8 k: f - .text:24BC2D99 cmp esi, edi5 |. F+ N5 t2 V1 h' W
- .text:24BC2D9B jnz short loc_24BC2DB6
1 I8 R/ r5 j. C7 F - .text:24BC2D9D mov eax, [ebp+var_8]
' W( K4 i, U# x8 K - .text:24BC2DA0 push eax
1 a8 L* r3 _. p$ _% P: ^ - .text:24BC2DA1 mov ecx, [eax]0 k+ s: M% R$ g
- .text:24BC2DA3 call dword ptr [ecx+8]) I" B/ D6 a+ I, J% v/ w
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
1 a, ?$ s* K& T6 A! f1 B7 ] - .text:24BC2DA9 call ds:FreeLibrary
9 u: q; g" L$ P) Y* G3 e) O7 W - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"5 @; [/ M3 k6 P5 S1 u
- .text:24BC2DB4 jmp short loc_24BC2DE2
/ o! `8 O; V2 d2 U - .text:24BC2DB6 ; ---------------------------------------------------------------------------; w* J. ]" i. w& w/ F8 X
- .text:24BC2DB6; I3 O) }$ N d0 G7 K. k
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j2 {$ S3 m- R. d0 {
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
* o$ T3 \0 P E8 p: r0 a( } - .text:24BC2DBB push esi ; hModule% u- t( J l( z; w1 M* ]% _
- .text:24BC2DBC call ds:GetProcAddress
W1 U3 r0 h8 g1 \ - .text:24BC2DC2 push esi ; hLibModule* W R0 U6 ^2 [/ k/ t( w% y
- .text:24BC2DC3 mov esi, ds:FreeLibrary1 T6 N$ |2 _* N/ q! N, n1 y
- .text:24BC2DC9 test eax, eax; A& e! m" J6 T' T
- .text:24BC2DCB jnz short loc_24BC2DF2! M$ W- |3 ?8 [$ A, V2 Z, I
- .text:24BC2DCD call esi ; FreeLibrary
8 e0 g# ^9 r. W2 p1 G) H' t; b - .text:24BC2DCF mov eax, [ebp+var_8]2 Y, A' ]. `' K
- .text:24BC2DD2 push eax
; E7 A" D2 d9 g3 h% ~+ \ - .text:24BC2DD3 mov ecx, [eax]
# n5 w& ^7 }/ r+ { - .text:24BC2DD5 call dword ptr [ecx+8]
4 @: v* K0 n, r0 B" `- d k - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
! g: A. D# b1 C. w% f, r: } - .text:24BC2DDB call esi ; FreeLibrary
0 L* z V$ l/ F. q - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...+ b0 Y8 f4 W/ M& m5 s, Q
- .text:24BC2DE2
0 h3 `6 P$ g/ Q* D - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
/ L, k8 L( O; s - .text:24BC2DE2 call ds:OutputDebugStringA
. ]" V& b- A: T, ?9 A' D - .text:24BC2DE8 mov eax, 200h& S7 s! C i3 [) a/ i
- .text:24BC2DED jmp loc_24BC3011
9 s) g! d( h, f: Q! E1 ] - .text:24BC2DF2 ; ---------------------------------------------------------------------------
9 T6 Q9 [% E; D* [ j/ A" s& H4 i - .text:24BC2DF2( I# N9 _! J+ n* c( t/ \
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
- e2 y9 W$ `/ i/ R- }. U- w: w - .text:24BC2DF2 call esi ; FreeLibrary
. J5 l/ _0 D# Z0 y# g - .text:24BC2DF4 push 6Ch ; Size3 q3 W% D! O5 a: C
- .text:24BC2DF6 lea eax, [ebp+Dst]! }+ P7 l! @8 f( C, j1 \. O7 f
- .text:24BC2DFC push edi ; Val" _8 N6 ^; s: @0 w) n' ~
- .text:24BC2DFD push eax ; Dst ^; [2 u) K$ ], h3 P
- .text:24BC2DFE call memset/ j7 ^+ ?5 G+ o) B' X! B
- .text:24BC2E03 mov eax, [ebp+var_8]; w2 a# m/ f6 _/ r* n, g1 o7 o
- .text:24BC2E06 add esp, 0Ch
* D% I L4 q8 J/ ?; G - .text:24BC2E09 mov [ebp+Dst], 6Ch+ i* I! M, [( f, P* q
- .text:24BC2E13 mov [ebp+var_8C], 1
' {1 b1 g5 e( P9 |& y - .text:24BC2E1D mov [ebp+var_28], 200h
! z+ M: D) Z! p3 g0 ]! w4 w" W9 B - .text:24BC2E24 mov ecx, [eax]# v' I8 @- {: O2 h+ @* y3 [; l
- .text:24BC2E26 push 8
% A5 Z$ @) M/ N - .text:24BC2E28 push edi
* g$ m0 Y9 [. M# I - .text:24BC2E29 push eax+ n8 e, E# z% ^6 E! g. a$ ~8 X
- .text:24BC2E2A call dword ptr [ecx+50h]
" {: S3 U) F$ {( i5 S - .text:24BC2E2D test eax, eax
$ X) z/ a7 |1 b- ] - .text:24BC2E2F mov eax, [ebp+var_8]1 A2 i! P8 l. z7 h# f" I$ b8 {, s
- .text:24BC2E32 mov ecx, [eax]8 Z0 B2 u' C4 u9 \
- .text:24BC2E34 jge short loc_24BC2E46
, _5 d% s# H( _# B: F1 u: W4 { - .text:24BC2E36 push eax4 o5 R/ t) V/ i3 _: Z& J
- .text:24BC2E37 call dword ptr [ecx+8]
" H% ?4 p, r L - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule" w( f% F+ W8 c) L7 I
- .text:24BC2E3D call esi ; FreeLibrary$ ^* ~- V1 P6 ^% t1 {( x
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n". h0 B H9 X- }6 h* g$ u
- .text:24BC2E44 jmp short loc_24BC2E6D
) y7 \; K$ W! R9 v8 [- F# k8 d! Z& ~ - .text:24BC2E46 ; ---------------------------------------------------------------------------
9 N8 q. U( v2 L7 ]# ^/ N7 C" Y - .text:24BC2E46
0 A) b5 k( c& Z( ^8 e - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j; e, y, I* D9 e# a8 a1 K3 |3 y
- .text:24BC2E46 lea edx, [ebp+var_C]
$ |9 a& M: z& X# | - .text:24BC2E49 push edi
& U2 Q2 }* c" W- X2 d$ i$ Z - .text:24BC2E4A push edx1 m) ?7 B0 z4 L0 {2 v7 p2 J1 m
- .text:24BC2E4B lea edx, [ebp+Dst]
9 }9 r2 d1 M+ I; D1 ? - .text:24BC2E51 push edx
5 G- Z+ {9 o0 I8 [+ _: K - .text:24BC2E52 push eax
7 ^2 | T' G7 b) k. K; X# N9 S, G - .text:24BC2E53 call dword ptr [ecx+18h]
1 @* U( Q* U8 U& P - .text:24BC2E56 test eax, eax
$ Z, b, A8 E6 X: v - .text:24BC2E58 jge short loc_24BC2E7A
% p& f. E ~. U% K& j5 M ^9 y; K! Y - .text:24BC2E5A mov eax, [ebp+var_8]
! m4 H, w" H Z$ X - .text:24BC2E5D push eax
^- o/ f; f2 A9 k2 u8 a - .text:24BC2E5E mov ecx, [eax]9 S3 q( b0 M: R, d ^# ]
- .text:24BC2E60 call dword ptr [ecx+8]; c! X$ r+ K: Y
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule8 ~: t4 g3 T, D! Y* \( [
- .text:24BC2E66 call esi ; FreeLibrary0 [$ W- @1 o& A
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"3 ~4 A9 `5 T& E8 o! v
- .text:24BC2E6D( @# B. f1 _/ g/ Q* _) h
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j9 F; ?, H1 R: Q3 O
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
5 o. m |6 p: u, x - .text:24BC2E6D call ds:OutputDebugStringA( p% ]& S0 {% [' Z! T" c/ X
- .text:24BC2E73 xor eax, eax
1 d7 D3 G& U7 J1 j9 ^ x1 m6 d" _( m - .text:24BC2E75 jmp loc_24BC3011
8 ^; S3 E. N8 b' G - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 2 \, a+ T% ^ B0 i! G
, o5 ]9 o( ^ Q- C
9 b+ b% R9 J( N* H
|