这游戏以前分析过,本贴再写得详细一些。9 b8 ?0 q) a( Y" X1 f
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,' J6 |9 X0 [: h/ o
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
' ^- R9 J* L8 X7 ]
" p) K, n$ k: W+ X. t0 q J参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
" ^6 z4 t, _2 M3 r: h4 B( U+ o- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;" W0 o; Y6 R3 R* Z
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;3 Q4 J# w2 \# H3 k# ?" B8 z# {# j5 v
- STDMETHOD_(ULONG,Release) (THIS) PURE; l. U/ F# e/ @( }
- STDMETHOD(Compact)(THIS) PURE;3 x: y+ _( v" I, F7 o! J6 Q, Z
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
, R( n( n' ~" y" h. G$ d+ \ - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;* p& f! w7 z$ x, u
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 5 p8 q _7 d" @+ j
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
6 G1 _/ ^- l0 t: l/ {) C% a4 X- {! }( m4 l5 y, t i6 s" t9 _& O, i
' c% x1 Z! N# K( v5 L& v. E) U% [* u5 D( n2 s
8 ] _& O& _/ `; n9 c+ }- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================; t; z: C; D" L a4 e
- .text:24BC2CD2
0 r9 @2 }$ D3 ~ - .text:24BC2CD2 ; Attributes: bp-based frame+ y$ h% a. Z4 i; J4 k
- .text:24BC2CD2' Z# o2 Q/ ^0 B: D. R; C+ T
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
7 V& F& M" F7 D @" v - .text:24BC2CD2# a, x( {( s* d7 I, |9 x
- .text:24BC2CD2 Dst = dword ptr -90h s, D5 ~; E0 e& }7 X2 R% ~% K1 d, Y
- .text:24BC2CD2 var_8C = dword ptr -8Ch
% C7 s) W6 R2 |. E% W - .text:24BC2CD2 var_28 = dword ptr -28h: N& Y" B1 V' e9 n* G
- .text:24BC2CD2 var_24 = dword ptr -24h
2 G3 B8 S2 a; h+ V( q - .text:24BC2CD2 var_20 = dword ptr -20h3 K7 {8 m# O! I7 G
- .text:24BC2CD2 var_1C = dword ptr -1Ch4 [+ u& y2 |; j9 ?# F
- .text:24BC2CD2 var_18 = dword ptr -18h
+ R6 u% W6 R6 w1 a6 E - .text:24BC2CD2 ppv = dword ptr -14h
* ? B, Q2 \& w - .text:24BC2CD2 var_10 = dword ptr -10h7 F* `: S- G7 f8 X
- .text:24BC2CD2 var_C = dword ptr -0Ch
5 y$ D7 R: x, e - .text:24BC2CD2 var_8 = dword ptr -8
$ X+ ?8 t$ z+ J' K - .text:24BC2CD2 hLibModule = dword ptr -4 P% Y1 i7 E. K$ I) C4 ]
- .text:24BC2CD2
3 `5 z* _/ W2 X - .text:24BC2CD2 push ebp
& o/ M& D( w, }( Q - .text:24BC2CD3 mov ebp, esp
2 l- K) L1 ?0 Y8 H$ e. r9 R' ?5 H - .text:24BC2CD5 sub esp, 90h
4 D$ I& C! A% e b2 Q: V+ [. x - .text:24BC2CDB push ebx
0 \0 ~6 X ^( M: G; U! ^& o7 C - .text:24BC2CDC mov ebx, ds:LoadLibraryA# F1 p' Q6 a8 N8 K1 `1 G: R+ l
- .text:24BC2CE2 push esi
# G5 G" r* \! L9 }' c+ s7 S: A - .text:24BC2CE3 push edi
, z3 Y/ r; n4 E' Q - .text:24BC2CE4 xor edi, edi
- S- `5 w) f/ X6 y2 F6 ] - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
5 e0 X* |4 a4 z) W" K3 D* h - .text:24BC2CEB mov [ebp+var_8], edi
$ p2 Q* f4 X4 r2 E3 ?* G P - .text:24BC2CEE mov [ebp+var_1C], edi+ W! t- g- W4 [- |
- .text:24BC2CF1 mov [ebp+var_C], edi
. @. U" d$ a+ `% s4 Y% e& G' [: k7 v - .text:24BC2CF4 mov [ebp+var_10], edi
3 f. R, F+ `' s: _: {: f3 g - .text:24BC2CF7 mov [ebp+var_18], edi6 w. J/ D7 Y f7 Q# q, T
- .text:24BC2CFA call ebx ; LoadLibraryA" L& a) n9 Y7 C0 [
- .text:24BC2CFC mov esi, eax: O9 s7 H* \& |0 |7 w
- .text:24BC2CFE cmp esi, edi
- t( h) _6 ]& M - .text:24BC2D00 mov [ebp+hLibModule], esi: O6 P% S% j. Y# v
- .text:24BC2D03 jnz short loc_24BC2D0F: Q# A* I2 O G2 ~: I
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"8 S' D3 t! e' y5 H$ i
- .text:24BC2D0A jmp loc_24BC2E6D
" i% |& K: Z3 u$ o3 f0 q - .text:24BC2D0F ; ---------------------------------------------------------------------------' i4 X. j* w0 X4 t7 y9 H) { M2 z
- .text:24BC2D0F
1 m" {) m* p! |2 u" q - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j( c. d) ?; D: u6 t3 i: `; J. b
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
, d& ~( r) d: R- U) ]8 i; h - .text:24BC2D14 push esi ; hModule6 D% N6 l/ e4 Y
- .text:24BC2D15 call ds:GetProcAddress& ?" E5 ?% O2 {1 z# C) X# M; A2 W
- .text:24BC2D1B cmp eax, edi" S! b: f3 O! P- b' Q2 A
- .text:24BC2D1D jnz short loc_24BC2D30
& _9 S6 }/ A8 Q: n - .text:24BC2D1F push esi ; hLibModule
2 Y6 X0 f/ J" _. q: L - .text:24BC2D20 call ds:FreeLibrary! @ K( x0 p3 g2 ~* T3 w6 ~( X& I
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
3 O* c/ P2 T8 I8 ~: b - .text:24BC2D2B jmp loc_24BC2E6D
: E" A- z: f, D& i: y5 _0 _! [ - .text:24BC2D30 ; ---------------------------------------------------------------------------# u* K0 O7 r( g
- .text:24BC2D30( d; N, H0 Z+ r3 B. p4 o
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
5 a7 }5 ]* r9 b: O - .text:24BC2D30 lea ecx, [ebp+var_8]
# Z+ n m* s, U: t% [7 W - .text:24BC2D33 push edi
# r, J! w; h# w- h8 ?' _: [ - .text:24BC2D34 push ecx5 \5 A: d# `) F! g/ z
- .text:24BC2D35 push edi" V7 k H4 Y5 L& I
- .text:24BC2D36 call eax$ G* _4 U# M5 \ ?" Q# h; u
- .text:24BC2D38 test eax, eax. ?: c$ _' p" F2 T
- .text:24BC2D3A jge short loc_24BC2D4D4 y1 }6 W0 E& C; k% v. M) l
- .text:24BC2D3C push esi ; hLibModule6 V8 W; R. r/ Q1 A
- .text:24BC2D3D call ds:FreeLibrary
+ ]4 i6 h U! ~7 X/ m# c - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"( t# ^5 H8 V- L4 ~- K3 E) A
- .text:24BC2D48 jmp loc_24BC2E6D
8 g) \" X/ B: t) a; d - .text:24BC2D4D ; ---------------------------------------------------------------------------" U3 n, P7 P2 W1 v3 s* y5 h" o
- .text:24BC2D4D
' U! `, P, l) n1 ~ - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j, N5 L( z; ?& W% ~4 [% m
- .text:24BC2D4D mov eax, [ebp+var_8]- C1 x5 X) | }" R, V8 |0 G w
- .text:24BC2D50 lea edx, [ebp+var_1C]$ s& ?& d0 V; B0 c1 R+ @4 }
- .text:24BC2D53 push edx
( L( ?4 n" q/ M, u# D - .text:24BC2D54 push offset unk_24BC4470
" |3 `6 l1 g q& l, G - .text:24BC2D59 mov ecx, [eax]' W4 @: G5 w# W! j
- .text:24BC2D5B push eax
) j/ _5 u; K, A - .text:24BC2D5C call dword ptr [ecx]
c8 }, R* H; ~' p' K2 J& O. v - .text:24BC2D5E test eax, eax
( H4 F7 x" E9 d3 B' g n - .text:24BC2D60 jge short loc_24BC2D87 a* c1 F0 M# A/ o5 Q
- .text:24BC2D62 mov eax, [ebp+var_8]
$ C3 N6 m; ~2 t { - .text:24BC2D65 push eax
$ @; B- B: \ a: Y* L - .text:24BC2D66 mov ecx, [eax]. i, F1 t1 o) K
- .text:24BC2D68 call dword ptr [ecx+8]) O! n) }0 U$ h5 D
- .text:24BC2D6B push esi ; hLibModule
% b: z, |' ~) g8 v; F5 ]/ N - .text:24BC2D6C call ds:FreeLibrary3 {, G8 q' j& R1 T; v
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
4 W: X0 r0 L# x. i1 F( } - .text:24BC2D77 call ds:OutputDebugStringA% ~4 r5 S- B! a) h$ m
- .text:24BC2D7D mov eax, 100h: }0 V/ S$ B9 i H
- .text:24BC2D82 jmp loc_24BC30110 e! x* ]( }' S, ?1 _
- .text:24BC2D87 ; ---------------------------------------------------------------------------
$ P# V2 r3 }) q - .text:24BC2D87
/ F3 \1 F* q% S' U - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j/ W: e5 w3 }( k. v* t
- .text:24BC2D87 mov eax, [ebp+var_1C]% l4 }' Y# k7 ^8 |9 L$ I
- .text:24BC2D8A push eax/ N) ~: [; a! n/ `' x& @7 A0 X
- .text:24BC2D8B mov ecx, [eax]' _, g# k- l4 ~# p8 ^
- .text:24BC2D8D call dword ptr [ecx+8]
# N9 b" M& R" y6 u% b) J - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"0 Q1 R0 B# N- p( g" {
- .text:24BC2D95 call ebx ; LoadLibraryA
% P6 r% h& w3 j! h - .text:24BC2D97 mov esi, eax
% L# ^3 G, F9 q* h; x - .text:24BC2D99 cmp esi, edi! K& P; x" a! O( m
- .text:24BC2D9B jnz short loc_24BC2DB6
1 @4 V3 @' T3 j3 F8 ~( J7 e - .text:24BC2D9D mov eax, [ebp+var_8]
1 P1 S l g& t8 }7 n& t' |7 P - .text:24BC2DA0 push eax
+ n5 y4 Y h( {0 `* x - .text:24BC2DA1 mov ecx, [eax]6 q: _2 z1 e( [2 t
- .text:24BC2DA3 call dword ptr [ecx+8]6 ?% D" O/ E7 e- Q: e
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule; ~- z9 t- U* ^
- .text:24BC2DA9 call ds:FreeLibrary
2 Q" W% x6 @: ?% [2 o4 f - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
' \; T1 A9 g; o% L - .text:24BC2DB4 jmp short loc_24BC2DE2
0 R+ d% { u& O' V: d( |9 Q- \, x - .text:24BC2DB6 ; ---------------------------------------------------------------------------
$ I; j# L& e* D2 S6 t - .text:24BC2DB6
O4 u1 _6 _5 ^) P) b; ? - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
$ E1 ?5 y9 T/ ?% N. G3 q& k8 l - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"; k8 ~2 |3 k8 Z% c; d
- .text:24BC2DBB push esi ; hModule' p }7 ] y* h
- .text:24BC2DBC call ds:GetProcAddress' F. i" a- h% K! L& [$ O
- .text:24BC2DC2 push esi ; hLibModule0 |/ U: ] s) k
- .text:24BC2DC3 mov esi, ds:FreeLibrary
4 p' X% q. e7 s' u7 u; w6 G, E: X - .text:24BC2DC9 test eax, eax' F# z2 @2 M' R8 n. I' P4 U
- .text:24BC2DCB jnz short loc_24BC2DF22 `3 v5 N* p7 [9 V2 h
- .text:24BC2DCD call esi ; FreeLibrary
2 R8 ]0 l+ J2 T0 E5 j - .text:24BC2DCF mov eax, [ebp+var_8], P# I; p& M/ A( \
- .text:24BC2DD2 push eax6 n2 X( Z* E) J Q
- .text:24BC2DD3 mov ecx, [eax]& F% E4 S. Z, l
- .text:24BC2DD5 call dword ptr [ecx+8]
; j( ?8 m! i9 C' m! f6 K3 @ - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule* P. K) i+ V* Z, |5 p/ j$ V
- .text:24BC2DDB call esi ; FreeLibrary
. z: M0 E2 W7 J }: [% r& d" j1 D, o - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...5 l* z( P2 n Y K" `( W
- .text:24BC2DE2) e+ L, q4 T: _2 v5 P; X
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j/ ?6 h8 Y! s, i3 k8 N7 K$ n* V
- .text:24BC2DE2 call ds:OutputDebugStringA
$ J7 ~0 k7 X2 ]. h ]0 @; p2 x0 c - .text:24BC2DE8 mov eax, 200h
7 ^$ i8 L! U- k* v' u4 @) w; f" ~0 V - .text:24BC2DED jmp loc_24BC3011% L% ]! m' B! w" N1 Y! w7 E
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
$ C+ Y& U; D3 t- v0 _& v1 V - .text:24BC2DF2
) d) w8 D# @! i6 A - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
% Z9 s0 @+ y7 r; w) g, f0 X5 }( A+ Q - .text:24BC2DF2 call esi ; FreeLibrary
* e2 ^# `" f! H6 b - .text:24BC2DF4 push 6Ch ; Size
. W& A% d. V# b% Z - .text:24BC2DF6 lea eax, [ebp+Dst]
1 B8 g/ r: F/ e5 P0 w4 L. M - .text:24BC2DFC push edi ; Val
8 s7 L8 l# o3 F; D - .text:24BC2DFD push eax ; Dst; ?1 k) e: d, G! m' r$ e- E3 D7 |
- .text:24BC2DFE call memset
3 W2 l9 g- [* T# T - .text:24BC2E03 mov eax, [ebp+var_8]
4 h' E9 y5 }/ l! s) W0 J2 Q+ Y+ l - .text:24BC2E06 add esp, 0Ch" P4 h+ q+ ]; r
- .text:24BC2E09 mov [ebp+Dst], 6Ch' _$ [1 p% O' _
- .text:24BC2E13 mov [ebp+var_8C], 1/ ]! g# t) V' ?. q- b) b
- .text:24BC2E1D mov [ebp+var_28], 200h9 K, Y( ]6 w) z
- .text:24BC2E24 mov ecx, [eax]5 V$ {$ q+ ?' m$ `. N; Y
- .text:24BC2E26 push 8
. ?5 `" z( }: O% B* D% q2 ] - .text:24BC2E28 push edi& V. b' z l( p7 x7 G( z
- .text:24BC2E29 push eax( p6 X- f' `/ `9 m
- .text:24BC2E2A call dword ptr [ecx+50h]
% D; h1 P' ]3 `* C) ^! V - .text:24BC2E2D test eax, eax
9 g+ U, Y8 o2 N - .text:24BC2E2F mov eax, [ebp+var_8]( p$ H5 ]( l5 ^5 N# K- [$ H
- .text:24BC2E32 mov ecx, [eax]7 E5 O; p/ T/ \
- .text:24BC2E34 jge short loc_24BC2E46/ w+ F/ H5 w6 Q( e; o' H4 g
- .text:24BC2E36 push eax
5 Q7 q0 n" ^. }& q3 u2 n" c- J - .text:24BC2E37 call dword ptr [ecx+8]5 l' V7 W- j. s/ c5 q
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
; Z1 ?- Q" E2 |' w8 g3 V& Q& a% `% Z- ? - .text:24BC2E3D call esi ; FreeLibrary4 l+ F% f. S |/ X
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"9 C3 v6 @# ^5 u( `
- .text:24BC2E44 jmp short loc_24BC2E6D
7 w8 w7 ?! k( F5 c - .text:24BC2E46 ; ---------------------------------------------------------------------------
: H9 i8 e* c) p6 Q; i( x - .text:24BC2E46) g2 Q* A K* n \6 T
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
5 Q7 S" v8 B# i7 p8 K; h8 K - .text:24BC2E46 lea edx, [ebp+var_C]
# B7 ?+ L. S: H5 p+ n L - .text:24BC2E49 push edi* n' h$ m$ W8 r$ u! d
- .text:24BC2E4A push edx
8 Q( H- i; z7 d$ [7 _0 r! P - .text:24BC2E4B lea edx, [ebp+Dst]' {6 w& i s% o/ Y6 u$ a
- .text:24BC2E51 push edx
& z6 N+ v& o9 i6 g( Q' \% |( M - .text:24BC2E52 push eax
1 n0 r; i( f( @: S S* w" J+ k3 F+ `) } - .text:24BC2E53 call dword ptr [ecx+18h]
+ r( N& e/ {8 ~3 c* Z4 H - .text:24BC2E56 test eax, eax
0 |) k# }; P1 O8 b2 }. E - .text:24BC2E58 jge short loc_24BC2E7A! b% E) Z" s7 [; y- Y
- .text:24BC2E5A mov eax, [ebp+var_8]
+ j& h- M* N+ a# z" X - .text:24BC2E5D push eax" v" L$ ^7 l% F
- .text:24BC2E5E mov ecx, [eax]7 @1 Z/ a& |! }& M$ a
- .text:24BC2E60 call dword ptr [ecx+8]
, | O. o, k& K8 A! q# z4 \ - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
6 X4 C/ ]2 f# ^$ a9 B% h. p. ] - .text:24BC2E66 call esi ; FreeLibrary
3 J) v& n% `/ T7 R3 O- p - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"/ [: C) |7 B. M y- ~9 L$ p
- .text:24BC2E6D& { C1 w$ G2 }/ Z% w; N
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j: _6 N. C' v2 U& ^
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
* @, R4 H* @4 g' G' ^9 H6 ` - .text:24BC2E6D call ds:OutputDebugStringA
) k) o* K/ c0 j) E' R8 `: s: i - .text:24BC2E73 xor eax, eax
8 D' B* `! Z# T, B* K- Q/ i - .text:24BC2E75 jmp loc_24BC30118 u$ U/ B5 Z! e& |; G
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
6 p) S B P" X% J. i' `
# w: P$ c+ P& e( _: Y- g# _! W0 A9 g% H; P
|