这游戏以前分析过,本贴再写得详细一些。
: {& I% n; G8 s6 w: t' n( E这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
9 P1 Q4 D* x9 h% C# \) L; t2 B注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
% W/ M. ]3 p4 X9 y) x8 _
, A' S' \4 s- E1 ?参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.6 O0 q4 l* A7 k' R1 j, I/ u
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;+ _) E( P: y! ~/ E$ A# F1 p
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
% \. w x4 q; i* B# I6 h1 N - STDMETHOD_(ULONG,Release) (THIS) PURE;: _9 A: g5 g6 Y* i( v6 L' C0 v/ U
- STDMETHOD(Compact)(THIS) PURE;
+ Y: g1 Z! }, c9 D# ^* B8 O4 q - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
: Q, w2 i7 D8 @ _6 ]7 Z, I- g4 t - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;8 V' \4 P0 m' J, {* [
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
/ i4 p( M x8 S( N8 Z以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 + q! K/ |$ M! B* I. R+ f
0 F1 P& b& J& q
5 P6 z- K$ e/ e& p9 E5 k6 z
' X+ y P3 y2 {5 e! e* b) j
- i: o7 \- p- G; Q! D: y( M- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
$ @) U3 I' o3 v& j - .text:24BC2CD2+ Z7 r( o% [! \/ }! K& Q
- .text:24BC2CD2 ; Attributes: bp-based frame
0 D8 B& H. p# I6 {- { - .text:24BC2CD2, V) h7 C. n: W6 V8 b3 a
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
5 Z4 F B* Y. C. o - .text:24BC2CD2* C4 k$ ~- R u B& P, ]
- .text:24BC2CD2 Dst = dword ptr -90h
R0 C2 K! o) F6 [9 r0 W - .text:24BC2CD2 var_8C = dword ptr -8Ch
7 N% S! O" C6 ]& {% h& q9 S. ]% w - .text:24BC2CD2 var_28 = dword ptr -28h+ [: N. {6 i) [9 q, m
- .text:24BC2CD2 var_24 = dword ptr -24h5 g. s2 f3 S1 {# ^7 S; S: w
- .text:24BC2CD2 var_20 = dword ptr -20h6 x5 V% h7 f _7 ~
- .text:24BC2CD2 var_1C = dword ptr -1Ch- `3 _9 o0 c! `% W# G4 Q* w
- .text:24BC2CD2 var_18 = dword ptr -18h
1 Y/ @9 D2 p' a - .text:24BC2CD2 ppv = dword ptr -14h
5 j/ j( K; b, X U9 U: T - .text:24BC2CD2 var_10 = dword ptr -10h# \# t5 i1 n1 g
- .text:24BC2CD2 var_C = dword ptr -0Ch
/ q% F3 W% d" w0 f - .text:24BC2CD2 var_8 = dword ptr -8; K/ W$ ?) j5 J% n& b \1 B
- .text:24BC2CD2 hLibModule = dword ptr -42 q3 O% z0 v9 F4 i3 Q2 J
- .text:24BC2CD2( a1 [2 u; Y/ `* r) u) U( f
- .text:24BC2CD2 push ebp4 E, j3 m0 Y S9 }6 Z3 y$ v
- .text:24BC2CD3 mov ebp, esp
9 j6 w& I$ J6 ?+ w2 k - .text:24BC2CD5 sub esp, 90h
% r3 p$ r2 P! C$ p5 T' F1 p. S - .text:24BC2CDB push ebx4 M5 A* P) o# e; m7 A$ @' o4 l) q
- .text:24BC2CDC mov ebx, ds:LoadLibraryA3 [) a" h3 O5 Y: U) ^* V2 a
- .text:24BC2CE2 push esi
: w9 E; M/ _6 n9 h: d, [7 r - .text:24BC2CE3 push edi
: a& N; O: E6 V6 ~/ E5 N - .text:24BC2CE4 xor edi, edi
: f. w s. ?/ `, l$ ]: v - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL") Z+ k9 }/ y* a T
- .text:24BC2CEB mov [ebp+var_8], edi
7 @0 b; t1 G3 C - .text:24BC2CEE mov [ebp+var_1C], edi
5 R; w" g8 U2 G - .text:24BC2CF1 mov [ebp+var_C], edi7 U& h, k$ K7 T6 d
- .text:24BC2CF4 mov [ebp+var_10], edi
0 e6 a9 p, {4 G. u3 x- ]5 @ - .text:24BC2CF7 mov [ebp+var_18], edi
6 L& {4 h* p! H5 |1 \6 H% X; N - .text:24BC2CFA call ebx ; LoadLibraryA
. ^1 G# j/ a$ O7 |; y! ]7 ] - .text:24BC2CFC mov esi, eax% l; X @ T$ J5 q, q
- .text:24BC2CFE cmp esi, edi
2 a6 D0 e8 Q1 r- Y: a0 A5 q! z - .text:24BC2D00 mov [ebp+hLibModule], esi# x% S# j2 r/ W6 g
- .text:24BC2D03 jnz short loc_24BC2D0F6 g4 N( b* v% Z3 j! X p! L
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"( |8 ?, \* Z# F P' ]. A$ I
- .text:24BC2D0A jmp loc_24BC2E6D- Z; R! Q0 C }& B% D2 x, z
- .text:24BC2D0F ; ---------------------------------------------------------------------------/ L5 v- g+ F+ q
- .text:24BC2D0F, E+ f% D* J$ d- O2 a" N$ E% J# s
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
$ J$ _9 N3 C3 i* a O - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate", p" ?3 P2 g* o) p) Q' V5 k' w+ T. }
- .text:24BC2D14 push esi ; hModule
$ _/ h7 z0 `5 Z H - .text:24BC2D15 call ds:GetProcAddress/ A$ {9 j' @( W( j* c" I
- .text:24BC2D1B cmp eax, edi
' ]) R( G7 O9 t6 L1 r9 e - .text:24BC2D1D jnz short loc_24BC2D30
9 ? ^/ B3 M7 L+ y - .text:24BC2D1F push esi ; hLibModule+ x8 }, U4 @6 T9 H6 b1 e% J1 W
- .text:24BC2D20 call ds:FreeLibrary& ~9 `& B5 ]8 b$ U0 A* ^" O
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
1 c7 U! x: g3 R. \. s% | - .text:24BC2D2B jmp loc_24BC2E6D0 \" l- _, a9 `, x+ J" u; G% ?
- .text:24BC2D30 ; ---------------------------------------------------------------------------' u1 h2 w+ s' k7 G4 S j
- .text:24BC2D30
5 C: V/ G; D; X - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j% t" x* H3 ]5 c
- .text:24BC2D30 lea ecx, [ebp+var_8]
. q2 a( _( X: H( J8 V+ [ - .text:24BC2D33 push edi4 M- K) A$ a! h
- .text:24BC2D34 push ecx) u' f) Z& x6 o% u" D
- .text:24BC2D35 push edi) ^* C5 W9 u% a$ ?% u' a4 m% ?7 E0 U
- .text:24BC2D36 call eax6 c) d1 }7 ?9 ~% V
- .text:24BC2D38 test eax, eax% J0 n8 X4 e- T: l+ O( b
- .text:24BC2D3A jge short loc_24BC2D4D
: e ~% ^, s) L2 ] - .text:24BC2D3C push esi ; hLibModule3 _" X! H( K' `0 ?& u& C
- .text:24BC2D3D call ds:FreeLibrary6 F* q8 E; W- P1 o* O3 B* T& C
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
, Y& b1 G1 e% N$ Z; f - .text:24BC2D48 jmp loc_24BC2E6D
: {) c/ g# A( S - .text:24BC2D4D ; ---------------------------------------------------------------------------
; V1 x( y+ B y1 h+ q: a - .text:24BC2D4D# h% y% K9 j/ b% E8 w. {7 y' g# s
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
! m: u a7 G3 {1 A4 W9 y6 _: Y - .text:24BC2D4D mov eax, [ebp+var_8]
0 a7 r. T. X7 C8 a9 J - .text:24BC2D50 lea edx, [ebp+var_1C]
" A7 f# y, i* z; T3 ] - .text:24BC2D53 push edx5 ?3 h/ ^5 Q; r1 r! {* C5 S X" x! c
- .text:24BC2D54 push offset unk_24BC4470
1 G6 P* z( G9 P4 i) K$ _2 \ - .text:24BC2D59 mov ecx, [eax]
4 h! ~% A7 J5 \! K! v - .text:24BC2D5B push eax
5 ]: X4 R5 s$ p7 C% u. e c - .text:24BC2D5C call dword ptr [ecx]9 ^6 W" D0 M0 x% s P6 k x3 k
- .text:24BC2D5E test eax, eax' O0 c+ t9 P# D
- .text:24BC2D60 jge short loc_24BC2D877 S# n) K, Z+ `: \+ V: g- r6 @- _
- .text:24BC2D62 mov eax, [ebp+var_8]8 \! \9 A8 r, O5 j: D
- .text:24BC2D65 push eax
2 {9 R2 ]3 b" U - .text:24BC2D66 mov ecx, [eax]
4 U+ r8 z4 N, p" d - .text:24BC2D68 call dword ptr [ecx+8]1 ?& |3 w6 n$ o, @, l; v/ ~7 d8 N- b
- .text:24BC2D6B push esi ; hLibModule
; m, P X) R+ \$ F - .text:24BC2D6C call ds:FreeLibrary
% z7 {0 ]5 c2 \2 l, r - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
9 f8 G+ U# x9 l5 m - .text:24BC2D77 call ds:OutputDebugStringA# F& S0 C: w e4 l8 Q
- .text:24BC2D7D mov eax, 100h
# n' y6 u* l& _, g - .text:24BC2D82 jmp loc_24BC3011
9 L) E. @# \- C. ~" I- u8 ?0 U F - .text:24BC2D87 ; ---------------------------------------------------------------------------# o7 @$ O: c% |
- .text:24BC2D87/ P0 W. q0 C" Y" H
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j9 L* f, ?# z D# Z3 a+ L
- .text:24BC2D87 mov eax, [ebp+var_1C]& ~. t* L! a' {: S# `
- .text:24BC2D8A push eax
. j' j/ n: m B' [ - .text:24BC2D8B mov ecx, [eax]" b" U8 ?- s' z
- .text:24BC2D8D call dword ptr [ecx+8]$ n9 d9 k) }& \" k
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"( t. C8 E$ y2 @2 j+ n
- .text:24BC2D95 call ebx ; LoadLibraryA
5 x& K1 m: d c: \) |; A - .text:24BC2D97 mov esi, eax
- d& N# f# W2 k" v: L - .text:24BC2D99 cmp esi, edi( a- p+ |$ O3 z- K7 R) t! N
- .text:24BC2D9B jnz short loc_24BC2DB6- m3 g8 F6 j ]3 p" D
- .text:24BC2D9D mov eax, [ebp+var_8]- W( Y5 Q7 c, I0 p3 G
- .text:24BC2DA0 push eax
0 A# l0 m% ~2 E6 O - .text:24BC2DA1 mov ecx, [eax]! W" R1 \ o+ N- H+ v& K
- .text:24BC2DA3 call dword ptr [ecx+8]" m) i3 y; h% q5 ]) q: I+ Y2 j
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule! t. ^* ?' i" w1 e6 ]; K# v+ f* t
- .text:24BC2DA9 call ds:FreeLibrary3 L8 ^ V6 M& @3 f) }4 s
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"% C. W9 C/ ^* p+ A) c; J R
- .text:24BC2DB4 jmp short loc_24BC2DE2
4 n2 n) P) q+ O - .text:24BC2DB6 ; ---------------------------------------------------------------------------" Y6 s" Y" K2 m4 T* p8 V
- .text:24BC2DB67 K6 N, _) Q3 i6 ^" H) }
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
# |* e3 a/ s4 [3 K - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
- U& y7 C2 `# r. A4 X - .text:24BC2DBB push esi ; hModule- P" ^. H. V. F9 q
- .text:24BC2DBC call ds:GetProcAddress+ f8 I) ^) s5 `5 G
- .text:24BC2DC2 push esi ; hLibModule
; N" d u. [* p5 c0 k - .text:24BC2DC3 mov esi, ds:FreeLibrary4 j8 O4 ~& S1 s7 ^, I) `) Q
- .text:24BC2DC9 test eax, eax
. ^% g* X( w- S1 y' N/ W+ O: J# W8 w - .text:24BC2DCB jnz short loc_24BC2DF2
4 |' L$ c+ s, p) U5 W* A - .text:24BC2DCD call esi ; FreeLibrary* G9 Q K- ]4 J
- .text:24BC2DCF mov eax, [ebp+var_8]7 W) v9 X" f& i! K
- .text:24BC2DD2 push eax
+ p7 f$ J6 [2 c z- s t - .text:24BC2DD3 mov ecx, [eax]
% o! O* f$ A; n2 R - .text:24BC2DD5 call dword ptr [ecx+8]+ a* r- j/ e4 t6 \9 O
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule8 A; Q9 n* W! z h
- .text:24BC2DDB call esi ; FreeLibrary w: N; b2 h; T; {& c: O; N9 e
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"..." y% Y' J8 E/ U) m9 d
- .text:24BC2DE2
( x7 s+ M* f' B; x% R- \+ M9 M - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
- Q/ ?* i, d8 F3 _* i4 N P - .text:24BC2DE2 call ds:OutputDebugStringA n4 f" [4 I7 f# K0 n
- .text:24BC2DE8 mov eax, 200h
' \. W( q5 q" U. N0 @1 c/ M - .text:24BC2DED jmp loc_24BC3011
$ n8 I: J+ x; F; n4 E( o - .text:24BC2DF2 ; ---------------------------------------------------------------------------: _. W7 t* E2 s0 R7 K# E
- .text:24BC2DF2( X+ t$ I5 _; b! A' q! _1 \
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
6 x3 }9 n$ o" Q; L" I3 O - .text:24BC2DF2 call esi ; FreeLibrary
! d ~7 C) _ |& h - .text:24BC2DF4 push 6Ch ; Size
3 P! s- Q' O! A7 ] - .text:24BC2DF6 lea eax, [ebp+Dst]
+ A; W" y) E+ m" \% v" A" T9 T& Y - .text:24BC2DFC push edi ; Val
* Z5 R% Z1 M. |. s9 h( E! a - .text:24BC2DFD push eax ; Dst
* T* F6 q1 T2 A - .text:24BC2DFE call memset
6 }0 e) C% g/ T- q; @8 i3 C - .text:24BC2E03 mov eax, [ebp+var_8]
% ]; V* w8 I; z E - .text:24BC2E06 add esp, 0Ch
5 `# a, I- a) T5 V- x1 S1 v0 z- J - .text:24BC2E09 mov [ebp+Dst], 6Ch
% B- d# j" J1 p" w/ e - .text:24BC2E13 mov [ebp+var_8C], 1- u9 k8 d# Q# K% W. l" l
- .text:24BC2E1D mov [ebp+var_28], 200h
! O9 }* s: J2 D3 X8 n0 Y) n - .text:24BC2E24 mov ecx, [eax]5 f/ U5 k, R+ X: [2 ~+ H
- .text:24BC2E26 push 8
- f; N" f# O) w/ Y& @% \ - .text:24BC2E28 push edi
! f& k# I; J6 \: J$ J( Z - .text:24BC2E29 push eax6 {# I* y8 G- g* V+ b
- .text:24BC2E2A call dword ptr [ecx+50h]/ |/ z% J- p0 S6 ` u# D
- .text:24BC2E2D test eax, eax
" X- _2 T& G. @+ b8 ~# e9 g - .text:24BC2E2F mov eax, [ebp+var_8]# T: u3 R: o0 e
- .text:24BC2E32 mov ecx, [eax]
' R. o9 ]( c' i) z) G$ k - .text:24BC2E34 jge short loc_24BC2E46
& F5 O; g' I4 f1 k! Q - .text:24BC2E36 push eax4 w4 |" D0 Z; e
- .text:24BC2E37 call dword ptr [ecx+8]4 t$ R3 ?1 W6 ^$ B/ q& Q) @# Y
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
$ S% Q+ y1 y! I# d0 ^# a - .text:24BC2E3D call esi ; FreeLibrary
# ^, @3 U( s! ^# T5 b. Q - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
8 o8 w7 T) z3 Y7 x2 V; N - .text:24BC2E44 jmp short loc_24BC2E6D
. r6 d5 F2 f( ]0 t4 |, f - .text:24BC2E46 ; ---------------------------------------------------------------------------
+ {0 y3 E7 i0 n/ E# ] - .text:24BC2E46
6 h6 m2 O7 h& A - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
( b" t, O* o2 b, H# M9 c - .text:24BC2E46 lea edx, [ebp+var_C]
, H* h2 u& B8 k( \2 f - .text:24BC2E49 push edi; a* \6 W8 s% T# T( I! g, l& q
- .text:24BC2E4A push edx
% _ i' D& Q. R2 ` - .text:24BC2E4B lea edx, [ebp+Dst]
! L* |' q( d; J% y! T - .text:24BC2E51 push edx3 D2 w. a1 |5 N, ]4 |" j8 d9 p$ d; ~
- .text:24BC2E52 push eax
6 K; z$ C& Y% g: t" R( n - .text:24BC2E53 call dword ptr [ecx+18h]
1 p6 g' K5 Q2 C1 d - .text:24BC2E56 test eax, eax$ H* _1 m+ J- _0 q+ \$ w5 T
- .text:24BC2E58 jge short loc_24BC2E7A
* D. U7 p5 J$ X& V8 [! J# { - .text:24BC2E5A mov eax, [ebp+var_8]- G! g5 X# Z7 A9 q r
- .text:24BC2E5D push eax) W' Y2 E) i6 C0 O0 u
- .text:24BC2E5E mov ecx, [eax]
+ G# G" A$ ?" b: |$ H - .text:24BC2E60 call dword ptr [ecx+8]. i: g* V/ {0 J/ {7 k7 [
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule( F/ _8 d, W3 N2 a( z. V
- .text:24BC2E66 call esi ; FreeLibrary) u9 ]( Z' C9 X$ X0 T
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"4 a" B G9 F3 j& u' [# L
- .text:24BC2E6D" Y4 }9 N! M! h! o, \
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
. G& t$ F# V# [) b1 V% {' t, ^ - .text:24BC2E6D ; sub_24BC2CD2+59↑j .../ J v' w0 z; `
- .text:24BC2E6D call ds:OutputDebugStringA
8 K, h! x) b. o% r% K - .text:24BC2E73 xor eax, eax& k8 O4 p" y b
- .text:24BC2E75 jmp loc_24BC3011
4 a+ t6 X# m+ \/ t+ h9 g A3 p7 q6 ^ - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 + V/ Z- c4 v+ W
( W4 \& p5 ^, [; A) R/ Q9 I( d2 _: J$ i; |7 `
|