mirror of
https://github.com/reactos/reactos.git
synced 2025-01-27 05:54:16 +08:00
Added .o -> .sys rule to simplify driver makefiles
Added PATH_TO_ROOT variable to most makefiles Added system independant install utility Implemented prototype system for changing individual regions without a memory area Added some interesting articles from usenet svn path=/trunk/; revision=1306
This commit is contained in:
parent
f7d76fbc5b
commit
ddfa2017c7
5
reactos/.gdbinit
Normal file
5
reactos/.gdbinit
Normal file
@ -0,0 +1,5 @@
|
||||
file ntoskrnl/ntoskrnl.nostrip.exe
|
||||
add-symbol-file lib/ntdll/ntdll.dll 0x77f61000
|
||||
add-symbol-file subsys/smss/smss.exe 0x401000
|
||||
#add-symbol-file subsys/csrss/csrss.exe 0x401000
|
||||
break exp.c:156
|
@ -6,7 +6,7 @@
|
||||
# Select your host
|
||||
#
|
||||
#HOST = mingw32-linux
|
||||
HOST = mingw32-windows
|
||||
#HOST = mingw32-windows
|
||||
|
||||
include rules.mak
|
||||
|
||||
@ -57,7 +57,16 @@ clean: buildno_clean $(COMPONENTS:%=%_clean) $(DLLS:%=%_clean) $(LOADERS:%=%_cle
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
install: make_install_dirs autoexec_install $(COMPONENTS:%=%_install) \
|
||||
ifeq ($(HOST),mingw32-linux)
|
||||
rcopy$(EXE_POSTFIX): rcopy.c
|
||||
$(NATIVE_CC) -g -DUNIX_PATHS rcopy.c -o rcopy$(EXE_POSTFIX)
|
||||
endif
|
||||
ifeq ($(HOST),mingw32-windows)
|
||||
rcopy$(EXE_POSTFIX): rcopy.c
|
||||
$(NATIVE_CC) -g -DDOS_PATHS rcopy.c -o rcopy$(EXE_POSTFIX)
|
||||
endif
|
||||
|
||||
install: rcopy$(EXE_POSTFIX) make_install_dirs autoexec_install $(COMPONENTS:%=%_install) \
|
||||
$(DLLS:%=%_install) $(LOADERS:%=%_install) \
|
||||
$(KERNEL_SERVICES:%=%_install) $(SUBSYS:%=%_install) \
|
||||
$(APPS:%=%_install)
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS= ../common/crt0.o apc.o
|
||||
PROGS= apc.exe
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS= args.o
|
||||
PROGS= args.exe
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
PROGS = bench-thread
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS = consume.o
|
||||
PROGS = consume.exe
|
||||
LIBS =
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS = dump_shared_data.o
|
||||
PROGS = dump_shared_data.exe
|
||||
LIBS =
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
PROGS = event
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS= file.o
|
||||
PROGS= file.exe
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
PROGS = gditest
|
||||
|
||||
OBJECTS= ../common/crt0.o
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS = hello.o
|
||||
PROGS = hello.exe
|
||||
LIBS =
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
SRV_OBJECTS= ../common/crt0.o lpcsrv.o
|
||||
CLT_OBJECTS= ../common/crt0.o lpcclt.o
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS = pteb.o
|
||||
PROGS = pteb.exe
|
||||
LIBS =
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
SRV_OBJECTS= ../common/crt0.o shmsrv.o
|
||||
CLT_OBJECTS= ../common/crt0.o shmclt.o
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
PROGS= test-stdio tst-printf tstdiomisc bug2 bug3 \
|
||||
temptest test-fseek test_rdwr
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
PROGS = thread
|
||||
|
||||
all: $(PROGS:%=%.exe)
|
||||
|
@ -1,6 +1,8 @@
|
||||
# $Id: Makefile,v 1.6 2000/06/29 23:35:09 dwelch Exp $
|
||||
# $Id: Makefile,v 1.7 2000/08/18 22:26:53 dwelch Exp $
|
||||
#
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
BASE_CFLAGS =
|
||||
TARGETNAME=buildno
|
||||
CLEAN_FILES= $(TARGETNAME).o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).sym
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS= cat.o
|
||||
PROGS= cat.exe
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET_NAME=objdir
|
||||
OBJECTS= $(TARGET_NAME).o
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
OBJECTS= ../common/crt0.o shell.o
|
||||
PROGS= shell.exe
|
||||
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
|
||||
|
142
reactos/doc/news1
Normal file
142
reactos/doc/news1
Normal file
@ -0,0 +1,142 @@
|
||||
|
||||
Correction / addition to Prasad's "Undocumented NT"
|
||||
|
||||
From: dan_ps@my-deja.com
|
||||
Reply to: dan_ps@my-deja.com
|
||||
Date: Sun, 23 Apr 2000 10:03:30 GMT
|
||||
Organization: Deja.com - Before you buy.
|
||||
Newsgroups:
|
||||
comp.os.ms-windows.programmer.nt.kernel-mode
|
||||
Followup to: newsgroup
|
||||
|
||||
|
||||
Recently , I had a chanche to borrow "Undocumented NT" by Mr Prasad
|
||||
Dabak from one of my friends and read it. While reading the chapters
|
||||
regarding builidng your own interrupt handlers or callgates under NT ,
|
||||
I found that the book glosses over very important topics such as IDT
|
||||
in SMP enviroments , and a complete wrong presentation of what structure
|
||||
a interrupt handler is supposed to build on the stack to ensure shamless
|
||||
OS functionality. Mr's Prasad choice is a straigtforward pushad ,
|
||||
folowed by setting the FS segment to the ring0 PCR selector. This way
|
||||
to build a trap frame for a interrupt is still used in Windows 95 ,
|
||||
but in Windows NT , the layout of a correct Trap Frame is a little bit
|
||||
more complex.
|
||||
The correct layout for a Trap Frame is the folowing: (note that
|
||||
it consitis from two parts , a stack frame wich is built by the CPU
|
||||
according to mode in wich was the CPU when the exception or software
|
||||
interrupt was generated , and a Context Capure frame who has to be built
|
||||
by the exception handler itself )
|
||||
|
||||
struc KeTrapFrame
|
||||
|
||||
.DebugEBP resd 1 ; 00
|
||||
.DebugEIP resd 1 ; 04
|
||||
.DebugArgMark resd 1 ; 08
|
||||
.DebugPointer resd 1 ; 0C
|
||||
.TempCS resd 1 ; 10
|
||||
.TempEsp resd 1 ; 14
|
||||
|
||||
.DR0 resd 1 ; 18
|
||||
.DR1 resd 1 ; 1C
|
||||
.DR2 resd 1 ; 20
|
||||
.DR3 resd 1 ; 24
|
||||
.DR6 resd 1 ; 28
|
||||
.DR7 resd 1 ; 2C
|
||||
.GS resw 1 ; 30
|
||||
resw 1 ; 32
|
||||
.ES resw 1 ; 34
|
||||
resw 1 ; 36
|
||||
.DS resw 1 ; 38
|
||||
resw 1 ; 3A
|
||||
.EDX resd 1 ; 3C
|
||||
.ECX resd 1 ; 40
|
||||
.EAX resd 1 ; 44
|
||||
.PreviousMode resd 1 ; 48
|
||||
.ExceptionList resd 1 ; 4C
|
||||
.FS resw 1 ; 50
|
||||
resw 1 ; 52
|
||||
.EDI resd 1 ; 54
|
||||
.ESI resd 1 ; 58
|
||||
.EBX resd 1 ; 5C
|
||||
.EBP resd 1 ; 60
|
||||
.Error resd 1 ; 64
|
||||
.EIP resd 1 ; 68
|
||||
.CS resw 1 ; 6C
|
||||
resw 1 ; 6E
|
||||
.EFLAGS resd 1 ; 70
|
||||
.ESP resd 1 ; 74
|
||||
.SS resw 1 ; 78
|
||||
resw 1 ; 7A
|
||||
.ES_V86 resw 1 ; 7C
|
||||
resw 1 ; 7E
|
||||
.DS_V86 resw 1 ; 80
|
||||
resw 1 ; 82
|
||||
.FS_V86 resw 1 ; 84
|
||||
resw 1 ; 86
|
||||
.GS_V86 resw 1 ; 88
|
||||
endstruc
|
||||
|
||||
Note that this is the complete layout of a TrapFrame structure.
|
||||
Depending in what mode the CPU was when the exception occured , it may
|
||||
break earlier than .GS_V86. Also , it seems that fields above .DR0 are
|
||||
required only to debug builds. The declaration is for NASM , a free X86
|
||||
assembler , but this shouldnt have any kind of importance.
|
||||
|
||||
Now why one should build the correct layout for this stack
|
||||
frame ? The answer is that for shamlees operation of OS , a interrupt
|
||||
handler HAS to poke into interrupted thread's KTHREAD strucure a
|
||||
pointer to current TrapFrame existing on stack. This pointer will be
|
||||
later used by several ntoskrnl API's to gain access to interrupted
|
||||
thread;s acccess registers , or to gain information about the
|
||||
interrupted thread's ring3 stack location , or simply to capture all
|
||||
this information and package it into the form of a CONTEXT structure.
|
||||
Since ntoskrnl assumes the above layout for a stack frame , using any
|
||||
other structure size or layout can lead to unforeseen consequences.
|
||||
|
||||
Other things wich one may want to do when building a stack
|
||||
frame are : (assumes that the handler already set the FS register to
|
||||
kernel PCR selector )
|
||||
|
||||
1. Save old Exception List head , and patch -1 to FS:0 ( thus
|
||||
overriding any potentialy pre-existing SEH handlers.
|
||||
|
||||
2. Determine whatever the interrupted thread was runing in
|
||||
ring0 or in ring3 and save this information in PreviousMode field of
|
||||
The Trap frame. This is also important , since many internal API's will
|
||||
check the Provious mode , acting differently in each case. (check CS
|
||||
image on stack for this )
|
||||
|
||||
3. Get a pointer to the top of KeTrapFrame , and patch it into
|
||||
KTHREAD structure, at KTHREAD->TrapFrame. if ya want the layout of
|
||||
TrapFrame , there are multiple places where one can get it , but Im
|
||||
willing to post it here on request.
|
||||
|
||||
4. In the case that the hardware stack built by CPU does not
|
||||
contain an error code , fake one ( generaly , aborts always push an
|
||||
error code on stack , some exceptions do , and traps never push an
|
||||
error code by deafult. Suplimentary information can be found in intel
|
||||
arch. reference manual .
|
||||
|
||||
5. Optionaly enable the interrupts trough a STI . NT uses
|
||||
usualy interrupt gates , so the CPU will clear IF upon entering an
|
||||
exception handler. Note that in the case handling the interrupt or
|
||||
exception trough a trap gate , IF will not be automaticly cleared.
|
||||
|
||||
If you are interesting in the code wich can actualy build such
|
||||
a structure on the stack , use a kernel debugger and Break on Int
|
||||
0x2E , and single step the code .
|
||||
|
||||
As last words , I want to ensure Mr Prasad of my respect , and
|
||||
the thing that the only reason for this posting is my feeling that all
|
||||
holes must be covered , for the sake of all NT driver writing comunity.
|
||||
|
||||
Later , Dan
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Sent via Deja.com http://www.deja.com/
|
||||
Before you buy.
|
52
reactos/doc/news2
Normal file
52
reactos/doc/news2
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
Re: alternative to SeCaptureSubjectContext for Win2000 sought
|
||||
|
||||
From: "dave porter" <porter@zultranet.com>
|
||||
Reply to: "dave porter"
|
||||
Date: Mon, 26 Jun 2000 10:57:18 -0400
|
||||
Newsgroups:
|
||||
comp.os.ms-windows.programmer.nt.kernel-mode
|
||||
Followup to: newsgroup
|
||||
References:
|
||||
<39520e7f$0$15896@wodc7nh1.news.uu.net>
|
||||
<sl5ulbjfe7f47@corp.supernews.com>
|
||||
<39575985$0$24336@wodc7nh0.news.uu.net>
|
||||
|
||||
|
||||
> Under advise, I have tried ZwOpenProcessToken(), but to little avail.
|
||||
> ZwQueryInformationToken( ..TokenUser ...) doesn't seem to want to do its
|
||||
job
|
||||
> either under NT4.
|
||||
|
||||
I could be jumping in the middle here, but in what way doesn't it work?
|
||||
This code works for me:
|
||||
|
||||
int bufLen = 256; // we suppose this is enough
|
||||
void* sidBuf = new char[bufLen];
|
||||
int sidLen = 0;
|
||||
|
||||
void* pToken = PsReferencePrimaryToken(PsGetCurrentProcess());
|
||||
if (!pToken) ... error ...
|
||||
|
||||
NTSTATUS ntstatus = ObOpenObjectByPointer(pToken, 0, 0, TOKEN_QUERY,
|
||||
0, KernelMode, &handle);
|
||||
if (!NT_SUCCESS(ntstatus)) ... error ...
|
||||
|
||||
TOKEN_USER* user = static_cast<TOKEN_USER*>(sidBuf);
|
||||
ULONG tokenInfoLen;
|
||||
ntstatus = ZwQueryInformationToken(handle, TokenUser, user, bufLen,
|
||||
&tokenInfoLen);
|
||||
if (!NT_SUCCESS(ntstatus)) ... error ...
|
||||
|
||||
assert(tokenInfoLen <= bufLen); // else we would have got an error,
|
||||
right?
|
||||
assert(user->User.Sid == user+1); // SID is in buffer just past
|
||||
TOKEN_USER structure
|
||||
|
||||
sidLen = tokenInfoLen - sizeof (TOKEN_USER);
|
||||
memmove(sidBuf, user->User.Sid, sidLen); // shuffle down the buffer
|
||||
|
||||
Naturally, this returns the id of the thread that's running it.
|
||||
If you execute this in DriverEntry, you're running in some
|
||||
thread in the system process, which is not related to
|
||||
the thread which executed the Win32 StartService call.
|
@ -1,6 +1,8 @@
|
||||
# $Id: makefile,v 1.7 2000/08/11 12:41:58 ekohl Exp $
|
||||
# $Id: makefile,v 1.8 2000/08/18 22:27:04 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET = beep
|
||||
OBJECTS = beep.o beep.coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
|
@ -1,13 +1,15 @@
|
||||
# $Id: makefile,v 1.12 2000/08/11 12:42:07 ekohl Exp $
|
||||
# $Id: makefile,v 1.13 2000/08/18 22:27:04 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET = blue
|
||||
|
||||
BASE_CFLAGS = -I../../../include
|
||||
|
||||
OBJECTS = $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
all: $(TARGET).sys
|
||||
all: $(TARGET).sys $(TARGET).sys.unstripped
|
||||
|
||||
.phony: all
|
||||
|
||||
@ -24,48 +26,13 @@ clean:
|
||||
install: $(FLOPPY_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
$(FLOPPY_DIR)/drivers/$(TARGET).sys: $(TARGET).sys
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $(TARGET).sys $(FLOPPY_DIR)\drivers\$(TARGET).sys
|
||||
else
|
||||
$(CP) $(TARGET).sys $(FLOPPY_DIR)/drivers/$(TARGET).sys
|
||||
endif
|
||||
|
||||
dist: ../../../$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
../../../$(DIST_DIR)/drivers/$(TARGET).sys: $(TARGET).sys
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $(TARGET).sys ..\..\..\$(DIST_DIR)\drivers\$(TARGET).sys
|
||||
else
|
||||
$(CP) $(TARGET).sys ../../../$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
endif
|
||||
|
||||
$(TARGET).sys: $(OBJECTS)
|
||||
$(CC) \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp \
|
||||
$(OBJECTS)
|
||||
- $(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $(TARGET).sys \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-Wl,temp.exp \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o $(TARGET).sys \
|
||||
$(OBJECTS)
|
||||
- $(RM) temp.exp
|
||||
|
||||
$(TARGET).sys $(TARGET).sys.unstripped: $(OBJECTS)
|
||||
|
||||
include ../../../rules.mak
|
||||
|
@ -1,6 +1,8 @@
|
||||
# $Id: Makefile,v 1.2 2000/08/11 12:42:19 ekohl Exp $
|
||||
# $Id: Makefile,v 1.3 2000/08/18 22:27:04 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET=floppy
|
||||
|
||||
OBJECTS = $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
@ -1,13 +1,15 @@
|
||||
# $Id: makefile,v 1.14 2000/08/11 12:42:31 ekohl Exp $
|
||||
# $Id: makefile,v 1.15 2000/08/18 22:27:04 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET=ide
|
||||
|
||||
OBJECTS = $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
BASE_CFLAGS = -I. -I../../../include
|
||||
|
||||
all: $(TARGET).nostrip.sys $(TARGET).sys
|
||||
all: $(TARGET).sys.unstripped $(TARGET).sys
|
||||
|
||||
.phony: all
|
||||
|
||||
@ -25,76 +27,14 @@ clean:
|
||||
install: $(FLOPPY_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
$(FLOPPY_DIR)/drivers/$(TARGET).sys: $(TARGET).sys
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $(TARGET).sys $(FLOPPY_DIR)\drivers\$(TARGET).sys
|
||||
else
|
||||
$(CP) $(TARGET).sys $(FLOPPY_DIR)/drivers/$(TARGET).sys
|
||||
endif
|
||||
|
||||
dist: ../../../$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
|
||||
../../../$(DIST_DIR)/drivers/$(TARGET).sys: $(TARGET).sys
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $(TARGET).sys ..\..\..\$(DIST_DIR)\drivers\$(TARGET).sys
|
||||
else
|
||||
$(CP) $(TARGET).sys ../../../$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
endif
|
||||
|
||||
$(TARGET).sys: $(OBJECTS)
|
||||
$(STRIP) --strip-debug $(OBJECTS)
|
||||
$(CC) \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp $(OBJECTS)
|
||||
- $(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $(TARGET).sys \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-Wl,temp.exp \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o $(TARGET).sys \
|
||||
$(OBJECTS)
|
||||
- $(RM) temp.exp
|
||||
|
||||
$(TARGET).nostrip.sys: $(OBJECTS)
|
||||
$(CC) \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp $(OBJECTS)
|
||||
- $(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $(TARGET).sys \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-Wl,temp.exp \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o $(TARGET).nostrip.sys \
|
||||
$(OBJECTS)
|
||||
- $(RM) temp.exp
|
||||
|
||||
$(TARGET).sys $(TARGET).sys.unstripped: $(OBJECTS)
|
||||
|
||||
WITH_DEBUGGING=yes
|
||||
include ../../../rules.mak
|
||||
|
@ -1,13 +1,15 @@
|
||||
# $Id: makefile,v 1.10 2000/08/11 12:42:41 ekohl Exp $
|
||||
# $Id: makefile,v 1.11 2000/08/18 22:27:05 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET=keyboard
|
||||
|
||||
OBJECTS = $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
BASE_CFLAGS = -I. -I../../../include
|
||||
|
||||
all: $(TARGET).sys
|
||||
all: $(TARGET).sys $(TARGET).sys.unstripped
|
||||
|
||||
.phony: all
|
||||
|
||||
@ -39,32 +41,6 @@ else
|
||||
$(CP) $(TARGET).sys ../../../$(DIST_DIR)/drivers/$(TARGET).sys
|
||||
endif
|
||||
|
||||
$(TARGET).sys: $(OBJECTS)
|
||||
$(CC) \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp \
|
||||
$(OBJECTS)
|
||||
- $(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $(TARGET).sys \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-Wl,temp.exp \
|
||||
-specs=../../svc_specs \
|
||||
-mdll \
|
||||
-o $(TARGET).sys \
|
||||
$(OBJECTS)
|
||||
- $(RM) temp.exp
|
||||
$(TARGET).sys $(TARGET).sys.unstripped: $(OBJECTS)
|
||||
|
||||
include ../../../rules.mak
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET=mouse
|
||||
OBJECTS= mouse.o ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
# $Id: makefile,v 1.8 2000/08/11 12:42:58 ekohl Exp $
|
||||
# $Id: makefile,v 1.9 2000/08/18 22:27:06 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGETNAME=null
|
||||
OBJECTS= $(TARGETNAME).o $(TARGETNAME).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
# $Id: makefile,v 1.9 2000/08/11 12:43:09 ekohl Exp $
|
||||
# $Id: makefile,v 1.10 2000/08/18 22:27:06 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET=parallel
|
||||
OBJECTS= $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
OBJECTS= sdisk.o ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
all: sdisk.sys
|
||||
|
@ -1,6 +1,8 @@
|
||||
# $Id: makefile,v 1.9 2000/08/11 12:43:19 ekohl Exp $
|
||||
# $Id: makefile,v 1.10 2000/08/18 22:27:07 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET= serial
|
||||
OBJECTS= $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
OBJECTS= sound.o ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
all: sound.sys
|
||||
|
@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
OBJECTS= test.o ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
all: test.sys
|
||||
|
@ -1,7 +1,8 @@
|
||||
# $Id: makefile,v 1.9 2000/08/11 12:43:43 ekohl Exp $
|
||||
# $Id: makefile,v 1.10 2000/08/18 22:27:08 dwelch Exp $
|
||||
#
|
||||
# Makefile for ReactOS vgaddi.dll
|
||||
#
|
||||
PATH_TO_TOP = ../../../..
|
||||
TARGET=vgaddi
|
||||
|
||||
BASE_CFLAGS = -I../../../../include -I.
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $Id: makefile,v 1.2 2000/08/11 12:43:51 ekohl Exp $
|
||||
# $Id: makefile,v 1.3 2000/08/18 22:27:08 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../../..
|
||||
BASE_CFLAGS = -I../../../../include
|
||||
|
||||
MP_OBJECTS = vgamp.o initvga.o vgavideo.o vgamp.coff ../../../../ntoskrnl/ntoskrnl.a ../../vidport/vidport.a
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $Id: makefile,v 1.8 2000/08/11 12:44:03 ekohl Exp $
|
||||
# $Id: makefile,v 1.9 2000/08/18 22:27:08 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
TARGET=vidport
|
||||
OBJECTS = $(TARGET).o $(TARGET).coff ../../../ntoskrnl/ntoskrnl.a
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $Id: makefile,v 1.20 2000/08/11 12:44:40 ekohl Exp $
|
||||
# $Id: makefile,v 1.21 2000/08/18 22:27:09 dwelch Exp $
|
||||
#
|
||||
#
|
||||
PATH_TO_TOP = ../../..
|
||||
TARGET=vfatfs
|
||||
|
||||
OBJECTS = blockdev.o close.o create.o dir.o dirwr.o iface.o string.o fat.o \
|
||||
|
@ -1,9 +1,11 @@
|
||||
# $Id: makefile,v 1.6 2000/06/24 09:02:02 ea Exp $
|
||||
# $Id: makefile,v 1.7 2000/08/18 22:26:58 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
# Generate files for a kernel module that needs to add a service table.
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
#TARGETNAME = mktab
|
||||
TARGETNAME = genw32k
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
# $Id: makefile,v 1.2 1999/08/29 13:44:52 dwelch Exp $
|
||||
# $Id: makefile,v 1.3 2000/08/18 22:26:58 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
# Generate:
|
||||
# - defedf
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET = defedf
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: makefile,v 1.9 1999/08/29 13:44:52 dwelch Exp $
|
||||
# $Id: makefile,v 1.10 2000/08/18 22:26:58 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
@ -8,6 +8,8 @@
|
||||
# - ntoskrnl.exe Zw functions stubs to call Nt functions from kernel mode;
|
||||
# - ntdll.dll stubs to call system functions from user mode applications.
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET = genntdll
|
||||
SYSTEM_CALLS_DB = sysfuncs.lst
|
||||
NTDLL_STUBS = ../../lib/ntdll/napi.c
|
||||
|
@ -1,21 +1,15 @@
|
||||
# $Id: makefile,v 1.13 2000/08/11 12:31:17 ekohl Exp $
|
||||
# $Id: makefile,v 1.14 2000/08/18 22:26:59 dwelch Exp $
|
||||
#
|
||||
# Makefile for ReactOS advapi32.dll
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
TARGETNAME=advapi32
|
||||
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGETNAME).a
|
||||
else
|
||||
DLLTARGET=$(TARGETNAME).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGETNAME).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGETNAME).dll
|
||||
|
||||
|
||||
|
||||
MISC_OBJECTS = misc/dllmain.o misc/shutdown.o \
|
||||
|
@ -1,17 +1,12 @@
|
||||
# $Id: makefile,v 1.37 2000/08/11 12:31:28 ekohl Exp $
|
||||
# $Id: makefile,v 1.38 2000/08/18 22:26:59 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET=crtdll
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
|
@ -1,17 +1,12 @@
|
||||
# $Id: makefile,v 1.8 2000/08/11 12:31:37 ekohl Exp $
|
||||
# $Id: makefile,v 1.9 2000/08/18 22:26:59 dwelch Exp $
|
||||
#
|
||||
# Makefile for fmifs.dll
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET=fmifs
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
|
@ -1,20 +1,15 @@
|
||||
# $Id: makefile,v 1.14 2000/08/11 12:31:49 ekohl Exp $
|
||||
# $Id: makefile,v 1.15 2000/08/18 22:27:00 dwelch Exp $
|
||||
#
|
||||
# Makefile for ReactOS gdi32.dll
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET=gdi32
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
# $Id: makefile,v 1.38 2000/08/14 14:33:24 ea Exp $
|
||||
# $Id: makefile,v 1.39 2000/08/18 22:27:00 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET=kernel32
|
||||
|
||||
KERNEL32_BASE = 0x77f00000
|
||||
@ -10,16 +12,7 @@ BASE_CFLAGS = -I../../include
|
||||
|
||||
CFLAGS = $(CFLAGS) -DKERNEL32_BASE=$(KERNEL32_BASE)
|
||||
|
||||
include ../../rules.mak
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
@ -161,5 +154,5 @@ else
|
||||
endif
|
||||
|
||||
WITH_DEBUGGING=yes
|
||||
WARNINGS_ARE_ERRORS = yes
|
||||
|
||||
#WARNINGS_ARE_ERRORS = yes
|
||||
include ../../rules.mak
|
||||
|
@ -1,17 +1,11 @@
|
||||
# $Id: Makefile,v 1.2 2000/08/11 12:32:53 ekohl Exp $
|
||||
# $Id: Makefile,v 1.3 2000/08/18 22:27:00 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET_NAME=msvcrt
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
TARGET_DLL=$(TARGET_NAME).a
|
||||
else
|
||||
TARGET_DLL=$(TARGET_NAME).dll
|
||||
endif
|
||||
else
|
||||
TARGET_DLL=$(TARGET_NAME).dll
|
||||
endif
|
||||
TARGET_DLL=$(TARGET_NAME).dll
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
# $Id: makefile,v 1.51 2000/08/11 12:33:18 ekohl Exp $
|
||||
# $Id: makefile,v 1.52 2000/08/18 22:27:01 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET = ntdll
|
||||
|
||||
BASE_CFLAGS = -I../../include -D__NTDLL__
|
||||
|
@ -1,18 +1,13 @@
|
||||
# $Id: makefile,v 1.7 2000/08/11 12:37:11 ekohl Exp $
|
||||
# $Id: makefile,v 1.8 2000/08/18 22:27:01 dwelch Exp $
|
||||
#
|
||||
# ReactOS psxdll.dll makefile
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGETNAME=psxdll
|
||||
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGETNAME).a
|
||||
else
|
||||
DLLTARGET=$(TARGETNAME).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGETNAME).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGETNAME).dll
|
||||
|
||||
|
||||
BASE_CFLAGS =-Iinclude -I../../include -D__PSXDLL__
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
# $Id: Makefile,v 1.2 2000/08/11 12:37:21 ekohl Exp $
|
||||
# $Id: Makefile,v 1.3 2000/08/18 22:27:01 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET = midl rpcrt4 rpcss
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
@ -10,16 +12,8 @@ CFLAGS = $(CFLAGS)
|
||||
|
||||
midl:
|
||||
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
# $Id: Makefile,v 1.1 2000/08/12 19:33:19 dwelch Exp $
|
||||
# $Id: Makefile,v 1.2 2000/08/18 22:27:02 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET = secur32
|
||||
|
||||
SECUR32_BASE = 0x10000000
|
||||
@ -11,15 +13,7 @@ BASE_CFLAGS = -I../../include
|
||||
CFLAGS = $(CFLAGS)
|
||||
|
||||
include ../../rules.mak
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
|
@ -1,24 +1,18 @@
|
||||
# $Id: makefile_rex,v 1.10 2000/08/11 12:37:32 ekohl Exp $
|
||||
# $Id: makefile_rex,v 1.11 2000/08/18 22:27:02 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
# Makefile for user32.dll
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
include ../../rules.mak
|
||||
|
||||
TARGET=user32
|
||||
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
|
@ -1,21 +1,14 @@
|
||||
# $Id: makefile,v 1.3 2000/08/11 12:37:42 ekohl Exp $
|
||||
# $Id: makefile,v 1.4 2000/08/18 22:27:02 dwelch Exp $
|
||||
#
|
||||
# Makefile for ReactOS version.dll
|
||||
#
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET=version
|
||||
|
||||
BASE_CFLAGS = -I../../include
|
||||
|
||||
ifneq ($(HOST),mingw32-windows)
|
||||
ifneq ($(HOST),mingw32-linux)
|
||||
DLLTARGET=$(TARGET).a
|
||||
else
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
else
|
||||
DOSCLI=yes
|
||||
DLLTARGET=$(TARGET).dll
|
||||
endif
|
||||
DLLTARGET=$(TARGET).dll
|
||||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
|
@ -22,8 +22,7 @@ enum
|
||||
MEMORY_AREA_IO_MAPPING,
|
||||
MEMORY_AREA_SYSTEM,
|
||||
MEMORY_AREA_MDL_MAPPING,
|
||||
MEMORY_AREA_COMMIT,
|
||||
MEMORY_AREA_RESERVE,
|
||||
MEMORY_AREA_VIRTUAL_MEMORY,
|
||||
MEMORY_AREA_SECTION_VIEW_RESERVE,
|
||||
MEMORY_AREA_CACHE_SEGMENT,
|
||||
MEMORY_AREA_SHARED_DATA,
|
||||
@ -84,6 +83,10 @@ typedef struct
|
||||
ULONG ViewOffset;
|
||||
LIST_ENTRY ViewListEntry;
|
||||
} SectionData;
|
||||
struct
|
||||
{
|
||||
LIST_ENTRY SegmentListHead;
|
||||
} VirtualMemoryData;
|
||||
} Data;
|
||||
} MEMORY_AREA, *PMEMORY_AREA;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
# $Id: makefile_rex,v 1.83 2000/08/11 12:38:45 ekohl Exp $
|
||||
# $Id: makefile_rex,v 1.84 2000/08/18 22:27:02 dwelch Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
PATH_TO_TOP = ..
|
||||
|
||||
TARGETNAME = ntoskrnl
|
||||
|
||||
OBJECTS_PATH = objects
|
||||
@ -537,22 +539,14 @@ $(CLEAN_FILES:%=%_clean): %_clean:
|
||||
install: $(FLOPPY_DIR)/$(TARGETNAME).exe
|
||||
|
||||
$(FLOPPY_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $(TARGETNAME).exe $(FLOPPY_DIR)\$(TARGETNAME).exe
|
||||
else
|
||||
$(CP) $(TARGETNAME).exe $(FLOPPY_DIR)/$(TARGETNAME).exe
|
||||
endif
|
||||
|
||||
.PHONY: dist
|
||||
|
||||
dist: ../$(DIST_DIR)/$(TARGETNAME).exe
|
||||
|
||||
../$(DIST_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe
|
||||
ifeq ($(DOSCLI),yes)
|
||||
$(CP) $(TARGETNAME).exe ..\$(DIST_DIR)\$(TARGETNAME).exe
|
||||
else
|
||||
$(CP) $(TARGETNAME).exe ../$(DIST_DIR)/$(TARGETNAME).exe
|
||||
endif
|
||||
|
||||
.PHONY: dist
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: mm.c,v 1.35 2000/08/12 19:33:22 dwelch Exp $
|
||||
/* $Id: mm.c,v 1.36 2000/08/18 22:27:03 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@ -191,7 +191,7 @@ NTSTATUS MmNotPresentFault(KPROCESSOR_MODE Mode,
|
||||
(PVOID)Address);
|
||||
break;
|
||||
|
||||
case MEMORY_AREA_COMMIT:
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
Status = MmNotPresentFaultVirtualMemory(AddressSpace,
|
||||
MemoryArea,
|
||||
(PVOID)Address);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: mpw.c,v 1.2 2000/07/07 10:30:56 dwelch Exp $
|
||||
/* $Id: mpw.c,v 1.3 2000/08/18 22:27:03 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@ -57,7 +57,7 @@ ULONG MmWritePage(PMADDRESS_SPACE AddressSpace,
|
||||
Address);
|
||||
return(Status);
|
||||
|
||||
case MEMORY_AREA_COMMIT:
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
Status = MmWritePageVirtualMemory(AddressSpace,
|
||||
MArea,
|
||||
Address);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: virtual.c,v 1.32 2000/07/07 10:30:56 dwelch Exp $
|
||||
/* $Id: virtual.c,v 1.33 2000/08/18 22:27:03 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@ -25,7 +25,63 @@
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
/* TYPES *********************************************************************/
|
||||
|
||||
typedef struct _MM_SEGMENT
|
||||
{
|
||||
ULONG Type;
|
||||
ULONG Protect;
|
||||
ULONG Length;
|
||||
LIST_ENTRY SegmentListEntry;
|
||||
} MM_SEGMENT, *PMM_SEGMENT;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PMM_SEGMENT MmGetSegmentForAddress(PMEMORY_AREA MArea,
|
||||
PVOID Address,
|
||||
PVOID* PCurrentAddress)
|
||||
/*
|
||||
* FUNCTION: Get the segment corresponding to a particular memory area and
|
||||
* address.
|
||||
* ARGUMENTS:
|
||||
* MArea (IN) = The memory area
|
||||
* Address (IN) = The address to get the segment for
|
||||
* PCurrentAddress (OUT) = The start of the segment
|
||||
* RETURNS:
|
||||
* The corresponding memory or NULL if an error occurred
|
||||
*/
|
||||
{
|
||||
PVOID CurrentAddress;
|
||||
PMM_SEGMENT CurrentSegment;
|
||||
PLIST_ENTRY Current;
|
||||
|
||||
if (Address < MArea->BaseAddress ||
|
||||
Address >= (MArea->BaseAddress + MArea->Length))
|
||||
{
|
||||
KeBugCheck(0);
|
||||
*PCurrentAddress = NULL;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
Current = MArea->Data.VirtualMemoryData.SegmentListHead.Flink;
|
||||
CurrentAddress = MArea->BaseAddress;
|
||||
while (Current != &MArea->Data.VirtualMemoryData.SegmentListHead)
|
||||
{
|
||||
CurrentSegment = CONTAINING_RECORD(Current,
|
||||
MM_SEGMENT,
|
||||
SegmentListEntry);
|
||||
if (Address >= CurrentAddress &&
|
||||
Address < (CurrentAddress + CurrentSegment->Length))
|
||||
{
|
||||
*PCurrentAddress = CurrentAddress;
|
||||
return(CurrentSegment);
|
||||
}
|
||||
CurrentAddress = CurrentAddress + CurrentSegment->Length;
|
||||
Current = Current->Flink;
|
||||
}
|
||||
KeBugCheck(0);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
NTSTATUS MmWritePageVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||
PMEMORY_AREA MArea,
|
||||
@ -160,6 +216,18 @@ NTSTATUS MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||
{
|
||||
PVOID Page;
|
||||
NTSTATUS Status;
|
||||
PMM_SEGMENT Segment;
|
||||
PVOID CurrentAddress;
|
||||
|
||||
Segment = MmGetSegmentForAddress(MemoryArea, Address, &CurrentAddress);
|
||||
if (Segment == NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
if (Segment->Type == MEM_RESERVE)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
if (MmIsPagePresent(NULL, Address))
|
||||
{
|
||||
@ -200,10 +268,349 @@ NTSTATUS MmNotPresentFaultVirtualMemory(PMADDRESS_SPACE AddressSpace,
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID MmModifyAttributes(PMADDRESS_SPACE AddressSpace,
|
||||
PVOID BaseAddress,
|
||||
ULONG RegionSize,
|
||||
ULONG OldType,
|
||||
ULONG OldProtect,
|
||||
ULONG NewType,
|
||||
ULONG NewProtect)
|
||||
{
|
||||
if (NewType == MEM_RESERVE &&
|
||||
OldType == MEM_COMMIT)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for (i=0; i<=(RegionSize/PAGESIZE); i++)
|
||||
{
|
||||
LARGE_INTEGER PhysicalAddr;
|
||||
|
||||
PhysicalAddr = MmGetPhysicalAddress(BaseAddress + (i*PAGESIZE));
|
||||
if (PhysicalAddr.u.LowPart != 0)
|
||||
{
|
||||
MmRemovePageFromWorkingSet(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGESIZE));
|
||||
MmDereferencePage((PVOID)(ULONG)(PhysicalAddr.u.LowPart));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NewType == MEM_COMMIT && OldType == MEM_COMMIT &&
|
||||
OldProtect != NewProtect)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for (i=0; i<(RegionSize/PAGESIZE); i++)
|
||||
{
|
||||
if (MmIsPagePresent(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGESIZE)))
|
||||
{
|
||||
MmSetPageProtect(AddressSpace->Process,
|
||||
BaseAddress + (i*PAGESIZE),
|
||||
NewProtect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VOID InsertAfterEntry(PLIST_ENTRY Previous,
|
||||
PLIST_ENTRY Entry)
|
||||
{
|
||||
Previous->Flink->Blink = Entry;
|
||||
|
||||
Entry->Flink = Previous->Flink;
|
||||
Entry->Blink = Previous;
|
||||
|
||||
Previous->Flink = Entry;
|
||||
}
|
||||
|
||||
NTSTATUS MmSplitSegment(PMADDRESS_SPACE AddressSpace,
|
||||
PMEMORY_AREA MemoryArea,
|
||||
PVOID BaseAddress,
|
||||
ULONG RegionSize,
|
||||
ULONG Type,
|
||||
ULONG Protect,
|
||||
PMM_SEGMENT CurrentSegment,
|
||||
PVOID CurrentAddress)
|
||||
/*
|
||||
* FUNCTION: Split a memory segment internally
|
||||
*/
|
||||
{
|
||||
PMM_SEGMENT NewSegment;
|
||||
PMM_SEGMENT NewTopSegment;
|
||||
PMM_SEGMENT PreviousSegment;
|
||||
ULONG OldType;
|
||||
ULONG OldProtect;
|
||||
|
||||
OldType = CurrentSegment->Type;
|
||||
OldProtect = CurrentSegment->Protect;
|
||||
|
||||
NewSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
|
||||
if (NewSegment == NULL)
|
||||
{
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
NewTopSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
|
||||
if (NewTopSegment == NULL)
|
||||
{
|
||||
ExFreePool(NewSegment);
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
if (CurrentSegment->Type == Type &&
|
||||
CurrentSegment->Protect == Protect)
|
||||
{
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
if (CurrentAddress < BaseAddress)
|
||||
{
|
||||
NewSegment->Type = Type;
|
||||
NewSegment->Protect = Protect;
|
||||
NewSegment->Length = RegionSize;
|
||||
|
||||
CurrentSegment->Length = BaseAddress - CurrentAddress;
|
||||
|
||||
InsertAfterEntry(&CurrentSegment->SegmentListEntry,
|
||||
&NewSegment->SegmentListEntry);
|
||||
|
||||
PreviousSegment = NewSegment;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSegment->Type = Type;
|
||||
CurrentSegment->Protect = Protect;
|
||||
|
||||
PreviousSegment = CurrentSegment;
|
||||
|
||||
ExFreePool(NewSegment);
|
||||
NewSegment = NULL;
|
||||
}
|
||||
|
||||
if ((CurrentAddress + CurrentSegment->Length) > (BaseAddress + RegionSize))
|
||||
{
|
||||
NewTopSegment->Type = OldType;
|
||||
NewTopSegment->Protect = OldProtect;
|
||||
NewTopSegment->Length =
|
||||
(CurrentAddress + CurrentSegment->Length) -
|
||||
(BaseAddress + RegionSize);
|
||||
|
||||
InsertAfterEntry(&PreviousSegment->SegmentListEntry,
|
||||
&NewTopSegment->SegmentListEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExFreePool(NewTopSegment);
|
||||
NewTopSegment = NULL;
|
||||
}
|
||||
|
||||
MmModifyAttributes(AddressSpace, BaseAddress, RegionSize,
|
||||
OldType, OldProtect, Type, Protect);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS MmGatherSegment(PMADDRESS_SPACE AddressSpace,
|
||||
PMEMORY_AREA MemoryArea,
|
||||
PVOID BaseAddress,
|
||||
ULONG RegionSize,
|
||||
ULONG Type,
|
||||
ULONG Protect,
|
||||
PMM_SEGMENT CurrentSegment,
|
||||
PVOID CurrentAddress)
|
||||
/*
|
||||
* FUNCTION: Do a virtual memory operation that will effect several
|
||||
* memory segments.
|
||||
* ARGUMENTS:
|
||||
* AddressSpace (IN) = Address space to affect
|
||||
* MemoryArea (IN) = Memory area to affect
|
||||
* BaseAddress (IN) = Base address of the region to affect
|
||||
* RegionSize (IN) = Size of the region to affect
|
||||
* Type (IN) = New type of the region
|
||||
* Protect (IN) = New protection of the region
|
||||
* CurrentSegment (IN) = First segment intersecting with the region
|
||||
* CurrentAddress (IN) = Start address of the first segment
|
||||
* interesting with the region
|
||||
* RETURNS: Status
|
||||
*/
|
||||
{
|
||||
PMM_SEGMENT NewSegment;
|
||||
PMM_SEGMENT NewTopSegment;
|
||||
PMM_SEGMENT PreviousSegment;
|
||||
PVOID LAddress;
|
||||
ULONG RSize;
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PLIST_ENTRY ListHead;
|
||||
|
||||
/*
|
||||
* We will need a maximum of two new segments. Allocate them now
|
||||
* because if we fail latter we may not be able to reverse the
|
||||
* what we've already done
|
||||
*/
|
||||
NewSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
|
||||
if (NewSegment == NULL)
|
||||
{
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
NewTopSegment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
|
||||
if (NewTopSegment == NULL)
|
||||
{
|
||||
ExFreePool(NewSegment);
|
||||
return(STATUS_NO_MEMORY);
|
||||
}
|
||||
|
||||
if (CurrentAddress < BaseAddress)
|
||||
{
|
||||
/*
|
||||
* If a portion of the first segment is not covered by the region then
|
||||
* we need to split it into two segments
|
||||
*/
|
||||
|
||||
NewSegment->Type = Type;
|
||||
NewSegment->Protect = Protect;
|
||||
NewSegment->Length = RegionSize;
|
||||
|
||||
CurrentSegment->Length =
|
||||
BaseAddress - CurrentAddress;
|
||||
|
||||
InsertAfterEntry(&CurrentSegment->SegmentListEntry,
|
||||
&NewSegment->SegmentListEntry);
|
||||
|
||||
PreviousSegment = NewSegment;
|
||||
|
||||
MmModifyAttributes(AddressSpace, BaseAddress, NewSegment->Length,
|
||||
CurrentSegment->Type,
|
||||
CurrentSegment->Protect, Type, Protect);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Otherwise just change the attributes of the segment
|
||||
*/
|
||||
|
||||
ULONG OldType;
|
||||
ULONG OldProtect;
|
||||
|
||||
OldType = CurrentSegment->Type;
|
||||
OldProtect = CurrentSegment->Protect;
|
||||
|
||||
CurrentSegment->Type = Type;
|
||||
CurrentSegment->Protect = Protect;
|
||||
|
||||
PreviousSegment = CurrentSegment;
|
||||
|
||||
ExFreePool(NewSegment);
|
||||
NewSegment = NULL;
|
||||
|
||||
MmModifyAttributes(AddressSpace, BaseAddress, CurrentSegment->Length,
|
||||
OldType, OldProtect, Type, Protect);
|
||||
}
|
||||
|
||||
LAddress = BaseAddress + PreviousSegment->Length;
|
||||
RSize = RegionSize - PreviousSegment->Length;
|
||||
CurrentEntry = PreviousSegment->SegmentListEntry.Flink;
|
||||
ListHead = &MemoryArea->Data.VirtualMemoryData.SegmentListHead;
|
||||
|
||||
while (CurrentEntry != ListHead && RSize > 0)
|
||||
{
|
||||
ULONG OldType;
|
||||
ULONG OldProtect;
|
||||
|
||||
CurrentSegment = CONTAINING_RECORD(CurrentEntry,
|
||||
MM_SEGMENT,
|
||||
SegmentListEntry);
|
||||
|
||||
if (CurrentSegment->Length > RSize)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
OldType = CurrentSegment->Type;
|
||||
OldProtect = CurrentSegment->Protect;
|
||||
CurrentSegment->Type = Type;
|
||||
CurrentSegment->Protect = Protect;
|
||||
|
||||
MmModifyAttributes(AddressSpace, LAddress, CurrentSegment->Length,
|
||||
OldType, OldProtect, Type, Protect);
|
||||
|
||||
RSize = RSize - CurrentSegment->Length;
|
||||
LAddress = LAddress + CurrentSegment->Length;
|
||||
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
|
||||
if (CurrentEntry == ListHead && RSize > 0)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
||||
if (RSize > 0)
|
||||
{
|
||||
NewTopSegment->Type = CurrentSegment->Type;
|
||||
NewTopSegment->Protect = CurrentSegment->Protect;
|
||||
NewTopSegment->Length = CurrentSegment->Length - RSize;
|
||||
|
||||
CurrentSegment->Length = RSize;
|
||||
CurrentSegment->Type = Type;
|
||||
CurrentSegment->Protect = Protect;
|
||||
|
||||
InsertAfterEntry(&CurrentSegment->SegmentListEntry,
|
||||
&NewTopSegment->SegmentListEntry);
|
||||
|
||||
MmModifyAttributes(AddressSpace, LAddress, RSize,
|
||||
NewTopSegment->Type,
|
||||
NewTopSegment->Protect, Type, Protect);
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS MmComplexVirtualMemoryOperation(PMADDRESS_SPACE AddressSpace,
|
||||
PMEMORY_AREA MemoryArea,
|
||||
PVOID BaseAddress,
|
||||
ULONG RegionSize,
|
||||
ULONG Type,
|
||||
ULONG Protect)
|
||||
{
|
||||
PMM_SEGMENT CurrentSegment;
|
||||
PVOID CurrentAddress;
|
||||
|
||||
CurrentSegment = MmGetSegmentForAddress(MemoryArea,
|
||||
BaseAddress,
|
||||
&CurrentAddress);
|
||||
if (CurrentSegment == NULL)
|
||||
{
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
||||
if (BaseAddress >= CurrentAddress &&
|
||||
(BaseAddress + RegionSize) <= (CurrentAddress + CurrentSegment->Length))
|
||||
{
|
||||
return((MmSplitSegment(AddressSpace,
|
||||
MemoryArea,
|
||||
BaseAddress,
|
||||
RegionSize,
|
||||
Type,
|
||||
Protect,
|
||||
CurrentSegment,
|
||||
CurrentAddress)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return((MmGatherSegment(AddressSpace,
|
||||
MemoryArea,
|
||||
BaseAddress,
|
||||
RegionSize,
|
||||
Type,
|
||||
Protect,
|
||||
CurrentSegment,
|
||||
CurrentAddress)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||
IN OUT PVOID * BaseAddress,
|
||||
IN OUT PVOID* PBaseAddress,
|
||||
IN ULONG ZeroBits,
|
||||
IN OUT PULONG RegionSize,
|
||||
IN OUT PULONG PRegionSize,
|
||||
IN ULONG AllocationType,
|
||||
IN ULONG Protect)
|
||||
/*
|
||||
@ -240,19 +647,26 @@ NTSTATUS STDCALL NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||
ULONG Type;
|
||||
NTSTATUS Status;
|
||||
PMADDRESS_SPACE AddressSpace;
|
||||
PMM_SEGMENT Segment;
|
||||
PVOID BaseAddress;
|
||||
ULONG RegionSize;
|
||||
|
||||
DPRINT("NtAllocateVirtualMemory(ProcessHandle %x, *BaseAddress %x, "
|
||||
"ZeroBits %d, *RegionSize %x, AllocationType %x, Protect %x)\n",
|
||||
ProcessHandle,*BaseAddress,ZeroBits,*RegionSize,AllocationType,
|
||||
Protect);
|
||||
|
||||
BaseAddress = (PVOID)PAGE_ROUND_DOWN((*PBaseAddress));
|
||||
RegionSize = PAGE_ROUND_UP((*PBaseAddress) + (*PRegionSize)) -
|
||||
PAGE_ROUND_DOWN((*PBaseAddress));
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
PROCESS_VM_OPERATION,
|
||||
NULL,
|
||||
UserMode,
|
||||
(PVOID*)(&Process),
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtAllocateVirtualMemory() = %x\n",Status);
|
||||
return(Status);
|
||||
@ -260,58 +674,61 @@ NTSTATUS STDCALL NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||
|
||||
if (AllocationType & MEM_RESERVE)
|
||||
{
|
||||
Type = MEMORY_AREA_RESERVE;
|
||||
Type = MEM_RESERVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = MEMORY_AREA_COMMIT;
|
||||
Type = MEM_COMMIT;
|
||||
}
|
||||
|
||||
AddressSpace = &Process->AddressSpace;
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
|
||||
if ((*BaseAddress) != 0)
|
||||
if (BaseAddress != 0)
|
||||
{
|
||||
MemoryArea = MmOpenMemoryAreaByAddress(&Process->AddressSpace,
|
||||
*BaseAddress);
|
||||
BaseAddress);
|
||||
|
||||
if (MemoryArea != NULL)
|
||||
if (MemoryArea != NULL &&
|
||||
MemoryArea->Type == MEMORY_AREA_VIRTUAL_MEMORY &&
|
||||
MemoryArea->Length >= RegionSize)
|
||||
{
|
||||
if (MemoryArea->BaseAddress == (*BaseAddress) &&
|
||||
MemoryArea->Length == *RegionSize)
|
||||
{
|
||||
MemoryArea->Type = Type;
|
||||
MemoryArea->Attributes = Protect;
|
||||
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
MemoryArea = MmSplitMemoryArea(Process,
|
||||
&Process->AddressSpace,
|
||||
MemoryArea,
|
||||
*BaseAddress,
|
||||
*RegionSize,
|
||||
Type,
|
||||
Protect);
|
||||
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
||||
Status = MmComplexVirtualMemoryOperation(AddressSpace,
|
||||
MemoryArea,
|
||||
BaseAddress,
|
||||
RegionSize,
|
||||
Type,
|
||||
Protect);
|
||||
/* FIXME: Reserve/dereserve swap pages */
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_SUCCESS);
|
||||
return(Status);
|
||||
}
|
||||
else if (MemoryArea != NULL)
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
}
|
||||
|
||||
Segment = ExAllocatePool(NonPagedPool, sizeof(MM_SEGMENT));
|
||||
if (Segment == NULL)
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
Status = MmCreateMemoryArea(Process,
|
||||
&Process->AddressSpace,
|
||||
Type,
|
||||
BaseAddress,
|
||||
*RegionSize,
|
||||
MEMORY_AREA_VIRTUAL_MEMORY,
|
||||
&BaseAddress,
|
||||
RegionSize,
|
||||
Protect,
|
||||
&MemoryArea);
|
||||
|
||||
if (Status != STATUS_SUCCESS)
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtAllocateVirtualMemory() = %x\n",Status);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
@ -319,13 +736,25 @@ NTSTATUS STDCALL NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||
return(Status);
|
||||
}
|
||||
|
||||
InitializeListHead(&MemoryArea->Data.VirtualMemoryData.SegmentListHead);
|
||||
|
||||
Segment->Type = Type;
|
||||
Segment->Protect = Protect;
|
||||
Segment->Length = RegionSize;
|
||||
InsertTailList(&MemoryArea->Data.VirtualMemoryData.SegmentListHead,
|
||||
&Segment->SegmentListEntry);
|
||||
|
||||
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
||||
if ((AllocationType & MEM_COMMIT) &&
|
||||
((Protect & PAGE_READWRITE) ||
|
||||
(Protect & PAGE_EXECUTE_READWRITE)))
|
||||
{
|
||||
MmReserveSwapPages(PAGE_ROUND_UP((*RegionSize)));
|
||||
MmReserveSwapPages(RegionSize);
|
||||
}
|
||||
|
||||
*PBaseAddress = BaseAddress;
|
||||
*PRegionSize = RegionSize;
|
||||
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_SUCCESS);
|
||||
@ -352,8 +781,8 @@ NTSTATUS STDCALL NtFlushVirtualMemory(IN HANDLE ProcessHandle,
|
||||
|
||||
|
||||
NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
IN PVOID * BaseAddress,
|
||||
IN PULONG RegionSize,
|
||||
IN PVOID* PBaseAddress,
|
||||
IN PULONG PRegionSize,
|
||||
IN ULONG FreeType)
|
||||
/*
|
||||
* FUNCTION: Frees a range of virtual memory
|
||||
@ -373,11 +802,16 @@ NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
PEPROCESS Process;
|
||||
PMADDRESS_SPACE AddressSpace;
|
||||
ULONG i;
|
||||
PVOID BaseAddress;
|
||||
ULONG RegionSize;
|
||||
|
||||
DPRINT("NtFreeVirtualMemory(ProcessHandle %x, *BaseAddress %x, "
|
||||
"*RegionSize %x, FreeType %x)\n",ProcessHandle,*BaseAddress,
|
||||
*RegionSize,FreeType);
|
||||
|
||||
BaseAddress = (PVOID)PAGE_ROUND_DOWN((*PBaseAddress));
|
||||
RegionSize = PAGE_ROUND_UP((*PBaseAddress) + (*PRegionSize)) -
|
||||
PAGE_ROUND_DOWN((*PBaseAddress));
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
PROCESS_VM_OPERATION,
|
||||
@ -385,7 +819,7 @@ NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
UserMode,
|
||||
(PVOID*)(&Process),
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
@ -394,7 +828,7 @@ NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
|
||||
MmLockAddressSpace(AddressSpace);
|
||||
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
||||
*BaseAddress);
|
||||
BaseAddress);
|
||||
if (MemoryArea == NULL)
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
@ -405,18 +839,20 @@ NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
switch (FreeType)
|
||||
{
|
||||
case MEM_RELEASE:
|
||||
if (MemoryArea->BaseAddress != (*BaseAddress))
|
||||
if (MemoryArea->BaseAddress != BaseAddress)
|
||||
{
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
#if 0
|
||||
if ((MemoryArea->Type == MEMORY_AREA_COMMIT) &&
|
||||
((MemoryArea->Attributes & PAGE_READWRITE) ||
|
||||
(MemoryArea->Attributes & PAGE_EXECUTE_READWRITE)))
|
||||
{
|
||||
MmDereserveSwapPages(PAGE_ROUND_UP(MemoryArea->Length));
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i=0; i<=(MemoryArea->Length/PAGESIZE); i++)
|
||||
{
|
||||
@ -442,22 +878,15 @@ NTSTATUS STDCALL NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
case MEM_DECOMMIT:
|
||||
if ((MemoryArea->Type == MEMORY_AREA_COMMIT) &&
|
||||
((MemoryArea->Attributes & PAGE_READWRITE) ||
|
||||
(MemoryArea->Attributes & PAGE_EXECUTE_READWRITE)))
|
||||
{
|
||||
MmDereserveSwapPages(PAGE_ROUND_UP((*RegionSize)));
|
||||
}
|
||||
MmSplitMemoryArea(Process,
|
||||
&Process->AddressSpace,
|
||||
MemoryArea,
|
||||
*BaseAddress,
|
||||
*RegionSize,
|
||||
MEMORY_AREA_RESERVE,
|
||||
MemoryArea->Attributes);
|
||||
Status = MmComplexVirtualMemoryOperation(AddressSpace,
|
||||
MemoryArea,
|
||||
BaseAddress,
|
||||
RegionSize,
|
||||
MEM_RESERVE,
|
||||
PAGE_NOACCESS);
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
return(STATUS_SUCCESS);
|
||||
return(Status);
|
||||
}
|
||||
MmUnlockAddressSpace(AddressSpace);
|
||||
ObDereferenceObject(Process);
|
||||
@ -619,7 +1048,8 @@ NTSTATUS STDCALL NtQueryVirtualMemory (IN HANDLE ProcessHandle,
|
||||
return (STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
if (MemoryArea->Type == MEMORY_AREA_COMMIT)
|
||||
#if 0
|
||||
if (MemoryArea->Type == MEMORY_AREA_VIRTUAL_MEMORY)
|
||||
{
|
||||
Info->State = MEM_COMMIT;
|
||||
}
|
||||
@ -627,7 +1057,8 @@ NTSTATUS STDCALL NtQueryVirtualMemory (IN HANDLE ProcessHandle,
|
||||
{
|
||||
Info->State = MEM_RESERVE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Info->BaseAddress = MemoryArea->BaseAddress;
|
||||
Info->RegionSize = MemoryArea->Length;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: wset.c,v 1.4 2000/07/08 16:53:33 dwelch Exp $
|
||||
/* $Id: wset.c,v 1.5 2000/08/18 22:27:03 dwelch Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@ -70,7 +70,7 @@ ULONG MmPageOutPage(PMADDRESS_SPACE AddressSpace,
|
||||
Ul);
|
||||
return(Count);
|
||||
|
||||
case MEMORY_AREA_COMMIT:
|
||||
case MEMORY_AREA_VIRTUAL_MEMORY:
|
||||
Count = MmPageOutVirtualMemory(AddressSpace,
|
||||
MArea,
|
||||
Address,
|
||||
|
87
reactos/rcopy.c
Normal file
87
reactos/rcopy.c
Normal file
@ -0,0 +1,87 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char* convert_path(char* origpath)
|
||||
{
|
||||
char* newpath;
|
||||
int i;
|
||||
|
||||
newpath = strdup(origpath);
|
||||
|
||||
i = 0;
|
||||
while (newpath[i] != 0)
|
||||
{
|
||||
#ifdef UNIX_PATHS
|
||||
if (newpath[i] == '\\')
|
||||
{
|
||||
newpath[i] = '/';
|
||||
}
|
||||
#else
|
||||
#ifdef DOS_PATHS
|
||||
if (newpath[i] == '/');
|
||||
{
|
||||
newpath[i] = '\\';
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
i++;
|
||||
}
|
||||
return(newpath);
|
||||
}
|
||||
|
||||
#define TRANSFER_SIZE (65536)
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char* path1;
|
||||
char* path2;
|
||||
FILE* in;
|
||||
FILE* out;
|
||||
char* buf;
|
||||
int n_in;
|
||||
int n_out;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
fprintf(stderr, "Too many arguments\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
path1 = convert_path(argv[1]);
|
||||
path2 = convert_path(argv[2]);
|
||||
|
||||
in = fopen(path1, "rb");
|
||||
if (in == NULL)
|
||||
{
|
||||
perror("Cannot open input file");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
out = fopen(path2, "wb");
|
||||
if (out == NULL)
|
||||
{
|
||||
perror("Cannot open output file");
|
||||
fclose(in);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
buf = malloc(TRANSFER_SIZE);
|
||||
|
||||
while (!feof(in))
|
||||
{
|
||||
n_in = fread(buf, 1, TRANSFER_SIZE, in);
|
||||
n_out = fwrite(buf, 1, n_in, out);
|
||||
if (n_in != n_out)
|
||||
{
|
||||
perror("Failed to write to output file\n");
|
||||
free(buf);
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
@ -15,7 +15,8 @@ NASM_FORMAT = win32
|
||||
PREFIX = i586-mingw32-
|
||||
EXE_POSTFIX =
|
||||
EXE_PREFIX = ./
|
||||
CP = cp
|
||||
#CP = cp
|
||||
CP = $(PATH_TO_TOP)/rcopy
|
||||
DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
|
||||
NASM_CMD = nasm
|
||||
KM_SPECS = $(TOPDIR)/specs
|
||||
@ -28,7 +29,8 @@ ifeq ($(HOST),mingw32-windows)
|
||||
NASM_FORMAT = win32
|
||||
PREFIX =
|
||||
EXE_POSTFIX = .exe
|
||||
CP = copy /B
|
||||
#CP = copy /B
|
||||
CP = rcopy
|
||||
DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
|
||||
NASM_CMD = nasm
|
||||
RM = del
|
||||
@ -95,5 +97,57 @@ RCINC = --include-dir ../include --include-dir ../../include --include-dir ../..
|
||||
%.coff: %.rc
|
||||
$(RC) $(RCINC) $< $@
|
||||
|
||||
%.sys: %.o
|
||||
$(CC) \
|
||||
-specs=$(PATH_TO_TOP)/services/svc_specs \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp $^
|
||||
- $(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $@ \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-Wl,temp.exp \
|
||||
-specs=$(PATH_TO_TOP)/services/svc_specs \
|
||||
-mdll \
|
||||
-o $@.unstripped \
|
||||
$^
|
||||
- $(RM) temp.exp
|
||||
$(STRIP) --strip-debug $<
|
||||
$(CC) \
|
||||
-specs=$(PATH_TO_TOP)/services/svc_specs \
|
||||
-mdll \
|
||||
-o junk.tmp \
|
||||
-Wl,--defsym,_end=end \
|
||||
-Wl,--defsym,_edata=__data_end__ \
|
||||
-Wl,--defsym,_etext=etext \
|
||||
-Wl,--base-file,base.tmp $^
|
||||
- $(RM) junk.tmp
|
||||
$(DLLTOOL) \
|
||||
--dllname $@ \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
--verbose \
|
||||
-Wl,--image-base,0x10000 \
|
||||
-Wl,-e,_DriverEntry@8 \
|
||||
-Wl,temp.exp \
|
||||
-specs=$(PATH_TO_TOP)/services/svc_specs \
|
||||
-mdll \
|
||||
-o $@ \
|
||||
$^
|
||||
- $(RM) temp.exp
|
||||
|
||||
RULES_MAK_INCLUDED = 1
|
||||
|
Loading…
Reference in New Issue
Block a user