这游戏以前分析过,本贴再写得详细一些。/ J' | J$ c. j1 x2 v# K% H
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,4 O) J5 u0 V7 S0 p |
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。- T1 G, e/ E! R7 W4 ^
' P' }+ `- @3 m: R7 w
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.% I5 E* u% C1 L$ [
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;- B- H+ V8 ?) r m/ H, X" O
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;
( x5 [6 V$ z0 ` - STDMETHOD_(ULONG,Release) (THIS) PURE;. @+ z; I1 G' _$ e7 f
- STDMETHOD(Compact)(THIS) PURE;8 J! E4 `( x0 d3 m, w
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;+ L% T+ T" @& _0 t0 |; S3 m6 C
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;( m9 l# J$ X, {: j+ X" H
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 ' h. x+ L) e/ o5 v; _$ A& G3 Z
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 / @6 l7 R" b5 u, l, k2 L" n
) X3 o$ W8 t3 O/ D! @4 W
$ a) {# {7 J M) C0 p' [
! q. `8 u% N; ^% T- # O, e2 x! o$ C i
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================5 R. ]$ {: V* X8 i7 P0 K! Y
- .text:24BC2CD2, r! Q' ?! q# _4 g! Q: J' l: U
- .text:24BC2CD2 ; Attributes: bp-based frame
( V m; A% ^! f( c" p - .text:24BC2CD2- O" e; N! c5 Y* y
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p, N0 @- [% {5 ?9 s$ ]7 Y1 F* p) [ M8 o
- .text:24BC2CD2
4 y! L3 q+ f/ R8 _ - .text:24BC2CD2 Dst = dword ptr -90h9 v8 M/ ~- R* f+ _3 r; H
- .text:24BC2CD2 var_8C = dword ptr -8Ch5 W$ ~! Q0 T) O/ b
- .text:24BC2CD2 var_28 = dword ptr -28h
. e( r5 }: }8 i) t" d - .text:24BC2CD2 var_24 = dword ptr -24h% l- u N4 Z, }3 L ]0 o' M
- .text:24BC2CD2 var_20 = dword ptr -20h
* M/ h9 e8 L5 `1 m - .text:24BC2CD2 var_1C = dword ptr -1Ch
) n( B% I* f2 s" ~6 N - .text:24BC2CD2 var_18 = dword ptr -18h* I1 Z( J3 ~9 O& C) X
- .text:24BC2CD2 ppv = dword ptr -14h
( n1 u* o4 W- Y- I - .text:24BC2CD2 var_10 = dword ptr -10h
9 i. e0 ^+ s8 l" Z - .text:24BC2CD2 var_C = dword ptr -0Ch! m$ f$ Z7 I; b: D; A+ h
- .text:24BC2CD2 var_8 = dword ptr -8" j g) _; p+ G' v' ]
- .text:24BC2CD2 hLibModule = dword ptr -4
8 j1 R% w3 U# z% |' N2 C - .text:24BC2CD2
- r" c8 s+ H0 i0 [) m4 C - .text:24BC2CD2 push ebp7 Q3 }, H6 I' `" O4 ?( O, L# o
- .text:24BC2CD3 mov ebp, esp5 v @- e* z, V c
- .text:24BC2CD5 sub esp, 90h5 k$ s0 }7 f. W1 `; O
- .text:24BC2CDB push ebx
1 s2 b# K2 L% n+ L/ V. Z6 @ - .text:24BC2CDC mov ebx, ds:LoadLibraryA- U- o( P2 p. h6 J! V* q
- .text:24BC2CE2 push esi# h" v( p& ?& E( P
- .text:24BC2CE3 push edi M/ y# S, ?2 k
- .text:24BC2CE4 xor edi, edi
# s4 O _* F: |$ T - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"0 w3 q1 J" \2 J3 }, k9 ?2 V/ J
- .text:24BC2CEB mov [ebp+var_8], edi4 T$ n7 X5 `# \" _* [
- .text:24BC2CEE mov [ebp+var_1C], edi
# x2 b2 x; ^ H! q - .text:24BC2CF1 mov [ebp+var_C], edi9 }8 n |/ v" P$ L" b3 M5 ]9 s+ M0 J# N
- .text:24BC2CF4 mov [ebp+var_10], edi" A3 l- C; I" h( O3 T9 F% b: ?. \
- .text:24BC2CF7 mov [ebp+var_18], edi
' ^% T0 i; L. Z( L& I- w/ t - .text:24BC2CFA call ebx ; LoadLibraryA
4 ?7 J1 }! z4 ~- B& k - .text:24BC2CFC mov esi, eax" C+ c$ F! M$ _; Q5 Z, ?4 s! z
- .text:24BC2CFE cmp esi, edi6 i* y& D* _# L9 |% r
- .text:24BC2D00 mov [ebp+hLibModule], esi
1 g% p+ g! \! Z, W% q - .text:24BC2D03 jnz short loc_24BC2D0F
+ |' N& f/ k# L- a0 v$ W - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
9 X/ [3 L9 H7 j - .text:24BC2D0A jmp loc_24BC2E6D
" t b" l9 A) ]% N! } Z - .text:24BC2D0F ; ---------------------------------------------------------------------------
8 v6 q$ B; b- K* v( C - .text:24BC2D0F
5 O7 g4 f) S# w5 f0 k - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
& j/ ~" j& L: r - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"; F$ n v1 n8 l; k
- .text:24BC2D14 push esi ; hModule
+ I1 X0 Q; g/ R* k - .text:24BC2D15 call ds:GetProcAddress
% g- `( p' j1 K: a9 k! Z - .text:24BC2D1B cmp eax, edi
) a7 B' C) {5 p. B+ Y4 M, l$ m8 p8 { - .text:24BC2D1D jnz short loc_24BC2D30/ d7 v$ R; H6 x$ l
- .text:24BC2D1F push esi ; hLibModule
' A% m& S' v `% h+ ?/ c) m. ~ - .text:24BC2D20 call ds:FreeLibrary$ p7 q/ h3 u' d* i8 |( a- }: L
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
# Q9 x2 C% b; F' `" | - .text:24BC2D2B jmp loc_24BC2E6D7 C$ b. [7 d& D L. f3 g
- .text:24BC2D30 ; ---------------------------------------------------------------------------' n4 |- {$ m$ {" I% S: J7 O
- .text:24BC2D30
- s" B5 A3 a0 a& Y - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
0 |, l. {0 j- ?# @3 o - .text:24BC2D30 lea ecx, [ebp+var_8]3 {; V J' d( B! C6 v
- .text:24BC2D33 push edi
5 W! E/ c i6 U6 ]: }# H3 d - .text:24BC2D34 push ecx
* t7 ?. U$ W- u; E$ I. ] - .text:24BC2D35 push edi# l3 g4 @$ m/ B/ ?
- .text:24BC2D36 call eax: j' w+ Q0 o$ Z# h" [' C6 D4 `
- .text:24BC2D38 test eax, eax; T, c7 o( l+ X/ T" v! Y
- .text:24BC2D3A jge short loc_24BC2D4D0 P6 j8 G& W8 o2 @% S
- .text:24BC2D3C push esi ; hLibModule& S3 I7 ]+ S2 }4 T
- .text:24BC2D3D call ds:FreeLibrary G! g! u- A" k# I
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"& s2 W5 u/ I. R3 O S
- .text:24BC2D48 jmp loc_24BC2E6D) H% y' ]' L, @, d$ O, `
- .text:24BC2D4D ; ---------------------------------------------------------------------------
1 m& J0 J, l; h% F: ^7 J - .text:24BC2D4D9 R( u# t: g( c, H9 T
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
: M: e# x5 \+ m* [% F% ~+ U- r0 a/ O! m$ ]1 j - .text:24BC2D4D mov eax, [ebp+var_8]
3 @! k3 ^$ B! f E" _2 B - .text:24BC2D50 lea edx, [ebp+var_1C]
" G9 y2 z4 _8 ^' ?! U' ~ \% W - .text:24BC2D53 push edx
/ d2 k! }( a5 {+ K2 Z( |' X - .text:24BC2D54 push offset unk_24BC44702 K7 j+ j: `0 p, e- A
- .text:24BC2D59 mov ecx, [eax]
/ H' A6 A" N4 N* t8 i - .text:24BC2D5B push eax
3 X/ U& T8 |2 B' I) |- F+ N - .text:24BC2D5C call dword ptr [ecx]6 Q3 T" R" j! t5 [+ k0 p- h
- .text:24BC2D5E test eax, eax
) q: J2 _" {" c! ?8 U) g: v; V - .text:24BC2D60 jge short loc_24BC2D87
6 Z- o0 }% i. F4 Y) l7 X6 q5 R# Z - .text:24BC2D62 mov eax, [ebp+var_8], O+ u, {3 J7 n
- .text:24BC2D65 push eax
/ r; I( h0 [: ?; n6 [5 a% b! { - .text:24BC2D66 mov ecx, [eax]
+ G% v* g4 Q/ T9 }# h6 y) x F - .text:24BC2D68 call dword ptr [ecx+8]
0 H$ t* G5 A7 C - .text:24BC2D6B push esi ; hLibModule
' M4 c& g1 K; Y' W - .text:24BC2D6C call ds:FreeLibrary
8 o$ W2 X1 _7 d: t1 n; v' v Q - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
$ n3 K' f$ D( Q* v9 p - .text:24BC2D77 call ds:OutputDebugStringA. j, Z! J4 Q1 D* K0 `9 q
- .text:24BC2D7D mov eax, 100h
, ], U& z' [; d, @4 z: l+ ~ - .text:24BC2D82 jmp loc_24BC3011
8 Y3 o p. T5 _, h! q K - .text:24BC2D87 ; ---------------------------------------------------------------------------9 u" R) A3 b! n5 i4 u
- .text:24BC2D87/ K4 f# f5 N9 T [0 R( A! K
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j G9 P8 A* l5 R6 E& o
- .text:24BC2D87 mov eax, [ebp+var_1C]9 W, l; A+ `& a2 A' j7 y! K
- .text:24BC2D8A push eax
2 X0 X! Q* c; Y, \3 K4 p( t - .text:24BC2D8B mov ecx, [eax]* c; [7 m* E5 H
- .text:24BC2D8D call dword ptr [ecx+8]7 ~& P: E& b* K
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
$ e2 H0 E7 a( q- ` - .text:24BC2D95 call ebx ; LoadLibraryA" f$ g& m9 w6 }' K7 R- `7 m
- .text:24BC2D97 mov esi, eax
: n. m, O5 E( _( A1 j- H - .text:24BC2D99 cmp esi, edi
X& L* N& [; _) v5 ] M/ H - .text:24BC2D9B jnz short loc_24BC2DB69 ?5 k) I3 F& u( |0 `$ W) w
- .text:24BC2D9D mov eax, [ebp+var_8]
$ B& C" \! C# t - .text:24BC2DA0 push eax" G8 t/ Z9 n6 s: D; s
- .text:24BC2DA1 mov ecx, [eax]9 V4 \; N+ G* B3 ^) w
- .text:24BC2DA3 call dword ptr [ecx+8]) i u7 ^! Q, ]9 ]
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule9 H3 C- g4 |: `2 i" p
- .text:24BC2DA9 call ds:FreeLibrary
1 t0 R/ F# [* Z& ]* g" h - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"- R, q3 R% b+ S8 s0 ^ c
- .text:24BC2DB4 jmp short loc_24BC2DE2
& ?, h; x8 ?6 Z# t/ e# x, L - .text:24BC2DB6 ; ---------------------------------------------------------------------------
& W3 @0 T/ u! a$ T! q% n - .text:24BC2DB6; S) l7 D, V# |" U+ e# u
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
; O3 z8 d8 j ?& j: f. P- O1 F - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA" N; {( l+ W2 T
- .text:24BC2DBB push esi ; hModule
6 {! Y) v2 j! a; F7 _ S9 m$ F* @ - .text:24BC2DBC call ds:GetProcAddress
& j8 X( k6 q; S4 M" E: N - .text:24BC2DC2 push esi ; hLibModule
: }; q; @3 ?' T- X. M( m - .text:24BC2DC3 mov esi, ds:FreeLibrary2 n4 U' a# C+ v
- .text:24BC2DC9 test eax, eax8 x0 h$ o- R# f+ _: h
- .text:24BC2DCB jnz short loc_24BC2DF27 ^+ o7 V' ^( [: u9 x) O$ S4 `
- .text:24BC2DCD call esi ; FreeLibrary
- H8 n/ J% k$ m( g3 f& c& O - .text:24BC2DCF mov eax, [ebp+var_8]
7 R1 H' V S3 o4 V+ v) F - .text:24BC2DD2 push eax0 ~% C% Z7 @0 e; e7 K- g. O* _, U- z
- .text:24BC2DD3 mov ecx, [eax]
- Z* @) c( A- L2 u7 } - .text:24BC2DD5 call dword ptr [ecx+8]$ [/ G! b. K6 A' d3 F
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
: }+ B1 U/ a5 R - .text:24BC2DDB call esi ; FreeLibrary$ \* ^+ `1 Y, Y. }% K( ?; h4 P+ g9 p$ h8 M
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"..., l! v+ C, r: w) z2 j$ g' H/ U
- .text:24BC2DE22 s5 m& L' R: z( {
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
/ z4 h3 w! S' ?4 y7 x9 p - .text:24BC2DE2 call ds:OutputDebugStringA* O- J' a/ t' d7 Z
- .text:24BC2DE8 mov eax, 200h4 L2 Y# H0 A8 O6 k' B9 ~' I
- .text:24BC2DED jmp loc_24BC3011
" F& b: Y$ L6 x" V4 c3 l - .text:24BC2DF2 ; ---------------------------------------------------------------------------
2 W6 M7 J" J0 _8 C% ?1 A' g) n - .text:24BC2DF27 y' i3 }9 C0 [6 E% J2 G
- .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
% [* ~& `( x! N6 T7 r - .text:24BC2DF2 call esi ; FreeLibrary: z# c" C, C l' `; p8 ^
- .text:24BC2DF4 push 6Ch ; Size
; W) x5 S3 F! {6 G - .text:24BC2DF6 lea eax, [ebp+Dst]2 ?! x+ p2 { i7 D- F
- .text:24BC2DFC push edi ; Val
7 v: ^5 {4 `% u% s3 v - .text:24BC2DFD push eax ; Dst6 ~: a4 c/ o3 p3 W9 S
- .text:24BC2DFE call memset w4 A' v- g0 s* R6 {1 l
- .text:24BC2E03 mov eax, [ebp+var_8]
z7 B; N$ g0 D2 O* U; U - .text:24BC2E06 add esp, 0Ch& t. u( X( c2 A' D( a
- .text:24BC2E09 mov [ebp+Dst], 6Ch3 `, K2 l3 e9 t3 C9 K" n
- .text:24BC2E13 mov [ebp+var_8C], 1
8 M0 ?; n: R/ N/ |3 C - .text:24BC2E1D mov [ebp+var_28], 200h& o' J) |" x0 E: t3 m
- .text:24BC2E24 mov ecx, [eax]
~# p: J1 s& @7 ~* F - .text:24BC2E26 push 8! x/ U/ ^- B; {$ p- _
- .text:24BC2E28 push edi5 R$ I* G( H5 T5 X) T z
- .text:24BC2E29 push eax
; i" Y/ u8 n. ]+ M# _8 U' P - .text:24BC2E2A call dword ptr [ecx+50h]
3 [! b( {4 l5 f$ C% ^& K9 I - .text:24BC2E2D test eax, eax
. q+ I" L0 E1 J: m9 ~ - .text:24BC2E2F mov eax, [ebp+var_8]
! X+ s' W ^ g& j0 C) f& U6 t9 I6 g - .text:24BC2E32 mov ecx, [eax]/ m$ \. \2 R1 [, C
- .text:24BC2E34 jge short loc_24BC2E46. |5 J4 ]" w9 P, ^1 A5 I9 E
- .text:24BC2E36 push eax
( f h f/ }# g/ _ r6 w& c - .text:24BC2E37 call dword ptr [ecx+8]7 p6 Z6 w, a ?
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
1 _% h5 x, N2 o$ I - .text:24BC2E3D call esi ; FreeLibrary9 l; L6 b Z5 |) G+ L
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"8 ^, N1 o" s" n+ C9 l! a' A
- .text:24BC2E44 jmp short loc_24BC2E6D
+ Y/ V# q5 i- [) B, ?; Y+ q- T - .text:24BC2E46 ; ---------------------------------------------------------------------------
# d# f- W% y( k l/ g* [2 Y8 V - .text:24BC2E46$ a; A7 M9 ]" C, D( w
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j z; A, r! A- D+ u1 f9 ?- V
- .text:24BC2E46 lea edx, [ebp+var_C]* o7 L: v$ N( O2 }' i! x$ S
- .text:24BC2E49 push edi7 @: R2 G1 \# |4 H/ S3 D+ m
- .text:24BC2E4A push edx
. I5 Y8 ]# |' X& C - .text:24BC2E4B lea edx, [ebp+Dst]) {+ `/ [4 p8 ?! @5 U
- .text:24BC2E51 push edx# y- { y/ b1 D/ t
- .text:24BC2E52 push eax
5 x! `6 z5 \7 Q* b, W x3 m - .text:24BC2E53 call dword ptr [ecx+18h]9 T0 W2 x" c2 ^. y" |' K
- .text:24BC2E56 test eax, eax
% s- M9 f2 ^1 q/ Q! p - .text:24BC2E58 jge short loc_24BC2E7A
- |/ ~" q' ^' i' h - .text:24BC2E5A mov eax, [ebp+var_8]3 d% t6 Q6 L, W. B! p Q
- .text:24BC2E5D push eax& h+ @ p1 |, p
- .text:24BC2E5E mov ecx, [eax]
- C% D0 H# m Y: u# Q; N& O' g4 F - .text:24BC2E60 call dword ptr [ecx+8]
! j7 s% U1 q+ p - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule/ x7 ]2 g1 z: M% A G' {; S; S3 h
- .text:24BC2E66 call esi ; FreeLibrary. X% k3 i' ?" H8 ^( ~) t9 J, k" h
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
$ m; ~ g4 n N/ u) a - .text:24BC2E6D
& b& l4 p$ M( m3 K: \ - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j" q- v' {1 z; w. p: ^' d: i
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
6 x* e/ z, E, D2 A, \ m - .text:24BC2E6D call ds:OutputDebugStringA
" A0 e" W) E+ \; F5 R; ~ - .text:24BC2E73 xor eax, eax& }9 P$ G% q+ z) m# ?: L W
- .text:24BC2E75 jmp loc_24BC3011
+ b9 `& C. {5 m3 O - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ! T) G6 I( s! |8 `! F
- n& b- G- O' O1 h# U; X
0 T( @' f# c3 \' N' l1 v) Z. a |