这游戏以前分析过,本贴再写得详细一些。8 ^* Y+ u1 E+ B
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,% O: A. h, [% O3 {) u$ z- N# H
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。; Y# R7 L9 Z2 p i# d" a7 ]) M* _0 t
0 S& C8 Y7 L* E$ Z- D参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.. [" y' ?7 O# U7 R7 S
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
* B2 v5 ~4 U( G h, v8 p( i - STDMETHOD_(ULONG,AddRef) (THIS) PURE;' u) E* |( Z* @9 h6 {
- STDMETHOD_(ULONG,Release) (THIS) PURE;- V- |1 w: | b6 U
- STDMETHOD(Compact)(THIS) PURE;
" B p6 \$ U2 R. C: d8 \, V - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;/ K) \% w: ]! h
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
7 A- w3 E. n6 } z# M2 q# I - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 8 v% ?; m" K& Z' g8 @! i; n- V
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
* s5 x' S1 d4 r& V* p8 q; f5 n. A+ y+ G1 E9 T
6 M3 M4 o! ]' c2 a" W
2 \. k$ j& z2 e1 |: K& C- ( v: E* u9 e% F9 k) |- ^
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
2 j) ]! q0 Q: N0 K - .text:24BC2CD2; J, h. I. Q! Z t% z
- .text:24BC2CD2 ; Attributes: bp-based frame0 J8 A* Z. F5 M8 n5 J$ h
- .text:24BC2CD2
# y- H# o. w S; c3 E& i2 t - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
+ W+ E7 X5 g' t - .text:24BC2CD2& b; T+ ^; z/ ?. ]6 b; x
- .text:24BC2CD2 Dst = dword ptr -90h
6 M$ X* N$ l) O& s n2 I - .text:24BC2CD2 var_8C = dword ptr -8Ch& |& Q9 ^+ B! e
- .text:24BC2CD2 var_28 = dword ptr -28h
* m7 A. v- K0 k. J9 G" a0 Q: f - .text:24BC2CD2 var_24 = dword ptr -24h
9 L& [% b$ q S H - .text:24BC2CD2 var_20 = dword ptr -20h
* ?+ U* e6 q5 @" I% e - .text:24BC2CD2 var_1C = dword ptr -1Ch
' J2 M7 _( d* S8 E5 m+ Y! n9 l) r - .text:24BC2CD2 var_18 = dword ptr -18h
/ ?4 T( ?0 o3 x2 S - .text:24BC2CD2 ppv = dword ptr -14h
6 g; T% y) n8 g5 c0 U - .text:24BC2CD2 var_10 = dword ptr -10h3 |5 V8 d" v) h6 c# k
- .text:24BC2CD2 var_C = dword ptr -0Ch
: J# X; M9 a H$ ^ U% {' M( _5 @ - .text:24BC2CD2 var_8 = dword ptr -84 Q0 a. d1 K) \
- .text:24BC2CD2 hLibModule = dword ptr -4
- ~: a6 V" U& p' A9 z* ~6 u- k - .text:24BC2CD2
& i$ @( S" i! v4 \* q/ m - .text:24BC2CD2 push ebp
( p3 S% u j- g. E' K% e& U - .text:24BC2CD3 mov ebp, esp. {+ g# _, S* Z: o9 q6 N
- .text:24BC2CD5 sub esp, 90h( w0 H7 z6 {2 }1 L! ~ U
- .text:24BC2CDB push ebx) l* p) i0 _! Y3 Q4 }5 N+ G, W0 D
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
$ ~+ v4 j. }9 z( o! ?& { - .text:24BC2CE2 push esi
+ ]0 U6 c7 q2 O5 _7 c9 n/ e - .text:24BC2CE3 push edi8 v: s% S3 s% f" |
- .text:24BC2CE4 xor edi, edi
, i% L4 `; x; z, y+ x- [) Y1 V - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"1 p; V9 x6 n. y* ?0 b* d
- .text:24BC2CEB mov [ebp+var_8], edi
% o& A* \7 h, z$ R - .text:24BC2CEE mov [ebp+var_1C], edi9 m8 e! n. R& T3 @+ p% B
- .text:24BC2CF1 mov [ebp+var_C], edi' S% u/ {* a0 w# r2 p" \) a" _# Y
- .text:24BC2CF4 mov [ebp+var_10], edi
) W. Q/ Q- ?* ~% [ - .text:24BC2CF7 mov [ebp+var_18], edi' j/ C: D9 G9 ~& T2 }1 Z6 }% s* @& ]
- .text:24BC2CFA call ebx ; LoadLibraryA
6 @" S' X0 r& E: T4 y. w/ b2 }! J9 V - .text:24BC2CFC mov esi, eax
- P! c6 u5 ~0 Q/ \* U - .text:24BC2CFE cmp esi, edi
0 A; Z2 S! D8 k5 G. [: c - .text:24BC2D00 mov [ebp+hLibModule], esi7 J' a0 L" M- |
- .text:24BC2D03 jnz short loc_24BC2D0F; o5 \; E+ b4 h
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
N6 M: _1 \. E7 c7 ] - .text:24BC2D0A jmp loc_24BC2E6D* D' Q7 c) X4 `; K8 G
- .text:24BC2D0F ; ---------------------------------------------------------------------------" f# Q% N+ H, C
- .text:24BC2D0F5 S7 c/ @' E# L3 r" Y* [
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
5 d! ~4 M2 F& {4 u" V/ A6 L0 o - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
' l( U% |3 a: v) n8 @ - .text:24BC2D14 push esi ; hModule
, z) p' y6 ?8 T9 P# o2 u - .text:24BC2D15 call ds:GetProcAddress
7 x/ P- k. v5 ?, \' d( z - .text:24BC2D1B cmp eax, edi
- i3 B4 r& V5 S+ O- S; E - .text:24BC2D1D jnz short loc_24BC2D30
( W5 @ ~1 Y" S i. l6 ]+ i - .text:24BC2D1F push esi ; hLibModule3 [6 B3 l0 H; N! H
- .text:24BC2D20 call ds:FreeLibrary
) K4 v% L* Y2 ~/ ~1 C - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
; w) R1 R& s: j* ]* _! a - .text:24BC2D2B jmp loc_24BC2E6D
8 J0 S! Z# V/ c. |( V2 \$ F - .text:24BC2D30 ; ---------------------------------------------------------------------------* d* m: g- ?' e' D
- .text:24BC2D30
$ q: h; \$ P; ~/ t+ _. N3 D - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j) C4 B2 }: l5 P- _4 r6 Q' t
- .text:24BC2D30 lea ecx, [ebp+var_8]
: j+ _5 b0 b. L! x - .text:24BC2D33 push edi! g& V. ?# r! l( k* G% ]
- .text:24BC2D34 push ecx
& n- b$ }' N# U( R& o4 P - .text:24BC2D35 push edi( P `! Q7 S* Y: V6 A" |
- .text:24BC2D36 call eax; p- R4 f7 @- S" ~# y
- .text:24BC2D38 test eax, eax; K6 k- m" n% z1 Z& o0 q5 b+ J/ {
- .text:24BC2D3A jge short loc_24BC2D4D6 D0 K8 s. U: C% C1 O3 y6 D3 ?
- .text:24BC2D3C push esi ; hLibModule" W. h: x7 U, k# q
- .text:24BC2D3D call ds:FreeLibrary
* k8 h# G7 i1 ]# f z( x - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n") J. v- {9 D7 B$ [2 F* [/ j. Y
- .text:24BC2D48 jmp loc_24BC2E6D2 o$ `& I7 K( G+ m
- .text:24BC2D4D ; ---------------------------------------------------------------------------4 P) Y6 T( j# a1 {: [
- .text:24BC2D4D
/ B! c# I9 N) [6 Y0 C2 T - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j1 o; r, u! m, x% D
- .text:24BC2D4D mov eax, [ebp+var_8]' ]) T% W" z/ u9 r4 r, X* l
- .text:24BC2D50 lea edx, [ebp+var_1C]
$ @7 G) {8 e) f3 ]; S - .text:24BC2D53 push edx
3 h; j. \2 T4 T8 t5 ~# l - .text:24BC2D54 push offset unk_24BC44709 o" s" r, X4 B; w
- .text:24BC2D59 mov ecx, [eax]
1 z6 u* l! u1 f1 W0 M6 U - .text:24BC2D5B push eax
7 G# c- T: E8 @8 j - .text:24BC2D5C call dword ptr [ecx]
% p: v# B1 j& I' ]: C' X - .text:24BC2D5E test eax, eax: D: E; D r6 R% B2 ^( ~) ~7 O
- .text:24BC2D60 jge short loc_24BC2D87
6 {4 a, N% y% D% C2 a4 n - .text:24BC2D62 mov eax, [ebp+var_8]
3 i: b1 C* x, B( C9 z/ w - .text:24BC2D65 push eax
- w6 n5 [' [( P0 W& L5 @ - .text:24BC2D66 mov ecx, [eax]
) @/ E: I% {4 S2 v) Z: u - .text:24BC2D68 call dword ptr [ecx+8]
$ @$ U' J0 [( j& ?! P7 d - .text:24BC2D6B push esi ; hLibModule
4 H$ Y. _, ~7 U# c. K - .text:24BC2D6C call ds:FreeLibrary
7 n6 f+ `9 p& }: T& r) v; K1 b - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
1 y2 I5 v8 _5 f8 z# E$ J/ L - .text:24BC2D77 call ds:OutputDebugStringA9 g. ~8 h! O! A
- .text:24BC2D7D mov eax, 100h8 Y8 p8 C7 @& |2 O
- .text:24BC2D82 jmp loc_24BC3011
* B( V# {3 f1 A2 `, j7 B2 Z" h - .text:24BC2D87 ; ---------------------------------------------------------------------------4 O% _8 h. L, x4 j
- .text:24BC2D878 m* n, W9 ^) b: w2 @9 E
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j6 K0 S# B% A4 m+ S. o3 f% t
- .text:24BC2D87 mov eax, [ebp+var_1C]
# }2 J, ]% \. n; h4 R - .text:24BC2D8A push eax5 |( c1 Z. q, p/ L8 f
- .text:24BC2D8B mov ecx, [eax]* _' ~" j y( n: R
- .text:24BC2D8D call dword ptr [ecx+8]
/ z1 w' D# C/ i% h6 @ - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"' V( E9 d" {- k x
- .text:24BC2D95 call ebx ; LoadLibraryA4 N2 d1 \; L+ ?' I! E% A( h
- .text:24BC2D97 mov esi, eax
, z+ Y2 H4 R1 P1 a - .text:24BC2D99 cmp esi, edi
- u) W! Q+ h( s* q5 x - .text:24BC2D9B jnz short loc_24BC2DB6' S1 W: i+ Y& }" Y# r$ q
- .text:24BC2D9D mov eax, [ebp+var_8]$ L# @; z" y8 A$ z2 N U+ Q9 G0 f
- .text:24BC2DA0 push eax
0 s% C7 K+ k( X7 {- e, n! c) ` - .text:24BC2DA1 mov ecx, [eax]
1 p$ r* F1 K" e2 g! M% \ - .text:24BC2DA3 call dword ptr [ecx+8]
/ E% E7 r+ m: N( _( J" a9 t6 F - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule/ H) C; J3 @; ^( u: ?' \" X" ]+ s
- .text:24BC2DA9 call ds:FreeLibrary) {8 ~* ^/ s x
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
+ j. j! @; y( A+ a8 e - .text:24BC2DB4 jmp short loc_24BC2DE2$ ?) {4 }. |4 x0 }" N F& S0 L
- .text:24BC2DB6 ; ---------------------------------------------------------------------------
+ v6 I9 r) x* F( ^- I' E) u# M - .text:24BC2DB6' `: R1 @) S% _/ w
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j/ R3 E2 g+ m2 h3 Y: e b
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
4 ] r3 J3 w2 D; T - .text:24BC2DBB push esi ; hModule
. z- z) o) ^, V/ M# h, x/ a' n - .text:24BC2DBC call ds:GetProcAddress" o1 H) g7 t1 A' C
- .text:24BC2DC2 push esi ; hLibModule
. P5 J- p# z# c, P& r - .text:24BC2DC3 mov esi, ds:FreeLibrary
' M b1 n& N! G! I* x - .text:24BC2DC9 test eax, eax
7 v/ ] @) ?$ l9 d/ h& } - .text:24BC2DCB jnz short loc_24BC2DF2
0 _# A' u, w5 I - .text:24BC2DCD call esi ; FreeLibrary
* p5 j& |9 `$ E - .text:24BC2DCF mov eax, [ebp+var_8]
: |* H. L4 o0 m6 O" W( t0 u: V. ~ - .text:24BC2DD2 push eax- w! G! `/ }# r3 N% E8 {8 ^" `
- .text:24BC2DD3 mov ecx, [eax]+ _. x* I# W" g! d" O: ~
- .text:24BC2DD5 call dword ptr [ecx+8]
6 T' t4 A) @* ^ - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule, l% H. Q. K6 `% ~
- .text:24BC2DDB call esi ; FreeLibrary
8 J% s0 W% ~) G, _) V Z- S4 l4 p1 t - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...2 z$ h$ Y* `8 F$ w" J
- .text:24BC2DE2
# {* I+ p( M) V' s: ?- u/ M" ~ - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
3 y2 Z' C: ]5 x# c; z - .text:24BC2DE2 call ds:OutputDebugStringA
/ ~2 C' M+ p- F/ O5 x - .text:24BC2DE8 mov eax, 200h8 `# O! U7 Y; r l4 I. Z
- .text:24BC2DED jmp loc_24BC3011
" |. C" c9 j; K0 A6 |% M& j9 W+ E- B - .text:24BC2DF2 ; ---------------------------------------------------------------------------
1 M5 ^% k$ N# b3 r+ [8 e; _9 ` - .text:24BC2DF2) Z/ Q1 l- y3 D+ t1 Z5 }
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j; g! n. P" u- a& g1 Z8 C
- .text:24BC2DF2 call esi ; FreeLibrary
c# Q! W+ s5 s/ |% g) Q* f- ` - .text:24BC2DF4 push 6Ch ; Size. D6 d2 ~) P8 p7 n4 Q/ d/ T
- .text:24BC2DF6 lea eax, [ebp+Dst]
" e n$ [/ l* X& U& f& j% _. w# r - .text:24BC2DFC push edi ; Val
\7 c! C: [, j. ` - .text:24BC2DFD push eax ; Dst. f! x' j: p# X/ M1 k5 s" W. F, w0 S
- .text:24BC2DFE call memset$ O$ E* F; L/ u0 u# v* L$ h
- .text:24BC2E03 mov eax, [ebp+var_8]$ ~' T- G& P, U2 f( t# x8 q
- .text:24BC2E06 add esp, 0Ch& P2 r2 O) J7 q1 ?8 g5 j& b3 d, g
- .text:24BC2E09 mov [ebp+Dst], 6Ch7 l$ K" q8 @8 x9 e4 j2 A) Q r& O
- .text:24BC2E13 mov [ebp+var_8C], 1
; v$ T5 p" S) L5 M; O - .text:24BC2E1D mov [ebp+var_28], 200h
! i& Z$ w9 e g9 @) m% Y1 W - .text:24BC2E24 mov ecx, [eax]
- Z, ^1 P; }1 L; Q- B+ k( R - .text:24BC2E26 push 8
5 g: y; N+ w% Z - .text:24BC2E28 push edi: f) i, F4 F/ V& K
- .text:24BC2E29 push eax/ g7 @% O5 v" ~+ _! |# |8 b
- .text:24BC2E2A call dword ptr [ecx+50h]
, y9 V) } u, Y7 S6 [( u# B+ Q$ x# K - .text:24BC2E2D test eax, eax) U5 W) H1 Q' N* q: @/ K/ ^
- .text:24BC2E2F mov eax, [ebp+var_8], \ q" T$ D' w4 n9 H
- .text:24BC2E32 mov ecx, [eax]
2 Q) }* m6 j' N- b) W( G8 j" ~ - .text:24BC2E34 jge short loc_24BC2E46
`( C1 o+ U) s. I( [! K* V - .text:24BC2E36 push eax: S( l; ~6 [) ^4 N7 _- @# z
- .text:24BC2E37 call dword ptr [ecx+8]
7 ^0 F1 W" \1 B - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
0 o% F4 C! p& _& K2 h8 ^7 G - .text:24BC2E3D call esi ; FreeLibrary6 h; M; n9 V4 J4 [' R" o
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
' p7 O% L+ D% { - .text:24BC2E44 jmp short loc_24BC2E6D
+ t) E4 D j! N; P4 O7 W3 W, G - .text:24BC2E46 ; ---------------------------------------------------------------------------7 Y% `0 d! q! C
- .text:24BC2E462 w! ^7 c! ~8 Y/ T" Y" u% d" o' R% \
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
; R1 v* Y! O9 S' S - .text:24BC2E46 lea edx, [ebp+var_C]3 z9 Q, T% S$ b5 g3 _( u" d) }# j
- .text:24BC2E49 push edi
( k0 k% T, ^8 @) s* n1 ^# v - .text:24BC2E4A push edx
0 E O. h3 [8 {; k8 h9 O7 y& U - .text:24BC2E4B lea edx, [ebp+Dst]
2 F. q3 ]% ^; [" T2 s3 E" ^ - .text:24BC2E51 push edx
" @8 w2 m2 `3 H9 @4 W4 E - .text:24BC2E52 push eax) H! n2 H" }( x/ P! e0 x
- .text:24BC2E53 call dword ptr [ecx+18h]
4 y0 ~/ t% r+ | - .text:24BC2E56 test eax, eax
; q6 B+ m: K' n5 Y: C6 E+ ] - .text:24BC2E58 jge short loc_24BC2E7A
5 g7 t. K+ B4 G8 i) h% z - .text:24BC2E5A mov eax, [ebp+var_8]- ?; M9 J) h, {5 t5 M1 K: f6 Q
- .text:24BC2E5D push eax
# r! @ ?6 x1 D - .text:24BC2E5E mov ecx, [eax]
% i! d3 z( N8 F9 h4 S) ] - .text:24BC2E60 call dword ptr [ecx+8]
/ ?4 {: o$ a V: A" x& c1 X - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
8 f2 T* A$ ~: w0 i" W - .text:24BC2E66 call esi ; FreeLibrary
( ?0 X, ]% ~* z6 J3 L - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
6 r( u* s) B6 X6 A. j2 @ - .text:24BC2E6D
3 i/ z: t1 Y7 z0 V0 ~' Y- C, O) Y - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j0 w+ u8 G! R- ]/ A) |- p
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
9 L' {" `8 B( H( `( a, a - .text:24BC2E6D call ds:OutputDebugStringA
; t2 t, F4 J; ? - .text:24BC2E73 xor eax, eax
- ]% n$ j% L1 ~7 h8 b0 B) ` - .text:24BC2E75 jmp loc_24BC3011( v6 R `8 h5 U
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ( v) c9 @9 |4 t: d" V& H) N* G
! e2 q- m' W! q p; e( A
! O+ S F8 G9 z8 [5 w
|