冒险解谜游戏中文网 ChinaAVG
标题:
【DirectDraw游戏汉化 #2】 静物前传(Post Mortem)寻找CreateSurface
[打印本页]
作者:
shane007
时间:
2023-8-25 16:59
标题:
【DirectDraw游戏汉化 #2】 静物前传(Post Mortem)寻找CreateSurface
这游戏以前分析过,本贴再写得详细一些。
* {7 \* n, ^* y- ~; B% H P, G$ ]
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
+ V0 {& h& g4 S2 Y( m
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
( p6 ` U( q) J! o: b: e6 Y
& e, B$ l$ \, T Z2 U; T' u
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
2 X$ x0 K, ^8 W
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
5 m4 s' i2 z( Y& [. S$ g
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
; p: x( J% F$ _4 [! H" a
STDMETHOD_(ULONG,Release) (THIS) PURE;
t9 I V* V- F* S# |. ]$ j$ @* z( s
STDMETHOD(Compact)(THIS) PURE;
7 X! P9 U6 c, R: v) Q
STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
0 f+ K; L8 w/ }' [. W
STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
3 a6 [1 o# F) x& S# @
STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
4 o0 h! U" l( f% Z( c
以下一段中完成CreateSurface。
.text:24BC2E53 call dword ptr [ecx+18h]
复制代码
" X' P b( n- w( D
7 d! y3 Z4 [3 s( D/ t3 _6 j6 i7 u) l
" Z$ n) ?( C; ]7 O8 j' x
3 [" c, g' t# C s5 @
Y% T# p ]: _$ @- P
.text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
# s6 p: S+ c/ x1 t( B- n1 q
.text:24BC2CD2
& C/ o8 \/ R9 |2 V& L& [
.text:24BC2CD2 ; Attributes: bp-based frame
; n( U) }% Q+ ?+ j
.text:24BC2CD2
3 q" k- A4 b6 p. n
.text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
7 \' J! U* W2 m4 ` S" \# k
.text:24BC2CD2
1 i6 i9 x# C$ E( y& k5 Z
.text:24BC2CD2 Dst = dword ptr -90h
4 b- u7 T o# r; K3 ^$ Z
.text:24BC2CD2 var_8C = dword ptr -8Ch
: n( e/ h& ^$ v: ]5 \4 n/ o0 Y; M
.text:24BC2CD2 var_28 = dword ptr -28h
, V) B& p8 @( m% _
.text:24BC2CD2 var_24 = dword ptr -24h
) w3 a. o' u* X1 Q/ |
.text:24BC2CD2 var_20 = dword ptr -20h
" Q$ t) B# e6 v# X4 j
.text:24BC2CD2 var_1C = dword ptr -1Ch
& M# Y. A9 l* ^7 e2 \6 n0 h
.text:24BC2CD2 var_18 = dword ptr -18h
) ]/ K3 n; E& M7 ^2 `
.text:24BC2CD2 ppv = dword ptr -14h
, Y$ f4 K3 f) l
.text:24BC2CD2 var_10 = dword ptr -10h
; K7 g8 ~# p8 J8 ^5 @
.text:24BC2CD2 var_C = dword ptr -0Ch
. j' R8 B: {% F9 M* A `- z
.text:24BC2CD2 var_8 = dword ptr -8
6 C' J* `9 v, r2 h2 ]
.text:24BC2CD2 hLibModule = dword ptr -4
' J1 ?$ v' v. a3 D$ |" F& q, z
.text:24BC2CD2
, @8 f R1 {6 V6 a% y
.text:24BC2CD2 push ebp
% Q' M3 s& m! |3 S5 A9 R+ e: ]
.text:24BC2CD3 mov ebp, esp
G# g: [/ m& }+ L' E! \
.text:24BC2CD5 sub esp, 90h
+ h7 `, n& s3 L- P) e$ d0 D2 ~
.text:24BC2CDB push ebx
3 |. D6 h. Q/ }: Y1 i, @+ F
.text:24BC2CDC mov ebx, ds:LoadLibraryA
# n0 @- j! ?% l- U+ X8 O% `
.text:24BC2CE2 push esi
% N* x3 \; O7 G! Z |* w
.text:24BC2CE3 push edi
3 n8 R9 e. }) |5 G% s4 j( A1 t
.text:24BC2CE4 xor edi, edi
. P' E! ]! d3 N* c" u
.text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
: ?# j0 w# |8 }; m5 o
.text:24BC2CEB mov [ebp+var_8], edi
8 F6 ]6 w$ p2 Q a
.text:24BC2CEE mov [ebp+var_1C], edi
1 a) w* E+ ~5 w4 @" [
.text:24BC2CF1 mov [ebp+var_C], edi
2 p% l8 i. [; I7 w3 B2 `
.text:24BC2CF4 mov [ebp+var_10], edi
8 c9 g8 V, f4 E' A' G2 j
.text:24BC2CF7 mov [ebp+var_18], edi
7 Z/ F. P) ]3 D
.text:24BC2CFA call ebx ; LoadLibraryA
. k2 E3 }- S! Q0 ^/ j% [
.text:24BC2CFC mov esi, eax
$ p6 c# s2 \3 o6 N& Q5 H' ^
.text:24BC2CFE cmp esi, edi
3 I! Z; k* Q: X h/ n) p% v" m
.text:24BC2D00 mov [ebp+hLibModule], esi
/ D6 Z8 H* `# W7 A5 h a
.text:24BC2D03 jnz short loc_24BC2D0F
* c- a0 c' ?& Q) H+ M
.text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
$ M- o( ~. e% U0 B0 o; \
.text:24BC2D0A jmp loc_24BC2E6D
0 v/ D! Z" ]6 s( D: L2 B5 O' i# v% I
.text:24BC2D0F ; ---------------------------------------------------------------------------
9 C0 w9 d/ R: P- a) P' [
.text:24BC2D0F
0 K1 S! x+ ?1 g/ k7 d% T5 ~0 H
.text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
# V7 o8 \# {* M9 T
.text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
5 H7 m& p* R$ p5 N( W9 u
.text:24BC2D14 push esi ; hModule
$ q3 a2 @8 q% r4 a: ?0 a0 |
.text:24BC2D15 call ds:GetProcAddress
$ ]- V0 L3 `3 O/ S2 U% @
.text:24BC2D1B cmp eax, edi
, k K7 x. t+ ~: _" E3 J0 T
.text:24BC2D1D jnz short loc_24BC2D30
8 y$ T7 X! T* q. ^: {5 n
.text:24BC2D1F push esi ; hLibModule
* \' \ h8 n* l" E' u
.text:24BC2D20 call ds:FreeLibrary
; r1 ~1 o1 [4 X, R" I8 z; v9 i; X2 Z
.text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
( e# E7 x$ Z# t, ^7 k# d
.text:24BC2D2B jmp loc_24BC2E6D
0 A& w0 w0 T% ^3 H) N+ H' P
.text:24BC2D30 ; ---------------------------------------------------------------------------
' x; {" c3 h/ M5 V; R- m: |# N
.text:24BC2D30
* @; M) T# ]$ V5 X* e9 r8 V* j
.text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
1 j; h6 y3 Z/ e: m8 F9 f
.text:24BC2D30 lea ecx, [ebp+var_8]
8 S3 Z. v* S- W* H/ i) ~
.text:24BC2D33 push edi
+ t4 {- H, d# c
.text:24BC2D34 push ecx
5 n4 F0 u% Z, o4 T7 q4 R/ @6 a% y
.text:24BC2D35 push edi
/ L+ i6 C' F5 f% P$ z
.text:24BC2D36 call eax
+ D \( b% V9 P; j4 |5 C
.text:24BC2D38 test eax, eax
/ p$ O) C4 Z7 \
.text:24BC2D3A jge short loc_24BC2D4D
% u- P) d8 E: Q3 O4 s. @
.text:24BC2D3C push esi ; hLibModule
5 ^ _5 C4 G" G8 \3 x
.text:24BC2D3D call ds:FreeLibrary
3 f" V4 ?; U; y% I6 Y
.text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
/ W1 C% ?! X8 R2 f% F
.text:24BC2D48 jmp loc_24BC2E6D
. D0 R3 o; a+ r! X3 s8 y
.text:24BC2D4D ; ---------------------------------------------------------------------------
- o4 x- G# a4 a3 j3 }
.text:24BC2D4D
$ r3 I$ V* Q8 Q3 m
.text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
( H( D; T% O3 F- Q
.text:24BC2D4D mov eax, [ebp+var_8]
* n6 E4 \0 c. Q" R9 z
.text:24BC2D50 lea edx, [ebp+var_1C]
5 J, B3 P1 Y) p
.text:24BC2D53 push edx
/ _, B a) G4 T
.text:24BC2D54 push offset unk_24BC4470
' W6 |# @; y6 P& _2 K( i
.text:24BC2D59 mov ecx, [eax]
! Z/ z# O- n) n/ G2 w- T
.text:24BC2D5B push eax
! t; {, F" |4 i4 i0 M
.text:24BC2D5C call dword ptr [ecx]
8 \0 ]/ y( B b: c" X2 G
.text:24BC2D5E test eax, eax
% |/ x& ~( _3 ]8 O1 W4 d4 N Y
.text:24BC2D60 jge short loc_24BC2D87
+ X/ U- I5 g: R& M8 {% _! B4 Y
.text:24BC2D62 mov eax, [ebp+var_8]
8 ^* Q& c8 E. f% l1 H4 N
.text:24BC2D65 push eax
: n2 S( y4 x6 @( Y/ j% U* R- G
.text:24BC2D66 mov ecx, [eax]
4 r, Y, t* [( [) E- Q
.text:24BC2D68 call dword ptr [ecx+8]
; z/ K- P% @2 f4 _. ] ^ y1 m4 y
.text:24BC2D6B push esi ; hLibModule
2 I* V* e) c l1 k
.text:24BC2D6C call ds:FreeLibrary
9 ^7 F/ M1 O% T" ?$ d9 R+ `
.text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
' H: d" z* H) Z' ?9 ?
.text:24BC2D77 call ds:OutputDebugStringA
: L, P7 S, B/ Z% ?3 }1 Y
.text:24BC2D7D mov eax, 100h
9 N; H' ?' L* Z: B
.text:24BC2D82 jmp loc_24BC3011
: N0 \3 N s) H, G0 J( \
.text:24BC2D87 ; ---------------------------------------------------------------------------
% v" A) V) E5 W2 P
.text:24BC2D87
; s& C6 i Y/ d3 `2 R6 u
.text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
$ E7 Q9 w4 n* K
.text:24BC2D87 mov eax, [ebp+var_1C]
! E* r8 ^9 v4 [4 |( m
.text:24BC2D8A push eax
D4 l X& [" v5 G: ?# h
.text:24BC2D8B mov ecx, [eax]
5 P7 }2 E6 ~3 ]
.text:24BC2D8D call dword ptr [ecx+8]
E9 L( A( r$ C d: Z( d
.text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
4 e9 Z1 H& O }1 W
.text:24BC2D95 call ebx ; LoadLibraryA
4 r; ^6 A q2 k9 r, u4 w
.text:24BC2D97 mov esi, eax
}. t# Q( g( L+ d) P
.text:24BC2D99 cmp esi, edi
/ M v, E1 f& y Q8 Z. Y) x- c
.text:24BC2D9B jnz short loc_24BC2DB6
% A$ m3 y/ s, `$ E
.text:24BC2D9D mov eax, [ebp+var_8]
5 C# ?" w, L! _9 u" w# W& |0 N0 F
.text:24BC2DA0 push eax
3 i9 J/ E A7 s! X5 [ K. L
.text:24BC2DA1 mov ecx, [eax]
7 ^. C, I8 u4 U7 H, j
.text:24BC2DA3 call dword ptr [ecx+8]
9 h: J z- {; m% _3 x' M' X
.text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
2 T6 Z2 T2 h( r) O
.text:24BC2DA9 call ds:FreeLibrary
1 P/ |6 r! z/ \) T8 f- z
.text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
2 c8 L8 S7 `+ x- c% ?
.text:24BC2DB4 jmp short loc_24BC2DE2
w6 I' X( h' j
.text:24BC2DB6 ; ---------------------------------------------------------------------------
/ o( {9 P9 ~, [/ q& y$ i
.text:24BC2DB6
. O+ k* v7 ]( G5 I3 M
.text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
) y# S' A6 D6 h. F% H
.text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
8 n1 {( I' Z3 |! T, r3 z
.text:24BC2DBB push esi ; hModule
4 ?5 Q/ B! m% Q5 o, S
.text:24BC2DBC call ds:GetProcAddress
5 V( o6 x% L% e# t
.text:24BC2DC2 push esi ; hLibModule
1 F' \( C' n5 t' T5 _2 @% l
.text:24BC2DC3 mov esi, ds:FreeLibrary
2 T( r6 f& o' E; ~9 x" K0 J$ Z2 B
.text:24BC2DC9 test eax, eax
8 D! W! U! N2 c6 W
.text:24BC2DCB jnz short loc_24BC2DF2
' r$ Z- o7 B3 W
.text:24BC2DCD call esi ; FreeLibrary
/ T9 K f5 s! P. x# N. l/ T
.text:24BC2DCF mov eax, [ebp+var_8]
7 C# B% I' l6 Y, Z, A# L0 R* W
.text:24BC2DD2 push eax
% u" N1 m7 J% l S" g
.text:24BC2DD3 mov ecx, [eax]
6 @- {5 V a3 G' ?4 u+ p6 }
.text:24BC2DD5 call dword ptr [ecx+8]
2 ?; M$ E# j& U2 _1 B" u [
.text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
5 d- J4 x3 O# g b8 u8 h6 N
.text:24BC2DDB call esi ; FreeLibrary
; ^) p; ^: B( X! W5 _3 U K( h
.text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
& p4 N$ B7 m+ u t6 D( ^: k
.text:24BC2DE2
# F2 H) O s# n7 _) e
.text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
) K [- w" B1 W" B
.text:24BC2DE2 call ds:OutputDebugStringA
) X9 f7 T( }8 T) o, l. B. P
.text:24BC2DE8 mov eax, 200h
5 W7 g2 f( g1 [' b( g- i
.text:24BC2DED jmp loc_24BC3011
( D7 K/ \7 L. q; ^0 o, n, x* h6 z
.text:24BC2DF2 ; ---------------------------------------------------------------------------
4 b, Z! s3 _* D; L# N
.text:24BC2DF2
% Q0 B. d" K' A- X
.text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
- N2 b) |5 r3 p" S- P/ d
.text:24BC2DF2 call esi ; FreeLibrary
6 V# Q4 Y) p1 \/ L1 `$ f
.text:24BC2DF4 push 6Ch ; Size
3 Y2 |6 L6 c$ k
.text:24BC2DF6 lea eax, [ebp+Dst]
+ s6 K8 P, o% f2 w
.text:24BC2DFC push edi ; Val
8 V6 M$ z$ n5 l" d
.text:24BC2DFD push eax ; Dst
7 M9 {$ I$ P: e& p, k @9 ^7 b
.text:24BC2DFE call memset
& H( Y z1 S. N. x7 @
.text:24BC2E03 mov eax, [ebp+var_8]
* {# I) k6 F' o- i% H# `! X% N
.text:24BC2E06 add esp, 0Ch
x6 F+ [: V2 D: {2 g
.text:24BC2E09 mov [ebp+Dst], 6Ch
9 Q' l2 `! n: e
.text:24BC2E13 mov [ebp+var_8C], 1
; F: w% _; p9 c# O: H# V8 D4 y) z/ o: q0 n
.text:24BC2E1D mov [ebp+var_28], 200h
* V. p6 ?" I4 y
.text:24BC2E24 mov ecx, [eax]
, e/ l _! w3 j
.text:24BC2E26 push 8
( X3 ?6 N% Z- P3 i- j9 a
.text:24BC2E28 push edi
) `5 D+ x3 b" \; D- @+ ]
.text:24BC2E29 push eax
3 [/ O# @3 c* F+ ~; {+ Y4 Y
.text:24BC2E2A call dword ptr [ecx+50h]
, E# w" n* k ~9 {8 E/ u
.text:24BC2E2D test eax, eax
( r% ?8 X$ I. |; i9 {. y2 }+ j; f
.text:24BC2E2F mov eax, [ebp+var_8]
1 J+ X; g# z0 O3 J+ r% M
.text:24BC2E32 mov ecx, [eax]
+ C- D9 |, a- R4 @% M+ M7 V
.text:24BC2E34 jge short loc_24BC2E46
- G8 u. g4 v2 @ ~, e% w- b
.text:24BC2E36 push eax
( q. ^! X' {/ U5 `$ w5 L2 W! V
.text:24BC2E37 call dword ptr [ecx+8]
; H: Z5 \5 V7 @: d% `1 L" J
.text:24BC2E3A push [ebp+hLibModule] ; hLibModule
7 j) i/ I! r- q8 a ]) f' X' [6 j
.text:24BC2E3D call esi ; FreeLibrary
. Y g: P8 x1 @5 B
.text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
@" c! h% |7 i) \
.text:24BC2E44 jmp short loc_24BC2E6D
4 L9 O7 M/ i0 B
.text:24BC2E46 ; ---------------------------------------------------------------------------
3 C i7 \& e9 r% m" L, u
.text:24BC2E46
% ]' \# m C3 |. {/ L8 i8 h
.text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
- y5 |4 _2 t! Z
.text:24BC2E46 lea edx, [ebp+var_C]
% b- N; v: J9 J8 j# ?, C1 t
.text:24BC2E49 push edi
7 P2 W7 G0 i! T& y
.text:24BC2E4A push edx
* }" i1 T @4 @
.text:24BC2E4B lea edx, [ebp+Dst]
) E4 d" X1 d. b, O O- o* S, X
.text:24BC2E51 push edx
# T4 r" ?1 A! y! w% s
.text:24BC2E52 push eax
, ?8 O: h/ ?5 R4 O4 }
.text:24BC2E53 call dword ptr [ecx+18h]
# Q* n3 t2 B7 g5 L
.text:24BC2E56 test eax, eax
" _3 o! q+ n9 z3 \
.text:24BC2E58 jge short loc_24BC2E7A
2 N; W+ [/ V- |$ W; f# s* ]$ }
.text:24BC2E5A mov eax, [ebp+var_8]
& B* P. Y" A& A
.text:24BC2E5D push eax
B3 z. Z) n F% b, _0 J
.text:24BC2E5E mov ecx, [eax]
5 ?$ Q3 Q8 F: W
.text:24BC2E60 call dword ptr [ecx+8]
0 j0 M8 r$ ~6 G+ d/ h
.text:24BC2E63 push [ebp+hLibModule] ; hLibModule
2 k; q5 H9 N1 M. T) I1 K
.text:24BC2E66 call esi ; FreeLibrary
6 j# u0 c; @) ]+ E5 T
.text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
+ G& [% y. c# a9 Z6 K+ F1 A& {; |
.text:24BC2E6D
8 i/ g) C4 S, g$ `2 g$ G) q4 v1 o
.text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
3 x! K% s( M! ^8 M" D: N; d3 f
.text:24BC2E6D ; sub_24BC2CD2+59↑j ...
$ q- _' ?# M# ]& H) a3 b* A
.text:24BC2E6D call ds:OutputDebugStringA
; I/ r0 U! r1 x4 ]5 f S. C# l5 Q+ X
.text:24BC2E73 xor eax, eax
a/ U5 A) d$ b) o% j7 T- J% O. G. P
.text:24BC2E75 jmp loc_24BC3011
1 i U1 F( s0 @4 v" i( X9 o! _% B
.text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
6 b8 r2 d5 d) q1 S7 f; E+ s* c$ }, Z
7 Y0 ]+ M r" P; _& h' f; G: Y
: A: r) b' P2 q! u, P: k( H
作者:
星之韶华
时间:
2025-4-13 11:37
学习学习一下
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/)
Powered by Discuz! X3.2