这游戏以前分析过,本贴再写得详细一些。
% _4 ~* M8 c8 S9 o' D这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
w( K% y/ s# G. K注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
; ~6 ^* \9 q& N; c7 Z/ ]
! m2 |9 |- G8 m9 g! g8 p参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.# ]* G& |& P% e5 d
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
% I" p, Q! m4 y4 i& e - STDMETHOD_(ULONG,AddRef) (THIS) PURE;
: a0 D2 ]$ U Q( i) @ - STDMETHOD_(ULONG,Release) (THIS) PURE;+ X; { S0 G* S( G/ l
- STDMETHOD(Compact)(THIS) PURE;
, }. c5 p1 Z- S: S9 x - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
! _8 S$ y. T' v& C0 d3 j( N ] - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;4 ~$ Z& ~+ a, R4 l) J+ o0 c% f
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
2 y$ D/ [ k( r6 Q+ v) A& y以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
2 U9 ^, E$ I) ~+ g2 h2 q! Z2 O* `
+ I/ T* A( c Q. w5 L$ a( c; H8 F2 z9 t, }( |$ D4 K
" @/ B7 r9 L2 m# D: K6 U- 2 B% O# B! h- Z2 u4 D
- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================) H; l! j- g+ I5 H. @8 n
- .text:24BC2CD2
6 i' P* @+ T) \2 Y$ z/ R; H - .text:24BC2CD2 ; Attributes: bp-based frame/ ^/ G3 p7 R' R9 J
- .text:24BC2CD2
" p) Q+ p0 I+ f, I6 W - .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
" F8 ~# }* j! N5 B! F# l" N - .text:24BC2CD2
+ R* n/ v' s3 v* Z- q' P; x% ~ - .text:24BC2CD2 Dst = dword ptr -90h
+ O* F4 N/ ?$ R( N3 X - .text:24BC2CD2 var_8C = dword ptr -8Ch
( s- x$ y* R/ `, @( B - .text:24BC2CD2 var_28 = dword ptr -28h
% C. n3 l t' {- W i4 W& G - .text:24BC2CD2 var_24 = dword ptr -24h v& C e; Q* }
- .text:24BC2CD2 var_20 = dword ptr -20h b$ W% E& s9 c) _. f
- .text:24BC2CD2 var_1C = dword ptr -1Ch
$ Q/ s- _/ k- l# n. j - .text:24BC2CD2 var_18 = dword ptr -18h
2 X6 Q+ w7 F3 E* b - .text:24BC2CD2 ppv = dword ptr -14h
' V0 v2 S' @7 ]' @ - .text:24BC2CD2 var_10 = dword ptr -10h
( v' b/ i% j. P! C - .text:24BC2CD2 var_C = dword ptr -0Ch+ _ J7 {" D7 O% d" L( g
- .text:24BC2CD2 var_8 = dword ptr -8& n D# a: Z" G* J4 C
- .text:24BC2CD2 hLibModule = dword ptr -4
# P& J# ?9 S T - .text:24BC2CD2. w* C* b/ \' X, r6 M2 p1 r" s
- .text:24BC2CD2 push ebp
9 O5 ?, {+ o9 U" @9 w3 L - .text:24BC2CD3 mov ebp, esp8 R2 i1 D2 b0 T8 u. ?1 I
- .text:24BC2CD5 sub esp, 90h
2 ?& z. q" f0 u# G1 ]7 O6 X ? - .text:24BC2CDB push ebx
1 R, I8 P5 ?- j2 ~, H - .text:24BC2CDC mov ebx, ds:LoadLibraryA) _" F9 o8 Q" d4 `
- .text:24BC2CE2 push esi
: ], K/ C9 c3 M# s - .text:24BC2CE3 push edi6 f$ U& r$ J+ h" d. H1 u
- .text:24BC2CE4 xor edi, edi1 Z, |) Z5 |& K0 V- s; K# b
- .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
+ n0 e0 {, I. M - .text:24BC2CEB mov [ebp+var_8], edi; L: P! b( E8 N
- .text:24BC2CEE mov [ebp+var_1C], edi0 C2 X8 \$ @& T
- .text:24BC2CF1 mov [ebp+var_C], edi
" P! b: G- y$ E3 |" h% m - .text:24BC2CF4 mov [ebp+var_10], edi E5 O, z: W0 D$ y/ B5 A& a
- .text:24BC2CF7 mov [ebp+var_18], edi
) k; M. [+ e1 a1 v, B3 P4 E8 d8 k - .text:24BC2CFA call ebx ; LoadLibraryA% ]* y% [6 Y4 i9 _/ a4 W
- .text:24BC2CFC mov esi, eax
* C" N! K3 G) P" i' D - .text:24BC2CFE cmp esi, edi
- d% b' ^. ^/ p ~ - .text:24BC2D00 mov [ebp+hLibModule], esi- [$ |5 d' C$ d7 c$ H/ k
- .text:24BC2D03 jnz short loc_24BC2D0F
) w$ j' n: _) J& e3 W - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"3 H/ i6 C3 y0 B. D |
- .text:24BC2D0A jmp loc_24BC2E6D2 k* k; q! H# I# y# E& F
- .text:24BC2D0F ; ---------------------------------------------------------------------------
0 d T! J' T$ L* @4 i - .text:24BC2D0F
; [: r& p9 R# h - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
m! w7 M+ j( q - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"5 d- B g6 O4 y/ o* r
- .text:24BC2D14 push esi ; hModule$ r8 t1 J; A5 L6 y
- .text:24BC2D15 call ds:GetProcAddress
( f, u* C* O) O. G$ X/ b - .text:24BC2D1B cmp eax, edi$ ^+ `5 k& x6 B8 _3 k
- .text:24BC2D1D jnz short loc_24BC2D30
* X; Z. i' @, n3 _ - .text:24BC2D1F push esi ; hLibModule
# N$ |- B7 U( f! T4 c { - .text:24BC2D20 call ds:FreeLibrary% N' D+ D, J$ W0 G* k' \
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
- n- o8 G7 @( s8 ]: O - .text:24BC2D2B jmp loc_24BC2E6D/ N6 T4 ^. G" W$ P
- .text:24BC2D30 ; ---------------------------------------------------------------------------% u7 j. ?6 o& J, G
- .text:24BC2D30
8 W- `7 e- Y* s: M3 J - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
% d$ Y( y. t% K - .text:24BC2D30 lea ecx, [ebp+var_8]
3 z6 g C* y- `7 A6 f - .text:24BC2D33 push edi! o3 f7 g1 B3 N5 {+ n2 e
- .text:24BC2D34 push ecx
( A% ]* \$ A+ {) T9 c/ c, V* T - .text:24BC2D35 push edi
7 t* O" J: }) D3 ` - .text:24BC2D36 call eax
; y9 a8 K6 t$ J) g - .text:24BC2D38 test eax, eax
! i; `! v/ C) ^& C- v3 x - .text:24BC2D3A jge short loc_24BC2D4D
: d4 ^6 s5 _! B; @4 I: m( E& w - .text:24BC2D3C push esi ; hLibModule* O+ n; i. ~0 _: s
- .text:24BC2D3D call ds:FreeLibrary3 V @3 c, u. \) R
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
) M$ y5 S3 X$ N - .text:24BC2D48 jmp loc_24BC2E6D1 J8 C; Y' T/ _
- .text:24BC2D4D ; ---------------------------------------------------------------------------" ^ z0 q" ?: t5 S4 M: f
- .text:24BC2D4D
; H* U3 ?0 |, t - .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j1 ]- b$ f% T' D1 s, ?: K& {
- .text:24BC2D4D mov eax, [ebp+var_8]
$ {0 Q8 { V- A) d q2 K5 a* q! D9 H - .text:24BC2D50 lea edx, [ebp+var_1C]3 A9 D2 p0 V: d2 W
- .text:24BC2D53 push edx9 M* Q1 \0 K0 }5 P1 {
- .text:24BC2D54 push offset unk_24BC4470
5 Z) K: ?" i7 o1 I - .text:24BC2D59 mov ecx, [eax]' d) v4 s! A5 Q
- .text:24BC2D5B push eax
0 k% }3 k3 ?* B: t; W k - .text:24BC2D5C call dword ptr [ecx]
. q6 F5 A# Q1 _, | - .text:24BC2D5E test eax, eax* K/ D4 |0 {; `% x) Y2 Q1 T8 D
- .text:24BC2D60 jge short loc_24BC2D87# z a, u, h6 X& c
- .text:24BC2D62 mov eax, [ebp+var_8]
. l1 x# E1 _4 t. G9 n! C - .text:24BC2D65 push eax
6 H7 g$ H" A6 [; T* O! j) z' ^; g! Q - .text:24BC2D66 mov ecx, [eax]
( g" q+ u2 O9 d3 r) S% u5 T - .text:24BC2D68 call dword ptr [ecx+8]% J N% r# G" j: \% G# U# \$ N: e
- .text:24BC2D6B push esi ; hLibModule. s, Y: x( y# `/ R0 A! c) Q
- .text:24BC2D6C call ds:FreeLibrary9 M1 H! ^+ n& _/ g4 C
- .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
3 Q% v0 `3 Q4 m @ - .text:24BC2D77 call ds:OutputDebugStringA
0 n! ] L$ j- {# m - .text:24BC2D7D mov eax, 100h
. G/ \8 J9 M, T! } - .text:24BC2D82 jmp loc_24BC30112 r. \" T) |: t L0 S" l
- .text:24BC2D87 ; ---------------------------------------------------------------------------3 s+ D8 R) h. s5 X: U6 U) S# `8 ~
- .text:24BC2D87/ B9 X4 k; Q! t/ U, C
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j& {$ V2 z3 I# S5 e: l4 l. D
- .text:24BC2D87 mov eax, [ebp+var_1C]
2 d; V: q! M5 b. e" ` - .text:24BC2D8A push eax
& n: Q' X- q' J - .text:24BC2D8B mov ecx, [eax] `. K& u+ @* h% D0 W
- .text:24BC2D8D call dword ptr [ecx+8]
6 l2 X# Z+ E6 P( `$ ^1 i - .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
$ _) B5 F9 |& T: k0 {/ ^1 a - .text:24BC2D95 call ebx ; LoadLibraryA6 D+ J( \) D2 f
- .text:24BC2D97 mov esi, eax6 ?8 h, e$ F0 B1 s
- .text:24BC2D99 cmp esi, edi
' q6 A& g3 X( M3 \2 X9 R' U4 z) z - .text:24BC2D9B jnz short loc_24BC2DB6
3 ]7 D/ G+ v) Q1 Q - .text:24BC2D9D mov eax, [ebp+var_8]) b4 S' h- j; P* b" M" `- g
- .text:24BC2DA0 push eax
4 _0 A- {8 h" s - .text:24BC2DA1 mov ecx, [eax]
c/ e3 X. I5 N. X# F+ g# n6 C, w# A. ] - .text:24BC2DA3 call dword ptr [ecx+8]
2 O b+ g0 e1 v1 U7 ] - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule S3 H$ i0 w+ h- E: `2 F" \. {" ~
- .text:24BC2DA9 call ds:FreeLibrary
+ G, a# n7 ?, ^/ N6 d: B% E9 N2 { - .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
5 H& \, A2 Y; \8 O; x4 a2 X6 D, C - .text:24BC2DB4 jmp short loc_24BC2DE2
2 e" C4 A1 q9 J' F3 }' d6 q8 n9 @ - .text:24BC2DB6 ; ---------------------------------------------------------------------------
. N2 h w7 U& E - .text:24BC2DB6
- x7 Z. H& V( ^7 B5 a - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
4 F3 p4 D, e0 A" E: m) \0 X - .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
* U) y- k y. ]' O$ P - .text:24BC2DBB push esi ; hModule
7 a! J# C; n) B+ p7 l6 I - .text:24BC2DBC call ds:GetProcAddress. r* `) ^: |5 p9 \) j, A
- .text:24BC2DC2 push esi ; hLibModule8 [% E: H$ o1 |( i. z; J8 t
- .text:24BC2DC3 mov esi, ds:FreeLibrary
% y* w6 A& u N# ~2 }* l) i4 L - .text:24BC2DC9 test eax, eax2 H- O M. m& Q4 S; s U
- .text:24BC2DCB jnz short loc_24BC2DF2+ @4 b5 I+ b+ r$ w
- .text:24BC2DCD call esi ; FreeLibrary
: ]0 C; T8 R" g* q3 i - .text:24BC2DCF mov eax, [ebp+var_8]! j& Z. ~3 C3 N* t8 D# u8 N
- .text:24BC2DD2 push eax- \$ G+ z4 Z/ k" N$ b5 a3 V4 R
- .text:24BC2DD3 mov ecx, [eax]
* `& }) r4 L3 H# u) f - .text:24BC2DD5 call dword ptr [ecx+8]
, X0 g# e+ S' ?3 P, ?( n* z) v - .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
% d% _* \9 `4 _+ T: D( u2 g - .text:24BC2DDB call esi ; FreeLibrary. M- s7 G% H I# @
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
- S% A; u, {+ i3 j$ p - .text:24BC2DE2
2 w* k b7 V% K8 |: A% w5 C& |2 m/ w - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j7 A! F8 f9 {/ T2 M2 d
- .text:24BC2DE2 call ds:OutputDebugStringA, H4 e+ {% Q, j) H2 K2 X
- .text:24BC2DE8 mov eax, 200h( [( e" m/ q s9 G% M
- .text:24BC2DED jmp loc_24BC3011) Q' Q7 G, m! I0 w' j ?* c: o
- .text:24BC2DF2 ; ---------------------------------------------------------------------------
* O0 Y& l6 Q* t& P - .text:24BC2DF2
& N, ~1 g1 N# y3 l( Q+ n; D - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
0 u+ X: z( I+ f - .text:24BC2DF2 call esi ; FreeLibrary7 M' r# I6 T" k
- .text:24BC2DF4 push 6Ch ; Size
" u' l5 r) V) j3 N - .text:24BC2DF6 lea eax, [ebp+Dst]
; U/ v4 G- Y. u" W - .text:24BC2DFC push edi ; Val
4 _. h3 U# f5 n! c! | - .text:24BC2DFD push eax ; Dst( G4 }9 K& O, _7 j+ c' b- `
- .text:24BC2DFE call memset
- L! p- [5 ?* }2 q% m7 { - .text:24BC2E03 mov eax, [ebp+var_8]* k& b; h: N3 z* ?* I
- .text:24BC2E06 add esp, 0Ch
4 g9 n6 ^8 J1 N% ~! [/ u- h2 v4 X - .text:24BC2E09 mov [ebp+Dst], 6Ch; V0 g( S- q9 @1 V
- .text:24BC2E13 mov [ebp+var_8C], 1
# i _) d* E0 V4 Q9 t: V t - .text:24BC2E1D mov [ebp+var_28], 200h7 u6 C8 u! M4 m/ z
- .text:24BC2E24 mov ecx, [eax]
f2 m# \4 D1 b' O9 n$ U& l+ k - .text:24BC2E26 push 8
% ?4 b: N4 j) G+ ~/ N6 S5 r4 c - .text:24BC2E28 push edi& I' x; R$ M2 c$ m' `
- .text:24BC2E29 push eax1 T0 Y% K( S) i. D
- .text:24BC2E2A call dword ptr [ecx+50h]
/ p: l8 F2 F+ l% y. \. R e - .text:24BC2E2D test eax, eax
k _7 m- B: y" r - .text:24BC2E2F mov eax, [ebp+var_8]1 o3 {( a7 c+ C; G1 Z' u
- .text:24BC2E32 mov ecx, [eax]
2 ^3 k$ g7 g) [/ x7 R; M - .text:24BC2E34 jge short loc_24BC2E469 A( B+ C1 m3 r0 s, R
- .text:24BC2E36 push eax
9 `7 S% r3 |9 u: d - .text:24BC2E37 call dword ptr [ecx+8]
9 p8 \3 v* M5 ?1 Z - .text:24BC2E3A push [ebp+hLibModule] ; hLibModule9 t9 ?" U5 U, d/ t. a$ B' C# i
- .text:24BC2E3D call esi ; FreeLibrary* F! X% H' s& N/ V
- .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"* N$ `+ n4 h( L c1 N
- .text:24BC2E44 jmp short loc_24BC2E6D& I b d7 P: r$ X `
- .text:24BC2E46 ; ---------------------------------------------------------------------------+ Z+ x* R0 K% k) j
- .text:24BC2E46; V& F# l# z2 E9 i
- .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j1 j) w; i) g* G, d
- .text:24BC2E46 lea edx, [ebp+var_C]! C. _4 U! ^& Z+ e, j
- .text:24BC2E49 push edi# c1 P0 f# A. f D
- .text:24BC2E4A push edx* [" {2 D# Y9 t( u9 |
- .text:24BC2E4B lea edx, [ebp+Dst]! i" B9 ^! f0 w# F9 q
- .text:24BC2E51 push edx+ |0 \5 V/ B& U2 y8 Z5 e) d+ D
- .text:24BC2E52 push eax
. B- C5 p2 a: i - .text:24BC2E53 call dword ptr [ecx+18h]
6 }5 A" c$ k0 |6 R: W( d. o - .text:24BC2E56 test eax, eax8 P8 ]0 u1 T( z5 \- @( I8 k
- .text:24BC2E58 jge short loc_24BC2E7A9 d0 w; h% F" S, c" u8 z
- .text:24BC2E5A mov eax, [ebp+var_8]
! F0 a4 ]" V, n* o. x - .text:24BC2E5D push eax
- G% G9 J6 U& r# m" x! V" {0 A- e4 v - .text:24BC2E5E mov ecx, [eax]
; T. [& k1 e% t7 O - .text:24BC2E60 call dword ptr [ecx+8]# D9 ^. Q `7 \: C! v( e" V/ L
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule2 F' ]: }6 b7 i2 T2 b
- .text:24BC2E66 call esi ; FreeLibrary
7 Q# m$ a) ~: C5 d% X' O - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"2 `5 w' P8 [/ p1 D4 |. ?
- .text:24BC2E6D5 @0 a, E8 h r4 P
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j, N& E/ x2 z" U( M6 ^
- .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
8 c, }& f8 S" x$ { - .text:24BC2E6D call ds:OutputDebugStringA
}6 I2 _8 f, p: R5 H8 u% a - .text:24BC2E73 xor eax, eax+ S9 I5 |! |0 ~# x1 |* n9 Z# H# a
- .text:24BC2E75 jmp loc_24BC30111 G. u# Y4 A3 _0 f
- .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 . K d1 V5 \3 ?/ V4 K& B' i
. b+ v2 Y0 c# W' j/ \8 Z9 x3 m) C; R, i, j
|