这游戏以前分析过,本贴再写得详细一些。
* W2 K5 ?1 X1 ^0 |' Q& O( |# t这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,: ?, F( z: W5 \+ b5 t7 v
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
9 ?, m/ H9 Z, s- N8 M! D
% u, C- j d; v& @参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.+ W% d4 A4 q5 f+ C
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
7 g/ ^* G0 M# Y" y - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
% c* r; {. f' X$ b8 X ?: q - STDMETHOD_(ULONG,Release) (THIS) PURE;
8 p) M/ D1 t$ k9 ^; Q" ^ - STDMETHOD(Compact)(THIS) PURE;
% ~ \3 k, U3 \% ]) ~5 c+ Z - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
2 ^( o. R) j9 T - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
4 L( K; K8 ^2 x7 y - STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
R+ k1 ~% t3 o5 x) X; z7 ~$ _1 \以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 7 q2 w3 C& U$ I6 p+ V$ u* }) i) r* X6 H
6 U+ J( o$ W2 e) W/ G5 J$ q
, E# p+ R' D: D! q7 E
% n! J0 G0 `: V4 v1 z w- q
4 T7 \ ]1 \8 W$ Q, g, {- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
7 [0 Z' I0 R0 {* Z - .text:24BC2CD2
6 }" A, S4 Y# K L; E0 F1 r - .text:24BC2CD2 ; Attributes: bp-based frame0 L# D' S, ?" N9 t7 O
- .text:24BC2CD2 t3 h. [. m% S% s6 B# @& z
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
3 B6 |; k, q8 E( C6 P7 t6 b - .text:24BC2CD2' R2 W `- ]# `. D
- .text:24BC2CD2 Dst = dword ptr -90h
H# m" e# s) W. l - .text:24BC2CD2 var_8C = dword ptr -8Ch3 R8 q5 s6 X( L! R4 k
- .text:24BC2CD2 var_28 = dword ptr -28h+ F( E; R! }* r. v, p" t
- .text:24BC2CD2 var_24 = dword ptr -24h8 d# K2 @9 C t. @) a3 x1 O- S
- .text:24BC2CD2 var_20 = dword ptr -20h
" H; z0 y' z& A- G6 ]' ~ - .text:24BC2CD2 var_1C = dword ptr -1Ch
9 t5 T- i' b: T& ^, h7 C - .text:24BC2CD2 var_18 = dword ptr -18h
+ |0 e% @4 i' R - .text:24BC2CD2 ppv = dword ptr -14h; R+ B5 v) F! a& _+ t( a# p0 {
- .text:24BC2CD2 var_10 = dword ptr -10h
6 \3 a; w$ _5 Z9 a1 R: x - .text:24BC2CD2 var_C = dword ptr -0Ch: p7 X7 {5 f% c. L: h
- .text:24BC2CD2 var_8 = dword ptr -8 a3 R5 u& {: Q3 N0 x
- .text:24BC2CD2 hLibModule = dword ptr -4
5 [/ e4 b% h- x0 o( e1 M - .text:24BC2CD2
4 B: W8 C5 O& L% Z7 X% a8 U - .text:24BC2CD2 push ebp$ F0 q2 u4 D" }# n
- .text:24BC2CD3 mov ebp, esp$ ^2 S! _9 @- B
- .text:24BC2CD5 sub esp, 90h2 M9 ]/ k: x+ v" U* I# j
- .text:24BC2CDB push ebx
/ x3 U E/ v; S- V - .text:24BC2CDC mov ebx, ds:LoadLibraryA
& A# y6 X% w& {8 U) v; A- C - .text:24BC2CE2 push esi
: D* Y# E2 C \) m - .text:24BC2CE3 push edi
& @- m% a2 M8 p9 T6 [8 G5 z' G - .text:24BC2CE4 xor edi, edi
\; n& w/ A( m6 M5 ^! H - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL". P q, L; ~4 v8 l8 [
- .text:24BC2CEB mov [ebp+var_8], edi4 a4 ^. q2 x* u8 w! g. B" i% b
- .text:24BC2CEE mov [ebp+var_1C], edi: f/ h0 N5 ^/ o3 T7 o3 D
- .text:24BC2CF1 mov [ebp+var_C], edi
( g7 W4 a0 z+ |, E - .text:24BC2CF4 mov [ebp+var_10], edi) w. {& C& i! v+ l
- .text:24BC2CF7 mov [ebp+var_18], edi1 v8 W, E+ R$ U8 | E3 Z
- .text:24BC2CFA call ebx ; LoadLibraryA( j+ Q2 N# v# ~ b4 N& V! v
- .text:24BC2CFC mov esi, eax
# \4 Z$ o1 v; z. i1 u$ g. Z - .text:24BC2CFE cmp esi, edi4 J, u( P6 x; n' n. A! x& G
- .text:24BC2D00 mov [ebp+hLibModule], esi, z, X$ j$ A5 R% j' b$ e) b
- .text:24BC2D03 jnz short loc_24BC2D0F
* }/ v) c$ \$ {& w8 c' F - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
1 b( Y8 U/ Y7 a; `' t5 _' M - .text:24BC2D0A jmp loc_24BC2E6D
1 [/ g' c+ i% \5 O! ~ - .text:24BC2D0F ; ---------------------------------------------------------------------------( K. ?( R9 E" @: @( I/ u3 q
- .text:24BC2D0F- n5 }; t2 J- Q) U# M
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
/ @) c2 D- Q: o - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"" {% H# j6 d# P7 l" S6 ~
- .text:24BC2D14 push esi ; hModule
# L, \( O( d' W7 i - .text:24BC2D15 call ds:GetProcAddress
& R4 ~% d5 y5 j* F8 _" X2 { - .text:24BC2D1B cmp eax, edi
- q7 R9 _+ C* e" ?8 b9 t) _ - .text:24BC2D1D jnz short loc_24BC2D30
/ o" c+ ^3 }& r - .text:24BC2D1F push esi ; hLibModule
$ }. X4 l. h6 q/ m# S4 R - .text:24BC2D20 call ds:FreeLibrary W' ~7 a) k5 c
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...3 B, y7 |) d5 V2 b" I+ w) G" S% @
- .text:24BC2D2B jmp loc_24BC2E6D
" F/ d2 S3 ]; R- e6 ^! o# O - .text:24BC2D30 ; ---------------------------------------------------------------------------# V& G! o4 U% i% D/ S6 H2 ]
- .text:24BC2D30$ h/ `3 h) D1 Q$ G
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j9 N5 l; {3 p2 ]6 L
- .text:24BC2D30 lea ecx, [ebp+var_8] D4 y6 \' p5 H2 V9 F! z
- .text:24BC2D33 push edi: D% E& x h2 D& M
- .text:24BC2D34 push ecx. b2 ]1 J* \! @$ D% {
- .text:24BC2D35 push edi
3 z/ [1 D, P9 z/ c - .text:24BC2D36 call eax2 `1 x; \* U9 P9 K! x' D7 |
- .text:24BC2D38 test eax, eax
1 `. A0 \4 @+ k/ g' E - .text:24BC2D3A jge short loc_24BC2D4D
7 u4 n1 _/ \$ i$ S$ U - .text:24BC2D3C push esi ; hLibModule
: ~" s- B+ o9 `: D7 g6 {, q/ M - .text:24BC2D3D call ds:FreeLibrary
& e& |/ z7 r$ Y' | - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"2 u9 {' k# y6 K: w" k {
- .text:24BC2D48 jmp loc_24BC2E6D
5 m: c/ n9 W* R8 O - .text:24BC2D4D ; ---------------------------------------------------------------------------1 w7 s- f+ h3 q# c
- .text:24BC2D4D
- N, r, t' S8 |3 P, n q! q - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
& h( S1 ~& y- x N3 p0 N( r - .text:24BC2D4D mov eax, [ebp+var_8]0 L; g" E# c0 k* }
- .text:24BC2D50 lea edx, [ebp+var_1C]
+ H, e% [8 C2 r1 z/ g9 T - .text:24BC2D53 push edx
: |4 r7 c( j+ V. ?, | @; D - .text:24BC2D54 push offset unk_24BC4470
* y" d0 L0 G/ ~) @. M - .text:24BC2D59 mov ecx, [eax]9 Q4 b/ o5 e2 H/ t$ N4 ^* N( M
- .text:24BC2D5B push eax
0 w+ W( Y' G1 A* `3 o1 P, L - .text:24BC2D5C call dword ptr [ecx]
" _+ ]1 D& F! S5 ], |: _! _2 H - .text:24BC2D5E test eax, eax9 d! Y+ ^7 M" E! ?( d! g$ }. {
- .text:24BC2D60 jge short loc_24BC2D87
, B4 R( V9 o( Y6 j! K/ w' z) ] - .text:24BC2D62 mov eax, [ebp+var_8]
8 M: Y. c+ Q. x3 l, |8 j - .text:24BC2D65 push eax: `! \ a* b% L/ Z. @
- .text:24BC2D66 mov ecx, [eax]# N- _+ p9 p0 u6 S
- .text:24BC2D68 call dword ptr [ecx+8]
% X3 Q$ g* i( y% W, |. p - .text:24BC2D6B push esi ; hLibModule
6 X$ [" m1 m% ^+ s- x2 `1 _. k) M& L. U - .text:24BC2D6C call ds:FreeLibrary+ J Q J' Y5 A& v& k8 B; O0 D
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"! k- x' i; U8 A9 v5 t
- .text:24BC2D77 call ds:OutputDebugStringA
0 u |4 P& ~6 E - .text:24BC2D7D mov eax, 100h4 D; h7 w5 l! }" T* w! G0 z4 z4 i& z
- .text:24BC2D82 jmp loc_24BC3011) s. s3 B ?6 j5 T
- .text:24BC2D87 ; ---------------------------------------------------------------------------' y. C7 a7 O5 Z, q; `. X0 h
- .text:24BC2D87
1 m) Z8 h( H a7 \# L, B+ t- i - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
, U# Y1 k" I/ V' P9 q$ F - .text:24BC2D87 mov eax, [ebp+var_1C] O, A1 R6 u/ E) \5 o" W
- .text:24BC2D8A push eax7 y* n6 I/ N5 @# W, m2 G9 p0 P
- .text:24BC2D8B mov ecx, [eax]
& R) n) Q* P' e+ |- h) w7 q3 ^ - .text:24BC2D8D call dword ptr [ecx+8]
8 @; P: p0 l+ q# k - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"4 A+ c+ [) w U& |
- .text:24BC2D95 call ebx ; LoadLibraryA
1 R# ?+ Z6 v- c3 M - .text:24BC2D97 mov esi, eax
- E& J+ o5 K! u8 \ - .text:24BC2D99 cmp esi, edi! x' x T6 R- a$ W- y
- .text:24BC2D9B jnz short loc_24BC2DB6: ^/ M8 L4 Z4 n7 M; V
- .text:24BC2D9D mov eax, [ebp+var_8]: Z% l. o7 x: |) [& A5 d
- .text:24BC2DA0 push eax- Q: q6 g* p( z
- .text:24BC2DA1 mov ecx, [eax]; ]( s5 v) P! u6 }7 n! r& ^2 r
- .text:24BC2DA3 call dword ptr [ecx+8]
; ]9 M0 j! w7 h @( Q - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
9 W$ c. h9 }3 @' P" }9 t - .text:24BC2DA9 call ds:FreeLibrary
5 \ N$ F# J; U - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
9 H& Y' |3 z8 R+ R. l# F) X/ E - .text:24BC2DB4 jmp short loc_24BC2DE28 p/ ]% f) X2 S! b2 g6 n
- .text:24BC2DB6 ; ---------------------------------------------------------------------------7 Z- R- b% _3 Y o1 \
- .text:24BC2DB6. ~) d$ w" ?/ t- H$ \; j% ]4 C3 y
- .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
3 t7 M2 z& t4 e& s: O( |+ }* Q - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"+ h& v5 S5 o2 _6 b$ Y
- .text:24BC2DBB push esi ; hModule: ]' ^: `8 i$ }' w- b; H# _( H$ [6 G
- .text:24BC2DBC call ds:GetProcAddress0 S$ I6 G+ O4 P7 ~2 l; b3 M
- .text:24BC2DC2 push esi ; hLibModule
: Q: n* [' p6 g - .text:24BC2DC3 mov esi, ds:FreeLibrary: L8 b+ Z& _2 T, ~3 E: P
- .text:24BC2DC9 test eax, eax
1 ?: u2 z# b) _; O0 ? - .text:24BC2DCB jnz short loc_24BC2DF2
1 S& J' [1 M! U4 }, q - .text:24BC2DCD call esi ; FreeLibrary
& K; s3 d0 Y3 `# `3 i d0 g4 z a - .text:24BC2DCF mov eax, [ebp+var_8]
' m+ z" }' E- P - .text:24BC2DD2 push eax
_( F3 H) t* ` - .text:24BC2DD3 mov ecx, [eax]% V& j3 I5 L: R' _
- .text:24BC2DD5 call dword ptr [ecx+8]7 x' ^" |7 L5 X$ P- w9 O
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
" B8 g. Q5 b- T - .text:24BC2DDB call esi ; FreeLibrary
1 s' u% ~* a5 R. R2 m) j- Z: [ - .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...1 h5 O4 p7 Y2 @6 d) {
- .text:24BC2DE2% r+ r) v! ], x. E: l C( w
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j9 K2 ]+ [5 A8 `! m+ Z* p$ z
- .text:24BC2DE2 call ds:OutputDebugStringA
. E* E; R. B4 [7 e - .text:24BC2DE8 mov eax, 200h
3 u3 J: n0 m% H% `* _: j1 x4 |! G - .text:24BC2DED jmp loc_24BC30110 W3 X9 A4 W f3 G3 R' D* m
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
* \# u0 ~9 _; R - .text:24BC2DF2
7 X8 Z1 E3 S" E1 g* g T) F - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j+ {8 v7 v* X( c1 O9 V3 O% ~
- .text:24BC2DF2 call esi ; FreeLibrary2 s4 F) u3 u3 D* |" V. B4 c
- .text:24BC2DF4 push 6Ch ; Size
Z0 c" m8 o# y w- h T - .text:24BC2DF6 lea eax, [ebp+Dst], o& d. I6 B9 y3 |! B9 X
- .text:24BC2DFC push edi ; Val* ?: A( G& s0 l: K7 `
- .text:24BC2DFD push eax ; Dst* J0 ?0 W, r! I; {
- .text:24BC2DFE call memset/ n+ z/ D9 {- P# V$ i1 L) c
- .text:24BC2E03 mov eax, [ebp+var_8]) n: I. M! U# x7 M! Z
- .text:24BC2E06 add esp, 0Ch
y2 r0 S3 [5 Y# ]1 p - .text:24BC2E09 mov [ebp+Dst], 6Ch Q$ s4 i0 Q2 s" Y
- .text:24BC2E13 mov [ebp+var_8C], 1
+ Y0 h) {. a8 a3 ] - .text:24BC2E1D mov [ebp+var_28], 200h0 [+ [- P, I) T" ]! I
- .text:24BC2E24 mov ecx, [eax]
# h2 V5 `. B3 G - .text:24BC2E26 push 8
# ]0 m: G+ V& i - .text:24BC2E28 push edi
3 j( G& X5 b) t2 t - .text:24BC2E29 push eax
1 Z+ m" K8 E n$ ?1 ^/ T+ Z - .text:24BC2E2A call dword ptr [ecx+50h]) i2 ?& Q& t6 K- q( O$ s6 ]
- .text:24BC2E2D test eax, eax
+ V0 R& U1 f5 x7 Q8 X9 G3 G - .text:24BC2E2F mov eax, [ebp+var_8]
% b, t9 P4 J! V/ Y V2 j - .text:24BC2E32 mov ecx, [eax] c9 F! X. X' ?
- .text:24BC2E34 jge short loc_24BC2E46
+ u2 {( }/ p3 R9 }# n - .text:24BC2E36 push eax4 G7 [( s: {. v" Z9 z' }
- .text:24BC2E37 call dword ptr [ecx+8]
+ F# T* ~$ m, A* m2 a6 ]- c - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule- ]7 \; [+ ^% g; x
- .text:24BC2E3D call esi ; FreeLibrary0 B4 b f- i2 a5 O+ }
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"% k( n3 |7 j7 t! ^ H
- .text:24BC2E44 jmp short loc_24BC2E6D: H) n6 X* Y( w9 O+ ~0 @" y1 |
- .text:24BC2E46 ; ---------------------------------------------------------------------------, j. ?. f3 P( J3 }
- .text:24BC2E46
# L* y( R* K- ^3 ~ - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
+ Z7 B% K! ~. l) J/ _, \1 @ - .text:24BC2E46 lea edx, [ebp+var_C]( L3 o6 y2 ^! e A6 C% W
- .text:24BC2E49 push edi
+ c0 t9 ]0 b9 X o) v. S& @3 e9 {& | - .text:24BC2E4A push edx
3 Q5 g! x4 l' C8 t- p7 l1 I8 R. ^ - .text:24BC2E4B lea edx, [ebp+Dst]) t* G4 z2 V9 ^
- .text:24BC2E51 push edx
: K6 H( x6 [% Y. Q3 s! h - .text:24BC2E52 push eax- x- ?! b& a0 e# ^) f( G
- .text:24BC2E53 call dword ptr [ecx+18h]
) e% Z' _+ j5 P) W' X+ y - .text:24BC2E56 test eax, eax
. H* l; x6 T9 q& ]; a - .text:24BC2E58 jge short loc_24BC2E7A/ T; ?4 A. A6 |" O" b8 X7 G [
- .text:24BC2E5A mov eax, [ebp+var_8]
8 _1 ?5 U* Q2 D0 ~ - .text:24BC2E5D push eax
* Q a, C. F# E. e; N4 ^ - .text:24BC2E5E mov ecx, [eax]
5 X, Y y" r! @ - .text:24BC2E60 call dword ptr [ecx+8]
- j: T+ u. n0 j$ P) k. a1 x2 I# X+ g - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule# W/ a0 y6 W$ w' A$ S* A
- .text:24BC2E66 call esi ; FreeLibrary
6 k3 E; ]) _4 o6 i' M! ?% R - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
$ l. V& D/ u( ?2 r - .text:24BC2E6D
?/ p+ ]& G1 f4 y# F - .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
- y5 t- i- t, }% ^" k0 Y - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...- s1 ^# [5 Q, r, z/ a* e2 _# _
- .text:24BC2E6D call ds:OutputDebugStringA
' a6 _1 M0 j" p( U" q v - .text:24BC2E73 xor eax, eax$ z i0 \: O) E7 E: K X4 ]
- .text:24BC2E75 jmp loc_24BC3011) |6 h( n @" L e
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
) D) J& K, B4 h- D! o& v9 x& s7 |5 g1 f& X! E @( Q! N2 _
: I2 }* Z; \7 f4 n. g6 _ |