Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bcf41605
Commit
bcf41605
authored
Dec 17, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debug channels cleanup.
parent
9e8e5ff7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
38 deletions
+30
-38
segment.c
loader/ne/segment.c
+22
-27
pe_image.c
loader/pe_image.c
+8
-11
No files found.
loader/ne/segment.c
View file @
bcf41605
...
...
@@ -43,10 +43,9 @@
#include "builtin16.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
fixup
);
WINE_DECLARE_DEBUG_CHANNEL
(
dll
);
WINE_DECLARE_DEBUG_CHANNEL
(
fixup
);
WINE_DECLARE_DEBUG_CHANNEL
(
module
);
WINE_DECLARE_DEBUG_CHANNEL
(
segment
);
/*
* Relocation table entry
...
...
@@ -219,24 +218,20 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
ReadFile
(
hf
,
&
count
,
sizeof
(
count
),
&
res
,
NULL
);
if
(
!
count
)
goto
succeed
;
TRACE_
(
fixup
)(
"Fixups for %.*s, segment %d, hSeg %04x
\n
"
,
*
((
BYTE
*
)
pModule
+
pModule
->
name_table
),
(
char
*
)
pModule
+
pModule
->
name_table
+
1
,
segnum
,
pSeg
->
hSeg
);
TRACE_
(
segment
)(
"Fixups for %.*s, segment %d, hSeg %04x
\n
"
,
TRACE
(
"Fixups for %.*s, segment %d, hSeg %04x
\n
"
,
*
((
BYTE
*
)
pModule
+
pModule
->
name_table
),
(
char
*
)
pModule
+
pModule
->
name_table
+
1
,
segnum
,
pSeg
->
hSeg
);
reloc_entries
=
(
struct
relocation_entry_s
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
struct
relocation_entry_s
));
if
(
reloc_entries
==
NULL
)
{
WARN
_
(
fixup
)
(
"Not enough memory for relocation entries!"
);
WARN
(
"Not enough memory for relocation entries!"
);
goto
fail
;
}
if
(
!
ReadFile
(
hf
,
reloc_entries
,
count
*
sizeof
(
struct
relocation_entry_s
),
&
res
,
NULL
)
||
(
res
!=
count
*
sizeof
(
struct
relocation_entry_s
)))
{
WARN
_
(
fixup
)
(
"Unable to read relocation information
\n
"
);
WARN
(
"Unable to read relocation information
\n
"
);
goto
fail
;
}
...
...
@@ -272,7 +267,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
(
char
*
)
pModule
+
pModule
->
name_table
+
1
);
else
{
ERR
_
(
fixup
)
(
"No implementation for %.*s.%d, setting to 0xdeadbeef
\n
"
,
ERR
(
"No implementation for %.*s.%d, setting to 0xdeadbeef
\n
"
,
*
((
BYTE
*
)
pTarget
+
pTarget
->
name_table
),
(
char
*
)
pTarget
+
pTarget
->
name_table
+
1
,
ordinal
);
...
...
@@ -282,7 +277,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
if
(
TRACE_ON
(
fixup
))
{
NE_MODULE
*
pTarget
=
NE_GetPtr
(
module
);
TRACE
_
(
fixup
)
(
"%d: %.*s.%d=%04x:%04x %s
\n
"
,
i
+
1
,
TRACE
(
"%d: %.*s.%d=%04x:%04x %s
\n
"
,
i
+
1
,
*
((
BYTE
*
)
pTarget
+
pTarget
->
name_table
),
(
char
*
)
pTarget
+
pTarget
->
name_table
+
1
,
ordinal
,
HIWORD
(
address
),
LOWORD
(
address
),
...
...
@@ -302,7 +297,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
if
(
ERR_ON
(
fixup
)
&&
!
address
)
{
NE_MODULE
*
pTarget
=
NE_GetPtr
(
module
);
ERR
_
(
fixup
)
(
"No implementation for %.*s.%s, setting to 0xdeadbeef
\n
"
,
ERR
(
"No implementation for %.*s.%s, setting to 0xdeadbeef
\n
"
,
*
((
BYTE
*
)
pTarget
+
pTarget
->
name_table
),
(
char
*
)
pTarget
+
pTarget
->
name_table
+
1
,
func_name
);
}
...
...
@@ -310,7 +305,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
if
(
TRACE_ON
(
fixup
))
{
NE_MODULE
*
pTarget
=
NE_GetPtr
(
module
);
TRACE
_
(
fixup
)
(
"%d: %.*s.%s=%04x:%04x %s
\n
"
,
i
+
1
,
TRACE
(
"%d: %.*s.%s=%04x:%04x %s
\n
"
,
i
+
1
,
*
((
BYTE
*
)
pTarget
+
pTarget
->
name_table
),
(
char
*
)
pTarget
+
pTarget
->
name_table
+
1
,
func_name
,
HIWORD
(
address
),
LOWORD
(
address
),
...
...
@@ -328,7 +323,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
address
=
(
FARPROC16
)
MAKESEGPTR
(
SEL
(
pSegTable
[
rep
->
target1
-
1
].
hSeg
),
rep
->
target2
);
}
TRACE
_
(
fixup
)
(
"%d: %04x:%04x %s
\n
"
,
TRACE
(
"%d: %04x:%04x %s
\n
"
,
i
+
1
,
HIWORD
(
address
),
LOWORD
(
address
),
NE_GetRelocAddrName
(
rep
->
address_type
,
additive
)
);
break
;
...
...
@@ -342,7 +337,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
* successfully emulate the coprocessor if it doesn't
* exist.
*/
TRACE
_
(
fixup
)
(
"%d: TYPE %d, OFFSET %04x, TARGET %04x %04x %s
\n
"
,
TRACE
(
"%d: TYPE %d, OFFSET %04x, TARGET %04x %04x %s
\n
"
,
i
+
1
,
rep
->
relocation_type
,
rep
->
offset
,
rep
->
target1
,
rep
->
target2
,
NE_GetRelocAddrName
(
rep
->
address_type
,
additive
)
);
...
...
@@ -357,14 +352,14 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
{
char
module
[
10
];
GetModuleName16
(
pModule
->
self
,
module
,
sizeof
(
module
)
);
ERR
_
(
fixup
)
(
"WARNING: module %s: unknown reloc addr type = 0x%02x. Please report.
\n
"
,
ERR
(
"WARNING: module %s: unknown reloc addr type = 0x%02x. Please report.
\n
"
,
module
,
rep
->
address_type
);
}
if
(
additive
)
{
sp
=
MapSL
(
MAKESEGPTR
(
SEL
(
pSeg
->
hSeg
),
offset
)
);
TRACE
_
(
fixup
)
(
" %04x:%04x
\n
"
,
offset
,
*
sp
);
TRACE
(
" %04x:%04x
\n
"
,
offset
,
*
sp
);
switch
(
rep
->
address_type
&
0x7f
)
{
case
NE_RADDR_LOWBYTE
:
...
...
@@ -380,7 +375,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
case
NE_RADDR_SELECTOR
:
/* Borland creates additive records with offset zero. Strange, but OK */
if
(
*
sp
)
ERR
_
(
fixup
)
(
"Additive selector to %04x.Please report
\n
"
,
*
sp
);
ERR
(
"Additive selector to %04x.Please report
\n
"
,
*
sp
);
else
*
sp
=
HIWORD
(
address
);
break
;
...
...
@@ -394,7 +389,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
{
sp
=
MapSL
(
MAKESEGPTR
(
SEL
(
pSeg
->
hSeg
),
offset
)
);
next_offset
=
*
sp
;
TRACE
_
(
fixup
)
(
" %04x:%04x
\n
"
,
offset
,
*
sp
);
TRACE
(
" %04x:%04x
\n
"
,
offset
,
*
sp
);
switch
(
rep
->
address_type
&
0x7f
)
{
case
NE_RADDR_LOWBYTE
:
...
...
@@ -426,7 +421,7 @@ succeed:
return
TRUE
;
unknown:
WARN
_
(
fixup
)
(
"WARNING: %d: unknown ADDR TYPE %d, "
WARN
(
"WARNING: %d: unknown ADDR TYPE %d, "
"TYPE %d, OFFSET %04x, TARGET %04x %04x
\n
"
,
i
+
1
,
rep
->
address_type
,
rep
->
relocation_type
,
rep
->
offset
,
rep
->
target1
,
rep
->
target2
);
...
...
@@ -505,7 +500,7 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum)
WORD
dgroup
,
num_entries
,
sel
=
SEL
(
pSegTable
[
segnum
-
1
].
hSeg
);
BYTE
*
pSeg
,
*
pFunc
;
TRACE
_
(
module
)
(
"(%d);
\n
"
,
segnum
);
TRACE
(
"(%d);
\n
"
,
segnum
);
if
(
pSegTable
[
segnum
-
1
].
flags
&
NE_SEGFLAGS_DATA
)
{
...
...
@@ -522,22 +517,22 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum)
bundle
=
(
ET_BUNDLE
*
)((
BYTE
*
)
pModule
+
pModule
->
entry_table
);
do
{
TRACE
_
(
module
)
(
"num_entries: %d, bundle: %p, next: %04x, pSeg: %p
\n
"
,
bundle
->
last
-
bundle
->
first
,
bundle
,
bundle
->
next
,
pSeg
);
TRACE
(
"num_entries: %d, bundle: %p, next: %04x, pSeg: %p
\n
"
,
bundle
->
last
-
bundle
->
first
,
bundle
,
bundle
->
next
,
pSeg
);
if
(
!
(
num_entries
=
bundle
->
last
-
bundle
->
first
))
return
;
entry
=
(
ET_ENTRY
*
)((
BYTE
*
)
bundle
+
6
);
while
(
num_entries
--
)
{
/*TRACE
_(module)
("entry: %p, entry->segnum: %d, entry->offs: %04x\n", entry, entry->segnum, entry->offs);*/
/*TRACE("entry: %p, entry->segnum: %d, entry->offs: %04x\n", entry, entry->segnum, entry->offs);*/
if
(
entry
->
segnum
==
segnum
)
{
pFunc
=
((
BYTE
*
)
pSeg
+
entry
->
offs
);
TRACE
_
(
module
)
(
"pFunc: %p, *(DWORD *)pFunc: %08lx, num_entries: %d
\n
"
,
pFunc
,
*
(
DWORD
*
)
pFunc
,
num_entries
);
TRACE
(
"pFunc: %p, *(DWORD *)pFunc: %08lx, num_entries: %d
\n
"
,
pFunc
,
*
(
DWORD
*
)
pFunc
,
num_entries
);
if
(
*
(
pFunc
+
2
)
==
0x90
)
{
if
(
*
(
WORD
*
)
pFunc
==
0x581e
)
/* push ds, pop ax */
{
TRACE
_
(
module
)
(
"patch %04x:%04x -> mov ax, ds
\n
"
,
sel
,
entry
->
offs
);
TRACE
(
"patch %04x:%04x -> mov ax, ds
\n
"
,
sel
,
entry
->
offs
);
*
(
WORD
*
)
pFunc
=
0xd88c
;
/* mov ax, ds */
}
...
...
@@ -545,7 +540,7 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum)
{
if
((
entry
->
flags
&
2
))
/* public data ? */
{
TRACE
_
(
module
)
(
"patch %04x:%04x -> mov ax, dgroup [%04x]
\n
"
,
sel
,
entry
->
offs
,
dgroup
);
TRACE
(
"patch %04x:%04x -> mov ax, dgroup [%04x]
\n
"
,
sel
,
entry
->
offs
,
dgroup
);
*
pFunc
=
0xb8
;
/* mov ax, */
*
(
WORD
*
)(
pFunc
+
1
)
=
dgroup
;
}
...
...
@@ -553,7 +548,7 @@ static void NE_FixupSegmentPrologs(NE_MODULE *pModule, WORD segnum)
if
((
pModule
->
flags
&
NE_FFLAGS_MULTIPLEDATA
)
&&
(
entry
->
flags
&
1
))
/* exported ? */
{
TRACE
_
(
module
)
(
"patch %04x:%04x -> nop, nop
\n
"
,
sel
,
entry
->
offs
);
TRACE
(
"patch %04x:%04x -> nop, nop
\n
"
,
sel
,
entry
->
offs
);
*
(
WORD
*
)
pFunc
=
0x9090
;
/* nop, nop */
}
}
...
...
loader/pe_image.c
View file @
bcf41605
...
...
@@ -48,11 +48,8 @@
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
win32
);
WINE_DECLARE_DEBUG_CHANNEL
(
delayhlp
);
WINE_DECLARE_DEBUG_CHANNEL
(
fixup
);
WINE_DECLARE_DEBUG_CHANNEL
(
module
);
WINE_DECLARE_DEBUG_CHANNEL
(
relay
);
WINE_DECLARE_DEBUG_CHANNEL
(
segment
);
/* convert PE image VirtualAddress to Real Address */
...
...
@@ -462,14 +459,14 @@ WINE_MODREF *PE_CreateModule( HMODULE hModule, LPCSTR filename, DWORD flags,
{
ImgDelayDescr
*
pe_delay
=
NULL
;
pe_delay
=
get_rva
(
hModule
,
dir
->
VirtualAddress
);
TRACE
_
(
delayhlp
)
(
"pe_delay->grAttrs = %08x
\n
"
,
pe_delay
->
grAttrs
);
TRACE
_
(
delayhlp
)
(
"pe_delay->szName = %s
\n
"
,
pe_delay
->
szName
);
TRACE
_
(
delayhlp
)
(
"pe_delay->phmod = %08x
\n
"
,
pe_delay
->
phmod
);
TRACE
_
(
delayhlp
)
(
"pe_delay->pIAT = %08x
\n
"
,
pe_delay
->
pIAT
);
TRACE
_
(
delayhlp
)
(
"pe_delay->pINT = %08x
\n
"
,
pe_delay
->
pINT
);
TRACE
_
(
delayhlp
)
(
"pe_delay->pBoundIAT = %08x
\n
"
,
pe_delay
->
pBoundIAT
);
TRACE
_
(
delayhlp
)
(
"pe_delay->pUnloadIAT = %08x
\n
"
,
pe_delay
->
pUnloadIAT
);
TRACE
_
(
delayhlp
)
(
"pe_delay->dwTimeStamp = %08x
\n
"
,
pe_delay
->
dwTimeStamp
);
TRACE
(
"pe_delay->grAttrs = %08x
\n
"
,
pe_delay
->
grAttrs
);
TRACE
(
"pe_delay->szName = %s
\n
"
,
pe_delay
->
szName
);
TRACE
(
"pe_delay->phmod = %08x
\n
"
,
pe_delay
->
phmod
);
TRACE
(
"pe_delay->pIAT = %08x
\n
"
,
pe_delay
->
pIAT
);
TRACE
(
"pe_delay->pINT = %08x
\n
"
,
pe_delay
->
pINT
);
TRACE
(
"pe_delay->pBoundIAT = %08x
\n
"
,
pe_delay
->
pBoundIAT
);
TRACE
(
"pe_delay->pUnloadIAT = %08x
\n
"
,
pe_delay
->
pUnloadIAT
);
TRACE
(
"pe_delay->dwTimeStamp = %08x
\n
"
,
pe_delay
->
dwTimeStamp
);
}
#endif
/* ImgDelayDescr */
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment