这游戏以前分析过,本贴再写得详细一些。
, z- f7 I' v- u- v3 ~: \7 Z+ I! a这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
$ R/ }$ a( N( H* u注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
: Q1 R: F+ w' h- T/ d4 [
X% ~8 S, H- m+ r2 ^参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
) Q5 r O# ]( s) S5 S1 ^4 r8 M- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;9 B- B( e; ~+ `0 X$ Z
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;' t8 M* v7 A4 |& f4 X% P
- STDMETHOD_(ULONG,Release) (THIS) PURE;
! a4 G9 @2 q, \/ ~( G7 v/ h - STDMETHOD(Compact)(THIS) PURE;- }. I# V8 `+ }9 i
- STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
9 i' g1 t; D: E' @# j% b. X4 { - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;9 ~2 l6 L0 q( ?* N, _& Y$ y, v
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码 5 |6 V2 L& B- O1 O+ J2 I
以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码 " r8 a m: S: d2 Q/ k# T* t
& l) f1 F& N- C9 D2 n9 |
* e$ j1 u( }9 [, p% p8 o: s: T/ v# R6 A
' X2 l- W5 F9 ]0 A& o- - Q$ i4 t; I) t* M$ z8 O, P) S
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================& l' p$ ^, B) I3 J, c; P1 `8 `
- .text:24BC2CD26 k$ ^1 e. b6 J* m" O- m' ~6 X
- .text:24BC2CD2 ; Attributes: bp-based frame# Y! m* n( X. W- b4 ~1 N$ ?
- .text:24BC2CD2
" K( ^! O+ X4 m& V' g) o* b6 | B - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p7 }$ V7 @1 f# X4 b& a
- .text:24BC2CD2
) x6 v& I& ?7 p. ^4 S; F - .text:24BC2CD2 Dst = dword ptr -90h$ b* Q9 y" J4 N: f# a1 P
- .text:24BC2CD2 var_8C = dword ptr -8Ch
0 n3 K9 W( \% L7 J- ] - .text:24BC2CD2 var_28 = dword ptr -28h9 l, J7 i* f$ s& g `
- .text:24BC2CD2 var_24 = dword ptr -24h) `1 r! [' x, m3 M# H0 N, d
- .text:24BC2CD2 var_20 = dword ptr -20h. I: e0 P4 \% }8 O- {& z. D
- .text:24BC2CD2 var_1C = dword ptr -1Ch
- x4 ~/ y% X; O - .text:24BC2CD2 var_18 = dword ptr -18h
: N# s$ k1 ^5 a, _# F5 V! y - .text:24BC2CD2 ppv = dword ptr -14h3 G; Y' `: M! {: @
- .text:24BC2CD2 var_10 = dword ptr -10h+ r9 Y7 j E5 e2 d
- .text:24BC2CD2 var_C = dword ptr -0Ch4 x- j; s- ?% a' u; A+ L6 T/ m
- .text:24BC2CD2 var_8 = dword ptr -8; h1 A* \+ u; P7 B6 U" f8 {
- .text:24BC2CD2 hLibModule = dword ptr -4
, j/ n: ] U2 e4 E8 G" o - .text:24BC2CD27 e1 V1 c$ [1 Y! G' G
- .text:24BC2CD2 push ebp
' x$ s/ m. V# m# X$ b& J' [ - .text:24BC2CD3 mov ebp, esp
& }; ]8 S/ N9 J1 A* q& ^$ b2 g - .text:24BC2CD5 sub esp, 90h
# ^, V7 S! n) }/ y/ S) v - .text:24BC2CDB push ebx3 T2 Q* x0 D) Z& k
- .text:24BC2CDC mov ebx, ds:LoadLibraryA2 B) J" b9 E% b6 ?& n! r+ w
- .text:24BC2CE2 push esi, w1 u1 w- A9 f: E. C8 L
- .text:24BC2CE3 push edi: x& [( j9 A- K6 m c
- .text:24BC2CE4 xor edi, edi; M) R8 ^" a- G2 ?7 x/ b
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"' r# ]: K& ?: h' |1 W
- .text:24BC2CEB mov [ebp+var_8], edi3 [8 \' b2 N8 o" x2 }1 w t" @* T
- .text:24BC2CEE mov [ebp+var_1C], edi/ J/ l" \+ i, [3 L3 p. S
- .text:24BC2CF1 mov [ebp+var_C], edi. d+ r% [. d, v) ]1 G
- .text:24BC2CF4 mov [ebp+var_10], edi
|3 K* c/ z4 _7 D7 x/ V' g9 r - .text:24BC2CF7 mov [ebp+var_18], edi
% ~, J$ O) L, V# R/ [# h - .text:24BC2CFA call ebx ; LoadLibraryA& S. r7 f1 S/ h5 [
- .text:24BC2CFC mov esi, eax
3 d' G8 {7 E% G& q$ Z; _4 l: V - .text:24BC2CFE cmp esi, edi
/ z; w, R* u7 T0 w' q6 n - .text:24BC2D00 mov [ebp+hLibModule], esi
) H @" W4 l' q! y - .text:24BC2D03 jnz short loc_24BC2D0F& v/ s9 F' p) i9 g. B
- .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n") d/ o$ ~7 G3 P) Z
- .text:24BC2D0A jmp loc_24BC2E6D
$ m( u; K- v' ?$ f8 F' m6 @, T - .text:24BC2D0F ; ---------------------------------------------------------------------------
5 [! v. N1 Z3 {8 F* t! \" l# X+ k" | - .text:24BC2D0F
, y7 P- |: m, K$ N2 { - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j3 g5 @3 c2 G! F
- .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"6 m" G* n' A9 o# d* d Q* d
- .text:24BC2D14 push esi ; hModule
! n2 d2 }6 x$ W- A) K2 }5 | - .text:24BC2D15 call ds:GetProcAddress
& R# T0 m X' Z9 {/ @ - .text:24BC2D1B cmp eax, edi
8 f1 w9 S( a7 J; P" t1 l: W2 m - .text:24BC2D1D jnz short loc_24BC2D30
) F4 k: r+ @9 \1 W$ \ ` - .text:24BC2D1F push esi ; hLibModule# K3 V, T, Y; ]+ b z- |2 S$ m
- .text:24BC2D20 call ds:FreeLibrary
7 b2 h; W9 S5 K9 V; a! E4 I o$ b - .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
$ O# ~4 ] G+ {8 D1 t1 ^) G" H - .text:24BC2D2B jmp loc_24BC2E6D& E& o8 L1 b2 k+ H
- .text:24BC2D30 ; ---------------------------------------------------------------------------2 w3 A; c! u& J2 z7 y2 `; |1 `
- .text:24BC2D301 p, D* y! u/ k- C
- .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
/ z% s9 F: ?- y - .text:24BC2D30 lea ecx, [ebp+var_8]
- w1 b+ H3 J g' N8 Q - .text:24BC2D33 push edi
; j8 [3 i3 S3 c% w3 W" k7 o - .text:24BC2D34 push ecx
: ]1 N5 S; k" g4 k - .text:24BC2D35 push edi
! o; [' y) y3 c0 \" {0 @ - .text:24BC2D36 call eax
5 T5 q- f7 H/ V! e5 _0 u - .text:24BC2D38 test eax, eax
; `1 g: ?! w6 a, \ - .text:24BC2D3A jge short loc_24BC2D4D
& j) t0 {9 I+ V/ ] Y9 W - .text:24BC2D3C push esi ; hLibModule
" Q: F+ z8 R- B) K, K( I2 E - .text:24BC2D3D call ds:FreeLibrary
( w0 x4 }- x) p, l+ X - .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"$ `" X" d9 Y( Q7 _9 h1 @
- .text:24BC2D48 jmp loc_24BC2E6D C `5 l0 ^+ w F
- .text:24BC2D4D ; ---------------------------------------------------------------------------
4 ?0 L$ K7 a/ g7 \ - .text:24BC2D4D1 u7 { l5 e9 a8 _8 A% w {' s0 S# N" c
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j3 i9 O& m% b: I x, v7 J, K
- .text:24BC2D4D mov eax, [ebp+var_8]
+ g, y% r2 c7 R" c5 s9 p - .text:24BC2D50 lea edx, [ebp+var_1C]
9 D$ d# {% g/ k9 i- a) y+ T5 [* @ - .text:24BC2D53 push edx
" r0 f" b2 w1 e+ u m: b2 h/ S - .text:24BC2D54 push offset unk_24BC4470/ u1 R2 |4 e9 ?& }/ s2 F
- .text:24BC2D59 mov ecx, [eax]
9 b D1 s% R) m( ^8 o7 E, s - .text:24BC2D5B push eax
5 M' \! q4 h& Y - .text:24BC2D5C call dword ptr [ecx]3 ~7 K; q+ @" _! C8 K
- .text:24BC2D5E test eax, eax5 x; o0 t- Z0 C* S" n# E0 [( U
- .text:24BC2D60 jge short loc_24BC2D879 r9 l- Q! g. m
- .text:24BC2D62 mov eax, [ebp+var_8]
7 {( f# O. _+ {7 S, H - .text:24BC2D65 push eax
: t1 r$ |! p# z+ f% t - .text:24BC2D66 mov ecx, [eax]* `! t: D. v9 l3 h7 o% m' X
- .text:24BC2D68 call dword ptr [ecx+8] b' o/ X! q- Z4 x' n( B g
- .text:24BC2D6B push esi ; hLibModule
' e" T0 l6 O% q, q/ R) ^ - .text:24BC2D6C call ds:FreeLibrary
8 U& a" r6 g" U( Q2 i& t6 g* j- Z: d - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
/ q/ X5 Q7 R9 n3 ~ - .text:24BC2D77 call ds:OutputDebugStringA/ R/ ^; W2 o7 P- B/ O/ j" O
- .text:24BC2D7D mov eax, 100h
0 X2 [$ B1 |1 p$ a2 C/ p' x - .text:24BC2D82 jmp loc_24BC3011
5 n8 O8 R1 z) l k/ V6 _ - .text:24BC2D87 ; ---------------------------------------------------------------------------4 G" c' m# H2 l J6 t- @ O: W
- .text:24BC2D874 G2 ?( u8 W/ `- n7 G/ W0 I9 r
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j. ^# \# p( h6 G& y5 E/ p
- .text:24BC2D87 mov eax, [ebp+var_1C]
8 j- V7 E* U. w4 ^1 W: y8 L - .text:24BC2D8A push eax, M4 o0 ]3 n' n
- .text:24BC2D8B mov ecx, [eax]# |) M2 j/ K, ~ J. t/ g
- .text:24BC2D8D call dword ptr [ecx+8]
1 }5 N& Q7 z! S: q8 x- _ - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
) n* N+ q" D$ i2 w$ _; F - .text:24BC2D95 call ebx ; LoadLibraryA
4 N% T" J. G) A K1 K+ `$ G: z - .text:24BC2D97 mov esi, eax
3 A3 R; b- h% [# y: S/ Q - .text:24BC2D99 cmp esi, edi% S6 f. @! y1 D2 C5 h, P- B# i
- .text:24BC2D9B jnz short loc_24BC2DB6
2 X; `3 b, z& M* j0 T3 r - .text:24BC2D9D mov eax, [ebp+var_8]
( K* E3 B9 m, }' ]& s' ? - .text:24BC2DA0 push eax
; J2 r3 M' S. H" X* y+ S - .text:24BC2DA1 mov ecx, [eax]
$ @/ C' R' x3 N' z - .text:24BC2DA3 call dword ptr [ecx+8]2 P! Y* X: y6 `- ]4 P1 a
- .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule/ D" x( K; }3 Y6 I3 b! E/ J
- .text:24BC2DA9 call ds:FreeLibrary
9 r6 y) |9 ~4 r' ~# J' n - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"* U1 W- U! x7 @6 ]: C
- .text:24BC2DB4 jmp short loc_24BC2DE20 T( Z$ |/ J% J* e6 v# T4 [/ z
- .text:24BC2DB6 ; ---------------------------------------------------------------------------8 n9 C: p0 @! o: D$ L2 p' |* \8 O
- .text:24BC2DB6
: y* [" l! r8 ]% e& r3 y - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j- Z p _- s( a6 T
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"0 S8 m5 q: Q. V) |; a
- .text:24BC2DBB push esi ; hModule6 O- f- a0 F+ K1 J
- .text:24BC2DBC call ds:GetProcAddress% r/ P% M3 W9 E4 _
- .text:24BC2DC2 push esi ; hLibModule: ~4 [. P4 ^* z" f, ]
- .text:24BC2DC3 mov esi, ds:FreeLibrary
, n4 c6 x. D7 U4 C+ y# p9 l' A - .text:24BC2DC9 test eax, eax
7 N9 _& _9 A3 S - .text:24BC2DCB jnz short loc_24BC2DF2
' U& `9 C" u" a - .text:24BC2DCD call esi ; FreeLibrary
. Z2 y% F" m p0 p - .text:24BC2DCF mov eax, [ebp+var_8]/ Y' V% ~8 V3 A- P" z& W" k a' K6 Z0 }
- .text:24BC2DD2 push eax
: }9 i' _4 h7 N2 D7 Z1 A - .text:24BC2DD3 mov ecx, [eax]2 G4 Y: w- ^( s9 u: r Z( U
- .text:24BC2DD5 call dword ptr [ecx+8]
5 {/ ?( ]2 z) i, r/ S' F# O: Y+ F! r - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
9 a; O5 X6 V5 ~ - .text:24BC2DDB call esi ; FreeLibrary+ K/ e1 z9 b! Y4 y* M; {8 ~
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
; M3 C: _. L8 n - .text:24BC2DE2
2 u5 o8 z6 k( P& _3 ~ - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
6 Y+ G2 x, _% J Z - .text:24BC2DE2 call ds:OutputDebugStringA
% v6 E- ^2 a( n' P0 L8 i/ B4 K - .text:24BC2DE8 mov eax, 200h) m5 L2 ~8 f* n$ W" @( D( J
- .text:24BC2DED jmp loc_24BC30119 s+ a2 P* l1 Q8 ]
- .text:24BC2DF2 ; ---------------------------------------------------------------------------2 J! i+ u1 b: T' R3 R3 I1 k
- .text:24BC2DF2
$ u6 d+ t n* f1 x, G - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j5 P/ f$ \: Q- I, M7 u; r! g
- .text:24BC2DF2 call esi ; FreeLibrary
0 F- m$ V* f3 S6 ? - .text:24BC2DF4 push 6Ch ; Size
: ^- A6 @- v: P m4 w7 q1 } - .text:24BC2DF6 lea eax, [ebp+Dst]
8 O% V5 z8 d& U - .text:24BC2DFC push edi ; Val
% z Q; U4 q' q! ^/ k! O M - .text:24BC2DFD push eax ; Dst
' X5 |" d$ ^* ? - .text:24BC2DFE call memset0 [! K( a' k. E
- .text:24BC2E03 mov eax, [ebp+var_8]+ v% `' ?: [- X& \* p* R- U& I8 L
- .text:24BC2E06 add esp, 0Ch
# v* m) Q4 Q; Z4 u% v0 `/ k - .text:24BC2E09 mov [ebp+Dst], 6Ch* E2 k# i/ ^& y4 o* @( M" T9 K% J
- .text:24BC2E13 mov [ebp+var_8C], 1: H+ S2 k; k3 Y z% P9 ~: _/ y
- .text:24BC2E1D mov [ebp+var_28], 200h* B. U5 K1 A9 Y5 F
- .text:24BC2E24 mov ecx, [eax]
( q: I) j% k7 m9 W) | - .text:24BC2E26 push 8
* x' b6 w. A( ?$ m2 c - .text:24BC2E28 push edi
$ o& ]4 `+ d8 \/ f" e( Q - .text:24BC2E29 push eax( z" P. {2 r9 [
- .text:24BC2E2A call dword ptr [ecx+50h]
: J f* {" U- w3 r4 ]+ o - .text:24BC2E2D test eax, eax
% A! n. D" M% K2 G" z - .text:24BC2E2F mov eax, [ebp+var_8]
' C) ~7 X7 A' h& m$ Y - .text:24BC2E32 mov ecx, [eax]
' c& F# E j) U, X N9 A - .text:24BC2E34 jge short loc_24BC2E46+ _$ _) T2 R7 z
- .text:24BC2E36 push eax
( X f1 C& M3 ?1 Y. z - .text:24BC2E37 call dword ptr [ecx+8]" p1 E+ D& g4 f# t8 x5 s
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
0 q2 P" K1 s/ B/ x - .text:24BC2E3D call esi ; FreeLibrary. d1 r" w- n; ] w B9 M! N0 N: q( A
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
% o9 G |! E: }" X5 s - .text:24BC2E44 jmp short loc_24BC2E6D
# e2 S' n: t5 F. ? - .text:24BC2E46 ; ---------------------------------------------------------------------------
6 L) D/ y/ i. O- F K7 X - .text:24BC2E46
* ]4 U. p; e% M ` - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
+ v3 T, Z: B6 V1 U H1 P) @1 i+ K - .text:24BC2E46 lea edx, [ebp+var_C]. R. n6 d( Z/ O; {& y0 c
- .text:24BC2E49 push edi$ ~1 ~) x5 d# Y0 y' t
- .text:24BC2E4A push edx
) h) S& b% ~4 p1 @7 f - .text:24BC2E4B lea edx, [ebp+Dst]
, ]3 t$ R! g6 z' G0 A# _ - .text:24BC2E51 push edx
" z, R4 N! i! l3 o9 i6 p - .text:24BC2E52 push eax1 {5 X. x5 y4 s4 @
- .text:24BC2E53 call dword ptr [ecx+18h]
' X4 @: x& t6 g& I- S3 U/ ?; | - .text:24BC2E56 test eax, eax) \& V( Y! [6 }1 U
- .text:24BC2E58 jge short loc_24BC2E7A
+ U; y1 t0 _) D4 k - .text:24BC2E5A mov eax, [ebp+var_8]: H% d; k7 c8 d: A5 z9 g" D
- .text:24BC2E5D push eax
6 u, N1 H4 e& w! D - .text:24BC2E5E mov ecx, [eax]2 a: Y3 K! ~+ M4 s) L: x5 W
- .text:24BC2E60 call dword ptr [ecx+8]
# j/ a- F/ F: p2 [9 @; I - .text:24BC2E63 push [ebp+hLibModule] ; hLibModule* { d& y0 S2 W' N( C; M0 Q
- .text:24BC2E66 call esi ; FreeLibrary$ u5 \* c# H |* M) |2 U
- .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
8 q5 }9 Y {4 g: p - .text:24BC2E6D: j9 |, l- T, J/ b: v" A
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j' A5 S, l; D( k7 C5 D4 G. z7 @
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...$ Q, [* b0 z( ?; |9 k
- .text:24BC2E6D call ds:OutputDebugStringA) B G( F) ~3 i# O1 N3 [$ f
- .text:24BC2E73 xor eax, eax
8 [ T3 q# ^; { - .text:24BC2E75 jmp loc_24BC30114 @8 D; J; X" M: S, r
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 ; U, W+ ]8 _' N8 F# z. a# j( _) V5 H
( w0 C' N' {3 T4 }- r
8 j* j9 ]" u* S8 i0 _ |