这游戏以前分析过,本贴再写得详细一些。) M3 y! }# k0 T3 t' l6 e/ n$ g
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
* m6 u, X9 |3 i) a( d. T( @注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。3 S. @3 @- I3 w
- ~* x3 ?, J- o- y
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
, l) V6 |, ]1 e7 X- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
+ v4 A% C; G) Z. [ - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
* t' @, b9 _1 H. K; t& R - STDMETHOD_(ULONG,Release) (THIS) PURE;
. [0 M, T9 e* [! v& t - STDMETHOD(Compact)(THIS) PURE;% D7 m5 R& |5 L8 s3 }
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;- I) Y1 u0 m: }
- STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;. e7 W" y6 S/ k( k3 A0 z$ X4 |5 ]
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 2 f4 L% c' J: A' P3 n+ i: R
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 5 P. D8 B( ~1 z K, {
+ x2 X/ h% i% ?. S' ]/ F4 _$ _
% f+ q& }3 y. l+ P4 Y3 c
. {, W2 M% R6 F0 c2 r- . A8 w k, J& [
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================/ n2 Y$ C# H; r: M
- .text:24BC2CD2: Y$ r7 B1 x+ ^" r/ S5 |
- .text:24BC2CD2 ; Attributes: bp-based frame
8 K% l4 n( e( G, ^ - .text:24BC2CD2/ ^& K' i4 z! t6 ^0 a
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
; V6 c( @5 W. Q& ~4 T: q+ B - .text:24BC2CD2
9 `& ~$ O1 E8 [: v - .text:24BC2CD2 Dst = dword ptr -90h+ S& e4 n. b4 C1 F
- .text:24BC2CD2 var_8C = dword ptr -8Ch
( r9 w0 J$ {' D2 r; c/ I @9 f - .text:24BC2CD2 var_28 = dword ptr -28h+ Q2 ^4 U) C$ e: a: y. m7 z l1 _/ }
- .text:24BC2CD2 var_24 = dword ptr -24h# j1 `7 @) [" U) b6 Z7 s- O! ]9 B
- .text:24BC2CD2 var_20 = dword ptr -20h
9 R. v; [7 B: I! } - .text:24BC2CD2 var_1C = dword ptr -1Ch9 c1 Y$ u0 W: l0 j& i+ V# u
- .text:24BC2CD2 var_18 = dword ptr -18h
; I/ K. g+ p' G8 {, [$ O - .text:24BC2CD2 ppv = dword ptr -14h
* n4 \2 `7 t" B! }& G4 Q - .text:24BC2CD2 var_10 = dword ptr -10h
) a0 q4 d( t7 r' d - .text:24BC2CD2 var_C = dword ptr -0Ch$ d' W" ^3 q: [( B ^# T
- .text:24BC2CD2 var_8 = dword ptr -8
: Z& S9 d8 x. W% K- L! b% u - .text:24BC2CD2 hLibModule = dword ptr -4
. ?6 l- I! W1 T, I* x% R" u - .text:24BC2CD2
" w- [% {4 Y" o2 N2 k5 ~3 o - .text:24BC2CD2 push ebp" l5 a: }& K7 B; \8 [; W% q0 R/ p1 j
- .text:24BC2CD3 mov ebp, esp: M% Y3 w# O5 E# f7 u0 x$ r
- .text:24BC2CD5 sub esp, 90h
* n$ ?5 ?8 L$ ~4 C8 ] - .text:24BC2CDB push ebx
/ [1 w$ x# C3 J5 U8 ~, k - .text:24BC2CDC mov ebx, ds:LoadLibraryA
7 p4 h1 r E. v, S" T% U, E - .text:24BC2CE2 push esi
: D2 D! X* T. e4 b% S - .text:24BC2CE3 push edi: K W/ E& M4 k6 ~% m5 S# @1 ?
- .text:24BC2CE4 xor edi, edi
: _7 z7 Y/ C0 p, l - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"$ {) o, e- G" R8 s6 B& `. X
- .text:24BC2CEB mov [ebp+var_8], edi
4 `5 e: V2 ^' z+ z" } - .text:24BC2CEE mov [ebp+var_1C], edi/ i% |2 V* t2 v) }& y8 E
- .text:24BC2CF1 mov [ebp+var_C], edi
- Q% Y5 ]( \8 { - .text:24BC2CF4 mov [ebp+var_10], edi$ ?% y W8 c# q7 j. [4 I: P5 p6 r
- .text:24BC2CF7 mov [ebp+var_18], edi
# t% R+ t$ r! C. q - .text:24BC2CFA call ebx ; LoadLibraryA
9 J) ? T9 ^- B* r3 v - .text:24BC2CFC mov esi, eax& X3 T1 z5 k( O4 c; h" ]
- .text:24BC2CFE cmp esi, edi$ N/ Y& q) G% {" `
- .text:24BC2D00 mov [ebp+hLibModule], esi
+ O2 @! E) f; z' @ - .text:24BC2D03 jnz short loc_24BC2D0F5 Q8 Y; M& a7 z9 E- a G9 J
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
$ n# w% X+ C3 r% N. c - .text:24BC2D0A jmp loc_24BC2E6D
2 z1 p) }$ a- l5 ^ - .text:24BC2D0F ; ---------------------------------------------------------------------------! [* ~5 w$ K0 m, s6 Q0 _' t
- .text:24BC2D0F) T0 |& d0 ]% f! @4 x# ]! ?
- .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
1 m" n: f) `3 f1 ?& t6 N2 [ - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"- y; ~7 s- g/ D3 I( [' Q5 I
- .text:24BC2D14 push esi ; hModule! w4 n `1 e5 K6 q& t
- .text:24BC2D15 call ds:GetProcAddress7 R1 ?* ]0 g% [4 `
- .text:24BC2D1B cmp eax, edi' y! ?: t% k2 {4 y G0 h( A8 V
- .text:24BC2D1D jnz short loc_24BC2D303 x2 Z& }. @& o+ U' V1 b/ }5 R( q
- .text:24BC2D1F push esi ; hLibModule) ] }( c8 {* x+ g
- .text:24BC2D20 call ds:FreeLibrary D5 ?, L" s) D" p/ R h
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
# S( i9 q0 a& w) O F1 b5 y - .text:24BC2D2B jmp loc_24BC2E6D
. H+ h {/ y0 k# ^ - .text:24BC2D30 ; ---------------------------------------------------------------------------
* Z) g. W3 E0 M+ X% |" Q0 P - .text:24BC2D30
j: v# |( D( H% e - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
9 Z0 R3 l6 y1 B# ] - .text:24BC2D30 lea ecx, [ebp+var_8]9 e, j4 Y, C' ]$ h" l
- .text:24BC2D33 push edi
: c' h0 _- O8 x& Y: @1 U" B$ | - .text:24BC2D34 push ecx
P2 I0 U2 e' D4 e( Q. K& G - .text:24BC2D35 push edi
2 N O* l8 v- U+ f5 c6 @9 Z - .text:24BC2D36 call eax
- |3 M* R8 {' L' A ~ - .text:24BC2D38 test eax, eax
" `, C4 g! G6 p0 @6 A - .text:24BC2D3A jge short loc_24BC2D4D' ^5 F# D! P$ B1 Q% f7 O- F& B
- .text:24BC2D3C push esi ; hLibModule4 ]- \7 N! M- A$ X
- .text:24BC2D3D call ds:FreeLibrary0 j$ u1 r3 P$ a0 x5 C& d- _
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"$ C. V# ?/ G- c
- .text:24BC2D48 jmp loc_24BC2E6D, e1 M j" w. R3 ^* C" d
- .text:24BC2D4D ; ---------------------------------------------------------------------------4 e+ _1 n# l3 d- f1 I' k: P" z
- .text:24BC2D4D5 a, E5 W: N* E& b0 z* d
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
+ M ?# [6 K6 I' G - .text:24BC2D4D mov eax, [ebp+var_8]: O+ V: ~2 N+ N0 F( Q
- .text:24BC2D50 lea edx, [ebp+var_1C]+ r7 k9 r7 k" D$ Z3 o
- .text:24BC2D53 push edx: ]# R: K$ s' p, x
- .text:24BC2D54 push offset unk_24BC4470- _7 ]* r& M. V* C1 l
- .text:24BC2D59 mov ecx, [eax]
$ I: f; F4 a4 Z3 \; D9 H8 T; o - .text:24BC2D5B push eax9 G: V4 W& b* \
- .text:24BC2D5C call dword ptr [ecx], i( ]* a. \. f" x* y$ |2 h0 ?6 C
- .text:24BC2D5E test eax, eax
, ]2 X) `0 n% U3 W( E - .text:24BC2D60 jge short loc_24BC2D87
# o. {% U1 z9 T7 F - .text:24BC2D62 mov eax, [ebp+var_8]" \" {4 S- {2 |- V* H
- .text:24BC2D65 push eax
' c) i' b* `& O; s* b$ U - .text:24BC2D66 mov ecx, [eax]3 F- O1 Z, ~0 S5 h/ _+ e
- .text:24BC2D68 call dword ptr [ecx+8]. F$ ?: \1 P3 G, o1 X
- .text:24BC2D6B push esi ; hLibModule
# g: A+ A w1 d6 F e - .text:24BC2D6C call ds:FreeLibrary- c. y$ L4 ~# K* i
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"3 Q! e* W; z, a# E8 @
- .text:24BC2D77 call ds:OutputDebugStringA
% i/ c) t O; U+ B - .text:24BC2D7D mov eax, 100h( Q7 J" U. W/ D% F; E
- .text:24BC2D82 jmp loc_24BC3011
9 c" Y: p. G2 @" T$ u - .text:24BC2D87 ; --------------------------------------------------------------------------- }8 ^& l; Y' h- Q9 g! I
- .text:24BC2D87
* k1 }& J/ Q- p1 |: t5 j" n) d7 e - .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j- B5 p$ A2 e7 G x- R
- .text:24BC2D87 mov eax, [ebp+var_1C]1 }- N, d8 X$ s) L4 [1 Z. u% F
- .text:24BC2D8A push eax( }$ P- r, ?* \# \2 s: {' P
- .text:24BC2D8B mov ecx, [eax]9 Q; T5 {+ J" d) n! B0 o: z
- .text:24BC2D8D call dword ptr [ecx+8]- F' h* @ @) b) K J4 Y% F: r* J
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
1 f# D& y/ |* s6 b$ [' |/ A - .text:24BC2D95 call ebx ; LoadLibraryA
7 `! R# W" r6 ] - .text:24BC2D97 mov esi, eax
3 U6 L6 O1 v D9 L; z9 \& |+ U - .text:24BC2D99 cmp esi, edi
1 z/ O4 f5 d" v! w& \! A" O- N - .text:24BC2D9B jnz short loc_24BC2DB6) F2 O" ^4 ?! x( ]' M& f/ |
- .text:24BC2D9D mov eax, [ebp+var_8]1 ?; N" L5 f8 ]5 C, N! N
- .text:24BC2DA0 push eax
# n- W+ j b" K$ T: E0 k/ [ - .text:24BC2DA1 mov ecx, [eax]$ Q. q/ T, Y. ~# {+ Z8 z" y
- .text:24BC2DA3 call dword ptr [ecx+8]
; ]# _: r5 z; E$ M - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
3 L4 b8 ]! p3 Z4 K7 `4 e - .text:24BC2DA9 call ds:FreeLibrary+ V) C5 h' E9 Q7 C2 h% a5 I; {
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
9 `, q* c# k k! S: [ - .text:24BC2DB4 jmp short loc_24BC2DE2
# `" s& x4 v, n* ? - .text:24BC2DB6 ; ---------------------------------------------------------------------------
1 H/ b; ~4 @$ K* E n2 ~ - .text:24BC2DB6
! w6 n* A* f, y - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j! _5 D! b- U- p3 [" i! [7 ~2 e
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"0 G f" t1 }* C! o4 U1 F4 a" M2 K
- .text:24BC2DBB push esi ; hModule0 U# O G; [& Q5 I. L1 M1 ]
- .text:24BC2DBC call ds:GetProcAddress) E- [; F7 i1 ~" Z+ P" R
- .text:24BC2DC2 push esi ; hLibModule
8 Z3 @; S5 H2 q( y - .text:24BC2DC3 mov esi, ds:FreeLibrary
$ Q) ~4 N% ~& a. v4 m9 C - .text:24BC2DC9 test eax, eax
/ g8 g1 X& z- ~ - .text:24BC2DCB jnz short loc_24BC2DF2
; [8 J- L( S4 \0 L' z - .text:24BC2DCD call esi ; FreeLibrary+ k D- B8 z. V* A% U
- .text:24BC2DCF mov eax, [ebp+var_8]; E" e$ S* r9 Q$ q
- .text:24BC2DD2 push eax2 q/ \4 f$ {1 {1 ~$ v/ n
- .text:24BC2DD3 mov ecx, [eax]
/ y2 ?- d% J' j/ X7 i - .text:24BC2DD5 call dword ptr [ecx+8]
5 f* ]5 `) g$ X: ~ - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule$ H$ X( _+ ]6 T8 v. e( I
- .text:24BC2DDB call esi ; FreeLibrary( ^5 k8 E1 U$ Q8 B- L# S2 Z
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
9 d( s" V8 {2 |# h/ t+ q- ` - .text:24BC2DE2: t* k$ L7 v5 u% m: |
- .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j' E; \' t1 a% s: {' O
- .text:24BC2DE2 call ds:OutputDebugStringA' ~" }6 R9 i( H x2 `3 C l
- .text:24BC2DE8 mov eax, 200h) k1 [" r& @- Z2 G9 t P! G3 D
- .text:24BC2DED jmp loc_24BC3011
! X( A: G) B' H# l+ o - .text:24BC2DF2 ; ---------------------------------------------------------------------------
+ ?3 {- b* r7 q - .text:24BC2DF2
3 q% }# V, b. V) p3 i" H - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j$ [$ ^ ?6 V9 ^! T# S
- .text:24BC2DF2 call esi ; FreeLibrary
" Q2 I! n; d$ m+ E; E$ X1 N - .text:24BC2DF4 push 6Ch ; Size# r% R2 u/ r1 a. v l2 {5 _
- .text:24BC2DF6 lea eax, [ebp+Dst]
+ S. v, v0 r' ^. a8 j" n( E% O M - .text:24BC2DFC push edi ; Val( q9 L; [( v* ?* `1 g& t, D a
- .text:24BC2DFD push eax ; Dst! r' ~" B# J4 p$ `0 f
- .text:24BC2DFE call memset
4 o- E( r5 Z( O6 }7 ?: R+ n! J - .text:24BC2E03 mov eax, [ebp+var_8]8 O8 }$ T& G* V3 O3 J' l& A6 C! g" I
- .text:24BC2E06 add esp, 0Ch2 ]6 R/ |$ J/ T$ o% w& |
- .text:24BC2E09 mov [ebp+Dst], 6Ch
6 ~4 ]# e0 `. H* l& l - .text:24BC2E13 mov [ebp+var_8C], 1
, e* B1 v- N$ y9 f0 P7 ^9 d0 f - .text:24BC2E1D mov [ebp+var_28], 200h
. |6 ^7 O& Z: C! { - .text:24BC2E24 mov ecx, [eax]; j% v/ O% K9 h4 y9 C; N
- .text:24BC2E26 push 86 F5 Q4 O" Z* R, x& q/ W
- .text:24BC2E28 push edi6 j& ^- Y, z' M' G
- .text:24BC2E29 push eax2 G( R( v3 n: i! Q) L
- .text:24BC2E2A call dword ptr [ecx+50h]
Q4 H" E# |& \ R - .text:24BC2E2D test eax, eax
8 _9 l5 M- I% ?# X% c$ W - .text:24BC2E2F mov eax, [ebp+var_8]
1 g2 {! m- \ b: |" k2 I N - .text:24BC2E32 mov ecx, [eax]: I2 l4 z% G* [* a, N4 {0 G
- .text:24BC2E34 jge short loc_24BC2E46% N; v5 @3 ~7 ?7 ]( t1 z5 j
- .text:24BC2E36 push eax% Q9 B9 {0 u9 U+ o
- .text:24BC2E37 call dword ptr [ecx+8]) {8 C) F& D" x; C& i. D9 e
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule5 B6 U: I# p# L% M; g* R5 d
- .text:24BC2E3D call esi ; FreeLibrary9 y. P! @, ?) ]7 G% l
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
. t# Q- J, t5 Z" S3 k9 Y - .text:24BC2E44 jmp short loc_24BC2E6D
+ d6 g/ W; K, o. g4 D5 W4 v - .text:24BC2E46 ; ---------------------------------------------------------------------------3 \8 _, s. q1 @% l
- .text:24BC2E46
( I* N0 D7 r; J/ I - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
9 J Q' n& y, `# x/ p9 ^. y - .text:24BC2E46 lea edx, [ebp+var_C]# u; Y: D" _( U2 I/ D7 w
- .text:24BC2E49 push edi- h9 M% r Z; I2 R7 l* b
- .text:24BC2E4A push edx
- o6 y# f' f% {; ^ - .text:24BC2E4B lea edx, [ebp+Dst]7 o$ O u; j# {/ g
- .text:24BC2E51 push edx3 f0 W: I7 W6 C! x j6 C! k
- .text:24BC2E52 push eax# M" o" p, y7 V! L1 `, }2 v
- .text:24BC2E53 call dword ptr [ecx+18h]
6 M- v& l* z m1 D - .text:24BC2E56 test eax, eax7 Y( `% a0 B( O6 U
- .text:24BC2E58 jge short loc_24BC2E7A0 l2 d( j8 y: |" L+ A4 ]6 r0 t
- .text:24BC2E5A mov eax, [ebp+var_8]& s( G |' \9 m; J. u/ a: |6 u
- .text:24BC2E5D push eax" B$ b, f% X n5 J8 e, s
- .text:24BC2E5E mov ecx, [eax]
: A+ U6 p" C& P ~8 h+ z - .text:24BC2E60 call dword ptr [ecx+8] S! {( Y5 M3 t5 V4 \
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
$ s, c+ W* ^% q) E9 F - .text:24BC2E66 call esi ; FreeLibrary
4 T; F b8 H. v/ W- R4 t( R- V - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
0 R9 ~- j- I! p& f% P+ { - .text:24BC2E6D$ q+ e: i3 ?+ w- r
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j; Q# g. O: \0 U0 X+ Z2 q
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...; k8 l6 O9 e! y8 N
- .text:24BC2E6D call ds:OutputDebugStringA0 c5 X t" I9 U9 A
- .text:24BC2E73 xor eax, eax
" R/ K9 L0 R2 j( [0 V - .text:24BC2E75 jmp loc_24BC3011" u! | Y8 L2 ?& F1 z
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
& S+ T, s& Y2 O$ X( n5 x2 C
6 E8 |/ o- h$ U1 u( \* L7 T/ D- T. B- }$ O' i3 _4 {
|