Compare commits

...

24 Commits

Author SHA1 Message Date
David Welch
72d86ddffb Added this to compile kernel32 as a dll
svn path=/branches/mingw32/; revision=337
1999-03-24 10:18:49 +00:00
David Welch
f0c44628b3 Removed redundant file
svn path=/branches/mingw32/; revision=336
1999-03-24 10:17:42 +00:00
David Welch
6f09ababf5 Deleted redundant driver
svn path=/branches/mingw32/; revision=335
1999-03-24 10:15:36 +00:00
David Welch
d6a08a5446 Made kernel32 compile as a dll
svn path=/branches/mingw32/; revision=334
1999-03-24 10:13:27 +00:00
David Welch
29179770fc This shouldn't be in the repository
svn path=/branches/mingw32/; revision=320
1999-03-17 12:49:06 +00:00
David Welch
a70e3087f3 Fixed remaining bugs in PE loader for user programs
svn path=/branches/mingw32/; revision=318
1999-03-17 12:46:49 +00:00
David Welch
92f71b7235 Updated header file usage
svn path=/branches/mingw32/; revision=316
1999-03-15 16:29:46 +00:00
David Welch
a4b4ff1ffb Corrected header file usage and file names
svn path=/branches/mingw32/; revision=315
1999-03-15 16:27:49 +00:00
David Welch
ad2ffa4236 Updated header file usage and corrected bugs in loader
svn path=/branches/mingw32/; revision=313
1999-03-15 16:25:59 +00:00
David Welch
e2e21b38cf Changed base address of ntdll.dll and changed Makefile name
svn path=/branches/mingw32/; revision=312
1999-03-15 16:24:15 +00:00
David Welch
78f48c804f Moved headers file into dll specific directory
svn path=/branches/mingw32/; revision=310
1999-03-15 16:22:57 +00:00
David Welch
f3d61a9d91 Moved include files to dll specific directory
svn path=/branches/mingw32/; revision=309
1999-03-15 16:19:26 +00:00
David Welch
79f21187a9 Moved include files to dll specific directory
svn path=/branches/mingw32/; revision=308
1999-03-15 16:18:41 +00:00
Rex Jolliff
5b2e338ce6 changed the name for consistancy
svn path=/branches/mingw32/; revision=303
1999-03-12 22:35:39 +00:00
Rex Jolliff
9feaf7da61 Changed to copy PE files
svn path=/branches/mingw32/; revision=302
1999-03-12 22:33:28 +00:00
Rex Jolliff
2b40da68c8 we can boot now!
svn path=/branches/mingw32/; revision=289
1999-03-10 08:16:51 +00:00
The ReactOS Team
a1719f3e2b This commit was manufactured by cvs2svn to create branch 'mingw32'.
svn path=/branches/mingw32/; revision=288
1999-03-10 07:18:38 +00:00
Rex Jolliff
f775cf142c more changes to compile under mingw32
svn path=/branches/mingw32/; revision=287
1999-03-10 07:18:38 +00:00
Rex Jolliff
52ef8d2d16 added config to generate NTDLL.DLL under mingw32
svn path=/branches/mingw32/; revision=279
1999-03-06 21:44:41 +00:00
Rex Jolliff
87709c4ca5 Changed function for use as initial process loader
svn path=/branches/mingw32/; revision=277
1999-03-03 02:56:25 +00:00
Rex Jolliff
041895f643 Added code for image startup
svn path=/branches/mingw32/; revision=276
1999-03-03 01:30:40 +00:00
Rex Jolliff
c791abd0c0 Added rules to compile using MingW32 under windows
svn path=/branches/mingw32/; revision=274
1999-02-27 00:30:19 +00:00
Rex Jolliff
57c894ef14 Changes to support compilation under mingw32
svn path=/branches/mingw32/; revision=273
1999-02-26 19:03:22 +00:00
The ReactOS Team
f81c666055 This commit was manufactured by cvs2svn to create branch 'mingw32'.
svn path=/branches/mingw32/; revision=272
1999-02-26 19:03:22 +00:00
453 changed files with 10175 additions and 13327 deletions

View File

@@ -1,4 +1,4 @@
0.0.14 (so far):
0.0.14 (so far):
0.0.13: Mostly bugfixes (I think)

View File

@@ -10,8 +10,6 @@ int mainCRTStartup(PWSTR args)
{
int nRet;
KERNEL32_Init(args);
// SetUnhandledExceptionFilter(NULL);
// _fpreset();

View File

@@ -0,0 +1,35 @@
#include <internal/mmhal.h>
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
HANDLE OutputHandle;
HANDLE InputHandle;
void debug_printf(char* fmt, ...)
{
va_list args;
char buffer[255];
va_start(args,fmt);
vsprintf(buffer,fmt,args);
WriteConsoleA(OutputHandle, buffer, strlen(buffer), NULL, NULL);
va_end(args);
}
void main(int argc, char* argv[])
{
int i;
AllocConsole();
InputHandle = GetStdHandle(STD_INPUT_HANDLE);
OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE);
for (i=0; i<argc; i++)
{
debug_printf("Args: '%s'\n",argv[i]);
}
}

View File

@@ -0,0 +1,10 @@
all: args.exe
OBJECTS= ../common/crt0.o args.o
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
args.exe: $(OBJECTS) $(LIBS)
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o args.exe
$(NM) --numeric-sort args.exe > args.sym
include ../../rules.mak

View File

@@ -1,10 +1,7 @@
#include <ddk/ntddk.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
void main()
int main(int argc, char* argv[])
{
NtDisplayString("Hello world\n");
ExitProcess(0);
printf("Hello world\n");
return(0);
}

View File

@@ -1,9 +1,8 @@
all: hello.bin
all: hello.exe
OBJECTS = ../common/crt0.o hello.o
OBJECTS = hello.o
hello.bin: $(OBJECTS)
$(LD) -Ttext 0x10000 $(OBJECTS) ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a -o hello.exe
$(OBJCOPY) -O binary hello.exe hello.bin
hello.exe: $(OBJECTS) $(LIBS)
$(CC) $(OBJECTS) -o hello.exe
include ../../rules.mak

View File

@@ -1,11 +1,10 @@
all: shell.bin
all: shell.exe
OBJECTS= ../common/crt0.o shell.o
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a ../../ntoskrnl/libgcc.a
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
shell.bin: $(OBJECTS) $(LIBS)
$(LD) -Ttext 0x10000 $(OBJECTS) $(LIBS) -o shell.exe
shell.exe: $(OBJECTS) $(LIBS)
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o shell.exe
$(NM) --numeric-sort shell.exe > shell.sym
$(OBJCOPY) -O binary shell.exe shell.bin
include ../../rules.mak

View File

@@ -46,10 +46,10 @@ void ExecuteDir(char* cmdline)
debug_printf("<REP> "),nRep++;
else
debug_printf(" %10d ",FindData.nFileSizeLow),nFile++;
RtlTimeToTimeFields(&FindData.ftLastWriteTime ,&fTime);
debug_printf("%02d/%02d/%04d %02d:%02d:%02d "
,fTime.Month,fTime.Day,fTime.Year
,fTime.Hour,fTime.Minute,fTime.Second);
// RtlTimeToTimeFields(&FindData.ftLastWriteTime ,&fTime);
// debug_printf("%02d/%02d/%04d %02d:%02d:%02d "
// ,fTime.Month,fTime.Day,fTime.Year
// ,fTime.Hour,fTime.Minute,fTime.Second);
debug_printf("%s\n",FindData.cFileName);
} while(FindNextFile(shandle,&FindData));
debug_printf("\n %d files\n %d directories\n\n",nFile,nRep);
@@ -159,6 +159,11 @@ void ExecuteCommand(char* line)
ExecuteType(tail);
return;
}
if (strcmp(cmd,"exit")==0)
{
ExitProcess(0);
return;
}
if (ExecuteProcess(cmd,tail))
{
return;

View File

@@ -1 +1 @@
loaders\dos\loadros ntoskrnl\kimage.bin services\dd\ide\ide.o services\fs\vfat\vfatfsd.o services\dd\keyboard\keyboard.o ext2fs.sys
loadros kimage.bin ide.o vfatfsd.o keyboard.o

View File

@@ -3,9 +3,11 @@
:
: copy files to HD...
:
COPY /Y SHELL.BIN C:\reactos\system\SHELL.bin
COPY /Y BLUES.o C:\reactos\system\drivers\BLUES.o
COPY /Y KEYBOARD.o C:\reactos\system\drivers\KEYBOARD.o
COPY /Y BLUE.SYS C:\reactos\system\drivers\blue.SYS
COPY /Y KEYBOARD.SYS C:\reactos\system\drivers\KEYBOARD.SYS
COPY /Y NTDLL.DLL C:\reactos\system\NTDLL.DLL
: COPY /Y CRTDLL.DLL C:\reactos\system\CRTDLL.DLL
COPY /Y SHELL.EXE C:\reactos\system\SHELL.EXE
:
: present a menu to the booter...
@@ -13,23 +15,23 @@ COPY /Y KEYBOARD.o C:\reactos\system\drivers\KEYBOARD.o
ECHO 1) Keyboard,IDE,VFatFSD
ECHO 2) IDE,VFatFSD
ECHO 3) No Drivers
CHOICE /C:123 /T:2,10 "Select kernel boot config"
CHOICE /C:123 /T:2,3 "Select kernel boot config"
IF ERRORLEVEL 3 GOTO :L3
IF ERRORLEVEL 2 GOTO :L2
:L1
CLS
LOADROS KIMAGE.BIN KEYBOARD.O IDE.O VFATFSD.O
LOADROS NTOSKRNL.EXE KEYBOARD.O IDE.SYS VFATFSD.SYS
GOTO :END
:L2
CLS
LOADROS KIMAGE.BIN IDE.O VFATFSD.O
LOADROS NTOSKRNL.EXE IDE.SYS VFATFSD.SYS
GOTO :END
:L3
CLS
LOADROS KIMAGE.BIN
LOADROS NTOSKRNL.EXE
GOTO :END
:END

View File

@@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -1,290 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/dd/beep/beep.c
* PURPOSE: BEEP device driver
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
* UPDATE HISTORY:
* Created 30/01/99
*/
/* INCLUDES ****************************************************************/
#include <ddk/ntddk.h>
#include <ddk/ntddbeep.h>
#define NDEBUG
#include <internal/debug.h>
/* TYEPEDEFS ***************************************************************/
typedef struct _BEEP_DEVICE_EXTENSION
{
KDPC Dpc;
KTIMER Timer;
KEVENT Event;
DWORD BeepOn;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
/* FUNCTIONS ***************************************************************/
VOID BeepDPC(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
{
PDEVICE_EXTENSION pDeviceExtension = DeferredContext;
DPRINT("BeepDPC() called!\n");
HalMakeBeep (0);
InterlockedExchange (&(pDeviceExtension->BeepOn), 0);
KeSetEvent (&(pDeviceExtension->Event), 0, TRUE);
DPRINT("BeepDPC() finished!\n");
}
NTSTATUS BeepCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
if (Stack->MajorFunction == IRP_MJ_CREATE)
{
DPRINT ("BeepCreate() called!\n");
Irp->IoStatus.Information = 0;
status = STATUS_SUCCESS;
}
else
status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
return(status);
}
NTSTATUS BeepClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
switch (Stack->MajorFunction)
{
case IRP_MJ_CLOSE:
DPRINT ("BeepClose() called!\n");
Irp->IoStatus.Information = 0;
status = STATUS_SUCCESS;
break;
default:
status = STATUS_NOT_IMPLEMENTED;
}
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
return(status);
}
NTSTATUS BeepCleanup(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
if (Stack->MajorFunction == IRP_MJ_CLEANUP)
{
DPRINT ("BeepCleanup() called!\n");
Irp->IoStatus.Information = 0;
status = STATUS_SUCCESS;
}
else
status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
return(status);
}
NTSTATUS BeepDeviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* FUNCTION: Handles user mode requests
* ARGUMENTS:
* DeviceObject = Device for request
* Irp = I/O request packet describing request
* RETURNS: Success or failure
*/
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
PDEVICE_EXTENSION pDeviceExtension;
PBEEP_SET_PARAMETERS pbsp;
NTSTATUS status;
pDeviceExtension = DeviceObject->DeviceExtension;
if (Stack->MajorFunction == IRP_MJ_DEVICE_CONTROL)
{
DPRINT("BeepDeviceControl() called!\n");
if (Stack->Parameters.DeviceIoControl.IoControlCode == IOCTL_BEEP_SET)
{
Irp->IoStatus.Information = 0;
if (Stack->Parameters.DeviceIoControl.InputBufferLength == sizeof(BEEP_SET_PARAMETERS))
{
pbsp = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer;
if (pbsp->Frequency >= BEEP_FREQUENCY_MINIMUM &&
pbsp->Frequency <= BEEP_FREQUENCY_MAXIMUM)
{
LARGE_INTEGER DueTime = 0;
/* do the beep!! */
DPRINT("Beep:\n Freq: %lu Hz\n Dur: %lu ms\n",
pbsp->Frequency, pbsp->Duration);
if (pbsp->Duration >= 0)
{
DueTime = (LARGE_INTEGER)pbsp->Duration * 10000;
KeSetTimer (&pDeviceExtension->Timer,
-DueTime,
&pDeviceExtension->Dpc);
HalMakeBeep (pbsp->Frequency);
InterlockedExchange(&(pDeviceExtension->BeepOn), TRUE);
KeWaitForSingleObject (&(pDeviceExtension->Event),
Executive,
KernelMode,
FALSE,
NULL);
}
else if (pbsp->Duration == (DWORD)-1)
{
if (pDeviceExtension->BeepOn)
{
HalMakeBeep(0);
InterlockedExchange(&(pDeviceExtension->BeepOn), FALSE);
}
else
{
HalMakeBeep(pbsp->Frequency);
InterlockedExchange(&(pDeviceExtension->BeepOn), TRUE);
}
}
DPRINT("Did the beep!\n");
status = STATUS_SUCCESS;
}
else
{
status = STATUS_INVALID_PARAMETER;
}
}
else
{
status = STATUS_INVALID_PARAMETER;
}
}
else
{
status = STATUS_NOT_IMPLEMENTED;
}
}
else
status = STATUS_NOT_IMPLEMENTED;
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
return(status);
}
NTSTATUS BeepUnload(PDRIVER_OBJECT DriverObject)
{
DPRINT("BeepUnload() called!\n");
return(STATUS_SUCCESS);
}
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
PDEVICE_OBJECT pDeviceObject;
PDEVICE_EXTENSION pDeviceExtension;
NTSTATUS ret;
ANSI_STRING ansi_device_name;
UNICODE_STRING device_name;
ANSI_STRING asymlink_name;
UNICODE_STRING symlink_name;
DbgPrint("Beep Device Driver 0.0.1\n");
RtlInitAnsiString(&ansi_device_name,"\\Device\\Beep");
RtlAnsiStringToUnicodeString(&device_name,&ansi_device_name,TRUE);
ret = IoCreateDevice(DriverObject,
sizeof(DEVICE_EXTENSION),
&device_name,
FILE_DEVICE_BEEP,
0,
FALSE,
&pDeviceObject);
if (ret!=STATUS_SUCCESS)
{
return(ret);
}
/* prelininary */
RtlInitAnsiString(&asymlink_name,"\\??\\Beep");
RtlAnsiStringToUnicodeString(&symlink_name,&asymlink_name,TRUE);
IoCreateSymbolicLink(&symlink_name,&device_name);
DriverObject->MajorFunction[IRP_MJ_CREATE] = BeepCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = BeepClose;
DriverObject->MajorFunction[IRP_MJ_CLEANUP] = BeepCleanup;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = BeepDeviceControl;
DriverObject->DriverUnload = BeepUnload;
/* set up device extension */
pDeviceObject->Flags |= DO_BUFFERED_IO;
pDeviceExtension = pDeviceObject->DeviceExtension;
pDeviceExtension->BeepOn = FALSE;
KeInitializeDpc (&(pDeviceExtension->Dpc),
BeepDPC,
pDeviceExtension);
KeInitializeTimer (&(pDeviceExtension->Timer));
KeInitializeEvent (&(pDeviceExtension->Event),
SynchronizationEvent,
FALSE);
return(STATUS_SUCCESS);
}

View File

@@ -1 +0,0 @@
all: beep.o

View File

@@ -0,0 +1,4 @@
base.tmp
junk.tmp
temp.exp

View File

@@ -1,8 +1,8 @@
#undef WIN32_LEAN_AND_MEAN
#include <internal/mmhal.h>
#include <internal/halio.h>
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#include <defines.h>
@@ -79,7 +79,8 @@ NTSTATUS ScrDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* Module entry point
*/
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
STDCALL NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
PDEVICE_OBJECT DeviceObject;
ANSI_STRING adevice_name;

View File

@@ -0,0 +1,23 @@
#
#
#
all: blue.sys
.phony: all
OBJECTS = blue.o ../../../ntoskrnl/ntoskrnl.a
blue.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 blue.sys --base-file base.tmp \
--output-exp temp.exp
- $(RM) base.tmp
$(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 \
-specs=../../svc_specs -mdll -o blue.sys $(OBJECTS) -Wl,temp.exp
- $(RM) temp.exp

View File

@@ -165,4 +165,4 @@ main(
}
// EOF
// EOF

View File

@@ -444,4 +444,4 @@ Return Value:
}
// EOF
// EOF

View File

@@ -0,0 +1,3 @@
base.tmp
junk.tmp
temp.exp

View File

@@ -72,6 +72,7 @@ typedef DISK_GEOMETRY *PDISK_GEOMETRY;
// -------------------------------------------------------------------------
#include <internal/i386/io.h>
#include <string.h>
#include <internal/string.h>
#define NDEBUG
@@ -230,7 +231,7 @@ IDESwapBytePairs(char *Buf,
// RETURNS:
// NTSTATUS
NTSTATUS
STDCALL NTSTATUS
DriverEntry(IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
{

View File

@@ -1,9 +1,15 @@
#
#
#
all: ide.sys
all: ide.o
OBJECTS = ide.o ../../../ntoskrnl/ntoskrnl.a
ide.o: ide.c ide.h idep.h partitio.h
include ../../../rules.mak
ide.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 ide.sys --base-file base.tmp \
--output-exp temp.exp
- $(RM) base.tmp
$(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 \
-specs=../../svc_specs -mdll -o ide.sys $(OBJECTS) -Wl,temp.exp
- $(RM) temp.exp

View File

@@ -75,14 +75,14 @@ typedef enum PartitionTypes {
((P)->PartitionType == PTDosExtended)
typedef struct Partition {
__u8 BootFlags;
__u8 StartingHead;
__u8 StartingSector;
__u8 StartingCylinder;
__u8 PartitionType;
__u8 EndingHead;
__u8 EndingSector;
__u8 EndingCylinder;
unsigned char BootFlags;
unsigned char StartingHead;
unsigned char StartingSector;
unsigned char StartingCylinder;
unsigned char PartitionType;
unsigned char EndingHead;
unsigned char EndingSector;
unsigned char EndingCylinder;
unsigned int StartingBlock;
unsigned int SectorCount;

View File

@@ -0,0 +1,4 @@
base.tmp
junk.tmp
temp.exp

View File

@@ -20,10 +20,10 @@
**
*/
#undef WIN32_LEAN_AND_MEAN
#include <internal/mmhal.h>
#include <internal/halio.h>
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#include <defines.h>
@@ -689,7 +689,8 @@ NTSTATUS KbdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
/*
* Module entry point
*/
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
STDCALL NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
PDEVICE_OBJECT DeviceObject;
ANSI_STRING adevice_name;

View File

@@ -1 +1,15 @@
all: keyboard.o
all: keyboard.sys
OBJECTS = keyboard.o ../../../ntoskrnl/ntoskrnl.a
keyboard.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 keyboard.sys --base-file base.tmp \
--output-exp temp.exp
- $(RM) base.tmp
$(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 \
-specs=../../svc_specs -mdll -o keyboard.sys $(OBJECTS) -Wl,temp.exp
- $(RM) temp.exp

View File

@@ -58,4 +58,4 @@ void write_dsp(unsigned short base,unsigned char data)
while ((inb(base+DSP_WRITE_PORT) & 0x80) != 0);
outb(base+DSP_WRITE_PORT, data);
}

View File

@@ -29,4 +29,4 @@ void get_dma(SB16* sb16)
if(lo==0x08) sb16->dma8=3;
if(lo==0x02) sb16->dma8=1;
if(lo==0x01) sb16->dma8=0;
}
}

View File

@@ -6,4 +6,4 @@ typedef struct
unsigned char dma16;
unsigned char* buffer;
}SB16;

View File

@@ -1,3 +1,3 @@
void write_wave()
{
}
}

View File

@@ -17,6 +17,7 @@
#include <internal/hal/ddk.h>
#include <internal/dma.h>
#include <internal/mm.h>
#include <string.h>
#include <internal/string.h>
#include <devices.h>
#include "sb16.h"

View File

@@ -0,0 +1,126 @@
ULONG OldIRQ;
PKINTERRUPT IrqObject;
BOOLEAN DMAOutputISR(PKINTERRUPT Interrupt, PVOID ServiceContext)
{
printk("interrupt\n");
return FALSE;
}
void sb16_play(WAVE_HDR* wave)
{
unsigned int eflags;
ULONG MappedIrq;
KIRQL Dirql;
KAFFINITY Affinity;
PKINTERRUPT IrqObject;
unsigned int mask,newmask;
unsigned int i;
unsigned int tmp[255];
i=0;
dump_wav(wave);
do
{
tmp[i++]=get_dma_page(0x0fffff+IDMAP_BASE);
printk("0x%x ",tmp[i-1]);
}
while((tmp[i-1]&0xffff)!=0);
free_page((tmp[0])-IDMAP_BASE,i-1);
sb16.buffer=((unsigned char*)tmp[i-1]);
/*
* Because this is used by alomost every subsystem including irqs it
* must be atomic. The following code sequence disables interrupts after
* saving the previous state of the interrupt flag
*/
__asm__("pushf\n\tpop %0\n\tcli\n\t"
: "=m" (eflags)
: );
memcpy(sb16.buffer,(&wave->data),wave->dLen);
MappedIrq = HalGetInterruptVector(Internal,0,0,8+sb16.irq,&Dirql,&Affinity);
IoConnectInterrupt(&IrqObject,DMAOutputISR,0,NULL,MappedIrq,Dirql,Dirql,0,FALSE,Affinity,FALSE);
mask=inb(0x21);
newmask=((int)1<<sb16.irq);
outb(0x21,(mask&~newmask));
// Restore the interrupt flag
__asm__("push %0\n\tpopf\n\t"
:
: "m" (eflags));
disable_dma(sb16.dma8);
//outb(0x0a,5);
clear_dma_ff(1);
//outb(0xc,0);
set_dma_count(1,wave->dLen);
set_dma_mode(1,DMA_MODE_WRITE);
//outb(0xb,0x49);
//outb(0x3,(wave->dLen)&0xff);
//outb(0x3,((unsigned int)(wave->dLen)>>8)&0xff);
set_dma_addr(sb16.dma8,(unsigned int)sb16.buffer-IDMAP_BASE);
//outb(0x83,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>16))&0xf);
//outb(0x2,((unsigned int)sb16.buffer&0xff));
//outb(0x2,(((unsigned int)(sb16.buffer-IDMAP_BASE)>>8))&0xff);
enable_dma(sb16.dma8);
//outb(0xa,1);
write_dsp(sb16.base,0x00D1);
write_dsp(sb16.base,0x40);
write_dsp(sb16.base,((unsigned char)256-(1000000/wave->nSamplesPerSec)));
outb(sb16.base + 4, (int) 0xa);
outb(sb16.base + 5, (int) 0x00);
outb(sb16.base + 4, (int) 4);
outb(sb16.base + 5, (int) 0xFF);
outb(sb16.base + 4, (int) 0x22);
outb(sb16.base + 5, (int) 0xFF);
write_dsp(sb16.base,0x14);
write_dsp(sb16.base,(wave->dLen&0x00ff));
write_dsp(sb16.base,((wave->dLen)&0xff00)>>8);
// write_dsp(sb16.base,0xc0);
// write_dsp(sb16.base,0x0);
// OldIRQ=HalGetInterruptVector(Internal,0,0,irq+8,&irql,&affinity);
// printk("OldIRQ: 0x%x\n",OldIRQ);
// status=IoConnectInterrupt(&IrqObject,playRoutine,0,NULL,OldIRQ,irql,irql,0,FALSE,affinity,FALSE);
// if(status!=STATUS_SUCCESS) printk("Couldn't set irq\n");
// else printk("IRQ set\n");
}
void dump_wav(WAVE_HDR* wave)
{
printk("wave.rID: %c%c%c%c\n",wave->rID[0],wave->rID[1],wave->rID[2],wave->rID[3]);
printk("wave.rLen: 0x%x\n",wave->rLen);
printk("wave.wID: %c%c%c%c\n",wave->wID[0],wave->wID[1],wave->wID[2],wave->wID[3]);
printk("wave.fID: %c%c%c%c\n",wave->fID[0],wave->fID[1],wave->fID[2],wave->fID[3]);
printk("wave.fLen: 0x%x\n",wave->fLen);
printk("wave.wFormatTag: 0x%x\n",wave->wFormatTag);
printk("wave.nChannels: 0x%x\n",wave->nChannels);
printk("wave.nSamplesPerSec: 0x%x\n",wave->nSamplesPerSec);
printk("wave.nAvgBytesPerSec: 0x%x\n",wave->nAvgBytesPerSec);
printk("wave.nBlockAlign: 0x%x\n",wave->nBlockAlign);
printk("wave.FormatSpecific: 0x%x\n",wave->FormatSpecific);
printk("wave.dID: %c%c%c%c\n",wave->dID[0],wave->dID[1],wave->dID[2],wave->dID[3]);
printk("wave.dLen: 0x%x\n",wave->dLen);
}
BOOLEAN playRoutine(PKINTERRUPT Interrupt,PVOID ServiceContext)
{
return FALSE;
}

View File

@@ -21,4 +21,4 @@ typedef struct
void sb16_play(WAVE_HDR* wave);
void dump_wav(WAVE_HDR* wave);
BOOLEAN playRoutine(PKINTERRUPT Interrupt,PVOID ServiceContext);
BOOLEAN playRoutine(PKINTERRUPT Interrupt,PVOID ServiceContext);

View File

@@ -0,0 +1,4 @@
base.tmp
junk.tmp
temp.exp

View File

@@ -1 +1,16 @@
all: test.o
all: test.sys
OBJECTS = test.o ../../../ntoskrnl/ntoskrnl.a
# --def test.def --def test.def
test.sys: test.o
$(DLLTOOL) --dllname test.sys --output-lib test.a
$(CC) -specs=$(KM_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 test.sys --base-file base.tmp \
--output-exp temp.exp
- $(RM) base.tmp
$(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry -specs=$(KM_SPECS) -mdll -o test.sys $(OBJECTS) -Wl,temp.exp
- $(RM) temp.exp

View File

@@ -15,12 +15,14 @@
/* FUNCTIONS **************************************************************/
#if 0
NTSTATUS TestWrite(PIRP Irp, PIO_STACK_LOCATION Stk)
{
PVOID Address;
Address = MmGetSystemAddressForMdl(Irp->MdlAddress);
printk("Asked to write '%s'\n",(PCH)Address);
DbgPrint("Asked to write '%s'\n",(PCH)Address);
return(STATUS_SUCCESS);
}
@@ -40,7 +42,7 @@ NTSTATUS TestDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
switch (Stack->MajorFunction)
{
case IRP_MJ_CREATE:
printk("(Test Driver) Creating\n");
DbgPrint("(Test Driver) Creating\n");
status = STATUS_SUCCESS;
break;
@@ -49,7 +51,7 @@ NTSTATUS TestDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
break;
case IRP_MJ_WRITE:
printk("(Test Driver) Writing\n");
DbgPrint("(Test Driver) Writing\n");
status = TestWrite(Irp,Stack);
break;
@@ -65,6 +67,8 @@ NTSTATUS TestDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
return(status);
}
#endif
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
@@ -79,8 +83,9 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
ANSI_STRING astr;
UNICODE_STRING ustr;
printk("Test Driver 0.0.1\n");
DbgPrint("Test Driver 0.0.1\n");
#if 0
RtlInitAnsiString(&astr,"\\Device\\Test");
RtlAnsiStringToUnicodeString(&ustr,&astr,TRUE);
ret = IoCreateDevice(DriverObject,0,&ustr,
@@ -96,7 +101,7 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
DriverObject->MajorFunction[IRP_MJ_WRITE] = TestDispatch;
DriverObject->MajorFunction[IRP_MJ_WRITE] = TestDispatch;
DriverObject->DriverUnload = NULL;
#endif
return(STATUS_SUCCESS);
}

View File

@@ -1 +0,0 @@
all: test.o

View File

@@ -1,65 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: services/test1/test.c
* PURPOSE: Bug demonstration
* PROGRAMMER: David Welch (welch@mcmail.com)
* UPDATE HISTORY:
* ??/??/??: Created
* 18/06/98: Made more NT like
*/
/* FUNCTIONS **************************************************************/
#include <windows.h>
#include <internal/kernel.h>
#include <internal/halio.h>
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/debug.h>
#define IDE_NT_ROOTDIR_NAME "\\Device\\"
#define IDE_NT_DEVICE_NAME "\\HardDrive"
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
/*
* FUNCTION: Called by the system to initalize the driver
* ARGUMENTS:
* DriverObject = object describing this driver
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
{
char DeviceDirName[255];
UNICODE_STRING UnicodeDeviceDirName;
ANSI_STRING AnsiDeviceDirName;
OBJECT_ATTRIBUTES DeviceDirAttributes;
HANDLE Handle;
NTSTATUS RC;
ULONG HarddiskIdx = 0;
strcpy(DeviceDirName,IDE_NT_ROOTDIR_NAME);
strcat(DeviceDirName,IDE_NT_DEVICE_NAME);
DeviceDirName[strlen(DeviceDirName)+1]='\0';
DeviceDirName[strlen(DeviceDirName)]= '0' + HarddiskIdx;
printk("DeviceDirName %s\n",DeviceDirName);
RtlInitAnsiString(&AnsiDeviceDirName,DeviceDirName);
RC = RtlAnsiStringToUnicodeString(&UnicodeDeviceDirName,
&AnsiDeviceDirName,
TRUE);
if (!NT_SUCCESS(RC))
{
DPRINT("Could not convert ansi to unicode for device dir\n",0);
return(STATUS_UNSUCCESSFUL);
}
InitializeObjectAttributes(&DeviceDirAttributes,&UnicodeDeviceDirName,
0,NULL,NULL);
RC = ZwCreateDirectoryObject(&Handle,0,&DeviceDirAttributes);
if (!NT_SUCCESS(RC))
{
DPRINT("Could not create device dir\n",0);
return(STATUS_UNSUCCESSFUL);
}
RtlFreeUnicodeString(&UnicodeDeviceDirName);
}

View File

@@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#define NDEBUG

View File

@@ -10,8 +10,8 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <wchar.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -10,8 +10,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -1,9 +1,16 @@
OBJECTS = super.o blockdev.o inode.o file.o dir.o rw.o
all: ext2fs.sys
all: ext2.o
ext2.o: $(OBJECTS)
$(LD) -r $(OBJECTS) -o ext2fs.sys
include ../../../rules.mak
OBJECTS = super.o blockdev.o inode.o file.o dir.o rw.o \
../../../ntoskrnl/ntoskrnl.a
ext2fs.sys: $(OBJECTS)
$(CC) -specs=$(KM_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 ext2fs.sys --base-file base.tmp \
--output-exp temp.exp
$(RM) base.tmp
$(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry \
-specs=$(KM_SPECS) -mdll -o ext2fs.sys $(OBJECTS) -Wl,temp.exp
$(RM) temp.exp

View File

@@ -10,8 +10,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -10,8 +10,8 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <wchar.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -10,8 +10,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#define NDEBUG

View File

@@ -10,8 +10,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -10,6 +10,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/string.h>
#include <internal/bitops.h>
#include <ddk/ntifs.h>

View File

@@ -11,8 +11,6 @@
#include <ddk/ntddk.h>
#include <ddk/ntifs.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -10,8 +10,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -0,0 +1,4 @@
base.tmp
junk.tmp
temp.exp

View File

@@ -10,8 +10,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/string.h>
#include <wstring.h>
#define NDEBUG
#include <internal/debug.h>

View File

@@ -7,9 +7,10 @@
19-12-1998 : created
*/
#include <ddk/ntddk.h>
#include <wchar.h>
#include <internal/string.h>
#include <wstring.h>
#include <ddk/ntddk.h>
#include <ddk/cctypes.h>
#include <ddk/zwtypes.h>
@@ -36,7 +37,7 @@ BOOL fsdDosDateTimeToFileTime(WORD wDosDate,WORD wDosTime, TIME *FileTime)
long long int mult;
Day=wDosDate&0x001f;
Month= (wDosDate&0x00e0)>>5;//1=January
Year= ((wDosDate&0xfe00)>>9)+1980;
Year= ((wDosDate&0xff00)>>8)+1980;
Second=(wDosTime&0x001f)<<1;
Minute=(wDosTime&0x07e0)>>5;
Hour= (wDosTime&0xf100)>>11;
@@ -49,13 +50,13 @@ BOOL fsdDosDateTimeToFileTime(WORD wDosDate,WORD wDosTime, TIME *FileTime)
mult *=24;
*pTime +=(Day-1)*mult;
if((Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0))
*pTime += MonthsDF1[1][Month-1]*mult;
*pTime += MonthsDF1[1][Month-1];
else
*pTime += MonthsDF1[0][Month-1]*mult;
*pTime +=((Year-1601)*365
*pTime += MonthsDF1[0][Month-1];
*pTime +=(Year-1601)*mult*365
+(Year-1601)/4
-(Year-1601)/100
+(Year-1601)/400)*mult;
+(Year-1601)/400;
return TRUE;
}
#define DosDateTimeToFileTime fsdDosDateTimeToFileTime
@@ -215,7 +216,7 @@ NTSTATUS DoQuery(PDEVICE_OBJECT DeviceObject, PIRP Irp,PIO_STACK_LOCATION Stack)
PVfatCCB pCcb;
PDEVICE_EXTENSION DeviceExt;
WCHAR star[5],*pCharPattern;
unsigned long OldEntry;
unsigned long OldEntry,OldSector;
DeviceExt = DeviceObject->DeviceExtension;
// Obtain the callers parameters
BufferLength = Stack->Parameters.QueryDirectory.Length;
@@ -227,7 +228,7 @@ NTSTATUS DoQuery(PDEVICE_OBJECT DeviceObject, PIRP Irp,PIO_STACK_LOCATION Stack)
pFcb = pCcb->pFcb;
if(Stack->Flags & SL_RESTART_SCAN)
{//FIXME : what is really use of RestartScan ?
pCcb->StartEntry=0;
pCcb->StartEntry=pCcb->StartSector=0;
}
// determine Buffer for result :
if (Irp->MdlAddress)
@@ -245,12 +246,12 @@ NTSTATUS DoQuery(PDEVICE_OBJECT DeviceObject, PIRP Irp,PIO_STACK_LOCATION Stack)
tmpFcb.ObjectName=tmpFcb.PathName;
while(RC==STATUS_SUCCESS && BufferLength >0)
{
OldSector=pCcb->StartSector;
OldEntry=pCcb->StartEntry;
CHECKPOINT;
RC=FindFile(DeviceExt,&tmpFcb,pFcb,pCharPattern,&pCcb->StartEntry);
DPRINT("Found %w,RC=%x,entry %x\n",tmpFcb.ObjectName,RC
,pCcb->StartEntry);
pCcb->StartEntry++;
if(OldSector)pCcb->StartEntry++;
RC=FindFile(DeviceExt,&tmpFcb,pFcb,pCharPattern,&pCcb->StartSector,&pCcb->StartEntry);
DPRINT("Found %w,RC=%x, sector %x entry %x\n",tmpFcb.ObjectName,RC
,pCcb->StartSector,pCcb->StartEntry);
if (NT_SUCCESS(RC))
{
switch(FileInformationClass)
@@ -283,6 +284,7 @@ DPRINT("Found %w,RC=%x,entry %x\n",tmpFcb.ObjectName,RC
if(RC==STATUS_BUFFER_OVERFLOW)
{
if(Buffer0) Buffer0->NextEntryOffset=0;
pCcb->StartSector=OldSector;
pCcb->StartEntry=OldEntry;
break;
}

View File

@@ -8,10 +8,10 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <ctype.h>
#include <wchar.h>
#include <internal/string.h>
#include <internal/ctype.h>
#include <wstring.h>
#include <ddk/ntddk.h>
#include <ddk/cctypes.h>
#define NDEBUG
@@ -19,22 +19,23 @@
#include "vfat.h"
NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PVfatFCB pFcb)
NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PFILE_OBJECT pFileObject)
/*
update an existing FAT entry
*/
{
WCHAR DirName[MAX_PATH],*FileName,*PathFileName;
VfatFCB FileFcb;
ULONG Entry=0;
ULONG Sector=0,Entry=0;
PUCHAR Buffer;
FATDirEntry * pEntries;
NTSTATUS status;
FILE_OBJECT FileObject;
PVfatCCB pDirCcb;
PVfatFCB pDirFcb;
PVfatFCB pDirFcb,pFcb;
short i,posCar,NameLen;
CHECKPOINT;
PathFileName=pFcb->PathName;
PathFileName=pFileObject->FileName.Buffer;
pFcb=((PVfatCCB)pFileObject->FsContext2)->pFcb;
//find last \ in PathFileName
posCar=-1;
for(i=0;PathFileName[i];i++)
@@ -49,8 +50,6 @@ NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PVfatFCB pFcb)
if(FileName[0]==0 && DirName[0]==0)
return STATUS_SUCCESS;//root : nothing to do ?
memset(&FileObject,0,sizeof(FILE_OBJECT));
FileObject.FileName.Buffer=DirName;
FileObject.FileName.Length=posCar;
DPRINT("open directory %w for update of entry %w\n",DirName,FileName);
status=FsdOpenFile(DeviceExt,&FileObject,DirName);
pDirCcb=(PVfatCCB)FileObject.FsContext2;
@@ -58,15 +57,18 @@ DPRINT("open directory %w for update of entry %w\n",DirName,FileName);
pDirFcb=pDirCcb->pFcb;
assert(pDirFcb);
FileFcb.ObjectName=&FileFcb.PathName[0];
status=FindFile(DeviceExt,&FileFcb,pDirFcb,FileName,&Entry);
status=FindFile(DeviceExt,&FileFcb,pDirFcb,FileName,&Sector,&Entry);
if(NT_SUCCESS(status))
{
DPRINT("update entry: entry %d\n",Entry);
status=FsdWriteFile(DeviceExt,pDirFcb,&pFcb->entry,sizeof(FATDirEntry)
,Entry*sizeof(FATDirEntry));
Buffer=ExAllocatePool(NonPagedPool,BLOCKSIZE);
DPRINT("update entry: sector %d, entry %d\n",Sector,Entry);
VFATReadSectors(DeviceExt->StorageDevice,Sector,1,Buffer);
pEntries=(FATDirEntry *)Buffer;
memcpy(&pEntries[Entry],&pFcb->entry,sizeof(FATDirEntry));
VFATWriteSectors(DeviceExt->StorageDevice,Sector,1,Buffer);
ExFreePool(Buffer);
}
FsdCloseFile(DeviceExt,&FileObject);
CHECKPOINT;
return status;
}
@@ -85,13 +87,11 @@ NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt
slot *pSlots;
ULONG LengthRead,Offset;
short nbSlots=0,nbFree=0,i,j,posCar,NameLen;
PUCHAR Buffer;
PUCHAR Buffer,Buffer2;
BOOLEAN needTilde=FALSE,needLong=FALSE;
PVfatFCB newFCB,pDirFCB;
PVfatCCB newCCB,pDirCCB;
PVfatFCB newFCB;
PVfatCCB newCCB;
ULONG CurrentCluster;
TIME_FIELDS RTCTime;
CHECKPOINT;
PathFileName=pFileObject->FileName.Buffer;
DPRINT("addEntry: Pathname=%w\n",PathFileName);
//find last \ in PathFileName
@@ -108,8 +108,6 @@ NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt
// open parent directory
memset(&FileObject,0,sizeof(FILE_OBJECT));
status=FsdOpenFile(DeviceExt,&FileObject,DirName);
pDirCCB=FileObject.FsContext2;
pDirFCB=pDirCCB->pFcb;
nbSlots=(NameLen+12)/13+1;//nb of entry needed for long name+normal entry
DPRINT("NameLen= %d, nbSlots =%d\n",NameLen,nbSlots);
Buffer=ExAllocatePool(NonPagedPool,(nbSlots+1)*sizeof(FATDirEntry));
@@ -128,6 +126,7 @@ NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt
memset(pEntry,' ',11);
for(i=0,j=0;j<8 && i<posCar;i++)
{
//FIXME : is there other characters to ignore ?
if( FileName[i]!='.'
&& FileName[i]!=' '
&& FileName[i]!='+'
@@ -168,7 +167,7 @@ NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt
DirName[7]='0'+i;
pEntry->Filename[7]='0'+i;
status=FindFile(DeviceExt,&FileFcb
,&DirFcb,DirName,NULL);
,&DirFcb,DirName,NULL,NULL);
if(status!=STATUS_SUCCESS)break;
}
//try second with xxxxx~yy.zzz
@@ -180,7 +179,7 @@ NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt
DirName[7]='0'+i;
pEntry->Filename[7]='0'+i;
status=FindFile(DeviceExt,&FileFcb
,&DirFcb,DirName,NULL);
,&DirFcb,DirName,NULL,NULL);
if(status!=STATUS_SUCCESS)break;
}
}
@@ -225,19 +224,13 @@ DPRINT("i=%d,j=%d,%d,%d\n",i,j,pEntry->Filename[i],FileName[i]);
DirName[NameLen]=0;
}
DPRINT("dos name=%11.11s\n",pEntry->Filename);
// set attributes, dates, times
//FIXME : set attributes, dates, times
pEntry->Attrib=ReqAttr;
if(RequestedOptions&FILE_DIRECTORY_FILE)
pEntry->Attrib |= FILE_ATTRIBUTE_DIRECTORY;
HalQueryRealTimeClock(&RTCTime);
pEntry->CreationTime
= (RTCTime.Second>>1)+(RTCTime.Minute<<5)+(RTCTime.Hour<<11);
pEntry->CreationDate
= RTCTime.Day+(RTCTime.Month<<5)+((RTCTime.Year-1980)<<9);
pEntry->UpdateDate=pEntry->CreationDate;
pEntry->UpdateTime=pEntry->CreationTime;
pEntry->AccessDate=pEntry->CreationDate;
pEntry->CreationDate=0x21;
pEntry->UpdateDate=0x21;
// calculate checksum for 8.3 name
for(pSlots[0].alias_checksum=i=0;i<11;i++)
{
@@ -256,28 +249,33 @@ DPRINT("i=%d,j=%d,%d,%d\n",i,j,pEntry->Filename[i],FileName[i]);
pSlots[i].id=nbSlots-i-1+0x40;
pSlots[i].alias_checksum=pSlots[0].alias_checksum;
//FIXME pSlots[i].start=;
memcpy(pSlots[i].name0_4 ,DirName+(nbSlots-i-2)*13
memcpy(pSlots[i].name0_4 ,FileName+(nbSlots-i-2)*13
,5*sizeof(WCHAR));
memcpy(pSlots[i].name5_10 ,DirName+(nbSlots-i-2)*13+5
memcpy(pSlots[i].name5_10 ,FileName+(nbSlots-i-2)*13+5
,6*sizeof(WCHAR));
memcpy(pSlots[i].name11_12,DirName+(nbSlots-i-2)*13+11
memcpy(pSlots[i].name11_12,FileName+(nbSlots-i-2)*13+11
,2*sizeof(WCHAR));
}
//try to find nbSlots contiguous entries frees in directory
for(i=0,status=STATUS_SUCCESS;status==STATUS_SUCCESS;i++)
{
status=FsdReadFile(DeviceExt,pDirFCB,&FatEntry
status=FsdReadFile(DeviceExt,&FileObject,&FatEntry
,sizeof(FATDirEntry),i*sizeof(FATDirEntry),&LengthRead);
if(IsLastEntry(&FatEntry))
if(IsLastEntry(&FatEntry,0))
break;
if(IsDeletedEntry(&FatEntry)) nbFree++;
if(IsDeletedEntry(&FatEntry,0)) nbFree++;
else nbFree=0;
if (nbFree==nbSlots) break;
}
DPRINT("NbFree %d, entry number %d\n",nbFree,i);
if(RequestedOptions&FILE_DIRECTORY_FILE)
{ // directory has always a first cluster
{
CurrentCluster=GetNextWriteCluster(DeviceExt,0);
// zero the cluster
Buffer2=ExAllocatePool(NonPagedPool,DeviceExt->BytesPerCluster);
memset(Buffer2,0,DeviceExt->BytesPerCluster);
VFATWriteCluster(DeviceExt,Buffer2,CurrentCluster);
ExFreePool(Buffer2);
if (DeviceExt->FatType == FAT32)
{
pEntry->FirstClusterHigh=CurrentCluster>>16;
@@ -289,13 +287,13 @@ DPRINT("i=%d,j=%d,%d,%d\n",i,j,pEntry->Filename[i],FileName[i]);
if(nbFree==nbSlots)
{//use old slots
Offset=(i-nbSlots+1)*sizeof(FATDirEntry);
status=FsdWriteFile(DeviceExt,pDirFCB,Buffer
status=FsdWriteFile(DeviceExt,&FileObject,Buffer
,sizeof(FATDirEntry)*nbSlots,Offset);
}
else
{//write at end of directory
Offset=(i-nbFree)*sizeof(FATDirEntry);
status=FsdWriteFile(DeviceExt,pDirFCB,Buffer
status=FsdWriteFile(DeviceExt,&FileObject,Buffer
,sizeof(FATDirEntry)*(nbSlots+1),Offset);
}
DPRINT("write entry offset %d status=%x\n",Offset,status);
@@ -307,13 +305,10 @@ DPRINT("i=%d,j=%d,%d,%d\n",i,j,pEntry->Filename[i],FileName[i]);
newCCB->PtrFileObject=pFileObject;
newFCB->RefCount++;
//FIXME : initialize all fields in FCB and CCB
newFCB->Buffer=ExAllocatePool(NonPagedPool,DeviceExt->BytesPerCluster);
newFCB->Cluster=0xFFFFFFFF;
newFCB->Flags=0;
newFCB->nextFcb=pFirstFcb;
memcpy(&newFCB->entry,pEntry,sizeof(FATDirEntry));
DPRINT("new : entry=%11.11s\n",newFCB->entry.Filename);
DPRINT("new : entry=%11.11s\n",pEntry->Filename);
newFCB->nextFcb=pFirstFcb;
pFirstFcb=newFCB;
vfat_wcsncpy(newFCB->PathName,PathFileName,MAX_PATH);
newFCB->ObjectName=newFCB->PathName+(PathFileName-FileName);
@@ -324,7 +319,7 @@ DPRINT("new : entry=%11.11s\n",pEntry->Filename);
{
// create . and ..
memcpy(pEntry->Filename,". ",11);
status=FsdWriteFile(DeviceExt,newFCB,pEntry
status=FsdWriteFile(DeviceExt,pFileObject,pEntry
,sizeof(FATDirEntry),0L);
pEntry->FirstCluster
=((VfatCCB *)(FileObject.FsContext2))->pFcb->entry.FirstCluster;
@@ -333,7 +328,7 @@ DPRINT("new : entry=%11.11s\n",pEntry->Filename);
memcpy(pEntry->Filename,".. ",11);
if(pEntry->FirstCluster==1 && DeviceExt->FatType!=FAT32)
pEntry->FirstCluster=0;
status=FsdWriteFile(DeviceExt,newFCB,pEntry
status=FsdWriteFile(DeviceExt,pFileObject,pEntry
,sizeof(FATDirEntry),sizeof(FATDirEntry));
}
FsdCloseFile(DeviceExt,&FileObject);

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,15 @@
%.o: %.cc
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.asm
$(NASM) $(NFLAGS) $< -o $@
all: vfatfsd.sys
OBJECTS= blockdev.o iface.o dir.o dirwr.o
OBJECTS = blockdev.o dir.o dirwr.o iface.o ../../../ntoskrnl/ntoskrnl.a
all: vfatfsd.o
tests: tstvfat5.bin tstvfat6.bin
vfatfsd.o: $(OBJECTS)
$(LD) $(OBJECTS) -r -o vfatfsd.o
$(NM) --numeric-sort vfatfsd.o > vfatfsd.sym
OBJECTS2 = ../../../apps/common/crt0.o
LIBS= ../../../lib/kernel32/kernel32.a ../../../lib/ntdll/ntdll.a
%.bin: $(OBJECTS) %.o
$(LD) -Ttext 0x10000 $(OBJECTS2) $*.o $(LIBS) -o $*.exe
$(OBJCOPY) -O binary $*.exe $*.bin
include ../../../rules.mak
vfatfsd.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 vfatfsd.sys --base-file base.tmp \
--output-exp temp.exp
- $(RM) base.tmp
$(CC) --verbose -Wl,--image-base,0x10000 -Wl,-e,_DriverEntry@8 \
-specs=../../svc_specs -mdll -o vfatfsd.sys $(OBJECTS) -Wl,temp.exp
- $(RM) temp.exp

View File

@@ -1,4 +1,4 @@
#include <wchar.h>
@@ -113,9 +113,6 @@ typedef struct _VfatFCB
PDEVICE_EXTENSION pDevExt;
struct _VfatFCB * nextFcb, *prevFcb;
struct _VfatFCB * parentFcb;
UCHAR *Buffer;
long Flags;
ULONG Cluster;
} VfatFCB, *PVfatFCB;
typedef struct
@@ -124,6 +121,7 @@ typedef struct
LIST_ENTRY NextCCB;
PFILE_OBJECT PtrFileObject;
LARGE_INTEGER CurrentByteOffset;
ULONG StartSector; // for DirectoryControl
ULONG StartEntry; //for DirectoryControl
// PSTRING DirectorySearchPattern;// for DirectoryControl ?
} VfatCCB, *PVfatCCB;
@@ -158,27 +156,27 @@ BOOLEAN VFATWriteSectors(IN PDEVICE_OBJECT pDeviceObject,
//internal functions in iface.c :
NTSTATUS FindFile(PDEVICE_EXTENSION DeviceExt, PVfatFCB Fcb,
PVfatFCB Parent, PWSTR FileToFind,ULONG *Entry);
PVfatFCB Parent, PWSTR FileToFind,ULONG *StartSector,ULONG *Entry);
NTSTATUS FsdCloseFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject);
NTSTATUS FsdGetStandardInformation(PVfatFCB FCB, PDEVICE_OBJECT DeviceObject,
PFILE_STANDARD_INFORMATION StandardInfo);
NTSTATUS FsdOpenFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PWSTR FileName);
NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PVfatFCB pFcb,
NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG ReadOffset,
PULONG LengthRead);
NTSTATUS FsdWriteFile(PDEVICE_EXTENSION DeviceExt, PVfatFCB pFcb,
PVOID Buffer, ULONG Length, ULONG WriteOffset);
NTSTATUS FsdWriteFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG WriteOffset);
ULONG GetNextWriteCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster);
BOOLEAN IsDeletedEntry(FATDirEntry *pEntry);
BOOLEAN IsLastEntry(FATDirEntry *pEntry);
BOOLEAN IsDeletedEntry(PVOID Block, ULONG Offset);
BOOLEAN IsLastEntry(PVOID Block, ULONG Offset);
wchar_t * vfat_wcsncpy(wchar_t * dest, const wchar_t *src,size_t wcount);
void VFATWriteCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster);
//internal functions in dirwr.c
NTSTATUS addEntry(PDEVICE_EXTENSION DeviceExt
,PFILE_OBJECT pFileObject,ULONG RequestedOptions,UCHAR ReqAttr);
NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PVfatFCB pFcb);
NTSTATUS updEntry(PDEVICE_EXTENSION DeviceExt,PFILE_OBJECT pFileObject);
//FIXME : following defines must be removed

View File

@@ -9,4 +9,4 @@ To install :
What's new :
- some bugfixes
- support for IRP_MJ_DIRECTORY_CONTROL
(see reactos/tst/sshell.c for use of ZwQueryDirectoryFile)
(see reactos/tst/sshell.c for use of ZwQueryDirectoryFile)

78
reactos/drivers/svc_specs Normal file
View File

@@ -0,0 +1,78 @@
*asm:
*asm_final:
*cpp:
-remap %(cpp_cpu) %{posix:-D_POSIX_SOURCE}
*cc1:
%(cc1_spec)
*cc1plus:
*endfile:
*link:
%{mwindows:--subsystem windows} %{mdll:--dll -e _DriverEntry@8}
*lib:
*libgcc:
*startfile:
*switches_need_spaces:
*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}
*predefines:
-Di386 -D_WIN32 -DWIN32 -D__WIN32__ -D__MINGW32__ -DWINNT -D_X86_=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) _D_stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -Asystem(winnt) -Acpu(i386) -Amachine(i386)
*cross_compile:
1
*version:
egcs-2.91.57
*multilib:
. ;
*multilib_defaults:
*multilib_extra:
*multilib_matches:
*linker:
collect2
*cpp_486:
%{!ansi:-Di486} -D__i486 -D__i486__
*cpp_586:
%{!ansi:-Di586 -Dpentium} -D__i586 -D__i586__ -D__pentium -D__pentium__
*cpp_686:
%{!ansi:-Di686 -Dpentiumpro} -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__
*cpp_cpu_default:
%(cpp_586)
*cpp_cpu:
-Acpu(i386) -Amachine(i386) %{!ansi:-Di386} -D__i386 -D__i386__ %{mcpu=i486:%(cpp_486)} %{m486:%(cpp_486)} %{mpentium:%(cpp_586)} %{mcpu=pentium:%(cpp_586)} %{mpentiumpro:%(cpp_686)} %{mcpu=pentiumpro:%(cpp_686)} %{!mcpu*:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}
*cc1_cpu:
%{!mcpu*: %{m386:-mcpu=i386 -march=i386} %{mno-486:-mcpu=i386 -march=i386} %{m486:-mcpu=i486 -march=i486} %{mno-386:-mcpu=i486 -march=i486} %{mno-pentium:-mcpu=i486 -march=i486} %{mpentium:-mcpu=pentium} %{mno-pentiumpro:-mcpu=pentium} %{mpentiumpro:-mcpu=pentiumpro}}

View File

@@ -10,6 +10,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
@@ -24,7 +25,8 @@ int process(FILE* in, FILE* out, FILE *out2)
char* name2;
int value;
char* nr_args;
char* stmp;
unsigned char first1 = TRUE;
fprintf(out,"; Machine generated, don't edit\n");
@@ -55,18 +57,17 @@ int process(FILE* in, FILE* out, FILE *out2)
// value = strtok(NULL," \t");
nr_args = (char *)strtok(NULL," \t");
if ((stmp=strchr(nr_args,'\n'))!=NULL)
{
*stmp=0;
}
// printf("name %s value %d\n",name,value);
#ifdef PARAMETERIZED_LIBS
fprintf(out,"GLOBAL _%s@%s\n",name,nr_args);
fprintf(out,"GLOBAL _%s@%s\n",name2,nr_args);
fprintf(out,"_%s@%s:\n",name,nr_args);
fprintf(out,"_%s@%s:\n",name2,nr_args);
#else
fprintf(out,"GLOBAL _%s\n",name);
fprintf(out,"GLOBAL _%s\n",name2);
fprintf(out,"_%s:\n",name);
fprintf(out,"_%s:\n",name2);
#endif
fprintf(out,"\tmov\teax,%d\n",value);
fprintf(out,"\tlea\tedx,[esp+4]\n");
fprintf(out,"\tint\t2Eh\n");

View File

@@ -11,8 +11,8 @@ genntdll$(EXE_POSTFIX): genntdll.c
sysfuncs.lst: dummy
clean: dummy
- $(RM) ../../lib/ntdll/sysfuncs.lst
- $(RM) ../../include/ntdll/napi.h
$(RM) ../../lib/ntdll/sysfuncs.lst
$(RM) ../../include/ntdll/napi.h
dummy:

View File

@@ -60,7 +60,7 @@ NtFreeVirtualMemory ZwFreeVirtualMemory 16
NtFsControlFile ZwFsControlFile 40
NtGetContextThread ZwGetContextThread 8
NtGetPlugPlayEvent ZwGetPlugPlayEvent 16
NtGetTickCount ZwGetTickCount 0
NtGetTickCount ZwGetTickCount 4
NtImpersonateClientOfPort ZwImpersonateClientOfPort 8
NtImpersonateThread ZwImpersonateThread 12
NtInitializeRegistry ZwInitializeRegistry 4

View File

@@ -65,6 +65,10 @@ typedef unsigned short *PUSHORT;
typedef void *PVOID;
typedef unsigned char BYTE;
typedef void *LPVOID;
typedef DWORD *PDWORD;
typedef float *PFLOAT;
typedef unsigned short *PWCH;
typedef unsigned short *PWORD;
/* Check VOID before defining CHAR, SHORT, and LONG */
#ifndef VOID
@@ -274,8 +278,6 @@ typedef BYTE *PBYTE;
typedef const CHAR *PCCH;
typedef const char *PCSTR;
typedef const unsigned short *PCWCH;
typedef DWORD *PDWORD;
typedef float *PFLOAT;
/* typedef PHKEY; */
typedef int *PINT;
/* typedef LCID *PLCID; */
@@ -296,8 +298,6 @@ typedef char *PTCHAR;
typedef char *PTSTR;
#endif /* UNICODE */
typedef unsigned short *PWCH;
typedef unsigned short *PWORD;
/*
typedef PWSTR;
typedef REGSAM;

View File

@@ -1,67 +0,0 @@
/*
* conio.h
*
* Low level console I/O functions. Pretty please try to use the ANSI
* standard ones if you are writing new code.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.4 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _CONIO_H_
#define _CONIO_H_
#ifdef __cplusplus
extern "C" {
#endif
char* _cgets (char* szBuffer);
int _cprintf (const char* szFormat, ...);
int _cputs (const char* szString);
int _cscanf (char* szFormat, ...);
int _getch (void);
int _getche (void);
int _kbhit (void);
int _putch (int cPut);
int _ungetch (int cUnget);
#ifndef _NO_OLDNAMES
#define getch _getch
#define getche _getche
#define kbhit _kbhit
#define putch _putch
#define ungetch _ungetch
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
}
#endif
#endif /* Not _CONIO_H_ */
#endif /* Not __STRICT_ANSI__ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/

View File

@@ -0,0 +1,111 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_conio_h_
#define __dj_include_conio_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
extern int directvideo; /* ignored by gppconio */
extern int _wscroll;
#define _NOCURSOR 0
#define _SOLIDCURSOR 1
#define _NORMALCURSOR 2
struct text_info {
unsigned char winleft;
unsigned char wintop;
unsigned char winright;
unsigned char winbottom;
unsigned char attribute;
unsigned char normattr;
unsigned char currmode;
unsigned char screenheight;
unsigned char screenwidth;
unsigned char curx;
unsigned char cury;
};
enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
enum COLORS {
/* dark colors */
BLACK,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
/* light colors */
DARKGRAY,
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#define BLINK 0x80 /* blink bit */
void blinkvideo(void);
char * cgets(char *_str);
void clreol(void);
void clrscr(void);
int _conio_kbhit(void); /* checks for ungetch char */
//int cprintf(const char *_format, ...) __attribute__((format(printf,1,2)));
int cputs(const char *_str);
//int cscanf(const char *_format, ...) __attribute__((format(scanf,1,2)));
void delline(void);
int getch(void);
int getche(void);
int gettext(int _left, int _top, int _right, int _bottom, void *_destin);
void gettextinfo(struct text_info *_r);
void gotoxy(int _x, int _y);
void gppconio_init(void);
void highvideo(void);
void insline(void);
void intensevideo(void);
void lowvideo(void);
int movetext(int _left, int _top, int _right, int _bottom, int _destleft, int _desttop);
void normvideo(void);
int putch(int _c);
int puttext(int _left, int _top, int _right, int _bottom, void *_source);
void _setcursortype(int _type);
void _set_screen_lines(int _nlines);
void textattr(int _attr);
void textbackground(int _color);
void textcolor(int _color);
void textmode(int _mode);
int ungetch(int);
unsigned int wherex(void);
unsigned int wherey(void);
void window(int _left, int _top, int _right, int _bottom);
#define kbhit _conio_kbhit /* Who ever includes gppconio.h probably
also wants _conio_kbhit and not kbhit
from libc */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_conio_h_ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: ariadne $
* $Date: 1999/03/07 13:35:10 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/
#ifndef _LINUX_CTYPE_H
@@ -50,10 +50,18 @@
#define _ALPHA 0x0103
// additionally defined
#define _PRINT 0x0200
#define _GRAPH 0x0400
/* from DJGPP, see appropriate licence */
#define __dj_ISALNUM 0x0001
#define __dj_ISALPHA 0x0002
#define __dj_ISCNTRL 0x0004
#define __dj_ISDIGIT 0x0008
#define __dj_ISGRAPH 0x0010
#define __dj_ISLOWER 0x0020
#define __dj_ISPRINT 0x0040
#define __dj_ISPUNCT 0x0080
#define __dj_ISSPACE 0x0100
#define __dj_ISUPPER 0x0200
#define __dj_ISXDIGIT 0x0400
#ifdef __cplusplus
extern "C" {
@@ -72,7 +80,7 @@ int isupper(int c);
int isxdigit(int c);
#ifndef __STRICT_ANSI__
int _isctype (unsigned char c, int ctypeFlags);
int _isctype (int c, int ctypeFlags);
#endif
int tolower(int c);
@@ -103,20 +111,20 @@ int _toupper(int c);
typedef int wctype_t;
/* Wide character equivalents */
int iswalnum(int wc);
int iswalpha(int wc);
int iswascii(int wc);
int iswcntrl(int wc);
int iswctype(unsigned short wc, int wctypeFlags);
int is_wctype(unsigned short wc, int wctypeFlags); /* Obsolete! */
int iswdigit(int wc);
int iswgraph(int wc);
int iswlower(int wc);
int iswprint(int wc);
int iswpunct(int wc);
int iswspace(int wc);
int iswupper(int wc);
int iswxdigit(int wc);
int iswalnum(wint_t wc);
int iswalpha(wint_t wc);
int iswascii(wint_t wc);
int iswcntrl(wint_t wc);
int iswctype(wint_t wc, wctype_t wctypeFlags);
int is_wctype(wint_t wc, wctype_t wctypeFlags); /* Obsolete! */
int iswdigit(wint_t wc);
int iswgraph(wint_t wc);
int iswlower(wint_t wc);
int iswprint(wint_t wc);
int iswpunct(wint_t wc);
int iswspace(wint_t wc);
int iswupper(wint_t wc);
int iswxdigit(wint_t wc);
wchar_t towlower(wchar_t c);
wchar_t towupper(wchar_t c);
@@ -130,10 +138,10 @@ int __iscsymf (int c); /* Valid first character in C symbol */
int __iscsym (int c); /* Valid character in C symbol (after first) */
#ifndef _NO_OLDNAMES
#define isascii(c) (!((c)&(~0x7f)))
#define toascii(c) ((unsigned)(c) &0x7F)
#define iscsymf(c) (isalpha(c) || ( c == '_' ))
#define iscsym(c) (isalnum(c) || ( c == '_' ))
int isascii (int c);
int toascii (int c);
int iscsymf (int c);
int iscsym (int c);
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/

View File

@@ -0,0 +1,27 @@
#ifndef __include_direct_h_
#define __include_direct_h_
struct _diskfree_t {
unsigned short total_clusters;
unsigned short avail_clusters;
unsigned short sectors_per_cluster;
unsigned short bytes_per_sector;
};
int _chdrive( int drive );
int _getdrive( void );
char *_getcwd( char *buffer, int maxlen );
int _chdir(const char *_path);
char *_getcwd(char *, int);
int _mkdir(const char *_path);
int _rmdir(const char *_path);
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace);
#define chdir _chdir
#define getcwd _getcwd
#define mkdir _mkdir
#define rmdir _rmdir
#endif

View File

@@ -14,9 +14,9 @@
* DISCLAMED. This includeds but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/

View File

@@ -0,0 +1,158 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_h_
#define __dj_include_h_
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
struct ftime {
unsigned ft_tsec:5; /* 0-29, double to get real seconds */
unsigned ft_min:6; /* 0-59 */
unsigned ft_hour:5; /* 0-23 */
unsigned ft_day:5; /* 1-31 */
unsigned ft_month:4; /* 1-12 */
unsigned ft_year:7; /* since 1980 */
};
struct date {
short da_year;
char da_day;
char da_mon;
};
struct time {
unsigned char ti_min;
unsigned char ti_hour;
unsigned char ti_hund;
unsigned char ti_sec;
};
struct dfree {
unsigned df_avail;
unsigned df_total;
unsigned df_bsec;
unsigned df_sclus;
};
#ifdef __cplusplus
extern "C" {
#endif
extern unsigned short _osmajor, _osminor;
extern const char * _os_flavor;
unsigned short _get_version(int);
int getftime(int handle, struct ftime *ftimep);
int setftime(int handle, struct ftime *ftimep);
int getcbrk(void);
int setcbrk(int new_value);
void getdate(struct date *);
void gettime(struct time *);
void setdate(struct date *);
void settime(struct time *);
void getdfree(unsigned char drive, struct dfree *ptr);
void delay(unsigned msec);
/* int _get_default_drive(void);
void _fixpath(const char *, char *); */
/*
* For compatibility with other DOS C compilers.
*/
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_VOLID 0x08 /* Volume ID file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */
#define _enable enable
#define _disable disable
struct date_t {
unsigned char day; /* 1-31 */
unsigned char month; /* 1-12 */
unsigned short year; /* 1980-2099 */
unsigned char dayofweek; /* 0-6, 0=Sunday */
};
#define dosdate_t date_t
struct time_t {
unsigned char hour; /* 0-23 */
unsigned char minute; /* 0-59 */
unsigned char second; /* 0-59 */
unsigned char hsecond; /* 0-99 */
};
#define dostime_t time_t
#define finddata_t _finddata_t
#define diskfree_t _diskfree_t
struct _DOSERROR {
int exterror;
#ifdef __cplusplus
char errclass;
#else
char class;
#endif
char action;
char locus;
};
#define DOSERROR _DOSERROR
void _getdate(struct date_t *_date);
unsigned int _setdate(struct date_t *_date);
void _gettime(struct time_t *_time);
unsigned int _settime(struct time_t *_time);
unsigned int _getftime(int _handle, unsigned int *_p_date, unsigned int *_p_time);
unsigned int _setftime(int _handle, unsigned int _date, unsigned int _time);
unsigned int _getfileattr(const char *_filename, unsigned int *_p_attr);
unsigned int _setfileattr(const char *_filename, unsigned int _attr);
void _setdrive(unsigned int _drive, unsigned int *_p_drives);
int exterr(struct _DOSERROR *_p_error);
#define dosexterr(_ep) exterr(_ep)
#include <direct.h>
#define int386(_i, _ir, _or) int86(_i, _ir, _or)
#define int386x(_i, _ir, _or, _sr) int86x(_i, _ir, _or, _sr)
#ifdef __cplusplus
}
#endif
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#endif /* !__dj_include_h_ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/
@@ -96,10 +96,10 @@ extern "C" {
* sys_errlist.
*/
int* _errno(void);
#define errno (*_errno(void))
#define errno (*_errno())
int* __doserrno(void);
#define _doserrno (*__doserrno(void))
#define _doserrno (*__doserrno())
#if __MSVCRT__
/* One of the MSVCRTxx libraries */

View File

@@ -0,0 +1,164 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_fcntl_h_
#define __dj_include_fcntl_h_
#ifdef __cplusplus
extern "C" {
#endif
#define _IOREAD 000010
#define _IOWRT 000020
#define _IOMYBUF 000040
#define _IOEOF 000100
#define _IOERR 000200
#define _IOSTRG 000400
#define _IORW 001000
#define _IOAPPEND 002000
#define _IORMONCL 004000 /* remove on close, for temp files */
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#define FD_CLOEXEC 0x0001
#define F_DUPFD 1
#define F_GETFD 2
#define F_GETFL 3
#define F_GETLK 4
#define F_SETFD 5
#define F_SETFL 6
#define F_SETLK 7
#define F_SETLKW 8
#define F_UNLCK 0
#define F_RDLCK 1
#define F_WRLCK 2
#define O_RDONLY 0x0000
#define O_WRONLY 0x0001
#define O_RDWR 0x0002
#define O_ACCMODE 0x0003
#define O_BINARY 0x0004 /* must fit in char, reserved by dos */
#define O_TEXT 0x0008 /* must fit in char, reserved by dos */
#define O_RANDOM 0x0010
#define O_SEQUENTIAL 0x0020
#define O_TEMPORARY 0x0040
/* temporary access hint */
/* sequential/random access hints */
#define O_NOINHERIT 0x0080 /* DOS-specific */
#define O_CREAT 0x0100 /* second byte, away from DOS bits */
#define O_EXCL 0x0200
#define O_NOCTTY 0x0400
#define O_TRUNC 0x0800
#define O_APPEND 0x1000
#define O_NONBLOCK 0x2000
#define O_SHORT_LIVED 0x1000
//#include <sys/types.h>
#include <sys/stat.h>
//typedef int dev_t;
//typedef int ino_t;
//typedef int mode_t;
//typedef int nlink_t;
#include <io.h>
struct flock {
off_t l_len;
pid_t l_pid;
off_t l_start;
short l_type;
short l_whence;
};
extern int _fmode; /* O_TEXT or O_BINARY */
//int open(const char *_path, int _oflag, ...);
//int creat(const char *_path, int _mode);
int fcntl(int _fildes, int _cmd, ...);
#ifndef _POSIX_SOURCE
#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_IEXEC S_IXUSR
/*
* For compatibility with other DOS C compilers.
*/
#define _O_RDONLY O_RDONLY
#define _O_WRONLY O_WRONLY
#define _O_RDWR O_RDWR
#define _O_APPEND O_APPEND
#define _O_CREAT O_CREAT
#define _O_TRUNC O_TRUNC
#define _O_EXCL O_EXCL
#define _O_TEXT O_TEXT
#define _O_BINARY O_BINARY
#define _O_NOINHERIT O_NOINHERIT
#define _O_RANDOM O_RANDOM
#define _O_SEQUENTIAL O_RANDOM
#define _O_SHORT_LIVED O_SHORT_LIVED
#define _O_TEMPORARY O_TEMPORARY
#define _S_IREAD S_IRUSR
#define _S_IWRITE S_IWUSR
#define _S_IEXEC S_IXUSR
/*
* Support for advanced filesystems (Windows 9x VFAT, NTFS, LFN etc.)
*/
#define _FILESYS_UNKNOWN 0x80000000U
#define _FILESYS_CASE_SENSITIVE 0x0001
#define _FILESYS_CASE_PRESERVED 0x0002
#define _FILESYS_UNICODE 0x0004
#define _FILESYS_LFN_SUPPORTED 0x4000
#define _FILESYS_VOL_COMPRESSED 0x8000
unsigned _get_volume_info (const char *_path, int *_max_file_len, int *_max_path_len, char *_filesystype);
char _use_lfn (const char *_path);
char *_lfn_gen_short_fname (const char *_long_fname, char *_short_fname);
#define _LFN_CTIME 1
#define _LFN_ATIME 2
unsigned _lfn_get_ftime (int _handle, int _which);
char _preserve_fncase (void);
#define _USE_LFN _use_lfn(0) /* assume it's the same on ALL drives */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_fcntl_h_ */

View File

@@ -27,9 +27,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: ariadne $
* $Date: 1999/03/07 13:35:10 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/
@@ -146,15 +146,15 @@ unsigned int _controlfp (unsigned int unNew, unsigned int unMask);
unsigned int _control87 (unsigned int unNew, unsigned int unMask);
unsigned int _clearfp (void); /* Clear the FPU status word */
unsigned int _statusfp (void); /* Report the FPU status word */
unsigned int _clearfp (); /* Clear the FPU status word */
unsigned int _statusfp (); /* Report the FPU status word */
#define _clear87 _clearfp
#define _status87 _statusfp
void _fpreset (void); /* Reset the FPU */
void _fpreset (); /* Reset the FPU */
/* Global 'variable' for the current floating point error code. */
int * __fpecode(void);
int * __fpecode();
#define _fpecode (*(__fpecode()))
/*

View File

@@ -0,0 +1,94 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_io_h_
#define __dj_include_io_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#include <sys/types.h>
#include <internal/types.h>
/*
* For compatibility with other DOS C compilers.
*/
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_VOLID 0x08 /* Volume ID file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */
struct _finddata_t {
char reserved[21] __attribute__((packed));
unsigned char attrib __attribute__((packed));
unsigned short time_create __attribute__((packed));
unsigned short time_access __attribute__((packed));
unsigned short time_write __attribute__((packed));
unsigned long size __attribute__((packed));
char name[256] __attribute__((packed));
};
int chsize(int handle, long size);
int close(int _fd);
int _close(int _fd);
int _creat(const char *_path, int _attrib);
unsigned int _commit(int _handle);
ssize_t crlf2nl(char *_buffer, ssize_t _length);
int _dos_lock(int _fd, long _offset, long _length);
long filelength(int _handle);
long _findfirst(char *_name, struct _finddata_t *_result);
int _findnext(long handle, struct _finddata_t *_result);
int _findclose(long handle);
short _get_dev_info(int _arg);
int lock(int _fd, long _offset, long _length);
int _open(const char *_path, int _oflag, ...);
size_t _read(int _fd, void *_buf,size_t _nbyte);
int setmode(int _fd, int _newmode);
int _setmode(int _fd, int _newmode);
off_t tell(int _fd);
int _dos_unlock(int _fd, long _offset, long _length);
int unlock(int _fd, long _offset, long _length);
size_t _write(int _fd, const void *_buf, size_t _nbyte);
int _chmod(const char *_path, int _func, ...);
void _flush_disk_cache(void);
int _dup( int handle);
int _dup2( int handle1, int handle2 );
long _lseek(int _filedes, long _offset, int _whence);
int _open_osfhandle ( void *osfhandle, int flags );
#define open _open
#define dup _dup
#define dup2 _dup2
#define lseek _lseek
#define open_osfhandle _open_osfhandle
#define sopen(path, access, shflag, mode) \
open((path), (access)|(shflag), (mode))
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_io_h_ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/

View File

@@ -0,0 +1,52 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_process_h_
#define __dj_include_process_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
int _dos_exec(const char *program, const char *args, char *const _envp[]);
int execl(const char *_path, const char *_argv0, ...);
int execle(const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int execlp(const char *_path, const char *_argv0, ...);
int execlpe(const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int execv(const char *_path,const char *const _argv[]);
int execve(const char *_path,const char *const _argv[],const char *const _envp[]);
int execvp(const char *_path,const char *const _argv[]);
int execvpe(const char *_path,const char *const _argv[],const char *const _envp[]);
int spawnl(int _mode, const char *_path, const char *_argv0, ...);
int spawnle(int _mode, const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int spawnlp(int _mode, const char *_path, const char *_argv0, ...);
int spawnlpe(int _mode, const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int spawnv(int _mode, const char *_path,const char *const _argv[]);
int spawnve(int _mode, const char *_path,const char *const _argv[],const char *const _envp[]);
int spawnvp(int _mode, const char *_path,const char *const _argv[]);
int spawnvpe(int _mode, const char *_path,const char *const _argv[],const char *const _envp[]);
#define P_WAIT 1
#define P_NOWAIT 2 /* always generates error */
#define P_OVERLAY 3
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_process_h_ */

View File

@@ -14,4 +14,4 @@
#define _SH_DENYRD SH_DENYRD
#define _SH_DENYNO SH_DENYNO
#endif
#endif

View File

@@ -0,0 +1,35 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_signal_h_
#define __dj_include_signal_h_
#ifdef __cplusplus
extern "C" {
#endif
/* 256 software interrupts + 32 exceptions = 288 */
#define SIGABRT 288
#define SIGFPE 289
#define SIGILL 290
#define SIGSEGV 291
#define SIGTERM 292
#define SIGINT 295
#define SIG_DFL ((void (*)(int))(0))
#define SIG_ERR ((void (*)(int))(1))
#define SIG_IGN ((void (*)(int))(-1))
typedef int sig_atomic_t;
int raise(int _sig);
void (*signal(int _sig, void (*_func)(int)))(int);
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_signal_h_ */

View File

@@ -26,9 +26,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/02/21 13:29:56 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */

View File

@@ -28,9 +28,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/02/21 20:59:55 $
* $Revision: 1.1.2.1 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/

View File

@@ -0,0 +1,157 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_stdio_h_
#define __dj_include_stdio_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#include <sys/djtypes.h>
#define _IOFBF 00001
#define _IONBF 00002
#define _IOLBF 00004
#define BUFSIZ 16384
#define EOF (-1)
#define FILENAME_MAX 260
#define FOPEN_MAX 20
#define L_tmpnam 260
#ifndef NULL
#define NULL 0
#endif
#define TMP_MAX 999999
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define _IOREAD 000010
#define _IOWRT 000020
#define _IOMYBUF 000040
#define _IOEOF 000100
#define _IOERR 000200
#define _IOSTRG 000400
#define _IORW 001000
#define _IOAPPEND 002000
#define _IORMONCL 004000 /* remove on close, for temp files */
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */
#include <internal/types.h>
__DJ_va_list
#undef __DJ_va_list
#define __DJ_va_list
#ifndef _FILE_DEFINED
typedef struct {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _ungotchar;
int _bufsiz;
char *_name_to_remove;
} FILE;
#define _FILE_DEFINED
#endif
typedef unsigned long fpos_t;
extern FILE _iob[];
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
#define stdaux (&_iob[3])
#define stdprn (&_iob[4])
void clearerr(FILE *_stream);
int fclose(FILE *_stream);
int feof(FILE *_stream);
int ferror(FILE *_stream);
int fflush(FILE *_stream);
int fgetc(FILE *_stream);
int fgetpos(FILE *_stream, fpos_t *_pos);
char * fgets(char *_s, int _n, FILE *_stream);
FILE * fopen(const char *_filename, const char *_mode);
int fprintf(FILE *_stream, const char *_format, ...);
int fputc(int _c, FILE *_stream);
int fputs(const char *_s, FILE *_stream);
size_t fread(void *_ptr, size_t _size, size_t _nelem, FILE *_stream);
FILE * freopen(const char *_filename, const char *_mode, FILE *_stream);
int fscanf(FILE *_stream, const char *_format, ...);
int fseek(FILE *_stream, long _offset, int _mode);
int fsetpos(FILE *_stream, const fpos_t *_pos);
long ftell(FILE *_stream);
size_t fwrite(const void *_ptr, size_t _size, size_t _nelem, FILE *_stream);
int getc(FILE *_stream);
int getchar(void);
char * gets(char *_s);
void perror(const char *_s);
int printf(const char *_format, ...);
int putc(int _c, FILE *_stream);
int putchar(int _c);
int puts(const char *_s);
int remove(const char *_filename);
int rename(const char *_old, const char *_new);
void rewind(FILE *_stream);
int scanf(const char *_format, ...);
void setbuf(FILE *_stream, char *_buf);
int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
int sprintf(char *_s, const char *_format, ...);
int sscanf(const char *_s, const char *_format, ...);
FILE * tmpfile(void);
char * tmpnam(char *_s);
char * _tmpnam(char *_s);
int ungetc(int _c, FILE *_stream);
int vfprintf(FILE *_stream, const char *_format, va_list _ap);
int vprintf(const char *_format, va_list _ap);
int vsprintf(char *_s, const char *_format, va_list _ap);
#ifndef __STRICT_ANSI__
#define L_ctermid
#define L_cusrid
/* #define STREAM_MAX 20 - DOS can change this */
int fileno(FILE *_stream);
int _fileno(FILE *_stream);
FILE * fdopen(int _fildes, const char *_type);
int pclose(FILE *_pf);
FILE * popen(const char *_command, const char *_mode);
#ifndef _POSIX_SOURCE
void _djstat_describe_lossage(FILE *_to_where);
int _doprnt(const char *_fmt, va_list _args, FILE *_f);
int _doscan(FILE *_f, const char *_fmt, void **_argp);
int _doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, void **_argp);
int fpurge(FILE *_f);
int getw(FILE *_f);
int mkstemp(char *_template);
char * mktemp(char *_template);
int putw(int _v, FILE *_f);
void setbuffer(FILE *_f, void *_buf, int _size);
void setlinebuf(FILE *_f);
char * tempnam(const char *_dir, const char *_prefix);
int _rename(const char *_old, const char *_new); /* Simple (no directory) */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_stdio_h_ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
* $Revision: 1.1.2.2 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */

View File

@@ -0,0 +1,128 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_sys_stat_h_
#define __dj_include_sys_stat_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#define S_ISBLK(m) (((m) & 0xf000) == 0x1000)
#define S_ISCHR(m) (((m) & 0xf000) == 0x2000)
#define S_ISDIR(m) (((m) & 0xf000) == 0x3000)
#define S_ISFIFO(m) (((m) & 0xf000) == 0x4000)
#define S_ISREG(m) (((m) & 0xf000) == 0x0000)
#define S_ISUID 0x80000000
#define S_ISGID 0x40000000
#define S_IRUSR 00400
#define S_IRGRP 00040
#define S_IROTH 00004
#define S_IWUSR 00200
#define S_IWGRP 00020
#define S_IWOTH 00002
#define S_IXUSR 00100
#define S_IXGRP 00010
#define S_IXOTH 00001
#define S_IRWXU 00700
#define S_IRWXG 00070
#define S_IRWXO 00007
#include <sys/types.h>
#include <internal/types.h>
//#include <sys/djtypes.h>
__DJ_time_t
#undef __DJ_time_t
#define __DJ_time_t
struct stat {
time_t st_atime;
time_t st_ctime;
dev_t st_dev;
gid_t st_gid;
ino_t st_ino;
mode_t st_mode;
time_t st_mtime;
nlink_t st_nlink;
off_t st_size;
off_t st_blksize;
uid_t st_uid;
dev_t st_rdev; /* unused */
};
int chmod(const char *_path, mode_t _mode);
int fstat(int _fildes, struct stat *_buf);
//int mkdir(const char *_path, mode_t _mode);
int mkfifo(const char *_path, mode_t _mode);
int stat(const char *_path, struct stat *_buf);
mode_t umask(mode_t _cmask);
#ifndef _POSIX_SOURCE
/* POSIX.1 doesn't mention these at all */
#define S_IFMT 0xf000
#define S_IFREG 0x0000
#define S_IFBLK 0x1000
#define S_IFCHR 0x2000
#define S_IFDIR 0x3000
#define S_IFIFO 0x4000
#define S_IFFIFO S_IFIFO
#define S_IFLABEL 0x5000
#define S_ISLABEL(m) (((m) & 0xf000) == 0x5000)
void _fixpath(const char *, char *);
unsigned short _get_magic(const char *, int);
int _is_executable(const char *, int, const char *);
int mknod(const char *_path, mode_t _mode, dev_t _dev);
char * _truename(const char *, char *);
/* Bit-mapped variable _djstat_flags describes what expensive
f?stat() features our application needs. If you don't need a
feature, set its bit in the variable. By default, all the
bits are cleared (i.e., you get the most expensive code). */
#define _STAT_INODE 1 /* should we bother getting inode numbers? */
#define _STAT_EXEC_EXT 2 /* get execute bits from file extension? */
#define _STAT_EXEC_MAGIC 4 /* get execute bits from magic signature? */
#define _STAT_DIRSIZE 8 /* compute directory size? */
#define _STAT_ROOT_TIME 0x10 /* try to get root dir time stamp? */
#define _STAT_WRITEBIT 0x20 /* fstat() needs write bit? */
extern unsigned short _djstat_flags;
/* Bit-mapped variable _djstat_fail_bits describes which individual
undocumented features f?stat() failed to use. To get a human-
readable description of the bits, call _djstat_describe_lossage(). */
#define _STFAIL_SDA 1 /* Get SDA call failed */
#define _STFAIL_OSVER 2 /* Unsupported DOS version */
#define _STFAIL_BADSDA 4 /* Bad pointer to SDA */
#define _STFAIL_TRUENAME 8 /* _truename() failed */
#define _STFAIL_HASH 0x10 /* inode defaults to hashing */
#define _STFAIL_LABEL 0x20 /* Root dir, but no volume label */
#define _STFAIL_DCOUNT 0x40 /* dirent_count ridiculously large */
#define _STFAIL_WRITEBIT 0x80 /* fstat() failed to get write access bit */
#define _STFAIL_DEVNO 0x100 /* fstat() failed to get device number */
#define _STFAIL_BADSFT 0x200 /* SFT entry found, but can't be trusted */
#define _STFAIL_SFTIDX 0x400 /* bad SFT index in JFT */
#define _STFAIL_SFTNF 0x800 /* file entry not found in SFT array */
extern unsigned short _djstat_fail_bits;
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_sys_stat_h_ */

View File

@@ -0,0 +1,67 @@
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_sys_types_h_
#define __dj_include_sys_types_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#include <sys/djtypes.h>
typedef int dev_t;
typedef int ino_t;
typedef int mode_t;
typedef int nlink_t;
__DJ_gid_t
#undef __DJ_gid_t
#define __DJ_gid_t
__DJ_off_t
#undef __DJ_off_t
#define __DJ_off_t
__DJ_pid_t
#undef __DJ_pid_t
#define __DJ_pid_t
//__DJ_size_t
#undef __DJ_size_t
#define __DJ_size_t
__DJ_ssize_t
#undef __DJ_ssize_t
#define __DJ_ssize_t
__DJ_uid_t
#undef __DJ_uid_t
#define __DJ_uid_t
#ifndef _POSIX_SOURCE
/* Allow including program to override. */
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
#endif
typedef struct fd_set {
unsigned char fd_bits [((FD_SETSIZE) + 7) / 8];
} fd_set;
#define FD_SET(n, p) ((p)->fd_bits[(n) / 8] |= (1 << ((n) & 7)))
#define FD_CLR(n, p) ((p)->fd_bits[(n) / 8] &= ~(1 << ((n) & 7)))
#define FD_ISSET(n, p) ((p)->fd_bits[(n) / 8] & (1 << ((n) & 7)))
#define FD_ZERO(p) memset ((void *)(p), 0, sizeof (*(p)))
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_sys_types_h_ */

View File

@@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: ariadne $
* $Date: 1999/02/21 13:29:57 $
* $Revision: 1.1.2.2 $
* $Author: dwelch $
* $Date: 1999/03/15 16:19:26 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */

View File

@@ -1,4 +1,5 @@
extern POBJECT_TYPE ExEventType;
typedef ULONG INTERLOCKED_RESULT;
typedef ULONG WORK_QUEUE_TYPE;

View File

@@ -4,11 +4,6 @@
#define CTL_CODE(Dev, Func, Meth, Acc) ( ((Dev)<<16) | ((Acc)<<14) | ((Func)<<2) | (Meth))
#define DEVICE_TYPE_FROM_CTL_CODE(ctlCode) (((ULONG)(ctlCode&0xffff0000))>>16)
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
// IOCTL Parameter buffering methods
#define METHOD_BUFFERED 0
#define METHOD_IN_DIRECT 1

View File

@@ -242,12 +242,6 @@ enum
#define FILE_EXISTS 0x0004
#define FILE_DOES_NOT_EXIST 0x0005
/*
* ByteOffset parameter : special values
*/
#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
/*
* file creation flags

View File

@@ -152,10 +152,6 @@ typedef struct _IO_STACK_LOCATION
HANDLE DeleteHandle;
} u;
} SetFile;
/*
* This is a guess
*/
struct
{
ULONG Length;
@@ -175,14 +171,7 @@ typedef struct _IO_STACK_LOCATION
typedef struct _IO_STATUS_BLOCK
{
/*
* Is the completion status
*/
NTSTATUS Status;
/*
* Is a request dependant value
*/
ULONG Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;

View File

@@ -147,13 +147,7 @@ typedef struct
} KSEMAPHORE, *PKSEMAPHORE;
typedef struct _KEVENT
/*
* PURPOSE: Describes an event
*/
{
/*
* PURPOSE: So we can use the general wait routine
*/
DISPATCHER_HEADER Header;
} KEVENT, *PKEVENT;
@@ -222,7 +216,7 @@ typedef struct _WAIT_CONTEXT_BLOCK
struct _KINTERRUPT;
typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
PVOID ServiceContext);
PVOID ServiceContext);
typedef struct _KINTERRUPT
{

View File

@@ -1,15 +0,0 @@
#ifndef _BEEP_H_INCLUDED_
#define _BEEP_H_INCLUDED_
#define IOCTL_BEEP_SET CTL_CODE(FILE_DEVICE_BEEP,0,METHOD_BUFFERED,FILE_ANY_ACCESS)
typedef struct tagBEEP_SET_PARAMETERS
{
ULONG Frequency;
ULONG Duration;
} BEEP_SET_PARAMETERS, *PBEEP_SET_PARAMETERS;
#define BEEP_FREQUENCY_MINIMUM 0x25
#define BEEP_FREQUENCY_MAXIMUM 0x7FFF
#endif /* _BEEP_H_INCLUDED_ */

View File

@@ -38,9 +38,9 @@ extern "C"
#include <ddk/pstypes.h>
#include <ddk/zwtypes.h>
#include <ddk/ioctrl.h>
#include <internal/hal/ddk.h>
#include <ddk/rtl.h>
#include <internal/hal/ddk.h>
#include <ddk/zw.h>
#include <ddk/cmfuncs.h>
#include <ddk/exfuncs.h>

View File

@@ -280,33 +280,21 @@ typedef struct {
// Heap creation routine
HANDLE
STDCALL
RtlCreateHeap(
ULONG Flags,
PVOID BaseAddress,
ULONG SizeToReserve,
ULONG SizeToCommit,
PVOID Unknown,
PRTL_HEAP_DEFINITION Definition
);
HANDLE STDCALL RtlCreateHeap(ULONG Flags,
PVOID BaseAddress,
ULONG SizeToReserve,
ULONG SizeToCommit,
PVOID Unknown,
PRTL_HEAP_DEFINITION Definition);
PVOID
STDCALL
RtlAllocateHeap(
HANDLE Heap,
ULONG Flags,
ULONG Size
);
PVOID STDCALL RtlAllocateHeap(HANDLE Heap,
ULONG Flags,
ULONG Size);
BOOLEAN
STDCALL
RtlFreeHeap(
HANDLE Heap,
ULONG Flags,
PVOID Address
);
BOOLEAN STDCALL RtlFreeHeap(HANDLE Heap,
ULONG Flags,
PVOID Address);
NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString,
IN PUNICODE_STRING SourceString,
@@ -337,6 +325,15 @@ DWORD RtlNtStatusToDosError(NTSTATUS StatusCode);
BOOL WINAPI RtlDestroyHeap(HANDLE hheap);
LPVOID STDCALL RtlReAllocHeap(HANDLE hheap, DWORD flags, LPVOID ptr,
DWORD size);
HANDLE WINAPI RtlGetProcessHeap(VOID);
BOOL WINAPI RtlLockHeap(HANDLE hheap);
BOOL WINAPI RtlUnlockHeap(HANDLE hheap);
UINT RtlCompactHeap(HANDLE hheap, DWORD flags);
DWORD WINAPI RtlSizeHeap(HANDLE hheap, DWORD flags, PVOID pmem);
BOOL WINAPI RtlValidateHeap(HANDLE hheap, DWORD flags, PVOID pmem);
#endif /* __DDK_RTL_H */

View File

@@ -108,7 +108,7 @@ enum
STATUS_ALREADY_DISCONNECTED,
STATUS_LONGJUMP,
STATUS_UNSUCCESSFUL=0xC0000001,
STATUS_UNSUCCESSFUL=0xC0000001,
STATUS_NOT_IMPLEMENTED,
STATUS_INVALID_INFO_CLASS,
STATUS_INFO_LENGTH_MISMATCH,
@@ -123,6 +123,8 @@ enum
STATUS_INVALID_PARAMETER,
STATUS_NO_SUCH_DEVICE,
STATUS_NO_SUCH_FILE,
// c0000010
STATUS_INVALID_DEVICE_REQUEST,
STATUS_END_OF_FILE,
STATUS_WRONG_VOLUME,
@@ -139,6 +141,8 @@ enum
STATUS_ILLEGAL_INSTRUCTION,
STATUS_INVALID_LOCK_SEQUENCE,
STATUS_INVALID_VIEW_SIZE,
// c0000020
STATUS_INVALID_FILE_FOR_SECTION,
STATUS_ALREADY_COMMITTED,
STATUS_ACCESS_DENIED,

View File

@@ -15,15 +15,11 @@
#ifndef __DDK_ZW_H
#define __DDK_ZW_H
#include <windows.h>
//#ifndef WIN32_LEAN_AND_MEAN
#define PTOKEN_USER PVOID
#define PTOKEN_GROUPS PVOID
#define PTOKEN_OWNER PVOID
#define PTOKEN_PRIVILEGES PVOID
#define PTOKEN_PRIMARY_GROUP PVOID
#define PTOKEN_DEFAULT_DACL PVOID
#define PTOKEN_SOURCE PVOID
#define TOKEN_INFORMATION_CLASS CINT
#define LCID ULONG
#define SECURITY_INFORMATION ULONG
@@ -325,16 +321,13 @@ NtAllocateVirtualMemory(
IN ULONG Protect
);
NTSTATUS
STDCALL
ZwAllocateVirtualMemory(
IN HANDLE ProcessHandle,
IN OUT PVOID *BaseAddress,
IN ULONG ZeroBits,
IN OUT PULONG RegionSize,
IN ULONG AllocationType,
IN ULONG Protect
);
NTSTATUS STDCALL ZwAllocateVirtualMemory(IN HANDLE ProcessHandle,
IN OUT PVOID *BaseAddress,
IN ULONG ZeroBits,
IN OUT PULONG RegionSize,
IN ULONG AllocationType,
IN ULONG Protect);
/*
* FUNCTION: Returns from a callback into user mode
* ARGUMENTS:
@@ -1084,63 +1077,6 @@ ZwCreateTimer(
IN CINT TimerType
);
/*
* FUNCTION: Creates a token.
* ARGUMENTS:
* TokenHandle (OUT) = Caller supplied storage for the resulting handle
* DesiredAccess = Specifies the allowed or desired access to the process can
* be a combinate of STANDARD_RIGHTS_REQUIRED| ..
* ObjectAttribute = Initialized attributes for the object, contains the rootdirectory and the filename
* TokenType =
* AuthenticationId =
* ExpirationTime =
* TokenUser =
* TokenGroups =
* TokenPrivileges =
* TokenOwner =
* TokenPrimaryGroup =
* TokenDefaultDacl =
* TokenSource =
* REMARKS:
* This function does not map to a win32 function
* RETURNS: Status
*/
NTSTATUS
STDCALL
NtCreateToken(
OUT PHANDLE TokenHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN TOKEN_TYPE TokenType,
IN PLUID AuthenticationId,
IN PLARGE_INTEGER ExpirationTime,
IN PTOKEN_USER TokenUser,
IN PTOKEN_GROUPS TokenGroups,
IN PTOKEN_PRIVILEGES TokenPrivileges,
IN PTOKEN_OWNER TokenOwner,
IN PTOKEN_PRIMARY_GROUP TokenPrimaryGroup,
IN PTOKEN_DEFAULT_DACL TokenDefaultDacl,
IN PTOKEN_SOURCE TokenSource
);
NTSTATUS
STDCALL
ZwCreateToken(
OUT PHANDLE TokenHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN TOKEN_TYPE TokenType,
IN PLUID AuthenticationId,
IN PLARGE_INTEGER ExpirationTime,
IN PTOKEN_USER TokenUser,
IN PTOKEN_GROUPS TokenGroups,
IN PTOKEN_PRIVILEGES TokenPrivileges,
IN PTOKEN_OWNER TokenOwner,
IN PTOKEN_PRIMARY_GROUP TokenPrimaryGroup,
IN PTOKEN_DEFAULT_DACL TokenDefaultDacl,
IN PTOKEN_SOURCE TokenSource
);
/*
* FUNCTION: Returns the callers thread TEB.
@@ -5137,6 +5073,7 @@ NTSTATUS STDCALL NtCompleteConnectPort(VOID);
NTSTATUS STDCALL NtConnectPort(VOID);
NTSTATUS STDCALL NtCreatePort(VOID);
NTSTATUS STDCALL NtCreateToken(VOID);
NTSTATUS STDCALL NtGetPlugPlayEvent(VOID);
NTSTATUS STDCALL NtImpersonateClientOfPort(VOID);

View File

@@ -13,4 +13,4 @@ typedef struct
PVOID DevCapsRoutine;
PVOID HwSetVolume;
ULONG IoMethod;
}SOUND_DEVICE_INIT;
}SOUND_DEVICE_INIT;

View File

@@ -1,63 +0,0 @@
/*
* direct.h
*
* Functions for manipulating paths and directories (included from dir.h)
* plus functions for setting the current drive.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _DIRECT_H_
#define _DIRECT_H_
#include <dir.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _diskfree_t {
unsigned long total_clusters;
unsigned long avail_clusters;
unsigned long sectors_per_cluster;
unsigned long bytes_per_sector;
};
#define diskfree_t _diskfree_t
/*
* You really shouldn't be using these. Use the Win32 API functions instead.
* However, it does make it easier to port older code.
*/
int _chdrive (int nDrive);
char* _getdcwd (int nDrive, char* caBuffer, int nBufLen);
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace);
#ifdef __cplusplus
}
#endif
#endif /* Not _DIRECT_H_ */
#endif /* Not __STRICT_ANSI__ */

View File

@@ -1,68 +0,0 @@
/*
* dos.h
*
* Definitions for MS-DOS interface routines
*
* This header file is meant for use with CRTDLL.DLL as included with
* Windows 95(tm) and Windows NT(tm). In conjunction with other versions
* of the standard C library things may or may not work so well.
*
* Contributors:
* Created by J.J. van der Heijden <J.J.vanderHeijden@student.utwente.nl>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef __STRICT_ANSI__
#ifndef _DOS_H_
#define _DOS_H_
#define __need_wchar_t
#include <stddef.h>
/* For DOS file attributes */
#include <dir.h>
#ifdef __cplusplus
extern "C" {
#endif
extern char** __imp__pgmptr_dll;
#define _pgmptr (*__imp__pgmptr_dll)
/* Wide character equivalent */
extern wchar_t** __imp__wpgmptr_dll;
#define _wpgmptr (*__imp__wpgmptr_dll)
/* These are obsolete, but some may find them useful */
extern unsigned int* __imp__basemajor_dll;
extern unsigned int* __imp__baseminor_dll;
extern unsigned int* __imp__baseversion_dll;
extern unsigned int* __imp__osmajor_dll;
extern unsigned int* __imp__osminor_dll;
extern unsigned int* __imp__osversion_dll;
#define _basemajor (*__imp__basemajor_dll)
#define _baseminor (*__imp__baseminor_dll)
#define _baseversion (*__imp__baseversion_dll)
#define _osmajor (*__imp__osmajor_dll)
#define _osminor (*__imp__osminor_dll)
#define _osversion (*__imp__osversion_dll)
#ifdef __cplusplus
}
#endif
#endif /* _DOS_H_ */
#endif /* Not __STRICT_ANSI__ */

View File

@@ -1,121 +0,0 @@
/*
* excpt.h
*
* Support for operating system level structured exception handling.
*
* NOTE: This is very preliminary stuff. I am also pretty sure it is
* completely Intel specific.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
* Based on code by Mikey <jeffdb@netzone.com>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/03/07 13:35:10 $
*
*/
#ifndef _EXCPT_H_
#define _EXCPT_H_
#ifndef __STRICT_ANSI__
#include <windows.h>
/*
* NOTE: The constants structs and typedefs below should be defined in the
* Win32 API headers.
*/
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
#ifndef RC_INVOKED
typedef enum {
ExceptionContinueExecution,
ExceptionContinueSearch,
ExceptionNestedException,
ExceptionCollidedUnwind
} EXCEPTION_DISPOSITION;
/*
* End of stuff that should be in the Win32 API files.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* The type of function that is expected as an exception handler to be
* installed with _try1.
*/
typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)
(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
/*
* This is not entirely necessary, but it is the structure installed by
* the _try1 primitive below.
*/
typedef struct _EXCEPTION_REGISTRATION
{
struct _EXCEPTION_REGISTRATION* prev;
PEXCEPTION_HANDLER handler;
} EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
/*
* A macro which installs the supplied exception handler.
* Push the pointer to the new handler onto the stack,
* then push the pointer to the old registration structure (at fs:0)
* onto the stack, then put a pointer to the new registration
* structure (i.e. the current stack pointer) at fs:0.
*/
#define __try1(pHandler) \
__asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
/*
* A macro which (dispite its name) *removes* an installed
* exception handler. Should be used only in conjunction with the above
* install routine __try1.
* Move the pointer to the old reg. struct (at the current stack
* position) to fs:0, replacing the pointer we installed above,
* then add 8 to the stack pointer to get rid of the space we
* used when we pushed on our new reg. struct above. Notice that
* the stack must be in the exact state at this point that it was
* after we did _try1 or this will smash things.
*/
#define __except1 \
__asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
: : : "%eax");
#ifdef __cplusplus
}
#endif
#endif /* Not RC_INVOKED */
#endif /* Not strict ANSI */
#endif /* _EXCPT_H_ not defined */

Some files were not shown because too many files have changed in this diff Show More