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
5d9586a6
Commit
5d9586a6
authored
Jul 05, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Get rid of the almost empty virtual.c.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
73a28110
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
108 deletions
+70
-108
Makefile.in
dlls/ntdll/Makefile.in
+0
-1
thread.c
dlls/ntdll/thread.c
+70
-1
virtual.c
dlls/ntdll/virtual.c
+0
-106
No files found.
dlls/ntdll/Makefile.in
View file @
5d9586a6
...
...
@@ -62,7 +62,6 @@ C_SRCS = \
unix/thread.c
\
unix/virtual.c
\
version.c
\
virtual.c
\
wcstring.c
RC_SRCS
=
version.rc
...
...
dlls/ntdll/thread.c
View file @
5d9586a6
...
...
@@ -32,8 +32,8 @@
#include "ddk/wdm.h"
#include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
thread
);
WINE_DECLARE_DEBUG_CHANNEL
(
relay
);
WINE_DECLARE_DEBUG_CHANNEL
(
thread
);
WINE_DECLARE_DEBUG_CHANNEL
(
pid
);
WINE_DECLARE_DEBUG_CHANNEL
(
timestamp
);
...
...
@@ -303,6 +303,75 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
}
/**********************************************************************
* RtlCreateUserStack (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlCreateUserStack
(
SIZE_T
commit
,
SIZE_T
reserve
,
ULONG
zero_bits
,
SIZE_T
commit_align
,
SIZE_T
reserve_align
,
INITIAL_TEB
*
stack
)
{
PROCESS_STACK_ALLOCATION_INFORMATION
alloc
;
NTSTATUS
status
;
TRACE
(
"commit %#lx, reserve %#lx, zero_bits %u, commit_align %#lx, reserve_align %#lx, stack %p
\n
"
,
commit
,
reserve
,
zero_bits
,
commit_align
,
reserve_align
,
stack
);
if
(
!
commit_align
||
!
reserve_align
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
commit
||
!
reserve
)
{
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
);
if
(
!
reserve
)
reserve
=
nt
->
OptionalHeader
.
SizeOfStackReserve
;
if
(
!
commit
)
commit
=
nt
->
OptionalHeader
.
SizeOfStackCommit
;
}
reserve
=
(
reserve
+
reserve_align
-
1
)
&
~
(
reserve_align
-
1
);
commit
=
(
commit
+
commit_align
-
1
)
&
~
(
commit_align
-
1
);
if
(
reserve
<
commit
)
reserve
=
commit
;
if
(
reserve
<
0x100000
)
reserve
=
0x100000
;
reserve
=
(
reserve
+
0xffff
)
&
~
0xffff
;
/* round to 64K boundary */
alloc
.
ReserveSize
=
reserve
;
alloc
.
ZeroBits
=
zero_bits
;
status
=
NtSetInformationProcess
(
GetCurrentProcess
(),
ProcessThreadStackAllocation
,
&
alloc
,
sizeof
(
alloc
)
);
if
(
!
status
)
{
void
*
addr
=
alloc
.
StackBase
;
SIZE_T
size
=
page_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_NOACCESS
);
addr
=
(
char
*
)
alloc
.
StackBase
+
page_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_READWRITE
|
PAGE_GUARD
);
addr
=
(
char
*
)
alloc
.
StackBase
+
2
*
page_size
;
size
=
reserve
-
2
*
page_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_READWRITE
);
/* note: limit is lower than base since the stack grows down */
stack
->
OldStackBase
=
0
;
stack
->
OldStackLimit
=
0
;
stack
->
DeallocationStack
=
alloc
.
StackBase
;
stack
->
StackBase
=
(
char
*
)
alloc
.
StackBase
+
reserve
;
stack
->
StackLimit
=
(
char
*
)
alloc
.
StackBase
+
2
*
page_size
;
}
return
status
;
}
/**********************************************************************
* RtlFreeUserStack (NTDLL.@)
*/
void
WINAPI
RtlFreeUserStack
(
void
*
stack
)
{
SIZE_T
size
=
0
;
TRACE
(
"stack %p
\n
"
,
stack
);
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
stack
,
&
size
,
MEM_RELEASE
);
}
/******************************************************************************
* RtlGetNtGlobalFlags (NTDLL.@)
*/
...
...
dlls/ntdll/virtual.c
deleted
100644 → 0
View file @
73a28110
/*
* Win32 virtual memory functions
*
* Copyright 1997, 2002 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#define NONAMELESSUNION
#include "windef.h"
#include "winternl.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
virtual
);
/**********************************************************************
* RtlCreateUserStack (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlCreateUserStack
(
SIZE_T
commit
,
SIZE_T
reserve
,
ULONG
zero_bits
,
SIZE_T
commit_align
,
SIZE_T
reserve_align
,
INITIAL_TEB
*
stack
)
{
PROCESS_STACK_ALLOCATION_INFORMATION
alloc
;
NTSTATUS
status
;
TRACE
(
"commit %#lx, reserve %#lx, zero_bits %u, commit_align %#lx, reserve_align %#lx, stack %p
\n
"
,
commit
,
reserve
,
zero_bits
,
commit_align
,
reserve_align
,
stack
);
if
(
!
commit_align
||
!
reserve_align
)
return
STATUS_INVALID_PARAMETER
;
if
(
!
commit
||
!
reserve
)
{
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
);
if
(
!
reserve
)
reserve
=
nt
->
OptionalHeader
.
SizeOfStackReserve
;
if
(
!
commit
)
commit
=
nt
->
OptionalHeader
.
SizeOfStackCommit
;
}
reserve
=
(
reserve
+
reserve_align
-
1
)
&
~
(
reserve_align
-
1
);
commit
=
(
commit
+
commit_align
-
1
)
&
~
(
commit_align
-
1
);
if
(
reserve
<
commit
)
reserve
=
commit
;
if
(
reserve
<
0x100000
)
reserve
=
0x100000
;
reserve
=
(
reserve
+
0xffff
)
&
~
0xffff
;
/* round to 64K boundary */
alloc
.
ReserveSize
=
reserve
;
alloc
.
ZeroBits
=
zero_bits
;
status
=
NtSetInformationProcess
(
GetCurrentProcess
(),
ProcessThreadStackAllocation
,
&
alloc
,
sizeof
(
alloc
)
);
if
(
!
status
)
{
void
*
addr
=
alloc
.
StackBase
;
SIZE_T
size
=
page_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_NOACCESS
);
addr
=
(
char
*
)
alloc
.
StackBase
+
page_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_READWRITE
|
PAGE_GUARD
);
addr
=
(
char
*
)
alloc
.
StackBase
+
2
*
page_size
;
size
=
reserve
-
2
*
page_size
;
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_READWRITE
);
/* note: limit is lower than base since the stack grows down */
stack
->
OldStackBase
=
0
;
stack
->
OldStackLimit
=
0
;
stack
->
DeallocationStack
=
alloc
.
StackBase
;
stack
->
StackBase
=
(
char
*
)
alloc
.
StackBase
+
reserve
;
stack
->
StackLimit
=
(
char
*
)
alloc
.
StackBase
+
2
*
page_size
;
}
return
status
;
}
/**********************************************************************
* RtlFreeUserStack (NTDLL.@)
*/
void
WINAPI
RtlFreeUserStack
(
void
*
stack
)
{
SIZE_T
size
=
0
;
TRACE
(
"stack %p
\n
"
,
stack
);
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
stack
,
&
size
,
MEM_RELEASE
);
}
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