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
acefd16b
Commit
acefd16b
authored
Dec 29, 2000
by
Ulrich Weigand
Committed by
Alexandre Julliard
Dec 29, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent unaligned access to NE in-memory module data.
parent
e709cdba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
module.c
loader/module.c
+2
-2
module.c
loader/ne/module.c
+9
-8
resource.c
loader/ne/resource.c
+7
-6
No files found.
loader/module.c
View file @
acefd16b
...
...
@@ -356,7 +356,7 @@ HMODULE MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 )
+
strlen
(
filename
)
+
1
;
size
=
sizeof
(
NE_MODULE
)
+
/* loaded file info */
of_size
+
((
of_size
+
3
)
&
~
3
)
+
/* segment table: DS,CS */
2
*
sizeof
(
SEGTABLEENTRY
)
+
/* name table */
...
...
@@ -405,7 +405,7 @@ HMODULE MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 )
ofs
->
cBytes
=
of_size
<
256
?
of_size
:
255
;
/* FIXME */
strcpy
(
ofs
->
szPathName
,
filename
);
pSegment
=
(
SEGTABLEENTRY
*
)((
char
*
)(
pModule
+
1
)
+
of_size
);
pSegment
=
(
SEGTABLEENTRY
*
)((
char
*
)(
pModule
+
1
)
+
((
of_size
+
3
)
&
~
3
)
);
pModule
->
seg_table
=
(
int
)
pSegment
-
(
int
)
pModule
;
/* Data segment */
pSegment
->
size
=
0
;
...
...
loader/ne/module.c
View file @
acefd16b
...
...
@@ -10,6 +10,7 @@
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include "wine/port.h"
#include "wine/winbase16.h"
#include "wine/library.h"
#include "winerror.h"
...
...
@@ -264,9 +265,9 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
{
if
(((
BYTE
)
*
cpnt
==
len
)
&&
!
memcmp
(
cpnt
+
1
,
buffer
,
len
))
{
TRACE
(
" Found: ordinal=%d
\n
"
,
*
(
WORD
*
)(
cpnt
+
*
cpnt
+
1
)
);
return
*
(
WORD
*
)(
cpnt
+
*
cpnt
+
1
)
;
WORD
ordinal
=
GET_UA_WORD
(
cpnt
+
*
cpnt
+
1
);
TRACE
(
" Found: ordinal=%d
\n
"
,
ordinal
);
return
ordinal
;
}
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
}
...
...
@@ -282,9 +283,9 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
{
if
(((
BYTE
)
*
cpnt
==
len
)
&&
!
memcmp
(
cpnt
+
1
,
buffer
,
len
))
{
TRACE
(
" Found: ordinal=%d
\n
"
,
*
(
WORD
*
)(
cpnt
+
*
cpnt
+
1
)
);
return
*
(
WORD
*
)(
cpnt
+
*
cpnt
+
1
)
;
WORD
ordinal
=
GET_UA_WORD
(
cpnt
+
*
cpnt
+
1
);
TRACE
(
" Found: ordinal=%d
\n
"
,
ordinal
);
return
ordinal
;
}
cpnt
+=
*
cpnt
+
1
+
sizeof
(
WORD
);
}
...
...
@@ -331,7 +332,7 @@ FARPROC16 NE_GetEntryPointEx( HMODULE16 hModule, WORD ordinal, BOOL16 snoop )
entry
++
;
sel
=
entry
->
segnum
;
offset
=
entry
->
offs
;
offset
=
GET_UA_WORD
(
&
entry
->
offs
)
;
if
(
sel
==
0xfe
)
sel
=
0xffff
;
/* constant entry */
else
sel
=
GlobalHandleToSel16
(
NE_SEG_TABLE
(
pModule
)[
sel
-
1
].
hSeg
);
...
...
@@ -372,7 +373,7 @@ BOOL16 NE_SetEntryPoint( HMODULE16 hModule, WORD ordinal, WORD offset )
for
(
i
=
0
;
i
<
(
ordinal
-
bundle
->
first
-
1
);
i
++
)
entry
++
;
entry
->
offs
=
offset
;
PUT_UA_WORD
(
&
entry
->
offs
,
offset
)
;
return
TRUE
;
}
...
...
loader/ne/resource.c
View file @
acefd16b
...
...
@@ -14,6 +14,7 @@
#include <fcntl.h>
#include <unistd.h>
#include "windef.h"
#include "wine/port.h"
#include "wine/winbase16.h"
#include "wine/library.h"
#include "global.h"
...
...
@@ -259,7 +260,7 @@ BOOL NE_InitResourceHandler( HMODULE16 hModule )
while
(
pTypeInfo
->
type_id
)
{
pTypeInfo
->
resloader
=
DefResourceHandlerProc
;
PUT_UA_DWORD
(
&
pTypeInfo
->
resloader
,
(
DWORD
)
DefResourceHandlerProc
)
;
pTypeInfo
=
NEXT_TYPEINFO
(
pTypeInfo
);
}
return
TRUE
;
...
...
@@ -285,8 +286,8 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId,
{
if
(
!
(
pTypeInfo
=
NE_FindTypeSection
(
pResTab
,
pTypeInfo
,
typeId
)))
break
;
prevHandler
=
pTypeInfo
->
resloader
;
pTypeInfo
->
resloader
=
resourceHandler
;
prevHandler
=
(
FARPROC16
)
GET_UA_DWORD
(
&
pTypeInfo
->
resloader
)
;
PUT_UA_DWORD
(
&
pTypeInfo
->
resloader
,
(
DWORD
)
resourceHandler
)
;
pTypeInfo
=
NEXT_TYPEINFO
(
pTypeInfo
);
}
return
prevHandler
;
...
...
@@ -483,10 +484,10 @@ HGLOBAL16 NE_LoadResource( NE_MODULE *pModule, HRSRC16 hRsrc )
}
else
{
if
(
pTypeInfo
->
resloader
&&
pTypeInfo
->
resloader
!=
DefResourceHandlerProc
)
FARPROC16
resloader
=
(
FARPROC16
)
GET_UA_DWORD
(
&
pTypeInfo
->
resloader
);
if
(
resloader
&&
resloader
!=
DefResourceHandlerProc
)
pNameInfo
->
handle
=
NE_CallTo16_word_www
(
pTypeInfo
->
resloader
,
pNameInfo
->
handle
,
pModule
->
self
,
hRsrc
);
resloader
,
pNameInfo
->
handle
,
pModule
->
self
,
hRsrc
);
else
pNameInfo
->
handle
=
NE_DefResourceHandler
(
pNameInfo
->
handle
,
pModule
->
self
,
hRsrc
);
...
...
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