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
9912ef77
Commit
9912ef77
authored
Oct 16, 2016
by
Sebastian Lackner
Committed by
Alexandre Julliard
Oct 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe: Use MmInitializeMdl in IoAllocateMdl.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
eb7ac554
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
15 deletions
+25
-15
ntoskrnl.c
dlls/ntoskrnl.exe/ntoskrnl.c
+4
-15
wdm.h
include/ddk/wdm.h
+21
-0
No files found.
dlls/ntoskrnl.exe/ntoskrnl.c
View file @
9912ef77
...
...
@@ -744,31 +744,20 @@ PVOID WINAPI IoAllocateErrorLogEntry( PVOID IoObject, UCHAR EntrySize )
*/
PMDL
WINAPI
IoAllocateMdl
(
PVOID
va
,
ULONG
length
,
BOOLEAN
secondary
,
BOOLEAN
charge_quota
,
IRP
*
irp
)
{
SIZE_T
mdl_size
;
PMDL
mdl
;
ULONG_PTR
address
=
(
ULONG_PTR
)
va
;
ULONG_PTR
page_address
;
SIZE_T
nb_pages
,
mdl_size
;
TRACE
(
"(%p, %u, %i, %i, %p)
\n
"
,
va
,
length
,
secondary
,
charge_quota
,
irp
);
if
(
charge_quota
)
FIXME
(
"Charge quota is not yet supported
\n
"
);
/* FIXME: We suppose that page size is 4096 */
page_address
=
address
&
~
(
4096
-
1
);
nb_pages
=
(((
address
+
length
-
1
)
&
~
(
4096
-
1
))
-
page_address
)
/
4096
+
1
;
mdl_size
=
sizeof
(
MDL
)
+
nb_pages
*
sizeof
(
PVOID
);
mdl
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mdl_size
);
mdl_size
=
sizeof
(
MDL
)
+
sizeof
(
PFN_NUMBER
)
*
ADDRESS_AND_SIZE_TO_SPAN_PAGES
(
va
,
length
);
mdl
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mdl_size
);
if
(
!
mdl
)
return
NULL
;
mdl
->
Size
=
mdl_size
;
mdl
->
Process
=
NULL
;
/* FIXME: IoGetCurrentProcess */
mdl
->
StartVa
=
(
PVOID
)
page_address
;
mdl
->
ByteCount
=
length
;
mdl
->
ByteOffset
=
address
-
page_address
;
MmInitializeMdl
(
mdl
,
va
,
length
);
if
(
!
irp
)
return
mdl
;
...
...
include/ddk/wdm.h
View file @
9912ef77
...
...
@@ -28,6 +28,16 @@
#define POINTER_ALIGNMENT
#endif
/* FIXME: We suppose that page size is 4096 */
#undef PAGE_SIZE
#define PAGE_SIZE 0x1000
#define PAGE_SHIFT 12
#define BYTE_OFFSET(va) ((ULONG)((ULONG_PTR)(va) & (PAGE_SIZE - 1)))
#define PAGE_ALIGN(va) ((PVOID)((ULONG_PTR)(va) & ~(PAGE_SIZE - 1)))
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(va, length) \
((BYTE_OFFSET(va) + ((SIZE_T)(length)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT)
typedef
LONG
KPRIORITY
;
typedef
ULONG_PTR
KSPIN_LOCK
,
*
PKSPIN_LOCK
;
...
...
@@ -1035,6 +1045,17 @@ typedef struct _MDL {
}
MDL
,
*
PMDL
;
typedef
MDL
*
PMDLX
;
typedef
ULONG
PFN_NUMBER
,
*
PPFN_NUMBER
;
static
inline
void
MmInitializeMdl
(
MDL
*
mdl
,
void
*
va
,
SIZE_T
length
)
{
mdl
->
Next
=
NULL
;
mdl
->
Size
=
sizeof
(
MDL
)
+
sizeof
(
PFN_NUMBER
)
*
ADDRESS_AND_SIZE_TO_SPAN_PAGES
(
va
,
length
);
mdl
->
MdlFlags
=
0
;
mdl
->
StartVa
=
(
void
*
)
PAGE_ALIGN
(
va
);
mdl
->
ByteOffset
=
BYTE_OFFSET
(
va
);
mdl
->
ByteCount
=
length
;
}
typedef
struct
_KTIMER
{
DISPATCHER_HEADER
Header
;
...
...
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