这游戏以前分析过,本贴再写得详细一些。
/ V" a6 o1 d9 v/ L这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,$ w* A( W4 ?3 s' p7 y* k3 h ^0 r
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。/ k+ @1 n5 G* \
$ O3 _3 o2 H! \
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.3 d0 M! u$ O/ o' [% v; l( D: i$ m
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;+ J8 c9 U& z4 y# u7 W
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;% y, {* e7 x+ ~5 K6 a% S }
- STDMETHOD_(ULONG,Release) (THIS) PURE;# U$ M: e9 u$ e+ ?. ]# H
- STDMETHOD(Compact)(THIS) PURE;
. }6 c, T K9 w, Q, Y - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;' H9 D- p* c/ @. L: E* l- H- s
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;) U6 T5 @8 N. n: m' ^, o6 B( l
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 * V! V" c9 R7 A( V( N) e4 w( x7 V
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
$ l6 o6 a- Q$ r4 o- \7 [) c: k' Q( T9 O) L) x1 L. X6 |: ?
4 [ H9 _3 |- H% f! x* T" s) r+ X& a s% P
- S% [# v0 b* k, v& N* p- 7 @- e4 |2 M1 g/ O
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
7 [+ v9 w; J: Q% V" D7 M - .text:24BC2CD2
% f4 r5 X, p7 }, j# U: ?6 M - .text:24BC2CD2 ; Attributes: bp-based frame$ t' x/ T5 D& D9 @# q! x. I
- .text:24BC2CD2
# B8 J! t4 E- w0 E6 d# x" q - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p- e$ v/ z# ~( E
- .text:24BC2CD2
7 ^/ ~0 V$ a2 | - .text:24BC2CD2 Dst = dword ptr -90h* e3 F+ r) p3 H* M. @
- .text:24BC2CD2 var_8C = dword ptr -8Ch7 v( k! q" R, n& U4 H
- .text:24BC2CD2 var_28 = dword ptr -28h# \9 x4 v1 C9 ]
- .text:24BC2CD2 var_24 = dword ptr -24h, g. K9 o, Y. p4 v/ j0 @2 c y
- .text:24BC2CD2 var_20 = dword ptr -20h
9 I# y" t: A, a - .text:24BC2CD2 var_1C = dword ptr -1Ch
8 W! Y7 F- X* L! _5 O) ` - .text:24BC2CD2 var_18 = dword ptr -18h
9 A& }, e% r' _0 a7 f- D - .text:24BC2CD2 ppv = dword ptr -14h
6 ]# T$ m5 A. F w - .text:24BC2CD2 var_10 = dword ptr -10h+ C/ y2 u; b5 M- M
- .text:24BC2CD2 var_C = dword ptr -0Ch
. O. ]3 t- s) e- w. N7 [7 m - .text:24BC2CD2 var_8 = dword ptr -8
: o1 k. A k- `0 H3 s: L, W0 I; P - .text:24BC2CD2 hLibModule = dword ptr -4
1 _( l% a v# I* b3 N7 {, l - .text:24BC2CD2
$ j- V: R% m O, D - .text:24BC2CD2 push ebp
$ s4 O$ ?+ i& j3 F5 m. r3 g$ `. `+ g - .text:24BC2CD3 mov ebp, esp
9 b5 h8 q0 n4 P* N - .text:24BC2CD5 sub esp, 90h$ Z+ J- T8 a! o7 }' o
- .text:24BC2CDB push ebx3 T3 n5 S/ F4 {; m0 R3 V& P
- .text:24BC2CDC mov ebx, ds:LoadLibraryA
6 ], r) ~ @) o" z/ M& N b - .text:24BC2CE2 push esi
1 l5 h5 P1 ]6 |0 d - .text:24BC2CE3 push edi
. h4 I1 v; e% c0 }4 @( x - .text:24BC2CE4 xor edi, edi
, {) _1 p4 F7 j1 V2 `% B - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"( h: _+ u3 T o4 o- @$ F
- .text:24BC2CEB mov [ebp+var_8], edi
/ d1 z. B# `9 T7 c - .text:24BC2CEE mov [ebp+var_1C], edi
5 j/ X+ E3 d0 Z& d) I. C - .text:24BC2CF1 mov [ebp+var_C], edi1 a6 B7 J3 c$ D, d
- .text:24BC2CF4 mov [ebp+var_10], edi! s7 z1 V0 n, z a5 u7 s/ d
- .text:24BC2CF7 mov [ebp+var_18], edi' G' v7 S+ e/ U) w* q e4 r
- .text:24BC2CFA call ebx ; LoadLibraryA4 ~' ]6 H! Q/ H
- .text:24BC2CFC mov esi, eax
) V& b& R" E( x8 g+ B/ r9 p1 {" v - .text:24BC2CFE cmp esi, edi
% N% `5 B& D9 U' A9 c - .text:24BC2D00 mov [ebp+hLibModule], esi
* {0 I2 S/ {! g. x; j - .text:24BC2D03 jnz short loc_24BC2D0F6 m ?" K z$ i7 }0 I
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"8 \4 i& w7 f7 q6 X. L' h- E
- .text:24BC2D0A jmp loc_24BC2E6D
8 K% d+ ~4 {' w - .text:24BC2D0F ; ---------------------------------------------------------------------------* i* G3 V: Q+ A4 u+ q
- .text:24BC2D0F
) y( p* y+ A4 y* z - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
5 R) n9 E9 \( s1 z* ~' ?! K- U - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
/ I( K' s1 W% y. W - .text:24BC2D14 push esi ; hModule
# h0 c; N/ b% l& q, Y' Y g - .text:24BC2D15 call ds:GetProcAddress5 c: o! k2 f3 {, x! g5 ~
- .text:24BC2D1B cmp eax, edi
/ N0 K9 d+ p0 ?, N. k - .text:24BC2D1D jnz short loc_24BC2D30( j# v3 Z9 F" x# q, [
- .text:24BC2D1F push esi ; hLibModule' K4 ^' s. d- s% z1 t1 S2 S8 _
- .text:24BC2D20 call ds:FreeLibrary @4 R# a% F* z: s" ]5 c
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...! k! @& u& n# \1 h
- .text:24BC2D2B jmp loc_24BC2E6D
0 Q* ?$ m/ P5 q - .text:24BC2D30 ; ---------------------------------------------------------------------------
4 V2 w: H6 J, i! I0 U - .text:24BC2D30
' p5 z- X' V& I# A, U - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j. D Y# a8 k* w2 Q/ {+ J( Z
- .text:24BC2D30 lea ecx, [ebp+var_8]
0 M2 w# `4 p/ D$ n$ K( n) S - .text:24BC2D33 push edi
$ Z6 U8 ]8 {2 Y' { - .text:24BC2D34 push ecx' `( e6 d4 U9 X+ f
- .text:24BC2D35 push edi' Z/ g& J$ B- c% }: n
- .text:24BC2D36 call eax" _0 p. `7 m0 w1 O) g9 K$ n: `2 G
- .text:24BC2D38 test eax, eax. r: p; {- ~2 \: i% O( i8 c
- .text:24BC2D3A jge short loc_24BC2D4D8 k7 ^; x1 t' R J( W0 h
- .text:24BC2D3C push esi ; hLibModule
: }# Q! w. r" G - .text:24BC2D3D call ds:FreeLibrary6 p C$ f O, |7 I0 _
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
t' R w7 l2 a* e6 x3 Z - .text:24BC2D48 jmp loc_24BC2E6D
2 e& W5 I1 K, N* H6 V - .text:24BC2D4D ; ---------------------------------------------------------------------------
* |# G% o/ ~2 K% B0 c1 f- h - .text:24BC2D4D
) P5 H. X/ q. h* [$ y - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
" }! O1 E8 C; P0 W - .text:24BC2D4D mov eax, [ebp+var_8]
0 f- h2 R) \3 j - .text:24BC2D50 lea edx, [ebp+var_1C]+ g' S- t7 L3 d% W4 K
- .text:24BC2D53 push edx
5 u/ E8 l5 l6 u7 _0 B7 Y! A! S& `& h - .text:24BC2D54 push offset unk_24BC4470& x' v7 j) J4 V# X8 B' s
- .text:24BC2D59 mov ecx, [eax]
$ ^! _) B! c- L+ C - .text:24BC2D5B push eax
7 B# ^7 R4 G s2 f - .text:24BC2D5C call dword ptr [ecx]
- `. `; Y+ G0 L( f - .text:24BC2D5E test eax, eax" E5 v5 v+ E- K6 l- S5 L
- .text:24BC2D60 jge short loc_24BC2D875 F3 V& `" l0 ~8 V: r
- .text:24BC2D62 mov eax, [ebp+var_8]; t& D5 d; P+ x# A% H6 T
- .text:24BC2D65 push eax0 y1 X0 M: O% ^, G
- .text:24BC2D66 mov ecx, [eax]" m$ P5 b, l& y. y( {0 J1 ^6 S6 I
- .text:24BC2D68 call dword ptr [ecx+8]
8 J9 P0 Y/ g" E7 @" f7 c% [ - .text:24BC2D6B push esi ; hLibModule; y4 I8 Z+ \, w" E# _" z
- .text:24BC2D6C call ds:FreeLibrary
: S! i- R) K7 O9 Z7 `- N+ ~6 L1 I. ? - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"0 y5 C9 D+ Z; ]; u' [# d& i
- .text:24BC2D77 call ds:OutputDebugStringA2 C7 c7 b) |; d3 A9 C# k
- .text:24BC2D7D mov eax, 100h% s1 s7 F0 T; d3 H! T
- .text:24BC2D82 jmp loc_24BC3011
6 K4 a- b. P( Z6 V" Q9 X. ]' Q - .text:24BC2D87 ; --------------------------------------------------------------------------- U* l1 k3 j$ a a: b
- .text:24BC2D87
0 I+ P1 d# T ]2 B! _ - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
, Z. U) }9 E5 u5 g \& k - .text:24BC2D87 mov eax, [ebp+var_1C]
8 V$ P6 A2 b4 [! Q5 O+ y: n - .text:24BC2D8A push eax
9 i/ A& O. T3 h0 d+ c - .text:24BC2D8B mov ecx, [eax]
) v7 n- A1 r% o( U/ P* } - .text:24BC2D8D call dword ptr [ecx+8] g. ?3 f& S' q" N/ j; v: c
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
( n+ I/ s: w+ e6 h$ u) z& n - .text:24BC2D95 call ebx ; LoadLibraryA
1 o y% r6 d- l/ D5 s4 R, ~ - .text:24BC2D97 mov esi, eax/ j0 c! p1 P# n
- .text:24BC2D99 cmp esi, edi% F4 M( Y6 f& _1 D9 J( A7 `
- .text:24BC2D9B jnz short loc_24BC2DB61 ~5 \2 H% G: H) f/ e2 H
- .text:24BC2D9D mov eax, [ebp+var_8]9 O% m& b! U2 A& u/ e
- .text:24BC2DA0 push eax5 e" x; F- G" W4 l! a' Q
- .text:24BC2DA1 mov ecx, [eax]9 ^) A/ @5 N( I* F, n s9 ~
- .text:24BC2DA3 call dword ptr [ecx+8]2 y: j+ s) |1 ?- l3 S, d$ U/ a
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule; x# g* I+ a$ M; x6 Q
- .text:24BC2DA9 call ds:FreeLibrary( k: s. h* m4 v+ x* w
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
1 j$ B8 g; a9 a- ^3 v G# D/ V7 I - .text:24BC2DB4 jmp short loc_24BC2DE22 G3 g+ P4 @ z T( l8 t
- .text:24BC2DB6 ; ---------------------------------------------------------------------------: M4 z, H+ _) y+ A, p) G& b
- .text:24BC2DB6
# }' r% e C1 V/ N/ I- N- L - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j$ S/ ` g6 j W M7 E: ]
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"( Z! ~2 C8 a2 O% V- y0 p2 f* H K
- .text:24BC2DBB push esi ; hModule' L; t5 M* g1 X& }5 j. X
- .text:24BC2DBC call ds:GetProcAddress
& R: u8 N/ T. I0 h0 U - .text:24BC2DC2 push esi ; hLibModule
! m1 |$ |* `, m+ n! H - .text:24BC2DC3 mov esi, ds:FreeLibrary
1 ~2 E2 p" Z ^# Q+ J3 b - .text:24BC2DC9 test eax, eax0 w1 G2 Z9 d8 t' m: h7 G
- .text:24BC2DCB jnz short loc_24BC2DF2
1 i0 C" |1 T' _7 x9 @ - .text:24BC2DCD call esi ; FreeLibrary
& | W' D/ C$ |# U( a - .text:24BC2DCF mov eax, [ebp+var_8], ~3 r8 F2 ~4 @/ ~; X5 I2 o7 T
- .text:24BC2DD2 push eax% P2 x6 n- _7 M
- .text:24BC2DD3 mov ecx, [eax]
5 [( U. O6 n4 {4 T - .text:24BC2DD5 call dword ptr [ecx+8]' u+ q$ T* I: E% V/ L. b! G
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
5 Z; R2 t5 r5 v3 V7 q% G- c9 O - .text:24BC2DDB call esi ; FreeLibrary
% K1 |8 |3 v+ Y" F, F$ m - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
2 m5 c8 d9 ^0 R* M% o" @6 e% f - .text:24BC2DE26 }% E% x* Q: [5 ^& R7 G& B
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j, i. Y" L7 ]( n3 N _$ j
- .text:24BC2DE2 call ds:OutputDebugStringA4 [, E( B, {0 H
- .text:24BC2DE8 mov eax, 200h
% R) ?7 p# p1 P& g1 C0 ]' i - .text:24BC2DED jmp loc_24BC3011
' _* b c6 P6 c5 B/ s. m" J - .text:24BC2DF2 ; ---------------------------------------------------------------------------
5 s$ Q. R" E0 q% i# g - .text:24BC2DF2
- ^. ?$ v9 L; U" G3 y; y% J& ~ - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
: ]2 F$ a7 z' o* e( R. R; D# d - .text:24BC2DF2 call esi ; FreeLibrary
( U. R- v# v3 y: U: T0 Y& } - .text:24BC2DF4 push 6Ch ; Size: ?' k7 ^! ^" ]
- .text:24BC2DF6 lea eax, [ebp+Dst]# u- b3 c: p! f
- .text:24BC2DFC push edi ; Val9 Y5 Q$ U) J4 Z0 Z$ c1 t
- .text:24BC2DFD push eax ; Dst8 s& \( T0 q# g! Z
- .text:24BC2DFE call memset
5 z& Z8 q8 C$ x9 ]' l# N$ r - .text:24BC2E03 mov eax, [ebp+var_8]* N' u4 B& e* [
- .text:24BC2E06 add esp, 0Ch
4 k* _, e& O | - .text:24BC2E09 mov [ebp+Dst], 6Ch
- m/ F6 F$ s0 _, ~0 h - .text:24BC2E13 mov [ebp+var_8C], 15 S0 T# t) ^8 H0 c3 y8 T
- .text:24BC2E1D mov [ebp+var_28], 200h
$ p/ O; y# b' V* J - .text:24BC2E24 mov ecx, [eax]# w; P. j- F; Y$ q' G$ d
- .text:24BC2E26 push 8* v8 {# d% w& D0 a% P7 o
- .text:24BC2E28 push edi0 G: ^' ]) w9 l- ]" Y
- .text:24BC2E29 push eax
8 A5 A) ~' ~2 R* a - .text:24BC2E2A call dword ptr [ecx+50h]
5 I2 i' L% A" } - .text:24BC2E2D test eax, eax
" I1 U7 I" O3 i3 y" P - .text:24BC2E2F mov eax, [ebp+var_8]
N0 I) H' h9 U9 h- A# ` - .text:24BC2E32 mov ecx, [eax]
" {% L0 c* V, } - .text:24BC2E34 jge short loc_24BC2E46& k+ |9 {6 Z* ]' e* H% P
- .text:24BC2E36 push eax
j& o+ `4 Q$ I5 o - .text:24BC2E37 call dword ptr [ecx+8]
% Q( {7 g+ d. w( R, O - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule2 q) G+ T# i6 k' N( X; \" D# p' b+ ?
- .text:24BC2E3D call esi ; FreeLibrary6 t! _2 _7 i* `$ ?1 t7 |
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"* g/ H) e/ ^1 v: t
- .text:24BC2E44 jmp short loc_24BC2E6D
* d8 k9 ^; x7 p" g; o - .text:24BC2E46 ; ---------------------------------------------------------------------------
# P2 `! ]$ Z" m; U8 b; F - .text:24BC2E46
7 F: z O9 |- d) b, K - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j9 s# R7 R# O/ _, ^, }+ J# p
- .text:24BC2E46 lea edx, [ebp+var_C]
# F% q8 Q2 r' ?! o6 _: R - .text:24BC2E49 push edi+ ?* v, y% b" d# P
- .text:24BC2E4A push edx1 S" w/ x y& A( q5 ?8 Q
- .text:24BC2E4B lea edx, [ebp+Dst]
6 T5 W# b0 p6 L# `; F) D- F - .text:24BC2E51 push edx! C. j3 L7 n! W) H/ y* H
- .text:24BC2E52 push eax
0 K2 k1 n. b7 q% k3 Q - .text:24BC2E53 call dword ptr [ecx+18h]
1 v q8 t. R; l% q t$ r. [& x - .text:24BC2E56 test eax, eax
$ B" j# H0 v1 e( s9 Q - .text:24BC2E58 jge short loc_24BC2E7A
! q' E& [6 Z5 z$ |$ X! f# s! x - .text:24BC2E5A mov eax, [ebp+var_8]4 C1 ]: g3 U3 ~9 a, D6 n8 Q; \
- .text:24BC2E5D push eax7 _+ X7 Z/ R9 K ?6 L( T/ t
- .text:24BC2E5E mov ecx, [eax]
# W( \. T, n3 Y& ^ z X0 E - .text:24BC2E60 call dword ptr [ecx+8]
: A9 V) G8 g4 L - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule G8 U2 }4 O( ?
- .text:24BC2E66 call esi ; FreeLibrary
6 c* K4 K& \/ F2 a4 l' A: c - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
% D9 C, Q) C: r - .text:24BC2E6D
0 z0 x) d9 Q* v! |: {2 y - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j0 H& |- o$ P9 Q1 ?: M; a
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
& p5 U4 X5 ]4 G) h5 w7 k, L - .text:24BC2E6D call ds:OutputDebugStringA
3 |$ U; X) }$ ~ P; v - .text:24BC2E73 xor eax, eax
" d" T2 i9 g5 E+ ?9 f: e+ ? m - .text:24BC2E75 jmp loc_24BC30114 `7 z! N2 c& n" p6 n' y
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ! k) ]3 f5 p7 [% S! W
) ?# p' B7 }' U2 W( h% ]) I( Z1 \
5 K; S3 G& @& x" q- O
|