这游戏以前分析过,本贴再写得详细一些。
( ~* U2 c6 @; C* ^4 j这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
% a! q; L# i) Q' `7 U! \注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。/ ?$ o; ^2 l$ B8 g1 ?& F
3 l( ?- p1 j1 Y" r& x: O
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
$ Q, C. m/ }9 \3 J8 M5 P: e- STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;8 t( v& e- D, ~9 }8 n
- STDMETHOD_(ULONG,AddRef) (THIS) PURE;( Z9 h- h* o0 f6 \/ j3 u8 O% l1 T
- STDMETHOD_(ULONG,Release) (THIS) PURE; d0 H' Z' e" b3 Z! `
- STDMETHOD(Compact)(THIS) PURE;
: O8 Y( H8 X0 s; q y - STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
: _: U$ j8 g9 Z; j - STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;! f0 J- f1 L$ H" r! P1 ~
- STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
. O! U9 |, x. U" a' a4 I/ `# N$ J+ z以下一段中完成CreateSurface。- .text:24BC2E53 call dword ptr [ecx+18h]
复制代码
$ f M+ I0 v* o! j1 X8 O
- q6 X0 `+ h! o- I0 [6 M% i. G5 R/ D- d f! M
$ |. W& t; X e( I! z
; P; q+ j$ {1 \) `- ^8 n- .text:24BC2CD2 ; =============== S U B R O U T I N E =======================================6 l' ]8 ~7 r5 g; P
- .text:24BC2CD23 q& B( m( A1 G/ H0 R0 l% M) a, V
- .text:24BC2CD2 ; Attributes: bp-based frame
* [& ^# M+ ?* r - .text:24BC2CD2 a: y" n; V2 G1 o" H5 o/ [
- .text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p4 g2 ?/ Y8 J7 v, _$ K4 j
- .text:24BC2CD2# h$ |! ` q8 C' x/ J+ D
- .text:24BC2CD2 Dst = dword ptr -90h s6 C* k5 r$ g
- .text:24BC2CD2 var_8C = dword ptr -8Ch1 d9 x$ f( L1 f( o/ K$ m1 z |
- .text:24BC2CD2 var_28 = dword ptr -28h! a0 q5 ?3 O6 d- `. m0 f
- .text:24BC2CD2 var_24 = dword ptr -24h
4 E6 {" @, b! |6 B9 l" `' ] - .text:24BC2CD2 var_20 = dword ptr -20h
* u5 y B0 ~) @, y3 O) t+ P" q - .text:24BC2CD2 var_1C = dword ptr -1Ch
5 l2 ?5 |* ], g3 p - .text:24BC2CD2 var_18 = dword ptr -18h
) g; r( x# S: `( [ - .text:24BC2CD2 ppv = dword ptr -14h
1 z$ e6 b: S) ~6 @# b* f! A - .text:24BC2CD2 var_10 = dword ptr -10h% w3 V. x4 _+ d' ]0 F0 U: a3 V
- .text:24BC2CD2 var_C = dword ptr -0Ch2 B6 R, t/ S- d) M+ [* t
- .text:24BC2CD2 var_8 = dword ptr -81 c2 W1 I9 {9 o( x
- .text:24BC2CD2 hLibModule = dword ptr -4
D/ e* p- G6 F$ @! P i - .text:24BC2CD2' x0 r ?9 S- d- t, _( h
- .text:24BC2CD2 push ebp
/ q& a& T3 i6 u - .text:24BC2CD3 mov ebp, esp1 g7 c- ~6 U/ |3 N3 N
- .text:24BC2CD5 sub esp, 90h4 |0 e7 d1 U, b! K& ]
- .text:24BC2CDB push ebx
; R% h+ I4 \ ~2 q8 E1 N# l% _ - .text:24BC2CDC mov ebx, ds:LoadLibraryA) M6 W, a$ I8 \: j9 \; j% B
- .text:24BC2CE2 push esi8 l# w( M: m2 Y$ K
- .text:24BC2CE3 push edi8 ]# o9 L* P/ w* o% h/ q" V
- .text:24BC2CE4 xor edi, edi
$ R& {+ Z' F5 p; C4 t% D* ^; R" _ - .text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"% C) K8 Y* l5 W1 w5 y' a
- .text:24BC2CEB mov [ebp+var_8], edi6 b" E4 {) ~2 d! a9 L7 S9 c
- .text:24BC2CEE mov [ebp+var_1C], edi* u! z0 Y/ x2 c6 I
- .text:24BC2CF1 mov [ebp+var_C], edi
4 j$ Z+ S! [! I$ C. j! W/ c* j4 F - .text:24BC2CF4 mov [ebp+var_10], edi* z# a) S* {' p' ~
- .text:24BC2CF7 mov [ebp+var_18], edi R0 a5 m5 c, y3 e4 K
- .text:24BC2CFA call ebx ; LoadLibraryA6 J2 O+ M7 r" o" W+ C/ }9 h
- .text:24BC2CFC mov esi, eax
; g! E# b. J" \; N+ P8 Y6 b - .text:24BC2CFE cmp esi, edi# e7 j1 Q# M6 E8 V4 }
- .text:24BC2D00 mov [ebp+hLibModule], esi! Y% h/ t- G9 F. k
- .text:24BC2D03 jnz short loc_24BC2D0F
$ s$ }% @8 _+ i& P2 R - .text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
) k. p U' O2 H; g' X' r/ r/ S - .text:24BC2D0A jmp loc_24BC2E6D0 k" F$ v& l& I) r% U9 [
- .text:24BC2D0F ; ---------------------------------------------------------------------------
+ C- J9 R( x$ `# {+ F) z - .text:24BC2D0F
$ c( ]! v' i% L- t# D - .text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
0 B# I5 l+ z4 L5 q) a - .text:24BC2D0F push offset ProcName ; "DirectDrawCreate"' r: V7 q' h3 W; h8 b" y
- .text:24BC2D14 push esi ; hModule, _( I" v" W9 a+ } U% u
- .text:24BC2D15 call ds:GetProcAddress( K& W( R$ f, A) k$ K0 C' X
- .text:24BC2D1B cmp eax, edi+ f2 g& Y+ o9 U! F* ^& u z
- .text:24BC2D1D jnz short loc_24BC2D302 i, g { T& r/ V" A4 n
- .text:24BC2D1F push esi ; hLibModule
1 X1 l ?2 B& X+ g2 x% Q% r - .text:24BC2D20 call ds:FreeLibrary5 V$ J8 r- L3 {4 g. M0 Y
- .text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
7 D Q2 B I$ o; A3 ? y1 x - .text:24BC2D2B jmp loc_24BC2E6D- s: Q0 L/ D) [4 f8 ?
- .text:24BC2D30 ; ---------------------------------------------------------------------------' Z1 v$ T3 m: X
- .text:24BC2D30
' F# j. Q3 ]8 ?' B: r0 l - .text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
Q& K* E& y4 }/ U - .text:24BC2D30 lea ecx, [ebp+var_8]$ u p) G1 W9 |3 ~- s
- .text:24BC2D33 push edi
3 w3 O# p5 C9 v( p - .text:24BC2D34 push ecx
v6 @# u- z2 e2 p5 m" c( V# S - .text:24BC2D35 push edi
$ j3 ^7 E& u( L1 q4 A# o - .text:24BC2D36 call eax
: g4 j! u4 t; U4 j: x - .text:24BC2D38 test eax, eax9 @ u, \/ w* b- i2 d
- .text:24BC2D3A jge short loc_24BC2D4D
: `8 G& f6 p t p2 B6 J - .text:24BC2D3C push esi ; hLibModule
- Y9 o8 v1 b$ {' H/ O - .text:24BC2D3D call ds:FreeLibrary2 d" F% t" c+ _! V( ~4 ?
- .text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"% [0 ?6 ]6 G7 b9 }/ C
- .text:24BC2D48 jmp loc_24BC2E6D
2 p1 o: w+ r* T* C& ^5 M {% o - .text:24BC2D4D ; ---------------------------------------------------------------------------$ ^3 K w$ b- W& g. z
- .text:24BC2D4D$ E3 v3 U3 C1 x9 o/ K2 ]2 P5 V
- .text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
. b: X2 A9 H1 R3 V' | - .text:24BC2D4D mov eax, [ebp+var_8]) O3 {" H1 U5 {
- .text:24BC2D50 lea edx, [ebp+var_1C]0 s% ~! ^* Y3 k* M. t7 ^, c3 B8 p* q
- .text:24BC2D53 push edx
6 [. Y8 P* U; O' T - .text:24BC2D54 push offset unk_24BC4470
! O. b9 n2 X+ R( R5 Y0 ` - .text:24BC2D59 mov ecx, [eax]
, ]% o; m" X" p: S - .text:24BC2D5B push eax3 _# c2 S$ k% D, s
- .text:24BC2D5C call dword ptr [ecx]
( ]# v: f* A& D, L - .text:24BC2D5E test eax, eax
- Q2 L! [6 v3 k- m - .text:24BC2D60 jge short loc_24BC2D87; l* [9 ^+ K7 J7 T& p
- .text:24BC2D62 mov eax, [ebp+var_8]
0 d* [$ }- @: l7 y6 n - .text:24BC2D65 push eax
$ J/ K, n/ e. h% I3 v - .text:24BC2D66 mov ecx, [eax]
. b% i V! p5 Y3 s I - .text:24BC2D68 call dword ptr [ecx+8]
; J+ \. [8 M4 h - .text:24BC2D6B push esi ; hLibModule
( `5 G! {& s8 z9 q! K - .text:24BC2D6C call ds:FreeLibrary
; r. J1 D( q2 e( z - .text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"! l3 v4 V; U, W# @0 f0 J9 ^7 j2 @2 L
- .text:24BC2D77 call ds:OutputDebugStringA8 d# y, E @. v" a& j, g
- .text:24BC2D7D mov eax, 100h
* \. l. n$ i8 `' x* e, G - .text:24BC2D82 jmp loc_24BC3011$ S' T4 r3 \( E/ R6 x
- .text:24BC2D87 ; ---------------------------------------------------------------------------8 v( g$ @; M E7 R( [/ `0 i
- .text:24BC2D87$ s$ X( f& @ b- c/ p2 a9 l
- .text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j) A0 r' T) a4 n1 a
- .text:24BC2D87 mov eax, [ebp+var_1C]
4 O& ?2 U f$ { - .text:24BC2D8A push eax& v9 t+ y0 b ?, ]$ i0 D
- .text:24BC2D8B mov ecx, [eax] {; n% n) s* d
- .text:24BC2D8D call dword ptr [ecx+8]9 a. `) ?3 P D' f
- .text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
4 ?* c' ?3 `+ N m& w6 P - .text:24BC2D95 call ebx ; LoadLibraryA
! l6 v9 M4 }; S& K" J - .text:24BC2D97 mov esi, eax
2 u* [! P: g2 W* `/ Z+ v - .text:24BC2D99 cmp esi, edi, G" W; J6 W" e% I
- .text:24BC2D9B jnz short loc_24BC2DB64 H% n! _! h% j4 V1 Q
- .text:24BC2D9D mov eax, [ebp+var_8]
4 a& |4 p: A- B( c - .text:24BC2DA0 push eax' E$ }. F" [3 W
- .text:24BC2DA1 mov ecx, [eax]$ t7 F$ n# z% U+ C/ l; A1 b# H/ V
- .text:24BC2DA3 call dword ptr [ecx+8]
5 V3 L& T( F. B, f; j' X8 v# V3 K - .text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
. I1 x1 O# f7 D5 o1 w m - .text:24BC2DA9 call ds:FreeLibrary8 B4 j0 p/ }5 c2 M9 |
- .text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"3 o9 ^) X8 v7 }. w) `! M3 ~" I4 S" \
- .text:24BC2DB4 jmp short loc_24BC2DE29 k. f. a/ X" ]- `* Y9 k0 g* c3 |# M
- .text:24BC2DB6 ; ---------------------------------------------------------------------------/ e3 y4 F- H% T+ J
- .text:24BC2DB6
w# F1 s& M! p) E, [/ X: z3 u - .text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j' J8 B/ }) u/ g, W3 l) l4 _
- .text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
5 u6 w5 H# o$ X- j" V - .text:24BC2DBB push esi ; hModule/ n5 _( g- b! K2 g* {( |2 D
- .text:24BC2DBC call ds:GetProcAddress) ^+ n! f: K0 W5 I3 i
- .text:24BC2DC2 push esi ; hLibModule
6 ~9 j* p2 X, \1 ^ - .text:24BC2DC3 mov esi, ds:FreeLibrary& f) `- j" C5 ?4 U- Q4 V
- .text:24BC2DC9 test eax, eax9 n$ X+ y8 B) S) y4 h7 g( h
- .text:24BC2DCB jnz short loc_24BC2DF2
3 O) }5 r7 x o2 e( M9 W: f" y - .text:24BC2DCD call esi ; FreeLibrary
4 `1 p/ m% x9 |; ], D - .text:24BC2DCF mov eax, [ebp+var_8]
3 k: `- I. r9 f+ O - .text:24BC2DD2 push eax
( ?7 Z6 n. g0 ? n4 m - .text:24BC2DD3 mov ecx, [eax]
! a, D% Q/ u- q l" o2 } - .text:24BC2DD5 call dword ptr [ecx+8]" q! f. X$ p4 I, y: W6 e
- .text:24BC2DD8 push [ebp+hLibModule] ; hLibModule# k2 W% Y6 s: w- y0 ], x
- .text:24BC2DDB call esi ; FreeLibrary/ a' c0 O# Z/ i7 R( p, ^6 h
- .text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
5 A7 u2 R& q2 R0 f# ~ - .text:24BC2DE2
# j/ h" n6 ?6 x; g# { - .text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
' H+ p: S% ^8 } - .text:24BC2DE2 call ds:OutputDebugStringA
9 T8 |& j* W- x) n! K( Y - .text:24BC2DE8 mov eax, 200h; n* @! |; \5 ? m
- .text:24BC2DED jmp loc_24BC3011
4 T* o- v1 {6 @$ _ - .text:24BC2DF2 ; ---------------------------------------------------------------------------
% M4 X' H* _/ V4 _! @( ^0 _ - .text:24BC2DF2
9 v9 ~2 b+ z6 ^% r7 ? - .text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
' M( M, S" V' {1 [, k - .text:24BC2DF2 call esi ; FreeLibrary! B$ e! o9 N ^$ d+ s6 \/ h
- .text:24BC2DF4 push 6Ch ; Size- u2 p: `9 a) P3 l- o
- .text:24BC2DF6 lea eax, [ebp+Dst]/ _2 Z6 `' Z8 d6 s/ G
- .text:24BC2DFC push edi ; Val
0 _* e" p5 T3 C+ K$ H& ?% d" k+ h - .text:24BC2DFD push eax ; Dst
2 [* r2 r* `: @& y. P& ] - .text:24BC2DFE call memset
7 k, |# w* @7 S, e - .text:24BC2E03 mov eax, [ebp+var_8]
/ F( Q j# }; s$ q w - .text:24BC2E06 add esp, 0Ch
. R" H2 f% |5 f/ B" | - .text:24BC2E09 mov [ebp+Dst], 6Ch$ u9 Z0 B! {: _+ B) M
- .text:24BC2E13 mov [ebp+var_8C], 11 r @9 E! K$ U! v5 M
- .text:24BC2E1D mov [ebp+var_28], 200h
) Y4 J# Y0 S0 ^; T' E( X: | - .text:24BC2E24 mov ecx, [eax]
7 Z& K2 K$ M5 x H' V - .text:24BC2E26 push 8- |" Y( R* ]; K1 f
- .text:24BC2E28 push edi4 E$ O7 N. ?% H p* }
- .text:24BC2E29 push eax
T) ]& D6 U, B" o* t2 s - .text:24BC2E2A call dword ptr [ecx+50h]
8 j) A) E! Y9 v* \/ ] - .text:24BC2E2D test eax, eax
4 \; l& n3 A2 p9 ^4 j4 {6 W - .text:24BC2E2F mov eax, [ebp+var_8]$ Z/ j8 j! u' ] l
- .text:24BC2E32 mov ecx, [eax]
$ T* Q- A @2 ?+ N g - .text:24BC2E34 jge short loc_24BC2E46
: @# M6 w, h) q1 q/ W! y - .text:24BC2E36 push eax
' q, j5 q: l% e, t - .text:24BC2E37 call dword ptr [ecx+8]4 I9 @) N, ?' F8 ~' \9 u' Q& k7 W
- .text:24BC2E3A push [ebp+hLibModule] ; hLibModule
- x# v& |; d" ^ - .text:24BC2E3D call esi ; FreeLibrary
7 p; B1 _' `& r/ b - .text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
- x5 ?9 E; T) U' a6 E. ` - .text:24BC2E44 jmp short loc_24BC2E6D
+ w2 W. S) H) N7 S( V a - .text:24BC2E46 ; ---------------------------------------------------------------------------5 C2 d# A; `$ i, _% A" N T; h
- .text:24BC2E46
; H9 D) c0 g3 [/ Q- F - .text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j" P- g2 X2 b: \& a& J, d: y: Y
- .text:24BC2E46 lea edx, [ebp+var_C]
+ w) D1 q# h- F! |1 K4 l/ C - .text:24BC2E49 push edi
2 ?4 o8 J% {# q! p# y: f! m - .text:24BC2E4A push edx
8 K4 u4 a8 t" t, L# | - .text:24BC2E4B lea edx, [ebp+Dst]
- F- E, ^$ p# t* W, E' z - .text:24BC2E51 push edx" x$ i* x5 \+ ^$ |- a
- .text:24BC2E52 push eax& R9 \1 \$ L0 y4 R% ~1 m9 s8 a" M
- .text:24BC2E53 call dword ptr [ecx+18h]8 `3 p1 N6 v- ?
- .text:24BC2E56 test eax, eax
. p" R# g# ^8 V/ r* D - .text:24BC2E58 jge short loc_24BC2E7A
5 B8 d0 o# v$ Z. P: u% n5 \' G, o - .text:24BC2E5A mov eax, [ebp+var_8]9 h, `( Q7 Q# }! o& {% f& r: n. k
- .text:24BC2E5D push eax
& G* J+ E. X" u0 Z - .text:24BC2E5E mov ecx, [eax] @' s% v% U) j) k
- .text:24BC2E60 call dword ptr [ecx+8]! q- Y9 |1 J3 E O
- .text:24BC2E63 push [ebp+hLibModule] ; hLibModule
1 x5 ?4 L: ?3 t - .text:24BC2E66 call esi ; FreeLibrary
3 o! y7 |3 f* ]/ C, b, F( S9 J - .text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"7 @! x/ S7 K, C( t6 Q0 H& @
- .text:24BC2E6D0 d; A8 m0 @1 \4 r7 n( i
- .text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
. j/ r3 T! e. m) {0 D" ? - .text:24BC2E6D ; sub_24BC2CD2+59↑j ...
! M5 F8 Q, Z6 ]3 ? - .text:24BC2E6D call ds:OutputDebugStringA t0 }1 m- u8 E9 x; [. q9 b1 j' X
- .text:24BC2E73 xor eax, eax# S' t; V# A, B" O# H' e, K$ K
- .text:24BC2E75 jmp loc_24BC3011
, g+ B, M- M+ X3 A - .text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码 , ]+ w/ Q( B$ {3 O! U J h" g% e
$ n( J* z8 N8 \: r6 B
2 u; ?& K$ O6 D% {% y0 K |