这游戏以前分析过,本贴再写得详细一些。
F' p7 p8 X5 ?( `这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
& @5 m" r% r2 _# x2 Q注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。) y y' r$ O2 {
5 m* X0 L! j# b* E
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.+ ?. h# Y2 R- j
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;+ I/ D' S3 p% Y+ c7 L* s5 z
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
! } w1 y/ U" O* H+ G - STDMETHOD_(ULONG,Release) (THIS) PURE; q x. p: H9 i7 s( G* m3 p* o: z
- STDMETHOD(Compact)(THIS) PURE;
3 V: P% [, s4 `: u' _; ^8 ~ - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;/ q9 Y2 G/ R6 t! O
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;* ?! v5 w& W9 o4 s
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 ( [( D k9 O& I- H- f+ ^+ [+ q) H
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 ( S8 M) E; j! \" l8 f
' Y( S# }* l" T" o3 k
3 n/ |& |$ x* \. L: Q
( W8 |# H) @2 v4 B$ S- 4 q0 `9 C$ |" K1 P& M3 U: y
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================0 W, _8 p: P w' Z+ G5 h5 ]
- .text:24BC2CD2
: p& b1 z9 _ |3 O1 k& K - .text:24BC2CD2 ; Attributes: bp-based frame0 [5 [' o6 L w& ?# ]/ e0 r8 u8 v
- .text:24BC2CD2
8 @: Q. N3 g3 \( ^1 H2 V( z - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
* q f: d6 m% T& ]6 R - .text:24BC2CD2# {) h3 ^. x" r7 O/ ]3 L( x
- .text:24BC2CD2 Dst = dword ptr -90h& C Z2 u+ s' U/ r
- .text:24BC2CD2 var_8C = dword ptr -8Ch& z9 @( \. M' K; g
- .text:24BC2CD2 var_28 = dword ptr -28h; o8 f5 l* G& l) R$ T
- .text:24BC2CD2 var_24 = dword ptr -24h0 U( s6 ~( ^* s2 P, c
- .text:24BC2CD2 var_20 = dword ptr -20h1 G# k: P! D4 T. d& i5 a. Q
- .text:24BC2CD2 var_1C = dword ptr -1Ch# t+ U- G9 g# Y4 @
- .text:24BC2CD2 var_18 = dword ptr -18h0 V- Y) b$ R8 U
- .text:24BC2CD2 ppv = dword ptr -14h
; J1 z" k3 I1 a6 Z - .text:24BC2CD2 var_10 = dword ptr -10h9 {) b6 k1 u7 A
- .text:24BC2CD2 var_C = dword ptr -0Ch
4 f7 Z @- S% E5 ?8 i, Q - .text:24BC2CD2 var_8 = dword ptr -8. q' j" J: H) M! h! l
- .text:24BC2CD2 hLibModule = dword ptr -4
# }7 s1 B! `4 _- s9 Z# j - .text:24BC2CD2/ r0 A- J8 m4 \- e1 a* }; H* K
- .text:24BC2CD2 push ebp6 [* w! B0 |+ @+ w1 T* Y
- .text:24BC2CD3 mov ebp, esp
( T4 O, N$ p7 j8 x% J/ B% X - .text:24BC2CD5 sub esp, 90h
. d9 ]* G4 v4 ~7 L/ {& F( A - .text:24BC2CDB push ebx( x6 @' u) o) b$ S- c
- .text:24BC2CDC mov ebx, ds:LoadLibraryA" [1 M1 q# _, O* c" d$ H
- .text:24BC2CE2 push esi
5 f+ W2 `+ n; e" Y o) ^1 L' |% p0 F4 b - .text:24BC2CE3 push edi% U8 n* `% v1 R- }, S1 o
- .text:24BC2CE4 xor edi, edi$ E# z. s% I* l+ F
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
% C; j2 v9 c% c. ~2 }4 x; h - .text:24BC2CEB mov [ebp+var_8], edi1 G$ n9 `6 V0 |0 i2 M! `
- .text:24BC2CEE mov [ebp+var_1C], edi. m4 \/ Q3 g+ l, R
- .text:24BC2CF1 mov [ebp+var_C], edi; [$ s" ]. M* C4 a$ b) |( p
- .text:24BC2CF4 mov [ebp+var_10], edi
* d& C3 t& {3 q$ h7 @' R$ m - .text:24BC2CF7 mov [ebp+var_18], edi/ o7 `- ], g2 L" n0 S4 l
- .text:24BC2CFA call ebx ; LoadLibraryA
; I. O& v0 x4 a6 T8 B( s - .text:24BC2CFC mov esi, eax
, i. Q+ t# M+ D2 C - .text:24BC2CFE cmp esi, edi
! {* x) H- _0 e. w1 @7 D# @) k! { - .text:24BC2D00 mov [ebp+hLibModule], esi0 ^' P) }: ]9 m# [) ^
- .text:24BC2D03 jnz short loc_24BC2D0F
" K: E" v: E8 M S7 i$ N# Z# R - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n", t1 u o/ v& a; F
- .text:24BC2D0A jmp loc_24BC2E6D
5 r: y! {* S* `& C/ x9 G - .text:24BC2D0F ; ---------------------------------------------------------------------------
: O! V+ O) `; Z2 N5 c1 d# Z - .text:24BC2D0F: W5 n' I; {# w. Q, {( W$ G
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
) G& C$ l8 P, a/ r u8 q - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"8 h; S" A o+ h8 t
- .text:24BC2D14 push esi ; hModule% x$ e! f" U$ B' h7 H, \
- .text:24BC2D15 call ds:GetProcAddress
9 ~0 o7 ^1 e3 Y - .text:24BC2D1B cmp eax, edi! _5 N% d3 f& x& C
- .text:24BC2D1D jnz short loc_24BC2D30" l# H+ j U8 H4 O/ R! M! N
- .text:24BC2D1F push esi ; hLibModule% e* R2 ]* ~4 u) X
- .text:24BC2D20 call ds:FreeLibrary4 j) {& v+ E( S3 S
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
0 g- R7 f$ J S7 C+ z; r - .text:24BC2D2B jmp loc_24BC2E6D) Z" j$ {) `% x( b0 ]! s' F
- .text:24BC2D30 ; ---------------------------------------------------------------------------2 t8 l9 g3 `7 Q) \: O! m
- .text:24BC2D30
, ]2 L5 @7 Z* H* u" i$ b - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j0 q0 g& n4 ^! w; P2 I
- .text:24BC2D30 lea ecx, [ebp+var_8]1 e2 A% h0 L* E o. F) l+ [. A
- .text:24BC2D33 push edi
* [" J1 r! [0 H. p - .text:24BC2D34 push ecx# ~* m# q6 } T" U' p% ?2 [
- .text:24BC2D35 push edi
q0 y+ M8 T5 U# X$ B. {2 x - .text:24BC2D36 call eax, v0 V' d9 _. M" f
- .text:24BC2D38 test eax, eax
6 x# C' O! Q2 s - .text:24BC2D3A jge short loc_24BC2D4D
" n7 H" o1 y L' f* M# R. K - .text:24BC2D3C push esi ; hLibModule
) S1 n" D- [! ]6 A3 f - .text:24BC2D3D call ds:FreeLibrary
" x5 V, ?2 }6 m- v5 Z a - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
# d' i U: r" R - .text:24BC2D48 jmp loc_24BC2E6D! @! {: b& E1 g" U8 N h4 f
- .text:24BC2D4D ; ---------------------------------------------------------------------------
* }- s" D# K# `" V7 {8 D+ K - .text:24BC2D4D; \+ B/ ? i7 V P& G2 V7 d0 ~
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
7 F" [8 o/ v. j6 b! ^ - .text:24BC2D4D mov eax, [ebp+var_8]1 M! Z* v+ h: q, i+ U% Z1 y0 U
- .text:24BC2D50 lea edx, [ebp+var_1C]4 d& R1 |( U1 t ]% s+ H
- .text:24BC2D53 push edx
. A& c! t9 u) w+ R - .text:24BC2D54 push offset unk_24BC44709 r5 |7 j* V% F% Z! Z3 N. P
- .text:24BC2D59 mov ecx, [eax]% C$ S+ v# O0 u* l c
- .text:24BC2D5B push eax! x5 p0 i$ S" j
- .text:24BC2D5C call dword ptr [ecx]
3 a5 N# x' F+ ^) J - .text:24BC2D5E test eax, eax+ ^9 O( [# ^( u
- .text:24BC2D60 jge short loc_24BC2D87
! v+ J. P4 y; m4 Q/ A6 j - .text:24BC2D62 mov eax, [ebp+var_8]
. T- A4 g3 \ I/ U# G2 { - .text:24BC2D65 push eax
% X) x7 A7 [. C# Q - .text:24BC2D66 mov ecx, [eax]- {3 l4 p9 R, ^9 I
- .text:24BC2D68 call dword ptr [ecx+8]
/ m( F: `+ A' c9 J* b - .text:24BC2D6B push esi ; hLibModule
) I4 {5 v, R" R; k" C - .text:24BC2D6C call ds:FreeLibrary! P$ _" J3 |4 l6 m+ S9 I
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
3 N) D9 o- v8 ], K# F# s/ Y- @ - .text:24BC2D77 call ds:OutputDebugStringA
6 K/ ^$ ^7 E0 L" e! Y3 M0 \0 H - .text:24BC2D7D mov eax, 100h
1 [4 S; a/ x3 d8 J$ g2 W' b# y( ~0 F1 u - .text:24BC2D82 jmp loc_24BC3011
& d9 _1 a9 D: X Z& l" v) O - .text:24BC2D87 ; ---------------------------------------------------------------------------
* L9 v/ R2 Y, H# v1 ` - .text:24BC2D87
4 N/ Y5 v7 N4 o( ?- ]& A1 j - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j$ I. |7 a+ O `* d, F
- .text:24BC2D87 mov eax, [ebp+var_1C]
i) }' u& d' ` ~ - .text:24BC2D8A push eax+ r4 h M' U0 B8 y1 u6 f0 D# B
- .text:24BC2D8B mov ecx, [eax]
" [: R9 e6 I' w; v - .text:24BC2D8D call dword ptr [ecx+8]
4 H# i5 x+ O8 @/ `( |6 e5 G' L - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
' ]' ?( Q0 ]8 o. j: o$ }7 ] - .text:24BC2D95 call ebx ; LoadLibraryA
' L. c% X2 m4 c$ s - .text:24BC2D97 mov esi, eax h. J% S% d% l+ D2 i0 M
- .text:24BC2D99 cmp esi, edi9 c) r* b7 q' V4 X- n- ]
- .text:24BC2D9B jnz short loc_24BC2DB6* G6 ]3 U. J& H+ M. P: G8 V
- .text:24BC2D9D mov eax, [ebp+var_8]! i3 l. m8 X6 b; D( O% D4 k
- .text:24BC2DA0 push eax
7 `2 ~1 a' b# T( u% J1 E - .text:24BC2DA1 mov ecx, [eax]
' n1 ?9 z* S( R3 { - .text:24BC2DA3 call dword ptr [ecx+8]
! D* D6 }9 k2 B! Y0 ^& o+ n1 F: @ - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
; l0 ~ C$ d7 C/ y - .text:24BC2DA9 call ds:FreeLibrary
; f3 q7 u. [5 M: c - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
& [) m+ p9 Y6 u' `- n* C - .text:24BC2DB4 jmp short loc_24BC2DE2
+ F e' R2 P7 N - .text:24BC2DB6 ; ---------------------------------------------------------------------------
( m2 K8 V6 e2 q4 f/ h% J - .text:24BC2DB64 {7 S2 N4 z+ O$ T
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j3 B! S0 e. j* j) d/ [3 M
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
6 R' n9 X: n: Z& Z; x - .text:24BC2DBB push esi ; hModule6 w3 A) R2 q3 z0 @+ Z# O6 ]
- .text:24BC2DBC call ds:GetProcAddress
4 _& a% a" n& T8 D - .text:24BC2DC2 push esi ; hLibModule
# k0 H/ N, v+ X+ T) w+ y - .text:24BC2DC3 mov esi, ds:FreeLibrary5 X( d2 \" T- O+ Z: S3 t
- .text:24BC2DC9 test eax, eax2 [3 E# _% B" n) j
- .text:24BC2DCB jnz short loc_24BC2DF2
% k" a* t. \: q2 q; h - .text:24BC2DCD call esi ; FreeLibrary
! K+ f2 t2 v$ m - .text:24BC2DCF mov eax, [ebp+var_8]; W9 n6 Y7 } y* O) Z# N# \1 J
- .text:24BC2DD2 push eax
1 y7 v$ v7 i, s - .text:24BC2DD3 mov ecx, [eax]
8 @$ r5 {# c; r5 z - .text:24BC2DD5 call dword ptr [ecx+8]
2 F. w: O/ H9 e. L/ _ - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule, Z# I, |6 ^7 q: A( S1 L
- .text:24BC2DDB call esi ; FreeLibrary2 C4 T9 x; h( I
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
) y. o! ~' c" I d% j5 x - .text:24BC2DE2. K' ?3 ?6 c& N$ p$ G
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
, P7 l2 t) j, C! F - .text:24BC2DE2 call ds:OutputDebugStringA! a3 d, N9 v L( @2 f9 p
- .text:24BC2DE8 mov eax, 200h
s8 k J! U$ v7 U - .text:24BC2DED jmp loc_24BC3011& j% r" G) X# v2 S: f% @& {
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
- S8 b0 ?" f/ S, `& p - .text:24BC2DF2
) S5 ^6 f. Q4 m* E$ i; s& W - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j4 J9 d& q* ~- \6 n2 ?
- .text:24BC2DF2 call esi ; FreeLibrary$ {) }2 Y( F" e
- .text:24BC2DF4 push 6Ch ; Size
: U% A' q- ]# w7 M& Y0 o% X - .text:24BC2DF6 lea eax, [ebp+Dst]0 p# M+ A! a1 I7 r0 U+ ]
- .text:24BC2DFC push edi ; Val
\) m) m* X- e9 v$ J; |- E# ]& [ - .text:24BC2DFD push eax ; Dst) d5 c1 O; v+ O
- .text:24BC2DFE call memset
' x+ Q% O' F) I% V - .text:24BC2E03 mov eax, [ebp+var_8], l- `7 F/ D7 z. K
- .text:24BC2E06 add esp, 0Ch
3 b- u: m6 {+ N2 k/ Q) m' c1 x1 N - .text:24BC2E09 mov [ebp+Dst], 6Ch/ M4 C5 g P' i
- .text:24BC2E13 mov [ebp+var_8C], 1
, P: t; u6 N8 D& I - .text:24BC2E1D mov [ebp+var_28], 200h
k0 B' x+ o3 p( I ? - .text:24BC2E24 mov ecx, [eax]
# {/ _, X* P0 L! `: \ - .text:24BC2E26 push 8
& m; n0 r5 V5 f& B) t% h' v# a - .text:24BC2E28 push edi
& e! t6 A; J! K q" u: _& D% V - .text:24BC2E29 push eax) L ]+ Q! o4 w8 p
- .text:24BC2E2A call dword ptr [ecx+50h]
9 h- r- F( q4 y) C6 } - .text:24BC2E2D test eax, eax& \$ s+ V6 b3 }
- .text:24BC2E2F mov eax, [ebp+var_8]3 e! [& [" ?3 N8 T, p
- .text:24BC2E32 mov ecx, [eax]
+ |1 @7 }6 }. @! f - .text:24BC2E34 jge short loc_24BC2E46
8 `2 B$ ~8 r9 W9 U" l - .text:24BC2E36 push eax* \- ? o& S$ F7 I0 V
- .text:24BC2E37 call dword ptr [ecx+8]
4 s7 a5 K& h7 L% ^6 G( u - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
& {9 Q) w' b! @+ |" { - .text:24BC2E3D call esi ; FreeLibrary# Q& ^) O4 }4 B) N' P. n @' ?! I& l
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"% @: [2 x* F! \
- .text:24BC2E44 jmp short loc_24BC2E6D4 I: H$ D2 \+ |6 j' a& y2 h8 n
- .text:24BC2E46 ; ---------------------------------------------------------------------------' ~2 D% _1 g. X
- .text:24BC2E46
0 E5 A0 g8 H3 j" W4 @* S; } - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j+ N' X/ {& G& D% Z/ p
- .text:24BC2E46 lea edx, [ebp+var_C]
- \: T6 f0 s5 e& t. |5 j& ?, W - .text:24BC2E49 push edi
8 m* [6 ^8 P0 r; C5 H* I6 J& z - .text:24BC2E4A push edx8 Y4 J. C! e/ b- {. F7 v+ J0 b, Q
- .text:24BC2E4B lea edx, [ebp+Dst]5 r8 B+ \3 x5 q, G; y3 u
- .text:24BC2E51 push edx5 X9 T& W0 u( H9 A% P7 s0 l9 h* N
- .text:24BC2E52 push eax
d/ ^6 u7 \) y- e0 ]. j - .text:24BC2E53 call dword ptr [ecx+18h]
3 V! T) t+ M: ]. A0 g% K5 O - .text:24BC2E56 test eax, eax/ N3 t! k# H, z f
- .text:24BC2E58 jge short loc_24BC2E7A) V# C8 ~' `& u3 d
- .text:24BC2E5A mov eax, [ebp+var_8]
2 q( `" \ v2 U. p4 \+ C8 j2 u - .text:24BC2E5D push eax5 Q: z. o" A& R* i8 d( ~8 d
- .text:24BC2E5E mov ecx, [eax]$ |+ g! V& ?2 L1 ~5 D
- .text:24BC2E60 call dword ptr [ecx+8]
: z" i' M4 S: E) U1 U. a/ Z" s - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
8 ^, X9 v2 y/ P& ?# [8 b8 @ - .text:24BC2E66 call esi ; FreeLibrary
# g1 n- j+ F, f, M. [% {7 ~ - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
0 {4 h f, [8 n - .text:24BC2E6D
4 M7 W" X- a3 t$ V4 O - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j0 `* @% q( [% K+ n9 n* p
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
3 x- T+ B$ K R3 _, X; [ - .text:24BC2E6D call ds:OutputDebugStringA
) }& Q }; R/ U9 K - .text:24BC2E73 xor eax, eax
7 @( u& l6 m5 C! r2 d - .text:24BC2E75 jmp loc_24BC30116 F3 t3 p# N9 e3 a; j& p9 F
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 5 A$ v% e. _$ _4 O( i. y
+ j' ]% h1 a9 G/ a+ t' M+ {0 l) Q& a/ b- g6 T$ W- c- C5 @
|