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
8eb1630c
Commit
8eb1630c
authored
May 19, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a memory mapping instead of file I/O to load 16-bit modules.
parent
a890293f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
40 deletions
+37
-40
kernel16_private.h
dlls/kernel/kernel16_private.h
+14
-6
ne_module.c
dlls/kernel/ne_module.c
+0
-0
ne_segment.c
dlls/kernel/ne_segment.c
+0
-0
resource16.c
dlls/kernel/resource16.c
+23
-34
No files found.
dlls/kernel/kernel16_private.h
View file @
8eb1630c
...
...
@@ -61,11 +61,12 @@ typedef struct _NE_MODULE
WORD
ne_swaparea
;
/* 3c Min. swap area size */
WORD
ne_expver
;
/* 3e Expected Windows version */
/* From here, these are extra fields not present in normal Windows */
HMODULE
module32
;
/* 40 PE module handle for Win32 modules */
HMODULE16
self
;
/* 44 Handle for this module */
WORD
self_loading_sel
;
/* 46 Selector used for self-loading apps. */
LPVOID
rsrc32_map
;
/* 48 HRSRC 16->32 map (for 32-bit modules) */
HANDLE
fd
;
/* 4c handle to the binary file */
HMODULE
module32
;
/* PE module handle for Win32 modules */
HMODULE16
self
;
/* Handle for this module */
WORD
self_loading_sel
;
/* Selector used for self-loading apps. */
LPVOID
rsrc32_map
;
/* HRSRC 16->32 map (for 32-bit modules) */
LPCVOID
mapping
;
/* mapping of the binary file */
SIZE_T
mapping_size
;
/* size of the file mapping */
}
NE_MODULE
;
typedef
struct
...
...
@@ -132,6 +133,14 @@ extern THHOOK *pThhook;
#define NE_MODULE_NAME(pModule) \
(((OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo))->szPathName)
#define NE_GET_DATA(pModule,offset,size) \
((const void *)(((offset)+(size) <= pModule->mapping_size) ? \
(const char *)pModule->mapping + (offset) : NULL))
#define NE_READ_DATA(pModule,buffer,offset,size) \
(((offset)+(size) <= pModule->mapping_size) ? \
(memcpy( buffer, (const char *)pModule->mapping + (offset), (size) ), TRUE) : FALSE)
#define CURRENT_STACK16 ((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))
#define CURRENT_DS (CURRENT_STACK16->ds)
...
...
@@ -158,7 +167,6 @@ extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name );
extern
FARPROC16
WINAPI
NE_GetEntryPoint
(
HMODULE16
hModule
,
WORD
ordinal
);
extern
FARPROC16
NE_GetEntryPointEx
(
HMODULE16
hModule
,
WORD
ordinal
,
BOOL16
snoop
);
extern
BOOL16
NE_SetEntryPoint
(
HMODULE16
hModule
,
WORD
ordinal
,
WORD
offset
);
extern
HANDLE
NE_OpenFile
(
NE_MODULE
*
pModule
);
extern
DWORD
NE_StartTask
(
void
);
/* ne_segment.c */
...
...
dlls/kernel/ne_module.c
View file @
8eb1630c
This diff is collapsed.
Click to expand it.
dlls/kernel/ne_segment.c
View file @
8eb1630c
This diff is collapsed.
Click to expand it.
dlls/kernel/resource16.c
View file @
8eb1630c
...
...
@@ -330,53 +330,42 @@ static NE_NAMEINFO *NE_FindResourceFromType( LPBYTE pResTab, NE_TYPEINFO *pTypeI
HGLOBAL16
WINAPI
NE_DefResourceHandler
(
HGLOBAL16
hMemObj
,
HMODULE16
hModule
,
HRSRC16
hRsrc
)
{
HANDLE
fd
;
HGLOBAL16
handle
;
WORD
sizeShift
;
NE_NAMEINFO
*
pNameInfo
;
NE_MODULE
*
pModule
=
NE_GetPtr
(
hModule
);
if
(
pModule
&&
(
pModule
->
ne_flags
&
NE_FFLAGS_BUILTIN
))
{
HGLOBAL16
handle
;
WORD
sizeShift
=
*
(
WORD
*
)((
char
*
)
pModule
+
pModule
->
ne_rsrctab
);
NE_NAMEINFO
*
pNameInfo
=
(
NE_NAMEINFO
*
)((
char
*
)
pModule
+
hRsrc
);
if
(
hMemObj
)
handle
=
GlobalReAlloc16
(
hMemObj
,
pNameInfo
->
length
<<
sizeShift
,
0
);
else
handle
=
AllocResource16
(
hModule
,
hRsrc
,
0
);
if
(
!
pModule
)
return
0
;
sizeShift
=
*
(
WORD
*
)((
char
*
)
pModule
+
pModule
->
ne_rsrctab
);
pNameInfo
=
(
NE_NAMEINFO
*
)((
char
*
)
pModule
+
hRsrc
);
if
(
hMemObj
)
handle
=
GlobalReAlloc16
(
hMemObj
,
pNameInfo
->
length
<<
sizeShift
,
0
);
else
handle
=
AllocResource16
(
hModule
,
hRsrc
,
0
);
if
(
handle
)
if
(
handle
)
{
if
(
pModule
->
ne_flags
&
NE_FFLAGS_BUILTIN
)
{
/* NOTE: hRsrcMap points to start of built-in resource data */
memcpy
(
GlobalLock16
(
handle
),
(
char
*
)
pModule
->
rsrc32_map
+
(
pNameInfo
->
offset
<<
sizeShift
),
pNameInfo
->
length
<<
sizeShift
);
}
return
handle
;
}
if
(
pModule
&&
(
fd
=
NE_OpenFile
(
pModule
))
!=
INVALID_HANDLE_VALUE
)
{
HGLOBAL16
handle
;
WORD
sizeShift
=
*
(
WORD
*
)((
char
*
)
pModule
+
pModule
->
ne_rsrctab
);
NE_NAMEINFO
*
pNameInfo
=
(
NE_NAMEINFO
*
)((
char
*
)
pModule
+
hRsrc
);
TRACE
(
"loading, pos=%d, len=%d
\n
"
,
(
int
)
pNameInfo
->
offset
<<
sizeShift
,
(
int
)
pNameInfo
->
length
<<
sizeShift
);
if
(
hMemObj
)
handle
=
GlobalReAlloc16
(
hMemObj
,
pNameInfo
->
length
<<
sizeShift
,
0
);
else
handle
=
AllocResource16
(
hModule
,
hRsrc
,
0
);
if
(
handle
)
{
DWORD
res
;
SetFilePointer
(
fd
,
(
int
)
pNameInfo
->
offset
<<
sizeShift
,
NULL
,
SEEK_SET
);
ReadFile
(
fd
,
GlobalLock16
(
handle
),
(
int
)
pNameInfo
->
length
<<
sizeShift
,
&
res
,
NULL
);
if
(
!
NE_READ_DATA
(
pModule
,
GlobalLock16
(
handle
),
(
int
)
pNameInfo
->
offset
<<
sizeShift
,
(
int
)
pNameInfo
->
length
<<
sizeShift
))
{
GlobalFree16
(
handle
);
handle
=
0
;
}
}
CloseHandle
(
fd
);
return
handle
;
}
return
(
HGLOBAL16
)
0
;
return
handle
;
}
...
...
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