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
0ac96900
Commit
0ac96900
authored
Aug 26, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved 16-bit relay and snoop support to dlls/kernel.
parent
1df015ae
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
217 additions
and
216 deletions
+217
-216
.cvsignore
dlls/kernel/.cvsignore
+1
-0
Makefile.in
dlls/kernel/Makefile.in
+8
-0
ne_module.c
dlls/kernel/ne_module.c
+207
-0
relay16.c
dlls/kernel/relay16.c
+0
-0
snoop16.c
dlls/kernel/snoop16.c
+0
-0
.cvsignore
dlls/ntdll/.cvsignore
+0
-1
Makefile.in
dlls/ntdll/Makefile.in
+1
-9
module.c
loader/ne/module.c
+0
-206
No files found.
dlls/kernel/.cvsignore
View file @
0ac96900
...
...
@@ -5,6 +5,7 @@ kernel32.dll.dbg.c
kernel32.spec.c
kernel32.spec.def
krnl386.exe.spec.c
relay16asm.s
stress.spec.c
system.drv.spec.c
toolhelp.spec.c
...
...
dlls/kernel/Makefile.in
View file @
0ac96900
...
...
@@ -38,8 +38,10 @@ C_SRCS = \
ne_segment.c
\
powermgnt.c
\
process.c
\
relay16.c
\
resource.c
\
resource16.c
\
snoop16.c
\
stress.c
\
string.c
\
sync.c
\
...
...
@@ -59,6 +61,8 @@ C_SRCS16 = \
registry16.c
\
system.c
ASM_SRCS
=
relay16asm.s
RC_SRCS
=
kernel.rc
RC_SRCS16
=
\
...
...
@@ -67,6 +71,7 @@ RC_SRCS16 = \
MC_SRCS
=
\
messages/winerr_enu.mc
EXTRA_OBJS
=
$
(
ASM_SRCS:.s
=
.o
)
SUBDIRS
=
tests
EXTRASUBDIRS
=
messages nls
...
...
@@ -74,6 +79,9 @@ EXTRASUBDIRS = messages nls
kernel.res
:
$(MC_SRCS:.mc=.mc.rc)
relay16asm.s
:
$(WINEBUILD)
$(WINEBUILD)
$(DEFS)
-o
$@
--relay16
# Special rules for 16-bit resource and spec files
krnl386.exe.spec.c
:
krnl386.exe.spec version16.res
...
...
dlls/kernel/ne_module.c
View file @
0ac96900
...
...
@@ -210,6 +210,16 @@ void __wine_unregister_dll_16( const BUILTIN16_DESCRIPTOR *descr )
}
/**********************************************************************
* NE_RegisterModule
*/
void
NE_RegisterModule
(
NE_MODULE
*
pModule
)
{
pModule
->
next
=
hFirstModule
;
hFirstModule
=
pModule
->
self
;
}
/***********************************************************************
* NE_DumpModule
*/
...
...
@@ -364,6 +374,143 @@ void NE_WalkModules(void)
/***********************************************************************
* NE_InitResourceHandler
*
* Fill in 'resloader' fields in the resource table.
*/
void
NE_InitResourceHandler
(
NE_MODULE
*
pModule
)
{
static
FARPROC16
proc
;
NE_TYPEINFO
*
pTypeInfo
=
(
NE_TYPEINFO
*
)((
char
*
)
pModule
+
pModule
->
res_table
+
2
);
TRACE
(
"InitResourceHandler[%04x]
\n
"
,
pModule
->
self
);
if
(
!
proc
)
proc
=
GetProcAddress16
(
GetModuleHandle16
(
"KERNEL"
),
"DefResourceHandler"
);
while
(
pTypeInfo
->
type_id
)
{
memcpy_unaligned
(
&
pTypeInfo
->
resloader
,
&
proc
,
sizeof
(
FARPROC16
)
);
pTypeInfo
=
(
NE_TYPEINFO
*
)((
char
*
)(
pTypeInfo
+
1
)
+
pTypeInfo
->
count
*
sizeof
(
NE_NAMEINFO
));
}
}
/***********************************************************************
* NE_GetOrdinal
*
* Lookup the ordinal for a given name.
*/
WORD
NE_GetOrdinal
(
HMODULE16
hModule
,
const
char
*
name
)
{
unsigned
char
buffer
[
256
],
*
cpnt
;
BYTE
len
;
NE_MODULE
*
pModule
;
if
(
!
(
pModule
=
NE_GetPtr
(
hModule
)))
return
0
;
if
(
pModule
->
flags
&
NE_FFLAGS_WIN32
)
return
0
;
TRACE
(
"(%04x,'%s')
\n
"
,
hModule
,
name
);
/* First handle names of the form '#xxxx' */
if
(
name
[
0
]
==
'#'
)
return
atoi
(
name
+
1
);
/* Now copy and uppercase the string */
strcpy
(
buffer
,
name
);
for
(
cpnt
=
buffer
;
*
cpnt
;
cpnt
++
)
*
cpnt
=
FILE_toupper
(
*
cpnt
);
len
=
cpnt
-
buffer
;
/* First search the resident names */
cpnt
=
(
char
*
)
pModule
+
pModule
->
name_table
;
/* Skip the first entry (module name) */
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
while
(
*
cpnt
)
{
if
(((
BYTE
)
*
cpnt
==
len
)
&&
!
memcmp
(
cpnt
+
1
,
buffer
,
len
))
{
WORD
ordinal
;
memcpy
(
&
ordinal
,
cpnt
+
*
cpnt
+
1
,
sizeof
(
ordinal
)
);
TRACE
(
" Found: ordinal=%d
\n
"
,
ordinal
);
return
ordinal
;
}
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
}
/* Now search the non-resident names table */
if
(
!
pModule
->
nrname_handle
)
return
0
;
/* No non-resident table */
cpnt
=
(
char
*
)
GlobalLock16
(
pModule
->
nrname_handle
);
/* Skip the first entry (module description string) */
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
while
(
*
cpnt
)
{
if
(((
BYTE
)
*
cpnt
==
len
)
&&
!
memcmp
(
cpnt
+
1
,
buffer
,
len
))
{
WORD
ordinal
;
memcpy
(
&
ordinal
,
cpnt
+
*
cpnt
+
1
,
sizeof
(
ordinal
)
);
TRACE
(
" Found: ordinal=%d
\n
"
,
ordinal
);
return
ordinal
;
}
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
}
return
0
;
}
/***********************************************************************
* NE_GetEntryPoint
*/
FARPROC16
WINAPI
NE_GetEntryPoint
(
HMODULE16
hModule
,
WORD
ordinal
)
{
return
NE_GetEntryPointEx
(
hModule
,
ordinal
,
TRUE
);
}
/***********************************************************************
* NE_GetEntryPointEx
*/
FARPROC16
NE_GetEntryPointEx
(
HMODULE16
hModule
,
WORD
ordinal
,
BOOL16
snoop
)
{
NE_MODULE
*
pModule
;
WORD
sel
,
offset
,
i
;
ET_ENTRY
*
entry
;
ET_BUNDLE
*
bundle
;
if
(
!
(
pModule
=
NE_GetPtr
(
hModule
)))
return
0
;
assert
(
!
(
pModule
->
flags
&
NE_FFLAGS_WIN32
)
);
bundle
=
(
ET_BUNDLE
*
)((
BYTE
*
)
pModule
+
pModule
->
entry_table
);
while
((
ordinal
<
bundle
->
first
+
1
)
||
(
ordinal
>
bundle
->
last
))
{
if
(
!
(
bundle
->
next
))
return
0
;
bundle
=
(
ET_BUNDLE
*
)((
BYTE
*
)
pModule
+
bundle
->
next
);
}
entry
=
(
ET_ENTRY
*
)((
BYTE
*
)
bundle
+
6
);
for
(
i
=
0
;
i
<
(
ordinal
-
bundle
->
first
-
1
);
i
++
)
entry
++
;
sel
=
entry
->
segnum
;
memcpy
(
&
offset
,
&
entry
->
offs
,
sizeof
(
WORD
)
);
if
(
sel
==
0xfe
)
sel
=
0xffff
;
/* constant entry */
else
sel
=
GlobalHandleToSel16
(
NE_SEG_TABLE
(
pModule
)[
sel
-
1
].
hSeg
);
if
(
sel
==
0xffff
)
return
(
FARPROC16
)
MAKESEGPTR
(
sel
,
offset
);
if
(
!
snoop
)
return
(
FARPROC16
)
MAKESEGPTR
(
sel
,
offset
);
else
return
(
FARPROC16
)
SNOOP16_GetProcAddress16
(
hModule
,
ordinal
,(
FARPROC16
)
MAKESEGPTR
(
sel
,
offset
));
}
/***********************************************************************
* EntryAddrProc (KERNEL.667) Wine-specific export
*
* Return the entry point for a given ordinal.
...
...
@@ -1566,6 +1713,66 @@ HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
return
ret
;
}
/***********************************************************************
* GetProcAddress (KERNEL.50)
*/
FARPROC16
WINAPI
GetProcAddress16
(
HMODULE16
hModule
,
LPCSTR
name
)
{
WORD
ordinal
;
FARPROC16
ret
;
if
(
!
hModule
)
hModule
=
GetCurrentTask
();
hModule
=
GetExePtr
(
hModule
);
if
(
HIWORD
(
name
)
!=
0
)
{
ordinal
=
NE_GetOrdinal
(
hModule
,
name
);
TRACE
(
"%04x '%s'
\n
"
,
hModule
,
name
);
}
else
{
ordinal
=
LOWORD
(
name
);
TRACE
(
"%04x %04x
\n
"
,
hModule
,
ordinal
);
}
if
(
!
ordinal
)
return
(
FARPROC16
)
0
;
ret
=
NE_GetEntryPoint
(
hModule
,
ordinal
);
TRACE
(
"returning %08x
\n
"
,
(
UINT
)
ret
);
return
ret
;
}
/***************************************************************************
* HasGPHandler (KERNEL.338)
*/
SEGPTR
WINAPI
HasGPHandler16
(
SEGPTR
address
)
{
HMODULE16
hModule
;
int
gpOrdinal
;
SEGPTR
gpPtr
;
GPHANDLERDEF
*
gpHandler
;
if
(
(
hModule
=
FarGetOwner16
(
SELECTOROF
(
address
)
))
!=
0
&&
(
gpOrdinal
=
NE_GetOrdinal
(
hModule
,
"__GP"
))
!=
0
&&
(
gpPtr
=
(
SEGPTR
)
NE_GetEntryPointEx
(
hModule
,
gpOrdinal
,
FALSE
))
!=
0
&&
!
IsBadReadPtr16
(
gpPtr
,
sizeof
(
GPHANDLERDEF
)
)
&&
(
gpHandler
=
MapSL
(
gpPtr
))
!=
NULL
)
{
while
(
gpHandler
->
selector
)
{
if
(
SELECTOROF
(
address
)
==
gpHandler
->
selector
&&
OFFSETOF
(
address
)
>=
gpHandler
->
rangeStart
&&
OFFSETOF
(
address
)
<
gpHandler
->
rangeEnd
)
return
MAKESEGPTR
(
gpHandler
->
selector
,
gpHandler
->
handler
);
gpHandler
++
;
}
}
return
0
;
}
/**********************************************************************
* GetModuleHandle (KERNEL.47)
*
...
...
if1632/relay
.c
→
dlls/kernel/relay16
.c
View file @
0ac96900
File moved
if1632/snoop
.c
→
dlls/kernel/snoop16
.c
View file @
0ac96900
File moved
dlls/ntdll/.cvsignore
View file @
0ac96900
...
...
@@ -2,5 +2,4 @@ Makefile
ntdll.dll.dbg.c
ntdll.spec.c
ntdll.spec.def
relay16.s
relay32.s
dlls/ntdll/Makefile.in
View file @
0ac96900
...
...
@@ -13,8 +13,6 @@ C_SRCS = \
$(TOPOBJDIR)
/files/file.c
\
$(TOPOBJDIR)
/files/profile.c
\
$(TOPOBJDIR)
/files/smb.c
\
$(TOPOBJDIR)
/if1632/relay.c
\
$(TOPOBJDIR)
/if1632/snoop.c
\
$(TOPOBJDIR)
/loader/loadorder.c
\
$(TOPOBJDIR)
/loader/module.c
\
$(TOPOBJDIR)
/loader/pe_image.c
\
...
...
@@ -83,9 +81,7 @@ C_SRCS = \
virtual.c
\
wcstring.c
ASM_SRCS
=
\
relay16.s
\
relay32.s
ASM_SRCS
=
relay32.s
EXTRA_OBJS
=
$
(
ASM_SRCS:.s
=
.o
)
...
...
@@ -93,7 +89,6 @@ SUBDIRS = tests
EXTRASUBDIRS
=
\
$(TOPOBJDIR)
/files
\
$(TOPOBJDIR)
/if1632
\
$(TOPOBJDIR)
/loader
\
$(TOPOBJDIR)
/loader/ne
\
$(TOPOBJDIR)
/memory
\
...
...
@@ -105,9 +100,6 @@ EXTRASUBDIRS = \
@MAKE_DLL_RULES@
relay16.s
:
$(WINEBUILD)
$(WINEBUILD)
$(DEFS)
-o
$@
--relay16
relay32.s
:
$(WINEBUILD)
$(WINEBUILD)
$(DEFS)
-o
$@
--relay32
...
...
loader/ne/module.c
View file @
0ac96900
...
...
@@ -72,153 +72,6 @@ NE_MODULE *NE_GetPtr( HMODULE16 hModule )
/**********************************************************************
* NE_RegisterModule
*/
void
NE_RegisterModule
(
NE_MODULE
*
pModule
)
{
pModule
->
next
=
hFirstModule
;
hFirstModule
=
pModule
->
self
;
}
/***********************************************************************
* NE_InitResourceHandler
*
* Fill in 'resloader' fields in the resource table.
*/
void
NE_InitResourceHandler
(
NE_MODULE
*
pModule
)
{
static
FARPROC16
proc
;
NE_TYPEINFO
*
pTypeInfo
=
(
NE_TYPEINFO
*
)((
char
*
)
pModule
+
pModule
->
res_table
+
2
);
TRACE
(
"InitResourceHandler[%04x]
\n
"
,
pModule
->
self
);
if
(
!
proc
)
proc
=
GetProcAddress16
(
GetModuleHandle16
(
"KERNEL"
),
"DefResourceHandler"
);
while
(
pTypeInfo
->
type_id
)
{
memcpy_unaligned
(
&
pTypeInfo
->
resloader
,
&
proc
,
sizeof
(
FARPROC16
)
);
pTypeInfo
=
(
NE_TYPEINFO
*
)((
char
*
)(
pTypeInfo
+
1
)
+
pTypeInfo
->
count
*
sizeof
(
NE_NAMEINFO
));
}
}
/***********************************************************************
* NE_GetOrdinal
*
* Lookup the ordinal for a given name.
*/
WORD
NE_GetOrdinal
(
HMODULE16
hModule
,
const
char
*
name
)
{
unsigned
char
buffer
[
256
],
*
cpnt
;
BYTE
len
;
NE_MODULE
*
pModule
;
if
(
!
(
pModule
=
NE_GetPtr
(
hModule
)))
return
0
;
if
(
pModule
->
flags
&
NE_FFLAGS_WIN32
)
return
0
;
TRACE
(
"(%04x,'%s')
\n
"
,
hModule
,
name
);
/* First handle names of the form '#xxxx' */
if
(
name
[
0
]
==
'#'
)
return
atoi
(
name
+
1
);
/* Now copy and uppercase the string */
strcpy
(
buffer
,
name
);
for
(
cpnt
=
buffer
;
*
cpnt
;
cpnt
++
)
*
cpnt
=
FILE_toupper
(
*
cpnt
);
len
=
cpnt
-
buffer
;
/* First search the resident names */
cpnt
=
(
char
*
)
pModule
+
pModule
->
name_table
;
/* Skip the first entry (module name) */
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
while
(
*
cpnt
)
{
if
(((
BYTE
)
*
cpnt
==
len
)
&&
!
memcmp
(
cpnt
+
1
,
buffer
,
len
))
{
WORD
ordinal
;
memcpy
(
&
ordinal
,
cpnt
+
*
cpnt
+
1
,
sizeof
(
ordinal
)
);
TRACE
(
" Found: ordinal=%d
\n
"
,
ordinal
);
return
ordinal
;
}
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
}
/* Now search the non-resident names table */
if
(
!
pModule
->
nrname_handle
)
return
0
;
/* No non-resident table */
cpnt
=
(
char
*
)
GlobalLock16
(
pModule
->
nrname_handle
);
/* Skip the first entry (module description string) */
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
while
(
*
cpnt
)
{
if
(((
BYTE
)
*
cpnt
==
len
)
&&
!
memcmp
(
cpnt
+
1
,
buffer
,
len
))
{
WORD
ordinal
;
memcpy
(
&
ordinal
,
cpnt
+
*
cpnt
+
1
,
sizeof
(
ordinal
)
);
TRACE
(
" Found: ordinal=%d
\n
"
,
ordinal
);
return
ordinal
;
}
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
}
return
0
;
}
/***********************************************************************
* NE_GetEntryPoint
*/
FARPROC16
WINAPI
NE_GetEntryPoint
(
HMODULE16
hModule
,
WORD
ordinal
)
{
return
NE_GetEntryPointEx
(
hModule
,
ordinal
,
TRUE
);
}
/***********************************************************************
* NE_GetEntryPointEx
*/
FARPROC16
NE_GetEntryPointEx
(
HMODULE16
hModule
,
WORD
ordinal
,
BOOL16
snoop
)
{
NE_MODULE
*
pModule
;
WORD
sel
,
offset
,
i
;
ET_ENTRY
*
entry
;
ET_BUNDLE
*
bundle
;
if
(
!
(
pModule
=
NE_GetPtr
(
hModule
)))
return
0
;
assert
(
!
(
pModule
->
flags
&
NE_FFLAGS_WIN32
)
);
bundle
=
(
ET_BUNDLE
*
)((
BYTE
*
)
pModule
+
pModule
->
entry_table
);
while
((
ordinal
<
bundle
->
first
+
1
)
||
(
ordinal
>
bundle
->
last
))
{
if
(
!
(
bundle
->
next
))
return
0
;
bundle
=
(
ET_BUNDLE
*
)((
BYTE
*
)
pModule
+
bundle
->
next
);
}
entry
=
(
ET_ENTRY
*
)((
BYTE
*
)
bundle
+
6
);
for
(
i
=
0
;
i
<
(
ordinal
-
bundle
->
first
-
1
);
i
++
)
entry
++
;
sel
=
entry
->
segnum
;
memcpy
(
&
offset
,
&
entry
->
offs
,
sizeof
(
WORD
)
);
if
(
sel
==
0xfe
)
sel
=
0xffff
;
/* constant entry */
else
sel
=
GlobalHandleToSel16
(
NE_SEG_TABLE
(
pModule
)[
sel
-
1
].
hSeg
);
if
(
sel
==
0xffff
)
return
(
FARPROC16
)
MAKESEGPTR
(
sel
,
offset
);
if
(
!
snoop
)
return
(
FARPROC16
)
MAKESEGPTR
(
sel
,
offset
);
else
return
(
FARPROC16
)
SNOOP16_GetProcAddress16
(
hModule
,
ordinal
,(
FARPROC16
)
MAKESEGPTR
(
sel
,
offset
));
}
/**********************************************************************
* GetModuleFileName (KERNEL.49)
*
* Comment: see GetModuleFileNameA
...
...
@@ -342,62 +195,3 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
}
return
0
;
}
/***********************************************************************
* GetProcAddress (KERNEL.50)
*/
FARPROC16
WINAPI
GetProcAddress16
(
HMODULE16
hModule
,
LPCSTR
name
)
{
WORD
ordinal
;
FARPROC16
ret
;
if
(
!
hModule
)
hModule
=
GetCurrentTask
();
hModule
=
GetExePtr
(
hModule
);
if
(
HIWORD
(
name
)
!=
0
)
{
ordinal
=
NE_GetOrdinal
(
hModule
,
name
);
TRACE
(
"%04x '%s'
\n
"
,
hModule
,
name
);
}
else
{
ordinal
=
LOWORD
(
name
);
TRACE
(
"%04x %04x
\n
"
,
hModule
,
ordinal
);
}
if
(
!
ordinal
)
return
(
FARPROC16
)
0
;
ret
=
NE_GetEntryPoint
(
hModule
,
ordinal
);
TRACE
(
"returning %08x
\n
"
,
(
UINT
)
ret
);
return
ret
;
}
/***************************************************************************
* HasGPHandler (KERNEL.338)
*/
SEGPTR
WINAPI
HasGPHandler16
(
SEGPTR
address
)
{
HMODULE16
hModule
;
int
gpOrdinal
;
SEGPTR
gpPtr
;
GPHANDLERDEF
*
gpHandler
;
if
(
(
hModule
=
FarGetOwner16
(
SELECTOROF
(
address
)
))
!=
0
&&
(
gpOrdinal
=
NE_GetOrdinal
(
hModule
,
"__GP"
))
!=
0
&&
(
gpPtr
=
(
SEGPTR
)
NE_GetEntryPointEx
(
hModule
,
gpOrdinal
,
FALSE
))
!=
0
&&
!
IsBadReadPtr16
(
gpPtr
,
sizeof
(
GPHANDLERDEF
)
)
&&
(
gpHandler
=
MapSL
(
gpPtr
))
!=
NULL
)
{
while
(
gpHandler
->
selector
)
{
if
(
SELECTOROF
(
address
)
==
gpHandler
->
selector
&&
OFFSETOF
(
address
)
>=
gpHandler
->
rangeStart
&&
OFFSETOF
(
address
)
<
gpHandler
->
rangeEnd
)
return
MAKESEGPTR
(
gpHandler
->
selector
,
gpHandler
->
handler
);
gpHandler
++
;
}
}
return
0
;
}
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