这游戏以前分析过,本贴再写得详细一些。
' v( ~- D: c* C7 I# g* m这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,$ s" x3 C+ t$ X: n( ]) |/ V4 G) }
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。2 i" D6 y& |7 F% v6 U
4 n. N0 O. f' y; V! V# T8 \5 Z参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.7 H3 `# J5 t, i3 q
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
- p1 t- a4 R4 D) {( T5 N - STDMETHOD_(ULONG,AddRef) (THIS) PURE;- I7 ^ b* U# t# c
- STDMETHOD_(ULONG,Release) (THIS) PURE;7 n' G0 i ^/ N% O! T
- STDMETHOD(Compact)(THIS) PURE;; f% o) t# R3 d0 K, c' k7 f5 b
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;# |# J2 b, h! v* a, n
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
; d. G7 V L9 }/ {5 C3 j' }; u! {9 S - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 0 E; D6 Q. @& q9 k3 b8 Z
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
! }( a* Y, B6 i1 x
8 \: k) i% K, I H) J& J
4 S% t6 y, l1 a2 n0 [, \
1 {! ~# Y# f2 S9 f$ m, b4 g% n- : e5 B3 L6 G8 G
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================! L( V: {1 V2 |3 g% Z' o8 K3 ^6 S
- .text:24BC2CD2
" T2 U! C" m) L4 c8 L0 r - .text:24BC2CD2 ; Attributes: bp-based frame. F6 f% F C2 _- P0 R
- .text:24BC2CD2; `6 Z6 T; \ }* T5 h' v# l3 [3 h
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
% E+ y6 B: m9 r$ Q1 n+ V1 F- d - .text:24BC2CD2# I* T7 ^. T$ ~ k1 `3 I! V! ~; U
- .text:24BC2CD2 Dst = dword ptr -90h
* Q$ B+ E/ `% k) R/ G0 J - .text:24BC2CD2 var_8C = dword ptr -8Ch9 s. T* W$ M# B1 H/ |
- .text:24BC2CD2 var_28 = dword ptr -28h0 W# _/ R8 z( |+ \& \+ z
- .text:24BC2CD2 var_24 = dword ptr -24h
7 u* N/ n7 g: n! L - .text:24BC2CD2 var_20 = dword ptr -20h/ a+ Z I# @ Z3 u$ r1 L
- .text:24BC2CD2 var_1C = dword ptr -1Ch, d; I" Z4 p5 g' f! X& j1 Q
- .text:24BC2CD2 var_18 = dword ptr -18h; V* E+ L, r' ^# t/ s6 \( E
- .text:24BC2CD2 ppv = dword ptr -14h, E O* {3 [# H3 Q0 W H+ S
- .text:24BC2CD2 var_10 = dword ptr -10h
% E R6 b. a+ \8 z8 L - .text:24BC2CD2 var_C = dword ptr -0Ch/ m; b7 r) E' @4 Y& |
- .text:24BC2CD2 var_8 = dword ptr -8
1 p% k1 `% y/ [% z' V2 d/ B - .text:24BC2CD2 hLibModule = dword ptr -4
% D5 H% c- ]7 u) {/ E: Y. ^: b& v! o# c - .text:24BC2CD2
( D! M8 m3 c7 @4 w - .text:24BC2CD2 push ebp7 y! n$ e( O. I" u" H$ |
- .text:24BC2CD3 mov ebp, esp& V7 l& z1 M& S$ k/ r6 s
- .text:24BC2CD5 sub esp, 90h& R0 }( \* P& G" C% v& _( [, {
- .text:24BC2CDB push ebx
- p0 U7 p. ]* o9 C# F9 @, k; P1 H - .text:24BC2CDC mov ebx, ds:LoadLibraryA
0 R4 E2 k' f$ l9 W - .text:24BC2CE2 push esi6 j! K) p2 P! Y
- .text:24BC2CE3 push edi
! n3 ^5 Z5 h0 k9 j2 z- E+ S - .text:24BC2CE4 xor edi, edi
' X: J+ U# `( u( e1 q - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
+ ?& H2 c8 n s$ Y1 ^ - .text:24BC2CEB mov [ebp+var_8], edi2 s/ O7 o' [/ ^$ X2 x) U3 X; |) t
- .text:24BC2CEE mov [ebp+var_1C], edi
7 S0 Z) F# c) T8 k: O4 a9 o- w- F' a" L - .text:24BC2CF1 mov [ebp+var_C], edi
8 c/ M. I0 _; I D$ P" k1 c$ B3 [7 X - .text:24BC2CF4 mov [ebp+var_10], edi
% k/ p* A5 s" \" e% X+ m$ ?! ? - .text:24BC2CF7 mov [ebp+var_18], edi
% ~8 e: w5 J" z% q3 \+ v - .text:24BC2CFA call ebx ; LoadLibraryA1 {9 d" `, X* s( B
- .text:24BC2CFC mov esi, eax
5 J: ]' m7 X: b$ }, M - .text:24BC2CFE cmp esi, edi) p* Y+ @8 Y' @1 z# X
- .text:24BC2D00 mov [ebp+hLibModule], esi1 _& H3 m4 A3 W$ z) z
- .text:24BC2D03 jnz short loc_24BC2D0F6 [5 R7 s$ W! M
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
$ U P) Q0 S3 H# z# p - .text:24BC2D0A jmp loc_24BC2E6D
% V* T0 e3 u! `# ]' _ - .text:24BC2D0F ; ---------------------------------------------------------------------------
0 ^9 ?8 |1 F' S. l& u0 g+ e - .text:24BC2D0F
# ?, i- i* D, g: Y# `. } t - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j6 V* `2 T- D7 c
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"+ y9 w7 G$ G/ ^" t& ?* C
- .text:24BC2D14 push esi ; hModule# [- g7 R& z% _9 R6 `2 v; J
- .text:24BC2D15 call ds:GetProcAddress' v0 S, C2 @" c) A3 X& y3 O& S( T
- .text:24BC2D1B cmp eax, edi
7 [ b# ~ Y3 B& q5 S5 f( d - .text:24BC2D1D jnz short loc_24BC2D30
# S# W6 ^+ a* {- F7 c0 E+ l - .text:24BC2D1F push esi ; hLibModule
+ d% b4 V/ t: c2 o- m" ? - .text:24BC2D20 call ds:FreeLibrary2 ^9 z' }' o' \9 @, d
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
( R& j; r# p) m* e' W - .text:24BC2D2B jmp loc_24BC2E6D9 ?" R! h9 L; `3 o" f8 @
- .text:24BC2D30 ; ---------------------------------------------------------------------------8 l; C2 q# _2 w/ b3 \
- .text:24BC2D30
4 h4 A* D) L: ~, r7 C3 ]$ @ - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
* r. L- C$ e7 ]1 x. \ - .text:24BC2D30 lea ecx, [ebp+var_8]
% M/ u; b5 _) r - .text:24BC2D33 push edi
+ `3 ~# U$ d/ A. X0 R# b - .text:24BC2D34 push ecx7 k+ S* A* q; _) u' ^
- .text:24BC2D35 push edi* m4 U! p) S0 X3 G7 @' x! n+ r" e
- .text:24BC2D36 call eax1 Z; F, n4 T7 t5 u' X4 U9 a8 q8 _
- .text:24BC2D38 test eax, eax9 o4 o9 T! Z3 G+ A- [4 y6 c
- .text:24BC2D3A jge short loc_24BC2D4D
0 U7 U5 i* r3 [7 e$ I - .text:24BC2D3C push esi ; hLibModule2 E- K/ Z8 |* y' K: e! Q- S
- .text:24BC2D3D call ds:FreeLibrary) T" c6 b( V: J0 K
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
1 c U( {1 p' X+ t* w - .text:24BC2D48 jmp loc_24BC2E6D- w A3 K- V; V; t& J
- .text:24BC2D4D ; ---------------------------------------------------------------------------
& c2 X) g, y# `! c3 O0 w - .text:24BC2D4D
5 D6 O, p9 t% b6 q" I$ ~8 F G6 ? - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
6 i1 q5 n" J |/ d - .text:24BC2D4D mov eax, [ebp+var_8]1 ^7 \0 L0 z$ B; [+ i' L" O0 L; e- W3 _
- .text:24BC2D50 lea edx, [ebp+var_1C]
3 N- [4 Q9 @: j+ r - .text:24BC2D53 push edx
0 J j) v f: W# @5 ?% ~ - .text:24BC2D54 push offset unk_24BC4470
3 l w7 X0 f* N3 x E8 ~8 p. Z - .text:24BC2D59 mov ecx, [eax]+ @- ^1 W5 I3 E; j* J, r+ r
- .text:24BC2D5B push eax4 V2 R9 i, F7 f+ j6 f9 S; F' N
- .text:24BC2D5C call dword ptr [ecx]# V9 ]( C4 O6 `
- .text:24BC2D5E test eax, eax6 \1 D$ x2 q7 z* w. x: c3 ]
- .text:24BC2D60 jge short loc_24BC2D87' S4 K u, D7 c! t
- .text:24BC2D62 mov eax, [ebp+var_8]
, c9 D6 @+ w& [" \/ s; a - .text:24BC2D65 push eax5 C) b4 Z! g. r+ G9 z% X
- .text:24BC2D66 mov ecx, [eax]
: C. M" N: v7 t/ V. ^% ? - .text:24BC2D68 call dword ptr [ecx+8]
2 ]: c) s P0 N7 L+ q - .text:24BC2D6B push esi ; hLibModule: p. C! {& u& \$ I1 J/ B3 Z; v# S
- .text:24BC2D6C call ds:FreeLibrary; ?: i: S X% i* ]$ T3 e: p0 v- n
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"7 x' h4 A9 l+ l7 v6 Y
- .text:24BC2D77 call ds:OutputDebugStringA
5 a8 S! Y* F5 l" O - .text:24BC2D7D mov eax, 100h9 ^$ J( ~; k8 \+ C3 v, f3 [
- .text:24BC2D82 jmp loc_24BC3011& m( H. j1 k" P, L
- .text:24BC2D87 ; ---------------------------------------------------------------------------& v4 \0 d# H, O% ^' m8 I% o3 r, S: r: Z
- .text:24BC2D87) g" W7 H4 B) p6 J4 p
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
+ |2 X& E* Z5 ?1 {# ?5 ] f1 m1 ^ - .text:24BC2D87 mov eax, [ebp+var_1C]' O4 a, `5 U# A* G& @" W, a9 O; K
- .text:24BC2D8A push eax
3 J h8 } d: U# z - .text:24BC2D8B mov ecx, [eax]
' [0 @8 i" M V1 } - .text:24BC2D8D call dword ptr [ecx+8]
6 n7 i! w F7 p; ^$ L! M. u - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
6 V7 S9 J9 a4 p% F0 R0 [ - .text:24BC2D95 call ebx ; LoadLibraryA
. H1 X" j- o8 z1 ^9 D# F" u - .text:24BC2D97 mov esi, eax+ J" g7 s+ b, g1 x$ ~* E4 c
- .text:24BC2D99 cmp esi, edi5 j. ~: \4 A& Z! D9 L
- .text:24BC2D9B jnz short loc_24BC2DB64 K% g) m- N) _* F# `
- .text:24BC2D9D mov eax, [ebp+var_8]
, d$ Y) Z! ?; p3 b8 O* i - .text:24BC2DA0 push eax
3 S# O, i; [2 q8 P1 d6 ? - .text:24BC2DA1 mov ecx, [eax]1 A# R; h0 O; A. D& U6 K/ l( Z
- .text:24BC2DA3 call dword ptr [ecx+8]9 |6 r+ A7 o* v6 j
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule' z* F) r6 J* W6 ?
- .text:24BC2DA9 call ds:FreeLibrary
: ]$ N/ u4 w! F: ` - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
! i: r: y2 G& c; J5 m$ q1 R - .text:24BC2DB4 jmp short loc_24BC2DE2
5 e3 H; A. @' g7 G - .text:24BC2DB6 ; ---------------------------------------------------------------------------+ Z! p( J3 e6 J5 U' m* Z, w. K, ]: H
- .text:24BC2DB6) E; }' N& F" P, G; w
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j( y# ? p$ T4 R" w0 ~" ^' @
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
W1 G9 A, _+ h% U X. ?4 d3 g - .text:24BC2DBB push esi ; hModule/ F+ N" [1 Y7 `- `, D# Z5 z
- .text:24BC2DBC call ds:GetProcAddress
* M* l3 `( h' c+ S - .text:24BC2DC2 push esi ; hLibModule4 P H! j- N' z& E) c! U- O
- .text:24BC2DC3 mov esi, ds:FreeLibrary
# v* ?6 o" i; @ - .text:24BC2DC9 test eax, eax
/ l6 f/ B0 V) w6 c9 Z - .text:24BC2DCB jnz short loc_24BC2DF2/ W1 d/ E9 ^* f
- .text:24BC2DCD call esi ; FreeLibrary" a% t# Z: z8 e8 U9 o3 ]
- .text:24BC2DCF mov eax, [ebp+var_8]. F$ [4 }# n N2 p! d
- .text:24BC2DD2 push eax
* I( _3 k6 S2 ?4 u! f8 I - .text:24BC2DD3 mov ecx, [eax]6 n8 c# H& Y7 T
- .text:24BC2DD5 call dword ptr [ecx+8]
2 M# h: Y/ p; A! U6 O - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule; V; W4 o# I* C* y2 g* b) ]2 L
- .text:24BC2DDB call esi ; FreeLibrary
$ V6 v4 u1 j @% T; e) t9 B - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...6 f9 J9 j) N; ^5 ?. q7 a0 `" [# ?5 g% m
- .text:24BC2DE2- l& U! n* W3 U# F1 G) M2 d
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
6 }. a( d* j, ?2 U4 c - .text:24BC2DE2 call ds:OutputDebugStringA
3 t. I/ ?4 r% G! w( I! M/ B - .text:24BC2DE8 mov eax, 200h
4 u& X; H) ~* Q A( D - .text:24BC2DED jmp loc_24BC3011
9 g% t+ C* o& I) u - .text:24BC2DF2 ; ---------------------------------------------------------------------------
1 Y9 p8 m/ u. ~0 q0 c2 Q* Z - .text:24BC2DF2
4 e7 k( |2 b( n- y. W, x! T6 V) e - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j9 F/ C$ n2 j7 l2 |0 G+ o1 C
- .text:24BC2DF2 call esi ; FreeLibrary
1 e2 p: i; W, f! u) s3 a4 s - .text:24BC2DF4 push 6Ch ; Size
: @% h; y* f4 I7 F - .text:24BC2DF6 lea eax, [ebp+Dst] ^# Y2 L* i4 a C6 k( P5 l
- .text:24BC2DFC push edi ; Val
% A8 O" w# \% V4 X" ]/ y8 o - .text:24BC2DFD push eax ; Dst
9 ]; [$ I* o% U) o' P" P) R& c7 z - .text:24BC2DFE call memset
# J. c. j* q9 y& v$ d - .text:24BC2E03 mov eax, [ebp+var_8]
% R/ \$ h1 A/ P3 M - .text:24BC2E06 add esp, 0Ch
; i) t' u2 y! ], u2 ?- v0 n3 U - .text:24BC2E09 mov [ebp+Dst], 6Ch1 @+ y/ t* ]* o
- .text:24BC2E13 mov [ebp+var_8C], 1
, j6 K0 X) c# Y; B# y - .text:24BC2E1D mov [ebp+var_28], 200h
+ c2 C4 v: H6 _8 L - .text:24BC2E24 mov ecx, [eax]0 b2 L( G+ B6 F4 R( F: @" u
- .text:24BC2E26 push 8/ B: j; V# F5 U! r8 a/ r2 l
- .text:24BC2E28 push edi, F" i; }/ ~& q1 O$ _7 H" W
- .text:24BC2E29 push eax/ x, c7 U! a; j3 @- M
- .text:24BC2E2A call dword ptr [ecx+50h]
5 x: v$ F1 D, `& \! K - .text:24BC2E2D test eax, eax- l- N( `8 ~+ ~" y6 i9 l* ^# w
- .text:24BC2E2F mov eax, [ebp+var_8]; V! G, |% m( a8 M1 e
- .text:24BC2E32 mov ecx, [eax]
P' n9 A: y; g+ u - .text:24BC2E34 jge short loc_24BC2E46: x" d/ v$ W: L- {6 O
- .text:24BC2E36 push eax% [2 M" ? I7 ?! ^, h* O( D' |
- .text:24BC2E37 call dword ptr [ecx+8]1 L5 H6 s2 C& O% ^2 Q! J
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule. ~, ^/ Z1 K0 W. e K2 K
- .text:24BC2E3D call esi ; FreeLibrary
2 ^# N0 |" U+ d% V - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
0 a5 l/ ?( W% v" X1 [9 ]1 r/ F5 @ - .text:24BC2E44 jmp short loc_24BC2E6D
) a3 Y3 V& t$ Q' B0 `; [# i& G - .text:24BC2E46 ; ---------------------------------------------------------------------------( A' W5 L" s( G7 R, h5 p
- .text:24BC2E46; |* T3 w/ v+ f. I+ t: u; r+ H
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
( O! h9 A" `+ A. ?- l - .text:24BC2E46 lea edx, [ebp+var_C]
& _' l/ c1 f& A - .text:24BC2E49 push edi
5 ?/ m0 q5 w3 T3 [" i - .text:24BC2E4A push edx9 g0 Q$ n4 X5 X/ x0 C5 K. b% R
- .text:24BC2E4B lea edx, [ebp+Dst]+ v5 G, {3 A/ e: Y. Q" p- Y9 x
- .text:24BC2E51 push edx
! K. s( j$ c) f1 w1 B - .text:24BC2E52 push eax
5 y: t5 g9 o4 V: L& L2 h( s - .text:24BC2E53 call dword ptr [ecx+18h]0 G Z! I0 _$ ~9 O+ m. \" T; z
- .text:24BC2E56 test eax, eax
% b3 ^/ |4 a4 h8 L6 z - .text:24BC2E58 jge short loc_24BC2E7A
R% |, ~$ H: _# B9 l. {4 x - .text:24BC2E5A mov eax, [ebp+var_8]$ I( i% y3 v/ K$ y5 p" {: I# r
- .text:24BC2E5D push eax
% \: c: f6 K/ Y& O' S# Q - .text:24BC2E5E mov ecx, [eax]
8 n4 ^5 V, _3 T1 s - .text:24BC2E60 call dword ptr [ecx+8]% W* k" Z+ Z7 _+ l( ]5 a
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule, ^. A( y8 _. c2 l
- .text:24BC2E66 call esi ; FreeLibrary
6 Q7 |- [. x+ ?. v - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
1 j1 M: }# ~- V1 ~' H* c - .text:24BC2E6D) h/ T. S9 }1 B3 K# u. O1 H
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j1 ^% Q; P* I' `/ C
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
6 {# @& B2 {) a% V3 Y) Y. {2 x& l - .text:24BC2E6D call ds:OutputDebugStringA2 Y4 r5 r! R) M. ^) h
- .text:24BC2E73 xor eax, eax
& T" r9 ~( ]1 y$ q4 q5 X# ~2 Y7 P - .text:24BC2E75 jmp loc_24BC30114 a$ T4 o ]) q% ~; e# j/ |
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 2 u1 ?1 U2 [4 P2 e9 O
^. P4 |' L: e/ ?3 K# T
7 J# M' c; X `6 j9 v$ A1 m
|