这游戏以前分析过,本贴再写得详细一些。( z, Z: ]* `. x3 r6 I* k
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
. Y. ^4 M+ @1 m. T) b6 i. h5 p注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。$ `1 |, a& z; @3 O4 @7 o
& C }% x( g4 g- X5 k! x
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18." P( z R3 V; _. W! Q0 [
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
& l9 x, Q6 C% Q1 A. S$ O3 s2 C - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
) j& a! A/ ~+ B2 \2 M; O* L) \! _& v - STDMETHOD_(ULONG,Release) (THIS) PURE;5 @3 _0 T! \- C
- STDMETHOD(Compact)(THIS) PURE;6 t Z2 @: D/ c) q0 F \
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;! p8 f' k1 Q5 @+ ]
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;! S, ^0 Z) t3 D: R$ g* d
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
6 @- ~4 a8 s6 o* m4 ~以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
' w6 H" u3 W# B, h! m j3 e9 p. {' Q
; C- E2 c3 q+ ^; E6 S7 R
$ T4 ]& s R3 {' L1 f" W) s
# d$ Q! e6 e& D; R4 D0 [% D- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================# D3 y$ v; _6 C/ x& L" h
- .text:24BC2CD2
% i" p: r- L5 A1 z - .text:24BC2CD2 ; Attributes: bp-based frame
2 }2 H9 D" L2 F4 Q0 X - .text:24BC2CD2* X4 z$ A* a! H" W
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
4 _3 F3 ]. B$ D6 W/ h# Z - .text:24BC2CD2
" @$ s* Y: k7 f4 g% R - .text:24BC2CD2 Dst = dword ptr -90h
- @( [0 Z' \ ?6 W* q: V - .text:24BC2CD2 var_8C = dword ptr -8Ch
* \" Q7 I; P- d4 L7 x - .text:24BC2CD2 var_28 = dword ptr -28h- s. c' T8 z) g `6 {
- .text:24BC2CD2 var_24 = dword ptr -24h
! N4 a: C$ B& H$ ~& \* h0 l - .text:24BC2CD2 var_20 = dword ptr -20h
% U- n6 s) _+ h3 N) { - .text:24BC2CD2 var_1C = dword ptr -1Ch5 ]2 d: p. h; f; i* z
- .text:24BC2CD2 var_18 = dword ptr -18h |$ H( E! P& N6 W! V: D' D
- .text:24BC2CD2 ppv = dword ptr -14h" L- e5 p( l- B8 M
- .text:24BC2CD2 var_10 = dword ptr -10h, u @9 x7 h. d2 F0 C! n8 `* C% L( V
- .text:24BC2CD2 var_C = dword ptr -0Ch$ G- f6 X/ C s6 I0 Q! n
- .text:24BC2CD2 var_8 = dword ptr -87 x8 [) z/ E" g2 K& s& d0 k
- .text:24BC2CD2 hLibModule = dword ptr -4- T* _4 r4 L' q, q) Q4 ?. P N8 V( ?9 T
- .text:24BC2CD2
' A6 L/ t7 z' Z" ?4 Y - .text:24BC2CD2 push ebp6 \6 @0 H8 b( T( N p0 \
- .text:24BC2CD3 mov ebp, esp# J, V: w' Q: U; F, x/ W! `
- .text:24BC2CD5 sub esp, 90h, q: Q# ~1 U" e
- .text:24BC2CDB push ebx) F% Z# z2 {7 @/ l J) c; L
- .text:24BC2CDC mov ebx, ds:LoadLibraryA# M2 ~6 @, T8 s" Z2 b! W# [
- .text:24BC2CE2 push esi
& \9 x6 p3 b0 I, `4 j- M* z - .text:24BC2CE3 push edi
% \2 X6 }& F, E1 u - .text:24BC2CE4 xor edi, edi
7 ~6 u- r* i K9 |0 h5 h! ? - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
1 M/ D% p: q/ C! P - .text:24BC2CEB mov [ebp+var_8], edi
) q: P' y* g- |; _ - .text:24BC2CEE mov [ebp+var_1C], edi
0 J4 |8 D8 t' y% [0 ^ - .text:24BC2CF1 mov [ebp+var_C], edi" o, [/ O& }' \
- .text:24BC2CF4 mov [ebp+var_10], edi
* V( q% e$ `; T' R - .text:24BC2CF7 mov [ebp+var_18], edi
3 b3 K8 N! v$ D% h& y/ j/ Q x - .text:24BC2CFA call ebx ; LoadLibraryA
# w1 [3 ~9 V! M. p" N) h$ I$ e - .text:24BC2CFC mov esi, eax8 S3 c) s6 S r* Q
- .text:24BC2CFE cmp esi, edi
! {! P+ A# c5 | - .text:24BC2D00 mov [ebp+hLibModule], esi
* Z, C7 Z' M+ N: f; n* k - .text:24BC2D03 jnz short loc_24BC2D0F9 C, I& H6 k3 e+ R: h4 b5 n# M# a5 c
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
7 S; Z$ G5 o. a! Z9 z# r - .text:24BC2D0A jmp loc_24BC2E6D( D' x8 X( x5 J* {+ E
- .text:24BC2D0F ; ---------------------------------------------------------------------------
, z# m0 h x. _9 a - .text:24BC2D0F# i5 n2 Z1 ?$ `% T$ t
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
5 Z8 u( H5 e4 S7 ]7 I b' J, Q - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"- {& N) R4 n. K
- .text:24BC2D14 push esi ; hModule. o0 ? U4 c$ @! M
- .text:24BC2D15 call ds:GetProcAddress
; b( `9 z. k+ U$ m9 ]$ G) K/ B/ D - .text:24BC2D1B cmp eax, edi( z' `. i+ z/ Y' G
- .text:24BC2D1D jnz short loc_24BC2D30/ e3 c' u5 a S* c8 T2 j
- .text:24BC2D1F push esi ; hLibModule' c. _; I! [0 x3 I, _
- .text:24BC2D20 call ds:FreeLibrary5 X. R/ D) H3 v$ I7 K
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
9 k$ b# ]0 C& T - .text:24BC2D2B jmp loc_24BC2E6D
& ]% d4 }. g5 a. ^1 T - .text:24BC2D30 ; ---------------------------------------------------------------------------
9 i3 l" h, E @2 W - .text:24BC2D30
+ D9 T9 z! B- G1 Z& f - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
( a' s$ [, O" r - .text:24BC2D30 lea ecx, [ebp+var_8]
! A, E+ [1 o, X( y$ f4 M - .text:24BC2D33 push edi; c4 V3 D5 e. U5 h
- .text:24BC2D34 push ecx
% S( t) h2 P/ N' Q& X - .text:24BC2D35 push edi
+ S0 v6 r. q( m% \& I/ ^! Y - .text:24BC2D36 call eax7 |, u" M# q3 y3 F, a' d
- .text:24BC2D38 test eax, eax
3 q" f9 ]8 i9 _4 S - .text:24BC2D3A jge short loc_24BC2D4D* e8 ?2 d/ L8 Q
- .text:24BC2D3C push esi ; hLibModule. }1 z1 W$ ?$ C1 d7 Z5 y: H+ F
- .text:24BC2D3D call ds:FreeLibrary
; x& _9 p7 e/ Q, q4 X- { - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"" o2 }* Q$ ^' _& S
- .text:24BC2D48 jmp loc_24BC2E6D7 ]& l4 \1 P- p; d/ K1 t- i
- .text:24BC2D4D ; ---------------------------------------------------------------------------( S" V# n6 \6 C; L9 }" j
- .text:24BC2D4D
* k5 T) _# ?4 Q# c0 M- i, s - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j) l* ]6 R* i+ G8 N x/ C9 z
- .text:24BC2D4D mov eax, [ebp+var_8]
/ E! `; J1 N) i4 L) s7 _ - .text:24BC2D50 lea edx, [ebp+var_1C]
" P, h0 ?% ]5 a+ l! `+ [ - .text:24BC2D53 push edx
$ M5 b1 f2 x* j$ H, i* y - .text:24BC2D54 push offset unk_24BC4470
9 V( i' g: z, h3 j" n4 g9 ^; K+ U - .text:24BC2D59 mov ecx, [eax]
G1 N3 d7 d* W# W f+ } - .text:24BC2D5B push eax
3 `( Y& E d& `5 F3 K0 r( { - .text:24BC2D5C call dword ptr [ecx]
3 i @+ \; g1 J% B9 \' K - .text:24BC2D5E test eax, eax
$ Z2 b% b2 @ ?% L. r8 ] - .text:24BC2D60 jge short loc_24BC2D87; U) X$ ^7 d" Q; @; N- I6 c0 F
- .text:24BC2D62 mov eax, [ebp+var_8]6 K& Y/ v) X; P3 v* U
- .text:24BC2D65 push eax3 x- O' u1 h( i8 s8 T
- .text:24BC2D66 mov ecx, [eax], s% U' H/ [' d) V
- .text:24BC2D68 call dword ptr [ecx+8]
: C9 ?& O: B7 q: y - .text:24BC2D6B push esi ; hLibModule W$ P3 x. }, |4 B& s1 e
- .text:24BC2D6C call ds:FreeLibrary
+ _6 p% S, W! C, c1 e8 O, F! H5 A - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
/ `+ T r+ J! h$ W - .text:24BC2D77 call ds:OutputDebugStringA
& H4 h& {" s4 x) k7 c2 F& I - .text:24BC2D7D mov eax, 100h% z$ I& x9 ^: y* l* l3 W
- .text:24BC2D82 jmp loc_24BC30113 C: q" n2 `' U+ A
- .text:24BC2D87 ; ---------------------------------------------------------------------------
: d0 R. l, \# d- @9 ^/ U - .text:24BC2D875 p) ?# g0 y5 y& I. u- ^; o
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j8 i( \+ ]) F, Z
- .text:24BC2D87 mov eax, [ebp+var_1C]
2 I; A1 \7 k0 v w5 h - .text:24BC2D8A push eax
, q6 u3 Y8 k1 A- g7 L! y( ] - .text:24BC2D8B mov ecx, [eax]! U6 J: a- K' F' M* c1 K$ K
- .text:24BC2D8D call dword ptr [ecx+8]9 e+ _; @' W+ X3 @" }5 V: Y k
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
# X$ D1 M( O0 g$ Z - .text:24BC2D95 call ebx ; LoadLibraryA% ?2 ?1 _2 z, c3 w3 b$ ^
- .text:24BC2D97 mov esi, eax) n1 ` \! ?; C$ [5 i( g1 a
- .text:24BC2D99 cmp esi, edi
0 f6 b2 g7 f. k, r* o - .text:24BC2D9B jnz short loc_24BC2DB68 o6 p4 V6 N' @; O: `) m& u
- .text:24BC2D9D mov eax, [ebp+var_8]
4 B: {# g0 Y& t - .text:24BC2DA0 push eax
8 m L$ Y, a1 F* V7 H& p - .text:24BC2DA1 mov ecx, [eax]# p0 z9 ~- b% W m1 Z, Y0 p
- .text:24BC2DA3 call dword ptr [ecx+8]4 |" A9 E: M2 J6 t! M$ {# _
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
( ]: N: S$ y% T% D: ?0 X8 z - .text:24BC2DA9 call ds:FreeLibrary+ ~$ h/ L. ^9 P& E' r! [
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
/ J" d% l( {: w/ q Z - .text:24BC2DB4 jmp short loc_24BC2DE2, ?( T+ Y1 }& m8 ^4 ]
- .text:24BC2DB6 ; ---------------------------------------------------------------------------4 n( ]% u s, E& E) @* I
- .text:24BC2DB63 U% c0 O. O1 {3 G- U: e* Z
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
5 _9 i3 @0 V3 x8 g+ J - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
- k9 s% T$ D3 i6 W) m* c - .text:24BC2DBB push esi ; hModule( y4 U2 {8 M* t( R. f6 c J/ z# m9 w( p: e
- .text:24BC2DBC call ds:GetProcAddress
/ q% p5 r6 Y6 t: I, |: C - .text:24BC2DC2 push esi ; hLibModule
2 V. M$ y2 c' a& }. H - .text:24BC2DC3 mov esi, ds:FreeLibrary
, h/ H; p% A% V) M6 N) ^ - .text:24BC2DC9 test eax, eax
) [: Z! }# ]; k5 K/ s2 D; ~: ]3 g" |$ X8 b - .text:24BC2DCB jnz short loc_24BC2DF2
# Y; j; Y" I' [- o# e - .text:24BC2DCD call esi ; FreeLibrary
$ w* o- U3 Z G8 S - .text:24BC2DCF mov eax, [ebp+var_8], Z a$ r) V# y0 Y
- .text:24BC2DD2 push eax: U4 p; C" n* d
- .text:24BC2DD3 mov ecx, [eax]
( @; l! \ n2 G: s ^! w, C5 a7 ] - .text:24BC2DD5 call dword ptr [ecx+8]
0 Y) j, s3 ~8 n5 C8 h - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule1 S/ X5 h$ c7 e
- .text:24BC2DDB call esi ; FreeLibrary
" g- R, x' i3 x - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...: t$ A- p) \! N
- .text:24BC2DE2
- Z H6 w4 n' N! _2 H2 t- j1 F- w - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
/ @0 D1 a" O6 R0 P3 o - .text:24BC2DE2 call ds:OutputDebugStringA+ n: B% F( `- H" A* b; s
- .text:24BC2DE8 mov eax, 200h( z0 v& P& w g
- .text:24BC2DED jmp loc_24BC3011
9 p& i: W1 T- \- H! t - .text:24BC2DF2 ; ---------------------------------------------------------------------------$ \- H: q( ^: P) B+ p
- .text:24BC2DF22 d( `' i5 n( B6 l! w
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j4 b- ?3 p: M! r3 i+ c' D
- .text:24BC2DF2 call esi ; FreeLibrary
% G. U0 m/ [8 C- }! w! s3 v - .text:24BC2DF4 push 6Ch ; Size& _- o" i# ]% s* h5 q. D
- .text:24BC2DF6 lea eax, [ebp+Dst]
& F# W+ F9 w: u% u j7 Z - .text:24BC2DFC push edi ; Val
+ p8 N- U# h: A" P% K- Y3 O/ t - .text:24BC2DFD push eax ; Dst
9 ]/ @' z( k' }9 w* K - .text:24BC2DFE call memset' W9 F3 {. F0 I1 f- P0 U
- .text:24BC2E03 mov eax, [ebp+var_8]8 _% ` {1 n7 O, N4 K7 c' X, `5 K: x
- .text:24BC2E06 add esp, 0Ch% G8 O4 q5 g: v) d0 @7 a+ o
- .text:24BC2E09 mov [ebp+Dst], 6Ch
2 s W! L' s) ~5 j6 z - .text:24BC2E13 mov [ebp+var_8C], 1
6 _( P$ O; _6 h N/ u, a4 I7 F - .text:24BC2E1D mov [ebp+var_28], 200h
* }0 O, L- `0 T1 d% E; @2 s - .text:24BC2E24 mov ecx, [eax]
V5 i; v! R/ S3 P. A0 X - .text:24BC2E26 push 8" A$ N3 @/ e# y: V2 v! P2 d
- .text:24BC2E28 push edi4 ], V- m) N2 X* u+ X
- .text:24BC2E29 push eax/ w; |' G* ^; }/ w
- .text:24BC2E2A call dword ptr [ecx+50h]
& v$ Q( g. N$ g7 `" c- G. s - .text:24BC2E2D test eax, eax# g7 t$ o0 L- m) {! v8 |7 D
- .text:24BC2E2F mov eax, [ebp+var_8]
1 \, r, Z! A2 P* u K2 r- v4 m - .text:24BC2E32 mov ecx, [eax]
/ @: U+ C; T: S" H3 K$ |1 C - .text:24BC2E34 jge short loc_24BC2E46
& [, \9 y! h) S, k) n - .text:24BC2E36 push eax
. e5 }* k7 J/ P2 P - .text:24BC2E37 call dword ptr [ecx+8] o7 G+ {7 X; L6 k4 M1 F* T, k
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule L% O/ [* ?2 F
- .text:24BC2E3D call esi ; FreeLibrary
% ~8 p/ s8 X& {/ f - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"/ d4 T0 }# a5 s# ?- b! h
- .text:24BC2E44 jmp short loc_24BC2E6D" L( r+ {& n0 `8 c/ I/ j" V
- .text:24BC2E46 ; ---------------------------------------------------------------------------: D) c" f- ^ s
- .text:24BC2E46
' T4 b; P8 L# t2 j" f - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
! ] l0 Q7 N) L. q - .text:24BC2E46 lea edx, [ebp+var_C]; X) f- E9 Q( {& b! S, M) T
- .text:24BC2E49 push edi
0 {8 B/ Q& Z* T& h9 _" V' M7 A1 d - .text:24BC2E4A push edx
4 e( L6 V! N( F8 u2 H% x - .text:24BC2E4B lea edx, [ebp+Dst]9 N4 @" [& U! z1 S
- .text:24BC2E51 push edx, y. @3 c N1 u, D# z
- .text:24BC2E52 push eax2 d( `3 C! ]7 v8 M% v
- .text:24BC2E53 call dword ptr [ecx+18h], o9 W+ O; p/ {) d4 {. _
- .text:24BC2E56 test eax, eax H; C1 j% ~4 y$ t. a4 G
- .text:24BC2E58 jge short loc_24BC2E7A9 }/ G* g: m# J* \/ q: f9 k
- .text:24BC2E5A mov eax, [ebp+var_8]# d5 g. s3 O: x9 H, I
- .text:24BC2E5D push eax
9 o* E2 \4 H/ J5 ]/ I - .text:24BC2E5E mov ecx, [eax]
* k) P7 ]3 b( w! i* Q" d& ^ - .text:24BC2E60 call dword ptr [ecx+8], ]- ?! i" D+ k1 B4 a
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule; D8 u( O7 t) F/ r# V8 F' U
- .text:24BC2E66 call esi ; FreeLibrary2 u: u; M. v" g& F3 n4 T8 L
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
4 C3 l$ E9 i6 K/ C - .text:24BC2E6D
* n( x, r9 n6 R# _5 @ - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
$ p' M3 f/ z' l0 H) V5 R. z - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
0 Q, l9 Z9 j9 ^* w4 D2 k; Z8 P - .text:24BC2E6D call ds:OutputDebugStringA
6 C. J$ g0 v& X - .text:24BC2E73 xor eax, eax
& j# Y3 G5 F9 q' u# X" `. ~ H" x% d - .text:24BC2E75 jmp loc_24BC3011
2 q7 Q+ R6 |- O" J - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
X, S$ ]6 m) n" r k
+ }" _* o# ]% S2 s" k( U
- n4 I" p! F5 {1 D9 n2 T F |