Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
13926586
Commit
13926586
authored
Jan 01, 1999
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Win32 file handles instead of Unix ones.
parent
f8e741bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
17 deletions
+22
-17
module.c
loader/ne/module.c
+7
-4
resource.c
loader/ne/resource.c
+5
-3
segment.c
loader/ne/segment.c
+10
-10
No files found.
loader/ne/module.c
View file @
13926586
...
...
@@ -395,22 +395,25 @@ BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset )
/***********************************************************************
* NE_OpenFile
*/
int
NE_OpenFile
(
NE_MODULE
*
pModule
)
HANDLE32
NE_OpenFile
(
NE_MODULE
*
pModule
)
{
DOS_FULL_NAME
full_name
;
char
*
name
;
static
int
cachedfd
=
-
1
;
static
HANDLE32
cachedfd
=
-
1
;
TRACE
(
module
,
"(%p) cache: mod=%p fd=%d
\n
"
,
pModule
,
pCachedModule
,
cachedfd
);
if
(
pCachedModule
==
pModule
)
return
cachedfd
;
clos
e
(
cachedfd
);
CloseHandl
e
(
cachedfd
);
pCachedModule
=
pModule
;
name
=
NE_MODULE_NAME
(
pModule
);
if
(
!
DOSFS_GetFullName
(
name
,
TRUE
,
&
full_name
)
||
(
cachedfd
=
open
(
full_name
.
long_name
,
O_RDONLY
))
==
-
1
)
(
cachedfd
=
FILE_OpenUnixFile
(
full_name
.
long_name
,
O_RDONLY
))
==
-
1
)
MSG
(
"Can't open file '%s' for module %04x
\n
"
,
name
,
pModule
->
self
);
else
/* FIXME: should not be necessary */
cachedfd
=
ConvertToGlobalHandle
(
cachedfd
);
TRACE
(
module
,
"opened '%s' -> %d
\n
"
,
name
,
cachedfd
);
return
cachedfd
;
...
...
loader/ne/resource.c
View file @
13926586
...
...
@@ -182,7 +182,7 @@ static HRSRC16 NE_FindResourceFromType( NE_MODULE *pModule,
HGLOBAL16
WINAPI
NE_DefResourceHandler
(
HGLOBAL16
hMemObj
,
HMODULE16
hModule
,
HRSRC16
hRsrc
)
{
int
fd
;
HANDLE32
fd
;
NE_MODULE
*
pModule
=
NE_GetPtr
(
hModule
);
if
(
pModule
&&
(
fd
=
NE_OpenFile
(
pModule
))
>=
0
)
{
...
...
@@ -200,8 +200,10 @@ HGLOBAL16 WINAPI NE_DefResourceHandler( HGLOBAL16 hMemObj, HMODULE16 hModule,
if
(
handle
)
{
lseek
(
fd
,
(
int
)
pNameInfo
->
offset
<<
sizeShift
,
SEEK_SET
);
read
(
fd
,
GlobalLock16
(
handle
),
(
int
)
pNameInfo
->
length
<<
sizeShift
);
DWORD
res
;
SetFilePointer
(
fd
,
(
int
)
pNameInfo
->
offset
<<
sizeShift
,
NULL
,
SEEK_SET
);
ReadFile
(
fd
,
GlobalLock16
(
handle
),
(
int
)
pNameInfo
->
length
<<
sizeShift
,
&
res
,
NULL
);
}
return
handle
;
}
...
...
loader/ne/segment.c
View file @
13926586
...
...
@@ -57,7 +57,8 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
WORD
count
,
i
,
offset
,
next_offset
;
HMODULE16
module
;
FARPROC16
address
=
0
;
int
fd
;
HFILE32
hf
;
DWORD
res
;
struct
relocation_entry_s
*
rep
,
*
reloc_entries
;
BYTE
*
func_name
;
int
size
;
...
...
@@ -77,10 +78,10 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
pModuleTable
=
NE_MODULE_TABLE
(
pModule
);
fd
=
NE_OpenFile
(
pModule
);
hf
=
NE_OpenFile
(
pModule
);
TRACE
(
module
,
"Loading segment %d, hSeg=%04x, flags=%04x
\n
"
,
segnum
,
pSeg
->
hSeg
,
pSeg
->
flags
);
lseek
(
fd
,
pSeg
->
filepos
<<
pModule
->
alignment
,
SEEK_SET
);
SetFilePointer
(
hf
,
pSeg
->
filepos
<<
pModule
->
alignment
,
NULL
,
SEEK_SET
);
if
(
pSeg
->
size
)
size
=
pSeg
->
size
;
else
size
=
pSeg
->
minsize
?
pSeg
->
minsize
:
0x10000
;
mem
=
GlobalLock16
(
pSeg
->
hSeg
);
...
...
@@ -92,7 +93,6 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
DWORD
oldstack
;
WORD
old_hSeg
,
new_hSeg
;
THDB
*
thdb
=
THREAD_Current
();
HFILE32
hf
=
FILE_DupUnixHandle
(
fd
);
selfloadheader
=
(
SELFLOADHEADER
*
)
PTR_SEG_OFF_TO_LIN
(
SEL
(
pSegTable
->
hSeg
),
0
);
...
...
@@ -138,7 +138,7 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
thdb
->
cur_stack
=
oldstack
;
}
else
if
(
!
(
pSeg
->
flags
&
NE_SEGFLAGS_ITERATED
))
read
(
fd
,
mem
,
size
);
ReadFile
(
hf
,
mem
,
size
,
&
res
,
NULL
);
else
{
/*
The following bit of code for "iterated segments" was written without
...
...
@@ -148,7 +148,7 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
*/
char
*
buff
=
xmalloc
(
size
);
char
*
curr
=
buff
;
read
(
fd
,
buff
,
size
);
ReadFile
(
hf
,
mem
,
size
,
&
res
,
NULL
);
while
(
curr
<
buff
+
size
)
{
unsigned
int
rept
=
*
((
short
*
)
curr
)
++
;
unsigned
int
len
=
*
((
short
*
)
curr
)
++
;
...
...
@@ -167,7 +167,7 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
if
(
!
(
pSeg
->
flags
&
NE_SEGFLAGS_RELOC_DATA
))
return
TRUE
;
/* No relocation data, we are done */
read
(
fd
,
&
count
,
sizeof
(
count
)
);
ReadFile
(
hf
,
&
count
,
sizeof
(
count
),
&
res
,
NULL
);
if
(
!
count
)
return
TRUE
;
TRACE
(
fixup
,
"Fixups for %.*s, segment %d, hSeg %04x
\n
"
,
...
...
@@ -180,8 +180,8 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
segnum
,
pSeg
->
hSeg
);
reloc_entries
=
(
struct
relocation_entry_s
*
)
xmalloc
(
count
*
sizeof
(
struct
relocation_entry_s
));
if
(
read
(
fd
,
reloc_entries
,
count
*
sizeof
(
struct
relocation_entry_s
))
!=
count
*
sizeof
(
struct
relocation_entry_s
))
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
"
);
return
FALSE
;
...
...
@@ -422,7 +422,7 @@ BOOL32 NE_LoadAllSegments( NE_MODULE *pModule )
stack16Top
->
ip
=
0
;
stack16Top
->
cs
=
0
;
hf
=
FILE_DupUnixHandle
(
NE_OpenFile
(
pModule
)
);
hf
=
NE_OpenFile
(
pModule
);
TRACE
(
dll
,
"CallBootAppProc(hModule=0x%04x,hf=0x%04x)
\n
"
,
pModule
->
self
,
HFILE32_TO_HFILE16
(
hf
));
Callbacks
->
CallBootAppProc
(
selfloadheader
->
BootApp
,
pModule
->
self
,
...
...
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