mirror of
https://github.com/reactos/reactos
synced 2025-10-07 08:52:45 +02:00
Compare commits
7 Commits
backups/sc
...
ReactOS-0.
Author | SHA1 | Date | |
---|---|---|---|
|
0b545b592e | ||
|
935b7c2953 | ||
|
1b7327da76 | ||
|
f77c44657c | ||
|
df0328b7cc | ||
|
94c8483b04 | ||
|
fc7e59ce74 |
1
reactos/boot.bat
Normal file
1
reactos/boot.bat
Normal file
@@ -0,0 +1 @@
|
||||
loaders\dos\loadros ntoskrnl\kimage.bin %1 %2 %3 %4
|
340
reactos/copying_rex
Normal file
340
reactos/copying_rex
Normal file
@@ -0,0 +1,340 @@
|
||||
|
||||
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.
|
140
reactos/doc/api.txt
Normal file
140
reactos/doc/api.txt
Normal file
@@ -0,0 +1,140 @@
|
||||
This file attempts to document the functions made publically available by
|
||||
the various subsystems.
|
||||
|
||||
* Formatted I/O operations *
|
||||
|
||||
NAME: int vsprintf(char *buf, const char *fmt, va_list args)
|
||||
NAME: int sprintf(char* buf, const char* fmt, ...)
|
||||
WHERE: internal/kernel.h
|
||||
FUNCTION: The same as the standard c library versions
|
||||
|
||||
* PIO operations *
|
||||
|
||||
NAME: in[b/w/l](port)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Read an IO port of the specified size (byte/word or long)
|
||||
RETURNS: The value read
|
||||
|
||||
NAME: out[b/w/l](port,val)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Write an IO port of the specified size (byte/word or long)
|
||||
|
||||
NAME: in_p[b/w/l](port)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Read an IO port of the specified size (byte/word or long) with
|
||||
a pause
|
||||
RETURNS: The value read
|
||||
|
||||
NAME: out_p[b/w/l](port,val)
|
||||
WHERE: internal/io.h
|
||||
FUNCTION: Write an IO port of the specified size (byte/word or long) with
|
||||
a pause
|
||||
|
||||
* Bit operations *
|
||||
|
||||
NAME: int set_bit(int nr, void* addr)
|
||||
NAME: int clear_bit(int nr, void* addr)
|
||||
NAME: int change_bit(int nr, void* addr)
|
||||
WHERE: internal/bitops.h>
|
||||
FUNCTION: Operate on a bit in the word pointed to by addr
|
||||
RETURN: 0 if the bit was cleared before the operations
|
||||
non-zero otherwise
|
||||
|
||||
* Debugging functions *
|
||||
|
||||
NAME: DPRINT(fmt,....)
|
||||
WHERE: internal/debug.h
|
||||
FUNCTION: Outputs a string to the console if NDEBUG isn't defined before
|
||||
including internal/debug.h, a NOP otherwise
|
||||
ARGUMENTS: The same as printf
|
||||
|
||||
NAME: printk
|
||||
WHERE: internal/kernel.h
|
||||
FUNCTION: Outputs a string to the console
|
||||
ARGUMENTS: The same as printf
|
||||
|
||||
* Memory managment functions *
|
||||
|
||||
NAME: unsigned int physical_to_linear(unsigned int paddr)
|
||||
WHERE: hal/page.h
|
||||
FUNCTION: Converts a physical address to a linear one
|
||||
RECEIVES:
|
||||
paddr = the physical address to convert
|
||||
RETURNS: A virtual address where the memory at that physical address can be
|
||||
accessed
|
||||
|
||||
NAME: void* ExAllocatePool(unsigned int size, unsigned int type = 0);
|
||||
WHERE: internal/pool.h
|
||||
FUNCTION: Allocates a block of memory
|
||||
RECEIVES:
|
||||
size = the size of the block to allocate
|
||||
type = will be whether to allocate pagable memory
|
||||
RETURNS: The address of the block
|
||||
NOTE: This isn't interrupt safe
|
||||
|
||||
NAME: void ExFreePool(void* block)
|
||||
WHERE: internal/pool.h
|
||||
FUNCTION: Frees a block of memory
|
||||
|
||||
NAME: void free_page(unsigned int physical_base, unsigned int nr = 1)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Adds a continuous range of physical memory to the free list
|
||||
|
||||
NAME: unsigned int get_free_page(void)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets a free page
|
||||
RETURNS: Its physical address
|
||||
|
||||
NAME: unsigned int get_page_physical_address(unsigned int vaddr)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets the physical address of a page
|
||||
|
||||
NAME: void mark_page_not_writable(unsigned int vaddr)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Prevent writing the page
|
||||
|
||||
* DMA functions *
|
||||
|
||||
NAME: unsigned int get_dma_page(unsigned int max_address)
|
||||
WHERE: internal/mm.h
|
||||
FUNCTION: Gets a page with a restricted physical address i.e. suitable for
|
||||
dma
|
||||
RETURNS: The physical address of the page
|
||||
|
||||
NAME: void disable_dma(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Disables the specified dma channel
|
||||
|
||||
NAME: void enable_dma(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Enables the specified dma channel
|
||||
|
||||
NAME: void clear_dma_ff(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Clear the dma flip-flop
|
||||
|
||||
NAME: void set_dma_mode(unsigned int dmanr, char mode)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Sets the type of dma transfer
|
||||
|
||||
NAME: void set_dma_page(unsigned int dmanr, char pagenr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Set only the page register bits of the transfer address
|
||||
|
||||
NAME: void set_dma_addr(unsigned int dmanr, unsigned int a)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Set the transfer address for dma
|
||||
NOTE: Assumes flip-flop is clear
|
||||
|
||||
NAME: void set_dma_count(unsigned int dmanr, unsigned int count)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Sets the size of the transfer
|
||||
ARGUMENTS:
|
||||
count = the number of bytes to transfer
|
||||
NOTE: Count must be even for channels 5-7
|
||||
|
||||
NAME: int get_dma_residue(unsigned int dmanr)
|
||||
WHERE: internal/dma.h
|
||||
FUNCTION: Gets the residue remaining after a dma transfer on the channel
|
||||
|
||||
|
2
reactos/doc/buglist
Normal file
2
reactos/doc/buglist
Normal file
@@ -0,0 +1,2 @@
|
||||
* Kernel bugs not fixed
|
||||
|
27
reactos/doc/ddkfuncs.txt
Normal file
27
reactos/doc/ddkfuncs.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
This is a list of the functions documented in the ddk that have been
|
||||
implemented
|
||||
|
||||
IoAllocateController
|
||||
IoFreeController
|
||||
IoCreateController
|
||||
IoDeleteController
|
||||
IoStartNextPacket
|
||||
IoStartNextPacketByKey
|
||||
IoStartPacket
|
||||
IoSizeOfIrp
|
||||
IoMarkIrpPending
|
||||
IoFreeIrp
|
||||
IoConnectInterrupt
|
||||
IoDisconnectInterrupt
|
||||
IoGetCurrentIrpStackLocation
|
||||
IoGetNextIrpStackLocation
|
||||
IoRequestDpc
|
||||
IoInitializeDpc
|
||||
IoInitializeTimer
|
||||
IoStartTimer
|
||||
IoStopTimer
|
||||
|
||||
Partially implemented
|
||||
|
||||
IoCreateDevice
|
||||
IoCallDriver
|
19
reactos/doc/debug.txt
Normal file
19
reactos/doc/debug.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Some notes on debugging the ReactOS kernel
|
||||
------------------------------------------
|
||||
|
||||
* Interpreting crashes
|
||||
|
||||
If the kernel causes a fatal cpu fault then it will print out a message and
|
||||
halt. This message contains important information for debugging the problem,
|
||||
look for these lines
|
||||
|
||||
Exception: xx(yy)
|
||||
CS:EIP 20:zzzzzzzzzzzz
|
||||
|
||||
Here xx is the type of error, usually either 14 or 13 and yy is the error
|
||||
code. Generally error codes 13 and 14 both mean the kernel tried to access
|
||||
some memory in an invalid way. zzzzzzzzz is the address of the erronous
|
||||
instruction.
|
||||
|
||||
* Debugging with bochs
|
||||
|
114
reactos/doc/faq.txt
Normal file
114
reactos/doc/faq.txt
Normal file
@@ -0,0 +1,114 @@
|
||||
Kernel Development FAQ (for v0.0.7)
|
||||
|
||||
This attempts to answer some of the common questions people developing for
|
||||
the kernel might want to ask (or at least what I think they should ask).
|
||||
Obviously I can only detail those parts which I have written so other
|
||||
developers please fill in the gaps.
|
||||
|
||||
Q: What is this, what are you people, what's going on
|
||||
A: This is the ReactOS, an operating system intended as a clone of windows
|
||||
NT. See the project website (http://www.sid-dis.com/reactos/) for more details.
|
||||
|
||||
Q: Why ReactOS
|
||||
A: To condemn Bill Gates to penury.
|
||||
|
||||
Q: What do I need to compile the kernel
|
||||
A: DJGPP, get it from http://www.delorie.com/djgpp
|
||||
|
||||
Q: How do I compile the kernel
|
||||
A: Unpack the zip. It is important not to install the kernel in the same
|
||||
directory as a previous version, this has caused a bit of confusion in the
|
||||
past. Edit the makefile in the top level directory, in particular select the
|
||||
correct host to build from. Then run make in the top directory
|
||||
|
||||
Q: What files are created when I make the kernel
|
||||
A: The following files are created in the kernel directory
|
||||
kimage = the kernel as a coff executable
|
||||
kimage.bin = the kernel as a raw binary image
|
||||
kernel.sym = a list of the kernel symbols
|
||||
|
||||
Q: How do I load the kernel
|
||||
A: Run the boot.bat batch file.
|
||||
|
||||
Q: Does it boot from disk
|
||||
A: Not at the moment.
|
||||
|
||||
Q: When I run the kernel it crashes
|
||||
A: The kernel (at the moment) can only be loaded from a clean system. That
|
||||
is one without EMM386 or any version of windows loaded. A quick way to
|
||||
ensure this (if you have windows 95) is to set the program to run in msdos
|
||||
mode and specify an empty config.sys and autoexec.bat. See the windows help
|
||||
for more information.
|
||||
|
||||
If you do that and the problem persists then contact the kernel team
|
||||
(ros-kernel@sid-dis.com) as it is probably a bug in the kernel
|
||||
|
||||
Q6: How do I load a module with the kernel
|
||||
A: Add the names of any modules to be loaded to the command line of boot.bat.
|
||||
|
||||
Q7: I want to add code to the kernel, how do I get it to be compiled
|
||||
A: You will need to edit the Makefile in kernel directory. There should be
|
||||
a statement like this
|
||||
|
||||
OBJECTS = hal/head.o hal/exp.o kernel/vsprintf.o \
|
||||
....
|
||||
kernel/irqhand.o hal/page.o mm/virtual.o kernel/error.o \
|
||||
kernel/exports.o kernel/module.o
|
||||
|
||||
Add the name of the object file (the file produced when your code is
|
||||
compiled) to the end of the statement (in this case after kernel/module.o).
|
||||
If you need to go onto a new line then add a slash to the end of the
|
||||
previous line. It is also very important to use an editor which preserves
|
||||
tabs.
|
||||
|
||||
Q8: I want to add code to the kernel, how do I make it official
|
||||
A: Contact the kernel mailing list ros-kernel@sid-dis.com or our coordinator
|
||||
dwinkley@whitworth.edu. If it is for a specific section then the kernel
|
||||
website (http://www.geocities.com/SiliconValley/Peaks/1957) has a list of
|
||||
those working on individual areas, you might what to contact one of them
|
||||
instead.
|
||||
|
||||
Q9: What header files should I use
|
||||
A: Don't include the usual DJGPP headers like stdio.h unless you are using
|
||||
something compiler based like stdargs.h. To use the DJGPP headers requires
|
||||
linking with libc which is useless in kernel mode.
|
||||
|
||||
All the header files are in the top-level include directory which is laid
|
||||
out like this
|
||||
include = general win32 api declarations
|
||||
include/internal = private kernel headers
|
||||
include/internal/hal = HAL headers
|
||||
include/ddk = header files with declarations for modules
|
||||
|
||||
There should be a file called api.txt which documents all of the functions
|
||||
(and which header files they need).
|
||||
|
||||
Q11: I want to export my function for modules to use, how do I do that
|
||||
A: Add the function to the list in kernel/exports.lst, then remake the
|
||||
kernel. Note the function must be declared as extern "C".
|
||||
|
||||
Q12: I want to make my functions part of the kernel interface to user mode,
|
||||
A: That section isn't finished yet, though it will probably mean adding a
|
||||
pointer to the function and the size of its parameters to a internal table
|
||||
somewhere.
|
||||
|
||||
Q14: I want to write a module, what are the guidelines
|
||||
A: See modules.txt in this directory
|
||||
|
||||
Q15: I want to write an ISR (interrupt service routine)
|
||||
A: See irq.txt in this directory
|
||||
|
||||
Q16: I want to use DMA
|
||||
A: Firstly this answer covers only DMA via the dma chips *not*
|
||||
busmaster DMA.
|
||||
|
||||
To program the dma chip use the functions in internal/dma.h (look in api.txt
|
||||
for details). PC DMA can only go to memory with a physical address below
|
||||
1mb (or 16mb on some systems), use the get_dma_page to allocate this kind
|
||||
of memory.
|
||||
|
||||
Q17: You haven't answered my question
|
||||
A: Send your questions to ros-kernel@sid-dis.com
|
||||
|
||||
|
||||
- David Welch (welch@mcmail.com)
|
10
reactos/doc/internal/mm.txt
Normal file
10
reactos/doc/internal/mm.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
This document describes the implementation of the memory managment
|
||||
|
||||
|
||||
* ReactOS memory map
|
||||
|
||||
0x00000000 - 0xc0000000 = User memory
|
||||
0xc0000000 - 0xd0000000 = Kernel memory
|
||||
0xd0000000 - 0xffffffff = Identify map of physical memory
|
||||
|
||||
*
|
1253
reactos/doc/internal/pe.txt
Normal file
1253
reactos/doc/internal/pe.txt
Normal file
File diff suppressed because it is too large
Load Diff
2
reactos/doc/internal/readme.txt
Normal file
2
reactos/doc/internal/readme.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
This contains documentation describing the internals of the various kernel
|
||||
subsystems and a few other useful bits of information.
|
135
reactos/doc/irq.txt
Normal file
135
reactos/doc/irq.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
** Introduction
|
||||
|
||||
This attempts to document the ReactOS irq handling. As of v0.0.8 this has
|
||||
changed to be more nt like, I will attempt to summarize the new
|
||||
implementation for those unavailable with nt device driver writing. Note,
|
||||
ReactOS doesn't have an exact implementation but the omissions are, except
|
||||
where noted, not user visible.
|
||||
|
||||
** Steps in grabbing an irq vector
|
||||
|
||||
* Call HalConnectInterrupt
|
||||
|
||||
PROTOTYPE:
|
||||
|
||||
ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType,
|
||||
ULONG BusNumber,
|
||||
ULONG BusInterruptLevel,
|
||||
ULONG BusInterruptVector,
|
||||
OUT PKIRQL Irql,
|
||||
OUT PKAFFINITY Affinity)
|
||||
|
||||
PURPOSE:
|
||||
|
||||
Translates a bus dependant interrupt vector to a system vector
|
||||
|
||||
ARGUMENTS:
|
||||
|
||||
InterfaceType = Type of bus to which the device to receive interrupts
|
||||
from is connected to. Currently only 'Internal' is
|
||||
recognized
|
||||
BusNumber = Number of the bus the device is connected to
|
||||
(currently ignored)
|
||||
BusInterruptLevel = Bus specific interrupt level (currently ignored)
|
||||
BusInterruptVector = Bus specific vector. Currently this is the same
|
||||
as the normal vector (09 is the keyboard vector
|
||||
for example)
|
||||
Irql = On return contains the DIRQL for the vector
|
||||
Affinity = On return contains the affinity mask for the vector
|
||||
(currently unimplemented)
|
||||
|
||||
RETURNS:
|
||||
The system mapped vector
|
||||
|
||||
* Call IoConnectInterrupt
|
||||
|
||||
PROTOTYPE:
|
||||
|
||||
NTSTATUS IoConnectInterrupt(OUT PKINTERRUPT* InterruptObject,
|
||||
PKSERVICE_ROUTINE ServiceRoutine,
|
||||
PVOID ServiceContext,
|
||||
PKSPIN_LOCK SpinLock,
|
||||
ULONG Vector,
|
||||
KIRQL Irql,
|
||||
KIRQL SynchronizeIrql,
|
||||
KINTERRUPT_MODE InterruptMode,
|
||||
BOOLEAN ShareVector,
|
||||
KAFFINITY ProcessorEnableMask,
|
||||
BOOLEAN FloatingSave)
|
||||
|
||||
PURPOSE:
|
||||
|
||||
Connect a service routine to an interrupt vector
|
||||
|
||||
ARGUMENTS:
|
||||
|
||||
InterruptObject = Points to an object describes the interrupt on
|
||||
return
|
||||
ServiceRoutine = Function to be called when the device interrupts
|
||||
ServiceContext = Parameters to be passed to the service routine
|
||||
SpinLock = Should be NULL
|
||||
Vector = System mapped vector returned from HalGetInterruptVector
|
||||
Irql = DIRQL returned from HalGetInterruptVector
|
||||
SynchronizeIrql = Should be the same as Irql
|
||||
InterruptMode = Device interrupt type (currently ignored)
|
||||
ShareVector = True if the interrupt vector can shared
|
||||
ProcessorEnableMask = Currently ignored
|
||||
FloatingSave = Should be false
|
||||
|
||||
RETURNS: Status
|
||||
|
||||
* Sample code for snarfing an interrupt vector
|
||||
|
||||
|
||||
void grab_my_irq()
|
||||
{
|
||||
ULONG MappedIrq;
|
||||
KIRQL Dirql;
|
||||
KAFFINITY Affinity;
|
||||
PKINTERRUPT IrqObject;
|
||||
|
||||
MappedIrq = HalGetInterruptVector(Internal,
|
||||
0,
|
||||
0,
|
||||
MY_VECTOR,
|
||||
&Dirql,
|
||||
&Affinity);
|
||||
IoConnectInterrupt(&IrqObject,
|
||||
my_irq_service_routine,
|
||||
my_context,
|
||||
NULL,
|
||||
MappedIrq,
|
||||
Dirql,
|
||||
Dirql,
|
||||
0,
|
||||
FALSE, // Not sharable
|
||||
Affinity,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
** Designing an interrupt service routine
|
||||
|
||||
An interrupt service routine should have the following prototype
|
||||
|
||||
BOOLEAN my_irq_service_routine(PKINTERRUPT Interrupt,
|
||||
PVOID ServiceContext);
|
||||
|
||||
ARGUMENTS:
|
||||
|
||||
Interrupt = The same as the object returned from the
|
||||
IoConnectInterrupt
|
||||
ServiceContext = A user defined parameters
|
||||
(passed to IoConnectInterrupt)
|
||||
|
||||
RETURNS:
|
||||
|
||||
True if it handled the interrupt, false if it should be passed onto
|
||||
other devices sharing the same vector
|
||||
|
||||
NOTES:
|
||||
|
||||
While an isr is executing all devices of a lower or equal priority
|
||||
can't interrupt. For this reason it is important that an isr
|
||||
should complete in a short an interval as possible. The set of
|
||||
routines an isr can call is also restricted.
|
||||
|
21
reactos/doc/irql.txt
Normal file
21
reactos/doc/irql.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
This document describes the state of a uniprocessor PC at each of the IRQ
|
||||
levels supported by the ReactOS kernel
|
||||
|
||||
PASSIVE_LEVEL: IF bit clear in the processor flags
|
||||
All irqs umasked at the PIC
|
||||
|
||||
APC_LEVEL: Unknown
|
||||
WAKE_LEVEL: Unknown
|
||||
|
||||
DISPATCH_LEVEL: IF bit clear in the processor flags
|
||||
All irqs umasked at the PIC
|
||||
Thread dispatching disabled
|
||||
|
||||
DIRQL (Device specific IRQ level):
|
||||
IF bit clear in the processor flags
|
||||
Device's irq and all lower priority irqs masked at the PIC
|
||||
Thread dispatching disabled
|
||||
|
||||
HIGH_LEVEL: IF bit set in the processor flags
|
||||
All irqs masked at the PIC
|
||||
Thread dispatching disabled
|
33
reactos/doc/modules.txt
Normal file
33
reactos/doc/modules.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
** Introduction
|
||||
|
||||
This is (an incomplete) guide to writing device drivers (and other kernel
|
||||
extensions) for ReactOS.
|
||||
|
||||
** Setting up the build environment
|
||||
|
||||
Create a new subdirectory in the modules directory and copy one of the
|
||||
existing module makefiles into it. Customize the makefile to compile the
|
||||
source files for the module. Note: generally it is not necessary to specify
|
||||
the compiler or compiler flags to use.
|
||||
|
||||
** Initializing a module
|
||||
|
||||
On loading the kernel will call the module function
|
||||
|
||||
PROTOTYPE:
|
||||
|
||||
NTSTATUS ModuleEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath)
|
||||
|
||||
PURPOSE:
|
||||
|
||||
Initializing the module
|
||||
|
||||
ARGUMENTS:
|
||||
|
||||
DriverObject = Pointer to an object describing the driver
|
||||
RegistryPath = Currently NULL
|
||||
|
||||
RETURNS:
|
||||
|
||||
STATUS_SUCCESS = If the module initialized successfully
|
31
reactos/doc/todo
Normal file
31
reactos/doc/todo
Normal file
@@ -0,0 +1,31 @@
|
||||
* Kernel things implemented [exceptions in brackets]
|
||||
|
||||
Spinlocks [Uniprocessor only]
|
||||
IRQ levels [Not APC_LEVEL or WAKE_LEVEL, uniprocessor only]
|
||||
ISRs [Partial, uniprocessor only]
|
||||
Timers [Untested]
|
||||
DPCs [Untested]
|
||||
Objects [Partial]
|
||||
Namespace [Partial]
|
||||
Handle tables [One process only]
|
||||
Threads [Some initial work]
|
||||
RTL list functions [All except sequenced lists]
|
||||
Zones [Untested]
|
||||
Memory pool [Working but semantics partially incompatiable]
|
||||
Device objects [Some but no support for layering]
|
||||
IRP [Partial]
|
||||
Memory sections [Partial, no file mappings]
|
||||
PCI interface [Probes but no support]
|
||||
CreateFile API [Device only]
|
||||
ReadFile/WriteFile API [Device only]
|
||||
MDL functions [Untested]
|
||||
|
||||
* Kernel things unimplemented (partial)
|
||||
|
||||
Add support for source level debugging to Bochs
|
||||
Support for remote debugging
|
||||
Process managment
|
||||
Dispatcher objects (Mutex, Semaphore etc)
|
||||
Investigate user and kernel mode APCs
|
||||
Asynchronous I/O
|
||||
Optimization
|
16
reactos/doc/wstring.txt
Normal file
16
reactos/doc/wstring.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
subject wstring.zip
|
||||
author Boudewijn Dekker
|
||||
date 06-06-98
|
||||
|
||||
|
||||
I wrote some inline wide character string functions. It are modified version
|
||||
of the ones in string.h. I added four more function nl stricmp, strnicmp,
|
||||
wcsicmp, and wcsnicmp. These are the case insensitive variants of
|
||||
strcmp, strncmp and wcscmp, wcsncmp. I tested all the functions but I
|
||||
would urge anyone to tested again. I removed an extern specifier
|
||||
__wcstok and strtok cause I it caused an compilation error when
|
||||
using strtok or wcstok. Please could someone see if this correct.
|
||||
I also used these string functions in lstring api functions.
|
||||
|
||||
|
||||
Boudewijn Dekker
|
11
reactos/drivers/readme
Normal file
11
reactos/drivers/readme
Normal file
@@ -0,0 +1,11 @@
|
||||
These are a selection of services for the ReactOS kernel. They include
|
||||
|
||||
parallel = parallel port driver
|
||||
serial = serial port driver
|
||||
mouse = mouse driver
|
||||
null = null device driver
|
||||
ide = IDE (hard disk) driver
|
||||
keyboard = keyboard driver
|
||||
loop = Allows accessing a file as a block device
|
||||
scramdisk = Filesystem encryption driver
|
||||
event = Sample driver demonstrating notifying a user thread using an event
|
2979
reactos/include/ascii.h
Normal file
2979
reactos/include/ascii.h
Normal file
File diff suppressed because it is too large
Load Diff
572
reactos/include/base.h
Normal file
572
reactos/include/base.h
Normal file
@@ -0,0 +1,572 @@
|
||||
/*
|
||||
Base.h
|
||||
|
||||
Base definitions
|
||||
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
|
||||
This file is part of the Windows32 API Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_H_WINDOWS32_BASE
|
||||
#define _GNU_H_WINDOWS32_BASE
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL (0)
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif /* !NULL */
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* typedef ACMDRIVERENUMCB;
|
||||
typedef ACMDRIVERPROC;
|
||||
typedef ACMFILERCHOOSEHOOKPROC;
|
||||
typedef ACMFILTERENUMCB;
|
||||
typedef ACMFILTERTAGENUMCB;
|
||||
typedef ACMFORMATCHOOSEHOOKPROC;
|
||||
typedef ACMFORMATENUMCB;
|
||||
typedef ACMFORMATTAGENUMCB;
|
||||
typedef APPLET_PROC;
|
||||
*/
|
||||
typedef unsigned short ATOM;
|
||||
/* Changed from BOOL to WINBOOL to avoid Objective-C conflict */
|
||||
typedef int WINBOOL;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char BYTE;
|
||||
typedef unsigned long CALTYPE;
|
||||
typedef unsigned long CALID;
|
||||
typedef char CCHAR;
|
||||
typedef unsigned long COLORREF;
|
||||
#define CONST const
|
||||
|
||||
/* Check VOID before defining CHAR, SHORT, and LONG */
|
||||
#ifndef VOID
|
||||
#define VOID void
|
||||
typedef char CHAR;
|
||||
typedef short SHORT;
|
||||
typedef long LONG;
|
||||
#endif
|
||||
|
||||
/*
|
||||
typedef CTRYID;
|
||||
typedef DLGPROC;
|
||||
*/
|
||||
typedef unsigned int DWORD; /* was unsigned long */
|
||||
typedef double DWORDLONG, *PDWORDLONG;
|
||||
/*
|
||||
typedef EDITWORDBREAKPROC;
|
||||
typedef ENHMFENUMPROC;
|
||||
typedef ENUMRESLANGPROC;
|
||||
typedef ENUMRESNAMEPROC;
|
||||
typedef ENUMRESTYPEPROC;
|
||||
*/
|
||||
typedef float FLOAT;
|
||||
/* typedef GLOBALHANDLE; */
|
||||
typedef void *HANDLE;
|
||||
typedef HANDLE HACCEL;
|
||||
typedef HANDLE HBITMAP;
|
||||
typedef HANDLE HBRUSH;
|
||||
typedef HANDLE HCOLORSPACE;
|
||||
typedef HANDLE HCONV;
|
||||
typedef HANDLE HCONVLIST;
|
||||
typedef HANDLE HCURSOR;
|
||||
typedef HANDLE HDBC;
|
||||
typedef HANDLE HDC;
|
||||
typedef HANDLE HDDEDATA;
|
||||
typedef HANDLE HDESK;
|
||||
typedef HANDLE HDROP;
|
||||
typedef HANDLE HDWP;
|
||||
typedef HANDLE HENHMETAFILE;
|
||||
typedef HANDLE HENV;
|
||||
typedef int HFILE;
|
||||
typedef HANDLE HFONT;
|
||||
typedef HANDLE HGDIOBJ;
|
||||
typedef HANDLE HGLOBAL;
|
||||
typedef HANDLE HGLRC;
|
||||
typedef HANDLE HHOOK;
|
||||
typedef HANDLE HICON;
|
||||
typedef HANDLE HIMAGELIST;
|
||||
typedef HANDLE HINSTANCE;
|
||||
typedef HANDLE HKEY, *PHKEY;
|
||||
typedef HANDLE HKL;
|
||||
typedef HANDLE HLOCAL;
|
||||
typedef HANDLE HMENU;
|
||||
typedef HANDLE HMETAFILE;
|
||||
typedef HANDLE HMODULE;
|
||||
typedef HANDLE HPALETTE;
|
||||
typedef HANDLE HPEN;
|
||||
typedef HANDLE HRASCONN;
|
||||
typedef long HRESULT;
|
||||
typedef HANDLE HRGN;
|
||||
typedef HANDLE HRSRC;
|
||||
typedef HANDLE HSTMT;
|
||||
typedef HANDLE HSZ;
|
||||
typedef HANDLE HWINSTA;
|
||||
typedef HANDLE HWND;
|
||||
typedef int INT;
|
||||
typedef unsigned short LANGID;
|
||||
typedef DWORD LCID;
|
||||
typedef DWORD LCTYPE;
|
||||
/* typedef LOCALHANDLE */
|
||||
typedef double LONGLONG, *PLONGLONG;
|
||||
typedef unsigned short *LP;
|
||||
typedef long LPARAM;
|
||||
typedef WINBOOL *LPBOOL;
|
||||
typedef BYTE *LPBYTE;
|
||||
typedef CONST CHAR *LPCCH;
|
||||
typedef CHAR *LPCH;
|
||||
typedef COLORREF *LPCOLORREF;
|
||||
typedef const char *LPCSTR;
|
||||
typedef char* PCSZ;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef const unsigned short *LPCTSTR;
|
||||
#else
|
||||
typedef const char *LPCTSTR;
|
||||
#endif /* UNICODE */
|
||||
|
||||
typedef const unsigned short *LPCWCH;
|
||||
typedef const unsigned short *LPCWSTR;
|
||||
typedef DWORD *LPDWORD;
|
||||
/* typedef LPFRHOOKPROC; */
|
||||
typedef HANDLE *LPHANDLE;
|
||||
/* typedef LPHANDLER_FUNCTION; */
|
||||
typedef int *LPINT;
|
||||
typedef long *LPLONG;
|
||||
typedef char *LPSTR;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef unsigned short *LPTCH;
|
||||
typedef unsigned short *LPTSTR;
|
||||
#else
|
||||
typedef char *LPTCH;
|
||||
typedef char *LPTSTR;
|
||||
#endif /* UNICODE */
|
||||
|
||||
typedef long LRESULT;
|
||||
typedef void *LPVOID;
|
||||
typedef const void *LPCVOID;
|
||||
typedef unsigned short *LPWCH;
|
||||
typedef unsigned short *LPWORD;
|
||||
typedef unsigned short *LPWSTR;
|
||||
typedef unsigned short *PWSTR;
|
||||
/* typedef NPSTR; */
|
||||
typedef unsigned short *NWPSTR;
|
||||
typedef WINBOOL *PWINBOOL;
|
||||
typedef BYTE *PBOOLEAN;
|
||||
typedef BYTE *PBYTE;
|
||||
typedef const CHAR *PCCH;
|
||||
typedef CHAR *PCH;
|
||||
typedef CHAR *PCHAR;
|
||||
typedef const char *PCSTR;
|
||||
typedef const unsigned short *PCWCH;
|
||||
typedef const unsigned short *PCWSTR;
|
||||
typedef DWORD *PDWORD;
|
||||
typedef float *PFLOAT;
|
||||
typedef HANDLE *PHANDLE;
|
||||
/* typedef PHKEY; */
|
||||
typedef int *PINT;
|
||||
/* typedef LCID *PLCID; */
|
||||
typedef long *PLONG;
|
||||
typedef short *PSHORT;
|
||||
/* typedef PSID; */
|
||||
typedef char *PSTR;
|
||||
typedef char *PSZ;
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef unsigned short *PTBYTE;
|
||||
typedef unsigned short *PTCH;
|
||||
typedef unsigned short *PTCHAR;
|
||||
typedef unsigned short *PTSTR;
|
||||
#else
|
||||
typedef unsigned char *PTBYTE;
|
||||
typedef char *PTCH;
|
||||
typedef char *PTCHAR;
|
||||
typedef char *PTSTR;
|
||||
#endif /* UNICODE */
|
||||
|
||||
typedef unsigned char *PUCHAR;
|
||||
typedef unsigned int *PUINT;
|
||||
typedef unsigned long *PULONG;
|
||||
typedef unsigned short *PUSHORT;
|
||||
typedef void *PVOID;
|
||||
typedef unsigned short *PWCH;
|
||||
typedef unsigned short *PWCHAR;
|
||||
typedef unsigned short *PWORD;
|
||||
/*
|
||||
typedef PWSTR;
|
||||
typedef REGSAM;
|
||||
*/
|
||||
|
||||
typedef short RETCODE;
|
||||
|
||||
typedef HANDLE SC_HANDLE;
|
||||
typedef LPVOID SC_LOCK;
|
||||
typedef SC_HANDLE *LPSC_HANDLE;
|
||||
typedef DWORD SERVICE_STATUS_HANDLE;
|
||||
/* typedef SPHANDLE; */
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef unsigned short TBYTE;
|
||||
typedef unsigned short TCHAR;
|
||||
typedef unsigned short BCHAR;
|
||||
#else
|
||||
typedef unsigned char TBYTE;
|
||||
typedef char TCHAR;
|
||||
typedef BYTE BCHAR;
|
||||
#endif /* UNICODE */
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned short WCHAR;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned int WPARAM;
|
||||
/* typedef YIELDPROC; */
|
||||
|
||||
/* Only use __stdcall under WIN32 compiler */
|
||||
#ifdef i386
|
||||
#define STDCALL __attribute__ ((stdcall))
|
||||
#define CDECL __attribute((cdecl))
|
||||
#define CALLBACK WINAPI
|
||||
#define PASCAL WINAPI
|
||||
#else
|
||||
#define STDCALL
|
||||
#define CDECL
|
||||
#define CALLBACK
|
||||
#define PASCAL
|
||||
#endif
|
||||
#define WINAPI STDCALL
|
||||
#define APIENTRY STDCALL
|
||||
#define WINGDIAPI
|
||||
|
||||
#define _export
|
||||
|
||||
/*
|
||||
Enumerations
|
||||
*/
|
||||
typedef enum _ACL_INFORMATION_CLASS {
|
||||
AclRevisionInformation = 1,
|
||||
AclSizeInformation
|
||||
} ACL_INFORMATION_CLASS;
|
||||
|
||||
typedef enum _MEDIA_TYPE {
|
||||
Unknown,
|
||||
F5_1Pt2_512,
|
||||
F3_1Pt44_512,
|
||||
F3_2Pt88_512,
|
||||
F3_20Pt8_512,
|
||||
F3_720_512,
|
||||
F5_360_512,
|
||||
F5_320_512,
|
||||
F5_320_1024,
|
||||
F5_180_512,
|
||||
F5_160_512,
|
||||
RemovableMedia,
|
||||
FixedMedia
|
||||
} MEDIA_TYPE;
|
||||
|
||||
#define RASCS_DONE 0x2000
|
||||
#define RASCS_PAUSED 0x1000
|
||||
typedef enum _RASCONNSTATE {
|
||||
RASCS_OpenPort = 0,
|
||||
RASCS_PortOpened,
|
||||
RASCS_ConnectDevice,
|
||||
RASCS_DeviceConnected,
|
||||
RASCS_AllDevicesConnected,
|
||||
RASCS_Authenticate,
|
||||
RASCS_AuthNotify,
|
||||
RASCS_AuthRetry,
|
||||
RASCS_AuthCallback,
|
||||
RASCS_AuthChangePassword,
|
||||
RASCS_AuthProject,
|
||||
RASCS_AuthLinkSpeed,
|
||||
RASCS_AuthAck,
|
||||
RASCS_ReAuthenticate,
|
||||
RASCS_Authenticated,
|
||||
RASCS_PrepareForCallback,
|
||||
RASCS_WaitForModemReset,
|
||||
RASCS_WaitForCallback,
|
||||
RASCS_Projected,
|
||||
|
||||
RASCS_StartAuthentication,
|
||||
RASCS_CallbackComplete,
|
||||
RASCS_LogonNetwork,
|
||||
|
||||
RASCS_Interactive = RASCS_PAUSED,
|
||||
RASCS_RetryAuthentication,
|
||||
RASCS_CallbackSetByCaller,
|
||||
RASCS_PasswordExpired,
|
||||
|
||||
RASCS_Connected = RASCS_DONE,
|
||||
RASCS_Disconnected
|
||||
} RASCONNSTATE ;
|
||||
|
||||
typedef enum _RASPROJECTION {
|
||||
RASP_Amb = 0x10000,
|
||||
RASP_PppNbf = 0x803F,
|
||||
RASP_PppIpx = 0x802B,
|
||||
RASP_PppIp = 0x8021
|
||||
} RASPROJECTION ;
|
||||
|
||||
typedef enum _SECURITY_IMPERSONATION_LEVEL {
|
||||
SecurityAnonymous,
|
||||
SecurityIdentification,
|
||||
SecurityImpersonation,
|
||||
SecurityDelegation
|
||||
} SECURITY_IMPERSONATION_LEVEL;
|
||||
|
||||
typedef enum _SID_NAME_USE {
|
||||
SidTypeUser = 1,
|
||||
SidTypeGroup,
|
||||
SidTypeDomain,
|
||||
SidTypeAlias,
|
||||
SidTypeWellKnownGroup,
|
||||
SidTypeDeletedAccount,
|
||||
SidTypeInvalid,
|
||||
SidTypeUnknown
|
||||
} SID_NAME_USE, *PSID_NAME_USE;
|
||||
|
||||
typedef enum _TOKEN_INFORMATION_CLASS {
|
||||
TokenUser = 1,
|
||||
TokenGroups,
|
||||
TokenPrivileges,
|
||||
TokenOwner,
|
||||
TokenPrimaryGroup,
|
||||
TokenDefaultDacl,
|
||||
TokenSource,
|
||||
TokenType,
|
||||
TokenImpersonationLevel,
|
||||
TokenStatistics
|
||||
} TOKEN_INFORMATION_CLASS;
|
||||
|
||||
typedef enum tagTOKEN_TYPE {
|
||||
TokenPrimary = 1,
|
||||
TokenImpersonation
|
||||
} TOKEN_TYPE;
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
/*
|
||||
Macros
|
||||
*/
|
||||
#define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) (void)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(id), (LPARAM)(NMHDR FAR*)(pnmhdr))
|
||||
|
||||
#define GetBValue(rgb) ((BYTE) ((rgb) >> 16))
|
||||
#define GetGValue(rgb) ((BYTE) (((WORD) (rgb)) >> 8))
|
||||
#define GetRValue(rgb) ((BYTE) (rgb))
|
||||
#define RGB(r, g ,b) ((DWORD) (((BYTE) (r) | ((WORD) (g) << 8)) | (((DWORD) (BYTE) (b)) << 16)))
|
||||
|
||||
#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam))
|
||||
|
||||
#define HIBYTE(w) ((BYTE) (((WORD) (w) >> 8) & 0xFF))
|
||||
#define HIWORD(l) ((WORD) (((DWORD) (l) >> 16) & 0xFFFF))
|
||||
#define LOBYTE(w) ((BYTE) (w))
|
||||
#define LOWORD(l) ((WORD) (l))
|
||||
#define MAKELONG(a, b) ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) << 16))
|
||||
#define MAKEWORD(a, b) ((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8))
|
||||
|
||||
/* original Cygnus headers also had the following defined: */
|
||||
#define SEXT_HIWORD(l) ((((int)l) >> 16))
|
||||
#define ZEXT_HIWORD(l) ((((unsigned int)l) >> 16))
|
||||
#define SEXT_LOWORD(l) ((int)(short)l)
|
||||
|
||||
#define INDEXTOOVERLAYMASK(i) ((i) << 8)
|
||||
#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
|
||||
|
||||
#define MAKEINTATOM(i) (LPTSTR) ((DWORD) ((WORD) (i)))
|
||||
#define MAKEINTRESOURCE(i) (LPTSTR) ((DWORD) ((WORD) (i)))
|
||||
|
||||
#define MAKELANGID(p, s) ((((WORD) (s)) << 10) | (WORD) (p))
|
||||
#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
|
||||
#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
|
||||
|
||||
#define LANGIDFROMLCID(lcid) ((WORD) (lcid))
|
||||
#define SORTIDFROMLCID(lcid) ((WORD )((((DWORD)(lcid)) & 0x000FFFFF) >> 16))
|
||||
#define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid)))))
|
||||
#define MAKELPARAM(l, h) ((LPARAM) MAKELONG(l, h))
|
||||
#define MAKELRESULT(l, h) ((LRESULT) MAKELONG(l, h))
|
||||
#define MAKEPOINTS(l) (*((POINTS FAR *) & (l)))
|
||||
#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore))
|
||||
#define MAKEWPARAM(l, h) ((WPARAM) MAKELONG(l, h))
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define PALETTEINDEX(i) ((COLORREF) (0x01000000 | (DWORD) (WORD) (i)))
|
||||
#define PALETTERGB(r, g, b) (0x02000000 | RGB(r, g, b))
|
||||
#define POINTSTOPOINT(pt, pts) {(pt).x = (SHORT) LOWORD(pts); (pt).y = (SHORT) HIWORD(pts);}
|
||||
#define POINTTOPOINTS(pt) (MAKELONG((short) ((pt).x), (short) ((pt).y)))
|
||||
|
||||
#define INDEXTOOVERLAYMASK(i) ((i) << 8)
|
||||
#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12)
|
||||
|
||||
#ifdef UNICODE
|
||||
#define TEXT(quote) L##quote
|
||||
#else
|
||||
#define TEXT(quote) quote
|
||||
#endif
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/*
|
||||
Definitions for callback procedures
|
||||
*/
|
||||
typedef int CALLBACK (*BFFCALLBACK) (HWND, UINT, LPARAM, LPARAM);
|
||||
typedef UINT CALLBACK (*LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef UINT CALLBACK (*LPCFHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef DWORD CALLBACK (*PTHREAD_START_ROUTINE) (LPVOID);
|
||||
typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
|
||||
typedef DWORD CALLBACK (*EDITSTREAMCALLBACK) (DWORD, LPBYTE, LONG, LONG);
|
||||
typedef UINT CALLBACK (*LPFRHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef UINT CALLBACK (*LPOFNHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef UINT CALLBACK (*LPPRINTHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef UINT CALLBACK (*LPSETUPHOOKPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef WINBOOL CALLBACK (*DLGPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef int CALLBACK (*PFNPROPSHEETCALLBACK) (HWND, UINT, LPARAM);
|
||||
typedef VOID CALLBACK (*LPSERVICE_MAIN_FUNCTION) (DWORD, LPTSTR);
|
||||
typedef int CALLBACK (*PFNTVCOMPARE) (LPARAM, LPARAM, LPARAM);
|
||||
typedef LRESULT CALLBACK (*WNDPROC) (HWND, UINT, WPARAM, LPARAM);
|
||||
typedef int CALLBACK (*FARPROC)(void);
|
||||
typedef FARPROC PROC;
|
||||
typedef WINBOOL CALLBACK (*ENUMRESTYPEPROC) (HANDLE, LPTSTR, LONG);
|
||||
typedef WINBOOL CALLBACK (*ENUMRESNAMEPROC) (HANDLE, LPCTSTR, LPTSTR, LONG);
|
||||
typedef WINBOOL CALLBACK (*ENUMRESLANGPROC) (HANDLE, LPCTSTR, LPCTSTR, WORD, LONG);
|
||||
typedef FARPROC DESKTOPENUMPROC;
|
||||
typedef WINBOOL CALLBACK (*ENUMWINDOWSPROC) (HWND, LPARAM);
|
||||
typedef WINBOOL CALLBACK (*ENUMWINDOWSTATIONPROC) (LPTSTR, LPARAM);
|
||||
typedef VOID CALLBACK (*SENDASYNCPROC) (HWND, UINT, DWORD, LRESULT);
|
||||
typedef VOID CALLBACK (*TIMERPROC) (HWND, UINT, UINT, DWORD);
|
||||
typedef FARPROC GRAYSTRINGPROC;
|
||||
typedef WINBOOL CALLBACK (*DRAWSTATEPROC) (HDC, LPARAM, WPARAM, int, int);
|
||||
typedef WINBOOL CALLBACK (*PROPENUMPROCEX) (HWND, LPCTSTR, HANDLE, DWORD);
|
||||
typedef WINBOOL CALLBACK (*PROPENUMPROC) (HWND, LPCTSTR, HANDLE);
|
||||
typedef LRESULT CALLBACK (*HOOKPROC) (int, WPARAM, LPARAM);
|
||||
typedef VOID CALLBACK (*ENUMOBJECTSPROC) (LPVOID, LPARAM);
|
||||
typedef VOID CALLBACK (*LINEDDAPROC) (int, int, LPARAM);
|
||||
typedef WINBOOL CALLBACK (*ABORTPROC) (HDC, int);
|
||||
typedef UINT CALLBACK (*LPPAGEPAINTHOOK) (HWND, UINT, WPARAM, LPARAM );
|
||||
typedef UINT CALLBACK (*LPPAGESETUPHOOK) (HWND, UINT, WPARAM, LPARAM );
|
||||
typedef int CALLBACK (*ICMENUMPROC) (LPTSTR, LPARAM);
|
||||
typedef LONG (*EDITWORDBREAKPROCEX) (char *, LONG, BYTE, INT);
|
||||
typedef int CALLBACK (*PFNLVCOMPARE) (LPARAM, LPARAM, LPARAM);
|
||||
typedef WINBOOL CALLBACK (*LOCALE_ENUMPROC) (LPTSTR);
|
||||
typedef WINBOOL CALLBACK (*CODEPAGE_ENUMPROC) (LPTSTR);
|
||||
typedef WINBOOL CALLBACK (*DATEFMT_ENUMPROC) (LPTSTR);
|
||||
typedef WINBOOL CALLBACK (*TIMEFMT_ENUMPROC) (LPTSTR);
|
||||
typedef WINBOOL CALLBACK (*CALINFO_ENUMPROC) (LPTSTR);
|
||||
typedef WINBOOL CALLBACK (*PHANDLER_ROUTINE) (DWORD);
|
||||
typedef WINBOOL CALLBACK (*LPHANDLER_FUNCTION) (DWORD);
|
||||
typedef UINT CALLBACK (*PFNGETPROFILEPATH) (LPCTSTR, LPSTR, UINT);
|
||||
typedef UINT CALLBACK (*PFNRECONCILEPROFILE) (LPCTSTR, LPCTSTR, DWORD);
|
||||
typedef WINBOOL CALLBACK (*PFNPROCESSPOLICIES) (HWND, LPCTSTR, LPCTSTR, LPCTSTR, DWORD);
|
||||
|
||||
#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
|
||||
#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
|
||||
#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
|
||||
#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
|
||||
#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
|
||||
#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
|
||||
|
||||
#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
|
||||
#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
|
||||
#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
|
||||
#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
|
||||
#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
|
||||
#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
|
||||
#define SE_TCB_NAME TEXT("SeTcbPrivilege")
|
||||
#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
|
||||
#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
|
||||
#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
|
||||
#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
|
||||
#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
|
||||
#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
|
||||
#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
|
||||
#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
|
||||
#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
|
||||
#define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
|
||||
#define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
|
||||
#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
|
||||
#define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
|
||||
#define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
|
||||
#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
|
||||
#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
|
||||
#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
|
||||
|
||||
#define SERVICES_ACTIVE_DATABASEW L"ServicesActive"
|
||||
#define SERVICES_FAILED_DATABASEW L"ServicesFailed"
|
||||
#define SERVICES_ACTIVE_DATABASEA "ServicesActive"
|
||||
#define SERVICES_FAILED_DATABASEA "ServicesFailed"
|
||||
#define SC_GROUP_IDENTIFIERW L'+'
|
||||
#define SC_GROUP_IDENTIFIERA '+'
|
||||
|
||||
#ifdef UNICODE
|
||||
#define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEW
|
||||
#define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEW
|
||||
#define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERW
|
||||
#else
|
||||
#define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEA
|
||||
#define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEA
|
||||
#define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERA
|
||||
#endif /* UNICODE */
|
||||
|
||||
/* ---------------------------------- */
|
||||
/* From ddeml.h in old Cygnus headers */
|
||||
|
||||
typedef void (*CALLB) (void);
|
||||
typedef CALLB PFNCALLBACK;
|
||||
|
||||
typedef WINBOOL SECURITY_CONTEXT_TRACKING_MODE;
|
||||
|
||||
/* End of stuff from ddeml.h in old Cygnus headers */
|
||||
/* ----------------------------------------------- */
|
||||
|
||||
typedef FARPROC WNDENUMPROC;
|
||||
typedef FARPROC ENHMFENUMPROC;
|
||||
typedef DWORD CCSTYLE, *PCCSTYLE, *LPCCSTYLE;
|
||||
typedef DWORD CCSTYLEFLAGA, *PCCSTYLEFLAGA, *LPCCSTYLEFLAGA;
|
||||
#define DECLARE_HANDLE(s) typedef HANDLE s
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _GNU_H_WINDOWS32_BASE */
|
339
reactos/include/coff.h
Normal file
339
reactos/include/coff.h
Normal file
@@ -0,0 +1,339 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#ifndef __dj_include_coff_h_
|
||||
#define __dj_include_coff_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//#ifndef __dj_ENFORCE_ANSI_FREESTANDING
|
||||
|
||||
//#ifndef __STRICT_ANSI__
|
||||
|
||||
//#ifndef _POSIX_SOURCE
|
||||
|
||||
/*** coff information for Intel 386/486. */
|
||||
|
||||
/********************** FILE HEADER **********************/
|
||||
|
||||
struct external_filehdr {
|
||||
unsigned short f_magic; /* magic number */
|
||||
unsigned short f_nscns; /* number of sections */
|
||||
unsigned long f_timdat; /* time & date stamp */
|
||||
unsigned long f_symptr; /* file pointer to symtab */
|
||||
unsigned long f_nsyms; /* number of symtab entries */
|
||||
unsigned short f_opthdr; /* sizeof(optional hdr) */
|
||||
unsigned short f_flags; /* flags */
|
||||
};
|
||||
|
||||
|
||||
/* Bits for f_flags:
|
||||
* F_RELFLG relocation info stripped from file
|
||||
* F_EXEC file is executable (no unresolved external references)
|
||||
* F_LNNO line numbers stripped from file
|
||||
* F_LSYMS local symbols stripped from file
|
||||
* F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)
|
||||
*/
|
||||
|
||||
#define F_RELFLG (0x0001)
|
||||
#define F_EXEC (0x0002)
|
||||
#define F_LNNO (0x0004)
|
||||
#define F_LSYMS (0x0008)
|
||||
|
||||
|
||||
|
||||
#define I386MAGIC 0x14c
|
||||
#define I386AIXMAGIC 0x175
|
||||
#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC)
|
||||
|
||||
|
||||
#define FILHDR struct external_filehdr
|
||||
#define FILHSZ sizeof(FILHDR)
|
||||
|
||||
|
||||
/********************** AOUT "OPTIONAL HEADER" **********************/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short magic; /* type of file */
|
||||
unsigned short vstamp; /* version stamp */
|
||||
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
|
||||
unsigned long dsize; /* initialized data " " */
|
||||
unsigned long bsize; /* uninitialized data " " */
|
||||
unsigned long entry; /* entry pt. */
|
||||
unsigned long text_start; /* base of text used for this file */
|
||||
unsigned long data_start; /* base of data used for this file */
|
||||
}
|
||||
AOUTHDR;
|
||||
|
||||
|
||||
typedef struct gnu_aout {
|
||||
unsigned long info;
|
||||
unsigned long tsize;
|
||||
unsigned long dsize;
|
||||
unsigned long bsize;
|
||||
unsigned long symsize;
|
||||
unsigned long entry;
|
||||
unsigned long txrel;
|
||||
unsigned long dtrel;
|
||||
} GNU_AOUT;
|
||||
|
||||
#define AOUTSZ (sizeof(AOUTHDR))
|
||||
|
||||
#define OMAGIC 0404 /* object files, eg as output */
|
||||
#define ZMAGIC 0413 /* demand load format, eg normal ld output */
|
||||
#define STMAGIC 0401 /* target shlib */
|
||||
#define SHMAGIC 0443 /* host shlib */
|
||||
|
||||
|
||||
/********************** SECTION HEADER **********************/
|
||||
|
||||
|
||||
struct external_scnhdr {
|
||||
char s_name[8]; /* section name */
|
||||
unsigned long s_paddr; /* physical address, aliased s_nlib */
|
||||
unsigned long s_vaddr; /* virtual address */
|
||||
unsigned long s_size; /* section size */
|
||||
unsigned long s_scnptr; /* file ptr to raw data for section */
|
||||
unsigned long s_relptr; /* file ptr to relocation */
|
||||
unsigned long s_lnnoptr; /* file ptr to line numbers */
|
||||
unsigned short s_nreloc; /* number of relocation entries */
|
||||
unsigned short s_nlnno; /* number of line number entries*/
|
||||
unsigned long s_flags; /* flags */
|
||||
};
|
||||
|
||||
#define SCNHDR struct external_scnhdr
|
||||
#define SCNHSZ sizeof(SCNHDR)
|
||||
|
||||
/*
|
||||
* names of "special" sections
|
||||
*/
|
||||
#define _TEXT ".text"
|
||||
#define _DATA ".data"
|
||||
#define _BSS ".bss"
|
||||
#define _COMMENT ".comment"
|
||||
#define _LIB ".lib"
|
||||
|
||||
/*
|
||||
* s_flags "type"
|
||||
*/
|
||||
#define STYP_TEXT (0x0020) /* section contains text only */
|
||||
#define STYP_DATA (0x0040) /* section contains data only */
|
||||
#define STYP_BSS (0x0080) /* section contains bss only */
|
||||
|
||||
/********************** LINE NUMBERS **********************/
|
||||
|
||||
/* 1 line number entry for every "breakpointable" source line in a section.
|
||||
* Line numbers are grouped on a per function basis; first entry in a function
|
||||
* grouping will have l_lnno = 0 and in place of physical address will be the
|
||||
* symbol table index of the function name.
|
||||
*/
|
||||
struct external_lineno {
|
||||
union {
|
||||
unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */
|
||||
unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */
|
||||
} l_addr;
|
||||
unsigned short l_lnno; /* line number */
|
||||
};
|
||||
|
||||
|
||||
#define LINENO struct external_lineno
|
||||
#define LINESZ sizeof(LINENO)
|
||||
|
||||
|
||||
/********************** SYMBOLS **********************/
|
||||
|
||||
#define E_SYMNMLEN 8 /* # characters in a symbol name */
|
||||
#define E_FILNMLEN 14 /* # characters in a file name */
|
||||
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
||||
|
||||
struct external_syment
|
||||
{
|
||||
union {
|
||||
char e_name[E_SYMNMLEN];
|
||||
struct {
|
||||
unsigned long e_zeroes __attribute__((packed));
|
||||
unsigned long e_offset __attribute__((packed));
|
||||
} e;
|
||||
} e;
|
||||
unsigned long e_value __attribute__((packed));
|
||||
short e_scnum;
|
||||
unsigned short e_type;
|
||||
unsigned char e_sclass;
|
||||
unsigned char e_numaux;
|
||||
};
|
||||
|
||||
#define N_BTMASK (0xf)
|
||||
#define N_TMASK (0x30)
|
||||
#define N_BTSHFT (4)
|
||||
#define N_TSHIFT (2)
|
||||
|
||||
union external_auxent {
|
||||
struct {
|
||||
unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */
|
||||
union {
|
||||
struct {
|
||||
unsigned short x_lnno; /* declaration line number */
|
||||
unsigned short x_size; /* str/union/array size */
|
||||
} x_lnsz;
|
||||
unsigned long x_fsize __attribute__((packed)); /* size of function */
|
||||
} x_misc;
|
||||
union {
|
||||
struct { /* if ISFCN, tag, or .bb */
|
||||
unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */
|
||||
unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */
|
||||
} x_fcn;
|
||||
struct { /* if ISARY, up to 4 dimen. */
|
||||
unsigned short x_dimen[E_DIMNUM];
|
||||
} x_ary;
|
||||
} x_fcnary;
|
||||
unsigned short x_tvndx; /* tv index */
|
||||
} x_sym;
|
||||
|
||||
union {
|
||||
char x_fname[E_FILNMLEN];
|
||||
struct {
|
||||
unsigned long x_zeroes __attribute__((packed));
|
||||
unsigned long x_offset __attribute__((packed));
|
||||
} x_n;
|
||||
} x_file;
|
||||
|
||||
struct {
|
||||
unsigned long x_scnlen __attribute__((packed)); /* section length */
|
||||
unsigned short x_nreloc; /* # relocation entries */
|
||||
unsigned short x_nlinno; /* # line numbers */
|
||||
} x_scn;
|
||||
|
||||
struct {
|
||||
unsigned long x_tvfill __attribute__((packed)); /* tv fill value */
|
||||
unsigned short x_tvlen; /* length of .tv */
|
||||
unsigned short x_tvran[2]; /* tv range */
|
||||
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
||||
|
||||
|
||||
};
|
||||
|
||||
#define SYMENT struct external_syment
|
||||
#define SYMESZ sizeof(SYMENT)
|
||||
#define AUXENT union external_auxent
|
||||
#define AUXESZ sizeof(AUXENT)
|
||||
|
||||
|
||||
# define _ETEXT "etext"
|
||||
|
||||
|
||||
/* Relocatable symbols have number of the section in which they are defined,
|
||||
or one of the following: */
|
||||
|
||||
#define N_UNDEF ((short)0) /* undefined symbol */
|
||||
#define N_ABS ((short)-1) /* value of symbol is absolute */
|
||||
#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */
|
||||
#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */
|
||||
#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/
|
||||
|
||||
/*
|
||||
* Type of a symbol, in low N bits of the word
|
||||
*/
|
||||
#define T_NULL 0
|
||||
#define T_VOID 1 /* function argument (only used by compiler) */
|
||||
#define T_CHAR 2 /* character */
|
||||
#define T_SHORT 3 /* short integer */
|
||||
#define T_INT 4 /* integer */
|
||||
#define T_LONG 5 /* long integer */
|
||||
#define T_FLOAT 6 /* floating point */
|
||||
#define T_DOUBLE 7 /* double word */
|
||||
#define T_STRUCT 8 /* structure */
|
||||
#define T_UNION 9 /* union */
|
||||
#define T_ENUM 10 /* enumeration */
|
||||
#define T_MOE 11 /* member of enumeration*/
|
||||
#define T_UCHAR 12 /* unsigned character */
|
||||
#define T_USHORT 13 /* unsigned short */
|
||||
#define T_UINT 14 /* unsigned integer */
|
||||
#define T_ULONG 15 /* unsigned long */
|
||||
#define T_LNGDBL 16 /* long double */
|
||||
|
||||
/*
|
||||
* derived types, in n_type
|
||||
*/
|
||||
#define DT_NON (0) /* no derived type */
|
||||
#define DT_PTR (1) /* pointer */
|
||||
#define DT_FCN (2) /* function */
|
||||
#define DT_ARY (3) /* array */
|
||||
|
||||
#define BTYPE(x) ((x) & N_BTMASK)
|
||||
|
||||
#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
|
||||
#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
|
||||
#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
|
||||
#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
|
||||
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
|
||||
|
||||
/********************** STORAGE CLASSES **********************/
|
||||
|
||||
/* This used to be defined as -1, but now n_sclass is unsigned. */
|
||||
#define C_EFCN 0xff /* physical end of function */
|
||||
#define C_NULL 0
|
||||
#define C_AUTO 1 /* automatic variable */
|
||||
#define C_EXT 2 /* external symbol */
|
||||
#define C_STAT 3 /* static */
|
||||
#define C_REG 4 /* register variable */
|
||||
#define C_EXTDEF 5 /* external definition */
|
||||
#define C_LABEL 6 /* label */
|
||||
#define C_ULABEL 7 /* undefined label */
|
||||
#define C_MOS 8 /* member of structure */
|
||||
#define C_ARG 9 /* function argument */
|
||||
#define C_STRTAG 10 /* structure tag */
|
||||
#define C_MOU 11 /* member of union */
|
||||
#define C_UNTAG 12 /* union tag */
|
||||
#define C_TPDEF 13 /* type definition */
|
||||
#define C_USTATIC 14 /* undefined static */
|
||||
#define C_ENTAG 15 /* enumeration tag */
|
||||
#define C_MOE 16 /* member of enumeration */
|
||||
#define C_REGPARM 17 /* register parameter */
|
||||
#define C_FIELD 18 /* bit field */
|
||||
#define C_AUTOARG 19 /* auto argument */
|
||||
#define C_LASTENT 20 /* dummy entry (end of block) */
|
||||
#define C_BLOCK 100 /* ".bb" or ".eb" */
|
||||
#define C_FCN 101 /* ".bf" or ".ef" */
|
||||
#define C_EOS 102 /* end of structure */
|
||||
#define C_FILE 103 /* file name */
|
||||
#define C_LINE 104 /* line # reformatted as symbol table entry */
|
||||
#define C_ALIAS 105 /* duplicate tag */
|
||||
#define C_HIDDEN 106 /* ext symbol in dmert public lib */
|
||||
|
||||
/********************** RELOCATION DIRECTIVES **********************/
|
||||
|
||||
|
||||
|
||||
struct external_reloc {
|
||||
unsigned long r_vaddr __attribute__((packed));
|
||||
unsigned long r_symndx __attribute__((packed));
|
||||
unsigned short r_type;
|
||||
};
|
||||
|
||||
|
||||
#define RELOC struct external_reloc
|
||||
#define RELSZ sizeof(RELOC)
|
||||
|
||||
#define RELOC_REL32 20 /* 32-bit PC-relative address */
|
||||
#define RELOC_ADDR32 6 /* 32-bit absolute address */
|
||||
|
||||
#define DEFAULT_DATA_SECTION_ALIGNMENT 4
|
||||
#define DEFAULT_BSS_SECTION_ALIGNMENT 4
|
||||
#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
|
||||
/* For new sections we havn't heard of before */
|
||||
#define DEFAULT_SECTION_ALIGNMENT 4
|
||||
|
||||
//#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_coff_h_ */
|
72
reactos/include/ddk/cfgtypes.h
Normal file
72
reactos/include/ddk/cfgtypes.h
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
// registry key structures
|
||||
|
||||
|
||||
typedef struct _KEY_BASIC_INFORMATION {
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1]; // variable size
|
||||
} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
|
||||
|
||||
typedef struct _KEY_NODE_INFORMATION {
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG ClassOffset;
|
||||
ULONG ClassLength;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1]; // variable size
|
||||
} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
|
||||
|
||||
typedef struct _KEY_FULL_INFORMATION {
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
ULONG TitleIndex;
|
||||
ULONG ClassOffset;
|
||||
ULONG ClassLength;
|
||||
ULONG SubKeys;
|
||||
ULONG MaxNameLen;
|
||||
ULONG MaxClassLen;
|
||||
ULONG Values;
|
||||
ULONG MaxValueNameLen;
|
||||
ULONG MaxValueDataLen;
|
||||
WCHAR Class[1]; // variable size
|
||||
} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
|
||||
|
||||
|
||||
typedef struct _KEY_WRITE_TIME_INFORMATION {
|
||||
LARGE_INTEGER LastWriteTime;
|
||||
} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
|
||||
|
||||
|
||||
// key query value structures
|
||||
|
||||
typedef struct _KEY_VALUE_BASIC_INFORMATION {
|
||||
ULONG TitleIndex;
|
||||
ULONG Type;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1]; // variable size
|
||||
} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_FULL_INFORMATION {
|
||||
ULONG TitleIndex;
|
||||
ULONG Type;
|
||||
ULONG DataOffset;
|
||||
ULONG DataLength;
|
||||
ULONG NameLength;
|
||||
WCHAR Name[1]; // variable size
|
||||
} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
|
||||
ULONG TitleIndex;
|
||||
ULONG Type;
|
||||
ULONG DataLength;
|
||||
UCHAR Data[1]; // variable size
|
||||
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
|
||||
|
||||
typedef struct _KEY_VALUE_ENTRY {
|
||||
PUNICODE_STRING ValueName;
|
||||
ULONG DataLength;
|
||||
ULONG DataOffset;
|
||||
ULONG Type;
|
||||
} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
|
||||
|
3
reactos/include/ddk/dbgfuncs.h
Normal file
3
reactos/include/ddk/dbgfuncs.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
VOID DbgBreakPoint(VOID);
|
||||
ULONG DbgPrint(PCH Format,...);
|
250
reactos/include/ddk/defines.h
Normal file
250
reactos/include/ddk/defines.h
Normal file
@@ -0,0 +1,250 @@
|
||||
/* GENERAL DEFINITIONS ****************************************************/
|
||||
|
||||
#include <internal/hal/irq.h>
|
||||
|
||||
#include <ddk/kedef.h>
|
||||
#include <ddk/iodef.h>
|
||||
|
||||
/*
|
||||
* PURPOSE: Number of a thread priority levels
|
||||
*/
|
||||
#define NR_PRIORITY_LEVELS (32)
|
||||
|
||||
/*
|
||||
* PURPOSE: Type of queue to insert a work item in
|
||||
*/
|
||||
enum
|
||||
{
|
||||
CriticalWorkQueue,
|
||||
DelayedWorkQueue,
|
||||
HyperCriticalWorkQueue,
|
||||
};
|
||||
|
||||
/*
|
||||
* Types of memory to allocate
|
||||
*/
|
||||
enum
|
||||
{
|
||||
NonPagedPool,
|
||||
NonPagedPoolMustSucceed,
|
||||
NonPagedPoolCacheAligned,
|
||||
NonPagedPoolCacheAlignedMustS,
|
||||
PagedPool,
|
||||
PagedPoolCacheAligned,
|
||||
};
|
||||
|
||||
/*
|
||||
* This is a list of bug check types (not MS's)
|
||||
*/
|
||||
enum
|
||||
{
|
||||
APC_INDEX_MISMATCH = 1,
|
||||
DEVICE_QUEUE_NOT_BUSY,
|
||||
INVALID_AFFINITY_SET,
|
||||
INVALID_DATA_ACCESS_TRAP,
|
||||
INVALID_PROCESS_ATTACH_ATTEMPT,
|
||||
INVALID_PROCESS_DEATTACH_ATTEMPT,
|
||||
INVALID_SOFTWARE_INTERRUPT,
|
||||
IRQL_NOT_DISPATCH_LEVEL,
|
||||
IRQL_NOT_GREATER_OR_EQUAL,
|
||||
NO_EXCEPTION_HANDLING_SUPPORT,
|
||||
MAXIMUM_WAIT_OBJECTS_EXCEEDED,
|
||||
MUTEX_LEVEL_NUMBER_VIOLATION,
|
||||
NO_USER_MODE_CONTEXT,
|
||||
SPIN_LOCK_ALREADY_OWNED,
|
||||
SPIN_LOCK_NOT_OWNED,
|
||||
THREAD_NOT_MUTEX_OWNER,
|
||||
TRAP_CAUSE_UNKNOWN,
|
||||
EMPTY_THREAD_REAPER_LIST,
|
||||
CREATE_DELETE_LOCK_NOT_LOCKED,
|
||||
LAST_CHANCE_CALLED_FROM_KMODE,
|
||||
CID_HANDLE_CREATION,
|
||||
CID_HANDLE_DELETION,
|
||||
REFERENCE_BY_POINTER,
|
||||
BAD_POOL_HEADER,
|
||||
MEMORY_MANAGMENT,
|
||||
PFN_SHARE_COUNT,
|
||||
PFN_REFERENCE_COUNT,
|
||||
NO_SPIN_LOCK_AVAILABLE,
|
||||
KMODE_EXCEPTION_NOT_HANDLED,
|
||||
SHARED_RESOURCE_CONV_ERROR,
|
||||
KERNEL_APC_PENDING_DURING_EXIT,
|
||||
QUOTA_UNDERFLOW,
|
||||
FILE_SYSTEM,
|
||||
FAT_FILE_SYSTEM,
|
||||
NTFS_FILE_SYSTEM,
|
||||
NPFS_FILE_SYSTEM,
|
||||
CDFS_FILE_SYSTEM,
|
||||
RDR_FILE_SYSTEM,
|
||||
CORRUPT_ACCESS_TOKEN,
|
||||
SECURITY_SYSTEM,
|
||||
INCONSISTENT_IRP,
|
||||
PANIC_STACK_SWITCH,
|
||||
PORT_DRIVER_INTERNAL,
|
||||
SCSI_DISK_DRIVER_INTERNAL,
|
||||
INSTRUCTION_BUS_ERROR,
|
||||
SET_OF_INVALID_CONTEXT,
|
||||
PHASE0_INITIALIZATION_FAILED,
|
||||
PHASE1_INITIALIZATION_FAILED,
|
||||
UNEXPECTED_INITIALIZATION_CALL,
|
||||
CACHE_MANAGER,
|
||||
NO_MORE_IRP_STACK_LOCATIONS,
|
||||
DEVICE_REFERENCE_COUNT_NOT_ZERO,
|
||||
FLOPPY_INTERNAL_ERROR,
|
||||
SERIAL_DRIVER_INTERNAL,
|
||||
SYSTEM_EXIT_OWNED_MUTEX,
|
||||
SYSTEM_UNWIND_PREVIOUS_USER,
|
||||
SYSTEN_SERVICE_EXCEPTION,
|
||||
INTERRUPT_UNWIND_ATTEMPTED,
|
||||
INTERRUPT_EXCEPTION_NOT_HANDLED,
|
||||
MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED,
|
||||
NO_MORE_SYSTEM_PTES,
|
||||
TARGET_MDL_TOO_SMALL,
|
||||
MUST_SUCCEED_POOL_EMPTY,
|
||||
ATDISK_DRIVER_INTERNAL,
|
||||
NO_SUCH_PARTITION,
|
||||
MULTIPLE_IRP_COMPLETE_REQUESTS,
|
||||
INSUFFICENT_SYSTEM_MAP_PAGES,
|
||||
DEREF_UNKNOWN_LOGON_SERVICE,
|
||||
REF_UNKNOWN_LOGON_SERVICE,
|
||||
CANCEL_STATE_IN_COMPLETED_IRP,
|
||||
PAGE_FAULT_WITH_INTERRUPTS_OFF,
|
||||
IRQL_GT_ZERO_AT_SYSTEM_SERVICE,
|
||||
STREAMS_INTERNAL_ERROR,
|
||||
FATAL_UNHANDLED_HARD_ERROR,
|
||||
NO_PAGES_AVAILABLE,
|
||||
PFN_LIST_CORRUPT,
|
||||
NDIS_INTERNAL_ERROR,
|
||||
PAGE_FAULT_IN_NONPAGED_AREA,
|
||||
REGISTRY_ERROR,
|
||||
MAILSLOT_FILE_SYSTEM,
|
||||
NO_BOOT_DEVICE,
|
||||
LM_SERVER_INTERNAL_ERROR,
|
||||
DATA_COHERENCY_EXCEPTION,
|
||||
INSTRUCTION_COHERENCY_EXCEPTION,
|
||||
XNS_INTERNAL_ERROR,
|
||||
FTDISK_INTERNAL_ERROR,
|
||||
PINBALL_FILE_SYSTEM,
|
||||
CRITICAL_SERVICE_FAILED,
|
||||
SET_ENV_VAR_FAILED,
|
||||
HAL_INITIALIZED_FAILED,
|
||||
UNSUPPORTED_PROCESSOR,
|
||||
OBJECT_INITIALIZATION_FAILED,
|
||||
SECURITY_INITIALIZATION_FAILED,
|
||||
PROCESS_INITIALIZATION_FAILED,
|
||||
HAL1_INITIALIZATION_FAILED,
|
||||
};
|
||||
enum
|
||||
{
|
||||
KBUG_NONE,
|
||||
KBUG_ORPHANED_IRP,
|
||||
KBUG_IO_STACK_OVERFLOW,
|
||||
KBUG_OUT_OF_MEMORY,
|
||||
KBUG_POOL_FREE_LIST_CORRUPT,
|
||||
|
||||
/*
|
||||
* These are well known but the actual value is unknown
|
||||
*/
|
||||
// NO_PAGES_AVAILABLE,
|
||||
|
||||
/*
|
||||
* These are well known (MS) bug types
|
||||
* (Reference: NT Insider 1997 - http://www.osr.com)
|
||||
*/
|
||||
IRQL_NOT_LESS_OR_EQUAL = 0xa,
|
||||
// KMODE_EXCEPTION_NOT_HANDLED = 0x1e,
|
||||
UNEXPECTED_KERNEL_MODE_TRAP = 0x7f,
|
||||
PAGE_FAULT_IN_NON_PAGED_AREA = 0x50,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Object attributes
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OBJ_INHERIT = 0x1,
|
||||
OBJ_PERMANENT = 0x2,
|
||||
OBJ_EXCLUSIVE = 0x4,
|
||||
OBJ_CASE_INSENSITIVE = 0x8,
|
||||
OBJ_OPENIF = 0x10,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: DPC priorities
|
||||
*/
|
||||
enum
|
||||
{
|
||||
High,
|
||||
Medium,
|
||||
Low,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Timer types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
NotificationTimer,
|
||||
SynchronizationTimer,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Some drivers use these
|
||||
*/
|
||||
#define IN
|
||||
#define OUT
|
||||
#define OPTIONAL
|
||||
|
||||
/*
|
||||
* PURPOSE: Power IRP minor function numbers
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IRP_MN_QUERY_POWER,
|
||||
IRP_MN_SET_POWER,
|
||||
IRP_MN_WAIT_WAKE,
|
||||
IRP_MN_QUERY_CAPABILITIES,
|
||||
IRP_MN_POWER_SEQUENCE,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Used all over
|
||||
*/
|
||||
enum
|
||||
{
|
||||
KernelMode,
|
||||
UserMode,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Arguments to MmProbeAndLockPages
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IoReadAccess,
|
||||
IoWriteAccess,
|
||||
IoModifyAccess,
|
||||
};
|
||||
|
||||
#define MAXIMUM_VOLUME_LABEL_LENGTH (32)
|
||||
|
||||
/*
|
||||
* IRQ levels
|
||||
*/
|
||||
enum
|
||||
{
|
||||
PASSIVE_LEVEL,
|
||||
|
||||
/*
|
||||
* Which order for these (only DISPATCH_LEVEL is important for now)
|
||||
*/
|
||||
APC_LEVEL,
|
||||
DISPATCH_LEVEL,
|
||||
|
||||
/*
|
||||
* Above here are device specific IRQ levels
|
||||
*/
|
||||
FIRST_DEVICE_SPECIFIC_LEVEL,
|
||||
HIGH_LEVEL = FIRST_DEVICE_SPECIFIC_LEVEL + NR_DEVICE_SPECIFIC_LEVELS,
|
||||
};
|
||||
|
96
reactos/include/ddk/exfuncs.h
Normal file
96
reactos/include/ddk/exfuncs.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/* EXECUTIVE ROUTINES ******************************************************/
|
||||
|
||||
VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex);
|
||||
VOID ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex);
|
||||
|
||||
BOOLEAN ExAcquireResourceExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireResourceExclusiveLite(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireResourceSharedLite(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireSharedStarveExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireSharedWaitForExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
PVOID ExAllocateFromNPagedLookasideList(PNPAGED_LOOKASIDE_LIST LookSide);
|
||||
PVOID ExAllocateFromPagedLookasideList(PPAGED_LOOKASIDE_LIST LookSide);
|
||||
PVOID ExAllocateFromZone(PZONE_HEADER Zone);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates memory from the nonpaged pool
|
||||
* ARGUMENTS:
|
||||
* size = minimum size of the block to be allocated
|
||||
* PoolType = the type of memory to use for the block (ignored)
|
||||
* RETURNS:
|
||||
* the address of the block if it succeeds
|
||||
*/
|
||||
PVOID ExAllocatePool(POOL_TYPE PoolType, ULONG size);
|
||||
|
||||
PVOID ExAllocatePoolWithQuota(POOL_TYPE PoolType, ULONG NumberOfBytes);
|
||||
PVOID ExAllocatePoolWithQuotaTag(POOL_TYPE PoolType, ULONG NumberOfBytes,
|
||||
ULONG Tag);
|
||||
PVOID ExAllocatePoolWithTag(POOL_TYPE PoolType, ULONG NumberOfBytes,
|
||||
ULONG Tag);
|
||||
VOID ExConvertExclusiveToSharedLite(PERESOURCE Resource);
|
||||
VOID ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside);
|
||||
VOID ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside);
|
||||
NTSTATUS ExDeleteResource(PERESOURCE Resource);
|
||||
NTSTATUS ExDeleteResourceLite(PERESOURCE Resource);
|
||||
NTSTATUS ExExtendZone(PZONE_HEADER Zone, PVOID Segment, ULONG SegmentSize);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases previously allocated memory
|
||||
* ARGUMENTS:
|
||||
* block = block to free
|
||||
*/
|
||||
VOID ExFreePool(PVOID block);
|
||||
|
||||
VOID ExFreeToNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PVOID Entry);
|
||||
VOID ExFreeToPagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PVOID Entry);
|
||||
PVOID ExFreeToZone(PZONE_HEADER Zone, PVOID Block);
|
||||
ERESOURCE_THREAD ExGetCurrentResourceThread(VOID);
|
||||
ULONG ExGetExclusiveWaiterCount(PERESOURCE Resource);
|
||||
ULONG ExGetSharedWaiterCount(PERESOURCE Resource);
|
||||
VOID ExInitializeFastMutex(PFAST_MUTEX FastMutex);
|
||||
VOID ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PALLOCATE_FUNCTION Allocate,
|
||||
PFREE_FUNCTION Free,
|
||||
ULONG Flags,
|
||||
ULONG Size,
|
||||
ULONG Tag,
|
||||
USHORT Depth);
|
||||
VOID ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
|
||||
PALLOCATE_FUNCTION Allocate,
|
||||
PFREE_FUNCTION Free,
|
||||
ULONG Flags,
|
||||
ULONG Size,
|
||||
ULONG Tag,
|
||||
USHORT Depth);
|
||||
NTSTATUS ExInitializeResource(PERESOURCE Resource);
|
||||
NTSTATUS ExInitializeResourceLite(PERESOURCE Resource);
|
||||
VOID ExInitializeSListHead(PSLIST_HEADER SListHead);
|
||||
VOID ExInitializeWorkItem(PWORK_QUEUE_ITEM Item,
|
||||
PWORKER_THREAD_ROUTINE Routine,
|
||||
PVOID Context);
|
||||
NTSTATUS ExInitializeZone(PZONE_HEADER Zone,
|
||||
ULONG BlockSize,
|
||||
PVOID InitialSegment,
|
||||
ULONG InitialSegmentSize);
|
||||
LARGE_INTEGER ExInterlockedAddLargeInteger(PLARGE_INTEGER Addend,
|
||||
LARGE_INTEGER Increment,
|
||||
PKSPIN_LOCK Lock);
|
||||
ULONG ExInterlockedAddUlong(PULONG Addend, ULONG Increment, PKSPIN_LOCK Lock);
|
||||
|
||||
VOID ExInterlockedRemoveEntryList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry,
|
||||
PKSPIN_LOCK Lock);
|
||||
VOID RemoveEntryFromList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry);
|
||||
PLIST_ENTRY ExInterlockedRemoveHeadList(PLIST_ENTRY Head, PKSPIN_LOCK Lock);
|
||||
|
||||
PLIST_ENTRY ExInterlockedInsertTailList(PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
|
||||
PLIST_ENTRY ExInterlockedInsertHeadList(PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
|
||||
VOID ExQueueWorkItem(PWORK_QUEUE_ITEM WorkItem,
|
||||
WORK_QUEUE_TYPE QueueType);
|
127
reactos/include/ddk/extypes.h
Normal file
127
reactos/include/ddk/extypes.h
Normal file
@@ -0,0 +1,127 @@
|
||||
|
||||
|
||||
typedef ULONG INTERLOCKED_RESULT;
|
||||
typedef ULONG WORK_QUEUE_TYPE;
|
||||
|
||||
typedef ULONG ERESOURCE_THREAD, *PERESOURCE_THREAD;
|
||||
|
||||
typedef struct _OWNER_ENTRY
|
||||
{
|
||||
ERESOURCE_THREAD OwnerThread;
|
||||
union
|
||||
{
|
||||
LONG OwnerCount;
|
||||
ULONG TableSize;
|
||||
} a;
|
||||
} OWNER_ENTRY, *POWNER_ENTRY;
|
||||
|
||||
typedef struct _ERESOURCE
|
||||
{
|
||||
LIST_ENTRY SystemResourcesList;
|
||||
POWNER_ENTRY OwnerTable;
|
||||
SHORT ActiveCount;
|
||||
USHORT Flag;
|
||||
PKSEMAPHORE SharedWaiters;
|
||||
PKEVENT ExclusiveWaiters;
|
||||
OWNER_ENTRY OwnerThreads[2];
|
||||
ULONG ContentionCount;
|
||||
USHORT NumberOfSharedWaiters;
|
||||
USHORT NumberOfExclusiveWaiters;
|
||||
union
|
||||
{
|
||||
PVOID Address;
|
||||
ULONG CreatorBackTraceIndex;
|
||||
} a;
|
||||
KSPIN_LOCK SpinLock;
|
||||
} ERESOURCE, *PERESOURCE;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LONG Count;
|
||||
struct _KTHREAD* Owner;
|
||||
ULONG Contention;
|
||||
KEVENT Event;
|
||||
ULONG OldIrql;
|
||||
} FAST_MUTEX, *PFAST_MUTEX;
|
||||
|
||||
typedef struct _ZONE_HEADER
|
||||
{
|
||||
SINGLE_LIST_ENTRY FreeList;
|
||||
SINGLE_LIST_ENTRY SegmentList;
|
||||
ULONG BlockSize;
|
||||
ULONG TotalSegmentSize;
|
||||
} ZONE_HEADER, *PZONE_HEADER;
|
||||
|
||||
typedef struct _ZONE_SEGMENT
|
||||
{
|
||||
SINGLE_LIST_ENTRY Entry;
|
||||
ULONG size;
|
||||
} ZONE_SEGMENT, *PZONE_SEGMENT;
|
||||
|
||||
typedef struct _ZONE_ENTRY
|
||||
{
|
||||
SINGLE_LIST_ENTRY Entry;
|
||||
} ZONE_ENTRY, *PZONE_ENTRY;
|
||||
|
||||
|
||||
typedef VOID (*PWORKER_THREAD_ROUTINE)(PVOID Parameter);
|
||||
|
||||
typedef struct _WORK_QUEUE_ITEM
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
PWORKER_THREAD_ROUTINE Routine;
|
||||
PVOID Context;
|
||||
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
|
||||
|
||||
typedef PVOID (*PALLOCATE_FUNCTION)(POOL_TYPE PoolType,
|
||||
ULONG NumberOfBytes,
|
||||
ULONG Tag);
|
||||
typedef VOID (*PFREE_FUNCTION)(PVOID Buffer);
|
||||
|
||||
typedef union _SLIST_HEADER
|
||||
{
|
||||
ULONGLONG Alignment;
|
||||
struct
|
||||
{
|
||||
SINGLE_LIST_ENTRY Next;
|
||||
USHORT Depth;
|
||||
USHORT Sequence;
|
||||
} s;
|
||||
} SLIST_HEADER, *PSLIST_HEADER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SLIST_HEADER ListHead;
|
||||
USHORT Depth;
|
||||
USHORT Pad;
|
||||
ULONG TotalAllocates;
|
||||
ULONG AllocateMisses;
|
||||
ULONG TotalFrees;
|
||||
ULONG TotalMisses;
|
||||
POOL_TYPE Type;
|
||||
ULONG Tag;
|
||||
ULONG Size;
|
||||
PALLOCATE_FUNCTION Allocate;
|
||||
PFREE_FUNCTION Free;
|
||||
LIST_ENTRY ListEntry;
|
||||
KSPIN_LOCK Lock;
|
||||
} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SLIST_HEADER ListHead;
|
||||
USHORT Depth;
|
||||
USHORT Pad;
|
||||
ULONG TotalAllocates;
|
||||
ULONG AllocateMisses;
|
||||
ULONG TotalFrees;
|
||||
ULONG TotalMisses;
|
||||
POOL_TYPE Type;
|
||||
ULONG Tag;
|
||||
ULONG Size;
|
||||
PALLOCATE_FUNCTION Allocate;
|
||||
PFREE_FUNCTION Free;
|
||||
LIST_ENTRY ListEntry;
|
||||
FAST_MUTEX Lock;
|
||||
} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
|
18
reactos/include/ddk/ioctrl.h
Normal file
18
reactos/include/ddk/ioctrl.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef __INCLUDE_DDK_IOCTRL_H
|
||||
#define __INCLUDE_DDK_IOCTRL_H
|
||||
|
||||
|
||||
#define CTL_CODE(Dev, Func, Meth, Acc) ( ((Dev)<<16) | ((Acc)<<14) | ((Func)<<2) | (Meth))
|
||||
|
||||
// IOCTL Parameter buffering methods
|
||||
#define METHOD_BUFFERED 0
|
||||
#define METHOD_IN_DIRECT 1
|
||||
#define METHOD_OUT_DIRECT 2
|
||||
#define METHOD_NEITHER 3
|
||||
|
||||
// IOCTL File access type
|
||||
#define FILE_ANY_ACCESS 0
|
||||
#define FILE_READ_ACCESS 1
|
||||
#define FILE_WRITE_ACCESS 2
|
||||
|
||||
#endif /* __INCLUDE_DDK_IOCTRL_H */
|
301
reactos/include/ddk/iodef.h
Normal file
301
reactos/include/ddk/iodef.h
Normal file
@@ -0,0 +1,301 @@
|
||||
#ifndef __INCLUDE_DDK_IODEF_H
|
||||
#define __INCLUDE_DDK_IODEF_H
|
||||
|
||||
typedef enum _IO_QUERY_DEVICE_DESCRIPTION
|
||||
{
|
||||
IoQueryDeviceIdentifier = 0,
|
||||
IoQueryDeviceConfigurationData,
|
||||
IoQueryDeviceComponentInformation,
|
||||
IoQueryDeviceDataFormatMaximum,
|
||||
} IO_QUERY_DEVICE_DESCRIPTION, *PIO_QUERY_DEVICE_DESCRIPTION;
|
||||
|
||||
typedef enum _CONFIGURATION_TYPE
|
||||
{
|
||||
DiskController,
|
||||
ParallelController,
|
||||
MaximumType,
|
||||
} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
|
||||
|
||||
typedef enum _CM_RESOURCE_TYPE
|
||||
{
|
||||
CmResourceTypePort = 1,
|
||||
CmResourceTypeInterrupt,
|
||||
CmResourceTypeMemory,
|
||||
CmResourceTypeDma,
|
||||
CmResourceTypeDeviceSpecific,
|
||||
CmResourceTypeMaximum,
|
||||
} CM_RESOURCE_TYPE;
|
||||
|
||||
typedef enum _CM_SHARE_DISPOSITION
|
||||
{
|
||||
CmResourceShareDeviceExclusive = 1,
|
||||
CmResourceShareDriverExclusive,
|
||||
CmResourceShareShared,
|
||||
CmResourceShareMaximum,
|
||||
} CM_SHARE_DISPOSITION;
|
||||
|
||||
enum
|
||||
{
|
||||
CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE,
|
||||
CM_RESOURCE_INTERRUPT_LATCHED,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CM_RESOURCE_PORT_MEMORY,
|
||||
CM_RESOURCE_PORT_IO,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Irp flags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* Read any data from the actual backing media
|
||||
*/
|
||||
IRP_NOCACHE,
|
||||
|
||||
/*
|
||||
* The I/O operation is performing paging
|
||||
*/
|
||||
IRP_PAGING_IO,
|
||||
|
||||
/*
|
||||
* The IRP is for a mount operation
|
||||
*/
|
||||
IRP_MOUNT_COMPLETION,
|
||||
|
||||
/*
|
||||
* The API expects synchronous behaviour
|
||||
*/
|
||||
IRP_SYNCHRONOUS_API,
|
||||
|
||||
/*
|
||||
* The IRP is associated with a larger operation
|
||||
*/
|
||||
IRP_ASSOCIATED_IRP,
|
||||
|
||||
/*
|
||||
* The AssociatedIrp.SystemBuffer field is valid
|
||||
*/
|
||||
IRP_BUFFERED_IO,
|
||||
|
||||
/*
|
||||
* The system buffer was allocated from pool and should be deallocated
|
||||
* by the I/O manager
|
||||
*/
|
||||
IRP_DEALLOCATE_BUFFER,
|
||||
|
||||
/*
|
||||
* The IRP is for an input operation
|
||||
*/
|
||||
IRP_INPUT_OPERATION,
|
||||
|
||||
/*
|
||||
* The paging operation should complete synchronously
|
||||
*/
|
||||
IRP_SYNCHRONOUS_PAGING_IO,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem create operation
|
||||
*/
|
||||
IRP_CREATE_OPERATION,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem read operation
|
||||
*/
|
||||
IRP_READ_OPERATION,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem write operation
|
||||
*/
|
||||
IRP_WRITE_OPERATION,
|
||||
|
||||
/*
|
||||
* The IRP represents a filesystem close operation
|
||||
*/
|
||||
IRP_CLOSE_OPERATION,
|
||||
|
||||
/*
|
||||
* Asynchronous behavior is advised but not required
|
||||
*/
|
||||
IRP_DEFER_IO_COMPLETION,
|
||||
};
|
||||
|
||||
/*
|
||||
* I/O operation flags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* Force an access check even if opened in kernel mode
|
||||
*/
|
||||
SL_FORCE_ACCESS_CHECK,
|
||||
|
||||
/*
|
||||
* The file being opened is a paging file
|
||||
*/
|
||||
SL_OPEN_PAGING_FILE,
|
||||
|
||||
SL_OPEN_TARGET_DIRECTORY,
|
||||
|
||||
SL_CASE_SENSITIVE,
|
||||
|
||||
SL_KEY_SPECIFIED,
|
||||
|
||||
SL_OVERRIDE_VERIFY_VOLUME,
|
||||
|
||||
SL_WRITE_THROUGH,
|
||||
|
||||
SL_FT_SEQUENTIAL_WRITE,
|
||||
|
||||
SL_FAIL_IMMEDIATELY,
|
||||
|
||||
SL_EXCLUSIVE_LOCK,
|
||||
|
||||
SL_RESTART_SCAN,
|
||||
|
||||
SL_RETURN_SINGLE_ENTRY,
|
||||
|
||||
SL_INDEX_SPECIFIED,
|
||||
|
||||
SL_WATCH_TREE,
|
||||
|
||||
SL_ALLOW_RAW_MOUNT,
|
||||
|
||||
SL_PENDING_RETURNED,
|
||||
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SL_INVOKE_ON_SUCCESS = 1,
|
||||
SL_INVOKE_ON_ERROR = 2,
|
||||
SL_INVOKE_ON_CANCEL = 4,
|
||||
};
|
||||
|
||||
/*
|
||||
* Possible flags for the device object flags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
DO_BUFFERED_IO = 0x1,
|
||||
DO_DIRECT_IO = 0x2,
|
||||
};
|
||||
|
||||
/*
|
||||
* Possible device types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* Standard define types
|
||||
*/
|
||||
FILE_DEVICE_BEEP,
|
||||
FILE_DEVICE_CDROM,
|
||||
FILE_DEVICE_CONTROLLER,
|
||||
FILE_DEVICE_DISK,
|
||||
FILE_DEVICE_INPORT_PORT,
|
||||
FILE_DEVICE_KEYBOARD,
|
||||
FILE_DEVICE_MIDI_IN,
|
||||
FILE_DEVICE_MIDI_OUT,
|
||||
FILE_DEVICE_MOUSE,
|
||||
FILE_DEVICE_NULL,
|
||||
FILE_DEVICE_PARALLEL_PORT,
|
||||
FILE_DEVICE_PRINTER,
|
||||
FILE_DEVICE_SCANNER,
|
||||
FILE_DEVICE_SERIAL_MOUSE_PORT,
|
||||
FILE_DEVICE_SERIAL_PORT,
|
||||
FILE_DEVICE_SCREEN,
|
||||
FILE_DEVICE_TAPE,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
FILE_DEVICE_VIDEO,
|
||||
FILE_DEVICE_VIRTUAL_DISK,
|
||||
FILE_DEVICE_WAVE_IN,
|
||||
FILE_DEVICE_WAVE_OUT,
|
||||
FILE_DEVICE_8042_PORT,
|
||||
|
||||
/*
|
||||
* Values beyond this are reserved for ISVs
|
||||
*/
|
||||
FILE_DEVICE_FIRST_FREE = 32768
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Possible device characteristics
|
||||
*/
|
||||
enum
|
||||
{
|
||||
FILE_REMOVABLE_MEDIA = 0x1,
|
||||
FILE_READ_ONLY_DEVICE = 0x2,
|
||||
FILE_FLOPPY_DISKETTE = 0x4,
|
||||
FILE_WRITE_ONCE_MEDIA = 0x8,
|
||||
FILE_REMOTE_DEVICE = 0x10,
|
||||
};
|
||||
|
||||
/*
|
||||
* PURPOSE: Bus types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
Internal,
|
||||
Isa,
|
||||
MicroChannel,
|
||||
TurboChannel,
|
||||
PCIBus,
|
||||
MaximumInterfaceType,
|
||||
};
|
||||
|
||||
/*
|
||||
* FIXME: These are not in the correct order
|
||||
*/
|
||||
enum
|
||||
{
|
||||
IRP_MJ_CREATE,
|
||||
IRP_MJ_CREATE_NAMED_PIPE,
|
||||
IRP_MJ_CLOSE,
|
||||
IRP_MJ_READ,
|
||||
IRP_MJ_WRITE,
|
||||
IRP_MJ_QUERY_INFORMATION,
|
||||
IRP_MJ_SET_INFORMATION,
|
||||
IRP_MJ_QUERY_EA,
|
||||
IRP_MJ_SET_EA,
|
||||
IRP_MJ_FLUSH_BUFFERS,
|
||||
IRP_MJ_QUERY_VOLUME_INFORMATION,
|
||||
IRP_MJ_SET_VOLUME_INFORMATION,
|
||||
IRP_MJ_DIRECTORY_CONTROL,
|
||||
IRP_MJ_FILE_SYSTEM_CONTROL,
|
||||
IRP_MJ_DEVICE_CONTROL,
|
||||
IRP_MJ_INTERNAL_DEVICE_CONTROL,
|
||||
IRP_MJ_SHUTDOWN,
|
||||
IRP_MJ_LOCK_CONTROL,
|
||||
IRP_MJ_CLEANUP,
|
||||
IRP_MJ_CREATE_MAILSLOT,
|
||||
IRP_MJ_QUERY_SECURITY,
|
||||
IRP_MJ_SET_SECURITY,
|
||||
IRP_MJ_QUERY_POWER,
|
||||
IRP_MJ_SET_POWER,
|
||||
IRP_MJ_DEVICE_CHANGE,
|
||||
IRP_MJ_QUERY_QUOTA,
|
||||
IRP_MJ_SET_QUOTA,
|
||||
IRP_MJ_PNP_POWER,
|
||||
IRP_MJ_MAXIMUM_FUNCTION,
|
||||
};
|
||||
|
||||
enum
|
||||
/*
|
||||
* PURPOSE: Details about the result of a file open or create
|
||||
*/
|
||||
{
|
||||
FILE_CREATED,
|
||||
// FILE_OPENED,
|
||||
FILE_OVERWRITTEN,
|
||||
FILE_SUPERSEDED,
|
||||
FILE_EXISTS,
|
||||
FILE_DOES_NOT_EXIST,
|
||||
};
|
||||
|
||||
#endif
|
523
reactos/include/ddk/iofuncs.h
Normal file
523
reactos/include/ddk/iofuncs.h
Normal file
@@ -0,0 +1,523 @@
|
||||
/* IO MANAGER ***************************************************************/
|
||||
|
||||
/*
|
||||
* FUNCTION: Registers the driver with WMI
|
||||
* ARGUMENTS:
|
||||
* DeviceObject = Device to register
|
||||
* Action = Action to take
|
||||
* RETURNS: Status (?)
|
||||
*/
|
||||
//NTSTATUS IoWMIRegistrationControl(DeviceObject, WMIREGACTION Action);
|
||||
|
||||
/*
|
||||
* FUNCTION: Synchronizes cancelable-state transistions for IRPs in a
|
||||
* multiprocessor-safe way
|
||||
* ARGUMENTS:
|
||||
* Irpl = Variable to store the current IRQ level
|
||||
*/
|
||||
VOID IoAcquireCancelSpinLock(PKIRQL Irpl);
|
||||
|
||||
typedef IO_ALLOCATION_ACTION (*PDRIVER_CONTROL)(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP irp,
|
||||
PVOID MapRegisterBase,
|
||||
PVOID Context);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates an adaptor object for a DMA operation on the target
|
||||
* device
|
||||
* ARGUMENTS:
|
||||
* Adaptor = Adapter channel or busmaster adapter to be allocated
|
||||
* DeviceObject = Target device for DMA
|
||||
* NumberOfMapRegisters = Number of map registers
|
||||
* ExecutionRoutine = Routine to be called when the adaptor is
|
||||
* available
|
||||
* Context = driver defined contex that will be passed to the
|
||||
* execution routine
|
||||
* RETURNS: Success or failure code
|
||||
*/
|
||||
NTSTATUS IoAllocateAdapterChannel(PADAPTER_OBJECT AdaperObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
ULONG NumberOfMapRegisters,
|
||||
PDRIVER_CONTROL ExecutionRoutine,
|
||||
PVOID Context);
|
||||
|
||||
/*
|
||||
* FUNCTION: Sets up a call to a driver supplied controller object as
|
||||
* soon as it is available
|
||||
* ARGUMENTS:
|
||||
* ControllerObject = Driver created controller object
|
||||
* DeviceObject = target device
|
||||
* ExecutionObject = Routine to be called
|
||||
* Context = Driver determined context to be based to the routine
|
||||
*/
|
||||
VOID IoAllocateController(PCONTROLLER_OBJECT ControllerObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PDRIVER_CONTROL ExecutionRoutine,
|
||||
PVOID Context);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates an error log packet
|
||||
* ARGUMENTS:
|
||||
* IoObject = Object which found the error
|
||||
* EntrySize = Size in bytes of the packet to be allocated
|
||||
* RETURNS: On success a pointer to the allocated packet
|
||||
* On failure returns NULL
|
||||
*/
|
||||
PVOID IoAllocateErrorLogEntry(PVOID IoObject, UCHAR EntrySize);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates an IRP
|
||||
* ARGUMENTS:
|
||||
* StackSize = number of stack locations to allocate
|
||||
* ChargeQuota = Who knows
|
||||
* RETURNS: On success the allocated IRP
|
||||
* On failure NULL
|
||||
*/
|
||||
PIRP IoAllocateIrp(CCHAR StackSize, BOOLEAN ChargeQuota);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates an MDL large enough to map the supplied buffer
|
||||
* ARGUMENTS:
|
||||
* VirtualAddress = base virtual address of the buffer to be mapped
|
||||
* Length = length of the buffer to be mapped
|
||||
* SecondaryBuffer = Whether the buffer is primary or secondary
|
||||
* ChargeQuota = Charge non-paged pool quota to current thread
|
||||
* Irp = Optional irp to be associated with the MDL
|
||||
* RETURNS: On the success the allocated MDL
|
||||
* On failure NULL
|
||||
*/
|
||||
PMDL IoAllocateMdl(PVOID VirtualAddress, ULONG Length,
|
||||
BOOLEAN SecondaryBuffer, BOOLEAN ChargeQuota,
|
||||
PIRP Irp);
|
||||
|
||||
/*
|
||||
* FUNCTION: Creates a symbolic link between the ARC name of a physical
|
||||
* device and the name of the corresponding device object
|
||||
* ARGUMENTS:
|
||||
* ArcName = ARC name of the device
|
||||
* DeviceName = Name of the device object
|
||||
*/
|
||||
VOID IoAssignArcName(PUNICODE_STRING ArcName, PUNICODE_STRING DeviceName);
|
||||
|
||||
enum
|
||||
{
|
||||
IO_NO_INCREMENT,
|
||||
};
|
||||
|
||||
/*
|
||||
* FUNCTION: Takes a list of requested hardware resources and allocates them
|
||||
* ARGUMENTS:
|
||||
* RegisterPath =
|
||||
* DriverClassName =
|
||||
* DriverObject = Driver object passed to the DriverEntry routine
|
||||
* DeviceObject =
|
||||
* RequestedResources = List of resources
|
||||
* RETURNS:
|
||||
*/
|
||||
NTSTATUS IoAssignResources(PUNICODE_STRING RegistryPath,
|
||||
PUNICODE_STRING DriverClassName,
|
||||
PDRIVER_OBJECT DriverObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
|
||||
PCM_RESOURCE_LIST* AllocatedResources);
|
||||
|
||||
/*
|
||||
* FUNCTION: Attaches the callers device object to a named target device
|
||||
* ARGUMENTS:
|
||||
* SourceDevice = caller's device
|
||||
* TargetDevice = Name of the target device
|
||||
* AttachedDevice = Caller allocated storage. On return contains
|
||||
* a pointer to the target device
|
||||
* RETURNS: Success or failure code
|
||||
*/
|
||||
NTSTATUS IoAttachDevice(PDEVICE_OBJECT SourceDevice,
|
||||
PUNICODE_STRING TargetDevice,
|
||||
PDEVICE_OBJECT* AttachedDevice);
|
||||
|
||||
/*
|
||||
* FUNCTION: Obsolete
|
||||
* ARGUMENTS:
|
||||
* SourceDevice = device to attach
|
||||
* TargetDevice = device to be attached to
|
||||
* RETURNS: Success or failure code
|
||||
*/
|
||||
NTSTATUS IoAttachDeviceByPointer(PDEVICE_OBJECT SourceDevice,
|
||||
PDEVICE_OBJECT TargetDevice);
|
||||
|
||||
/*
|
||||
* FUNCTION: Attaches the callers device to the highest device in the chain
|
||||
* ARGUMENTS:
|
||||
* SourceDevice = caller's device
|
||||
* TargetDevice = Device to attach
|
||||
* RETURNS: On success the previously highest device
|
||||
* On failure NULL
|
||||
*/
|
||||
PDEVICE_OBJECT IoAttachDeviceToDeviceStack(PDEVICE_OBJECT SourceDevice,
|
||||
PDEVICE_OBJECT TargetDevice);
|
||||
|
||||
/*
|
||||
* FUNCTION: Builds a irp to be sent to lower level drivers
|
||||
* ARGUMENTS:
|
||||
* MajorFunction = Major function code to be set in the IRP
|
||||
* DeviceObject = Next lower device object
|
||||
* Buffer = Buffer (only required for some major function codes)
|
||||
* Length = Length in bytes of the buffer
|
||||
* StartingOffset = Starting offset on the target device
|
||||
* IoStatusBlock = Storage for status about the operation (optional)
|
||||
* RETURNS: On success the IRP allocated
|
||||
* On failure NULL
|
||||
*/
|
||||
PIRP IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
PLARGE_INTEGER StartingOffset,
|
||||
PIO_STATUS_BLOCK IoStatusBlock);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates and sets up an IRP for a device control request
|
||||
* ARGUMENTS:
|
||||
* IoControlCode = Type of request
|
||||
* DeviceObject = Target device
|
||||
* InputBuffer = Optional input buffer to the driver
|
||||
* InputBufferLength = Length of the input buffer
|
||||
* OutputBuffer = Optional output buffer
|
||||
* OutputBufferLength = Length of the output buffer
|
||||
* InternalDeviceIoControl = TRUE if the request is internal
|
||||
* Event = Initialized event for the caller to wait for the request
|
||||
* to be completed
|
||||
* IoStatusBlock = I/O status block to be set when the request is
|
||||
* completed
|
||||
* RETURNS: Returns the IRP created
|
||||
*/
|
||||
PIRP IoBuildDeviceIoControlRequest(ULONG IoControlCode,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PVOID InputBuffer,
|
||||
ULONG InputBufferLength,
|
||||
PVOID OutputBuffer,
|
||||
ULONG OutputBufferLength,
|
||||
BOOLEAN InternalDeviceIoControl,
|
||||
PKEVENT Event,
|
||||
PIO_STATUS_BLOCK IoStatusBlock);
|
||||
|
||||
|
||||
VOID IoBuildPartialMdl(PMDL SourceMdl,
|
||||
PMDL TargetMdl,
|
||||
PVOID VirtualAddress,
|
||||
ULONG Length);
|
||||
|
||||
PIRP IoBuildSynchronousFsdRequest(ULONG MajorFunction,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
PLARGE_INTEGER StartingOffset,
|
||||
PKEVENT Event,
|
||||
PIO_STATUS_BLOCK IoStatusBlock);
|
||||
|
||||
/*
|
||||
* FUNCTION: Sends an irp to the next lower driver
|
||||
*/
|
||||
NTSTATUS IoCallDriver(PDEVICE_OBJECT DeviceObject, PIRP irp);
|
||||
|
||||
BOOLEAN IoCancelIrp(PIRP Irp);
|
||||
|
||||
NTSTATUS IoCheckShareAccess(ACCESS_MASK DesiredAccess,
|
||||
ULONG DesiredShareAccess,
|
||||
PFILE_OBJECT FileObject,
|
||||
PSHARE_ACCESS ShareAccess,
|
||||
BOOLEAN Update);
|
||||
|
||||
/*
|
||||
* FUNCTION: Indicates the caller has finished all processing for a given
|
||||
* I/O request and is returning the given IRP to the I/O manager
|
||||
* ARGUMENTS:
|
||||
* Irp = Irp to be cancelled
|
||||
* PriorityBoost = Increment by which to boost the priority of the
|
||||
* thread making the request
|
||||
*/
|
||||
VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost);
|
||||
|
||||
NTSTATUS IoConnectInterrupt(PKINTERRUPT* InterruptObject,
|
||||
PKSERVICE_ROUTINE ServiceRoutine,
|
||||
PVOID ServiceContext,
|
||||
PKSPIN_LOCK SpinLock,
|
||||
ULONG Vector,
|
||||
KIRQL Irql,
|
||||
KIRQL SynchronizeIrql,
|
||||
KINTERRUPT_MODE InterruptMode,
|
||||
BOOLEAN ShareVector,
|
||||
KAFFINITY ProcessorEnableMask,
|
||||
BOOLEAN FloatingSave);
|
||||
|
||||
PCONTROLLER_OBJECT IoCreateController(ULONG Size);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates memory for and intializes a device object for use for
|
||||
* a driver
|
||||
* ARGUMENTS:
|
||||
* DriverObject : Driver object passed by iomgr when the driver was
|
||||
* loaded
|
||||
* DeviceExtensionSize : Number of bytes for the device extension
|
||||
* DeviceName : Unicode name of device
|
||||
* DeviceType : Device type
|
||||
* DeviceCharacteristics : Bit mask of device characteristics
|
||||
* Exclusive : True if only one thread can access the device at a
|
||||
* time
|
||||
* RETURNS:
|
||||
* Success or failure
|
||||
* DeviceObject : Contains a pointer to allocated device object
|
||||
* if the call succeeded
|
||||
* NOTES: See the DDK documentation for more information
|
||||
*/
|
||||
NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
||||
ULONG DeviceExtensionSize,
|
||||
PUNICODE_STRING DeviceName,
|
||||
DEVICE_TYPE DeviceType,
|
||||
ULONG DeviceCharacteristics,
|
||||
BOOLEAN Exclusive,
|
||||
PDEVICE_OBJECT* DeviceObject);
|
||||
|
||||
|
||||
PKEVENT IoCreateNotificationEvent(PUNICODE_STRING EventName,
|
||||
PHANDLE EventHandle);
|
||||
|
||||
NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName);
|
||||
|
||||
PKEVENT IoCreateSynchronizationEvent(PUNICODE_STRING EventName,
|
||||
PHANDLE EventHandle);
|
||||
|
||||
NTSTATUS IoCreateUnprotectedSymbolicLink(PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName);
|
||||
|
||||
|
||||
VOID IoDeassignArcName(PUNICODE_STRING ArcName);
|
||||
|
||||
VOID IoDeleteController(PCONTROLLER_OBJECT ControllerObject);
|
||||
|
||||
VOID IoDeleteDevice(PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
NTSTATUS IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName);
|
||||
|
||||
VOID IoDetachDevice(PDEVICE_OBJECT TargetDevice);
|
||||
|
||||
VOID IoDisconnectInterrupt(PKINTERRUPT InterruptObject);
|
||||
|
||||
BOOLEAN IoFlushAdapterBuffers(PADAPTER_OBJECT AdapterObject,
|
||||
PMDL Mdl,
|
||||
PVOID MapRegisterBase,
|
||||
PVOID CurrentVa,
|
||||
ULONG Length,
|
||||
BOOLEAN WriteToDevice);
|
||||
|
||||
VOID IoFreeAdapterChannel(PADAPTER_OBJECT AdapterObject);
|
||||
VOID IoFreeController(PCONTROLLER_OBJECT ControllerObject);
|
||||
VOID IoFreeIrp(PIRP Irp);
|
||||
VOID IoFreeMapRegisters(PADAPTER_OBJECT AdapterObject,
|
||||
PVOID MapRegisterBase,
|
||||
ULONG NumberOfMapRegisters);
|
||||
VOID IoFreeMdl(PMDL Mdl);
|
||||
PCONFIGURATION_INFORMATION IoGetConfigurationInformation(VOID);
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns a pointer to the callers stack location in the irp
|
||||
*/
|
||||
PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(IRP* irp);
|
||||
|
||||
struct _EPROCESS* IoGetCurrentProcess(VOID);
|
||||
|
||||
NTSTATUS IoGetDeviceObjectPointer(PUNICODE_STRING ObjectName,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
PFILE_OBJECT* FileObject,
|
||||
PDEVICE_OBJECT* DeviceObject);
|
||||
|
||||
PDEVICE_OBJECT IoGetDeviceToVerify(PETHREAD Thread);
|
||||
|
||||
PGENERIC_MAPPING IoGetFileObjectGenericMapping(VOID);
|
||||
|
||||
ULONG IoGetFunctionCodeFromCtlCode(ULONG ControlCode);
|
||||
|
||||
PVOID IoGetInitialStack(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION:
|
||||
*/
|
||||
PIO_STACK_LOCATION IoGetNextIrpStackLocation(IRP* irp);
|
||||
|
||||
PDEVICE_OBJECT IoGetRelatedDeviceObject(PFILE_OBJECT FileObject);
|
||||
|
||||
VOID IoInitializeDpcRequest(PDEVICE_OBJECT DeviceObject,
|
||||
PIO_DPC_ROUTINE DpcRoutine);
|
||||
|
||||
/*
|
||||
* FUNCTION: Initalizes an irp allocated by the caller
|
||||
* ARGUMENTS:
|
||||
* Irp = IRP to initalize
|
||||
* PacketSize = Size in bytes of the IRP
|
||||
* StackSize = Number of stack locations in the IRP
|
||||
*/
|
||||
VOID IoInitializeIrp(PIRP Irp, USHORT PacketSize, CCHAR StackSize);
|
||||
|
||||
NTSTATUS IoInitializeTimer(PDEVICE_OBJECT DeviceObject,
|
||||
PIO_TIMER_ROUTINE TimerRoutine,
|
||||
PVOID Context);
|
||||
|
||||
BOOLEAN IoIsErrorUserInduced(NTSTATUS Status);
|
||||
|
||||
BOOLEAN IoIsTotalDeviceFailure(NTSTATUS Status);
|
||||
|
||||
PIRP IoMakeAssociatedIrp(PIRP Irp, CCHAR StackSize);
|
||||
|
||||
PHYSICAL_ADDRESS IoMapTransfer(PADAPTER_OBJECT AdapterObject,
|
||||
PMDL Mdl,
|
||||
PVOID MapRegisterBase,
|
||||
PVOID CurrentVa,
|
||||
PULONG Length,
|
||||
BOOLEAN WriteToDevice);
|
||||
|
||||
/*
|
||||
* FUNCTION: Marks an IRP as pending
|
||||
* ARGUMENTS:
|
||||
* Irp = Irp to mark
|
||||
* NOTE: If a driver doesn't complete the irp in its dispatch routine it
|
||||
* must mark it pending otherwise the I/O manager will complete it on
|
||||
* return from the dispatch routine.
|
||||
*/
|
||||
VOID IoMarkIrpPending(PIRP Irp);
|
||||
|
||||
NTSTATUS IoQueryDeviceDescription(PINTERFACE_TYPE BusType,
|
||||
PULONG BusNumber,
|
||||
PCONFIGURATION_TYPE ControllerType,
|
||||
PULONG ControllerNumber,
|
||||
PCONFIGURATION_TYPE PeripheralType,
|
||||
PULONG PeripheralNumber,
|
||||
PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
|
||||
PVOID Context);
|
||||
|
||||
VOID IoRaiseHardError(PIRP Irp, PVPB Vpb, PDEVICE_OBJECT RealDeviceObject);
|
||||
|
||||
BOOLEAN IoRaiseHardInformationalError(NTSTATUS ErrorStatus,
|
||||
PUNICODE_STRING String,
|
||||
PKTHREAD Thread);
|
||||
|
||||
NTSTATUS IoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||
ULONG SectorSize,
|
||||
BOOLEAN ReturnedRecognizedPartitions,
|
||||
struct _DRIVE_LAYOUT_INFORMATION** PBuffer);
|
||||
|
||||
VOID IoRegisterDriverReinitialization(PDRIVER_OBJECT DriverObject,
|
||||
PDRIVER_REINITIALIZE ReinitRoutine,
|
||||
PVOID Context);
|
||||
|
||||
NTSTATUS IoRegisterShutdownNotification(PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
VOID IoReleaseCancelSpinLock(KIRQL Irql);
|
||||
|
||||
VOID IoRemoveShareAccess(PFILE_OBJECT FileObject,
|
||||
PSHARE_ACCESS ShareAccess);
|
||||
|
||||
NTSTATUS IoReportResourceUsage(PUNICODE_STRING DriverClassName,
|
||||
PDRIVER_OBJECT DriverObject,
|
||||
PCM_RESOURCE_LIST DriverList,
|
||||
ULONG DriverListSize,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PCM_RESOURCE_LIST DeviceList,
|
||||
ULONG DeviceListSize,
|
||||
BOOLEAN OverrideConflict,
|
||||
PBOOLEAN ConflictDetected);
|
||||
|
||||
VOID IoRequestDpc(PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context);
|
||||
|
||||
PDRIVER_CANCEL IoSetCancelRoutine(PIRP Irp, PDRIVER_CANCEL CancelRoutine);
|
||||
|
||||
VOID IoSetCompletionRoutine(PIRP Irp,
|
||||
PIO_COMPLETION_ROUTINE CompletionRoutine,
|
||||
PVOID Context,
|
||||
BOOLEAN InvokeOnSuccess,
|
||||
BOOLEAN InvokeOnError,
|
||||
BOOLEAN InvokeOnCancel);
|
||||
|
||||
VOID IoSetHardErrorOrVerifyDevice(PIRP Irp, PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
VOID IoSetNextIrpStackLocation(PIRP Irp);
|
||||
|
||||
NTSTATUS IoSetPartitionInformation(PDEVICE_OBJECT DeviceObject,
|
||||
ULONG SectorSize,
|
||||
ULONG PartitionNumber,
|
||||
ULONG PartitionType);
|
||||
|
||||
VOID IoSetShareAccess(ACCESS_MASK DesiredAccess,
|
||||
ULONG DesiredShareAccess,
|
||||
PFILE_OBJECT FileObject,
|
||||
PSHARE_ACCESS ShareAccess);
|
||||
|
||||
/*
|
||||
* FUNCTION: Determines the size of an IRP
|
||||
* ARGUMENTS:
|
||||
* StackSize = number of stack locations in the IRP
|
||||
* RETURNS: The size of the IRP in bytes
|
||||
*/
|
||||
USHORT IoSizeOfIrp(CCHAR StackSize);
|
||||
|
||||
/*
|
||||
* FUNCTION: Dequeues the next IRP from the device's associated queue and
|
||||
* calls its StartIo routine
|
||||
* ARGUMENTS:
|
||||
* DeviceObject = Device object
|
||||
* Cancelable = True if IRPs in the queue can be cancelled
|
||||
*/
|
||||
VOID IoStartNextPacket(PDEVICE_OBJECT DeviceObject, BOOLEAN Cancelable);
|
||||
|
||||
VOID IoStartNextPacketByKey(PDEVICE_OBJECT DeviceObject,
|
||||
BOOLEAN Cancelable,
|
||||
ULONG Key);
|
||||
|
||||
/*
|
||||
* FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
|
||||
* the device is busy
|
||||
* ARGUMENTS:
|
||||
* DeviceObject = Device to pass the IRP to
|
||||
* Irp = Irp to be processed
|
||||
* Key = Optional value for where to insert the IRP
|
||||
* CancelFunction = Entry point for a driver supplied cancel function
|
||||
*/
|
||||
VOID IoStartPacket(PDEVICE_OBJECT DeviceObject, PIRP Irp, PULONG Key,
|
||||
PDRIVER_CANCEL CancelFunction);
|
||||
|
||||
VOID IoStartTimer(PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
VOID IoStopTimer(PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
VOID IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject);
|
||||
|
||||
VOID IoUpdateShareAccess(PFILE_OBJECT FileObject, PSHARE_ACCESS ShareAccess);
|
||||
|
||||
VOID IoWriteErrorLogEntry(PVOID ElEntry);
|
||||
|
||||
NTSTATUS IoWritePartitionTable(PDEVICE_OBJECT DeviceObject,
|
||||
ULONG SectorSize,
|
||||
ULONG SectorsPerTrack,
|
||||
ULONG NumberOfHeads,
|
||||
struct _DRIVE_LAYOUT_INFORMATION* PBuffer);
|
||||
|
||||
typedef ULONG FS_INFORMATION_CLASS;
|
||||
|
||||
// Preliminary guess
|
||||
NTKERNELAPI NTSTATUS IoQueryFileVolumeInformation(IN PFILE_OBJECT FileObject,
|
||||
IN FS_INFORMATION_CLASS FsInformationClass,
|
||||
IN ULONG Length,
|
||||
OUT PVOID FsInformation,
|
||||
OUT PULONG ReturnedLength);
|
||||
|
||||
NTKERNELAPI // confirmed - Undocumented because it does not require a valid file handle
|
||||
NTSTATUS
|
||||
IoQueryFileInformation(
|
||||
IN PFILE_OBJECT FileObject,
|
||||
IN FILE_INFORMATION_CLASS FileInformationClass,
|
||||
IN ULONG Length,
|
||||
OUT PVOID FileInformation,
|
||||
OUT PULONG ReturnedLength
|
||||
);
|
581
reactos/include/ddk/iotypes.h
Normal file
581
reactos/include/ddk/iotypes.h
Normal file
@@ -0,0 +1,581 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_DDK_IOTYPES_H
|
||||
#define __INCLUDE_DDK_IOTYPES_H
|
||||
|
||||
/*
|
||||
* These are referenced before they can be fully defined
|
||||
*/
|
||||
struct _DRIVER_OBJECT;
|
||||
struct _FILE_OBJECT;
|
||||
struct _DEVICE_OBJECT;
|
||||
struct _IRP;
|
||||
struct _IO_STATUS_BLOCK;
|
||||
|
||||
/* SIMPLE TYPES *************************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
DeallocateObject,
|
||||
KeepObject,
|
||||
};
|
||||
|
||||
typedef ULONG INTERFACE_TYPE;
|
||||
typedef INTERFACE_TYPE* PINTERFACE_TYPE;
|
||||
|
||||
/*
|
||||
* FIXME: Definition needed
|
||||
*/
|
||||
typedef struct _SHARE_ACCESS
|
||||
{
|
||||
} SHARE_ACCESS, *PSHARE_ACCESS;
|
||||
|
||||
/* FUNCTION TYPES ************************************************************/
|
||||
|
||||
typedef VOID (*PDRIVER_REINITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
|
||||
PVOID Context,
|
||||
ULONG Count);
|
||||
|
||||
typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
|
||||
PUNICODE_STRING Pathname,
|
||||
INTERFACE_TYPE BusType,
|
||||
ULONG BusNumber,
|
||||
PKEY_VALUE_FULL_INFORMATION* BI,
|
||||
CONFIGURATION_TYPE ControllerType,
|
||||
ULONG ControllerNumber,
|
||||
PKEY_VALUE_FULL_INFORMATION* CI,
|
||||
CONFIGURATION_TYPE PeripheralType,
|
||||
ULONG PeripheralNumber,
|
||||
PKEY_VALUE_FULL_INFORMATION* PI);
|
||||
|
||||
typedef NTSTATUS (*PIO_COMPLETION_ROUTINE)(struct _DEVICE_OBJECT* DeviceObject,
|
||||
struct _IRP* Irp,
|
||||
PVOID Context);
|
||||
|
||||
typedef VOID (*PIO_APC_ROUTINE) (PVOID ApcContext,
|
||||
struct _IO_STATUS_BLOCK* IoStatusBlock,
|
||||
ULONG Reserved);
|
||||
|
||||
|
||||
/* STRUCTURE TYPES ***********************************************************/
|
||||
|
||||
typedef struct _ADAPTER_OBJECT
|
||||
{
|
||||
} ADAPTER_OBJECT, *PADAPTER_OBJECT;
|
||||
|
||||
/*
|
||||
* PURPOSE: Special timer associated with each device
|
||||
* NOTES: This is a guess
|
||||
*/
|
||||
typedef struct _IO_TIMER
|
||||
{
|
||||
KTIMER timer;
|
||||
KDPC dpc;
|
||||
} IO_TIMER, *PIO_TIMER;
|
||||
|
||||
/*
|
||||
* PURPOSE: IRP stack location
|
||||
*/
|
||||
typedef struct _IO_STACK_LOCATION
|
||||
{
|
||||
/*
|
||||
* Type of request
|
||||
*/
|
||||
UCHAR MajorFunction;
|
||||
|
||||
/*
|
||||
* Further information about request type
|
||||
*/
|
||||
UCHAR MinorFunction;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
UCHAR Flags;
|
||||
|
||||
/*
|
||||
* FUNCTION: Various flags including for the io completion routine
|
||||
*/
|
||||
UCHAR Control;
|
||||
|
||||
/*
|
||||
* Parameters for request
|
||||
*/
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
/*
|
||||
* Number of bytes to be transferrred
|
||||
*/
|
||||
ULONG Length;
|
||||
|
||||
/*
|
||||
* Possibly used to sort incoming request (to be documented)
|
||||
*/
|
||||
ULONG Key;
|
||||
|
||||
/*
|
||||
* Optional starting offset for read
|
||||
*/
|
||||
LARGE_INTEGER ByteOffset;
|
||||
} Read;
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Key;
|
||||
LARGE_INTEGER ByteOffset;
|
||||
} Write;
|
||||
struct
|
||||
{
|
||||
ULONG OutputBufferLength;
|
||||
ULONG InputBufferLength;
|
||||
ULONG IoControlCode;
|
||||
PVOID Type3InputBuffer;
|
||||
} DeviceIoControl;
|
||||
|
||||
} Parameters;
|
||||
|
||||
/*
|
||||
* PURPOSE: Completion routine
|
||||
* NOTE: If this is the nth stack location (where the 1st is passed to the
|
||||
* highest level driver) then this is the completion routine set by
|
||||
* the (n-1)th driver
|
||||
*/
|
||||
PIO_COMPLETION_ROUTINE CompletionRoutine;
|
||||
PVOID CompletionContext;
|
||||
|
||||
/*
|
||||
* Driver created device object representing the target device
|
||||
*/
|
||||
struct _DEVICE_OBJECT* DeviceObject;
|
||||
|
||||
/*
|
||||
* File object (if any) associated with DeviceObject
|
||||
*/
|
||||
struct _FILE_OBJECT* FileObject;
|
||||
} IO_STACK_LOCATION, *PIO_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;
|
||||
|
||||
/*
|
||||
* Driver entry point declaration
|
||||
*/
|
||||
typedef NTSTATUS (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
|
||||
PUNICODE_STRING RegistryPath);
|
||||
|
||||
/*
|
||||
* Driver cancel declaration
|
||||
*/
|
||||
typedef NTSTATUS (*PDRIVER_CANCEL)(struct _DRIVER_OBJECT* DriverObject,
|
||||
PUNICODE_STRING RegistryPath);
|
||||
|
||||
|
||||
typedef struct _SECTION_OBJECT_POINTERS
|
||||
{
|
||||
PVOID DataSectionObject;
|
||||
PVOID SharedCacheMap;
|
||||
PVOID ImageSectionObject;
|
||||
} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
|
||||
|
||||
typedef struct _IO_COMPLETION_CONTEXT
|
||||
{
|
||||
PVOID Port;
|
||||
ULONG Key;
|
||||
} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
|
||||
|
||||
#define FO_FILE_OPEN 0x00000001
|
||||
#define FO_SYNCHRONOUS_IO 0x00000002
|
||||
#define FO_ALERTABLE_IO 0x00000004
|
||||
#define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
|
||||
#define FO_WRITE_THROUGH 0x00000010
|
||||
#define FO_SEQUENTIAL_ONLY 0x00000020
|
||||
#define FO_CACHE_SUPPORTED 0x00000040
|
||||
#define FO_NAMED_PIPE 0x00000080
|
||||
#define FO_STREAM_FILE 0x00000100
|
||||
#define FO_MAILSLOT 0x00000200
|
||||
#define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
|
||||
#define FO_DIRECT_DEVICE_OPEN 0x00000800
|
||||
#define FO_FILE_MODIFIED 0x00001000
|
||||
#define FO_FILE_SIZE_CHANGED 0x00002000
|
||||
#define FO_CLEANUP_COMPLETE 0x00004000
|
||||
#define FO_TEMPORARY_FILE 0x00008000
|
||||
#define FO_DELETE_ON_CLOSE 0x00010000
|
||||
#define FO_OPENED_CASE_SENSITIVE 0x00020000
|
||||
#define FO_HANDLE_CREATED 0x00040000
|
||||
#define FO_FILE_FAST_IO_READ 0x00080000
|
||||
|
||||
typedef struct _FILE_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
struct _DEVICE_OBJECT* DeviceObject;
|
||||
struct _VPB* Vpb;
|
||||
PVOID FsContext;
|
||||
PVOID FsContext2;
|
||||
PSECTION_OBJECT_POINTERS SectionObjectPointers;
|
||||
PVOID PrivateCacheMap;
|
||||
NTSTATUS FinalStatus;
|
||||
struct _FILE_OBJECT* RelatedFileObject;
|
||||
BOOLEAN LockOperation;
|
||||
BOOLEAN DeletePending;
|
||||
BOOLEAN ReadAccess;
|
||||
BOOLEAN WriteAccess;
|
||||
BOOLEAN DeleteAccess;
|
||||
BOOLEAN SharedRead;
|
||||
BOOLEAN SharedWrite;
|
||||
BOOLEAN SharedDelete;
|
||||
ULONG Flags;
|
||||
UNICODE_STRING FileName;
|
||||
LARGE_INTEGER CurrentByteOffset;
|
||||
ULONG Waiters;
|
||||
ULONG Busy;
|
||||
PVOID LastLock;
|
||||
KEVENT Lock;
|
||||
KEVENT Event;
|
||||
PIO_COMPLETION_CONTEXT CompletionContext;
|
||||
} FILE_OBJECT, *PFILE_OBJECT;
|
||||
|
||||
|
||||
typedef struct _IRP
|
||||
{
|
||||
PMDL MdlAddress;
|
||||
ULONG Flags;
|
||||
union
|
||||
{
|
||||
struct _IRP* MasterIrp;
|
||||
LONG IrpCount;
|
||||
PVOID SystemBuffer;
|
||||
} AssociatedIrp;
|
||||
LIST_ENTRY ThreadListEntry;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
KPROCESSOR_MODE RequestorMode;
|
||||
BOOLEAN PendingReturned;
|
||||
BOOLEAN Cancel;
|
||||
KIRQL CancelIrql;
|
||||
PDRIVER_CANCEL CancelRoutine;
|
||||
PVOID UserBuffer;
|
||||
PVOID ApcEnvironment;
|
||||
ULONG AllocationFlags;
|
||||
PIO_STATUS_BLOCK UserIosb;
|
||||
PKEVENT UserEvent;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
PIO_APC_ROUTINE UserApcRoutine;
|
||||
PVOID UserApcContext;
|
||||
} AsynchronousParameters;
|
||||
LARGE_INTEGER AllocationSize;
|
||||
} Overlay;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
|
||||
struct _ETHREAD* Thread;
|
||||
PCHAR AuxiliaryBuffer;
|
||||
LIST_ENTRY ListEntry;
|
||||
struct _IO_STACK_LOCATION* CurrentStackLocation;
|
||||
PFILE_OBJECT OriginalFileObject;
|
||||
} Overlay;
|
||||
KAPC Apc;
|
||||
ULONG CompletionKey;
|
||||
} Tail;
|
||||
ULONG CurrentLocation;
|
||||
IO_STACK_LOCATION Stack[1];
|
||||
} IRP, *PIRP;
|
||||
|
||||
|
||||
typedef struct _VPB
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
USHORT Flags;
|
||||
USHORT VolumeLabelLength;
|
||||
struct _DEVICE_OBJECT* DeviceObject;
|
||||
struct _DEVICE_OBJECT* RealDevice;
|
||||
ULONG SerialNumber;
|
||||
ULONG ReferenceCount;
|
||||
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
|
||||
} VPB, *PVPB;
|
||||
|
||||
|
||||
typedef struct _DEVICE_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
LONG ReferenceCount;
|
||||
struct _DRIVER_OBJECT* DriverObject;
|
||||
struct _DEVICE_OBJECT* NextDevice;
|
||||
struct _DEVICE_OBJECT* AttachedDevice;
|
||||
struct _IRP* CurrentIrp;
|
||||
PIO_TIMER Timer;
|
||||
ULONG Flags;
|
||||
ULONG Characteristics;
|
||||
PVPB Vpb;
|
||||
PVOID DeviceExtension;
|
||||
DEVICE_TYPE DeviceType;
|
||||
CCHAR StackSize;
|
||||
union
|
||||
{
|
||||
LIST_ENTRY ListHead;
|
||||
WAIT_CONTEXT_BLOCK Wcb;
|
||||
} Queue;
|
||||
ULONG AlignmentRequirement;
|
||||
KDEVICE_QUEUE DeviceQueue;
|
||||
KDPC Dpc;
|
||||
ULONG ActiveThreadCount;
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor;
|
||||
KEVENT DeviceLock;
|
||||
USHORT SectorSize;
|
||||
USHORT Spare1;
|
||||
struct _DEVOBJ_EXTENSION* DeviceObjectExtension;
|
||||
PVOID Reserved;
|
||||
} DEVICE_OBJECT, *PDEVICE_OBJECT;
|
||||
|
||||
/*
|
||||
* Dispatch routine type declaration
|
||||
*/
|
||||
typedef NTSTATUS (*PDRIVER_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
|
||||
|
||||
/*
|
||||
* Fast i/o routine type declaration
|
||||
*/
|
||||
typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
|
||||
|
||||
/*
|
||||
* Dispatch routine type declaration
|
||||
*/
|
||||
typedef VOID (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT*, IRP*);
|
||||
|
||||
/*
|
||||
* Dispatch routine type declaration
|
||||
*/
|
||||
typedef NTSTATUS (*PDRIVER_UNLOAD)(struct _DRIVER_OBJECT*);
|
||||
|
||||
typedef struct _DRIVER_EXTENSION
|
||||
{
|
||||
struct _DRIVER_OBJECT* DriverObject;
|
||||
PDRIVER_ADD_DEVICE AddDevice;
|
||||
ULONG Count;
|
||||
UNICODE_STRING ServiceKeyName;
|
||||
} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
|
||||
|
||||
typedef struct _DRIVER_OBJECT
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Magic values for debugging
|
||||
*/
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
ULONG Flags;
|
||||
PVOID DriverStart;
|
||||
ULONG DriverSize;
|
||||
PVOID DriverSection;
|
||||
PDRIVER_EXTENSION DriverExtension;
|
||||
UNICODE_STRING DriverName;
|
||||
PUNICODE_STRING HardwareDatabase;
|
||||
PFAST_IO_DISPATCH FastIoDispatch;
|
||||
PDRIVER_INITIALIZE DriverInit;
|
||||
PDRIVER_STARTIO DriverStartIo;
|
||||
PDRIVER_UNLOAD DriverUnload;
|
||||
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
|
||||
} DRIVER_OBJECT, *PDRIVER_OBJECT;
|
||||
|
||||
|
||||
typedef struct _CONFIGURATION_INFORMATION
|
||||
{
|
||||
ULONG DiskCount;
|
||||
ULONG FloppyCount;
|
||||
ULONG CDRomCount;
|
||||
ULONG TapeCount;
|
||||
ULONG ScsiPortCount;
|
||||
ULONG SerialCount;
|
||||
ULONG ParallelCount;
|
||||
BOOLEAN AtDiskPrimaryAddressClaimed;
|
||||
BOOLEAN AtDiskSecondaryAddressClaimed;
|
||||
} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
|
||||
|
||||
typedef VOID (*PIO_DPC_ROUTINE)(PKDPC Dpc,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
PVOID Context);
|
||||
|
||||
typedef VOID (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
|
||||
PVOID Context);
|
||||
|
||||
#if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
|
||||
typedef struct _PARTITION_INFORMATION
|
||||
{
|
||||
LARGE_INTEGER StartingOffset;
|
||||
LARGE_INTEGER PartitionLength;
|
||||
ULONG HiddenSectors;
|
||||
ULONG PartitionNumber;
|
||||
UCHAR PartitionType;
|
||||
BOOLEAN BootIndicator;
|
||||
BOOLEAN RecognizedPartition;
|
||||
BOOLEAN RewritePartition;
|
||||
} PARTITION_INFORMATION, *PPARTITION_INFORMATION;
|
||||
#endif
|
||||
|
||||
typedef struct _DRIVER_LAYOUT_INFORMATION
|
||||
{
|
||||
ULONG PartitionCount;
|
||||
ULONG Signature;
|
||||
PARTITION_INFORMATION PartitionEntry[1];
|
||||
} DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _IO_RESOURCE_DESCRIPTOR
|
||||
{
|
||||
UCHAR Option;
|
||||
UCHAR Type;
|
||||
UCHAR SharedDisposition;
|
||||
|
||||
/*
|
||||
* Reserved for system use
|
||||
*/
|
||||
UCHAR Spare1;
|
||||
|
||||
USHORT Flags;
|
||||
|
||||
/*
|
||||
* Reserved for system use
|
||||
*/
|
||||
UCHAR Spare2;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Alignment;
|
||||
PHYSICAL_ADDRESS MinimumAddress;
|
||||
PHYSICAL_ADDRESS MaximumAddress;
|
||||
} Port;
|
||||
struct
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Alignment;
|
||||
PHYSICAL_ADDRESS MinimumAddress;
|
||||
PHYSICAL_ADDRESS MaximumAddress;
|
||||
} Memory;
|
||||
struct
|
||||
{
|
||||
ULONG MinimumVector;
|
||||
ULONG MaximumVector;
|
||||
} Interrupt;
|
||||
struct
|
||||
{
|
||||
ULONG MinimumChannel;
|
||||
ULONG MaximumChannel;
|
||||
} Dma;
|
||||
} u;
|
||||
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct _IO_RESOURCE_LIST
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Revision;
|
||||
ULONG Count;
|
||||
IO_RESOURCE_DESCRIPTOR Descriptors[1];
|
||||
} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
|
||||
|
||||
typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
|
||||
{
|
||||
/*
|
||||
* List size in bytes
|
||||
*/
|
||||
ULONG ListSize;
|
||||
|
||||
/*
|
||||
* System defined enum for the bus
|
||||
*/
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
|
||||
ULONG BusNumber;
|
||||
ULONG SlotNumber;
|
||||
ULONG Reserved[3];
|
||||
ULONG AlternativeLists;
|
||||
IO_RESOURCE_LIST List[1];
|
||||
} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UCHAR Type;
|
||||
UCHAR ShareDisposition;
|
||||
USHORT Flags;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
PHYSICAL_ADDRESS Start;
|
||||
ULONG Length;
|
||||
} Port;
|
||||
struct
|
||||
{
|
||||
ULONG Level;
|
||||
ULONG Vector;
|
||||
ULONG Affinity;
|
||||
} Interrupt;
|
||||
struct
|
||||
{
|
||||
PHYSICAL_ADDRESS Start;
|
||||
ULONG Length;
|
||||
} Memory;
|
||||
struct
|
||||
{
|
||||
ULONG Channel;
|
||||
ULONG Port;
|
||||
ULONG Reserved1;
|
||||
} Dma;
|
||||
struct
|
||||
{
|
||||
ULONG DataSize;
|
||||
ULONG Reserved1;
|
||||
ULONG Reserved2;
|
||||
} DeviceSpecificData;
|
||||
} u;
|
||||
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
USHORT Version;
|
||||
USHORT Revision;
|
||||
ULONG Count;
|
||||
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
|
||||
} CM_PARTIAL_RESOURCE_LIST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
ULONG BusNumber;
|
||||
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
|
||||
} CM_FULL_RESOURCE_DESCRIPTOR;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG Count;
|
||||
CM_FULL_RESOURCE_DESCRIPTOR List[1];
|
||||
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
|
||||
|
||||
|
||||
#endif __INCLUDE_DDK_IOTYPES_H
|
42
reactos/include/ddk/kedef.h
Normal file
42
reactos/include/ddk/kedef.h
Normal file
@@ -0,0 +1,42 @@
|
||||
typedef enum _KINTERRUPT_MODE
|
||||
{
|
||||
LevelSensitive,
|
||||
Latched,
|
||||
} KINTERRUPT_MODE;
|
||||
|
||||
typedef enum _EVENT_TYPE
|
||||
{
|
||||
NotificationEvent,
|
||||
SynchronizationEvent,
|
||||
SemaphoreType,
|
||||
} EVENT_TYPE;
|
||||
|
||||
typedef enum _KWAIT_REASON
|
||||
{
|
||||
Executive,
|
||||
FreePage,
|
||||
PageIn,
|
||||
PoolAllocation,
|
||||
DelayExecution,
|
||||
Suspended,
|
||||
UserRequest,
|
||||
WrExecutive,
|
||||
WrFreePage,
|
||||
WrPageIn,
|
||||
WrDelayExecution,
|
||||
WrSuspended,
|
||||
WrUserRequest,
|
||||
WrQueue,
|
||||
WrLpcReceive,
|
||||
WrLpcReply,
|
||||
WrVirtualMemory,
|
||||
WrPageOut,
|
||||
WrRendezvous,
|
||||
Spare2,
|
||||
Spare3,
|
||||
Spare4,
|
||||
Spare5,
|
||||
Spare6,
|
||||
WrKernel,
|
||||
MaximumWaitReason,
|
||||
} KWAIT_REASON;
|
158
reactos/include/ddk/kefuncs.h
Normal file
158
reactos/include/ddk/kefuncs.h
Normal file
@@ -0,0 +1,158 @@
|
||||
#ifndef __INCLUDE_DDK_KEFUNCS_H
|
||||
#define __INCLUDE_DDK_KEFUNCS_H
|
||||
|
||||
/* KERNEL FUNCTIONS ********************************************************/
|
||||
|
||||
struct _KAPC;
|
||||
|
||||
void KeInitializeApc(
|
||||
struct _KAPC *Apc,
|
||||
PKTHREAD Thread,
|
||||
UCHAR StateIndex,
|
||||
PKKERNEL_ROUTINE KernelRoutine,
|
||||
PKRUNDOWN_ROUTINE RundownRoutine,
|
||||
PKNORMAL_ROUTINE NormalRoutine,
|
||||
UCHAR Mode,
|
||||
PVOID Context
|
||||
);
|
||||
|
||||
void KeInsertQueueApc(struct _KAPC *Apc, PVOID SystemArgument1,
|
||||
PVOID SystemArgument2, UCHAR Mode);
|
||||
void KeAttachProcess(struct _EPROCESS* Process);
|
||||
void KeDetachProcess(VOID);
|
||||
VOID KeDrainApcQueue(VOID);
|
||||
PKPROCESS KeGetCurrentProcess(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Acquires a spinlock so the caller can synchronize access to
|
||||
* data
|
||||
* ARGUMENTS:
|
||||
* SpinLock = Initialized spinlock
|
||||
* OldIrql (OUT) = Set the previous irql on return
|
||||
*/
|
||||
VOID KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql);
|
||||
|
||||
VOID KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock);
|
||||
BOOLEAN KeCancelTimer(PKTIMER Timer);
|
||||
VOID KeClearEvent(PKEVENT Event);
|
||||
NTSTATUS KeDelayExecutionThread(KPROCESSOR_MODE WaitMode,
|
||||
BOOLEAN Alertable,
|
||||
PLARGE_INTEGER Internal);
|
||||
BOOLEAN KeDeregisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD
|
||||
CallbackRecord);
|
||||
VOID KeEnterCriticalRegion(VOID);
|
||||
VOID KeFlushIoBuffers(PMDL Mdl, BOOLEAN ReadOperation, BOOLEAN DmaOperation);
|
||||
KIRQL KeGetCurrentIrql(VOID);
|
||||
ULONG KeGetCurrentProcessorNumber(VOID);
|
||||
ULONG KeGetDcacheFillSize(VOID);
|
||||
PKTHREAD KeGetCurrentThread(VOID);
|
||||
VOID KeInitializeCallbackRecord(PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
|
||||
VOID KeInitializeDeviceQueue(PKDEVICE_QUEUE DeviceQueue);
|
||||
VOID KeInitializeDpc(PKDPC Dpc, PKDEFERRED_ROUTINE DeferredRoutine,
|
||||
PVOID DeferredContext);
|
||||
VOID KeInitializeEvent(PKEVENT Event, EVENT_TYPE Type, BOOLEAN State);
|
||||
VOID KeInitializeMutex(PKMUTEX Mutex, ULONG Level);
|
||||
VOID KeInitializeSemaphore(PKSEMAPHORE Semaphore, LONG Count, LONG Limit);
|
||||
VOID KeInitializeTimer(PKTIMER Timer);
|
||||
VOID KeInitializeTimerEx(PKTIMER Timer, TIMER_TYPE Type);
|
||||
BOOLEAN KeInsertByKeyDeviceQueue(PKDEVICE_QUEUE DeviceQueue,
|
||||
PKDEVICE_QUEUE_ENTRY DeviceQueueEntry,
|
||||
ULONG SortKey);
|
||||
BOOLEAN KeInsertDeviceQueue(PKDEVICE_QUEUE DeviceQueue,
|
||||
PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
|
||||
BOOLEAN KeInsertQueueDpc(PKDPC Dpc, PVOID SystemArgument1,
|
||||
PVOID SystemArgument2);
|
||||
VOID KeLeaveCriticalRegion(VOID);
|
||||
VOID KeLowerIrql(KIRQL NewIrql);
|
||||
LARGE_INTEGER KeQueryPerformanceCounter(PLARGE_INTEGER PerformanceFrequency);
|
||||
VOID KeQuerySystemTime(PLARGE_INTEGER CurrentTime);
|
||||
VOID KeQueryTickCount(PLARGE_INTEGER TickCount);
|
||||
ULONG KeQueryTimeIncrement(VOID);
|
||||
VOID KeRaiseIrql(KIRQL NewIrql, PKIRQL OldIrql);
|
||||
LONG KeReadStateEvent(PKEVENT Event);
|
||||
LONG KeReadStateMutex(PKMUTEX Mutex);
|
||||
LONG KeReadStateSemaphore(PKSEMAPHORE Semaphore);
|
||||
BOOLEAN KeReadStateTimer(PKTIMER Timer);
|
||||
BOOLEAN KeRegisterBugCheckCallback(PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
|
||||
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
|
||||
PVOID Buffer,
|
||||
ULONG Length,
|
||||
PUCHAR Component);
|
||||
LONG KeReleaseMutex(PKMUTEX Mutex, BOOLEAN Wait);
|
||||
LONG KeReleaseSemaphore(PKSEMAPHORE Semaphore, KPRIORITY Increment,
|
||||
LONG Adjustment, BOOLEAN Wait);
|
||||
VOID KeReleaseSpinLock(PKSPIN_LOCK Spinlock, KIRQL NewIrql);
|
||||
VOID KeReleaseSpinLockFromDpcLevel(PKSPIN_LOCK Spinlock);
|
||||
PKDEVICE_QUEUE_ENTRY KeRemoveByKeyDeviceQueue(PKDEVICE_QUEUE DeviceQueue,
|
||||
ULONG SortKey);
|
||||
PKDEVICE_QUEUE_ENTRY KeRemoveDeviceQueue(PKDEVICE_QUEUE DeviceQueue);
|
||||
BOOLEAN KeRemoveEntryDeviceQueue(PKDEVICE_QUEUE DeviceQueue,
|
||||
PKDEVICE_QUEUE_ENTRY DeviceQueueEntry);
|
||||
BOOLEAN KeRemoveQueueDpc(PKDPC Dpc);
|
||||
LONG KeResetEvent(PKEVENT Event);
|
||||
LONG KeSetBasePriorityThread(PKTHREAD Thread, LONG Increment);
|
||||
LONG KeSetEvent(PKEVENT Event, KPRIORITY Increment, BOOLEAN Wait);
|
||||
KPRIORITY KeSetPriorityThread(PKTHREAD Thread, KPRIORITY Priority);
|
||||
BOOLEAN KeSetTimer(PKTIMER Timer, LARGE_INTEGER DueTime, PKDPC Dpc);
|
||||
BOOLEAN KeSetTimerEx(PKTIMER Timer, LARGE_INTEGER DueTime, LONG Period,
|
||||
PKDPC Dpc);
|
||||
VOID KeStallExecutionProcessor(ULONG MicroSeconds);
|
||||
BOOLEAN KeSynchronizeExecution(PKINTERRUPT Interrupt,
|
||||
PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
|
||||
PVOID SynchronizeContext);
|
||||
NTSTATUS KeWaitForMultipleObjects(ULONG Count,
|
||||
PVOID Object[],
|
||||
WAIT_TYPE WaitType,
|
||||
KWAIT_REASON WaitReason,
|
||||
KPROCESSOR_MODE WaitMode,
|
||||
BOOLEAN Alertable,
|
||||
PLARGE_INTEGER Timeout,
|
||||
PKWAIT_BLOCK WaitBlockArray);
|
||||
NTSTATUS KeWaitForMutexObject(PKMUTEX Mutex, KWAIT_REASON WaitReason,
|
||||
KPROCESSOR_MODE WaitMode, BOOLEAN Alertable,
|
||||
PLARGE_INTEGER Timeout);
|
||||
NTSTATUS KeWaitForSingleObject(PVOID Object, KWAIT_REASON WaitReason,
|
||||
KPROCESSOR_MODE WaitMode,
|
||||
BOOLEAN Alertable, PLARGE_INTEGER Timeout);
|
||||
|
||||
/*
|
||||
* FUNCTION: Initializes a spinlock
|
||||
* ARGUMENTS:
|
||||
* SpinLock = Spinlock to initialize
|
||||
*/
|
||||
VOID KeInitializeSpinLock(PKSPIN_LOCK SpinLock);
|
||||
|
||||
/*
|
||||
* FUNCTION: Sets the current irql without altering the current processor
|
||||
* state
|
||||
* ARGUMENTS:
|
||||
* newlvl = IRQ level to set
|
||||
* NOTE: This is for internal use only
|
||||
*/
|
||||
VOID KeSetCurrentIrql(KIRQL newlvl);
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Brings the system down in a controlled manner when an
|
||||
* inconsistency that might otherwise cause corruption has been detected
|
||||
* ARGUMENTS:
|
||||
* BugCheckCode = Specifies the reason for the bug check
|
||||
* BugCheckParameter[1-4] = Additional information about bug
|
||||
* RETURNS: Doesn't
|
||||
*/
|
||||
VOID KeBugCheckEx(ULONG BugCheckCode,
|
||||
ULONG BugCheckParameter1,
|
||||
ULONG BugCheckParameter2,
|
||||
ULONG BugCheckParameter3,
|
||||
ULONG BugCheckParameter4);
|
||||
|
||||
/*
|
||||
* FUNCTION: Brings the system down in a controlled manner when an
|
||||
* inconsistency that might otherwise cause corruption has been detected
|
||||
* ARGUMENTS:
|
||||
* BugCheckCode = Specifies the reason for the bug check
|
||||
* RETURNS: Doesn't
|
||||
*/
|
||||
VOID KeBugCheck(ULONG BugCheckCode);
|
||||
|
||||
#endif /* __INCLUDE_DDK_KEFUNCS_H */
|
299
reactos/include/ddk/ketypes.h
Normal file
299
reactos/include/ddk/ketypes.h
Normal file
@@ -0,0 +1,299 @@
|
||||
/* KERNEL TYPES **************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_DDK_KETYPES_H
|
||||
#define __INCLUDE_DDK_KETYPES_H
|
||||
|
||||
struct _KMUTANT;
|
||||
|
||||
typedef LONG KPRIORITY;
|
||||
|
||||
typedef VOID (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
|
||||
typedef BOOLEAN (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext);
|
||||
|
||||
struct _KAPC;
|
||||
|
||||
typedef VOID (*PKNORMAL_ROUTINE)(PVOID NormalContext,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2);
|
||||
typedef VOID (*PKKERNEL_ROUTINE)(struct _KAPC* Apc,
|
||||
PKNORMAL_ROUTINE* NormalRoutine,
|
||||
PVOID* NormalContext,
|
||||
PVOID* SystemArgument1,
|
||||
PVOID* SystemArgument2);
|
||||
|
||||
typedef VOID (*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
|
||||
|
||||
typedef struct
|
||||
/*
|
||||
* PURPOSE: Object describing the wait a thread is currently performing
|
||||
*/
|
||||
{
|
||||
LIST_ENTRY WaitListEntry;
|
||||
struct _KTHREAD* Thread;
|
||||
PVOID Object;
|
||||
struct _KWAIT_BLOCK* NextWaitBlock;
|
||||
USHORT WaitKey;
|
||||
USHORT WaitType;
|
||||
} KWAIT_BLOCK, *PKWAIT_BLOCK;
|
||||
|
||||
typedef struct _DISPATCHER_HEADER
|
||||
{
|
||||
UCHAR Type;
|
||||
UCHAR Absolute;
|
||||
UCHAR Size;
|
||||
UCHAR Inserted;
|
||||
LONG SignalState;
|
||||
LIST_ENTRY WaitListHead;
|
||||
} DISPATCHER_HEADER;
|
||||
|
||||
struct _KDPC;
|
||||
|
||||
typedef struct _KTIMER
|
||||
{
|
||||
/*
|
||||
* Pointers to maintain the linked list of activated timers
|
||||
*/
|
||||
LIST_ENTRY entry;
|
||||
|
||||
/*
|
||||
* Absolute expiration time in system time units
|
||||
*/
|
||||
signed long long expire_time;
|
||||
|
||||
/*
|
||||
* Optional dpc associated with the timer
|
||||
*/
|
||||
struct _KDPC* dpc;
|
||||
|
||||
/*
|
||||
* True if the timer is signaled
|
||||
*/
|
||||
BOOLEAN signaled;
|
||||
|
||||
/*
|
||||
* True if the timer is in the system timer queue
|
||||
*/
|
||||
BOOLEAN running;
|
||||
|
||||
/*
|
||||
* Type of the timer either Notification or Synchronization
|
||||
*/
|
||||
TIMER_TYPE type;
|
||||
|
||||
/*
|
||||
* Period of the timer in milliseconds (zero if once-only)
|
||||
*/
|
||||
ULONG period;
|
||||
|
||||
} KTIMER, *PKTIMER;
|
||||
|
||||
struct _KSPIN_LOCK;
|
||||
|
||||
typedef struct _KSPIN_LOCK
|
||||
{
|
||||
KIRQL irql;
|
||||
} KSPIN_LOCK, *PKSPIN_LOCK;
|
||||
|
||||
typedef struct _KDEVICE_QUEUE
|
||||
{
|
||||
LIST_ENTRY ListHead;
|
||||
BOOLEAN Busy;
|
||||
KSPIN_LOCK Lock;
|
||||
} KDEVICE_QUEUE, *PKDEVICE_QUEUE;
|
||||
|
||||
#if RIGHT_DEFINITION_PROVIDED_ABOVE
|
||||
#define _KTHREAD _ETHREAD
|
||||
|
||||
typedef struct _KTHREAD
|
||||
/*
|
||||
* PURPOSE: Describes a thread of execution
|
||||
*/
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
|
||||
/*
|
||||
* PURPOSE: Head of the queue of apcs
|
||||
*/
|
||||
LIST_ENTRY ApcQueueHead;
|
||||
|
||||
/*
|
||||
* PURPOSE: Entry in the linked list of threads
|
||||
*/
|
||||
LIST_ENTRY Entry;
|
||||
|
||||
/*
|
||||
* PURPOSE: Current state of the thread
|
||||
*/
|
||||
ULONG State;
|
||||
|
||||
/*
|
||||
* PURPOSE: Priority modifier of the thread
|
||||
*/
|
||||
ULONG Priority;
|
||||
|
||||
/*
|
||||
* PURPOSE: Pointer to our process
|
||||
*/
|
||||
struct _EPROCESS* Process;
|
||||
|
||||
/*
|
||||
* PURPOSE: Handle of our process
|
||||
*/
|
||||
HANDLE ProcessHandle;
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread affinity mask
|
||||
*/
|
||||
ULONG AffinityMask;
|
||||
|
||||
/*
|
||||
* PURPOSE: Saved thread context
|
||||
*/
|
||||
hal_thread_state context;
|
||||
|
||||
/*
|
||||
* PURPOSE: Timeout for the thread to be woken up
|
||||
*/
|
||||
signed long long int wake_time;
|
||||
|
||||
} KTHREAD, *PKTHREAD, *PETHREAD;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _KAPC
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
ULONG Spare0;
|
||||
struct _KTHREAD* Thread;
|
||||
LIST_ENTRY ApcListEntry;
|
||||
PKKERNEL_ROUTINE KernelRoutine;
|
||||
PKRUNDOWN_ROUTINE RundownRoutine;
|
||||
PKNORMAL_ROUTINE NormalRoutine;
|
||||
PVOID NormalContext;
|
||||
PVOID SystemArgument1;
|
||||
PVOID SystemArgument2;
|
||||
CCHAR ApcStateIndex;
|
||||
KPROCESSOR_MODE ApcMode;
|
||||
BOOLEAN Inserted;
|
||||
} KAPC, *PKAPC;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
|
||||
PVOID Buffer;
|
||||
ULONG Length;
|
||||
PUCHAR Component;
|
||||
ULONG Checksum;
|
||||
UCHAR State;
|
||||
} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DISPATCHER_HEADER Header;
|
||||
LIST_ENTRY MutantListEntry;
|
||||
struct _KTHREAD* OwnerThread;
|
||||
BOOLEAN Abandoned;
|
||||
UCHAR ApcDisable;
|
||||
} KMUTEX, *PKMUTEX;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DISPATCHER_HEADER Header;
|
||||
LONG Limit;
|
||||
} KSEMAPHORE, *PKSEMAPHORE;
|
||||
|
||||
typedef struct _KEVENT
|
||||
/*
|
||||
* PURPOSE: Describes an event
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* PURPOSE: So we can use the general wait routine
|
||||
*/
|
||||
DISPATCHER_HEADER Header;
|
||||
} KEVENT, *PKEVENT;
|
||||
|
||||
|
||||
|
||||
typedef VOID (*PDRIVER_ADD_DEVICE)(VOID);
|
||||
|
||||
struct _KDPC;
|
||||
|
||||
/*
|
||||
* PURPOSE: Defines a delayed procedure call routine
|
||||
* NOTE:
|
||||
* Dpc = The associated DPC object
|
||||
* DeferredContext = Driver defined context for the DPC
|
||||
* SystemArgument[1-2] = Undocumented.
|
||||
*
|
||||
*/
|
||||
typedef VOID (*PKDEFERRED_ROUTINE)(struct _KDPC* Dpc, PVOID DeferredContext,
|
||||
PVOID SystemArgument1, PVOID SystemArgument2);
|
||||
|
||||
typedef struct _KDPC
|
||||
/*
|
||||
* PURPOSE: Defines a delayed procedure call object
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Magic value to check this is the current object type
|
||||
*/
|
||||
SHORT Type;
|
||||
|
||||
/*
|
||||
* PURPOSE: Target processor or zero if untargetted
|
||||
*/
|
||||
UCHAR Number;
|
||||
|
||||
/*
|
||||
* PURPOSE: Indication of desired latency before exection
|
||||
*/
|
||||
UCHAR Importance;
|
||||
|
||||
LIST_ENTRY DpcListEntry;
|
||||
PKDEFERRED_ROUTINE DeferredRoutine;
|
||||
PVOID DeferredContext;
|
||||
PVOID SystemArgument1;
|
||||
PVOID SystemArgument2;
|
||||
|
||||
/*
|
||||
* PURPOSE: If non-zero then already in queue
|
||||
*/
|
||||
PULONG Lock;
|
||||
|
||||
} KDPC, *PKDPC;
|
||||
|
||||
|
||||
|
||||
typedef struct _KDEVICE_QUEUE_ENTRY
|
||||
{
|
||||
LIST_ENTRY Entry;
|
||||
ULONG Key;
|
||||
} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY;
|
||||
|
||||
typedef struct _WAIT_CONTEXT_BLOCK
|
||||
{
|
||||
} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
|
||||
|
||||
struct _KINTERRUPT;
|
||||
|
||||
typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
|
||||
PVOID ServiceContext);
|
||||
|
||||
typedef struct _KINTERRUPT
|
||||
{
|
||||
ULONG Vector;
|
||||
KAFFINITY ProcessorEnableMask;
|
||||
PKSPIN_LOCK IrqLock;
|
||||
BOOLEAN Shareable;
|
||||
BOOLEAN FloatingSave;
|
||||
PKSERVICE_ROUTINE ServiceRoutine;
|
||||
PVOID ServiceContext;
|
||||
LIST_ENTRY Entry;
|
||||
KIRQL SynchLevel;
|
||||
} KINTERRUPT, *PKINTERRUPT;
|
||||
|
||||
#endif /* __INCLUDE_DDK_KETYPES_H */
|
297
reactos/include/ddk/mmfuncs.h
Normal file
297
reactos/include/ddk/mmfuncs.h
Normal file
@@ -0,0 +1,297 @@
|
||||
/* MEMORY MANAGMENT ******************************************************/
|
||||
|
||||
#include <internal/hal/page.h>
|
||||
|
||||
/*
|
||||
* FUNCTION: Determines if the given virtual address is page aligned
|
||||
*/
|
||||
#define IS_PAGE_ALIGNED(Va) (((ULONG)Va)&0xfff)
|
||||
|
||||
/*
|
||||
* PURPOSE: Returns the byte offset of a field within a structure
|
||||
*/
|
||||
#define FIELD_OFFSET(Type,Field) (LONG)(&(((Type *)(0))->Field))
|
||||
|
||||
/*
|
||||
* PURPOSE: Returns the base address structure if the caller knows the
|
||||
* address of a field within the structure
|
||||
* ARGUMENTS:
|
||||
* Address = address of the field
|
||||
* Type = Type of the whole structure
|
||||
* Field = Name of the field whose address is none
|
||||
*/
|
||||
#define CONTAINING_RECORD(Address,Type,Field) (Type *)(((LONG)Address) - FIELD_OFFSET(Type,Field))
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the number of pages spanned by an address range
|
||||
* ARGUMENTS:
|
||||
* Va = start of range
|
||||
* Size = Size of range
|
||||
* RETURNS: The number of pages
|
||||
*/
|
||||
extern inline unsigned int ADDRESS_AND_SIZE_TO_SPAN_PAGES(PVOID Va,
|
||||
ULONG Size)
|
||||
{
|
||||
ULONG HighestAddr;
|
||||
ULONG LowestAddr;
|
||||
|
||||
HighestAddr = PAGE_ROUND_UP(Size + ((ULONG)Va));
|
||||
LowestAddr = PAGE_ROUND_DOWN((ULONG)Va);
|
||||
return((HighestAddr - LowestAddr) / PAGESIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns FALSE is the pointer is NULL, TRUE otherwise
|
||||
*/
|
||||
#define ARGUMENT_PRESENT(arg) ((arg)!=NULL)
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the byte offset of the address within its page
|
||||
*/
|
||||
#define BYTE_OFFSET(va) (((ULONG)va)%PAGESIZE)
|
||||
|
||||
/*
|
||||
* FUNCTION: Takes a count in bytes and returns the number of pages
|
||||
* required to hold it
|
||||
*/
|
||||
#define BYTES_TO_PAGES(size) (?)
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates a range of physically contiguous cache aligned
|
||||
* memory from the non-paged pool
|
||||
* ARGUMENTS:
|
||||
* NumberOfBytes = Size of the memory block to allocate
|
||||
* HighestAcceptableAddress = Highest address valid for the caller
|
||||
* RETURNS: The virtual address of the memory block on success
|
||||
* NULL on error
|
||||
*/
|
||||
PVOID MmAllocateContiguousMemory(ULONG NumberOfBytes,
|
||||
PHYSICAL_ADDRESS HighestAcceptableAddress);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates a virtual address range of noncached and cache
|
||||
* aligned memory
|
||||
* ARGUMENTS:
|
||||
* NumberOfBytes = Size of region to allocate
|
||||
* RETURNS: The base address of the range on success
|
||||
* NULL on failure
|
||||
*/
|
||||
PVOID MmAllocateNonCachedMemory(ULONG NumberOfBytes);
|
||||
|
||||
/*
|
||||
* FUNCTION: Fills in the corresponding physical page array for a given MDL
|
||||
* for a buffer in nonpaged system space
|
||||
* ARGUMENTS:
|
||||
* MemoryDescriptorList = MDL to fill
|
||||
*/
|
||||
VOID MmBuildMdlForNonPagedPool(PMDL MemoryDescriptorList);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates and initializes an MDL
|
||||
* ARGUMENTS:
|
||||
* MemoryDescriptorList = Optional caller allocated MDL to initalize
|
||||
* Base = Base virtual address for buffer
|
||||
* Length = Length in bytes of the buffer
|
||||
* RETURNS: A pointer to the initalized MDL
|
||||
*/
|
||||
PMDL MmCreateMdl(PMDL MemoryDescriptorList, PVOID Base, ULONG Length);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases a range of physically contiguous memory allocated
|
||||
* with MmAllocateContiguousMemory
|
||||
* ARGUMENTS:
|
||||
* BaseAddress = Vritual address of the memory to be freed
|
||||
*/
|
||||
VOID MmFreeContiguousMemory(PVOID BaseAddress);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases a range of noncached memory allocated with
|
||||
* MmAllocateNonCachedMemory
|
||||
* ARGUMENTS:
|
||||
* BaseAddress = Virtual address to be freed
|
||||
* NumberOfBytes = size of the region to be freed
|
||||
*/
|
||||
VOID MmFreeNonCachedMemory(PVOID BaseAddress, ULONG NumberOfBytes);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the length in bytes of a buffer described by an MDL
|
||||
* ARGUMENTS:
|
||||
* Mdl = the mdl
|
||||
* RETURNS: Size of the buffer
|
||||
*/
|
||||
ULONG MmGetMdlByteCount(PMDL Mdl);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the byte offset within a page of the buffer described
|
||||
* by an MDL
|
||||
* ARGUMENTS:
|
||||
* Mdl = the mdl
|
||||
* RETURNS: The offset in bytes
|
||||
*/
|
||||
ULONG MmGetMdlByteOffset(PMDL Mdl);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the initial virtual address for a buffer described
|
||||
* by an MDL
|
||||
* ARGUMENTS:
|
||||
* Mdl = the mdl
|
||||
* RETURNS: The initial virtual address
|
||||
*/
|
||||
PVOID MmGetMdlVirtualAddress(PMDL Mdl);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the physical address corresponding to a given valid
|
||||
* virtual address
|
||||
* ARGUMENTS:
|
||||
* BaseAddress = the virtual address
|
||||
* RETURNS: The physical address
|
||||
*/
|
||||
PHYSICAL_ADDRESS MmGetPhysicalAddress(PVOID BaseAddress);
|
||||
|
||||
/*
|
||||
* FUNCTION: Maps the physical pages described by an MDL into system space
|
||||
* ARGUMENTS:
|
||||
* Mdl = mdl
|
||||
* RETURNS: The base system address for the mapped buffer
|
||||
*/
|
||||
PVOID MmGetSystemAddressForMdl(PMDL Mdl);
|
||||
|
||||
/*
|
||||
* FUNCTION: Initalizes an mdl
|
||||
* ARGUMENTS:
|
||||
* MemoryDescriptorList = MDL to be initalized
|
||||
* BaseVa = Base virtual address of the buffer
|
||||
* Length = Length in bytes of the buffer
|
||||
*/
|
||||
VOID MmInitializeMdl(PMDL MemoryDescriptorList, PVOID BaseVa, ULONG Length);
|
||||
|
||||
/*
|
||||
* FUNCTION: Checks whether an address is valid for read/write
|
||||
* ARGUMENTS:
|
||||
* VirtualAddress = address to be check
|
||||
* RETURNS: TRUE if an access would be valid
|
||||
*/
|
||||
BOOLEAN MmIsAddressValid(PVOID VirtualAddress);
|
||||
|
||||
/*
|
||||
* FUNCTION: Checks if the current platform is a workstation or a server
|
||||
* RETURNS: If the system is a server returns true
|
||||
* NOTE: Drivers can use this as an estimate of the likely resources
|
||||
* available
|
||||
*/
|
||||
BOOLEAN MmIsThisAnAsSystem(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Locks a section of the driver's code into memory
|
||||
* ARGUMENTS:
|
||||
* AddressWithinSection = Any address in the region
|
||||
* RETURNS: A handle to the region
|
||||
*/
|
||||
PVOID MmLockPagableCodeSection(PVOID AddressWithinSection);
|
||||
|
||||
/*
|
||||
* FUNCTION: Locks a section of the driver's data into memory
|
||||
* ARGUMENTS:
|
||||
* AddressWithinSection = Any address in the region
|
||||
* RETURNS: A handle to the region
|
||||
*/
|
||||
PVOID MmLockPagableDataSection(PVOID AddressWithinSection);
|
||||
|
||||
/*
|
||||
* FUNCTION: Locks a section of memory
|
||||
* ARGUMENTS:
|
||||
* ImageSectionHandle = handle returned from MmLockPagableCodeSection
|
||||
* or MmLockPagableDataSection
|
||||
*/
|
||||
VOID MmLockPagableSectionByHandle(PVOID ImageSectionHandle);
|
||||
|
||||
/*
|
||||
* FUNCTION: Maps a physical memory range into system space
|
||||
* ARGUMENTS:
|
||||
* PhysicalAddress = First physical address to map
|
||||
* NumberOfBytes = Number of bytes to map
|
||||
* CacheEnable = TRUE if the range can be cached
|
||||
* RETURNS: The base virtual address which maps the region
|
||||
*/
|
||||
PVOID MmMapIoSpace(PHYSICAL_ADDRESS PhysicalAddress, ULONG NumberOfBytes,
|
||||
BOOLEAN CacheEnable);
|
||||
|
||||
/*
|
||||
* FUNCTION: Maps the pages described by a given MDL
|
||||
* ARGUMENTS:
|
||||
* MemoryDescriptorList = MDL updated by MmProbeAndLockPages
|
||||
* AccessMode = Access mode in which to map the MDL
|
||||
* RETURNS: The base virtual address which maps the buffer
|
||||
*/
|
||||
PVOID MmMapLockedPages(PMDL MemoryDescriptorList, KPROCESSOR_MODE AccessMode);
|
||||
|
||||
/*
|
||||
* FUNCTION: Makes the whole driver pageable
|
||||
* ARGUMENTS:
|
||||
* AddressWithinSection = Any address within the driver
|
||||
*/
|
||||
VOID MmPageEntireDriver(PVOID AddressWithinSection);
|
||||
|
||||
/*
|
||||
* FUNCTION: Resets the pageable status of a driver's sections to their
|
||||
* compile time settings
|
||||
* ARGUMENTS:
|
||||
* AddressWithinSection = Any address within the driver
|
||||
*/
|
||||
VOID MmResetDriverPaging(PVOID AddressWithinSection);
|
||||
|
||||
/*
|
||||
* FUNCTION: Reinitializes a caller-allocated MDL
|
||||
* ARGUMENTS:
|
||||
* Mdl = Points to the MDL that will be reused
|
||||
*/
|
||||
VOID MmPrepareMdlForReuse(PMDL Mdl);
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes the specified pages, makes them resident and locks
|
||||
* the physical pages mapped by the virtual address range
|
||||
* ARGUMENTS:
|
||||
* MemoryDescriptorList = MDL which supplies the virtual address,
|
||||
* byte offset and length
|
||||
* AccessMode = Access mode with which to probe the arguments
|
||||
* Operation = Types of operation for which the pages should be
|
||||
* probed
|
||||
*/
|
||||
VOID MmProbeAndLockPages(PMDL MemoryDescriptorList,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
LOCK_OPERATION Operation);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns an estimate of the amount of memory in the system
|
||||
* RETURNS: Either MmSmallSystem, MmMediumSystem or MmLargeSystem
|
||||
*/
|
||||
MM_SYSTEM_SIZE MmQuerySystemSize(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the number of bytes to allocate for an MDL
|
||||
* describing a given address range
|
||||
* ARGUMENTS:
|
||||
* Base = Base virtual address for the region
|
||||
* Length = size in bytes of the region
|
||||
* RETURNS: The number of bytes required for the MDL
|
||||
*/
|
||||
ULONG MmSizeOfMdl(PVOID Base, ULONG Length);
|
||||
|
||||
/*
|
||||
* FUNCTION: Unlocks the physical pages described by a given MDL
|
||||
* ARGUMENTS:
|
||||
* Mdl = Mdl to unlock
|
||||
*/
|
||||
VOID MmUnlockPages(PMDL Mdl);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases a section of driver code or data previously locked into
|
||||
* memory
|
||||
* ARGUMENTS:
|
||||
* ImageSectionHandle = Handle for the locked section
|
||||
*/
|
||||
VOID MmUnlockPagableImageSection(PVOID ImageSectionHandle);
|
||||
|
||||
VOID MmUnmapIoSpace(PVOID BaseAddress, ULONG NumberOfBytes);
|
||||
VOID MmUnmapLockedPages(PVOID BaseAddress, PMDL MemoryDescriptorList);
|
||||
PVOID MmAllocateSection(ULONG Length);
|
35
reactos/include/ddk/mmtypes.h
Normal file
35
reactos/include/ddk/mmtypes.h
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
enum
|
||||
{
|
||||
MDL_MAPPED_TO_SYSTEM_VA = 0x1,
|
||||
MDL_PAGES_LOCKED = 0x2,
|
||||
MDL_SOURCE_IS_NONPAGED_POOL = 0x4,
|
||||
MDL_ALLOCATED_FIXED_SIZE = 0x8,
|
||||
MDL_PARTIAL = 0x10,
|
||||
MDL_PARTIAL_HAS_BEEN_MAPPED = 0x20,
|
||||
MDL_IO_PAGE_READ = 0x40,
|
||||
MDL_WRITE_OPERATION = 0x80,
|
||||
MDL_PARENT_MAPPED_SYSTEM_VA = 0x100,
|
||||
MDL_LOCK_HELD = 0x200,
|
||||
MDL_SCATTER_GATHER_VA = 0x400,
|
||||
MDL_IO_SPACE = 0x800,
|
||||
MDL_NETWORK_HEADER = 0x1000,
|
||||
MDL_MAPPING_CAN_FAIL = 0x2000,
|
||||
MDL_ALLOCATED_MUST_SUCCEED = 0x4000,
|
||||
MDL_64_BIT_VA = 0x8000,
|
||||
};
|
||||
|
||||
typedef struct _MDL
|
||||
/*
|
||||
* PURPOSE: Describes a user buffer passed to a system API
|
||||
*/
|
||||
{
|
||||
struct _MDL* Next;
|
||||
CSHORT Size;
|
||||
CSHORT MdlFlags;
|
||||
struct _EPROCESS* Process;
|
||||
PVOID MappedSystemVa;
|
||||
PVOID StartVa;
|
||||
ULONG ByteCount;
|
||||
ULONG ByteOffset;
|
||||
} MDL, *PMDL;
|
62
reactos/include/ddk/ntddk.h
Normal file
62
reactos/include/ddk/ntddk.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/ddk/ntddk.h
|
||||
* PURPOSE: Interface definitions for drivers
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 15/05/98: Created
|
||||
*/
|
||||
|
||||
#ifndef __NTDDK_H
|
||||
#define __NTDDK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* INCLUDES ***************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define QUAD_PART(LI) (*(LONGLONG *)(&LI))
|
||||
|
||||
|
||||
#define IO_DISK_INCREMENT 4
|
||||
|
||||
#define FILE_WORD_ALIGNMENT 0x0001
|
||||
|
||||
#define FILE_OPENED 0x0001
|
||||
|
||||
#include <ddk/status.h>
|
||||
#include <ddk/ntdef.h>
|
||||
#include <ddk/defines.h>
|
||||
#include <ddk/types.h>
|
||||
#include <ddk/cfgtypes.h>
|
||||
#include <ddk/ketypes.h>
|
||||
#include <ddk/obtypes.h>
|
||||
#include <ddk/mmtypes.h>
|
||||
#include <ddk/iotypes.h>
|
||||
#include <ddk/extypes.h>
|
||||
#include <ddk/pstypes.h>
|
||||
#include <ddk/setypes.h>
|
||||
#include <ddk/ioctrl.h>
|
||||
#include <internal/hal/ddk.h>
|
||||
|
||||
#include <ddk/rtl.h>
|
||||
#include <ddk/zw.h>
|
||||
#include <ddk/exfuncs.h>
|
||||
#include <ddk/mmfuncs.h>
|
||||
#include <ddk/kefuncs.h>
|
||||
#include <ddk/iofuncs.h>
|
||||
#include <ddk/psfuncs.h>
|
||||
#include <ddk/obfuncs.h>
|
||||
#include <ddk/dbgfuncs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* __NTDDK_H */
|
||||
|
10
reactos/include/ddk/ntdef.h
Normal file
10
reactos/include/ddk/ntdef.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __INCLUDE_DDK_NTDEF_H
|
||||
#define __INCLUDE_DDK_NTDEF_H
|
||||
|
||||
struct _KTHREAD;
|
||||
struct _ETHREAD;
|
||||
struct _EPROCESS;
|
||||
|
||||
#define NTKERNELAPI
|
||||
|
||||
#endif
|
47
reactos/include/ddk/obfuncs.h
Normal file
47
reactos/include/ddk/obfuncs.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* OBJECT MANAGER ************************************************************/
|
||||
|
||||
/*
|
||||
* FUNCTION: Decrements the object's reference count and performs retention
|
||||
* checks
|
||||
* ARGUMENTS:
|
||||
* Object = Object's body
|
||||
*/
|
||||
VOID ObDeferenceObject(PVOID Object);
|
||||
|
||||
/*
|
||||
* FUNCTION: Performs access validation on an object handle and if access
|
||||
* is granted returns a pointer to the object's body
|
||||
* ARGUMENTS:
|
||||
* Handle = Handle to the object
|
||||
* DesiredAccess = Desired access to the object
|
||||
* ObjectType (OPTIONAL) = Pointer to the object's type definition
|
||||
* AccessMode = Access mode to use for the check
|
||||
* Object (OUT) = Caller supplied storage for a pointer to the object's
|
||||
* body
|
||||
* HandleInformation (OUT) = Points to a structure which receives
|
||||
* information about the handle
|
||||
* RETURNS: Status
|
||||
*/
|
||||
NTSTATUS ObReferenceObjectByHandle(HANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID* Object,
|
||||
POBJECT_HANDLE_INFORMATION HandleInfo);
|
||||
|
||||
/*
|
||||
* FUNCTION: Increments the reference count for a given object
|
||||
* ARGUMENTS:
|
||||
* Object = Points to the body of the object
|
||||
* AccessMode = Requested access to the object
|
||||
* ObjectType = Pointer to the object's type definition
|
||||
* AccessMode = Access mode to use for the security check
|
||||
* RETURNS: Status
|
||||
*/
|
||||
NTSTATUS ObReferenceObjectByPointer(PVOID Object,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode);
|
||||
|
||||
NTSTATUS ObOpenObjectByName(POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
PVOID* Object);
|
146
reactos/include/ddk/obtypes.h
Normal file
146
reactos/include/ddk/obtypes.h
Normal file
@@ -0,0 +1,146 @@
|
||||
struct _DIRECTORY_OBJECT;
|
||||
|
||||
typedef ULONG ACCESS_STATE, *PACCESS_STATE;
|
||||
|
||||
typedef struct _OBJECT_HANDLE_INFORMATION {
|
||||
ULONG HandleAttributes;
|
||||
ACCESS_MASK GrantedAccess;
|
||||
} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
|
||||
|
||||
struct _OBJECT;
|
||||
|
||||
typedef struct _OBJECT_TYPE
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Name of the type
|
||||
*/
|
||||
UNICODE_STRING TypeName;
|
||||
|
||||
/*
|
||||
* PURPOSE: Total number of objects of this type
|
||||
*/
|
||||
ULONG TotalObjects;
|
||||
|
||||
/*
|
||||
* PURPOSE: Total number of handles of this type
|
||||
*/
|
||||
ULONG TotalHandles;
|
||||
|
||||
/*
|
||||
* PURPOSE: Maximum objects of this type
|
||||
*/
|
||||
ULONG MaxObjects;
|
||||
|
||||
/*
|
||||
* PURPOSE: Maximum handles of this type
|
||||
*/
|
||||
ULONG MaxHandles;
|
||||
|
||||
/*
|
||||
* PURPOSE: Paged pool charge
|
||||
*/
|
||||
ULONG PagedPoolCharge;
|
||||
|
||||
/*
|
||||
* PURPOSE: Nonpaged pool charge
|
||||
*/
|
||||
ULONG NonpagedPoolCharge;
|
||||
|
||||
/*
|
||||
* PURPOSE: Dumps the object
|
||||
* NOTE: To be defined
|
||||
*/
|
||||
VOID (*Dump)(VOID);
|
||||
|
||||
/*
|
||||
* PURPOSE: Opens the object
|
||||
* NOTE: To be defined
|
||||
*/
|
||||
VOID (*Open)(VOID);
|
||||
|
||||
/*
|
||||
* PURPOSE: Called to close an object if OkayToClose returns true
|
||||
*/
|
||||
VOID (*Close)(VOID);
|
||||
|
||||
/*
|
||||
* PURPOSE: Called to close an object if OkayToClose returns true
|
||||
*/
|
||||
VOID (*Delete)(VOID);
|
||||
|
||||
/*
|
||||
* PURPOSE: Called when an open attempts to open a file apparently
|
||||
* residing within the object
|
||||
*/
|
||||
VOID (*Parse)(VOID);
|
||||
|
||||
/*
|
||||
*/
|
||||
VOID (*Security)(VOID);
|
||||
|
||||
/*
|
||||
*/
|
||||
VOID (*QueryName)(VOID);
|
||||
|
||||
/*
|
||||
* PURPOSE: Called when a process asks to close the object
|
||||
*/
|
||||
VOID (*OkayToClose)(VOID);
|
||||
|
||||
} OBJECT_TYPE, *POBJECT_TYPE;
|
||||
|
||||
|
||||
typedef struct _OBJECT
|
||||
/*
|
||||
* PURPOSE: Header for every object managed by the object manager
|
||||
*/
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Name of this entry
|
||||
*/
|
||||
UNICODE_STRING name;
|
||||
|
||||
/*
|
||||
* PURPOSE: Our entry in our parents list of subdirectory
|
||||
*/
|
||||
LIST_ENTRY entry;
|
||||
|
||||
/*
|
||||
* PURPOSE: Number of non-handle references to this object
|
||||
*/
|
||||
ULONG RefCount;
|
||||
|
||||
/*
|
||||
* PURPOSE: Number of handles opened to this object
|
||||
*/
|
||||
ULONG HandleCount;
|
||||
|
||||
struct _DIRECTORY_OBJECT* Parent;
|
||||
|
||||
/*
|
||||
* PURPOSE: Object type
|
||||
* NOTE: This overlaps the first member of the object body
|
||||
*/
|
||||
CSHORT Type;
|
||||
|
||||
/*
|
||||
* PURPOSE: Object size
|
||||
* NOTE: This overlaps the second member of the object body
|
||||
*/
|
||||
CSHORT Size;
|
||||
|
||||
|
||||
} OBJECT_HEADER, *POBJECT_HEADER;
|
||||
|
||||
/*
|
||||
* PURPOSE: Defines an object
|
||||
*/
|
||||
typedef struct _OBJECT_ATTRIBUTES
|
||||
{
|
||||
ULONG Length;
|
||||
HANDLE RootDirectory;
|
||||
PUNICODE_STRING ObjectName;
|
||||
ULONG Attributes;
|
||||
PVOID SecurityDescriptor;
|
||||
PVOID SecurityQualityOfService;
|
||||
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
|
31
reactos/include/ddk/psfuncs.h
Normal file
31
reactos/include/ddk/psfuncs.h
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION: Creates a thread which executes in kernel mode
|
||||
* ARGUMENTS:
|
||||
* ThreadHandle (OUT) = Caller supplied storage for the returned thread
|
||||
* handle
|
||||
* DesiredAccess = Requested access to the thread
|
||||
* ObjectAttributes = Object attributes (optional)
|
||||
* ProcessHandle = Handle of process thread will run in
|
||||
* NULL to use system process
|
||||
* ClientId (OUT) = Caller supplied storage for the returned client id
|
||||
* of the thread (optional)
|
||||
* StartRoutine = Entry point for the thread
|
||||
* StartContext = Argument supplied to the thread when it begins
|
||||
* execution
|
||||
* RETURNS: Success or failure status
|
||||
*/
|
||||
NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
HANDLE ProcessHandle,
|
||||
PCLIENT_ID ClientId,
|
||||
PKSTART_ROUTINE StartRoutine,
|
||||
PVOID StartContext);
|
||||
NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus);
|
||||
NTSTATUS PsSuspendThread(VOID);
|
||||
NTSTATUS PsWakeThread(PETHREAD Thread);
|
||||
PETHREAD PsGetCurrentThread(VOID);
|
||||
struct _EPROCESS* PsGetCurrentProcess(VOID);
|
285
reactos/include/ddk/pstypes.h
Normal file
285
reactos/include/ddk/pstypes.h
Normal file
@@ -0,0 +1,285 @@
|
||||
#ifndef __INCLUDE_DDK_PSTYPES_H
|
||||
#define __INCLUDE_DDK_PSTYPES_H
|
||||
|
||||
#include <kernel32/heap.h>
|
||||
#include <internal/hal.h>
|
||||
|
||||
typedef NTSTATUS (*PKSTART_ROUTINE)(PVOID StartContext);
|
||||
|
||||
typedef struct _STACK_INFORMATION
|
||||
{
|
||||
PVOID BaseAddress;
|
||||
PVOID UpperAddress;
|
||||
} STACK_INFORMATION, *PSTACK_INFORMATION;
|
||||
|
||||
typedef struct linux_sigcontext {
|
||||
int sc_gs;
|
||||
int sc_fs;
|
||||
int sc_es;
|
||||
int sc_ds;
|
||||
int sc_edi;
|
||||
int sc_esi;
|
||||
int sc_ebp;
|
||||
int sc_esp;
|
||||
int sc_ebx;
|
||||
int sc_edx;
|
||||
int sc_ecx;
|
||||
int sc_eax;
|
||||
int sc_trapno;
|
||||
int sc_err;
|
||||
int sc_eip;
|
||||
int sc_cs;
|
||||
int sc_eflags;
|
||||
int sc_esp_at_signal;
|
||||
int sc_ss;
|
||||
int sc_387;
|
||||
int sc_mask;
|
||||
int sc_cr2;
|
||||
} TRAP_FRAME, *PTRAP_FRAME;
|
||||
|
||||
typedef ULONG THREADINFOCLASS;
|
||||
|
||||
typedef void* ATOMTABLE;
|
||||
|
||||
typedef struct _pPebInfo {
|
||||
WCHAR* WindowTitle;
|
||||
WCHAR* ImageFile;
|
||||
WCHAR* CommandLine;
|
||||
WCHAR* DllPath;
|
||||
// STARTUPINFOW StartupInfo;
|
||||
} PEBINFO;
|
||||
|
||||
typedef struct _LDR_ {
|
||||
UCHAR Initialized;
|
||||
UCHAR InInitializationOrderModuleList;
|
||||
PVOID InLoadOrderModuleList;
|
||||
PVOID InMemoryOrderModuleList;
|
||||
} LDR, *PLDR;
|
||||
|
||||
|
||||
typedef struct _NT_PEB
|
||||
{
|
||||
UCHAR InheritedAddressSpace;
|
||||
UCHAR ReadImageFileExecOptions;
|
||||
UCHAR BeingDebugged;
|
||||
LONG ImageBaseAddress;
|
||||
LDR Ldr;
|
||||
DWORD dwTlsBits[2]; // tls in use bits
|
||||
WORD NumberOfProcessors;
|
||||
WORD NtGlobalFlag;
|
||||
DWORD HeapReserve;
|
||||
DWORD HeapCommit;
|
||||
DWORD HeapDecommitFreeBlockThreshold;
|
||||
DWORD NumberOfHeaps;
|
||||
DWORD MaxiumNumberOfHeaps;
|
||||
PEBINFO* PebInfo;
|
||||
PHEAP ProcessHeap;
|
||||
ATOMTABLE LocalAtomTable;
|
||||
LPCRITICAL_SECTION CriticalSection;
|
||||
DWORD CriticalSectionTimeout;
|
||||
WORD MajorVersion;
|
||||
WORD MinorVersion;
|
||||
WORD BuildNumber;
|
||||
WORD PlatformId;
|
||||
} NT_PEB, *PNT_PEB;
|
||||
|
||||
typedef struct _CLIENT_ID
|
||||
{
|
||||
HANDLE UniqueProcess;
|
||||
HANDLE UniqueThread;
|
||||
} CLIENT_ID, *PCLIENT_ID;
|
||||
|
||||
typedef struct _NT_TIB {
|
||||
struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
|
||||
PVOID StackBase;
|
||||
PVOID StackLimit;
|
||||
PVOID SubSystemTib;
|
||||
union {
|
||||
PVOID FiberData;
|
||||
ULONG Version;
|
||||
} Fib;
|
||||
PVOID ArbitraryUserPointer;
|
||||
struct _NT_TIB *Self;
|
||||
} NT_TIB, *PNT_TIB;
|
||||
|
||||
typedef struct _NT_TEB
|
||||
{
|
||||
|
||||
NT_TIB Tib;
|
||||
CLIENT_ID Cid;
|
||||
HANDLE RPCHandle;
|
||||
PVOID TlsData;
|
||||
NT_PEB *pPeb;
|
||||
DWORD LastErrorCode;
|
||||
NTSTATUS LastStatusValue;
|
||||
DWORD LockCount;
|
||||
UCHAR HardErrorMode;
|
||||
|
||||
} NT_TEB;
|
||||
|
||||
typedef struct _KTHREAD
|
||||
{
|
||||
DISPATCHER_HEADER DispatcherHeader;
|
||||
TIME ElapsedTime;
|
||||
TIME KernelTime;
|
||||
TIME UserTime;
|
||||
STACK_INFORMATION StackInformation;
|
||||
PVOID ServiceDescriptorTable; // points to KeServiceDescriptorTable
|
||||
KAFFINITY Affinity;
|
||||
KPRIORITY CurrentPriority;
|
||||
KPRIORITY BasePriority;
|
||||
ULONG Quantum;
|
||||
UCHAR ThreadState; //Thread state is a typeless enum, otherwise it should be const integer
|
||||
ULONG FreezeCount;
|
||||
ULONG SuspendCount;
|
||||
PTRAP_FRAME TrapFrame;
|
||||
PVOID *Tls;
|
||||
KWAIT_BLOCK WaitBlock[4];
|
||||
struct _KMUTANT* MutantList;
|
||||
PLIST_ENTRY ApcList;
|
||||
UCHAR KernelApcDisable;
|
||||
KTIMER TimerBlock;
|
||||
KDEVICE_QUEUE DeviceQueue;
|
||||
NT_TEB* Teb;
|
||||
|
||||
/*
|
||||
* PURPOSE: CPU state
|
||||
* NOTE: I have temporarily added this to give somewhere to store
|
||||
* cpu state when the thread isn't running
|
||||
*/
|
||||
hal_thread_state Context;
|
||||
LIST_ENTRY Entry;
|
||||
} KTHREAD, *PKTHREAD;
|
||||
|
||||
|
||||
// According to documentation the stack should have a commited [ 1 page ] and
|
||||
// a reserved part [ 1 M ].
|
||||
|
||||
typedef struct _INITIAL_TEB {
|
||||
PVOID StackCommit;
|
||||
PVOID StackReserved;
|
||||
} INITIAL_TEB, *PINITIAL_TEB;
|
||||
|
||||
|
||||
|
||||
|
||||
//ThreadState defines the current state of a thread
|
||||
//FIXME I am allready defined in psmgr.h as a enum
|
||||
/*
|
||||
enum
|
||||
{
|
||||
THREAD_STATE_INITIALIZED = 0,
|
||||
THREAD_STATE_READY,
|
||||
THREAD_STATE_RUNNING,
|
||||
THREAD_STATE_STANDBY,
|
||||
THREAD_STATE_TERMINATED,
|
||||
THREAD_STATE_WAIT,
|
||||
THREAD_STATE_TRANSITION,
|
||||
THREAD_STATE_RESERVED
|
||||
};
|
||||
*/
|
||||
|
||||
// wait reason only applies for threads in a wait state
|
||||
// part of this enum is double ????
|
||||
|
||||
/*
|
||||
typedef _KWAIT_REASON
|
||||
{
|
||||
WAIT_EXCECUTIVE1 = 0,
|
||||
WAIT_FREE_PAGE1,
|
||||
WAIT_PAGE_IN1,
|
||||
WAIT_POOL_ALLOCATION1,
|
||||
WAIT_EXECUTION_DELAY1,
|
||||
WAIT_SUSPENDED_CONDITION1,
|
||||
WAIT_USER_REQUEST1,
|
||||
WAIT_EXCECUTIVE2,
|
||||
WAIT_FREE_PAGE2,
|
||||
WAIT_PAGE_IN2,
|
||||
WAIT_POOL_ALLOCATION2,
|
||||
WAIT_EXECUTION_DELAY2,
|
||||
WAIT_SUSPENDED_CONDITION2,
|
||||
WAIT_USER_REQUEST2,
|
||||
WAIT_EVENT_PAIR_HIGH,
|
||||
WAIT_EVENT_PAIR_LOW,
|
||||
WAIT_LPC_RECEIVE,
|
||||
WAIT_LPC_REPLY,
|
||||
WAIT_VIRTUAL_MEMORY,
|
||||
WAIT_PAGE_OUT
|
||||
} KWAIT_REASON;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// TopLevelIrp can be one of the following values:
|
||||
// FIXME I belong somewhere else
|
||||
|
||||
#define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
|
||||
#define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
|
||||
#define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
|
||||
#define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
|
||||
#define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
|
||||
|
||||
typedef struct _TOP_LEVEL_IRP
|
||||
{
|
||||
PIRP TopLevelIrp;
|
||||
ULONG TopLevelIrpConst;
|
||||
} TOP_LEVEL_IRP;
|
||||
|
||||
typedef struct _ETHREAD {
|
||||
KTHREAD Tcb;
|
||||
TIME CreateTime;
|
||||
TIME ExitTime;
|
||||
NTSTATUS ExitStatus;
|
||||
LIST_ENTRY PostBlockList;
|
||||
LIST_ENTRY TerminationPortList;
|
||||
ULONG ActiveTimerListLock;
|
||||
PVOID ActiveTimerListHead;
|
||||
CLIENT_ID Cid;
|
||||
PLARGE_INTEGER LpcReplySemaphore;
|
||||
PVOID LpcReplyMessage;
|
||||
PLARGE_INTEGER LpcReplyMessageId;
|
||||
PVOID ImpersonationInfo;
|
||||
LIST_ENTRY IrpList; //
|
||||
TOP_LEVEL_IRP TopLevelIrp;
|
||||
ULONG ReadClusterSize;
|
||||
UCHAR ForwardClusterOnly;
|
||||
UCHAR DisablePageFaultClustering;
|
||||
UCHAR DeadThread;
|
||||
UCHAR HasTerminated;
|
||||
ACCESS_MASK GrantedAccess;
|
||||
struct _EPROCESS* ThreadsProcess;
|
||||
PKSTART_ROUTINE StartAddress;
|
||||
LPTHREAD_START_ROUTINE Win32StartAddress; // Should Specify a win32 start func
|
||||
UCHAR LpcExitThreadCalled;
|
||||
UCHAR HardErrorsAreDisabled;
|
||||
} ETHREAD, *PETHREAD;
|
||||
|
||||
|
||||
typedef struct _KPROCESS {
|
||||
DISPATCHER_HEADER DispatcherHeader;
|
||||
PVOID PageTableDirectory; // FIXME: I shoud point to a PTD
|
||||
TIME ElapsedTime;
|
||||
TIME KernelTime;
|
||||
TIME UserTime;
|
||||
LIST_ENTRY InOutSwap; // ??
|
||||
KSPIN_LOCK SpinLock;
|
||||
KAFFINITY Affinity;
|
||||
ULONG StackCount;
|
||||
KPRIORITY BasePriority;
|
||||
ULONG DefaultThreadQuantum;
|
||||
UCHAR ProcessState;
|
||||
ULONG ThreadSeed;
|
||||
UCHAR DisableBoost;
|
||||
|
||||
/*
|
||||
* Added by David Welch (welch@mcmail.com)
|
||||
*/
|
||||
LIST_ENTRY MemoryAreaList;
|
||||
} KPROCESS, *PKPROCESS;
|
||||
|
||||
typedef struct _EPROCESS
|
||||
{
|
||||
KPROCESS Pcb;
|
||||
} EPROCESS, *PEPROCESS;
|
||||
|
||||
#endif /* __INCLUDE_DDK_PSTYPES_H */
|
323
reactos/include/ddk/rtl.h
Normal file
323
reactos/include/ddk/rtl.h
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __DDK_RTL_H
|
||||
#define __DDK_RTL_H
|
||||
|
||||
typedef struct _CONTROLLER_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
PVOID ControllerExtension;
|
||||
KDEVICE_QUEUE DeviceWaitQueue;
|
||||
ULONG Spare1;
|
||||
LARGE_INTEGER Spare2;
|
||||
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
|
||||
|
||||
typedef struct _STRING
|
||||
{
|
||||
/*
|
||||
* Length in bytes of the string stored in buffer
|
||||
*/
|
||||
USHORT Length;
|
||||
|
||||
/*
|
||||
* Maximum length of the string
|
||||
*/
|
||||
USHORT MaximumLength;
|
||||
|
||||
/*
|
||||
* String
|
||||
*/
|
||||
PCHAR Buffer;
|
||||
} STRING, *PSTRING;
|
||||
|
||||
typedef struct _ANSI_STRING
|
||||
{
|
||||
/*
|
||||
* Length in bytes of the string stored in buffer
|
||||
*/
|
||||
USHORT Length;
|
||||
|
||||
/*
|
||||
* Maximum length of the string
|
||||
*/
|
||||
USHORT MaximumLength;
|
||||
|
||||
/*
|
||||
* String
|
||||
*/
|
||||
PCHAR Buffer;
|
||||
} ANSI_STRING, *PANSI_STRING;
|
||||
|
||||
typedef struct _TIME_FIELDS
|
||||
{
|
||||
CSHORT Year;
|
||||
CSHORT Month;
|
||||
CSHORT Day;
|
||||
CSHORT Hour;
|
||||
CSHORT Minute;
|
||||
CSHORT Second;
|
||||
CSHORT Milliseconds;
|
||||
CSHORT Weekday;
|
||||
} TIME_FIELDS, *PTIME_FIELDS;
|
||||
|
||||
/*
|
||||
* PURPOSE: Flags for RtlQueryRegistryValues
|
||||
*/
|
||||
enum
|
||||
{
|
||||
RTL_QUERY_REGISTRY_SUBKEY,
|
||||
RTL_QUERY_REGISTRY_TOPKEY,
|
||||
RTL_QUERY_REGISTRY_REQUIRED,
|
||||
RTL_QUERY_REGISTRY_NOVALUE,
|
||||
RTL_QUERY_REGISTRY_NOEXPAND,
|
||||
RTL_QUERY_REGISTRY_DIRECT,
|
||||
RTL_QUERY_REGISTRY_DELETE,
|
||||
};
|
||||
|
||||
typedef NTSTATUS (*PRTL_QUERY_REGISTRY_ROUTINE)(PWSTR ValueName,
|
||||
ULONG ValueType,
|
||||
PVOID ValueData,
|
||||
ULONG ValueLength,
|
||||
PVOID Context,
|
||||
PVOID EntryContext);
|
||||
|
||||
typedef struct _RTL_QUERY_REGISTRY_TABLE
|
||||
{
|
||||
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
|
||||
ULONG Flags;
|
||||
PWSTR Name;
|
||||
PVOID EntryContext;
|
||||
ULONG DefaultType;
|
||||
PVOID DefaultData;
|
||||
ULONG DefaultLength;
|
||||
} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
|
||||
|
||||
/*
|
||||
* PURPOSE: Used with RtlCheckRegistryKey, RtlCreateRegistryKey,
|
||||
* RtlDeleteRegistryKey
|
||||
*/
|
||||
enum
|
||||
{
|
||||
RTL_REGISTRY_ABSOLUTE,
|
||||
RTL_REGISTRY_SERVICES,
|
||||
RTL_REGISTRY_CONTROL,
|
||||
RTL_REGISTRY_WINDOWS_NT,
|
||||
RTL_REGISTRY_DEVICEMAP,
|
||||
RTL_REGISTRY_USER,
|
||||
RTL_REGISTRY_OPTIONAL,
|
||||
RTL_REGISTRY_VALUE,
|
||||
};
|
||||
|
||||
/*
|
||||
* FUNCTION: Sets up a parameter of type OBJECT_ATTRIBUTES for a
|
||||
* subsequent call to ZwCreateXXX or ZwOpenXXX
|
||||
* ARGUMENTS:
|
||||
* InitializedAttributes (OUT) = Caller supplied storage for the
|
||||
* object attributes
|
||||
* ObjectName = Full path name for object
|
||||
* Attributes = Attributes for the object
|
||||
* RootDirectory = Where the object should be placed or NULL
|
||||
* SecurityDescriptor = Ignored
|
||||
*/
|
||||
VOID InitializeObjectAttributes(POBJECT_ATTRIBUTES InitializedAttributes,
|
||||
PUNICODE_STRING ObjectName,
|
||||
ULONG Attributes,
|
||||
HANDLE RootDirectory,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor);
|
||||
|
||||
VOID InitializeListHead(PLIST_ENTRY ListHead);
|
||||
VOID InsertHeadList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry);
|
||||
VOID InsertTailList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry);
|
||||
BOOLEAN IsListEmpty(PLIST_ENTRY ListHead);
|
||||
PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead);
|
||||
VOID PushEntryList(PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry);
|
||||
VOID RemoveEntryList(PLIST_ENTRY Entry);
|
||||
PLIST_ENTRY RemoveHeadList(PLIST_ENTRY ListHead);
|
||||
PLIST_ENTRY RemoveTailList(PLIST_ENTRY ListHead);
|
||||
ULONG RtlAnsiStringToUnicodeSize(PANSI_STRING AnsiString);
|
||||
NTSTATUS RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString,
|
||||
PANSI_STRING SourceString,
|
||||
BOOLEAN AllocateDestinationString);
|
||||
NTSTATUS RtlAppendUnicodeStringToString(PUNICODE_STRING Destination,
|
||||
PUNICODE_STRING Source);
|
||||
NTSTATUS RtlAppendUnicodeToString(PUNICODE_STRING Destination,
|
||||
PWSTR Source);
|
||||
NTSTATUS RtlCharToInteger(PCSZ String, ULONG Base, PULONG Value);
|
||||
NTSTATUS RtlCheckRegistryKey(ULONG RelativeTo, PWSTR Path);
|
||||
ULONG RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length);
|
||||
LONG RtlCompareString(PSTRING String1, PSTRING String2,
|
||||
BOOLEAN CaseInsensitive);
|
||||
LONG RtlCompareUnicodeString(PUNICODE_STRING String1,
|
||||
PUNICODE_STRING String2,
|
||||
BOOLEAN BaseInsensitive);
|
||||
LARGE_INTEGER RtlConvertLongToLargeInteger(LONG SignedInteger);
|
||||
LARGE_INTEGER RtlConvertUlongToLargeInteger(ULONG UnsignedInteger);
|
||||
VOID RtlCopyBytes(PVOID Destination, CONST VOID* Source, ULONG Length);
|
||||
VOID RtlCopyMemory(VOID* Destination, VOID* Source, ULONG Length);
|
||||
VOID RtlCopyString(PSTRING DestinationString, PSTRING SourceString);
|
||||
VOID RtlCopyUnicodeString(PUNICODE_STRING DestinationString,
|
||||
PUNICODE_STRING SourceString);
|
||||
NTSTATUS RtlCreateRegistryKey(ULONG RelativeTo,
|
||||
PWSTR Path);
|
||||
NTSTATUS RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
ULONG Revision);
|
||||
NTSTATUS RtlDeleteRegistryValue(ULONG RelativeTo,
|
||||
PWSTR Path,
|
||||
PWSTR ValueName);
|
||||
LARGE_INTEGER RtlEnlargedIntegerMultiply(LONG Multiplicand,
|
||||
LONG Multiplier);
|
||||
ULONG RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend,
|
||||
ULONG Divisor,
|
||||
PULONG Remainder);
|
||||
LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
|
||||
ULONG Multiplier);
|
||||
BOOLEAN RtlEqualString(PSTRING String1,
|
||||
PSTRING String2,
|
||||
BOOLEAN CaseInSensitive);
|
||||
BOOLEAN RtlEqualUnicodeString(PUNICODE_STRING String1,
|
||||
PUNICODE_STRING String2,
|
||||
BOOLEAN CaseInSensitive);
|
||||
LARGE_INTEGER RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand,
|
||||
LONG Multiplier);
|
||||
LARGE_INTEGER RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend,
|
||||
ULONG Divisor,
|
||||
PULONG Remainder);
|
||||
LARGE_INTEGER RtlExtendedMagicDivide(LARGE_INTEGER Dividend,
|
||||
LARGE_INTEGER MagicDivisor,
|
||||
CCHAR ShiftCount);
|
||||
VOID RtlFillMemory(PVOID Destination, ULONG Length, UCHAR Fill);
|
||||
VOID RtlFreeAnsiString(PANSI_STRING AnsiString);
|
||||
VOID RtlFreeUnicodeString(PUNICODE_STRING UnicodeString);
|
||||
VOID RtlInitAnsiString(PANSI_STRING DestinationString,
|
||||
PCSZ SourceString);
|
||||
VOID RtlInitString(PSTRING DestinationString, PCSZ SourceString);
|
||||
VOID RtlInitUnicodeString(PUNICODE_STRING DestinationString,
|
||||
PCWSTR SourceString);
|
||||
NTSTATUS RtlIntegerToUnicodeString(ULONG Value,
|
||||
ULONG Base,
|
||||
PUNICODE_STRING String);
|
||||
LARGE_INTEGER RtlLargeIntegerAdd(LARGE_INTEGER Addend1,
|
||||
LARGE_INTEGER Addend2);
|
||||
VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result,
|
||||
LARGE_INTEGER Source,
|
||||
LARGE_INTEGER Mask);
|
||||
|
||||
/* MISSING FUNCTIONS GO HERE */
|
||||
LARGE_INTEGER RtlConvertLongToLargeInteger(LONG SignedInteger);
|
||||
LARGE_INTEGER RtlConvertUlongToLargeInteger(ULONG UnsignedInteger);
|
||||
LARGE_INTEGER RtlEnlargedIntegerMultiply(LONG Multiplicand,
|
||||
LONG Multiplier);
|
||||
ULONG RtlEnlargedUnsignedDivide(ULARGE_INTEGER Dividend,
|
||||
ULONG Divisor,
|
||||
PULONG Remainder);
|
||||
LARGE_INTEGER RtlEnlargedUnsignedMultiply(ULONG Multiplicand,
|
||||
ULONG Multipler);
|
||||
LARGE_INTEGER RtlExtendedIntegerMultiply(LARGE_INTEGER Multiplicand,
|
||||
LONG Multiplier);
|
||||
LARGE_INTEGER RtlExtendedLargeIntegerDivide(LARGE_INTEGER Dividend,
|
||||
ULONG Divisor,
|
||||
PULONG Remainder);
|
||||
LARGE_INTEGER RtlExtendedMagicDivide(LARGE_INTEGER Dividend,
|
||||
LARGE_INTEGER MagicDivisor,
|
||||
CCHAR ShiftCount);
|
||||
LARGE_INTEGER ExInterlockedAddLargeInteger(PLARGE_INTEGER Addend,
|
||||
LARGE_INTEGER Increment,
|
||||
PKSPIN_LOCK Lock);
|
||||
LARGE_INTEGER RtlLargeIntegerAdd(LARGE_INTEGER Addend1,
|
||||
LARGE_INTEGER Addend2);
|
||||
VOID RtlLargeIntegerAnd(PLARGE_INTEGER Result,
|
||||
LARGE_INTEGER Source,
|
||||
LARGE_INTEGER Mask);
|
||||
LARGE_INTEGER RtlLargeIntegerArithmeticShift(LARGE_INTEGER LargeInteger,
|
||||
CCHAR ShiftCount);
|
||||
LARGE_INTEGER RtlLargeIntegerDivide(LARGE_INTEGER Dividend,
|
||||
LARGE_INTEGER Divisor,
|
||||
PLARGE_INTEGER Remainder);
|
||||
BOOLEAN RtlLargeIntegerEqualTo(LARGE_INTEGER Operand1,
|
||||
LARGE_INTEGER Operand2);
|
||||
BOOLEAN RtlLargeIntegerEqualToZero(LARGE_INTEGER Operand);
|
||||
BOOLEAN RtlLargeIntegerGreaterThan(LARGE_INTEGER Operand1,
|
||||
LARGE_INTEGER Operand2);
|
||||
BOOLEAN RtlLargeIntegerGreaterThanOrEqualTo(LARGE_INTEGER Operand1,
|
||||
LARGE_INTEGER Operand2);
|
||||
BOOLEAN RtlLargeIntegerGreaterThanOrEqualToZero(LARGE_INTEGER Operand1);
|
||||
BOOLEAN RtlLargeIntegerGreaterThanZero(LARGE_INTEGER Operand1);
|
||||
BOOLEAN RtlLargeIntegerLessThan(LARGE_INTEGER Operand1,
|
||||
LARGE_INTEGER Operand2);
|
||||
BOOLEAN RtlLargeIntegerLessThanOrEqualTo(LARGE_INTEGER Operand1,
|
||||
LARGE_INTEGER Operand2);
|
||||
BOOLEAN RtlLargeIntegerLessThanOrEqualToZero(LARGE_INTEGER Operand);
|
||||
BOOLEAN RtlLargeIntegerLessThanZero(LARGE_INTEGER Operand);
|
||||
LARGE_INTEGER RtlLargeIntegerNegate(LARGE_INTEGER Subtrahend);
|
||||
BOOLEAN RtlLargeIntegerNotEqualTo(LARGE_INTEGER Operand1,
|
||||
LARGE_INTEGER Operand2);
|
||||
BOOLEAN RtlLargeIntegerNotEqualToZero(LARGE_INTEGER Operand);
|
||||
LARGE_INTEGER RtlLargeIntegerShiftLeft(LARGE_INTEGER LargeInteger,
|
||||
CCHAR ShiftCount);
|
||||
LARGE_INTEGER RtlLargeIntegerShiftRight(LARGE_INTEGER LargeInteger,
|
||||
CCHAR ShiftCount);
|
||||
LARGE_INTEGER RtlLargeIntegerSubtract(LARGE_INTEGER Minuend,
|
||||
LARGE_INTEGER Subtrahend);
|
||||
|
||||
ULONG RtlLengthSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor);
|
||||
VOID RtlMoveMemory(PVOID Destination, CONST VOID* Source, ULONG Length);
|
||||
NTSTATUS RtlQueryRegistryValues(ULONG RelativeTo,
|
||||
PWSTR Path,
|
||||
PRTL_QUERY_REGISTRY_TABLE QueryTable,
|
||||
PVOID Context, PVOID Environment);
|
||||
VOID RtlRetrieveUlong(PULONG DestinationAddress,
|
||||
PULONG SourceAddress);
|
||||
VOID RtlRetrieveUshort(PUSHORT DestinationAddress,
|
||||
PUSHORT SourceAddress);
|
||||
NTSTATUS RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
BOOLEAN DaclPresent,
|
||||
PACL Dacl,
|
||||
BOOLEAN DaclDefaulted);
|
||||
VOID RtlStoreLong(PULONG Address, ULONG Value);
|
||||
VOID RtlStoreUshort(PUSHORT Address, USHORT Value);
|
||||
BOOLEAN RtlTimeFieldsToTime(PTIME_FIELDS TimeFields, PLARGE_INTEGER Time);
|
||||
VOID RtlTimeToTimeFields(PLARGE_INTEGER Time, PTIME_FIELDS TimeFields);
|
||||
PWSTR RtlStrtok(PUNICODE_STRING _string, PWSTR _sep, PWSTR* temp);
|
||||
VOID RtlGetCallersAddress(PVOID* CallersAddress);
|
||||
VOID RtlZeroMemory(PVOID Destination, ULONG Length);
|
||||
|
||||
typedef struct {
|
||||
ULONG Length;
|
||||
ULONG Unknown[11];
|
||||
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
|
||||
|
||||
// Heap creation routine
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
RtlFreeHeap(
|
||||
HANDLE Heap,
|
||||
ULONG Flags,
|
||||
PVOID Address
|
||||
);
|
||||
|
||||
|
||||
#endif /* __DDK_RTL_H */
|
41
reactos/include/ddk/setypes.h
Normal file
41
reactos/include/ddk/setypes.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory for details
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/ddk/setypes.h
|
||||
* PURPOSE: Security manager types
|
||||
* REVISION HISTORY:
|
||||
* ??/??/??: Created with empty stubs by David Welch
|
||||
* 29/08/98: ACCESS_TOKEN definition from Boudewijn Dekker
|
||||
*/
|
||||
|
||||
typedef ULONG ACCESS_MODE, *PACCESS_MODE;
|
||||
|
||||
typedef struct _SECURITY_SUBJECT_CONTEXT
|
||||
{
|
||||
} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
|
||||
|
||||
typedef struct _SECURITY_DESCRIPTOR_CONTEXT
|
||||
{
|
||||
} SECURITY_DESCRIPTOR_CONTEXT, *PSECURITY_DESCRIPTOR_CONTEXT;
|
||||
|
||||
typedef struct _ACCESS_TOKEN {
|
||||
TOKEN_SOURCE TokenSource;
|
||||
LUID AuthenticationId;
|
||||
LARGE_INTEGER ExpirationTime;
|
||||
LUID ModifiedId;
|
||||
ULONG UserAndGroupCount;
|
||||
ULONG PrivilegeCount;
|
||||
ULONG VariableLength;
|
||||
ULONG DynamicCharged;
|
||||
ULONG DynamicAvailable;
|
||||
ULONG DefaultOwnerIndex;
|
||||
PACL DefaultDacl;
|
||||
TOKEN_TYPE TokenType;
|
||||
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
|
||||
UCHAR TokenFlags;
|
||||
UCHAR TokenInUse;
|
||||
UCHAR Unused[2];
|
||||
PVOID ProxyData;
|
||||
PVOID AuditData;
|
||||
UCHAR VariablePart[0];
|
||||
} ACCESS_TOKEN, *PACCESS_TOKEN;
|
159
reactos/include/ddk/status.h
Normal file
159
reactos/include/ddk/status.h
Normal file
@@ -0,0 +1,159 @@
|
||||
#ifndef __INCLUDE_DDK_STATUS_H
|
||||
#define __INCLUDE_DDK_STATUS_H
|
||||
|
||||
#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0)
|
||||
|
||||
/*
|
||||
* Possible status codes
|
||||
* FIXME: These may not be the actual values used by NT
|
||||
*/
|
||||
enum
|
||||
{
|
||||
STATUS_SUCCESS = 0x0,
|
||||
STATUS_INSUFFICIENT_RESOURCES = 0x80000000,
|
||||
STATUS_OBJECT_NAME_EXISTS,
|
||||
STATUS_OBJECT_NAME_COLLISION,
|
||||
// STATUS_DATATYPE_MISALIGNMENT,
|
||||
STATUS_CTL_FILE_NOT_SUPPORTED,
|
||||
// STATUS_ACCESS_VIOLATION,
|
||||
STATUS_PORT_ALREADY_SET,
|
||||
STATUS_SECTION_NOT_IMAGE,
|
||||
STATUS_BAD_WORKING_SET_LIMIT,
|
||||
STATUS_INCOMPATIBLE_FILE_MAP,
|
||||
STATUS_HANDLE_NOT_WAITABLE,
|
||||
STATUS_PORT_DISCONNECTED,
|
||||
STATUS_NOT_LOCKED,
|
||||
STATUS_NOT_MAPPED_VIEW,
|
||||
STATUS_UNABLE_TO_FREE_VM,
|
||||
STATUS_UNABLE_TO_DELETE_SECTION,
|
||||
STATUS_MORE_PROCESSING_REQUIRED,
|
||||
STATUS_INVALID_CID,
|
||||
STATUS_BAD_INITIAL_STACK,
|
||||
STATUS_INVALID_VOLUME_LABEL,
|
||||
STATUS_SECTION_NOT_EXTENDED,
|
||||
STATUS_NOT_MAPPED_DATA,
|
||||
STATUS_INFO_LENGTH_MISMATCH,
|
||||
STATUS_INVALID_INFO_CLASS,
|
||||
STATUS_SUSPEND_COUNT_EXCEEDED,
|
||||
STATUS_NOTIFY_ENUM_DIR,
|
||||
STATUS_REGISTRY_RECOVERED,
|
||||
STATUS_REGISTRY_IO_FAILED,
|
||||
STATUS_KEY_DELETED,
|
||||
STATUS_NO_LOG_SPACE,
|
||||
STATUS_KEY_HAS_CHILDREN,
|
||||
STATUS_CHILD_MUST_BE_VOLATILE,
|
||||
STATUS_REGISTRY_CORRUPT,
|
||||
STATUS_DLL_NOT_FOUND,
|
||||
STATUS_DLL_INIT_FAILED,
|
||||
STATUS_ORDINAL_NOT_FOUND,
|
||||
STATUS_ENTRYPOINT_NOT_FOUND,
|
||||
// STATUS_PENDING,
|
||||
STATUS_MORE_ENTRIES,
|
||||
// STATUS_INTEGER_OVERFLOW,
|
||||
STATUS_BUFFER_OVERFLOW,
|
||||
STATUS_NO_MORE_FILES,
|
||||
STATUS_NO_INHERITANCE,
|
||||
STATUS_NO_MORE_EAS,
|
||||
STATUS_NO_MORE_ENTRIES,
|
||||
STATUS_GUIDS_EXHAUSTED,
|
||||
STATUS_AGENTS_EXHAUSTED,
|
||||
STATUS_UNSUCCESSFUL,
|
||||
STATUS_NOT_IMPLEMENTED,
|
||||
STATUS_ILLEGAL_FUNCTION,
|
||||
// STATUS_IN_PAGE_ERROR,
|
||||
STATUS_PAGEFILE_QUOTA,
|
||||
STATUS_COMMITMENT_LIMIT,
|
||||
STATUS_SECTION_TOO_BIG,
|
||||
RPC_NT_SS_IN_NULL_CONTEXT,
|
||||
RPC_NT_INVALID_BINDING,
|
||||
// STATUS_INVALID_HANDLE,
|
||||
STATUS_OBJECT_FILE_MISMATCH,
|
||||
STATUS_FILE_CLOSED,
|
||||
STATUS_INVALID_PORT_HANDLE,
|
||||
STATUS_NOT_COMMITTED,
|
||||
STATUS_INVALID_PARAMETER,
|
||||
STATUS_INVALID_PARAMETER_1,
|
||||
STATUS_INVALID_PARAMETER_2,
|
||||
STATUS_INVALID_PARAMETER_3,
|
||||
STATUS_INVALID_PARAMETER_4,
|
||||
STATUS_INVALID_PARAMETER_5,
|
||||
STATUS_INVALID_PARAMETER_6,
|
||||
STATUS_INVALID_PARAMETER_7,
|
||||
STATUS_INVALID_PARAMETER_8,
|
||||
STATUS_INVALID_PARAMETER_9,
|
||||
STATUS_INVALID_PARAMETER_10,
|
||||
STATUS_INVALID_PARAMETER_11,
|
||||
STATUS_INVALID_PARAMETER_12,
|
||||
STATUS_INVALID_PARAMETER_MAX,
|
||||
STATUS_INVALID_PAGE_PROTECTION,
|
||||
STATUS_RESOURCE_DATA_NOT_FOUND,
|
||||
STATUS_RESOURCE_TYPE_NOT_FOUND,
|
||||
STATUS_RESOURCE_NAME_NOT_FOUND,
|
||||
STATUS_RESOURCE_LANG_NOT_FOUND,
|
||||
STATUS_NO_SUCH_DEVICE,
|
||||
STATUS_NO_SUCH_FILE,
|
||||
STATUS_INVALID_DEVICE_REQUEST,
|
||||
STATUS_END_OF_FILE,
|
||||
STATUS_FILE_FORCED_CLOSED,
|
||||
STATUS_WRONG_VOLUME,
|
||||
STATUS_NO_MEDIA,
|
||||
STATUS_NO_MEDIA_IN_DEVICE,
|
||||
STATUS_NONEXISTENT_SECTOR,
|
||||
STATUS_WORKING_SET_QUOTA,
|
||||
// STATUS_NO_MEMORY,
|
||||
STATUS_CONFLICTING_ADDRESS,
|
||||
STATUS_INVALID_SYSTEM_SERVICE,
|
||||
STATUS_THREAD_IS_TERMINATING,
|
||||
STATUS_PROCESS_IS_TERMINATING,
|
||||
STATUS_INVALID_LOCK_SEQUENCE,
|
||||
STATUS_INVALID_VIEW_SIZE,
|
||||
STATUS_ALREADY_COMMITTED,
|
||||
STATUS_ACCESS_DENIED,
|
||||
STATUS_FILE_IS_A_DIRECTORY,
|
||||
STATUS_CANNOT_DELETE,
|
||||
STATUS_INVALID_COMPUTER_NAME,
|
||||
STATUS_FILE_DELETED,
|
||||
STATUS_DELETE_PENDING,
|
||||
STATUS_PORT_CONNECTION_REFUSED,
|
||||
STATUS_NO_SUCH_PRIVILEGE,
|
||||
STATUS_PRIVILEGE_NOT_HELD,
|
||||
STATUS_CANNOT_IMPERSONATE,
|
||||
STATUS_LOGON_FAILURE,
|
||||
STATUS_ACCOUNT_RESTRICTION,
|
||||
STATUS_INVALID_LOGON_HOURS,
|
||||
STATUS_INVALID_WORKSTATION,
|
||||
STATUS_BUFFER_TOO_SMALL,
|
||||
STATUS_UNABLE_TO_DECOMMIT_VM,
|
||||
STATUS_DISK_CORRUPT_ERROR,
|
||||
STATUS_OBJECT_NAME_INVALID,
|
||||
STATUS_OBJECT_NAME_NOT_FOUND,
|
||||
// STATUS_OBJECT_NAME_COLLISION,
|
||||
STATUS_OBJECT_PATH_INVALID,
|
||||
STATUS_OBJECT_PATH_NOT_FOUND,
|
||||
STATUS_DFS_EXIT_PATH_FOUND,
|
||||
STATUS_OBJECT_PATH_SYNTAX_BAD,
|
||||
STATUS_DATA_OVERRUN,
|
||||
STATUS_DATA_LATE_ERROR,
|
||||
STATUS_DATA_ERROR,
|
||||
STATUS_CRC_ERROR,
|
||||
STATUS_SHARING_VIOLATION,
|
||||
STATUS_QUOTA_EXCEEDED,
|
||||
STATUS_MUTANT_NOT_OWNED,
|
||||
STATUS_SEMAPHORE_LIMIT_EXCEEDED,
|
||||
STATUS_DISK_FULL,
|
||||
STATUS_LOCK_NOT_GRANTED,
|
||||
|
||||
STATUS_DEVICE_NOT_READY,
|
||||
STATUS_IO_TIMEOUT,
|
||||
STATUS_MEDIA_WRITE_PROTECTED,
|
||||
STATUS_NO_MEDIA_IN_DRIVE,
|
||||
STATUS_VERIFY_REQUIRED,
|
||||
STATUS_UNRECOGNIZED_MEDIA,
|
||||
STATUS_UNRECOGNIZED_VOLUME,
|
||||
// STATUS_WRONG_VOLUME,
|
||||
STATUS_FS_DRIVER_REQUIRED,
|
||||
STATUS_NOT_SUPPORTED = 9999,
|
||||
STATUS_DISK_OPERATION_FAILED
|
||||
};
|
||||
|
||||
#endif /* __INCLUDE_DDK_STATUS_H */
|
73
reactos/include/ddk/types.h
Normal file
73
reactos/include/ddk/types.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#ifndef __DDK_TYPES_H
|
||||
#define __DDK_TYPES_H
|
||||
|
||||
// these should be moved to a file like ntdef.h
|
||||
|
||||
typedef const int CINT;
|
||||
|
||||
|
||||
typedef ULONG KAFFINITY, *PKAFFINITY;
|
||||
|
||||
typedef LONG NTSTATUS, *PNTSTATUS;
|
||||
|
||||
typedef ULONG DEVICE_TYPE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
DIRECTORY_QUERY,
|
||||
DIRECTORY_TRAVERSE,
|
||||
DIRECTORY_CREATE_OBJECT,
|
||||
DIRECTORY_CREATE_SUBDIRECTORY,
|
||||
DIRECTORY_ALL_ACCESS,
|
||||
};
|
||||
|
||||
typedef unsigned long long ULONGLONG;
|
||||
|
||||
/*
|
||||
* General type for status information
|
||||
*/
|
||||
//typedef LONG NTSTATUS;
|
||||
|
||||
typedef struct _UNICODE_STRING
|
||||
{
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
PWSTR Buffer;
|
||||
} UNICODE_STRING, *PUNICODE_STRING;
|
||||
|
||||
typedef enum _SECTION_INHERIT {
|
||||
ViewShare = 1,
|
||||
ViewUnmap = 2
|
||||
} SECTION_INHERIT;
|
||||
|
||||
/*
|
||||
* Various other types (all quite pointless)
|
||||
*/
|
||||
typedef ULONG KPROCESSOR_MODE;
|
||||
typedef UCHAR KIRQL;
|
||||
typedef KIRQL* PKIRQL;
|
||||
typedef ULONG IO_ALLOCATION_ACTION;
|
||||
typedef ULONG POOL_TYPE;
|
||||
typedef ULONG TIMER_TYPE;
|
||||
typedef ULONG MM_SYSTEM_SIZE;
|
||||
typedef ULONG LOCK_OPERATION;
|
||||
typedef ULONG KEY_INFORMATION_CLASS;
|
||||
typedef ULONG FILE_INFORMATION_CLASS;
|
||||
typedef ULONG KEY_VALUE_INFORMATION_CLASS;
|
||||
typedef LARGE_INTEGER PHYSICAL_ADDRESS;
|
||||
typedef PHYSICAL_ADDRESS* PPHYSICAL_ADDRESS;
|
||||
typedef ULONG WAIT_TYPE;
|
||||
//typedef ULONG KINTERRUPT_MODE;
|
||||
typedef USHORT CSHORT;
|
||||
|
||||
|
||||
typedef struct _TIME {
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
} TIME;
|
||||
|
||||
#endif
|
3908
reactos/include/ddk/zw.h
Normal file
3908
reactos/include/ddk/zw.h
Normal file
File diff suppressed because it is too large
Load Diff
5167
reactos/include/defines.h
Normal file
5167
reactos/include/defines.h
Normal file
File diff suppressed because it is too large
Load Diff
16
reactos/include/devices.h
Normal file
16
reactos/include/devices.h
Normal file
@@ -0,0 +1,16 @@
|
||||
typedef struct
|
||||
{
|
||||
LPSTR LeftVolumeName;
|
||||
LPSTR RightVolumeName;
|
||||
ULONG DefaultVolume;
|
||||
ULONG Type;
|
||||
ULONG DeviceType;
|
||||
char Key[4];
|
||||
LPSTR PrototypeName;
|
||||
PVOID DeferredRoutine;
|
||||
PVOID ExclusionRoutine;
|
||||
PVOID DispatchRoutine;
|
||||
PVOID DevCapsRoutine;
|
||||
PVOID HwSetVolume;
|
||||
ULONG IoMethod;
|
||||
}SOUND_DEVICE_INIT;
|
713
reactos/include/errors.h
Normal file
713
reactos/include/errors.h
Normal file
@@ -0,0 +1,713 @@
|
||||
/*
|
||||
Errors.h
|
||||
|
||||
Windows32 API error codes
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
|
||||
This file is part of the Windows32 API Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_H_WINDOWS32_ERROR
|
||||
#define _GNU_H_WINDOWS32_ERROR
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Numerical order */
|
||||
|
||||
#define LZERROR_UNKNOWNALG (-8)
|
||||
#define LZERROR_BADVALUE (-7)
|
||||
#define LZERROR_GLOBLOCK (-6)
|
||||
#define LZERROR_GLOBALLOC (-5)
|
||||
#define LZERROR_WRITE (-4)
|
||||
#define LZERROR_READ (-3)
|
||||
#define LZERROR_BADOUTHANDLE (-2)
|
||||
#define LZERROR_BADINHANDLE (-1)
|
||||
#define NO_ERROR 0L
|
||||
#define ERROR_SUCCESS 0L
|
||||
#define ERROR_INVALID_FUNCTION 1L
|
||||
#define ERROR_FILE_NOT_FOUND 2L
|
||||
#define ERROR_PATH_NOT_FOUND 3L
|
||||
#define ERROR_TOO_MANY_OPEN_FILES 4L
|
||||
#define ERROR_ACCESS_DENIED 5L
|
||||
#define ERROR_INVALID_HANDLE 6L
|
||||
#define ERROR_ARENA_TRASHED 7L
|
||||
#define ERROR_NOT_ENOUGH_MEMORY 8L
|
||||
#define ERROR_INVALID_BLOCK 9L
|
||||
#define ERROR_BAD_ENVIRONMENT 10L
|
||||
#define ERROR_BAD_FORMAT 11L
|
||||
#define ERROR_INVALID_ACCESS 12L
|
||||
#define ERROR_INVALID_DATA 13L
|
||||
#define ERROR_OUTOFMEMORY 14L
|
||||
#define ERROR_INVALID_DRIVE 15L
|
||||
#define ERROR_CURRENT_DIRECTORY 16L
|
||||
#define ERROR_NOT_SAME_DEVICE 17L
|
||||
#define ERROR_NO_MORE_FILES 18L
|
||||
#define ERROR_WRITE_PROTECT 19L
|
||||
#define ERROR_BAD_UNIT 20L
|
||||
#define ERROR_NOT_READY 21L
|
||||
#define ERROR_BAD_COMMAND 22L
|
||||
#define ERROR_CRC 23L
|
||||
#define ERROR_BAD_LENGTH 24L
|
||||
#define ERROR_SEEK 25L
|
||||
#define ERROR_NOT_DOS_DISK 26L
|
||||
#define ERROR_SECTOR_NOT_FOUND 27L
|
||||
#define ERROR_OUT_OF_PAPER 28L
|
||||
#define ERROR_WRITE_FAULT 29L
|
||||
#define ERROR_READ_FAULT 30L
|
||||
#define ERROR_GEN_FAILURE 31L
|
||||
#define ERROR_SHARING_VIOLATION 32L
|
||||
#define ERROR_LOCK_VIOLATION 33L
|
||||
#define ERROR_WRONG_DISK 34L
|
||||
#define ERROR_SHARING_BUFFER_EXCEEDED 36L
|
||||
#define ERROR_HANDLE_EOF 38L
|
||||
#define ERROR_HANDLE_DISK_FULL 39L
|
||||
#define ERROR_NOT_SUPPORTED 50L
|
||||
#define ERROR_REM_NOT_LIST 51L
|
||||
#define ERROR_DUP_NAME 52L
|
||||
#define ERROR_BAD_NETPATH 53L
|
||||
#define ERROR_NETWORK_BUSY 54L
|
||||
#define ERROR_DEV_NOT_EXIST 55L
|
||||
#define ERROR_TOO_MANY_CMDS 56L
|
||||
#define ERROR_ADAP_HDW_ERR 57L
|
||||
#define ERROR_BAD_NET_RESP 58L
|
||||
#define ERROR_UNEXP_NET_ERR 59L
|
||||
#define ERROR_BAD_REM_ADAP 60L
|
||||
#define ERROR_PRINTQ_FULL 61L
|
||||
#define ERROR_NO_SPOOL_SPACE 62L
|
||||
#define ERROR_PRINT_CANCELLED 63L
|
||||
#define ERROR_NETNAME_DELETED 64L
|
||||
#define ERROR_NETWORK_ACCESS_DENIED 65L
|
||||
#define ERROR_BAD_DEV_TYPE 66L
|
||||
#define ERROR_BAD_NET_NAME 67L
|
||||
#define ERROR_TOO_MANY_NAMES 68L
|
||||
#define ERROR_TOO_MANY_SESS 69L
|
||||
#define ERROR_SHARING_PAUSED 70L
|
||||
#define ERROR_REQ_NOT_ACCEP 71L
|
||||
#define ERROR_REDIR_PAUSED 72L
|
||||
#define ERROR_FILE_EXISTS 80L
|
||||
#define ERROR_CANNOT_MAKE 82L
|
||||
#define ERROR_FAIL_I24 83L
|
||||
#define ERROR_OUT_OF_STRUCTURES 84L
|
||||
#define ERROR_ALREADY_ASSIGNED 85L
|
||||
#define ERROR_INVALID_PASSWORD 86L
|
||||
#define ERROR_INVALID_PARAMETER 87L
|
||||
#define ERROR_NET_WRITE_FAULT 88L
|
||||
#define ERROR_NO_PROC_SLOTS 89L
|
||||
#define ERROR_TOO_MANY_SEMAPHORES 100L
|
||||
#define ERROR_EXCL_SEM_ALREADY_OWNED 101L
|
||||
#define ERROR_SEM_IS_SET 102L
|
||||
#define ERROR_TOO_MANY_SEM_REQUESTS 103L
|
||||
#define ERROR_INVALID_AT_INTERRUPT_TIME 104L
|
||||
#define ERROR_SEM_OWNER_DIED 105L
|
||||
#define ERROR_SEM_USER_LIMIT 106L
|
||||
#define ERROR_DISK_CHANGE 107L
|
||||
#define ERROR_DRIVE_LOCKED 108L
|
||||
#define ERROR_BROKEN_PIPE 109L
|
||||
#define ERROR_OPEN_FAILED 110L
|
||||
#define ERROR_BUFFER_OVERFLOW 111L
|
||||
#define ERROR_DISK_FULL 112L
|
||||
#define ERROR_NO_MORE_SEARCH_HANDLES 113L
|
||||
#define ERROR_INVALID_TARGET_HANDLE 114L
|
||||
#define ERROR_INVALID_CATEGORY 117L
|
||||
#define ERROR_INVALID_VERIFY_SWITCH 118L
|
||||
#define ERROR_BAD_DRIVER_LEVEL 119L
|
||||
#define ERROR_CALL_NOT_IMPLEMENTED 120L
|
||||
#define ERROR_SEM_TIMEOUT 121L
|
||||
#define ERROR_INSUFFICIENT_BUFFER 122L
|
||||
#define ERROR_INVALID_NAME 123L
|
||||
#define ERROR_INVALID_LEVEL 124L
|
||||
#define ERROR_NO_VOLUME_LABEL 125L
|
||||
#define ERROR_MOD_NOT_FOUND 126L
|
||||
#define ERROR_PROC_NOT_FOUND 127L
|
||||
#define ERROR_WAIT_NO_CHILDREN 128L
|
||||
#define ERROR_CHILD_NOT_COMPLETE 129L
|
||||
#define ERROR_DIRECT_ACCESS_HANDLE 130L
|
||||
#define ERROR_NEGATIVE_SEEK 131L
|
||||
#define ERROR_SEEK_ON_DEVICE 132L
|
||||
#define ERROR_IS_JOIN_TARGET 133L
|
||||
#define ERROR_IS_JOINED 134L
|
||||
#define ERROR_IS_SUBSTED 135L
|
||||
#define ERROR_NOT_JOINED 136L
|
||||
#define ERROR_NOT_SUBSTED 137L
|
||||
#define ERROR_JOIN_TO_JOIN 138L
|
||||
#define ERROR_SUBST_TO_SUBST 139L
|
||||
#define ERROR_JOIN_TO_SUBST 140L
|
||||
#define ERROR_SUBST_TO_JOIN 141L
|
||||
#define ERROR_BUSY_DRIVE 142L
|
||||
#define ERROR_SAME_DRIVE 143L
|
||||
#define ERROR_DIR_NOT_ROOT 144L
|
||||
#define ERROR_DIR_NOT_EMPTY 145L
|
||||
#define ERROR_IS_SUBST_PATH 146L
|
||||
#define ERROR_IS_JOIN_PATH 147L
|
||||
#define ERROR_PATH_BUSY 148L
|
||||
#define ERROR_IS_SUBST_TARGET 149L
|
||||
#define ERROR_SYSTEM_TRACE 150L
|
||||
#define ERROR_INVALID_EVENT_COUNT 151L
|
||||
#define ERROR_TOO_MANY_MUXWAITERS 152L
|
||||
#define ERROR_INVALID_LIST_FORMAT 153L
|
||||
#define ERROR_LABEL_TOO_LONG 154L
|
||||
#define ERROR_TOO_MANY_TCBS 155L
|
||||
#define ERROR_SIGNAL_REFUSED 156L
|
||||
#define ERROR_DISCARDED 157L
|
||||
#define ERROR_NOT_LOCKED 158L
|
||||
#define ERROR_BAD_THREADID_ADDR 159L
|
||||
#define ERROR_BAD_ARGUMENTS 160L
|
||||
#define ERROR_BAD_PATHNAME 161L
|
||||
#define ERROR_SIGNAL_PENDING 162L
|
||||
#define ERROR_MAX_THRDS_REACHED 164L
|
||||
#define ERROR_LOCK_FAILED 167L
|
||||
#define ERROR_BUSY 170L
|
||||
#define ERROR_CANCEL_VIOLATION 173L
|
||||
#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174L
|
||||
#define ERROR_INVALID_SEGMENT_NUMBER 180L
|
||||
#define ERROR_INVALID_ORDINAL 182L
|
||||
#define ERROR_ALREADY_EXISTS 183L
|
||||
#define ERROR_INVALID_FLAG_NUMBER 186L
|
||||
#define ERROR_SEM_NOT_FOUND 187L
|
||||
#define ERROR_INVALID_STARTING_CODESEG 188L
|
||||
#define ERROR_INVALID_STACKSEG 189L
|
||||
#define ERROR_INVALID_MODULETYPE 190L
|
||||
#define ERROR_INVALID_EXE_SIGNATURE 191L
|
||||
#define ERROR_EXE_MARKED_INVALID 192L
|
||||
#define ERROR_BAD_EXE_FORMAT 193L
|
||||
#define ERROR_ITERATED_DATA_EXCEEDS_64k 194L
|
||||
#define ERROR_INVALID_MINALLOCSIZE 195L
|
||||
#define ERROR_DYNLINK_FROM_INVALID_RING 196L
|
||||
#define ERROR_IOPL_NOT_ENABLED 197L
|
||||
#define ERROR_INVALID_SEGDPL 198L
|
||||
#define ERROR_AUTODATASEG_EXCEEDS_64k 199L
|
||||
#define ERROR_RING2SEG_MUST_BE_MOVABLE 200L
|
||||
#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201L
|
||||
#define ERROR_INFLOOP_IN_RELOC_CHAIN 202L
|
||||
#define ERROR_ENVVAR_NOT_FOUND 203L
|
||||
#define ERROR_NO_SIGNAL_SENT 205L
|
||||
#define ERROR_FILENAME_EXCED_RANGE 206L
|
||||
#define ERROR_RING2_STACK_IN_USE 207L
|
||||
#define ERROR_META_EXPANSION_TOO_LONG 208L
|
||||
#define ERROR_INVALID_SIGNAL_NUMBER 209L
|
||||
#define ERROR_THREAD_1_INACTIVE 210L
|
||||
#define ERROR_LOCKED 212L
|
||||
#define ERROR_TOO_MANY_MODULES 214L
|
||||
#define ERROR_NESTING_NOT_ALLOWED 215L
|
||||
#define ERROR_BAD_PIPE 230L
|
||||
#define ERROR_PIPE_BUSY 231L
|
||||
#define ERROR_NO_DATA 232L
|
||||
#define ERROR_PIPE_NOT_CONNECTED 233L
|
||||
#define ERROR_MORE_DATA 234L
|
||||
#define ERROR_VC_DISCONNECTED 240L
|
||||
#define ERROR_INVALID_EA_NAME 254L
|
||||
#define ERROR_EA_LIST_INCONSISTENT 255L
|
||||
#define ERROR_NO_MORE_ITEMS 259L
|
||||
#define ERROR_CANNOT_COPY 266L
|
||||
#define ERROR_DIRECTORY 267L
|
||||
#define ERROR_EAS_DIDNT_FIT 275L
|
||||
#define ERROR_EA_FILE_CORRUPT 276L
|
||||
#define ERROR_EA_TABLE_FULL 277L
|
||||
#define ERROR_INVALID_EA_HANDLE 278L
|
||||
#define ERROR_EAS_NOT_SUPPORTED 282L
|
||||
#define ERROR_NOT_OWNER 288L
|
||||
#define ERROR_TOO_MANY_POSTS 298L
|
||||
#define ERROR_PARTIAL_COPY 299L
|
||||
#define ERROR_MR_MID_NOT_FOUND 317L
|
||||
#define ERROR_INVALID_ADDRESS 487L
|
||||
#define ERROR_ARITHMETIC_OVERFLOW 534L
|
||||
#define ERROR_PIPE_CONNECTED 535L
|
||||
#define ERROR_PIPE_LISTENING 536L
|
||||
#define ERROR_EA_ACCESS_DENIED 994L
|
||||
#define ERROR_OPERATION_ABORTED 995L
|
||||
#define ERROR_IO_INCOMPLETE 996L
|
||||
#define ERROR_IO_PENDING 997L
|
||||
#define ERROR_NOACCESS 998L
|
||||
#define ERROR_SWAPERROR 999L
|
||||
#define ERROR_STACK_OVERFLOW 1001L
|
||||
#define ERROR_INVALID_MESSAGE 1002L
|
||||
#define ERROR_CAN_NOT_COMPLETE 1003L
|
||||
#define ERROR_INVALID_FLAGS 1004L
|
||||
#define ERROR_UNRECOGNIZED_VOLUME 1005L
|
||||
#define ERROR_FILE_INVALID 1006L
|
||||
#define ERROR_FULLSCREEN_MODE 1007L
|
||||
#define ERROR_NO_TOKEN 1008L
|
||||
#define ERROR_BADDB 1009L
|
||||
#define ERROR_BADKEY 1010L
|
||||
#define ERROR_CANTOPEN 1011L
|
||||
#define ERROR_CANTREAD 1012L
|
||||
#define ERROR_CANTWRITE 1013L
|
||||
#define ERROR_REGISTRY_RECOVERED 1014L
|
||||
#define ERROR_REGISTRY_CORRUPT 1015L
|
||||
#define ERROR_REGISTRY_IO_FAILED 1016L
|
||||
#define ERROR_NOT_REGISTRY_FILE 1017L
|
||||
#define ERROR_KEY_DELETED 1018L
|
||||
#define ERROR_NO_LOG_SPACE 1019L
|
||||
#define ERROR_KEY_HAS_CHILDREN 1020L
|
||||
#define ERROR_CHILD_MUST_BE_VOLATILE 1021L
|
||||
#define ERROR_NOTIFY_ENUM_DIR 1022L
|
||||
#define ERROR_DEPENDENT_SERVICES_RUNNING 1051L
|
||||
#define ERROR_INVALID_SERVICE_CONTROL 1052L
|
||||
#define ERROR_SERVICE_REQUEST_TIMEOUT 1053L
|
||||
#define ERROR_SERVICE_NO_THREAD 1054L
|
||||
#define ERROR_SERVICE_DATABASE_LOCKED 1055L
|
||||
#define ERROR_SERVICE_ALREADY_RUNNING 1056L
|
||||
#define ERROR_INVALID_SERVICE_ACCOUNT 1057L
|
||||
#define ERROR_SERVICE_DISABLED 1058L
|
||||
#define ERROR_CIRCULAR_DEPENDENCY 1059L
|
||||
#define ERROR_SERVICE_DOES_NOT_EXIST 1060L
|
||||
#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061L
|
||||
#define ERROR_SERVICE_NOT_ACTIVE 1062L
|
||||
#define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063L
|
||||
#define ERROR_EXCEPTION_IN_SERVICE 1064L
|
||||
#define ERROR_DATABASE_DOES_NOT_EXIST 1065L
|
||||
#define ERROR_SERVICE_SPECIFIC_ERROR 1066L
|
||||
#define ERROR_PROCESS_ABORTED 1067L
|
||||
#define ERROR_SERVICE_DEPENDENCY_FAIL 1068L
|
||||
#define ERROR_SERVICE_LOGON_FAILED 1069L
|
||||
#define ERROR_SERVICE_START_HANG 1070L
|
||||
#define ERROR_INVALID_SERVICE_LOCK 1071L
|
||||
#define ERROR_SERVICE_MARKED_FOR_DELETE 1072L
|
||||
#define ERROR_SERVICE_EXISTS 1073L
|
||||
#define ERROR_ALREADY_RUNNING_LKG 1074L
|
||||
#define ERROR_SERVICE_DEPENDENCY_DELETED 1075L
|
||||
#define ERROR_BOOT_ALREADY_ACCEPTED 1076L
|
||||
#define ERROR_SERVICE_NEVER_STARTED 1077L
|
||||
#define ERROR_DUPLICATE_SERVICE_NAME 1078L
|
||||
#define ERROR_END_OF_MEDIA 1100L
|
||||
#define ERROR_FILEMARK_DETECTED 1101L
|
||||
#define ERROR_BEGINNING_OF_MEDIA 1102L
|
||||
#define ERROR_SETMARK_DETECTED 1103L
|
||||
#define ERROR_NO_DATA_DETECTED 1104L
|
||||
#define ERROR_PARTITION_FAILURE 1105L
|
||||
#define ERROR_INVALID_BLOCK_LENGTH 1106L
|
||||
#define ERROR_DEVICE_NOT_PARTITIONED 1107L
|
||||
#define ERROR_UNABLE_TO_LOCK_MEDIA 1108L
|
||||
#define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109L
|
||||
#define ERROR_MEDIA_CHANGED 1110L
|
||||
#define ERROR_BUS_RESET 1111L
|
||||
#define ERROR_NO_MEDIA_IN_DRIVE 1112L
|
||||
#define ERROR_NO_UNICODE_TRANSLATION 1113L
|
||||
#define ERROR_DLL_INIT_FAILED 1114L
|
||||
#define ERROR_SHUTDOWN_IN_PROGRESS 1115L
|
||||
#define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116L
|
||||
#define ERROR_IO_DEVICE 1117L
|
||||
#define ERROR_SERIAL_NO_DEVICE 1118L
|
||||
#define ERROR_IRQ_BUSY 1119L
|
||||
#define ERROR_MORE_WRITES 1120L
|
||||
#define ERROR_COUNTER_TIMEOUT 1121L
|
||||
#define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122L
|
||||
#define ERROR_FLOPPY_WRONG_CYLINDER 1123L
|
||||
#define ERROR_FLOPPY_UNKNOWN_ERROR 1124L
|
||||
#define ERROR_FLOPPY_BAD_REGISTERS 1125L
|
||||
#define ERROR_DISK_RECALIBRATE_FAILED 1126L
|
||||
#define ERROR_DISK_OPERATION_FAILED 1127L
|
||||
#define ERROR_DISK_RESET_FAILED 1128L
|
||||
#define ERROR_EOM_OVERFLOW 1129L
|
||||
#define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130L
|
||||
#define ERROR_POSSIBLE_DEADLOCK 1131L
|
||||
#define ERROR_MAPPED_ALIGNMENT 1132L
|
||||
#define ERROR_SET_POWER_STATE_VETOED 1140L
|
||||
#define ERROR_SET_POWER_STATE_FAILED 1141L
|
||||
#define ERROR_OLD_WIN_VERSION 1150L
|
||||
#define ERROR_APP_WRONG_OS 1151L
|
||||
#define ERROR_SINGLE_INSTANCE_APP 1152L
|
||||
#define ERROR_RMODE_APP 1153L
|
||||
#define ERROR_INVALID_DLL 1154L
|
||||
#define ERROR_NO_ASSOCIATION 1155L
|
||||
#define ERROR_DDE_FAIL 1156L
|
||||
#define ERROR_DLL_NOT_FOUND 1157L
|
||||
#define ERROR_BAD_USERNAME 2202L
|
||||
#define ERROR_NOT_CONNECTED 2250L
|
||||
#define ERROR_OPEN_FILES 2401L
|
||||
#define ERROR_ACTIVE_CONNECTIONS 2402L
|
||||
#define ERROR_DEVICE_IN_USE 2404L
|
||||
#define ERROR_BAD_DEVICE 1200L
|
||||
#define ERROR_CONNECTION_UNAVAIL 1201L
|
||||
#define ERROR_DEVICE_ALREADY_REMEMBERED 1202L
|
||||
#define ERROR_NO_NET_OR_BAD_PATH 1203L
|
||||
#define ERROR_BAD_PROVIDER 1204L
|
||||
#define ERROR_CANNOT_OPEN_PROFILE 1205L
|
||||
#define ERROR_BAD_PROFILE 1206L
|
||||
#define ERROR_NOT_CONTAINER 1207L
|
||||
#define ERROR_EXTENDED_ERROR 1208L
|
||||
#define ERROR_INVALID_GROUPNAME 1209L
|
||||
#define ERROR_INVALID_COMPUTERNAME 1210L
|
||||
#define ERROR_INVALID_EVENTNAME 1211L
|
||||
#define ERROR_INVALID_DOMAINNAME 1212L
|
||||
#define ERROR_INVALID_SERVICENAME 1213L
|
||||
#define ERROR_INVALID_NETNAME 1214L
|
||||
#define ERROR_INVALID_SHARENAME 1215L
|
||||
#define ERROR_INVALID_PASSWORDNAME 1216L
|
||||
#define ERROR_INVALID_MESSAGENAME 1217L
|
||||
#define ERROR_INVALID_MESSAGEDEST 1218L
|
||||
#define ERROR_SESSION_CREDENTIAL_CONFLICT 1219L
|
||||
#define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220L
|
||||
#define ERROR_DUP_DOMAINNAME 1221L
|
||||
#define ERROR_NO_NETWORK 1222L
|
||||
#define ERROR_CANCELLED 1223L
|
||||
#define ERROR_USER_MAPPED_FILE 1224L
|
||||
#define ERROR_CONNECTION_REFUSED 1225L
|
||||
#define ERROR_GRACEFUL_DISCONNECT 1226L
|
||||
#define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227L
|
||||
#define ERROR_ADDRESS_NOT_ASSOCIATED 1228L
|
||||
#define ERROR_CONNECTION_INVALID 1229L
|
||||
#define ERROR_CONNECTION_ACTIVE 1230L
|
||||
#define ERROR_NETWORK_UNREACHABLE 1231L
|
||||
#define ERROR_HOST_UNREACHABLE 1232L
|
||||
#define ERROR_PROTOCOL_UNREACHABLE 1233L
|
||||
#define ERROR_PORT_UNREACHABLE 1234L
|
||||
#define ERROR_REQUEST_ABORTED 1235L
|
||||
#define ERROR_CONNECTION_ABORTED 1236L
|
||||
#define ERROR_RETRY 1237L
|
||||
#define ERROR_CONNECTION_COUNT_LIMIT 1238L
|
||||
#define ERROR_LOGIN_TIME_RESTRICTION 1239L
|
||||
#define ERROR_LOGIN_WKSTA_RESTRICTION 1240L
|
||||
#define ERROR_INCORRECT_ADDRESS 1241L
|
||||
#define ERROR_ALREADY_REGISTERED 1242L
|
||||
#define ERROR_SERVICE_NOT_FOUND 1243L
|
||||
#define ERROR_NOT_AUTHENTICATED 1244L
|
||||
#define ERROR_NOT_LOGGED_ON 1245L
|
||||
#define ERROR_CONTINUE 1246L
|
||||
#define ERROR_ALREADY_INITIALIZED 1247L
|
||||
#define ERROR_NO_MORE_DEVICES 1248L
|
||||
#define ERROR_NOT_ALL_ASSIGNED 1300L
|
||||
#define ERROR_SOME_NOT_MAPPED 1301L
|
||||
#define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302L
|
||||
#define ERROR_LOCAL_USER_SESSION_KEY 1303L
|
||||
#define ERROR_NULL_LM_PASSWORD 1304L
|
||||
#define ERROR_UNKNOWN_REVISION 1305L
|
||||
#define ERROR_REVISION_MISMATCH 1306L
|
||||
#define ERROR_INVALID_OWNER 1307L
|
||||
#define ERROR_INVALID_PRIMARY_GROUP 1308L
|
||||
#define ERROR_NO_IMPERSONATION_TOKEN 1309L
|
||||
#define ERROR_CANT_DISABLE_MANDATORY 1310L
|
||||
#define ERROR_NO_LOGON_SERVERS 1311L
|
||||
#define ERROR_NO_SUCH_LOGON_SESSION 1312L
|
||||
#define ERROR_NO_SUCH_PRIVILEGE 1313L
|
||||
#define ERROR_PRIVILEGE_NOT_HELD 1314L
|
||||
#define ERROR_INVALID_ACCOUNT_NAME 1315L
|
||||
#define ERROR_USER_EXISTS 1316L
|
||||
#define ERROR_NO_SUCH_USER 1317L
|
||||
#define ERROR_GROUP_EXISTS 1318L
|
||||
#define ERROR_NO_SUCH_GROUP 1319L
|
||||
#define ERROR_MEMBER_IN_GROUP 1320L
|
||||
#define ERROR_MEMBER_NOT_IN_GROUP 1321L
|
||||
#define ERROR_LAST_ADMIN 1322L
|
||||
#define ERROR_WRONG_PASSWORD 1323L
|
||||
#define ERROR_ILL_FORMED_PASSWORD 1324L
|
||||
#define ERROR_PASSWORD_RESTRICTION 1325L
|
||||
#define ERROR_LOGON_FAILURE 1326L
|
||||
#define ERROR_ACCOUNT_RESTRICTION 1327L
|
||||
#define ERROR_INVALID_LOGON_HOURS 1328L
|
||||
#define ERROR_INVALID_WORKSTATION 1329L
|
||||
#define ERROR_PASSWORD_EXPIRED 1330L
|
||||
#define ERROR_ACCOUNT_DISABLED 1331L
|
||||
#define ERROR_NONE_MAPPED 1332L
|
||||
#define ERROR_TOO_MANY_LUIDS_REQUESTED 1333L
|
||||
#define ERROR_LUIDS_EXHAUSTED 1334L
|
||||
#define ERROR_INVALID_SUB_AUTHORITY 1335L
|
||||
#define ERROR_INVALID_ACL 1336L
|
||||
#define ERROR_INVALID_SID 1337L
|
||||
#define ERROR_INVALID_SECURITY_DESCR 1338L
|
||||
#define ERROR_BAD_INHERITANCE_ACL 1340L
|
||||
#define ERROR_SERVER_DISABLED 1341L
|
||||
#define ERROR_SERVER_NOT_DISABLED 1342L
|
||||
#define ERROR_INVALID_ID_AUTHORITY 1343L
|
||||
#define ERROR_ALLOTTED_SPACE_EXCEEDED 1344L
|
||||
#define ERROR_INVALID_GROUP_ATTRIBUTES 1345L
|
||||
#define ERROR_BAD_IMPERSONATION_LEVEL 1346L
|
||||
#define ERROR_CANT_OPEN_ANONYMOUS 1347L
|
||||
#define ERROR_BAD_VALIDATION_CLASS 1348L
|
||||
#define ERROR_BAD_TOKEN_TYPE 1349L
|
||||
#define ERROR_NO_SECURITY_ON_OBJECT 1350L
|
||||
#define ERROR_CANT_ACCESS_DOMAIN_INFO 1351L
|
||||
#define ERROR_INVALID_SERVER_STATE 1352L
|
||||
#define ERROR_INVALID_DOMAIN_STATE 1353L
|
||||
#define ERROR_INVALID_DOMAIN_ROLE 1354L
|
||||
#define ERROR_NO_SUCH_DOMAIN 1355L
|
||||
#define ERROR_DOMAIN_EXISTS 1356L
|
||||
#define ERROR_DOMAIN_LIMIT_EXCEEDED 1357L
|
||||
#define ERROR_INTERNAL_DB_CORRUPTION 1358L
|
||||
#define ERROR_INTERNAL_ERROR 1359L
|
||||
#define ERROR_GENERIC_NOT_MAPPED 1360L
|
||||
#define ERROR_BAD_DESCRIPTOR_FORMAT 1361L
|
||||
#define ERROR_NOT_LOGON_PROCESS 1362L
|
||||
#define ERROR_LOGON_SESSION_EXISTS 1363L
|
||||
#define ERROR_NO_SUCH_PACKAGE 1364L
|
||||
#define ERROR_BAD_LOGON_SESSION_STATE 1365L
|
||||
#define ERROR_LOGON_SESSION_COLLISION 1366L
|
||||
#define ERROR_INVALID_LOGON_TYPE 1367L
|
||||
#define ERROR_CANNOT_IMPERSONATE 1368L
|
||||
#define ERROR_RXACT_INVALID_STATE 1369L
|
||||
#define ERROR_RXACT_COMMIT_FAILURE 1370L
|
||||
#define ERROR_SPECIAL_ACCOUNT 1371L
|
||||
#define ERROR_SPECIAL_GROUP 1372L
|
||||
#define ERROR_SPECIAL_USER 1373L
|
||||
#define ERROR_MEMBERS_PRIMARY_GROUP 1374L
|
||||
#define ERROR_TOKEN_ALREADY_IN_USE 1375L
|
||||
#define ERROR_NO_SUCH_ALIAS 1376L
|
||||
#define ERROR_MEMBER_NOT_IN_ALIAS 1377L
|
||||
#define ERROR_MEMBER_IN_ALIAS 1378L
|
||||
#define ERROR_ALIAS_EXISTS 1379L
|
||||
#define ERROR_LOGON_NOT_GRANTED 1380L
|
||||
#define ERROR_TOO_MANY_SECRETS 1381L
|
||||
#define ERROR_SECRET_TOO_LONG 1382L
|
||||
#define ERROR_INTERNAL_DB_ERROR 1383L
|
||||
#define ERROR_TOO_MANY_CONTEXT_IDS 1384L
|
||||
#define ERROR_LOGON_TYPE_NOT_GRANTED 1385L
|
||||
#define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386L
|
||||
#define ERROR_NO_SUCH_MEMBER 1387L
|
||||
#define ERROR_INVALID_MEMBER 1388L
|
||||
#define ERROR_TOO_MANY_SIDS 1389L
|
||||
#define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390L
|
||||
#define ERROR_NO_INHERITANCE 1391L
|
||||
#define ERROR_FILE_CORRUPT 1392L
|
||||
#define ERROR_DISK_CORRUPT 1393L
|
||||
#define ERROR_NO_USER_SESSION_KEY 1394L
|
||||
#define ERROR_LICENSE_QUOTA_EXCEEDED 1395L
|
||||
#define ERROR_INVALID_WINDOW_HANDLE 1400L
|
||||
#define ERROR_INVALID_MENU_HANDLE 1401L
|
||||
#define ERROR_INVALID_CURSOR_HANDLE 1402L
|
||||
#define ERROR_INVALID_ACCEL_HANDLE 1403L
|
||||
#define ERROR_INVALID_HOOK_HANDLE 1404L
|
||||
#define ERROR_INVALID_DWP_HANDLE 1405L
|
||||
#define ERROR_TLW_WITH_WSCHILD 1406L
|
||||
#define ERROR_CANNOT_FIND_WND_CLASS 1407L
|
||||
#define ERROR_WINDOW_OF_OTHER_THREAD 1408L
|
||||
#define ERROR_HOTKEY_ALREADY_REGISTERED 1409L
|
||||
#define ERROR_CLASS_ALREADY_EXISTS 1410L
|
||||
#define ERROR_CLASS_DOES_NOT_EXIST 1411L
|
||||
#define ERROR_CLASS_HAS_WINDOWS 1412L
|
||||
#define ERROR_INVALID_INDEX 1413L
|
||||
#define ERROR_INVALID_ICON_HANDLE 1414L
|
||||
#define ERROR_PRIVATE_DIALOG_INDEX 1415L
|
||||
#define ERROR_LISTBOX_ID_NOT_FOUND 1416L
|
||||
#define ERROR_NO_WILDCARD_CHARACTERS 1417L
|
||||
#define ERROR_CLIPBOARD_NOT_OPEN 1418L
|
||||
#define ERROR_HOTKEY_NOT_REGISTERED 1419L
|
||||
#define ERROR_WINDOW_NOT_DIALOG 1420L
|
||||
#define ERROR_CONTROL_ID_NOT_FOUND 1421L
|
||||
#define ERROR_INVALID_COMBOBOX_MESSAGE 1422L
|
||||
#define ERROR_WINDOW_NOT_COMBOBOX 1423L
|
||||
#define ERROR_INVALID_EDIT_HEIGHT 1424L
|
||||
#define ERROR_DC_NOT_FOUND 1425L
|
||||
#define ERROR_INVALID_HOOK_FILTER 1426L
|
||||
#define ERROR_INVALID_FILTER_PROC 1427L
|
||||
#define ERROR_HOOK_NEEDS_HMOD 1428L
|
||||
#define ERROR_GLOBAL_ONLY_HOOK 1429L
|
||||
#define ERROR_JOURNAL_HOOK_SET 1430L
|
||||
#define ERROR_HOOK_NOT_INSTALLED 1431L
|
||||
#define ERROR_INVALID_LB_MESSAGE 1432L
|
||||
#define ERROR_SETCOUNT_ON_BAD_LB 1433L
|
||||
#define ERROR_LB_WITHOUT_TABSTOPS 1434L
|
||||
#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435L
|
||||
#define ERROR_CHILD_WINDOW_MENU 1436L
|
||||
#define ERROR_NO_SYSTEM_MENU 1437L
|
||||
#define ERROR_INVALID_MSGBOX_STYLE 1438L
|
||||
#define ERROR_INVALID_SPI_VALUE 1439L
|
||||
#define ERROR_SCREEN_ALREADY_LOCKED 1440L
|
||||
#define ERROR_HWNDS_HAVE_DIFF_PARENT 1441L
|
||||
#define ERROR_NOT_CHILD_WINDOW 1442L
|
||||
#define ERROR_INVALID_GW_COMMAND 1443L
|
||||
#define ERROR_INVALID_THREAD_ID 1444L
|
||||
#define ERROR_NON_MDICHILD_WINDOW 1445L
|
||||
#define ERROR_POPUP_ALREADY_ACTIVE 1446L
|
||||
#define ERROR_NO_SCROLLBARS 1447L
|
||||
#define ERROR_INVALID_SCROLLBAR_RANGE 1448L
|
||||
#define ERROR_INVALID_SHOWWIN_COMMAND 1449L
|
||||
#define ERROR_NO_SYSTEM_RESOURCES 1450L
|
||||
#define ERROR_NONPAGED_SYSTEM_RESOURCES 1451L
|
||||
#define ERROR_PAGED_SYSTEM_RESOURCES 1452L
|
||||
#define ERROR_WORKING_SET_QUOTA 1453L
|
||||
#define ERROR_PAGEFILE_QUOTA 1454L
|
||||
#define ERROR_COMMITMENT_LIMIT 1455L
|
||||
#define ERROR_MENU_ITEM_NOT_FOUND 1456L
|
||||
#define ERROR_EVENTLOG_FILE_CORRUPT 1500L
|
||||
#define ERROR_EVENTLOG_CANT_START 1501L
|
||||
#define ERROR_LOG_FILE_FULL 1502L
|
||||
#define ERROR_EVENTLOG_FILE_CHANGED 1503L
|
||||
#define RPC_S_INVALID_STRING_BINDING 1700L
|
||||
#define RPC_S_WRONG_KIND_OF_BINDING 1701L
|
||||
#define RPC_S_INVALID_BINDING 1702L
|
||||
#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703L
|
||||
#define RPC_S_INVALID_RPC_PROTSEQ 1704L
|
||||
#define RPC_S_INVALID_STRING_UUID 1705L
|
||||
#define RPC_S_INVALID_ENDPOINT_FORMAT 1706L
|
||||
#define RPC_S_INVALID_NET_ADDR 1707L
|
||||
#define RPC_S_NO_ENDPOINT_FOUND 1708L
|
||||
#define RPC_S_INVALID_TIMEOUT 1709L
|
||||
#define RPC_S_OBJECT_NOT_FOUND 1710L
|
||||
#define RPC_S_ALREADY_REGISTERED 1711L
|
||||
#define RPC_S_TYPE_ALREADY_REGISTERED 1712L
|
||||
#define RPC_S_ALREADY_LISTENING 1713L
|
||||
#define RPC_S_NO_PROTSEQS_REGISTERED 1714L
|
||||
#define RPC_S_NOT_LISTENING 1715L
|
||||
#define RPC_S_UNKNOWN_MGR_TYPE 1716L
|
||||
#define RPC_S_UNKNOWN_IF 1717L
|
||||
#define RPC_S_NO_BINDINGS 1718L
|
||||
#define RPC_S_NO_PROTSEQS 1719L
|
||||
#define RPC_S_CANT_CREATE_ENDPOINT 1720L
|
||||
#define RPC_S_OUT_OF_RESOURCES 1721L
|
||||
#define RPC_S_SERVER_UNAVAILABLE 1722L
|
||||
#define RPC_S_SERVER_TOO_BUSY 1723L
|
||||
#define RPC_S_INVALID_NETWORK_OPTIONS 1724L
|
||||
#define RPC_S_NO_CALL_ACTIVE 1725L
|
||||
#define RPC_S_CALL_FAILED 1726L
|
||||
#define RPC_S_CALL_FAILED_DNE 1727L
|
||||
#define RPC_S_PROTOCOL_ERROR 1728L
|
||||
#define RPC_S_UNSUPPORTED_TRANS_SYN 1730L
|
||||
#define RPC_S_UNSUPPORTED_TYPE 1732L
|
||||
#define RPC_S_INVALID_TAG 1733L
|
||||
#define RPC_S_INVALID_BOUND 1734L
|
||||
#define RPC_S_NO_ENTRY_NAME 1735L
|
||||
#define RPC_S_INVALID_NAME_SYNTAX 1736L
|
||||
#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737L
|
||||
#define RPC_S_UUID_NO_ADDRESS 1739L
|
||||
#define RPC_S_DUPLICATE_ENDPOINT 1740L
|
||||
#define RPC_S_UNKNOWN_AUTHN_TYPE 1741L
|
||||
#define RPC_S_MAX_CALLS_TOO_SMALL 1742L
|
||||
#define RPC_S_STRING_TOO_LONG 1743L
|
||||
#define RPC_S_PROTSEQ_NOT_FOUND 1744L
|
||||
#define RPC_S_PROCNUM_OUT_OF_RANGE 1745L
|
||||
#define RPC_S_BINDING_HAS_NO_AUTH 1746L
|
||||
#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747L
|
||||
#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748L
|
||||
#define RPC_S_INVALID_AUTH_IDENTITY 1749L
|
||||
#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750L
|
||||
#define EPT_S_INVALID_ENTRY 1751L
|
||||
#define EPT_S_CANT_PERFORM_OP 1752L
|
||||
#define EPT_S_NOT_REGISTERED 1753L
|
||||
#define RPC_S_NOTHING_TO_EXPORT 1754L
|
||||
#define RPC_S_INCOMPLETE_NAME 1755L
|
||||
#define RPC_S_INVALID_VERS_OPTION 1756L
|
||||
#define RPC_S_NO_MORE_MEMBERS 1757L
|
||||
#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758L
|
||||
#define RPC_S_INTERFACE_NOT_FOUND 1759L
|
||||
#define RPC_S_ENTRY_ALREADY_EXISTS 1760L
|
||||
#define RPC_S_ENTRY_NOT_FOUND 1761L
|
||||
#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762L
|
||||
#define RPC_S_INVALID_NAF_ID 1763L
|
||||
#define RPC_S_CANNOT_SUPPORT 1764L
|
||||
#define RPC_S_NO_CONTEXT_AVAILABLE 1765L
|
||||
#define RPC_S_INTERNAL_ERROR 1766L
|
||||
#define RPC_S_ZERO_DIVIDE 1767L
|
||||
#define RPC_S_ADDRESS_ERROR 1768L
|
||||
#define RPC_S_FP_DIV_ZERO 1769L
|
||||
#define RPC_S_FP_UNDERFLOW 1770L
|
||||
#define RPC_S_FP_OVERFLOW 1771L
|
||||
#define RPC_X_NO_MORE_ENTRIES 1772L
|
||||
#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773L
|
||||
#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774L
|
||||
#define RPC_X_SS_IN_NULL_CONTEXT 1775L
|
||||
#define RPC_X_SS_CONTEXT_DAMAGED 1777L
|
||||
#define RPC_X_SS_HANDLES_MISMATCH 1778L
|
||||
#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779L
|
||||
#define RPC_X_NULL_REF_POINTER 1780L
|
||||
#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781L
|
||||
#define RPC_X_BYTE_COUNT_TOO_SMALL 1782L
|
||||
#define RPC_X_BAD_STUB_DATA 1783L
|
||||
#define ERROR_INVALID_USER_BUFFER 1784L
|
||||
#define ERROR_UNRECOGNIZED_MEDIA 1785L
|
||||
#define ERROR_NO_TRUST_LSA_SECRET 1786L
|
||||
#define ERROR_NO_TRUST_SAM_ACCOUNT 1787L
|
||||
#define ERROR_TRUSTED_DOMAIN_FAILURE 1788L
|
||||
#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789L
|
||||
#define ERROR_TRUST_FAILURE 1790L
|
||||
#define RPC_S_CALL_IN_PROGRESS 1791L
|
||||
#define ERROR_NETLOGON_NOT_STARTED 1792L
|
||||
#define ERROR_ACCOUNT_EXPIRED 1793L
|
||||
#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794L
|
||||
#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795L
|
||||
#define ERROR_UNKNOWN_PORT 1796L
|
||||
#define ERROR_UNKNOWN_PRINTER_DRIVER 1797L
|
||||
#define ERROR_UNKNOWN_PRINTPROCESSOR 1798L
|
||||
#define ERROR_INVALID_SEPARATOR_FILE 1799L
|
||||
#define ERROR_INVALID_PRIORITY 1800L
|
||||
#define ERROR_INVALID_PRINTER_NAME 1801L
|
||||
#define ERROR_PRINTER_ALREADY_EXISTS 1802L
|
||||
#define ERROR_INVALID_PRINTER_COMMAND 1803L
|
||||
#define ERROR_INVALID_DATATYPE 1804L
|
||||
#define ERROR_INVALID_ENVIRONMENT 1805L
|
||||
#define RPC_S_NO_MORE_BINDINGS 1806L
|
||||
#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807L
|
||||
#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808L
|
||||
#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809L
|
||||
#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810L
|
||||
#define ERROR_SERVER_HAS_OPEN_HANDLES 1811L
|
||||
#define ERROR_RESOURCE_DATA_NOT_FOUND 1812L
|
||||
#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813L
|
||||
#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L
|
||||
#define ERROR_RESOURCE_LANG_NOT_FOUND 1815L
|
||||
#define ERROR_NOT_ENOUGH_QUOTA 1816L
|
||||
#define RPC_S_NO_INTERFACES 1817L
|
||||
#define RPC_S_CALL_CANCELLED 1818L
|
||||
#define RPC_S_BINDING_INCOMPLETE 1819L
|
||||
#define RPC_S_COMM_FAILURE 1820L
|
||||
#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821L
|
||||
#define RPC_S_NO_PRINC_NAME 1822L
|
||||
#define RPC_S_NOT_RPC_ERROR 1823L
|
||||
#define RPC_S_UUID_LOCAL_ONLY 1824L
|
||||
#define RPC_S_SEC_PKG_ERROR 1825L
|
||||
#define RPC_S_NOT_CANCELLED 1826L
|
||||
#define RPC_X_INVALID_ES_ACTION 1827L
|
||||
#define RPC_X_WRONG_ES_VERSION 1828L
|
||||
#define RPC_X_WRONG_STUB_VERSION 1829L
|
||||
#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898L
|
||||
#define EPT_S_CANT_CREATE 1899L
|
||||
#define RPC_S_INVALID_OBJECT 1900L
|
||||
#define ERROR_INVALID_TIME 1901L
|
||||
#define ERROR_INVALID_FORM_NAME 1902L
|
||||
#define ERROR_INVALID_FORM_SIZE 1903L
|
||||
#define ERROR_ALREADY_WAITING 1904L
|
||||
#define ERROR_PRINTER_DELETED 1905L
|
||||
#define ERROR_INVALID_PRINTER_STATE 1906L
|
||||
#define ERROR_PASSWORD_MUST_CHANGE 1907L
|
||||
#define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908L
|
||||
#define ERROR_ACCOUNT_LOCKED_OUT 1909L
|
||||
#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L
|
||||
#define ERROR_INVALID_PIXEL_FORMAT 2000L
|
||||
#define ERROR_BAD_DRIVER 2001L
|
||||
#define ERROR_INVALID_WINDOW_STYLE 2002L
|
||||
#define ERROR_METAFILE_NOT_SUPPORTED 2003L
|
||||
#define ERROR_TRANSFORM_NOT_SUPPORTED 2004L
|
||||
#define ERROR_CLIPPING_NOT_SUPPORTED 2005L
|
||||
#define ERROR_UNKNOWN_PRINT_MONITOR 3000L
|
||||
#define ERROR_PRINTER_DRIVER_IN_USE 3001L
|
||||
#define ERROR_SPOOL_FILE_NOT_FOUND 3002L
|
||||
#define ERROR_SPL_NO_STARTDOC 3003L
|
||||
#define ERROR_SPL_NO_ADDJOB 3004L
|
||||
#define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005L
|
||||
#define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006L
|
||||
#define ERROR_WINS_INTERNAL 4000L
|
||||
#define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001L
|
||||
#define ERROR_STATIC_INIT 4002L
|
||||
#define ERROR_INC_BACKUP 4003L
|
||||
#define ERROR_FULL_BACKUP 4004L
|
||||
#define ERROR_REC_NON_EXISTENT 4005L
|
||||
#define ERROR_RPL_NOT_ALLOWED 4006L
|
||||
#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _GNU_H_WINDOWS32_ERROR */
|
7484
reactos/include/funcs.h
Normal file
7484
reactos/include/funcs.h
Normal file
File diff suppressed because it is too large
Load Diff
491
reactos/include/in.h
Normal file
491
reactos/include/in.h
Normal file
@@ -0,0 +1,491 @@
|
||||
unsigned int wavelength=3891;
|
||||
|
||||
unsigned char wave[]={
|
||||
0x52,0x49,0x46,0x46,0x2b,0xf,0x0,0x0,
|
||||
0x57,0x41,0x56,0x45,0x66,0x6d,0x74,0x20,
|
||||
0x10,0x0,0x0,0x0,0x1,0x0,0x1,0x0,
|
||||
0x22,0x56,0x0,0x0,0x22,0x56,0x0,0x0,
|
||||
0x1,0x0,0x8,0x0,0x64,0x61,0x74,0x61,
|
||||
0x7,0xf,0x0,0x0,0x80,0xce,0xb2,0x53,
|
||||
0x2e,0x75,0xca,0xbb,0x5d,0x2c,0x6a,0xc4,
|
||||
0xc2,0x68,0x2c,0x5f,0xbd,0xc8,0x74,0x2e,
|
||||
0x51,0xad,0xd0,0x8a,0x36,0x3f,0x98,0xd2,
|
||||
0xa2,0x46,0x33,0x81,0xcd,0xb5,0x58,0x2d,
|
||||
0x67,0xbe,0xc8,0x78,0x30,0x49,0xa3,0xd2,
|
||||
0x9b,0x43,0x34,0x80,0xcc,0xb9,0x60,0x2c,
|
||||
0x5e,0xb6,0xce,0x89,0x39,0x3b,0x8b,0xce,
|
||||
0xb4,0x5c,0x2d,0x5e,0xb6,0xce,0x89,0x39,
|
||||
0x3a,0x8b,0xce,0xb7,0x62,0x2d,0x54,0xaa,
|
||||
0xd1,0x9b,0x46,0x31,0x74,0xc2,0xc7,0x7b,
|
||||
0x34,0x41,0x94,0xcf,0xb3,0x61,0x2e,0x53,
|
||||
0xa6,0xd1,0xa3,0x4f,0x2e,0x65,0xb7,0xce,
|
||||
0x90,0x41,0x33,0x78,0xc3,0xc8,0x83,0x3a,
|
||||
0x38,0x80,0xc6,0xc4,0x7d,0x36,0x3c,0x86,
|
||||
0xc9,0xc0,0x76,0x34,0x40,0x8d,0xcb,0xbe,
|
||||
0x74,0x34,0x3e,0x87,0xc9,0xc1,0x78,0x36,
|
||||
0x3b,0x83,0xc7,0xc4,0x7e,0x39,0x39,0x7d,
|
||||
0xc2,0xc9,0x8a,0x42,0x32,0x6a,0xb6,0xce,
|
||||
0x9c,0x4f,0x2e,0x5b,0xa8,0xd0,0xab,0x5d,
|
||||
0x2f,0x49,0x94,0xcb,0xbe,0x78,0x39,0x38,
|
||||
0x77,0xbd,0xcc,0x95,0x4a,0x2f,0x5c,0xa7,
|
||||
0xcf,0xb0,0x68,0x33,0x40,0x83,0xc3,0xc9,
|
||||
0x8e,0x47,0x30,0x5c,0xa6,0xcf,0xb2,0x6b,
|
||||
0x34,0x3e,0x7e,0xbf,0xcc,0x99,0x51,0x2f,
|
||||
0x4f,0x96,0xcb,0xc1,0x81,0x40,0x32,0x64,
|
||||
0xab,0xcf,0xb0,0x6c,0x36,0x39,0x74,0xb7,
|
||||
0xce,0xa7,0x61,0x32,0x40,0x80,0xbe,0xcc,
|
||||
0x9d,0x56,0x30,0x48,0x88,0xc3,0xca,0x99,
|
||||
0x54,0x30,0x47,0x88,0xc2,0xca,0x98,0x55,
|
||||
0x30,0x47,0x87,0xc1,0xca,0x9a,0x58,0x31,
|
||||
0x42,0x80,0xbb,0xcd,0xa5,0x63,0x34,0x3b,
|
||||
0x73,0xb3,0xce,0xb1,0x6f,0x39,0x36,0x66,
|
||||
0xa6,0xcc,0xbe,0x84,0x47,0x30,0x50,0x8f,
|
||||
0xc4,0xc9,0x9b,0x5c,0x33,0x3f,0x77,0xb4,
|
||||
0xce,0xb2,0x77,0x40,0x32,0x57,0x96,0xc6,
|
||||
0xc7,0x99,0x5a,0x33,0x3e,0x73,0xb0,0xcd,
|
||||
0xb7,0x7e,0x45,0x31,0x4e,0x88,0xbe,0xcc,
|
||||
0xa9,0x6c,0x3b,0x34,0x5d,0x99,0xc7,0xc7,
|
||||
0x99,0x5d,0x35,0x3a,0x69,0xa3,0xca,0xc3,
|
||||
0x93,0x58,0x33,0x3c,0x6e,0xa8,0xcb,0xc0,
|
||||
0x8f,0x54,0x33,0x3f,0x6f,0xa8,0xcb,0xc1,
|
||||
0x91,0x58,0x34,0x3b,0x69,0xa3,0xc9,0xc5,
|
||||
0x98,0x5f,0x37,0x38,0x61,0x99,0xc4,0xc9,
|
||||
0xa5,0x6d,0x3e,0x33,0x52,0x88,0xba,0xcc,
|
||||
0xb3,0x80,0x4b,0x32,0x44,0x76,0xac,0xca,
|
||||
0xc2,0x96,0x5f,0x38,0x36,0x5b,0x91,0xbf,
|
||||
0xcb,0xaf,0x7b,0x49,0x32,0x44,0x75,0xa9,
|
||||
0xc9,0xc4,0x9d,0x68,0x3d,0x34,0x50,0x83,
|
||||
0xb5,0xcb,0xbc,0x8f,0x59,0x37,0x38,0x5d,
|
||||
0x91,0xbd,0xcb,0xb6,0x85,0x53,0x35,0x3a,
|
||||
0x60,0x94,0xbe,0xcb,0xb3,0x83,0x51,0x34,
|
||||
0x3c,0x62,0x95,0xbe,0xcb,0xb6,0x87,0x56,
|
||||
0x37,0x39,0x5a,0x8c,0xb9,0xcb,0xbb,0x90,
|
||||
0x5d,0x3a,0x35,0x52,0x80,0xb0,0xc9,0xc3,
|
||||
0x9f,0x6e,0x44,0x33,0x43,0x6d,0x9f,0xc2,
|
||||
0xc9,0xaf,0x81,0x53,0x37,0x39,0x57,0x85,
|
||||
0xb2,0xc9,0xc2,0x9f,0x6e,0x45,0x34,0x41,
|
||||
0x68,0x98,0xbe,0xca,0xb8,0x8e,0x61,0x3d,
|
||||
0x34,0x49,0x72,0xa1,0xc2,0xc9,0xb2,0x88,
|
||||
0x5a,0x3b,0x36,0x4e,0x7a,0xa6,0xc4,0xc8,
|
||||
0xb0,0x85,0x59,0x3b,0x36,0x4d,0x76,0xa3,
|
||||
0xc3,0xc9,0xb3,0x89,0x5d,0x3d,0x35,0x49,
|
||||
0x70,0x9c,0xbe,0xc9,0xba,0x96,0x6a,0x44,
|
||||
0x35,0x40,0x61,0x8d,0xb4,0xc8,0xc2,0xa4,
|
||||
0x7a,0x51,0x38,0x38,0x4f,0x78,0xa2,0xc0,
|
||||
0xc9,0xb8,0x93,0x68,0x45,0x35,0x3f,0x5f,
|
||||
0x89,0xaf,0xc6,0xc6,0xad,0x86,0x5e,0x3f,
|
||||
0x35,0x43,0x66,0x8f,0xb4,0xc7,0xc3,0xa9,
|
||||
0x81,0x58,0x3d,0x36,0x46,0x67,0x8f,0xb4,
|
||||
0xc7,0xc4,0xab,0x85,0x5d,0x3f,0x36,0x43,
|
||||
0x63,0x8a,0xb0,0xc5,0xc6,0xb1,0x8e,0x66,
|
||||
0x46,0x36,0x3c,0x56,0x7d,0xa2,0xbf,0xc8,
|
||||
0xbc,0x9c,0x77,0x51,0x3a,0x37,0x48,0x69,
|
||||
0x8f,0xb2,0xc5,0xc5,0xb2,0x8f,0x69,0x48,
|
||||
0x37,0x3b,0x51,0x75,0x9b,0xba,0xc7,0xc1,
|
||||
0xaa,0x86,0x62,0x44,0x37,0x3d,0x55,0x79,
|
||||
0x9d,0xba,0xc7,0xc1,0xa8,0x85,0x61,0x44,
|
||||
0x37,0x3c,0x54,0x75,0x99,0xb7,0xc6,0xc3,
|
||||
0xae,0x8e,0x69,0x4a,0x39,0x3a,0x4c,0x6b,
|
||||
0x8f,0xaf,0xc3,0xc6,0xb8,0x9c,0x79,0x57,
|
||||
0x3f,0x37,0x41,0x59,0x7c,0x9e,0xb9,0xc6,
|
||||
0xc2,0xad,0x8e,0x6c,0x4d,0x3b,0x38,0x46,
|
||||
0x61,0x82,0xa4,0xbc,0xc7,0xc0,0xaa,0x8a,
|
||||
0x68,0x4b,0x3a,0x39,0x48,0x62,0x84,0xa4,
|
||||
0xbc,0xc6,0xc1,0xad,0x8d,0x6d,0x4f,0x3c,
|
||||
0x38,0x44,0x5d,0x7d,0x9d,0xb6,0xc5,0xc4,
|
||||
0xb5,0x99,0x79,0x5b,0x43,0x38,0x3d,0x50,
|
||||
0x6c,0x8c,0xab,0xbf,0xc6,0xbf,0xaa,0x8d,
|
||||
0x6e,0x52,0x3e,0x38,0x41,0x56,0x73,0x92,
|
||||
0xae,0xc1,0xc6,0xbc,0xa5,0x87,0x6a,0x4f,
|
||||
0x3d,0x39,0x41,0x57,0x73,0x92,0xad,0xbf,
|
||||
0xc5,0xbe,0xa9,0x8d,0x70,0x53,0x40,0x39,
|
||||
0x3f,0x50,0x6b,0x88,0xa5,0xba,0xc5,0xc2,
|
||||
0xb3,0x9a,0x7e,0x61,0x49,0x3b,0x3a,0x46,
|
||||
0x5b,0x78,0x94,0xae,0xbf,0xc5,0xbe,0xad,
|
||||
0x93,0x77,0x5b,0x46,0x3b,0x3b,0x47,0x5b,
|
||||
0x77,0x92,0xac,0xbe,0xc5,0xc0,0xb1,0x9a,
|
||||
0x7e,0x63,0x4c,0x3e,0x3a,0x41,0x52,0x6a,
|
||||
0x85,0x9f,0xb4,0xc1,0xc4,0xbc,0xab,0x93,
|
||||
0x79,0x5f,0x4a,0x3d,0x3a,0x42,0x53,0x6a,
|
||||
0x82,0x9c,0xb1,0xc0,0xc4,0xbf,0xb0,0x9a,
|
||||
0x80,0x68,0x51,0x42,0x3a,0x3d,0x48,0x5c,
|
||||
0x73,0x8d,0xa4,0xb7,0xc2,0xc3,0xbc,0xac,
|
||||
0x96,0x7e,0x67,0x51,0x42,0x3b,0x3d,0x48,
|
||||
0x5a,0x70,0x88,0x9f,0xb2,0xbf,0xc3,0xbf,
|
||||
0xb3,0xa1,0x89,0x72,0x5c,0x4a,0x3e,0x3b,
|
||||
0x3f,0x4c,0x5e,0x75,0x8a,0xa1,0xb3,0xbf,
|
||||
0xc3,0xbf,0xb5,0xa3,0x8e,0x77,0x61,0x4e,
|
||||
0x41,0x3b,0x3d,0x46,0x55,0x69,0x80,0x95,
|
||||
0xa9,0xb8,0xc1,0xc3,0xbd,0xb0,0x9f,0x8a,
|
||||
0x75,0x61,0x4e,0x42,0x3c,0x3d,0x44,0x52,
|
||||
0x65,0x7a,0x8e,0xa2,0xb2,0xbd,0xc2,0xc0,
|
||||
0xb8,0xaa,0x98,0x83,0x6f,0x5c,0x4c,0x41,
|
||||
0x3c,0x3d,0x45,0x52,0x63,0x77,0x8b,0x9e,
|
||||
0xaf,0xbb,0xc1,0xc1,0xbc,0xb1,0xa1,0x8f,
|
||||
0x7b,0x67,0x56,0x48,0x3f,0x3c,0x3f,0x47,
|
||||
0x54,0x65,0x77,0x8a,0x9d,0xad,0xb9,0xc0,
|
||||
0xc2,0xbe,0xb5,0xa7,0x97,0x83,0x72,0x60,
|
||||
0x50,0x45,0x3e,0x3d,0x40,0x49,0x56,0x66,
|
||||
0x78,0x8a,0x9c,0xab,0xb7,0xbf,0xc1,0xbf,
|
||||
0xb8,0xac,0x9d,0x8c,0x7b,0x6a,0x59,0x4c,
|
||||
0x43,0x3d,0x3d,0x42,0x4b,0x57,0x67,0x79,
|
||||
0x89,0x9a,0xa8,0xb5,0xbd,0xc1,0xc0,0xbb,
|
||||
0xb1,0xa5,0x95,0x84,0x74,0x63,0x56,0x4a,
|
||||
0x42,0x3e,0x3e,0x43,0x4b,0x57,0x66,0x75,
|
||||
0x85,0x95,0xa4,0xb0,0xba,0xbf,0xc0,0xbe,
|
||||
0xb7,0xad,0xa0,0x92,0x81,0x72,0x63,0x55,
|
||||
0x4a,0x42,0x3e,0x3e,0x42,0x48,0x53,0x60,
|
||||
0x6e,0x7e,0x8d,0x9b,0xa9,0xb4,0xbb,0xbf,
|
||||
0xc0,0xbd,0xb7,0xad,0xa1,0x93,0x84,0x75,
|
||||
0x67,0x5a,0x4f,0x46,0x40,0x3e,0x3f,0x44,
|
||||
0x4b,0x56,0x63,0x71,0x80,0x8d,0x9a,0xa7,
|
||||
0xb1,0xb9,0xbe,0xc0,0xbe,0xb9,0xb2,0xa7,
|
||||
0x9c,0x8e,0x80,0x73,0x65,0x59,0x4f,0x47,
|
||||
0x41,0x3f,0x3f,0x43,0x49,0x53,0x5d,0x69,
|
||||
0x76,0x84,0x91,0x9e,0xa9,0xb3,0xba,0xbe,
|
||||
0xbf,0xbe,0xba,0xb3,0xaa,0xa0,0x93,0x86,
|
||||
0x7a,0x6d,0x60,0x55,0x4d,0x46,0x41,0x3f,
|
||||
0x40,0x44,0x49,0x51,0x5c,0x66,0x72,0x80,
|
||||
0x8b,0x97,0xa2,0xac,0xb4,0xba,0xbd,0xbe,
|
||||
0xbd,0xb9,0xb4,0xab,0xa1,0x96,0x8b,0x80,
|
||||
0x73,0x68,0x5d,0x52,0x4b,0x45,0x41,0x40,
|
||||
0x41,0x44,0x49,0x50,0x58,0x63,0x6e,0x7a,
|
||||
0x85,0x90,0x9b,0xa5,0xae,0xb5,0xba,0xbd,
|
||||
0xbe,0xbd,0xba,0xb4,0xae,0xa5,0x9b,0x91,
|
||||
0x85,0x7b,0x70,0x65,0x5b,0x53,0x4b,0x46,
|
||||
0x42,0x41,0x41,0x43,0x47,0x4c,0x54,0x5d,
|
||||
0x67,0x71,0x7c,0x86,0x90,0x9a,0xa3,0xac,
|
||||
0xb3,0xb8,0xbb,0xbd,0xbd,0xbb,0xb7,0xb2,
|
||||
0xac,0xa3,0x9b,0x91,0x87,0x7d,0x72,0x69,
|
||||
0x5f,0x57,0x50,0x4a,0x45,0x42,0x41,0x42,
|
||||
0x43,0x47,0x4c,0x53,0x5b,0x63,0x6c,0x76,
|
||||
0x80,0x88,0x93,0x9c,0xa4,0xab,0xb1,0xb6,
|
||||
0xba,0xbc,0xbd,0xbc,0xb9,0xb5,0xb0,0xaa,
|
||||
0xa2,0x9a,0x91,0x87,0x80,0x76,0x6c,0x63,
|
||||
0x5c,0x55,0x4e,0x49,0x45,0x43,0x42,0x42,
|
||||
0x44,0x47,0x4b,0x50,0x57,0x5e,0x66,0x6f,
|
||||
0x78,0x80,0x89,0x92,0x9a,0xa2,0xa8,0xae,
|
||||
0xb4,0xb7,0xba,0xbc,0xbc,0xbb,0xb8,0xb5,
|
||||
0xb0,0xab,0xa4,0x9d,0x95,0x8d,0x85,0x7c,
|
||||
0x74,0x6c,0x64,0x5c,0x56,0x51,0x4c,0x48,
|
||||
0x45,0x43,0x43,0x43,0x45,0x48,0x4b,0x50,
|
||||
0x56,0x5d,0x63,0x6b,0x73,0x7b,0x82,0x8a,
|
||||
0x92,0x99,0xa0,0xa7,0xac,0xb1,0xb5,0xb8,
|
||||
0xba,0xbb,0xbb,0xba,0xb8,0xb4,0xb1,0xac,
|
||||
0xa6,0xa0,0x9a,0x92,0x8b,0x83,0x7c,0x75,
|
||||
0x6d,0x66,0x60,0x5a,0x54,0x4f,0x4b,0x48,
|
||||
0x45,0x44,0x43,0x44,0x45,0x47,0x4a,0x4e,
|
||||
0x53,0x58,0x5e,0x64,0x6b,0x72,0x79,0x80,
|
||||
0x87,0x8d,0x94,0x9b,0xa1,0xa6,0xac,0xaf,
|
||||
0xb3,0xb6,0xb8,0xba,0xba,0xba,0xb9,0xb7,
|
||||
0xb4,0xb0,0xad,0xa8,0xa2,0x9d,0x97,0x90,
|
||||
0x8a,0x83,0x7d,0x76,0x70,0x69,0x64,0x5d,
|
||||
0x59,0x53,0x50,0x4c,0x49,0x47,0x45,0x44,
|
||||
0x44,0x45,0x46,0x48,0x4b,0x4f,0x52,0x57,
|
||||
0x5c,0x61,0x67,0x6c,0x72,0x79,0x80,0x85,
|
||||
0x8b,0x91,0x96,0x9c,0xa2,0xa7,0xab,0xaf,
|
||||
0xb2,0xb5,0xb7,0xb8,0xb9,0xb9,0xb9,0xb8,
|
||||
0xb6,0xb4,0xb1,0xae,0xaa,0xa6,0xa1,0x9c,
|
||||
0x96,0x91,0x8c,0x86,0x80,0x7a,0x75,0x6f,
|
||||
0x6a,0x64,0x5f,0x5b,0x56,0x52,0x4f,0x4c,
|
||||
0x4a,0x48,0x46,0x46,0x45,0x46,0x47,0x48,
|
||||
0x4a,0x4c,0x4f,0x52,0x56,0x5a,0x5e,0x63,
|
||||
0x68,0x6e,0x72,0x78,0x7d,0x82,0x88,0x8c,
|
||||
0x92,0x97,0x9b,0xa0,0xa4,0xa8,0xac,0xaf,
|
||||
0xb1,0xb3,0xb6,0xb7,0xb8,0xb8,0xb8,0xb7,
|
||||
0xb6,0xb5,0xb3,0xb0,0xad,0xaa,0xa7,0xa3,
|
||||
0x9f,0x9b,0x97,0x92,0x8c,0x87,0x82,0x7f,
|
||||
0x7a,0x75,0x70,0x6b,0x66,0x62,0x5e,0x5a,
|
||||
0x56,0x54,0x51,0x4e,0x4c,0x4a,0x49,0x47,
|
||||
0x47,0x47,0x47,0x47,0x48,0x4a,0x4b,0x4d,
|
||||
0x50,0x53,0x55,0x59,0x5d,0x61,0x64,0x68,
|
||||
0x6d,0x71,0x76,0x7b,0x7f,0x82,0x87,0x8b,
|
||||
0x90,0x95,0x98,0x9c,0xa0,0xa3,0xa7,0xaa,
|
||||
0xad,0xaf,0xb1,0xb3,0xb4,0xb5,0xb6,0xb7,
|
||||
0xb7,0xb6,0xb6,0xb5,0xb3,0xb2,0xb0,0xad,
|
||||
0xab,0xa8,0xa5,0xa2,0x9e,0x9a,0x96,0x93,
|
||||
0x8e,0x8a,0x86,0x81,0x7f,0x7a,0x76,0x72,
|
||||
0x6d,0x6a,0x65,0x62,0x5e,0x5b,0x58,0x55,
|
||||
0x53,0x50,0x4e,0x4c,0x4b,0x4a,0x49,0x48,
|
||||
0x48,0x48,0x49,0x49,0x4a,0x4b,0x4d,0x4f,
|
||||
0x51,0x54,0x56,0x59,0x5c,0x5f,0x63,0x66,
|
||||
0x6a,0x6e,0x72,0x76,0x7a,0x7e,0x80,0x85,
|
||||
0x89,0x8d,0x90,0x94,0x98,0x9c,0x9f,0xa2,
|
||||
0xa5,0xa7,0xaa,0xac,0xae,0xb0,0xb2,0xb3,
|
||||
0xb4,0xb5,0xb5,0xb5,0xb5,0xb5,0xb4,0xb3,
|
||||
0xb2,0xb0,0xaf,0xad,0xab,0xa8,0xa6,0xa3,
|
||||
0xa0,0x9d,0x9a,0x96,0x93,0x8f,0x8c,0x88,
|
||||
0x84,0x80,0x7e,0x7a,0x76,0x72,0x6f,0x6b,
|
||||
0x68,0x65,0x62,0x5f,0x5c,0x59,0x57,0x54,
|
||||
0x52,0x50,0x4f,0x4d,0x4c,0x4b,0x4a,0x4a,
|
||||
0x4a,0x4a,0x4a,0x4a,0x4b,0x4c,0x4d,0x4f,
|
||||
0x50,0x52,0x54,0x56,0x59,0x5c,0x5e,0x61,
|
||||
0x64,0x67,0x6a,0x6d,0x71,0x74,0x77,0x7b,
|
||||
0x7f,0x81,0x84,0x88,0x8b,0x8e,0x92,0x95,
|
||||
0x98,0x9b,0x9e,0xa1,0xa3,0xa5,0xa8,0xaa,
|
||||
0xac,0xad,0xaf,0xb0,0xb1,0xb2,0xb3,0xb3,
|
||||
0xb3,0xb3,0xb3,0xb3,0xb2,0xb2,0xb1,0xb0,
|
||||
0xae,0xac,0xab,0xa9,0xa7,0xa4,0xa2,0xa0,
|
||||
0x9d,0x9a,0x97,0x95,0x91,0x8f,0x8b,0x89,
|
||||
0x85,0x82,0x80,0x7d,0x79,0x76,0x73,0x70,
|
||||
0x6d,0x6a,0x68,0x65,0x62,0x5f,0x5d,0x5b,
|
||||
0x59,0x56,0x55,0x53,0x51,0x50,0x4f,0x4e,
|
||||
0x4d,0x4c,0x4c,0x4c,0x4b,0x4b,0x4c,0x4c,
|
||||
0x4d,0x4e,0x4e,0x50,0x51,0x53,0x54,0x56,
|
||||
0x58,0x5a,0x5b,0x5d,0x60,0x63,0x65,0x68,
|
||||
0x6a,0x6d,0x70,0x73,0x76,0x78,0x7c,0x7f,
|
||||
0x80,0x84,0x87,0x89,0x8c,0x8f,0x92,0x94,
|
||||
0x97,0x99,0x9c,0x9e,0xa0,0xa2,0xa5,0xa6,
|
||||
0xa8,0xaa,0xab,0xad,0xae,0xaf,0xaf,0xb0,
|
||||
0xb1,0xb1,0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,
|
||||
0xb0,0xaf,0xae,0xad,0xac,0xab,0xa9,0xa8,
|
||||
0xa5,0xa4,0xa2,0xa0,0x9e,0x9c,0x99,0x97,
|
||||
0x95,0x92,0x90,0x8d,0x8b,0x88,0x86,0x82,
|
||||
0x80,0x7e,0x7b,0x78,0x76,0x73,0x71,0x6e,
|
||||
0x6c,0x69,0x67,0x65,0x63,0x60,0x5e,0x5d,
|
||||
0x5b,0x59,0x57,0x56,0x54,0x53,0x52,0x51,
|
||||
0x50,0x50,0x4f,0x4e,0x4e,0x4e,0x4d,0x4d,
|
||||
0x4e,0x4e,0x4e,0x4f,0x4f,0x50,0x51,0x52,
|
||||
0x53,0x54,0x56,0x57,0x58,0x5a,0x5c,0x5e,
|
||||
0x60,0x62,0x63,0x65,0x67,0x6a,0x6c,0x6f,
|
||||
0x71,0x73,0x75,0x78,0x7a,0x7d,0x7f,0x80,
|
||||
0x83,0x85,0x88,0x8a,0x8c,0x8f,0x91,0x93,
|
||||
0x95,0x97,0x99,0x9b,0x9d,0x9f,0xa1,0xa2,
|
||||
0xa4,0xa5,0xa7,0xa8,0xa9,0xaa,0xab,0xac,
|
||||
0xad,0xae,0xae,0xaf,0xaf,0xaf,0xaf,0xaf,
|
||||
0xaf,0xaf,0xaf,0xae,0xae,0xad,0xad,0xac,
|
||||
0xab,0xaa,0xa9,0xa8,0xa7,0xa5,0xa4,0xa3,
|
||||
0xa1,0x9f,0x9e,0x9c,0x9a,0x98,0x96,0x95,
|
||||
0x92,0x91,0x8e,0x8c,0x8a,0x88,0x86,0x84,
|
||||
0x81,0x80,0x7e,0x7c,0x7a,0x78,0x75,0x73,
|
||||
0x71,0x6f,0x6d,0x6b,0x6a,0x67,0x66,0x64,
|
||||
0x63,0x61,0x5f,0x5e,0x5c,0x5b,0x5a,0x58,
|
||||
0x57,0x56,0x55,0x54,0x53,0x53,0x52,0x51,
|
||||
0x51,0x50,0x50,0x50,0x50,0x50,0x50,0x50,
|
||||
0x50,0x50,0x51,0x51,0x52,0x53,0x53,0x54,
|
||||
0x55,0x56,0x57,0x58,0x59,0x5a,0x5c,0x5d,
|
||||
0x5f,0x60,0x61,0x63,0x64,0x66,0x68,0x69,
|
||||
0x6c,0x6d,0x6f,0x71,0x73,0x74,0x77,0x78,
|
||||
0x7a,0x7c,0x7e,0x80,0x81,0x83,0x84,0x87,
|
||||
0x88,0x8a,0x8c,0x8e,0x8f,0x92,0x93,0x94,
|
||||
0x96,0x98,0x99,0x9b,0x9d,0x9e,0x9f,0xa0,
|
||||
0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,
|
||||
0xa9,0xaa,0xaa,0xab,0xac,0xac,0xac,0xac,
|
||||
0xad,0xad,0xad,0xad,0xad,0xac,0xac,0xac,
|
||||
0xac,0xab,0xab,0xaa,0xaa,0xa9,0xa8,0xa7,
|
||||
0xa6,0xa6,0xa5,0xa4,0xa2,0xa1,0xa0,0x9f,
|
||||
0x9e,0x9d,0x9b,0x99,0x98,0x97,0x95,0x94,
|
||||
0x93,0x90,0x8f,0x8d,0x8c,0x8a,0x89,0x87,
|
||||
0x86,0x83,0x82,0x80,0x80,0x7e,0x7c,0x7b,
|
||||
0x79,0x78,0x76,0x75,0x72,0x71,0x6f,0x6e,
|
||||
0x6c,0x6b,0x6a,0x68,0x67,0x66,0x64,0x63,
|
||||
0x62,0x61,0x60,0x5e,0x5d,0x5c,0x5b,0x5a,
|
||||
0x59,0x59,0x58,0x57,0x56,0x56,0x55,0x55,
|
||||
0x54,0x54,0x54,0x53,0x53,0x53,0x53,0x53,
|
||||
0x53,0x53,0x53,0x53,0x53,0x54,0x54,0x54,
|
||||
0x55,0x55,0x56,0x56,0x56,0x57,0x58,0x59,
|
||||
0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,
|
||||
0x61,0x62,0x64,0x64,0x65,0x67,0x68,0x69,
|
||||
0x6b,0x6c,0x6e,0x6f,0x70,0x71,0x73,0x74,
|
||||
0x76,0x77,0x79,0x7a,0x7c,0x7d,0x7e,0x80,
|
||||
0x80,0x82,0x83,0x85,0x86,0x88,0x89,0x8a,
|
||||
0x8b,0x8d,0x8e,0x90,0x91,0x92,0x93,0x94,
|
||||
0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,
|
||||
0x9e,0x9f,0xa0,0xa1,0xa2,0xa2,0xa3,0xa4,
|
||||
0xa5,0xa5,0xa6,0xa6,0xa7,0xa7,0xa8,0xa8,
|
||||
0xa8,0xa9,0xa9,0xa9,0xa9,0xa9,0xaa,0xaa,
|
||||
0xaa,0xa9,0xa9,0xa9,0xa9,0xa9,0xa9,0xa8,
|
||||
0xa8,0xa8,0xa7,0xa7,0xa6,0xa6,0xa5,0xa4,
|
||||
0xa4,0xa3,0xa2,0xa1,0xa1,0xa0,0x9f,0x9e,
|
||||
0x9d,0x9d,0x9c,0x9a,0x99,0x99,0x97,0x96,
|
||||
0x95,0x94,0x93,0x92,0x90,0x8f,0x8e,0x8d,
|
||||
0x8c,0x8a,0x89,0x88,0x87,0x85,0x84,0x83,
|
||||
0x81,0x80,0x80,0x7f,0x7d,0x7d,0x7b,0x7a,
|
||||
0x78,0x77,0x76,0x75,0x74,0x73,0x71,0x70,
|
||||
0x6f,0x6e,0x6c,0x6c,0x6b,0x69,0x68,0x68,
|
||||
0x66,0x65,0x65,0x64,0x63,0x62,0x61,0x60,
|
||||
0x5f,0x5f,0x5e,0x5d,0x5d,0x5c,0x5b,0x5b,
|
||||
0x5a,0x5a,0x59,0x59,0x58,0x58,0x58,0x57,
|
||||
0x57,0x57,0x57,0x57,0x56,0x56,0x56,0x56,
|
||||
0x56,0x56,0x56,0x57,0x57,0x57,0x57,0x57,
|
||||
0x58,0x58,0x58,0x59,0x59,0x5a,0x5a,0x5a,
|
||||
0x5b,0x5c,0x5c,0x5d,0x5d,0x5e,0x5f,0x5f,
|
||||
0x60,0x61,0x62,0x63,0x64,0x64,0x65,0x66,
|
||||
0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,
|
||||
0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,
|
||||
0x77,0x78,0x7a,0x7b,0x7c,0x7d,0x7e,0x80,
|
||||
0x80,0x81,0x81,0x83,0x84,0x85,0x86,0x87,
|
||||
0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
|
||||
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x96,
|
||||
0x98,0x98,0x99,0x9a,0x9b,0x9b,0x9c,0x9d,
|
||||
0x9d,0x9e,0x9f,0x9f,0xa0,0xa0,0xa1,0xa1,
|
||||
0xa2,0xa2,0xa3,0xa3,0xa3,0xa4,0xa4,0xa4,
|
||||
0xa5,0xa5,0xa5,0xa5,0xa5,0xa5,0xa6,0xa6,
|
||||
0xa6,0xa6,0xa6,0xa6,0xa6,0xa5,0xa5,0xa5,
|
||||
0xa5,0xa5,0xa5,0xa4,0xa4,0xa4,0xa3,0xa3,
|
||||
0xa3,0xa2,0xa2,0xa1,0xa1,0xa0,0xa0,0x9f,
|
||||
0x9f,0x9e,0x9e,0x9d,0x9d,0x9c,0x9b,0x9a,
|
||||
0x9a,0x99,0x98,0x97,0x97,0x96,0x95,0x95,
|
||||
0x93,0x93,0x92,0x91,0x90,0x8f,0x8e,0x8d,
|
||||
0x8d,0x8c,0x8b,0x8a,0x89,0x88,0x87,0x86,
|
||||
0x85,0x84,0x83,0x82,0x81,0x80,0x80,0x80,
|
||||
0x7e,0x7e,0x7d,0x7c,0x7b,0x7a,0x79,0x78,
|
||||
0x77,0x76,0x75,0x74,0x74,0x73,0x72,0x71,
|
||||
0x70,0x70,0x6e,0x6e,0x6d,0x6c,0x6b,0x6a,
|
||||
0x6a,0x69,0x68,0x67,0x67,0x66,0x65,0x65,
|
||||
0x64,0x64,0x63,0x62,0x62,0x62,0x61,0x61,
|
||||
0x60,0x60,0x5f,0x5f,0x5e,0x5e,0x5d,0x5d,
|
||||
0x5d,0x5d,0x5c,0x5c,0x5c,0x5c,0x5b,0x5b,
|
||||
0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
|
||||
0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
|
||||
0x5b,0x5c,0x5c,0x5c,0x5c,0x5d,0x5d,0x5d,
|
||||
0x5e,0x5e,0x5e,0x5f,0x5f,0x60,0x60,0x60,
|
||||
0x61,0x61,0x62,0x62,0x63,0x63,0x64,0x64,
|
||||
0x65,0x65,0x66,0x67,0x67,0x68,0x69,0x69,
|
||||
0x6a,0x6b,0x6b,0x6c,0x6d,0x6d,0x6e,0x6f,
|
||||
0x70,0x70,0x71,0x72,0x73,0x73,0x74,0x75,
|
||||
0x76,0x77,0x77,0x78,0x79,0x7a,0x7b,0x7b,
|
||||
0x7c,0x7d,0x7e,0x7e,0x80,0x80,0x80,0x81,
|
||||
0x82,0x82,0x83,0x84,0x85,0x85,0x86,0x87,
|
||||
0x88,0x88,0x89,0x8a,0x8b,0x8b,0x8c,0x8d,
|
||||
0x8d,0x8e,0x8f,0x90,0x90,0x91,0x92,0x92,
|
||||
0x93,0x93,0x94,0x95,0x95,0x96,0x96,0x97,
|
||||
0x97,0x98,0x99,0x99,0x99,0x9a,0x9a,0x9b,
|
||||
0x9b,0x9b,0x9c,0x9c,0x9d,0x9d,0x9d,0x9e,
|
||||
0x9e,0x9e,0x9e,0x9f,0x9f,0x9f,0x9f,0xa0,
|
||||
0xa0,0xa0,0xa0,0xa0,0xa0,0xa1,0xa1,0xa1,
|
||||
0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,0xa1,
|
||||
0xa1,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0xa0,
|
||||
0xa0,0xa0,0x9f,0x9f,0x9f,0x9f,0x9f,0x9e,
|
||||
0x9e,0x9e,0x9d,0x9d,0x9d,0x9c,0x9c,0x9c,
|
||||
0x9b,0x9b,0x9a,0x9a,0x9a,0x99,0x99,0x98,
|
||||
0x98,0x97,0x97,0x96,0x96,0x95,0x95,0x94,
|
||||
0x94,0x93,0x93,0x92,0x92,0x91,0x90,0x90,
|
||||
0x8f,0x8f,0x8e,0x8d,0x8d,0x8c,0x8c,0x8b,
|
||||
0x8a,0x8a,0x89,0x88,0x88,0x87,0x87,0x86,
|
||||
0x85,0x85,0x84,0x83,0x83,0x82,0x81,0x81,
|
||||
0x80,0x80,0x80,0x7f,0x7e,0x7e,0x7d,0x7d,
|
||||
0x7c,0x7b,0x7a,0x7a,0x79,0x79,0x78,0x78,
|
||||
0x77,0x76,0x75,0x75,0x74,0x74,0x73,0x73,
|
||||
0x72,0x72,0x71,0x71,0x70,0x6f,0x6f,0x6e,
|
||||
0x6e,0x6d,0x6d,0x6c,0x6c,0x6b,0x6b,0x6a,
|
||||
0x6a,0x69,0x69,0x69,0x68,0x68,0x68,0x67,
|
||||
0x67,0x66,0x66,0x65,0x65,0x65,0x65,0x64,
|
||||
0x64,0x64,0x63,0x63,0x63,0x63,0x62,0x62,
|
||||
0x62,0x62,0x62,0x61,0x61,0x61,0x61,0x61,
|
||||
0x61,0x61,0x60,0x60,0x60,0x60,0x60,0x60,
|
||||
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,
|
||||
0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x61,
|
||||
0x61,0x61,0x61,0x61,0x61,0x62,0x62,0x62,
|
||||
0x62,0x62,0x63,0x63,0x63,0x63,0x64,0x64,
|
||||
0x64,0x64,0x65,0x65,0x65,0x66,0x66,0x66,
|
||||
0x66,0x67,0x67,0x67,0x68,0x68,0x69,0x69,
|
||||
0x69,0x6a,0x6a,0x6b,0x6b,0x6b,0x6c,0x6c,
|
||||
0x6d,0x6d,0x6e,0x6e,0x6e,0x6f,0x6f,0x70,
|
||||
0x70,0x71,0x71,0x72,0x72,0x73,0x73,0x74,
|
||||
0x74,0x75,0x75,0x76,0x76,0x77,0x77,0x78,
|
||||
0x78,0x79,0x79,0x7a,0x7a,0x7b,0x7b,0x7c,
|
||||
0x7c,0x7d,0x7d,0x7e,0x7e,0x7f,0x80,0x80,
|
||||
0x80,0x80,0x81,0x81,0x82,0x82,0x83,0x83,
|
||||
0x84,0x84,0x84,0x85,0x85,0x86,0x86,0x87,
|
||||
0x87,0x88,0x88,0x89,0x89,0x8a,0x8a,0x8b,
|
||||
0x8b,0x8b,0x8c,0x8c,0x8d,0x8d,0x8e,0x8e,
|
||||
0x8e,0x8e,0x8f,0x8f,0x90,0x90,0x91,0x91,
|
||||
0x91,0x92,0x92,0x92,0x93,0x93,0x93,0x94,
|
||||
0x94,0x94,0x94,0x95,0x95,0x95,0x96,0x96,
|
||||
0x96,0x96,0x97,0x97,0x97,0x97,0x98,0x98,
|
||||
0x98,0x98,0x98,0x99,0x99,0x99,0x99,0x99,
|
||||
0x99,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,
|
||||
0x9a,0x9a,0x9a,0x9b,0x9b,0x9b,0x9b,0x9b,
|
||||
0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,0x9b,
|
||||
0x9b,0x9b,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,
|
||||
0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,0x9a,
|
||||
0x99,0x99,0x99,0x99,0x99,0x99,0x98,0x98,
|
||||
0x98,0x98,0x98,0x98,0x97,0x97,0x97,0x97,
|
||||
0x96,0x96,0x96,0x96,0x96,0x95,0x95,0x95,
|
||||
0x94,0x94,0x94,0x94,0x94,0x93,0x93,0x93,
|
||||
0x92,0x92,0x92,0x91,0x91,0x91,0x90,0x90,
|
||||
0x90,0x90,0x8f,0x8f,0x8e,0x8e,0x8e,0x8e,
|
||||
0x8d,0x8d,0x8c,0x8c,0x8c,0x8b,0x8b,0x8b,
|
||||
0x8a,0x8a,0x89,0x89,0x89,0x89,0x88,0x88,
|
||||
0x87,0x87,0x86,0x86,0x86,0x85,0x85,0x85,
|
||||
0x84,0x84,0x84,0x83,0x83,0x82,0x82,0x82,
|
||||
0x81,0x81,0x80,0x80,0x80,0x80,0x80,0x80,
|
||||
0x7f,0x7f,0x7f,0x7e,0x7e,0x7d,0x7d,0x7d,
|
||||
0x7c,0x7c,0x7b,0x7b,0x7b,0x7b,0x7a,0x7a,
|
||||
0x79,0x79,0x79,0x78,0x78,0x77,0x77,0x77,
|
||||
0x77,0x76,0x76,0x75,0x75,0x75,0x75,0x74,
|
||||
0x74,0x74,0x73,0x73,0x73,0x72,0x72,0x72,
|
||||
0x72,0x71,0x71,0x71,0x70,0x70,0x70,0x6f,
|
||||
0x6f,0x6f,0x6f,0x6e,0x6e,0x6e,0x6e,0x6e,
|
||||
0x6d,0x6d,0x6d,0x6d,0x6c,0x6c,0x6c,0x6c,
|
||||
0x6c,0x6b,0x6b,0x6b,0x6b,0x6b,0x6a,0x6a,
|
||||
0x6a,0x6a,0x6a,0x6a,0x6a,0x69,0x69,0x69,
|
||||
0x69,0x69,0x69,0x69,0x69,0x68,0x68,0x68,
|
||||
0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,
|
||||
0x68,0x67,0x67,0x67,0x67,0x67,0x67,0x67,
|
||||
0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,
|
||||
0x67,0x67,0x67,0x67,0x67,0x67,0x67,0x67,
|
||||
0x67,0x67,0x67,0x67,0x68,0x68,0x68,0x68,
|
||||
0x68,0x68,0x68,0x68,0x68,0x68,0x68,0x68,
|
||||
0x68,0x69,0x69,0x69,0x69,0x69,0x69,0x69,
|
||||
0x69,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,
|
||||
0x6b,0x6b,0x6b,0x6b,0x6b,0x6b,0x6c,0x6c,
|
||||
0x6c,0x6c,0x6c,0x6d,0x6d,0x6d,0x6d,0x6d,
|
||||
0x6d,0x6e,0x6e,0x6e,0x6e,0x6e,0x6f,0x6f,
|
||||
0x6f,0x6f,0x6f,0x70,0x70,0x70,0x70,0x71,
|
||||
0x71,0x71,0x71,0x72,0x72,0x72,0x72,0x73,
|
||||
0x73,0x73,0x73,0x73,0x74,0x74,0x74,0x74,
|
||||
0x75,0x75,0x75,0x76,0x76,0x76,0x76,0x77,
|
||||
0x77,0x77,0x77,0x77,0x78,0x78,0x79,0x79,
|
||||
0x79,0x79,0x79,0x7a,0x7a,0x7a,0x7a,0x7b,
|
||||
0x7b,0x7b,0x7c,0x7c,0x7c,0x7c,0x7c,0x7d,
|
||||
0x7d,0x7d,0x7e,0x7e,0x7e,0x7e,0x7f,0x7f,
|
||||
0x7f,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
|
||||
0x80,0x80,0x81,0x81,0x81,0x82,0x82,0x82,
|
||||
0x82,0x82,0x83,0x83,0x83,0x83,0x84,0x84,
|
||||
0x84,0x84,0x84,0x85,0x85,0x85,0x86,0x86,
|
||||
0x86,0x86,0x87,0x87,0x87,0x87,0x87,0x88,
|
||||
0x88,0x88,0x88,0x88,0x89,0x89,0x89,0x89,
|
||||
0x89,0x89,0x8a,0x8a,0x8a,0x8a,0x8b,0x8b,
|
||||
0x8b,0x8b,0x8b,0x8b,0x8b,0x8c,0x8c,0x8c,
|
||||
0x8c,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
|
||||
0x8d,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,
|
||||
0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,
|
||||
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
|
||||
0x90,0x90,0x90,0x91,0x91,0x91,0x91,0x91,
|
||||
0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,
|
||||
0x92,0x91,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,
|
||||
0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,
|
||||
0x91,0x91,0x91,0x91,0x91,0x91,0x91,0x91,
|
||||
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
|
||||
0x90,0x90,0x90,0x90,0x8f,0x8f,0x8f,0x8f,
|
||||
0x8f,0x8f,0x8f,0x8f,0x8f,0x8e,0x8e,0x8e,
|
||||
0x8e,0x8e,0x8e,0x8e,0x8e,0x8e,0x8d,0x8d,
|
||||
0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8c,
|
||||
0x8c,0x8c,0x8c,0x8c,0x8c,0x8c,0x8b,0x8b,
|
||||
0x8b,0x8b,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,
|
||||
0x8a,0x8a,0x8a,0x8a,0x89,0x89,0x89,0x89,
|
||||
0x89,0x89,0x88,0x88,0x88,0x88,0x88,0x88,
|
||||
0x88,0x87,0x87,0x87,0x87,0x87,0x86,0x86,
|
||||
0x86,0x86,0x86,0x86,0x86,0x86,0x85,0x85,
|
||||
0x85,0x85,0x85,0x84,0x84,0x84,0x84,0x84,
|
||||
0x84,0x84,0x84,0x83,0x83,0x83,0x83,0x83,
|
||||
0x83,0x82,0x82,0x82,0x82,0x82,0x81,0x81,
|
||||
0x81,0x81,0x81,0x81,0x81,0x81,0x80,0x80,
|
||||
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
|
||||
0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,
|
||||
0x7f,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7d,
|
||||
0x7e,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,
|
||||
0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,
|
||||
0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,
|
||||
0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7d,
|
||||
0x7d,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,0x7e,
|
||||
0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x7f,0x7f,
|
||||
0x7f,0x7f,0x80,0x80,0x80,0x80,0x80,0x80,
|
||||
};
|
140
reactos/include/internal/bitops.h
Normal file
140
reactos/include/internal/bitops.h
Normal file
@@ -0,0 +1,140 @@
|
||||
#ifndef _I386_BITOPS_H
|
||||
#define _I386_BITOPS_H
|
||||
|
||||
/*
|
||||
* Copyright 1992, Linus Torvalds.
|
||||
*/
|
||||
/*
|
||||
* Reused for the ReactOS kernel by David Welch (1998)
|
||||
*/
|
||||
|
||||
/*
|
||||
* These have to be done with inline assembly: that way the bit-setting
|
||||
* is guaranteed to be atomic. All bit operations return 0 if the bit
|
||||
* was cleared before the operation and != 0 if it was not.
|
||||
*
|
||||
* bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
|
||||
*/
|
||||
|
||||
#ifdef __SMP__
|
||||
#define LOCK_PREFIX "lock ; "
|
||||
#define SMPVOL volatile
|
||||
#else
|
||||
#define LOCK_PREFIX ""
|
||||
#define SMPVOL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some hacks to defeat gcc over-optimizations..
|
||||
*/
|
||||
struct __dummy { unsigned long a[100]; };
|
||||
#define ADDR (*(struct __dummy *) addr)
|
||||
#define CONST_ADDR (*(const struct __dummy *) addr)
|
||||
|
||||
extern __inline__ int set_bit(int nr, SMPVOL void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
__asm__ __volatile__(LOCK_PREFIX
|
||||
"btsl %2,%1\n\tsbbl %0,%0"
|
||||
:"=r" (oldbit),"=m" (ADDR)
|
||||
:"ir" (nr));
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
extern __inline__ int clear_bit(int nr, SMPVOL void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
__asm__ __volatile__(LOCK_PREFIX
|
||||
"btrl %2,%1\n\tsbbl %0,%0"
|
||||
:"=r" (oldbit),"=m" (ADDR)
|
||||
:"ir" (nr));
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
extern __inline__ int change_bit(int nr, SMPVOL void * addr)
|
||||
{
|
||||
int oldbit;
|
||||
|
||||
__asm__ __volatile__(LOCK_PREFIX
|
||||
"btcl %2,%1\n\tsbbl %0,%0"
|
||||
:"=r" (oldbit),"=m" (ADDR)
|
||||
:"ir" (nr));
|
||||
return oldbit;
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine doesn't need to be atomic.
|
||||
*/
|
||||
extern __inline__ int test_bit(int nr, const SMPVOL void * addr)
|
||||
{
|
||||
return ((1UL << (nr & 31)) & (((const unsigned int *) addr)[nr >> 5])) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find-bit routines..
|
||||
*/
|
||||
extern __inline__ int find_first_zero_bit(void * addr, unsigned size)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (!size)
|
||||
return 0;
|
||||
__asm__("cld\n\t"
|
||||
"movl $-1,%%eax\n\t"
|
||||
"xorl %%edx,%%edx\n\t"
|
||||
"repe; scasl\n\t"
|
||||
"je 1f\n\t"
|
||||
"xorl -4(%%edi),%%eax\n\t"
|
||||
"subl $4,%%edi\n\t"
|
||||
"bsfl %%eax,%%edx\n"
|
||||
"1:\tsubl %%ebx,%%edi\n\t"
|
||||
"shll $3,%%edi\n\t"
|
||||
"addl %%edi,%%edx"
|
||||
:"=d" (res)
|
||||
:"c" ((size + 31) >> 5), "D" (addr), "b" (addr)
|
||||
:"ax", "cx", "di");
|
||||
return res;
|
||||
}
|
||||
|
||||
extern __inline__ int find_next_zero_bit (void * addr, int size, int offset)
|
||||
{
|
||||
unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
|
||||
int set = 0, bit = offset & 31, res;
|
||||
|
||||
if (bit) {
|
||||
/*
|
||||
* Look for zero in first byte
|
||||
*/
|
||||
__asm__("bsfl %1,%0\n\t"
|
||||
"jne 1f\n\t"
|
||||
"movl $32, %0\n"
|
||||
"1:"
|
||||
: "=r" (set)
|
||||
: "r" (~(*p >> bit)));
|
||||
if (set < (32 - bit))
|
||||
return set + offset;
|
||||
set = 32 - bit;
|
||||
p++;
|
||||
}
|
||||
/*
|
||||
* No zero yet, search remaining full bytes for a zero
|
||||
*/
|
||||
res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr));
|
||||
return (offset + set + res);
|
||||
}
|
||||
|
||||
/*
|
||||
* ffz = Find First Zero in word. Undefined if no zero exists,
|
||||
* so code should check against ~0UL first..
|
||||
*/
|
||||
extern __inline__ unsigned long ffz(unsigned long word)
|
||||
{
|
||||
__asm__("bsfl %1,%0"
|
||||
:"=r" (word)
|
||||
:"r" (~word));
|
||||
return word;
|
||||
}
|
||||
|
||||
#endif /* _I386_BITOPS_H */
|
71
reactos/include/internal/ctype.h
Normal file
71
reactos/include/internal/ctype.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef _LINUX_CTYPE_H
|
||||
#define _LINUX_CTYPE_H
|
||||
|
||||
|
||||
#ifdef USE_OLD_CTYPE_IMPLEMENTATION
|
||||
|
||||
#define _U 0x01 /* upper */
|
||||
#define _L 0x02 /* lower */
|
||||
#define _D 0x04 /* digit */
|
||||
#define _C 0x08 /* cntrl */
|
||||
#define _P 0x10 /* punct */
|
||||
#define _S 0x20 /* white space (space/lf/tab) */
|
||||
#define _X 0x40 /* hex digit */
|
||||
#define _SP 0x80 /* hard space (0x20) */
|
||||
|
||||
extern unsigned char _ctype[];
|
||||
extern char _ctmp;
|
||||
|
||||
#define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D))
|
||||
#define isalpha(c) ((_ctype+1)[c]&(_U|_L))
|
||||
#define iscntrl(c) ((_ctype+1)[c]&(_C))
|
||||
#define isdigit(c) ((_ctype+1)[c]&(_D))
|
||||
#define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D))
|
||||
#define islower(c) ((_ctype+1)[c]&(_L))
|
||||
#define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP))
|
||||
#define ispunct(c) ((_ctype+1)[c]&(_P))
|
||||
#define isspace(c) ((_ctype+1)[c]&(_S))
|
||||
#define isupper(c) ((_ctype+1)[c]&(_U))
|
||||
#define isxdigit(c) ((_ctype+1)[c]&(_D|_X))
|
||||
|
||||
#define isascii(c) (((unsigned) c)<=0x7f)
|
||||
#define toascii(c) (((unsigned) c)&0x7f)
|
||||
|
||||
#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
|
||||
#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)
|
||||
|
||||
#else
|
||||
|
||||
#define upalpha ('A' - 'a')
|
||||
|
||||
extern inline char toupper(char c)
|
||||
{
|
||||
if ((c>='a') && (c<='z')) return (c+upalpha);
|
||||
return(c);
|
||||
}
|
||||
|
||||
extern inline int islower(char c)
|
||||
{
|
||||
if ((c>='a') && (c<='z')) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern inline int isdigit(char c)
|
||||
{
|
||||
if ((c>='0') && (c<='9')) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern inline int isxdigit(char c)
|
||||
{
|
||||
if (((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z')))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
72
reactos/include/internal/debug.h
Normal file
72
reactos/include/internal/debug.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/debug.h
|
||||
* PURPOSE: Useful debugging macros
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 28/05/98: Created
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Define NDEBUG before including this header to disable debugging
|
||||
* macros
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_DEBUG
|
||||
#define __INTERNAL_DEBUG
|
||||
|
||||
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is umimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define DPRINT(fmt,args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(fmt,args); } while(0);
|
||||
//#define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); (*((unsigned int *)0))=1; for (;;); }
|
||||
#define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); for (;;); }
|
||||
#define CHECKPOINT DbgPrint("%s:%d\n",__FILE__,__LINE__)
|
||||
#else
|
||||
#define DPRINT(fmt,args...)
|
||||
#define assert(x)
|
||||
#define CHECKPOINT
|
||||
#endif /* NDEBUG */
|
||||
|
||||
/*
|
||||
* FUNCTION: Assert a maximum value for the current irql
|
||||
* ARGUMENTS:
|
||||
* x = Maximum irql
|
||||
*/
|
||||
#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
|
||||
#define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
|
||||
|
||||
#define HBP_EXECUTE (0)
|
||||
#define HBP_WRITE (1)
|
||||
#define HBP_READWRITE (3)
|
||||
|
||||
#define HBP_BYTE (0)
|
||||
#define HBP_WORD (1)
|
||||
#define HBP_DWORD (3)
|
||||
|
||||
/*
|
||||
* FUNCTION: Sets a hardware breakpoint
|
||||
* ARGUMENTS:
|
||||
* i = breakpoint to set (0 to 3)
|
||||
* addr = linear address to break on
|
||||
* type = Type of access to break on
|
||||
* len = length of the variable to watch
|
||||
* NOTES:
|
||||
* The variable to watch must be aligned to its length (i.e. a dword
|
||||
* breakpoint must be aligned to a dword boundary)
|
||||
*
|
||||
* A fatal exception will be generated on the access to the variable.
|
||||
* It is (at the moment) only really useful for catching undefined
|
||||
* pointers if you know the variable effected but not the buggy
|
||||
* routine.
|
||||
*
|
||||
* FIXME: Extend to call out to kernel debugger on breakpoint
|
||||
* Add support for I/O breakpoints
|
||||
* REFERENCES: See the i386 programmer manual for more details
|
||||
*/
|
||||
void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
|
||||
unsigned int len);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_DEBUG */
|
267
reactos/include/internal/dma.h
Normal file
267
reactos/include/internal/dma.h
Normal file
@@ -0,0 +1,267 @@
|
||||
/* $Id: dma.h,v 1.1.1.2 1998/08/25 04:27:32 rex Exp $
|
||||
* linux/include/asm/dma.h: Defines for using and allocating dma channels.
|
||||
* Written by Hennus Bergman, 1992.
|
||||
* High DMA channel support & info by Hannu Savolainen
|
||||
* and John Boyd, Nov. 1992.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_DMA_H
|
||||
#define _ASM_DMA_H
|
||||
|
||||
#include <internal/hal/io.h> /* need byte IO */
|
||||
|
||||
|
||||
#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER
|
||||
#define dma_outb outb_p
|
||||
#else
|
||||
#define dma_outb outb
|
||||
#endif
|
||||
|
||||
#define dma_inb inb
|
||||
|
||||
/*
|
||||
* NOTES about DMA transfers:
|
||||
*
|
||||
* controller 1: channels 0-3, byte operations, ports 00-1F
|
||||
* controller 2: channels 4-7, word operations, ports C0-DF
|
||||
*
|
||||
* - ALL registers are 8 bits only, regardless of transfer size
|
||||
* - channel 4 is not used - cascades 1 into 2.
|
||||
* - channels 0-3 are byte - addresses/counts are for physical bytes
|
||||
* - channels 5-7 are word - addresses/counts are for physical words
|
||||
* - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries
|
||||
* - transfer count loaded to registers is 1 less than actual count
|
||||
* - controller 2 offsets are all even (2x offsets for controller 1)
|
||||
* - page registers for 5-7 don't use data bit 0, represent 128K pages
|
||||
* - page registers for 0-3 use bit 0, represent 64K pages
|
||||
*
|
||||
* DMA transfers are limited to the lower 16MB of _physical_ memory.
|
||||
* Note that addresses loaded into registers must be _physical_ addresses,
|
||||
* not logical addresses (which may differ if paging is active).
|
||||
*
|
||||
* Address mapping for channels 0-3:
|
||||
*
|
||||
* A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses)
|
||||
* | ... | | ... | | ... |
|
||||
* | ... | | ... | | ... |
|
||||
* | ... | | ... | | ... |
|
||||
* P7 ... P0 A7 ... A0 A7 ... A0
|
||||
* | Page | Addr MSB | Addr LSB | (DMA registers)
|
||||
*
|
||||
* Address mapping for channels 5-7:
|
||||
*
|
||||
* A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses)
|
||||
* | ... | \ \ ... \ \ \ ... \ \
|
||||
* | ... | \ \ ... \ \ \ ... \ (not used)
|
||||
* | ... | \ \ ... \ \ \ ... \
|
||||
* P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0
|
||||
* | Page | Addr MSB | Addr LSB | (DMA registers)
|
||||
*
|
||||
* Again, channels 5-7 transfer _physical_ words (16 bits), so addresses
|
||||
* and counts _must_ be word-aligned (the lowest address bit is _ignored_ at
|
||||
* the hardware level, so odd-byte transfers aren't possible).
|
||||
*
|
||||
* Transfer count (_not # bytes_) is limited to 64K, represented as actual
|
||||
* count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more,
|
||||
* and up to 128K bytes may be transferred on channels 5-7 in one operation.
|
||||
*
|
||||
*/
|
||||
|
||||
#define MAX_DMA_CHANNELS 8
|
||||
|
||||
/* The maximum address that we can perform a DMA transfer to on this platform */
|
||||
#define MAX_DMA_ADDRESS 0x1000000
|
||||
|
||||
/* 8237 DMA controllers */
|
||||
#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
|
||||
#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */
|
||||
|
||||
/* DMA controller registers */
|
||||
#define DMA1_CMD_REG 0x08 /* command register (w) */
|
||||
#define DMA1_STAT_REG 0x08 /* status register (r) */
|
||||
#define DMA1_REQ_REG 0x09 /* request register (w) */
|
||||
#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
|
||||
#define DMA1_MODE_REG 0x0B /* mode register (w) */
|
||||
#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
|
||||
#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
|
||||
#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
|
||||
#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
|
||||
#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
|
||||
|
||||
#define DMA2_CMD_REG 0xD0 /* command register (w) */
|
||||
#define DMA2_STAT_REG 0xD0 /* status register (r) */
|
||||
#define DMA2_REQ_REG 0xD2 /* request register (w) */
|
||||
#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
|
||||
#define DMA2_MODE_REG 0xD6 /* mode register (w) */
|
||||
#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
|
||||
#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
|
||||
#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
|
||||
#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
|
||||
#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
|
||||
|
||||
#define DMA_ADDR_0 0x00 /* DMA address registers */
|
||||
#define DMA_ADDR_1 0x02
|
||||
#define DMA_ADDR_2 0x04
|
||||
#define DMA_ADDR_3 0x06
|
||||
#define DMA_ADDR_4 0xC0
|
||||
#define DMA_ADDR_5 0xC4
|
||||
#define DMA_ADDR_6 0xC8
|
||||
#define DMA_ADDR_7 0xCC
|
||||
|
||||
#define DMA_CNT_0 0x01 /* DMA count registers */
|
||||
#define DMA_CNT_1 0x03
|
||||
#define DMA_CNT_2 0x05
|
||||
#define DMA_CNT_3 0x07
|
||||
#define DMA_CNT_4 0xC2
|
||||
#define DMA_CNT_5 0xC6
|
||||
#define DMA_CNT_6 0xCA
|
||||
#define DMA_CNT_7 0xCE
|
||||
|
||||
#define DMA_PAGE_0 0x87 /* DMA page registers */
|
||||
#define DMA_PAGE_1 0x83
|
||||
#define DMA_PAGE_2 0x81
|
||||
#define DMA_PAGE_3 0x82
|
||||
#define DMA_PAGE_5 0x8B
|
||||
#define DMA_PAGE_6 0x89
|
||||
#define DMA_PAGE_7 0x8A
|
||||
|
||||
#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
|
||||
#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
|
||||
#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
|
||||
|
||||
/* enable/disable a specific DMA channel */
|
||||
static __inline__ void enable_dma(unsigned int dmanr)
|
||||
{
|
||||
if (dmanr<=3)
|
||||
dma_outb(DMA1_MASK_REG, dmanr);
|
||||
else
|
||||
dma_outb(DMA2_MASK_REG, dmanr & 3);
|
||||
}
|
||||
|
||||
static __inline__ void disable_dma(unsigned int dmanr)
|
||||
{
|
||||
if (dmanr<=3)
|
||||
dma_outb(DMA1_MASK_REG, dmanr | 4);
|
||||
else
|
||||
dma_outb(DMA2_MASK_REG, (dmanr & 3) | 4);
|
||||
}
|
||||
|
||||
/* Clear the 'DMA Pointer Flip Flop'.
|
||||
* Write 0 for LSB/MSB, 1 for MSB/LSB access.
|
||||
* Use this once to initialize the FF to a known state.
|
||||
* After that, keep track of it. :-)
|
||||
* --- In order to do that, the DMA routines below should ---
|
||||
* --- only be used while interrupts are disabled! ---
|
||||
*/
|
||||
static __inline__ void clear_dma_ff(unsigned int dmanr)
|
||||
{
|
||||
if (dmanr<=3)
|
||||
dma_outb(DMA1_CLEAR_FF_REG, 0);
|
||||
else
|
||||
dma_outb(DMA2_CLEAR_FF_REG, 0);
|
||||
}
|
||||
|
||||
/* set mode (above) for a specific DMA channel */
|
||||
static __inline__ void set_dma_mode(unsigned int dmanr, char mode)
|
||||
{
|
||||
if (dmanr<=3)
|
||||
dma_outb(DMA1_MODE_REG, mode | dmanr);
|
||||
else
|
||||
dma_outb(DMA2_MODE_REG, mode | (dmanr&3));
|
||||
}
|
||||
|
||||
/* Set only the page register bits of the transfer address.
|
||||
* This is used for successive transfers when we know the contents of
|
||||
* the lower 16 bits of the DMA current address register, but a 64k boundary
|
||||
* may have been crossed.
|
||||
*/
|
||||
static __inline__ void set_dma_page(unsigned int dmanr, char pagenr)
|
||||
{
|
||||
switch(dmanr) {
|
||||
case 0:
|
||||
dma_outb(DMA_PAGE_0, pagenr);
|
||||
break;
|
||||
case 1:
|
||||
dma_outb(DMA_PAGE_1, pagenr);
|
||||
break;
|
||||
case 2:
|
||||
dma_outb(DMA_PAGE_2, pagenr);
|
||||
break;
|
||||
case 3:
|
||||
dma_outb(DMA_PAGE_3, pagenr);
|
||||
break;
|
||||
case 5:
|
||||
dma_outb(DMA_PAGE_5, pagenr & 0xfe);
|
||||
break;
|
||||
case 6:
|
||||
dma_outb(DMA_PAGE_6, pagenr & 0xfe);
|
||||
break;
|
||||
case 7:
|
||||
dma_outb(DMA_PAGE_7, pagenr & 0xfe);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set transfer address & page bits for specific DMA channel.
|
||||
* Assumes dma flipflop is clear.
|
||||
*/
|
||||
static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a)
|
||||
{
|
||||
set_dma_page(dmanr, a>>16);
|
||||
if (dmanr <= 3) {
|
||||
dma_outb(((dmanr&3)<<1) + IO_DMA1_BASE, a & 0xff);
|
||||
dma_outb(((dmanr&3)<<1) + IO_DMA1_BASE, (a>>8) & 0xff );
|
||||
} else {
|
||||
dma_outb( ((dmanr&3)<<2) + IO_DMA2_BASE ,(a>>1) & 0xff );
|
||||
dma_outb( ((dmanr&3)<<2) + IO_DMA2_BASE,(a>>9) & 0xff );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for
|
||||
* a specific DMA channel.
|
||||
* You must ensure the parameters are valid.
|
||||
* NOTE: from a manual: "the number of transfers is one more
|
||||
* than the initial word count"! This is taken into account.
|
||||
* Assumes dma flip-flop is clear.
|
||||
* NOTE 2: "count" represents _bytes_ and must be even for channels 5-7.
|
||||
*/
|
||||
static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count)
|
||||
{
|
||||
count--;
|
||||
if (dmanr <= 3) {
|
||||
dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
|
||||
dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE );
|
||||
} else {
|
||||
dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
|
||||
dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get DMA residue count. After a DMA transfer, this
|
||||
* should return zero. Reading this while a DMA transfer is
|
||||
* still in progress will return unpredictable results.
|
||||
* If called before the channel has been used, it may return 1.
|
||||
* Otherwise, it returns the number of _bytes_ left to transfer.
|
||||
*
|
||||
* Assumes DMA flip-flop is clear.
|
||||
*/
|
||||
static __inline__ int get_dma_residue(unsigned int dmanr)
|
||||
{
|
||||
unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
|
||||
: ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;
|
||||
|
||||
/* using short to get 16-bit wrap around */
|
||||
unsigned short count;
|
||||
|
||||
count = 1 + dma_inb(io_port);
|
||||
count += dma_inb(io_port) << 8;
|
||||
|
||||
return (dmanr<=3)? count : (count<<1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* _ASM_DMA_H */
|
10
reactos/include/internal/hal.h
Normal file
10
reactos/include/internal/hal.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __INCLUDE_INTERNAL_HAL_H
|
||||
#define __INCLUDE_INTERNAL_HAL_H
|
||||
|
||||
#ifdef i386
|
||||
#include <internal/i386/hal.h>
|
||||
#else
|
||||
#error "Unknown processor"
|
||||
#endif
|
||||
|
||||
#endif
|
117
reactos/include/internal/hal/ddk.h
Normal file
117
reactos/include/internal/hal/ddk.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/hal/ddk.h
|
||||
* PURPOSE: HAL provided defintions for device drivers
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* REVISION HISTORY:
|
||||
* 23/06/98: Taken from linux system.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __INCLUDE_INTERNAL_HAL_DDK_H
|
||||
#define __INCLUDE_INTERNAL_HAL_DDK_H
|
||||
|
||||
enum
|
||||
{
|
||||
DEVICE_DESCRIPTION_VERSION,
|
||||
DEVICE_DESCRIPTION_VERSION1,
|
||||
};
|
||||
|
||||
typedef ULONG DMA_WIDTH;
|
||||
typedef ULONG DMA_SPEED;
|
||||
typedef ULONG BUS_DATA_TYPE;
|
||||
|
||||
/*
|
||||
* PURPOSE: Types for HalGetBusData
|
||||
*/
|
||||
enum
|
||||
{
|
||||
Cmos,
|
||||
EisaConfiguration,
|
||||
Pos,
|
||||
PCIConfiguration,
|
||||
MaximumBusDataType,
|
||||
};
|
||||
|
||||
typedef struct _DEVICE_DESCRIPTION
|
||||
{
|
||||
ULONG Version;
|
||||
BOOLEAN Master;
|
||||
BOOLEAN ScatterGather;
|
||||
BOOLEAN DemandMode;
|
||||
BOOLEAN AutoInitialize;
|
||||
BOOLEAN Dma32BitAddress;
|
||||
BOOLEAN IgnoreCount;
|
||||
BOOLEAN Reserved1;
|
||||
BOOLEAN Reserved2;
|
||||
ULONG BusNumber;
|
||||
ULONG DmaChannel;
|
||||
INTERFACE_TYPE InterfaceType;
|
||||
DMA_WIDTH DmaWidth;
|
||||
DMA_SPEED DmaSpeed;
|
||||
ULONG MaximumLength;
|
||||
ULONG DmaPort;
|
||||
} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
|
||||
|
||||
PVOID HalAllocateCommonBuffer(PADAPTER_OBJECT AdapterObject,
|
||||
ULONG Length,
|
||||
PPHYSICAL_ADDRESS LogicalAddress,
|
||||
BOOLEAN CacheEnabled);
|
||||
NTSTATUS HalAssignSlotResources(PUNICODE_STRING RegistryPath,
|
||||
PUNICODE_STRING DriverClassName,
|
||||
PDRIVER_OBJECT DriverObject,
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
INTERFACE_TYPE BusType,
|
||||
ULONG BusNumber,
|
||||
ULONG SlotNumber,
|
||||
PCM_RESOURCE_LIST* AllocatedResources);
|
||||
VOID HalExamineMBR(PDEVICE_OBJECT DeviceObject,
|
||||
ULONG SectorSize,
|
||||
ULONG MBRTypeIdentifier,
|
||||
PVOID Buffer);
|
||||
VOID HalFreeCommonBuffer(PADAPTER_OBJECT AdapterObject,
|
||||
ULONG Length,
|
||||
PHYSICAL_ADDRESS LogicalAddress,
|
||||
PVOID VirtualAddress,
|
||||
BOOLEAN CacheEnabled);
|
||||
PADAPTER_OBJECT HalGetAdapter(PDEVICE_DESCRIPTION DeviceDescription,
|
||||
PULONG NumberOfMapRegisters);
|
||||
ULONG HalGetBusData(BUS_DATA_TYPE BusDataType,
|
||||
ULONG BusNumber,
|
||||
ULONG SlotNumber,
|
||||
PVOID Buffer,
|
||||
ULONG Length);
|
||||
ULONG HalGetBusDataByOffset(BUS_DATA_TYPE BusDataType,
|
||||
ULONG BusNumber,
|
||||
ULONG SlotNumber,
|
||||
PVOID Buffer,
|
||||
ULONG Offset,
|
||||
ULONG Length);
|
||||
ULONG HalGetDmaAlignmentRequirement(VOID);
|
||||
ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType,
|
||||
ULONG BusNumber,
|
||||
ULONG BusInterruptLevel,
|
||||
ULONG BusInterruptVector,
|
||||
PKIRQL Irql,
|
||||
PKAFFINITY Affinity);
|
||||
VOID HalQuerySystemInformation(VOID);
|
||||
ULONG HalReadDmaCounter(PADAPTER_OBJECT AdapterObject);
|
||||
ULONG HalSetBusData(BUS_DATA_TYPE BusDataType,
|
||||
ULONG BusNumber,
|
||||
ULONG SlotNumber,
|
||||
PVOID Buffer,
|
||||
ULONG Length);
|
||||
ULONG HalSetBusDataByOffset(BUS_DATA_TYPE BusDataType,
|
||||
ULONG BusNumber,
|
||||
ULONG SlotNumber,
|
||||
PVOID Buffer,
|
||||
ULONG Offset,
|
||||
ULONG Length);
|
||||
BOOLEAN HalTranslateBusAddress(INTERFACE_TYPE InterfaceType,
|
||||
ULONG BusNumber,
|
||||
PHYSICAL_ADDRESS BusAddress,
|
||||
PULONG AddressSpace,
|
||||
PPHYSICAL_ADDRESS TranslatedAddress);
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_HAL_DDK_H */
|
167
reactos/include/internal/hal/io.h
Normal file
167
reactos/include/internal/hal/io.h
Normal file
@@ -0,0 +1,167 @@
|
||||
#ifndef _ASM_IO_H
|
||||
#define _ASM_IO_H
|
||||
|
||||
/*
|
||||
* This file contains the definitions for the x86 IO instructions
|
||||
* inb/inw/inl/outb/outw/outl and the "string versions" of the same
|
||||
* (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing"
|
||||
* versions of the single-IO instructions (inb_p/inw_p/..).
|
||||
*
|
||||
* This file is not meant to be obfuscating: it's just complicated
|
||||
* to (a) handle it all in a way that makes gcc able to optimize it
|
||||
* as well as possible and (b) trying to avoid writing the same thing
|
||||
* over and over again with slight variations and possibly making a
|
||||
* mistake somewhere.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Thanks to James van Artsdalen for a better timing-fix than
|
||||
* the two short jumps: using outb's to a nonexistent port seems
|
||||
* to guarantee better timings even on fast machines.
|
||||
*
|
||||
* On the other hand, I'd like to be sure of a non-existent port:
|
||||
* I feel a bit unsafe about using 0x80 (should be safe, though)
|
||||
*
|
||||
* Linus
|
||||
*/
|
||||
|
||||
#ifdef SLOW_IO_BY_JUMPING
|
||||
#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
|
||||
#else
|
||||
#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
|
||||
#endif
|
||||
|
||||
#ifdef REALLY_SLOW_IO
|
||||
#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
|
||||
#else
|
||||
#define SLOW_DOWN_IO __SLOW_DOWN_IO
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Talk about misusing macros..
|
||||
*/
|
||||
|
||||
#define __OUT1(s,x) \
|
||||
extern inline void __out##s(unsigned x value, unsigned short port) {
|
||||
|
||||
#define __OUT2(s,s1,s2) \
|
||||
__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
|
||||
|
||||
#define __OUT(s,s1,x) \
|
||||
__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
|
||||
__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
|
||||
__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
|
||||
__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
|
||||
|
||||
#define __IN1(s) \
|
||||
extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v;
|
||||
|
||||
#define __IN2(s,s1,s2) \
|
||||
__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
|
||||
|
||||
#define __IN(s,s1,i...) \
|
||||
__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
|
||||
__IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
|
||||
__IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
|
||||
__IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
|
||||
|
||||
#define __INS(s) \
|
||||
extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
|
||||
{ __asm__ __volatile__ ("cld ; rep ; ins" #s \
|
||||
: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
|
||||
|
||||
#define __OUTS(s) \
|
||||
extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
|
||||
{ __asm__ __volatile__ ("cld ; rep ; outs" #s \
|
||||
: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
|
||||
|
||||
#define RETURN_TYPE unsigned char
|
||||
/* __IN(b,"b","0" (0)) */
|
||||
__IN(b,"")
|
||||
#undef RETURN_TYPE
|
||||
#define RETURN_TYPE unsigned short
|
||||
/* __IN(w,"w","0" (0)) */
|
||||
__IN(w,"")
|
||||
#undef RETURN_TYPE
|
||||
#define RETURN_TYPE unsigned int
|
||||
__IN(l,"")
|
||||
#undef RETURN_TYPE
|
||||
|
||||
__OUT(b,"b",char)
|
||||
__OUT(w,"w",short)
|
||||
__OUT(l,,int)
|
||||
|
||||
__INS(b)
|
||||
__INS(w)
|
||||
__INS(l)
|
||||
|
||||
__OUTS(b)
|
||||
__OUTS(w)
|
||||
__OUTS(l)
|
||||
|
||||
/*
|
||||
* Note that due to the way __builtin_constant_p() works, you
|
||||
* - can't use it inside a inline function (it will never be true)
|
||||
* - you don't have to worry about side effects within the __builtin..
|
||||
*/
|
||||
#define outb(port,val) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__outbc((val),(port)) : \
|
||||
__outb((val),(port)))
|
||||
|
||||
#define inb(port) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__inbc(port) : \
|
||||
__inb(port))
|
||||
|
||||
#define outb_p(port,val) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__outbc_p((val),(port)) : \
|
||||
__outb_p((val),(port)))
|
||||
|
||||
#define inb_p(port) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__inbc_p(port) : \
|
||||
__inb_p(port))
|
||||
|
||||
#define outw(port,val) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__outwc((val),(port)) : \
|
||||
__outw((val),(port)))
|
||||
|
||||
#define inw(port) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__inwc(port) : \
|
||||
__inw(port))
|
||||
|
||||
#define outw_p(port,val) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__outwc_p((val),(port)) : \
|
||||
__outw_p((val),(port)))
|
||||
|
||||
#define inw_p(port) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__inwc_p(port) : \
|
||||
__inw_p(port))
|
||||
|
||||
#define outl(port,val) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__outlc((val),(port)) : \
|
||||
__outl((val),(port)))
|
||||
|
||||
#define inl(port) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__inlc(port) : \
|
||||
__inl(port))
|
||||
|
||||
#define outl_p(port,val) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__outlc_p((val),(port)) : \
|
||||
__outl_p((val),(port)))
|
||||
|
||||
#define inl_p(port) \
|
||||
((__builtin_constant_p((port)) && (port) < 256) ? \
|
||||
__inlc_p(port) : \
|
||||
__inl_p(port))
|
||||
|
||||
#endif
|
7
reactos/include/internal/hal/irq.h
Normal file
7
reactos/include/internal/hal/irq.h
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* PURPOSE: The number of device specific level levels
|
||||
*/
|
||||
#define NR_DEVICE_SPECIFIC_LEVELS (16)
|
||||
|
||||
|
||||
|
82
reactos/include/internal/hal/page.h
Normal file
82
reactos/include/internal/hal/page.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Lowlevel memory managment definitions
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_HAL_PAGE_H
|
||||
#define __INTERNAL_HAL_PAGE_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define PAGESIZE (4096)
|
||||
|
||||
/*
|
||||
* Sets a page entry
|
||||
* vaddr: The virtual address to set the page entry for
|
||||
* attributes: The access attributes to give the page
|
||||
* physaddr: The physical address the page should map to
|
||||
*/
|
||||
void set_page(unsigned int vaddr, unsigned int attributes,
|
||||
unsigned int physaddr);
|
||||
|
||||
#define PAGE_ROUND_UP(x) ( (((ULONG)x)%PAGESIZE) ? ((((ULONG)x)&(~0xfff))+0x1000) : ((ULONG)x) )
|
||||
#define PAGE_ROUND_DOWN(x) (((ULONG)x)&(~0xfff))
|
||||
|
||||
/*
|
||||
* Page access attributes (or these together)
|
||||
*/
|
||||
#define PA_READ (1<<0)
|
||||
#define PA_WRITE ((1<<0)+(1<<1))
|
||||
#define PA_EXECUTE PA_READ
|
||||
#define PA_PCD (1<<4)
|
||||
#define PA_PWT (1<<3)
|
||||
|
||||
/*
|
||||
* Page attributes
|
||||
*/
|
||||
#define PA_USER (1<<2)
|
||||
#define PA_SYSTEM (0)
|
||||
|
||||
#define KERNEL_BASE (0xc0000000)
|
||||
#define IDMAP_BASE (0xd0000000)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Return a linear address which can be used to access the physical memory
|
||||
* starting at x
|
||||
*/
|
||||
extern inline unsigned int physical_to_linear(unsigned int x)
|
||||
{
|
||||
return(x+IDMAP_BASE);
|
||||
}
|
||||
|
||||
extern inline unsigned int linear_to_physical(unsigned int x)
|
||||
{
|
||||
return(x-IDMAP_BASE);
|
||||
}
|
||||
|
||||
#define FLUSH_TLB __asm__("movl %cr3,%eax\n\tmovl %eax,%cr3\n\t")
|
||||
|
||||
extern inline unsigned int* get_page_directory(void)
|
||||
{
|
||||
unsigned int page_dir=0;
|
||||
__asm__("movl %%cr3,%0\n\t"
|
||||
: "=r" (page_dir));
|
||||
return((unsigned int *)physical_to_linear(page_dir));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Amount of memory that can be mapped by a page table
|
||||
*/
|
||||
#define PAGE_TABLE_SIZE (4*1024*1024)
|
||||
|
||||
#define PAGE_MASK(x) (x&(~0xfff))
|
||||
#define VADDR_TO_PT_OFFSET(x) (((x/1024)%4096))
|
||||
#define VADDR_TO_PD_OFFSET(x) ((x)/(4*1024*1024))
|
||||
|
||||
unsigned int* get_page_entry(unsigned int vaddr);
|
||||
|
||||
BOOL is_page_present(unsigned int vaddr);
|
||||
|
||||
#endif /* __INTERNAL_HAL_PAGE_H */
|
343
reactos/include/internal/hal/segment.h
Normal file
343
reactos/include/internal/hal/segment.h
Normal file
@@ -0,0 +1,343 @@
|
||||
#ifndef _ASM_SEGMENT_H
|
||||
#define _ASM_SEGMENT_H
|
||||
|
||||
#define ZERO_DS 0x18
|
||||
#define KERNEL_CS 0x20
|
||||
#define KERNEL_DS 0x28
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/*
|
||||
* Uh, these should become the main single-value transfer routines..
|
||||
* They automatically use the right size if we just have the right
|
||||
* pointer type..
|
||||
*/
|
||||
#define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr)))
|
||||
#define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr))))
|
||||
|
||||
/*
|
||||
* This is a silly but good way to make sure that
|
||||
* the __put_user function is indeed always optimized,
|
||||
* and that we use the correct sizes..
|
||||
*/
|
||||
extern int bad_user_access_length(void);
|
||||
|
||||
/*
|
||||
* dummy pointer type structure.. gcc won't try to do something strange
|
||||
* this way..
|
||||
*/
|
||||
struct __segment_dummy { unsigned long a[100]; };
|
||||
#define __sd(x) ((struct __segment_dummy *) (x))
|
||||
#define __const_sd(x) ((const struct __segment_dummy *) (x))
|
||||
|
||||
static inline void __put_user(unsigned long x, void * y, int size)
|
||||
{
|
||||
switch (size) {
|
||||
case 1:
|
||||
__asm__ ("movb %b1,%%fs:%0"
|
||||
:"=m" (*__sd(y))
|
||||
:"iq" ((unsigned char) x), "m" (*__sd(y)));
|
||||
break;
|
||||
case 2:
|
||||
__asm__ ("movw %w1,%%fs:%0"
|
||||
:"=m" (*__sd(y))
|
||||
:"ir" ((unsigned short) x), "m" (*__sd(y)));
|
||||
break;
|
||||
case 4:
|
||||
__asm__ ("movl %1,%%fs:%0"
|
||||
:"=m" (*__sd(y))
|
||||
:"ir" (x), "m" (*__sd(y)));
|
||||
break;
|
||||
default:
|
||||
bad_user_access_length();
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned long __get_user(const void * y, int size)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
__asm__ ("movb %%fs:%1,%b0"
|
||||
:"=q" (result)
|
||||
:"m" (*__const_sd(y)));
|
||||
return (unsigned char) result;
|
||||
case 2:
|
||||
__asm__ ("movw %%fs:%1,%w0"
|
||||
:"=r" (result)
|
||||
:"m" (*__const_sd(y)));
|
||||
return (unsigned short) result;
|
||||
case 4:
|
||||
__asm__ ("movl %%fs:%1,%0"
|
||||
:"=r" (result)
|
||||
:"m" (*__const_sd(y)));
|
||||
return result;
|
||||
default:
|
||||
return bad_user_access_length();
|
||||
}
|
||||
}
|
||||
|
||||
static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n)
|
||||
{
|
||||
__asm__ volatile
|
||||
(" cld
|
||||
push %%es
|
||||
push %%fs
|
||||
cmpl $3,%0
|
||||
pop %%es
|
||||
jbe 1f
|
||||
movl %%edi,%%ecx
|
||||
negl %%ecx
|
||||
andl $3,%%ecx
|
||||
subl %%ecx,%0
|
||||
rep; movsb
|
||||
movl %0,%%ecx
|
||||
shrl $2,%%ecx
|
||||
rep; movsl
|
||||
andl $3,%0
|
||||
1: movl %0,%%ecx
|
||||
rep; movsb
|
||||
pop %%es"
|
||||
:"=abd" (n)
|
||||
:"0" (n),"D" ((long) to),"S" ((long) from)
|
||||
:"cx","di","si");
|
||||
}
|
||||
|
||||
static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n)
|
||||
{
|
||||
switch (n) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
__put_user(*(const char *) from, (char *) to, 1);
|
||||
return;
|
||||
case 2:
|
||||
__put_user(*(const short *) from, (short *) to, 2);
|
||||
return;
|
||||
case 3:
|
||||
__put_user(*(const short *) from, (short *) to, 2);
|
||||
__put_user(*(2+(const char *) from), 2+(char *) to, 1);
|
||||
return;
|
||||
case 4:
|
||||
__put_user(*(const int *) from, (int *) to, 4);
|
||||
return;
|
||||
case 8:
|
||||
__put_user(*(const int *) from, (int *) to, 4);
|
||||
__put_user(*(1+(const int *) from), 1+(int *) to, 4);
|
||||
return;
|
||||
case 12:
|
||||
__put_user(*(const int *) from, (int *) to, 4);
|
||||
__put_user(*(1+(const int *) from), 1+(int *) to, 4);
|
||||
__put_user(*(2+(const int *) from), 2+(int *) to, 4);
|
||||
return;
|
||||
case 16:
|
||||
__put_user(*(const int *) from, (int *) to, 4);
|
||||
__put_user(*(1+(const int *) from), 1+(int *) to, 4);
|
||||
__put_user(*(2+(const int *) from), 2+(int *) to, 4);
|
||||
__put_user(*(3+(const int *) from), 3+(int *) to, 4);
|
||||
return;
|
||||
}
|
||||
#define COMMON(x) \
|
||||
__asm__("cld\n\t" \
|
||||
"push %%es\n\t" \
|
||||
"push %%fs\n\t" \
|
||||
"pop %%es\n\t" \
|
||||
"rep ; movsl\n\t" \
|
||||
x \
|
||||
"pop %%es" \
|
||||
: /* no outputs */ \
|
||||
:"c" (n/4),"D" ((long) to),"S" ((long) from) \
|
||||
:"cx","di","si")
|
||||
|
||||
switch (n % 4) {
|
||||
case 0:
|
||||
COMMON("");
|
||||
return;
|
||||
case 1:
|
||||
COMMON("movsb\n\t");
|
||||
return;
|
||||
case 2:
|
||||
COMMON("movsw\n\t");
|
||||
return;
|
||||
case 3:
|
||||
COMMON("movsw\n\tmovsb\n\t");
|
||||
return;
|
||||
}
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n)
|
||||
{
|
||||
__asm__ volatile
|
||||
(" cld
|
||||
cmpl $3,%0
|
||||
jbe 1f
|
||||
movl %%edi,%%ecx
|
||||
negl %%ecx
|
||||
andl $3,%%ecx
|
||||
subl %%ecx,%0
|
||||
fs; rep; movsb
|
||||
movl %0,%%ecx
|
||||
shrl $2,%%ecx
|
||||
fs; rep; movsl
|
||||
andl $3,%0
|
||||
1: movl %0,%%ecx
|
||||
fs; rep; movsb"
|
||||
:"=abd" (n)
|
||||
:"0" (n),"D" ((long) to),"S" ((long) from)
|
||||
:"cx","di","si", "memory");
|
||||
}
|
||||
|
||||
static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n)
|
||||
{
|
||||
switch (n) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
*(char *)to = __get_user((const char *) from, 1);
|
||||
return;
|
||||
case 2:
|
||||
*(short *)to = __get_user((const short *) from, 2);
|
||||
return;
|
||||
case 3:
|
||||
*(short *) to = __get_user((const short *) from, 2);
|
||||
*((char *) to + 2) = __get_user(2+(const char *) from, 1);
|
||||
return;
|
||||
case 4:
|
||||
*(int *) to = __get_user((const int *) from, 4);
|
||||
return;
|
||||
case 8:
|
||||
*(int *) to = __get_user((const int *) from, 4);
|
||||
*(1+(int *) to) = __get_user(1+(const int *) from, 4);
|
||||
return;
|
||||
case 12:
|
||||
*(int *) to = __get_user((const int *) from, 4);
|
||||
*(1+(int *) to) = __get_user(1+(const int *) from, 4);
|
||||
*(2+(int *) to) = __get_user(2+(const int *) from, 4);
|
||||
return;
|
||||
case 16:
|
||||
*(int *) to = __get_user((const int *) from, 4);
|
||||
*(1+(int *) to) = __get_user(1+(const int *) from, 4);
|
||||
*(2+(int *) to) = __get_user(2+(const int *) from, 4);
|
||||
*(3+(int *) to) = __get_user(3+(const int *) from, 4);
|
||||
return;
|
||||
}
|
||||
#define COMMON(x) \
|
||||
__asm__("cld\n\t" \
|
||||
"rep ; fs ; movsl\n\t" \
|
||||
x \
|
||||
: /* no outputs */ \
|
||||
:"c" (n/4),"D" ((long) to),"S" ((long) from) \
|
||||
:"cx","di","si","memory")
|
||||
|
||||
switch (n % 4) {
|
||||
case 0:
|
||||
COMMON("");
|
||||
return;
|
||||
case 1:
|
||||
COMMON("fs ; movsb");
|
||||
return;
|
||||
case 2:
|
||||
COMMON("fs ; movsw");
|
||||
return;
|
||||
case 3:
|
||||
COMMON("fs ; movsw\n\tfs ; movsb");
|
||||
return;
|
||||
}
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
#define memcpy_fromfs(to, from, n) \
|
||||
(__builtin_constant_p(n) ? \
|
||||
__constant_memcpy_fromfs((to),(from),(n)) : \
|
||||
__generic_memcpy_fromfs((to),(from),(n)))
|
||||
|
||||
#define memcpy_tofs(to, from, n) \
|
||||
(__builtin_constant_p(n) ? \
|
||||
__constant_memcpy_tofs((to),(from),(n)) : \
|
||||
__generic_memcpy_tofs((to),(from),(n)))
|
||||
|
||||
/*
|
||||
* These are deprecated..
|
||||
*
|
||||
* Use "put_user()" and "get_user()" with the proper pointer types instead.
|
||||
*/
|
||||
|
||||
#define get_fs_byte(addr) __get_user((const unsigned char *)(addr),1)
|
||||
#define get_fs_word(addr) __get_user((const unsigned short *)(addr),2)
|
||||
#define get_fs_long(addr) __get_user((const unsigned int *)(addr),4)
|
||||
|
||||
#define put_fs_byte(x,addr) __put_user((x),(unsigned char *)(addr),1)
|
||||
#define put_fs_word(x,addr) __put_user((x),(unsigned short *)(addr),2)
|
||||
#define put_fs_long(x,addr) __put_user((x),(unsigned int *)(addr),4)
|
||||
|
||||
#ifdef WE_REALLY_WANT_TO_USE_A_BROKEN_INTERFACE
|
||||
|
||||
static inline unsigned short get_user_word(const short *addr)
|
||||
{
|
||||
return __get_user(addr, 2);
|
||||
}
|
||||
|
||||
static inline unsigned char get_user_byte(const char * addr)
|
||||
{
|
||||
return __get_user(addr,1);
|
||||
}
|
||||
|
||||
static inline unsigned long get_user_long(const int *addr)
|
||||
{
|
||||
return __get_user(addr, 4);
|
||||
}
|
||||
|
||||
static inline void put_user_byte(char val,char *addr)
|
||||
{
|
||||
__put_user(val, addr, 1);
|
||||
}
|
||||
|
||||
static inline void put_user_word(short val,short * addr)
|
||||
{
|
||||
__put_user(val, addr, 2);
|
||||
}
|
||||
|
||||
static inline void put_user_long(unsigned long val,int * addr)
|
||||
{
|
||||
__put_user(val, addr, 4);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Someone who knows GNU asm better than I should double check the following.
|
||||
* It seems to work, but I don't know if I'm doing something subtly wrong.
|
||||
* --- TYT, 11/24/91
|
||||
* [ nothing wrong here, Linus: I just changed the ax to be any reg ]
|
||||
*/
|
||||
|
||||
static inline unsigned long get_fs(void)
|
||||
{
|
||||
unsigned long _v;
|
||||
__asm__("mov %%fs,%w0":"=r" (_v):"0" (0));
|
||||
return _v;
|
||||
}
|
||||
|
||||
static inline unsigned long get_ds(void)
|
||||
{
|
||||
unsigned long _v;
|
||||
__asm__("mov %%ds,%w0":"=r" (_v):"0" (0));
|
||||
return _v;
|
||||
}
|
||||
|
||||
static inline void set_fs(unsigned long val)
|
||||
{
|
||||
__asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val));
|
||||
}
|
||||
|
||||
static inline void set_ds(unsigned long val)
|
||||
{
|
||||
__asm__ __volatile__("mov %w0,%%ds": /* no output */ :"r" (val));
|
||||
}
|
||||
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* _ASM_SEGMENT_H */
|
6
reactos/include/internal/hal/segment.inc
Normal file
6
reactos/include/internal/hal/segment.inc
Normal file
@@ -0,0 +1,6 @@
|
||||
;
|
||||
; Useful prototypes and definitions
|
||||
;
|
||||
|
||||
%define KERNEL_DS 028h
|
||||
%define KERNEL_CS 020h
|
71
reactos/include/internal/i386/hal.h
Normal file
71
reactos/include/internal/i386/hal.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __INTERNAL_HAL_HAL_H
|
||||
#define __INTERNAL_HAL_HAL_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short previous_task;
|
||||
unsigned short reserved1;
|
||||
unsigned long esp0;
|
||||
unsigned short ss0;
|
||||
unsigned short reserved2;
|
||||
unsigned long esp1;
|
||||
unsigned short ss1;
|
||||
unsigned short reserved3;
|
||||
unsigned long esp2;
|
||||
unsigned short ss2;
|
||||
unsigned short reserved4;
|
||||
unsigned long cr3;
|
||||
unsigned long eip;
|
||||
unsigned long eflags;
|
||||
unsigned long eax;
|
||||
unsigned long ecx;
|
||||
unsigned long edx;
|
||||
unsigned long ebx;
|
||||
unsigned long esp;
|
||||
unsigned long ebp;
|
||||
unsigned long esi;
|
||||
unsigned long edi;
|
||||
unsigned short es;
|
||||
unsigned short reserved5;
|
||||
unsigned short cs;
|
||||
unsigned short reserved6;
|
||||
unsigned short ss;
|
||||
unsigned short reserved7;
|
||||
unsigned short ds;
|
||||
unsigned short reserved8;
|
||||
unsigned short fs;
|
||||
unsigned short reserved9;
|
||||
unsigned short gs;
|
||||
unsigned short reserved10;
|
||||
unsigned short ldt;
|
||||
unsigned short reserved11;
|
||||
unsigned short trap;
|
||||
unsigned short iomap_base;
|
||||
|
||||
unsigned short nr;
|
||||
|
||||
unsigned char io_bitmap[1];
|
||||
} hal_thread_state;
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes for a PCI bus
|
||||
* RETURNS: True if found
|
||||
*/
|
||||
BOOL HalPciProbe(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Probes for a BIOS32 extension
|
||||
*/
|
||||
VOID Hal_bios32_probe(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Determines if a a bios32 service is present
|
||||
*/
|
||||
BOOLEAN Hal_bios32_is_service_present(ULONG service);
|
||||
|
||||
|
||||
#endif /* __INTERNAL_HAL_HAL_H */
|
27
reactos/include/internal/iomgr.h
Normal file
27
reactos/include/internal/iomgr.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/iomgr.h
|
||||
* PURPOSE: Internal io manager declarations
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* 28/05/97: Created
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_INTERNAL_IOMGR_H
|
||||
#define __INCLUDE_INTERNAL_IOMGR_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
/*
|
||||
* FUNCTION: Called to initalize a loaded driver
|
||||
* ARGUMENTS:
|
||||
* entry = pointer to the driver initialization routine
|
||||
* RETURNS: Success or failure
|
||||
*/
|
||||
NTSTATUS InitalizeLoadedDriver(PDRIVER_INITIALIZE entry);
|
||||
|
||||
VOID IoInitCancelHandling(VOID);
|
||||
VOID IoInitSymbolicLinkImplementation(VOID);
|
||||
|
||||
#endif
|
43
reactos/include/internal/ke.h
Normal file
43
reactos/include/internal/ke.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Various useful prototypes
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_INTERNAL_KERNEL_H
|
||||
#define __INCLUDE_INTERNAL_KERNEL_H
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* INTERNAL KERNEL FUNCTIONS ************************************************/
|
||||
|
||||
VOID KiInterruptDispatch(ULONG irq);
|
||||
VOID KiDispatchInterrupt(ULONG irq);
|
||||
VOID KiTimerInterrupt(VOID);
|
||||
VOID KeDrainDpcQueue(VOID);
|
||||
VOID KeExpireTimers(VOID);
|
||||
NTSTATUS KeAddThreadTimeout(PKTHREAD Thread, PLARGE_INTEGER Interval);
|
||||
VOID KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULONG Type,
|
||||
ULONG Size, ULONG SignalState);
|
||||
|
||||
/* INITIALIZATION FUNCTIONS *************************************************/
|
||||
|
||||
VOID KeInitExceptions(VOID);
|
||||
VOID KeInitIRQ(VOID);
|
||||
VOID KeInitTimer(VOID);
|
||||
VOID KeInitDpc(VOID);
|
||||
VOID KeInitBugCheck(VOID);
|
||||
VOID KeInitDispatcher(VOID);
|
||||
VOID KeCalibrateTimerLoop(VOID);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
1
reactos/include/internal/kernel.h
Normal file
1
reactos/include/internal/kernel.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <internal/ntoskrnl.h>
|
5
reactos/include/internal/linkage.h
Normal file
5
reactos/include/internal/linkage.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#ifdef __cplusplus
|
||||
#define asmlinkage extern "C"
|
||||
#else
|
||||
#define asmlinkage
|
||||
#endif
|
102
reactos/include/internal/mm.h
Normal file
102
reactos/include/internal/mm.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Higher level memory managment definitions
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_INTERNAL_MM_H
|
||||
#define __INCLUDE_INTERNAL_MM_H
|
||||
|
||||
#define PAGE_SYSTEM (0x80000000)
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <windows.h>
|
||||
|
||||
/* TYPES *********************************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
MEMORY_AREA_INVALID,
|
||||
MEMORY_AREA_SECTION_VIEW,
|
||||
MEMORY_AREA_CONTINUOUS_MEMORY,
|
||||
MEMORY_AREA_NO_CACHE,
|
||||
MEMORY_AREA_IO_MAPPING,
|
||||
MEMORY_AREA_SYSTEM,
|
||||
MEMORY_AREA_MDL_MAPPING,
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FILE_OBJECT* File;
|
||||
} SECTION_OBJECT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG Type;
|
||||
ULONG BaseAddress;
|
||||
ULONG Length;
|
||||
ULONG Attributes;
|
||||
LIST_ENTRY Entry;
|
||||
union
|
||||
{
|
||||
SECTION_OBJECT* Section;
|
||||
} d;
|
||||
} MEMORY_AREA;
|
||||
|
||||
|
||||
NTSTATUS MmCreateMemoryArea(KPROCESSOR_MODE Mode,
|
||||
ULONG Type,
|
||||
PULONG BaseAddress,
|
||||
ULONG Length,
|
||||
ULONG Attributes,
|
||||
MEMORY_AREA** Result);
|
||||
MEMORY_AREA* MmOpenMemoryAreaByAddress(ULONG Address);
|
||||
NTSTATUS MmInitMemoryAreas(VOID);
|
||||
VOID ExInitNonPagedPool(ULONG BaseAddress);
|
||||
NTSTATUS MmFreeMemoryArea(PVOID BaseAddress,
|
||||
ULONG Length,
|
||||
BOOLEAN FreePages);
|
||||
VOID MmDumpMemoryAreas(VOID);
|
||||
|
||||
/*
|
||||
* FUNCTION: Gets a page with a restricted max physical address (i.e.
|
||||
* suitable for dma)
|
||||
* RETURNS:
|
||||
* The physical address of the page if it succeeds
|
||||
* NULL if it fails.
|
||||
* NOTES: This is very inefficent because the list isn't sorted. On the
|
||||
* other hand sorting the list would be quite expensive especially if dma
|
||||
* is only used infrequently. Perhaps a special cache of dma pages should
|
||||
* be maintained?
|
||||
*/
|
||||
unsigned int get_dma_page(unsigned int max_address);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocate a page and return its physical address
|
||||
* RETURNS: The physical address of the page allocated
|
||||
*/
|
||||
asmlinkage unsigned int get_free_page(void);
|
||||
|
||||
/*
|
||||
* FUNCTION: Adds pages to the free list
|
||||
* ARGUMENTS:
|
||||
* physical_base = Physical address of the base of the region to
|
||||
* be freed
|
||||
* nr = number of continuous pages to free
|
||||
*/
|
||||
asmlinkage void free_page(unsigned int physical_base, unsigned int nr);
|
||||
|
||||
/*
|
||||
* FUNCTION: Returns the physical address mapped by a given virtual address
|
||||
* ARGUMENTS:
|
||||
* vaddr = virtual address to query
|
||||
* RETURNS: The physical address if present in memory
|
||||
* Zero if paged out or invalid
|
||||
* NOTE: This doesn't do any synchronization
|
||||
*/
|
||||
unsigned int get_page_physical_address(unsigned int vaddr);
|
||||
|
||||
void mark_page_not_writable(unsigned int vaddr);
|
||||
|
||||
void VirtualInit(boot_param* bp);
|
||||
|
||||
#endif
|
34
reactos/include/internal/module.h
Normal file
34
reactos/include/internal/module.h
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
#ifndef __MODULE_H
|
||||
#define __MODULE_H
|
||||
|
||||
#include <coff.h>
|
||||
|
||||
typedef struct
|
||||
/*
|
||||
*
|
||||
*/
|
||||
{
|
||||
unsigned int text_base;
|
||||
unsigned int data_base;
|
||||
unsigned int bss_base;
|
||||
SCNHDR* scn_list;
|
||||
char* str_tab;
|
||||
SYMENT* sym_list;
|
||||
unsigned int size;
|
||||
|
||||
/*
|
||||
* Base address of the module in memory
|
||||
*/
|
||||
unsigned int base;
|
||||
|
||||
/*
|
||||
* Offset of the raw data in memory
|
||||
*/
|
||||
unsigned int raw_data_off;
|
||||
} module;
|
||||
|
||||
BOOLEAN process_boot_module(unsigned int start);
|
||||
|
||||
#endif
|
||||
|
89
reactos/include/internal/ntoskrnl.h
Normal file
89
reactos/include/internal/ntoskrnl.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Various useful prototypes
|
||||
*/
|
||||
|
||||
#ifndef __KERNEL_H
|
||||
#define __KERNEL_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* Use these to place a function in a specific section of the executable
|
||||
*/
|
||||
#define PLACE_IN_SECTION(s) __attribute__((section (s)))
|
||||
#define INIT_FUNCTION (PLACE_IN_SECTION("init"))
|
||||
#define PAGE_LOCKED_FUNCTION (PLACE_IN_SECTION("pagelk"))
|
||||
#define PAGE_UNLOCKED_FUNCTION (PLACE_IN_SECTION("pagepo"))
|
||||
|
||||
/*
|
||||
* Maximum size of the kmalloc area (this is totally arbitary)
|
||||
*/
|
||||
#define NONPAGED_POOL_SIZE (4*1024*1024)
|
||||
|
||||
/*
|
||||
* Defines a descriptor as it appears in the processor tables
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int a;
|
||||
unsigned int b;
|
||||
} descriptor;
|
||||
|
||||
extern descriptor idt[256];
|
||||
extern descriptor gdt[256];
|
||||
|
||||
/*
|
||||
* printf style functions
|
||||
*/
|
||||
asmlinkage void printk(const char* fmt, ...);
|
||||
int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
int sprintf(char* buf, const char* fmt, ...);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* Magic value (useless really)
|
||||
*/
|
||||
unsigned int magic;
|
||||
|
||||
/*
|
||||
* Cursor position
|
||||
*/
|
||||
unsigned int cursorx;
|
||||
unsigned int cursory;
|
||||
|
||||
/*
|
||||
* Number of files (including the kernel) loaded
|
||||
*/
|
||||
unsigned int nr_files;
|
||||
|
||||
/*
|
||||
* Range of physical memory being used by the system
|
||||
*/
|
||||
unsigned int start_mem;
|
||||
unsigned int end_mem;
|
||||
|
||||
/*
|
||||
* List of module lengths (terminated by a 0)
|
||||
*/
|
||||
unsigned int module_length[64];
|
||||
} boot_param;
|
||||
|
||||
|
||||
/*
|
||||
* Initalization functions (called once by main())
|
||||
*/
|
||||
void MmInitalize(boot_param* bp);
|
||||
void HalInit(boot_param* bp);
|
||||
void IoInit(void);
|
||||
void ObInit(void);
|
||||
void PsInit(void);
|
||||
void TstBegin(void);
|
||||
VOID KeInit(VOID);
|
||||
VOID HalInitConsole(boot_param* bp);
|
||||
|
||||
#endif
|
91
reactos/include/internal/objmgr.h
Normal file
91
reactos/include/internal/objmgr.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/objmgr.h
|
||||
* PURPOSE: Object manager definitions
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_INTERNAL_OBJMGR_H
|
||||
#define __INCLUDE_INTERNAL_OBJMGR_H
|
||||
|
||||
#include <ddk/types.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
} COMMON_BODY_HEADER, *PCOMMON_BODY_HEADER;
|
||||
|
||||
typedef struct _DIRECTORY_OBJECT
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
|
||||
/*
|
||||
* PURPOSE: Head of the list of our subdirectories
|
||||
*/
|
||||
LIST_ENTRY head;
|
||||
KSPIN_LOCK Lock;
|
||||
} DIRECTORY_OBJECT, *PDIRECTORY_OBJECT;
|
||||
|
||||
|
||||
/*
|
||||
* Enumeration of object types
|
||||
*/
|
||||
enum
|
||||
{
|
||||
OBJTYP_INVALID,
|
||||
OBJTYP_TYPE,
|
||||
OBJTYP_DIRECTORY,
|
||||
OBJTYP_SYMLNK,
|
||||
OBJTYP_DEVICE,
|
||||
OBJTYP_THREAD,
|
||||
OBJTYP_FILE,
|
||||
OBJTYP_MAX,
|
||||
};
|
||||
|
||||
BOOL ObAddObjectToNameSpace(PUNICODE_STRING path, POBJECT_HEADER Object);
|
||||
|
||||
VOID ObRegisterType(CSHORT id, OBJECT_TYPE* type);
|
||||
|
||||
VOID ObInitializeObjectHeader(CSHORT id, PWSTR name,
|
||||
POBJECT_HEADER obj);
|
||||
|
||||
/*
|
||||
* FUNCTION: Get the size of an object
|
||||
* ARGUMENTS:
|
||||
* Type = Object type
|
||||
* RETURNS: The size in bytes
|
||||
*/
|
||||
ULONG ObSizeOf(CSHORT Type);
|
||||
HANDLE ObAddHandle(PVOID obj);
|
||||
PVOID ObLookupObject(HANDLE rooth, PWSTR _string);
|
||||
PVOID ObGetObjectByHandle(HANDLE h);
|
||||
PVOID ObGenericCreateObject(PHANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
CSHORT Type);
|
||||
|
||||
/*
|
||||
* FUNCTION: Creates an entry within a directory
|
||||
* ARGUMENTS:
|
||||
* parent = Parent directory
|
||||
* object = Header of the object to add
|
||||
*/
|
||||
VOID ObCreateEntry(PDIRECTORY_OBJECT parent, POBJECT_HEADER object);
|
||||
|
||||
extern inline POBJECT_HEADER BODY_TO_HEADER(PVOID body)
|
||||
{
|
||||
PCOMMON_BODY_HEADER chdr = (PCOMMON_BODY_HEADER)body;
|
||||
return(CONTAINING_RECORD((&(chdr->Type)),OBJECT_HEADER,Type));
|
||||
}
|
||||
|
||||
extern inline PVOID HEADER_TO_BODY(POBJECT_HEADER obj)
|
||||
{
|
||||
return(((void *)obj)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER));
|
||||
}
|
||||
|
||||
#define OBJECT_ALLOC_SIZE(type) (ObSizeOf(type)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER))
|
||||
|
||||
#endif /* __INCLUDE_INTERNAL_OBJMGR_H */
|
11
reactos/include/internal/pool.h
Normal file
11
reactos/include/internal/pool.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __INTERNAL_POOL_H
|
||||
#define __INTERNAL_POOL_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <internal/linkage.h>
|
||||
|
||||
static PVOID ExAllocatePagedPool(POOL_TYPE Type, ULONG size);
|
||||
static PVOID ExAllocateNonPagedPool(POOL_TYPE Type, ULONG size);
|
||||
|
||||
#endif /* __INTERNAL_POOL_H */
|
52
reactos/include/internal/psmgr.h
Normal file
52
reactos/include/internal/psmgr.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef __INCLUDE_INTERNAL_PSMGR_H
|
||||
#define __INCLUDE_INTERNAL_PSMGR_H
|
||||
|
||||
#include <internal/hal.h>
|
||||
|
||||
extern EPROCESS SystemProcess;
|
||||
extern HANDLE SystemProcessHandle;
|
||||
|
||||
void PsInitThreadManagment(void);
|
||||
VOID PsInitIdleThread(VOID);
|
||||
|
||||
/*
|
||||
* PURPOSE: Thread states
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*
|
||||
* PURPOSE: Don't touch
|
||||
*/
|
||||
THREAD_STATE_INVALID,
|
||||
|
||||
/*
|
||||
* PURPOSE: Waiting to be dispatched
|
||||
*/
|
||||
THREAD_STATE_RUNNABLE,
|
||||
|
||||
/*
|
||||
* PURPOSE: Currently running
|
||||
*/
|
||||
THREAD_STATE_RUNNING,
|
||||
|
||||
/*
|
||||
* PURPOSE: Doesn't want to run
|
||||
*/
|
||||
THREAD_STATE_SUSPENDED,
|
||||
|
||||
/*
|
||||
* Waiting to be freed
|
||||
*/
|
||||
THREAD_STATE_TERMINATED,
|
||||
};
|
||||
|
||||
/*
|
||||
* Functions the HAL must provide
|
||||
*/
|
||||
|
||||
void HalInitFirstTask(PKTHREAD thread);
|
||||
BOOLEAN HalInitTask(PKTHREAD thread, PKSTART_ROUTINE fn,
|
||||
PVOID StartContext);
|
||||
void HalTaskSwitch(PKTHREAD thread);
|
||||
|
||||
#endif
|
10
reactos/include/internal/stddef.h
Normal file
10
reactos/include/internal/stddef.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Some useful things
|
||||
*/
|
||||
|
||||
//#define NULL ((void*)0)
|
||||
#ifndef NULL
|
||||
#define NULL (0)
|
||||
#endif
|
||||
|
||||
|
680
reactos/include/internal/string.h
Normal file
680
reactos/include/internal/string.h
Normal file
@@ -0,0 +1,680 @@
|
||||
/*
|
||||
* Adapted from linux for the reactos kernel, march 1998 -- David Welch
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_STRING_H_
|
||||
#define _LINUX_STRING_H_
|
||||
|
||||
#include "types.h" /* for size_t */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern char * ___strtok;
|
||||
extern char * strcpy(char *,const char *);
|
||||
extern char * strncpy(char *,const char *, __kernel_size_t);
|
||||
extern char * strcat(char *, const char *);
|
||||
extern char * strncat(char *, const char *, __kernel_size_t);
|
||||
extern char * strchr(const char *,int);
|
||||
extern char * strrchr(const char *,int);
|
||||
extern char * strpbrk(const char *,const char *);
|
||||
extern char * strtok(char *,const char *);
|
||||
extern char * strstr(const char *,const char *);
|
||||
extern __kernel_size_t strlen(const char *);
|
||||
extern __kernel_size_t strnlen(const char *,__kernel_size_t);
|
||||
extern __kernel_size_t strspn(const char *,const char *);
|
||||
extern int strcmp(const char *,const char *);
|
||||
extern int strncmp(const char *,const char *,__kernel_size_t);
|
||||
|
||||
extern void * memset(void *,int,__kernel_size_t);
|
||||
extern void * memcpy(void *,const void *,__kernel_size_t);
|
||||
extern void * memmove(void *,const void *,__kernel_size_t);
|
||||
extern void * memscan(void *,int,__kernel_size_t);
|
||||
extern int memcmp(const void *,const void *,__kernel_size_t);
|
||||
|
||||
/*
|
||||
* Include machine specific inline routines
|
||||
*/
|
||||
#ifndef _I386_STRING_H_
|
||||
#define _I386_STRING_H_
|
||||
|
||||
/*
|
||||
* On a 486 or Pentium, we are better off not using the
|
||||
* byte string operations. But on a 386 or a PPro the
|
||||
* byte string ops are faster than doing it by hand
|
||||
* (MUCH faster on a Pentium).
|
||||
*
|
||||
* Also, the byte strings actually work correctly. Forget
|
||||
* the i486 routines for now as they may be broken..
|
||||
*/
|
||||
#if FIXED_486_STRING && (CPU == 486 || CPU == 586)
|
||||
#include <asm/string-486.h>
|
||||
#else
|
||||
|
||||
/*
|
||||
* This string-include defines all string functions as inline
|
||||
* functions. Use gcc. It also assumes ds=es=data space, this should be
|
||||
* normal. Most of the string-functions are rather heavily hand-optimized,
|
||||
* see especially strtok,strstr,str[c]spn. They should work, but are not
|
||||
* very easy to understand. Everything is done entirely within the register
|
||||
* set, making the functions fast and clean. String instructions have been
|
||||
* used through-out, making for "slightly" unclear code :-)
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#define __HAVE_ARCH_STRCPY
|
||||
extern inline char * strcpy(char * dest,const char *src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest):"si","di","ax","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRNCPY
|
||||
extern inline char * strncpy(char * dest,const char *src,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tdecl %2\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"rep\n\t"
|
||||
"stosb\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCAT
|
||||
extern inline char * strcat(char * dest,const char * src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"decl %1\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRNCAT
|
||||
extern inline char * strncat(char * dest,const char * src,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"decl %1\n\t"
|
||||
"movl %4,%3\n"
|
||||
"1:\tdecl %3\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\txorl %2,%2\n\t"
|
||||
"stosb"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
|
||||
:"si","di","ax","cx","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCMP
|
||||
extern inline int strcmp(const char * cs,const char * ct)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 2f\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"jmp 3f\n"
|
||||
"2:\tsbbl %%eax,%%eax\n\t"
|
||||
"orb $1,%%eax\n"
|
||||
"3:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRNCMP
|
||||
extern inline int strncmp(const char * cs,const char * ct,size_t count)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tdecl %3\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsb\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 3f\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\txorl %%eax,%%eax\n\t"
|
||||
"jmp 4f\n"
|
||||
"3:\tsbbl %%eax,%%eax\n\t"
|
||||
"orb $1,%%al\n"
|
||||
"4:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCHR
|
||||
extern inline char * strchr(const char * s, int c)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movb %%al,%%ah\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"cmpb %%ah,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl $1,%1\n"
|
||||
"2:\tmovl %1,%0\n\t"
|
||||
"decl %0"
|
||||
:"=a" (__res):"S" (s),"0" (c):"si");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRRCHR
|
||||
extern inline char * strrchr(const char * s, int c)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movb %%al,%%ah\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"cmpb %%ah,%%al\n\t"
|
||||
"jne 2f\n\t"
|
||||
"leal -1(%%esi),%0\n"
|
||||
"2:\ttestb %%al,%%al\n\t"
|
||||
"jne 1b"
|
||||
:"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRSPN
|
||||
extern inline size_t strspn(const char * cs, const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 1b\n"
|
||||
"2:\tdecl %0"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"ax","cx","dx","di");
|
||||
return __res-cs;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCSPN
|
||||
extern inline size_t strcspn(const char * cs, const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\tdecl %0"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"ax","cx","dx","di");
|
||||
return __res-cs;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRPBRK
|
||||
extern inline char * strpbrk(const char * cs,const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 1b\n\t"
|
||||
"decl %0\n\t"
|
||||
"jmp 3f\n"
|
||||
"2:\txorl %0,%0\n"
|
||||
"3:"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"ax","cx","dx","di");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRSTR
|
||||
extern inline char * strstr(const char * cs,const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t" \
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tmovl %4,%%edi\n\t"
|
||||
"movl %%esi,%%eax\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repe\n\t"
|
||||
"cmpsb\n\t"
|
||||
"je 2f\n\t" /* also works for empty string, see above */
|
||||
"xchgl %%eax,%%esi\n\t"
|
||||
"incl %%esi\n\t"
|
||||
"cmpb $0,-1(%%eax)\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"2:"
|
||||
:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
|
||||
:"cx","dx","di","si");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRLEN
|
||||
extern inline size_t strlen(const char * s)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %0\n\t"
|
||||
"decl %0"
|
||||
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRTOK
|
||||
extern inline char * strtok(char * s,const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"testl %1,%1\n\t"
|
||||
"jne 1f\n\t"
|
||||
"testl %0,%0\n\t"
|
||||
"je 8f\n\t"
|
||||
"movl %0,%1\n"
|
||||
"1:\txorl %0,%0\n\t"
|
||||
"movl $-1,%%ecx\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"je 7f\n\t" /* empty delimiter-string */
|
||||
"movl %%ecx,%%edx\n"
|
||||
"2:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 7f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 2b\n\t"
|
||||
"decl %1\n\t"
|
||||
"cmpb $0,(%1)\n\t"
|
||||
"je 7f\n\t"
|
||||
"movl %1,%0\n"
|
||||
"3:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 5f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 3b\n\t"
|
||||
"decl %1\n\t"
|
||||
"cmpb $0,(%1)\n\t"
|
||||
"je 5f\n\t"
|
||||
"movb $0,(%1)\n\t"
|
||||
"incl %1\n\t"
|
||||
"jmp 6f\n"
|
||||
"5:\txorl %1,%1\n"
|
||||
"6:\tcmpb $0,(%0)\n\t"
|
||||
"jne 7f\n\t"
|
||||
"xorl %0,%0\n"
|
||||
"7:\ttestl %0,%0\n\t"
|
||||
"jne 8f\n\t"
|
||||
"movl %0,%1\n"
|
||||
"8:"
|
||||
:"=b" (__res),"=S" (___strtok)
|
||||
:"0" (___strtok),"1" (s),"g" (ct)
|
||||
:"ax","cx","dx","di","memory");
|
||||
return __res;
|
||||
}
|
||||
|
||||
extern inline void * __memcpy(void * to, const void * from, size_t n)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep ; movsl\n\t"
|
||||
"testb $2,%b1\n\t"
|
||||
"je 1f\n\t"
|
||||
"movsw\n"
|
||||
"1:\ttestb $1,%b1\n\t"
|
||||
"je 2f\n\t"
|
||||
"movsb\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from)
|
||||
: "cx","di","si","memory");
|
||||
return (to);
|
||||
}
|
||||
|
||||
/*
|
||||
* This looks horribly ugly, but the compiler can optimize it totally,
|
||||
* as the count is constant.
|
||||
*/
|
||||
extern inline void * __constant_memcpy(void * to, const void * from, size_t n)
|
||||
{
|
||||
switch (n) {
|
||||
case 0:
|
||||
return to;
|
||||
case 1:
|
||||
*(unsigned char *)to = *(const unsigned char *)from;
|
||||
return to;
|
||||
case 2:
|
||||
*(unsigned short *)to = *(const unsigned short *)from;
|
||||
return to;
|
||||
case 3:
|
||||
*(unsigned short *)to = *(const unsigned short *)from;
|
||||
*(2+(unsigned char *)to) = *(2+(const unsigned char *)from);
|
||||
return to;
|
||||
case 4:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
return to;
|
||||
case 8:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
return to;
|
||||
case 12:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
|
||||
return to;
|
||||
case 16:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
|
||||
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
|
||||
return to;
|
||||
case 20:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
|
||||
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
|
||||
*(4+(unsigned long *)to) = *(4+(const unsigned long *)from);
|
||||
return to;
|
||||
}
|
||||
#define COMMON(x) \
|
||||
__asm__("cld\n\t" \
|
||||
"rep ; movsl" \
|
||||
x \
|
||||
: /* no outputs */ \
|
||||
: "c" (n/4),"D" ((long) to),"S" ((long) from) \
|
||||
: "cx","di","si","memory");
|
||||
|
||||
switch (n % 4) {
|
||||
case 0: COMMON(""); return to;
|
||||
case 1: COMMON("\n\tmovsb"); return to;
|
||||
case 2: COMMON("\n\tmovsw"); return to;
|
||||
case 3: COMMON("\n\tmovsw\n\tmovsb"); return to;
|
||||
}
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
#define memcpy(t, f, n) \
|
||||
(__builtin_constant_p(n) ? \
|
||||
__constant_memcpy((t),(f),(n)) : \
|
||||
__memcpy((t),(f),(n)))
|
||||
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
extern inline void * memmove(void * dest,const void * src, size_t n)
|
||||
{
|
||||
if (dest<src)
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep\n\t"
|
||||
"movsb"
|
||||
: /* no output */
|
||||
:"c" (n),"S" (src),"D" (dest)
|
||||
:"cx","si","di");
|
||||
else
|
||||
__asm__ __volatile__(
|
||||
"std\n\t"
|
||||
"rep\n\t"
|
||||
"movsb\n\t"
|
||||
"cld"
|
||||
: /* no output */
|
||||
:"c" (n),
|
||||
"S" (n-1+(const char *)src),
|
||||
"D" (n-1+(char *)dest)
|
||||
:"cx","si","di","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define memcmp __builtin_memcmp
|
||||
|
||||
#define __HAVE_ARCH_MEMCHR
|
||||
extern inline void * memchr(const void * cs,int c,size_t count)
|
||||
{
|
||||
register void * __res;
|
||||
if (!count)
|
||||
return NULL;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 1f\n\t"
|
||||
"movl $1,%0\n"
|
||||
"1:\tdecl %0"
|
||||
:"=D" (__res):"a" (c),"D" (cs),"c" (count)
|
||||
:"cx");
|
||||
return __res;
|
||||
}
|
||||
|
||||
extern inline void * __memset_generic(void * s, char c,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep\n\t"
|
||||
"stosb"
|
||||
: /* no output */
|
||||
:"a" (c),"D" (s),"c" (count)
|
||||
:"cx","di","memory");
|
||||
return s;
|
||||
}
|
||||
|
||||
/* we might want to write optimized versions of these later */
|
||||
#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count))
|
||||
|
||||
/*
|
||||
* memset(x,0,y) is a reasonably common thing to do, so we want to fill
|
||||
* things 32 bits at a time even when we don't know the size of the
|
||||
* area at compile-time..
|
||||
*/
|
||||
extern inline void * __constant_c_memset(void * s, unsigned long c, size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep ; stosl\n\t"
|
||||
"testb $2,%b1\n\t"
|
||||
"je 1f\n\t"
|
||||
"stosw\n"
|
||||
"1:\ttestb $1,%b1\n\t"
|
||||
"je 2f\n\t"
|
||||
"stosb\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"a" (c), "q" (count), "c" (count/4), "D" ((long) s)
|
||||
:"cx","di","memory");
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* Added by Gertjan van Wingerde to make minix and sysv module work */
|
||||
#define __HAVE_ARCH_STRNLEN
|
||||
extern inline size_t strnlen(const char * s, size_t count)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"movl %1,%0\n\t"
|
||||
"jmp 2f\n"
|
||||
"1:\tcmpb $0,(%0)\n\t"
|
||||
"je 3f\n\t"
|
||||
"incl %0\n"
|
||||
"2:\tdecl %2\n\t"
|
||||
"cmpl $-1,%2\n\t"
|
||||
"jne 1b\n"
|
||||
"3:\tsubl %1,%0"
|
||||
:"=a" (__res)
|
||||
:"c" (s),"d" (count)
|
||||
:"dx");
|
||||
return __res;
|
||||
}
|
||||
/* end of additional stuff */
|
||||
|
||||
/*
|
||||
* This looks horribly ugly, but the compiler can optimize it totally,
|
||||
* as we by now know that both pattern and count is constant..
|
||||
*/
|
||||
extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
|
||||
{
|
||||
switch (count) {
|
||||
case 0:
|
||||
return s;
|
||||
case 1:
|
||||
*(unsigned char *)s = pattern;
|
||||
return s;
|
||||
case 2:
|
||||
*(unsigned short *)s = pattern;
|
||||
return s;
|
||||
case 3:
|
||||
*(unsigned short *)s = pattern;
|
||||
*(2+(unsigned char *)s) = pattern;
|
||||
return s;
|
||||
case 4:
|
||||
*(unsigned long *)s = pattern;
|
||||
return s;
|
||||
}
|
||||
#define COMMON(x) \
|
||||
__asm__("cld\n\t" \
|
||||
"rep ; stosl" \
|
||||
x \
|
||||
: /* no outputs */ \
|
||||
: "a" (pattern),"c" (count/4),"D" ((long) s) \
|
||||
: "cx","di","memory")
|
||||
|
||||
switch (count % 4) {
|
||||
case 0: COMMON(""); return s;
|
||||
case 1: COMMON("\n\tstosb"); return s;
|
||||
case 2: COMMON("\n\tstosw"); return s;
|
||||
case 3: COMMON("\n\tstosw\n\tstosb"); return s;
|
||||
}
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
#define __constant_c_x_memset(s, c, count) \
|
||||
(__builtin_constant_p(count) ? \
|
||||
__constant_c_and_count_memset((s),(c),(count)) : \
|
||||
__constant_c_memset((s),(c),(count)))
|
||||
|
||||
#define __memset(s, c, count) \
|
||||
(__builtin_constant_p(count) ? \
|
||||
__constant_count_memset((s),(c),(count)) : \
|
||||
__memset_generic((s),(c),(count)))
|
||||
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define memset(s, c, count) \
|
||||
(__builtin_constant_p(c) ? \
|
||||
__constant_c_x_memset((s),(0x01010101UL*(unsigned char)c),(count)) : \
|
||||
__memset((s),(c),(count)))
|
||||
|
||||
/*
|
||||
* find the first occurrence of byte 'c', or 1 past the area if none
|
||||
*/
|
||||
#define __HAVE_ARCH_MEMSCAN
|
||||
extern inline void * memscan(void * addr, int c, size_t size)
|
||||
{
|
||||
if (!size)
|
||||
return addr;
|
||||
__asm__("cld
|
||||
repnz; scasb
|
||||
jnz 1f
|
||||
dec %%edi
|
||||
1: "
|
||||
: "=D" (addr), "=c" (size)
|
||||
: "0" (addr), "1" (size), "a" (c));
|
||||
return addr;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_STRING_H_ */
|
13
reactos/include/internal/symbol.h
Normal file
13
reactos/include/internal/symbol.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stddef.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char* name;
|
||||
unsigned int value;
|
||||
} export;
|
||||
|
||||
extern export symbol_table[];
|
56
reactos/include/internal/types.h
Normal file
56
reactos/include/internal/types.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef _LINUX_TYPES_H
|
||||
#define _LINUX_TYPES_H
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _I386_TYPES_H
|
||||
#define _I386_TYPES_H
|
||||
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These aren't exported outside the kernel to avoid name space clashes
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef signed long long s64;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef size_t __kernel_size_t;
|
||||
|
||||
#endif /* _LINUX_TYPES_H */
|
17
reactos/include/internal/version.h
Normal file
17
reactos/include/internal/version.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/version.h
|
||||
* PURPOSE: Defines the current version
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define KERNEL_VERSION "0.0.10"
|
||||
#define KERNEL_MAJOR_VERSION 0
|
||||
#define KERNEL_MINOR_VERSION 0
|
||||
#define KERNEL_PATCH_LEVEL 10
|
||||
|
||||
#endif
|
57
reactos/include/kernel32/atom.h
Normal file
57
reactos/include/kernel32/atom.h
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
/********************************************************************
|
||||
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA.
|
||||
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef Atoms__h
|
||||
#define Atoms__h
|
||||
|
||||
#include <windows.h>
|
||||
#include <ctype.h>
|
||||
//#include <types.h>
|
||||
|
||||
|
||||
typedef unsigned long ATOMID;
|
||||
|
||||
typedef struct {
|
||||
ATOMID q; /* what a string 'hashes' to */
|
||||
long idx; /* index into data table */
|
||||
long refcnt; /* how many clients have it */
|
||||
long idsize; /* space used by this slot */
|
||||
} ATOMENTRY;
|
||||
typedef ATOMENTRY *LPATOMENTRY;
|
||||
|
||||
typedef struct {
|
||||
ATOMENTRY *AtomTable; /* pointer to table data */
|
||||
wchar_t *AtomData; /* pointer to name data */
|
||||
unsigned long TableSize; /* number items in this table */
|
||||
unsigned long DataSize; /* space used by string data */
|
||||
LPVOID lpDrvData;
|
||||
} ATOMTABLE;
|
||||
typedef ATOMTABLE *LPATOMTABLE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* Atoms__h */
|
110
reactos/include/kernel32/heap.h
Normal file
110
reactos/include/kernel32/heap.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* kernel/heap.c
|
||||
* Copyright (C) 1996, Onno Hovers, All rights reserved
|
||||
* Adapted for the ReactOS system libraries by David Welch (welch@mcmail.com)
|
||||
* todo: __processheap should be part of peb.
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_KERNEL32_HEAP_H
|
||||
#define __INCLUDE_KERNEL32_HEAP_H
|
||||
|
||||
/* System wide includes ****************************************************/
|
||||
#include <windows.h>
|
||||
|
||||
/* System library's private includes ***************************************/
|
||||
|
||||
#include <ntdll/pagesize.h>
|
||||
|
||||
/* definitions */
|
||||
#define HEAP_ADMIN_SIZE 8
|
||||
#define HEAP_FRAG_ADMIN_SIZE 8
|
||||
#define HEAP_ROUNDVAL (2*(HEAP_ADMIN_SIZE)-1)
|
||||
#define HEAP_FRAGMENT_THRESHOLD 256
|
||||
|
||||
#define SIZE_TOTAL(s) ROUNDUP((s)+HEAP_ADMIN_SIZE,8)
|
||||
#define SIZE_ROUND(s) ROUNDUP((s),8)
|
||||
|
||||
#define HEAP_FRAG_MAGIC 0x10
|
||||
#define HEAP_ALLOC_MASK 0xF0000000
|
||||
#define HEAP_FREE_MASK 0x80000000
|
||||
#define HEAP_SIZE_MASK 0x0FFFFFFF
|
||||
#define HEAP_FREE_TAG 0x80000000 /* free region */
|
||||
#define HEAP_NORMAL_TAG 0x30000000 /* normal allocation */
|
||||
#define HEAP_MOVEABLE_TAG 0x50000000 /* moveable handle */
|
||||
#define HEAP_SUB_TAG 0x70000000 /* suballocated for fragments */
|
||||
|
||||
#define HEAP_ISFREE(p) ((((PHEAP_BLOCK)p)->Size) & HEAP_FREE_MASK)
|
||||
#define HEAP_ISALLOC(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_FREE_MASK)==0)
|
||||
#define HEAP_ISFRAG(p) ((((PHEAP_FRAGMENT)p)->Magic)==HEAP_FRAG_MAGIC)
|
||||
#define HEAP_ISNORMAL(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_ALLOC_MASK)\
|
||||
==HEAP_NORMAL_TAG)
|
||||
#define HEAP_ISSUB(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_ALLOC_MASK)\
|
||||
==HEAP_SUB_TAG)
|
||||
#define HEAP_ISOLD(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_ALLOC_MASK)\
|
||||
==HEAP_MOVEABLE_TAG)
|
||||
|
||||
#define HEAP_SIZE(p) ((((PHEAP_BLOCK)p)->Size) & HEAP_SIZE_MASK )
|
||||
#define HEAP_RSIZE(p) SIZE_ROUND(HEAP_SIZE(p))
|
||||
#define HEAP_TSIZE(p) SIZE_TOTAL(HEAP_SIZE(p))
|
||||
#define HEAP_PREVSIZE(p) ((((PHEAP_BLOCK)p)->PrevSize) & HEAP_SIZE_MASK )
|
||||
#define HEAP_FRAG_SIZE(p) (((PHEAP_FRAGMENT)p)->Size)
|
||||
|
||||
#define HEAP_PREV(p) ((PHEAP_BLOCK)(((LPVOID)(p))-HEAP_PREVSIZE(p)))
|
||||
#define HEAP_NEXT(p) ((PHEAP_BLOCK)(((LPVOID)(p))+HEAP_TSIZE(p)))
|
||||
|
||||
typedef struct __HEAP_BLOCK
|
||||
{
|
||||
ULONG Size; /* this is relative to Data */
|
||||
ULONG PrevSize; /* p - p->PrevSize is the previous block */
|
||||
} HEAP_BLOCK, *PHEAP_BLOCK;
|
||||
|
||||
struct __HEAP_SUBALLOC;
|
||||
|
||||
typedef struct __HEAP_FRAGMENT
|
||||
{
|
||||
UCHAR Magic;
|
||||
UCHAR Number;
|
||||
ULONG Size;
|
||||
struct __HEAP_SUBALLOC *Sub;
|
||||
|
||||
/* this is only used in free blocks */
|
||||
struct __HEAP_FRAGMENT *FreeNext;
|
||||
struct __HEAP_FRAGMENT *FreePrev;
|
||||
} HEAP_FRAGMENT, *PHEAP_FRAGMENT, *LPHEAP_FRAGMENT;
|
||||
|
||||
typedef struct __HEAP_SUBALLOC
|
||||
{
|
||||
ULONG Magic;
|
||||
ULONG NumberFree;
|
||||
struct __HEAP_SUBALLOC *Next;
|
||||
|
||||
struct __HEAP_SUBALLOC *Prev;
|
||||
struct __HEAP_FRAGMENT *FirstFree;
|
||||
struct __HEAP_BUCKET *Bucket;
|
||||
ULONG Bitmap;
|
||||
} HEAP_SUBALLOC, *PHEAP_SUBALLOC, *LPHEAP_SUBALLOC;
|
||||
|
||||
typedef struct __HEAP_BUCKET
|
||||
{
|
||||
struct __HEAP_SUBALLOC *FirstFree;
|
||||
ULONG Size;
|
||||
ULONG Number;
|
||||
ULONG TotalSize;
|
||||
} HEAP_BUCKET, *PHEAP_BUCKET, *LPHEAP_BUCKET;
|
||||
|
||||
typedef struct __HEAP
|
||||
{
|
||||
ULONG Magic;
|
||||
LPVOID End;
|
||||
ULONG Flags;
|
||||
CRITICAL_SECTION Synchronize;
|
||||
HEAP_BUCKET Bucket[8];
|
||||
struct __HEAP *NextHeap;
|
||||
LPVOID LastBlock;
|
||||
/* this has to aligned on an 8 byte boundary */
|
||||
HEAP_BLOCK Start __attribute__((aligned (8)));
|
||||
} HEAP, *PHEAP;
|
||||
|
||||
//PHEAP __ProcessHeap;
|
||||
|
||||
#endif /* __INCLUDE_KERNEL32_HEAP_H */
|
63
reactos/include/kernel32/process.h
Normal file
63
reactos/include/kernel32/process.h
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
#ifndef __PEB_DEFINED
|
||||
#define __PEB_DEFINED
|
||||
|
||||
#include "heap.h"
|
||||
|
||||
typedef void* HANDLE_TABLE;
|
||||
|
||||
typedef struct _pPebInfo {
|
||||
LPWSTR lpCommandLine;
|
||||
DWORD cb;
|
||||
HANDLE hStdInput; //18
|
||||
HANDLE hStdOutput;
|
||||
HANDLE hStdError;
|
||||
LPWSTR lpEnvironment;
|
||||
DWORD dwX;
|
||||
DWORD dwY;
|
||||
DWORD dwXSize;
|
||||
DWORD dwYSize;
|
||||
DWORD dwXCountChars;
|
||||
DWORD dwYCountChars;
|
||||
DWORD dwFillAttribute;
|
||||
DWORD dwFlags;
|
||||
DWORD wShowWindow;
|
||||
LPTSTR lpTitle;
|
||||
LPTSTR lpDesktop;
|
||||
LPTSTR reserved;
|
||||
DWORD cbReserved2;
|
||||
LPTSTR lpReserved1;
|
||||
} PEBINFO;
|
||||
|
||||
typedef struct _NT_PEB
|
||||
{
|
||||
|
||||
LONG ImageBaseAddress;
|
||||
void *HeapIndex;
|
||||
DWORD dwTlsBits[2]; // tls in use bits
|
||||
WORD NumberOfProcessors;
|
||||
WORD NtGlobalFlag;
|
||||
DWORD dwCriticalSectionTimeout;
|
||||
DWORD dwHeapReserve;
|
||||
DWORD dwHeapCommit;
|
||||
DWORD dwHeapDecommitFreeBlockThreshold;
|
||||
DWORD dwNumberOfHeaps;
|
||||
DWORD dwMaxiumNumberOfHeaps;
|
||||
PEBINFO *pPebInfo;
|
||||
HEAP *pProcessHeap;
|
||||
HANDLE_TABLE htGDISharedHandleTable;
|
||||
ATOMTABLE LocalAtomTable;
|
||||
CRITICAL_SECTION *pCriticalSection;
|
||||
WORD wMajorVersion;
|
||||
WORD wMinorVersion;
|
||||
WORD wBuildNumber;
|
||||
WORD wPlatformId;
|
||||
|
||||
} NT_PEB;
|
||||
|
||||
NT_PEB *GetPeb()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
56
reactos/include/kernel32/thread.h
Normal file
56
reactos/include/kernel32/thread.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file contains a proposal for Thread Environment Block.
|
||||
*/
|
||||
#ifndef __TEB_DEFINED
|
||||
#define __TEB_DEFINED
|
||||
|
||||
|
||||
typedef struct _NT_TIB {
|
||||
|
||||
struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
|
||||
|
||||
void *StackBase;
|
||||
void *StackLimit;
|
||||
void *SubSystemTib;
|
||||
union {
|
||||
void *FiberData;
|
||||
DWORD Version;
|
||||
};
|
||||
void *ArbitraryUserPointer;
|
||||
struct _NT_TIB *Self;
|
||||
|
||||
} NT_TIB;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct _NT_TEB
|
||||
{
|
||||
|
||||
NT_TIB Tib;
|
||||
DWORD dwProcessId;
|
||||
DWORD dwThreadId;
|
||||
HANDLE hRPC;
|
||||
NT_PEB *pPeb;
|
||||
DWORD dwErrCode;
|
||||
WORD nMutexCount;
|
||||
LCID Locale;
|
||||
//HQUEUE MessageQueue
|
||||
DWORD dwTlsIndex ;
|
||||
LPVOID TlsData[512];
|
||||
|
||||
|
||||
} NT_TEB;
|
||||
|
||||
|
||||
// should be an inline asm macro
|
||||
|
||||
NT_TEB *GetTeb()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
1095
reactos/include/messages.h
Normal file
1095
reactos/include/messages.h
Normal file
File diff suppressed because it is too large
Load Diff
7
reactos/include/ntdll/pagesize.h
Normal file
7
reactos/include/ntdll/pagesize.h
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef i386
|
||||
#define PAGESIZE (4096)
|
||||
#endif
|
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Service Control Manager - Protocol Header
|
||||
*
|
||||
* Copyright (C) 2004 Filip Navara
|
||||
*
|
||||
* This software 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 software 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING.LIB. If not, write
|
||||
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
|
||||
* MA 02139, USA.
|
||||
*
|
||||
* $Id: scmprot.h,v 1.1.2.1 2004/04/12 17:27:52 navaraf Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SCM_H
|
||||
#define _SCM_H
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* This protocol isn't compatible with the Windows (R) one. Since
|
||||
* Windows (R) XP (or 2000?) all the communcation goes through RPC.
|
||||
* We don't have RPC implemented yet, so it can't be used yet :(
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ULONG Length;
|
||||
WCHAR Buffer[256];
|
||||
} SCM_STRING;
|
||||
|
||||
#define INIT_SCM_STRING(x, y) x.Length = wcslen(y) * sizeof(WCHAR), RtlCopyMemory(x.Buffer, y, x.Length + sizeof(UNICODE_NULL))
|
||||
|
||||
/*
|
||||
* Global requests
|
||||
*/
|
||||
|
||||
#define SCM_OPENSERVICE 0x14
|
||||
#define SCM_CREATESERVICE 0x20
|
||||
|
||||
typedef struct _SCM_OPENSERVICE_REQUEST
|
||||
{
|
||||
DWORD RequestCode;
|
||||
SCM_STRING ServiceName;
|
||||
DWORD dwDesiredAccess;
|
||||
} SCM_OPENSERVICE_REQUEST, *PSCM_OPENSERVICE_REQUEST;
|
||||
|
||||
typedef struct _SCM_OPENSERVICE_REPLY
|
||||
{
|
||||
DWORD ReplyStatus;
|
||||
WCHAR PipeName[128];
|
||||
} SCM_OPENSERVICE_REPLY, *PSCM_OPENSERVICE_REPLY;
|
||||
|
||||
typedef struct _SCM_CREATESERVICE_REQUEST
|
||||
{
|
||||
DWORD RequestCode;
|
||||
SCM_STRING ServiceName;
|
||||
SCM_STRING DisplayName;
|
||||
DWORD dwDesiredAccess;
|
||||
DWORD dwServiceType;
|
||||
DWORD dwStartType;
|
||||
DWORD dwErrorControl;
|
||||
SCM_STRING BinaryPathName;
|
||||
SCM_STRING LoadOrderGroup;
|
||||
SCM_STRING Dependencies;
|
||||
SCM_STRING ServiceStartName;
|
||||
SCM_STRING Password;
|
||||
} SCM_CREATESERVICE_REQUEST, *PSCM_CREATESERVICE_REQUEST;
|
||||
|
||||
typedef struct _SCM_CREATESERVICE_REPLY
|
||||
{
|
||||
DWORD ReplyStatus;
|
||||
WCHAR PipeName[128];
|
||||
} SCM_CREATESERVICE_REPLY, *PSCM_CREATESERVICE_REPLY;
|
||||
|
||||
typedef union _SCM_REQUEST
|
||||
{
|
||||
DWORD RequestCode;
|
||||
SCM_OPENSERVICE_REQUEST OpenService;
|
||||
SCM_CREATESERVICE_REQUEST CreateService;
|
||||
} SCM_REQUEST, *PSCM_REQUEST;
|
||||
|
||||
typedef union _SCM_REPLY
|
||||
{
|
||||
DWORD ReplyStatus;
|
||||
SCM_OPENSERVICE_REPLY OpenService;
|
||||
SCM_CREATESERVICE_REPLY CreateService;
|
||||
} SCM_REPLY, *PSCM_REPLY;
|
||||
|
||||
/*
|
||||
* Per service requests
|
||||
*/
|
||||
|
||||
#define SCM_DELETESERVICE 0x10
|
||||
#define SCM_STARTSERVICE 0x11
|
||||
|
||||
typedef union _SCM_SERVICE_REQUEST
|
||||
{
|
||||
DWORD RequestCode;
|
||||
} SCM_SERVICE_REQUEST, *PSCM_SERVICE_REQUEST;
|
||||
|
||||
typedef union _SCM_SERVICE_REPLY
|
||||
{
|
||||
DWORD ReplyStatus;
|
||||
} SCM_SERVICE_REPLY, *PSCM_SERVICE_REPLY;
|
||||
|
||||
#endif
|
965
reactos/include/sockets.h
Normal file
965
reactos/include/sockets.h
Normal file
@@ -0,0 +1,965 @@
|
||||
/*
|
||||
Sockets.h
|
||||
|
||||
Windows Sockets specification version 1.1
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Thanks to Linux header files for supplying many needed definitions
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
||||
This file is part of the Windows32 API Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Portions Copyright (c) 1980, 1983, 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* -
|
||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies, and that
|
||||
* the name of Digital Equipment Corporation not be used in advertising or
|
||||
* publicity pertaining to distribution of the document or software without
|
||||
* specific, written prior permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
||||
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
#ifndef _GNU_H_WINDOWS32_SOCKETS
|
||||
#define _GNU_H_WINDOWS32_SOCKETS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* BSD */
|
||||
#ifndef _SYS_TYPES_H
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned long u_long;
|
||||
#endif
|
||||
|
||||
/*
|
||||
Default maximium number of sockets.
|
||||
Define this before including Sockets.h to increase; this does not
|
||||
mean that the underlying Windows Sockets implementation has to
|
||||
support that many!
|
||||
*/
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 64
|
||||
#endif /* !FD_SETSIZE */
|
||||
|
||||
/*
|
||||
These macros are critical to the usage of Windows Sockets.
|
||||
According to the documentation, a SOCKET is no longer represented
|
||||
by a "small non-negative integer"; so all programs MUST use these
|
||||
macros for setting, initializing, clearing and checking the
|
||||
fd_set structures.
|
||||
*/
|
||||
|
||||
typedef u_int SOCKET;
|
||||
|
||||
/* fd_set may have been defined by the newlib <sys/types.h>. */
|
||||
#ifdef fd_set
|
||||
#undef fd_set
|
||||
#endif
|
||||
typedef struct fd_set {
|
||||
u_int fd_count;
|
||||
SOCKET fd_array[FD_SETSIZE];
|
||||
} fd_set;
|
||||
|
||||
/* Internal function, not documented except in winsock.h */
|
||||
extern int PASCAL __WSAFDIsSet(SOCKET, fd_set*);
|
||||
|
||||
#ifdef FD_CLR
|
||||
#undef FD_CLR
|
||||
#endif
|
||||
#define FD_CLR(fd, set) do { \
|
||||
u_int __i; \
|
||||
for (__i = 0; __i < ((fd_set*)(set))->fd_count ; __i++) { \
|
||||
if (((fd_set*)(set))->fd_array[__i] == fd) { \
|
||||
while (__i < ((fd_set*)(set))->fd_count-1) { \
|
||||
((fd_set*)(set))->fd_array[__i] = \
|
||||
((fd_set*)(set))->fd_array[__i+1]; \
|
||||
__i++; \
|
||||
} \
|
||||
((fd_set*)(set))->fd_count--; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#ifdef FD_SET
|
||||
#undef FD_SET
|
||||
#endif
|
||||
#define FD_SET(fd, set) do { \
|
||||
if (((fd_set*)(set))->fd_count < FD_SETSIZE) \
|
||||
((fd_set*)(set))->fd_array[((fd_set*)(set))->fd_count++]=(fd);\
|
||||
} while(0)
|
||||
|
||||
#ifdef FD_ZERO
|
||||
#undef FD_ZERO
|
||||
#endif
|
||||
#define FD_ZERO(set) (((fd_set*)(set))->fd_count=0)
|
||||
|
||||
#ifdef FD_ISSET
|
||||
#undef FD_ISSET
|
||||
#endif
|
||||
#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set))
|
||||
|
||||
/*
|
||||
time structures
|
||||
*/
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* microseconds */
|
||||
};
|
||||
struct timezone {
|
||||
int tz_minuteswest; /* minutes west of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
/*
|
||||
Operations on timevals.
|
||||
|
||||
NB: timercmp does not work for >= or <=.
|
||||
*/
|
||||
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
|
||||
#define timercmp(tvp, uvp, cmp) \
|
||||
(((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) \
|
||||
|| (tvp)->tv_sec cmp (uvp)->tv_sec)
|
||||
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
|
||||
|
||||
/*
|
||||
ioctl command encoding.
|
||||
Some of this is different than what Linux has
|
||||
*/
|
||||
#define IOCPARM_MASK 0x7f
|
||||
#define IOC_VOID 0x20000000
|
||||
#define IOC_OUT 0x40000000
|
||||
#define IOC_IN 0x80000000
|
||||
#define IOC_INOUT (IOC_IN | IOC_OUT)
|
||||
|
||||
/* _IO(magic, subcode) */
|
||||
#define _IO(c,d) (IOC_VOID | ((c)<<8) | (d))
|
||||
/* _IOXX(magic, subcode, arg_t) */
|
||||
#define _IOW(c,d,t) (IOC_IN | (((long)sizeof(t) & IOCPARM_MASK)<<16) | \
|
||||
((c)<<8) | (d))
|
||||
#define _IOR(c,d,t) (IOC_OUT | (((long)sizeof(t) & IOCPARM_MASK)<<16) | \
|
||||
((c)<<8) | (d))
|
||||
|
||||
/*
|
||||
This stuff is hard-coded on Linux
|
||||
But winsock.h uses the macros defined above
|
||||
*/
|
||||
#define FIONREAD _IOR('f', 127, u_long)
|
||||
#define FIONBIO _IOW('f', 126, u_long)
|
||||
#define FIOASYNC _IOW('f', 125, u_long)
|
||||
|
||||
#define SIOCSHIWAT _IOW('s', 0, u_long)
|
||||
#define SIOCGHIWAT _IOR('s', 1, u_long)
|
||||
#define SIOCSLOWAT _IOW('s', 2, u_long)
|
||||
#define SIOCGLOWAT _IOR('s', 3, u_long)
|
||||
#define SIOCATMARK _IOR('s', 7, u_long)
|
||||
|
||||
/*
|
||||
Structures returned by network data base library, taken from the
|
||||
BSD file netdb.h. All addresses are supplied in host order, and
|
||||
returned in network order (suitable for use in system calls).
|
||||
|
||||
Slight modifications for differences between Linux and winsock.h
|
||||
*/
|
||||
|
||||
struct hostent {
|
||||
char *h_name; /* official name of host */
|
||||
char **h_aliases; /* alias list */
|
||||
short h_addrtype; /* host address type */
|
||||
short h_length; /* length of address */
|
||||
char **h_addr_list; /* list of addresses */
|
||||
#define h_addr h_addr_list[0] /* address, for backward compat */
|
||||
};
|
||||
|
||||
/*
|
||||
* Assumption here is that a network number
|
||||
* fits in an unsigned long -- someday that won't be true!
|
||||
*/
|
||||
struct netent {
|
||||
char *n_name; /* official name of net */
|
||||
char **n_aliases; /* alias list */
|
||||
short n_addrtype; /* net address type */
|
||||
u_long n_net; /* network # */
|
||||
};
|
||||
|
||||
struct servent {
|
||||
char *s_name; /* official service name */
|
||||
char **s_aliases; /* alias list */
|
||||
short s_port; /* port # */
|
||||
char *s_proto; /* protocol to use */
|
||||
};
|
||||
|
||||
struct protoent {
|
||||
char *p_name; /* official protocol name */
|
||||
char **p_aliases; /* alias list */
|
||||
short p_proto; /* protocol # */
|
||||
};
|
||||
|
||||
/*
|
||||
Standard well-known IP protocols.
|
||||
For some reason there are differences between Linx and winsock.h
|
||||
*/
|
||||
enum {
|
||||
IPPROTO_IP = 0,
|
||||
IPPROTO_ICMP = 1,
|
||||
IPPROTO_GGP = 2, /* huh? */
|
||||
IPPROTO_IPIP = 4,
|
||||
IPPROTO_TCP = 6, /* Transmission Control Protocol */
|
||||
IPPROTO_EGP = 8,
|
||||
IPPROTO_PUP = 12,
|
||||
IPPROTO_UDP = 17, /* User Datagram Protocol */
|
||||
IPPROTO_IDP = 22,
|
||||
IPPROTO_ND = 77, /* This one was in winsock.h */
|
||||
|
||||
IPPROTO_RAW = 255, /* raw IP packets */
|
||||
IPPROTO_MAX
|
||||
};
|
||||
|
||||
/* Standard well-known ports */
|
||||
enum {
|
||||
IPPORT_ECHO = 7,
|
||||
IPPORT_DISCARD = 9,
|
||||
IPPORT_SYSTAT = 11,
|
||||
IPPORT_DAYTIME = 13,
|
||||
IPPORT_NETSTAT = 15,
|
||||
IPPORT_FTP = 21,
|
||||
IPPORT_TELNET = 23,
|
||||
IPPORT_SMTP = 25,
|
||||
IPPORT_TIMESERVER = 37,
|
||||
IPPORT_NAMESERVER = 42,
|
||||
IPPORT_WHOIS = 43,
|
||||
IPPORT_MTP = 57,
|
||||
|
||||
IPPORT_TFTP = 69,
|
||||
IPPORT_RJE = 77,
|
||||
IPPORT_FINGER = 79,
|
||||
IPPORT_TTYLINK = 87,
|
||||
IPPORT_SUPDUP = 95,
|
||||
|
||||
IPPORT_EXECSERVER = 512,
|
||||
IPPORT_LOGINSERVER = 513,
|
||||
IPPORT_CMDSERVER = 514,
|
||||
IPPORT_EFSSERVER = 520,
|
||||
|
||||
/* UDP ports. */
|
||||
IPPORT_BIFFUDP = 512,
|
||||
IPPORT_WHOSERVER = 513,
|
||||
IPPORT_ROUTESERVER = 520,
|
||||
|
||||
/* Ports less than this value are reservered for privileged processes. */
|
||||
IPPORT_RESERVED = 1024,
|
||||
|
||||
/* Ports greater than this value are reserved for
|
||||
(non-privileged) processes */
|
||||
IPPORT_USERRESERVED = 5000
|
||||
};
|
||||
|
||||
/* Link numbers. */
|
||||
#define IMPLINK_IP 155
|
||||
#define IMPLINK_LOWEXPER 156
|
||||
#define IMPLINK_HIGHEXPER 158
|
||||
|
||||
/* Linux uses a simple unsigned long int, but winsock.h ... */
|
||||
struct in_addr {
|
||||
union {
|
||||
struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
|
||||
struct { u_short s_w1,s_w2; } S_un_w;
|
||||
u_long S_addr;
|
||||
} S_un;
|
||||
#define s_addr S_un.S_addr
|
||||
#define s_host S_un.S_un_b.s_b2
|
||||
#define s_net S_un.S_un_b.s_b1
|
||||
#define s_imp S_un.S_un_w.s_w2
|
||||
#define s_impno S_un.S_un_b.s_b4
|
||||
#define s_lh S_un.S_un_b.s_b3
|
||||
};
|
||||
|
||||
/*
|
||||
Definitions of bits in internet address integers.
|
||||
On subnets, host and network parts are found according
|
||||
to the subnet mask, not these masks.
|
||||
*/
|
||||
#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
|
||||
#define IN_CLASSA_NET 0xff000000
|
||||
#define IN_CLASSA_NSHIFT 24
|
||||
#define IN_CLASSA_HOST 0x00ffffff
|
||||
#define IN_CLASSA_MAX 128
|
||||
|
||||
#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
|
||||
#define IN_CLASSB_NET 0xffff0000
|
||||
#define IN_CLASSB_NSHIFT 16
|
||||
#define IN_CLASSB_HOST 0x0000ffff
|
||||
#define IN_CLASSB_MAX 65536
|
||||
|
||||
#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
|
||||
#define IN_CLASSC_NET 0xffffff00
|
||||
#define IN_CLASSC_NSHIFT 8
|
||||
#define IN_CLASSC_HOST 0x000000ff
|
||||
|
||||
#define INADDR_ANY (u_long)0x00000000
|
||||
#define INADDR_LOOPBACK 0x7f000001
|
||||
#define INADDR_BROADCAST (u_long)0xffffffff
|
||||
#define INADDR_NONE 0xffffffff
|
||||
|
||||
/*
|
||||
Structure describing an Internet (IP) socket address.
|
||||
*/
|
||||
struct sockaddr_in {
|
||||
short sin_family;
|
||||
u_short sin_port;
|
||||
struct in_addr sin_addr;
|
||||
char sin_zero[8];
|
||||
};
|
||||
|
||||
/*
|
||||
EVERYTHING FROM THIS POINT IS MAINLY SPECIFIC TO Win32
|
||||
|
||||
Structure which holds the detail for the underlying Window Sockets
|
||||
implementation. Set when WSAStartup() is called.
|
||||
*/
|
||||
#define WSADESCRIPTION_LEN 256
|
||||
#define WSASYS_STATUS_LEN 128
|
||||
|
||||
typedef struct WSAData {
|
||||
WORD wVersion;
|
||||
WORD wHighVersion;
|
||||
char szDescription[WSADESCRIPTION_LEN+1];
|
||||
char szSystemStatus[WSASYS_STATUS_LEN+1];
|
||||
unsigned short iMaxSockets;
|
||||
unsigned short iMaxUdpDg;
|
||||
char *lpVendorInfo;
|
||||
} WSADATA, *LPWSADATA;
|
||||
|
||||
#define IP_OPTIONS 1
|
||||
#define IP_MULTICAST_IF 2
|
||||
#define IP_MULTICAST_TTL 3
|
||||
#define IP_MULTICAST_LOOP 4
|
||||
#define IP_ADD_MEMBERSHIP 5
|
||||
#define IP_DROP_MEMBERSHIP 6
|
||||
|
||||
#define IP_DEFAULT_MULTICAST_TTL 1
|
||||
#define IP_DEFAULT_MULTICAST_LOOP 1
|
||||
#define IP_MAX_MEMBERSHIPS 20
|
||||
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr;
|
||||
struct in_addr imr_interface;
|
||||
};
|
||||
|
||||
/*
|
||||
* Definitions related to sockets: types, address families, options,
|
||||
* taken from the BSD file sys/socket.h.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is used instead of -1, since the
|
||||
* SOCKET type is unsigned.
|
||||
*/
|
||||
#define INVALID_SOCKET (SOCKET)(~0)
|
||||
#define SOCKET_ERROR (-1)
|
||||
|
||||
/* Socket types. */
|
||||
#define SOCK_STREAM 1
|
||||
#define SOCK_DGRAM 2
|
||||
#define SOCK_RAW 3
|
||||
#define SOCK_RDM 4
|
||||
#define SOCK_SEQPACKET 5
|
||||
|
||||
/* For setsockoptions(2) */
|
||||
#define SO_DEBUG 0x0001
|
||||
#define SO_ACCEPTCONN 0x0002
|
||||
#define SO_REUSEADDR 0x0004
|
||||
#define SO_KEEPALIVE 0x0008
|
||||
#define SO_DONTROUTE 0x0010
|
||||
#define SO_BROADCAST 0x0020
|
||||
#define SO_USELOOPBACK 0x0040
|
||||
#define SO_LINGER 0x0080
|
||||
#define SO_OOBINLINE 0x0100
|
||||
|
||||
#define SO_DONTLINGER (u_int)(~SO_LINGER)
|
||||
|
||||
/*
|
||||
* Additional options.
|
||||
*/
|
||||
#define SO_SNDBUF 0x1001 /* send buffer size */
|
||||
#define SO_RCVBUF 0x1002 /* receive buffer size */
|
||||
#define SO_SNDLOWAT 0x1003 /* send low-water mark */
|
||||
#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
|
||||
#define SO_SNDTIMEO 0x1005 /* send timeout */
|
||||
#define SO_RCVTIMEO 0x1006 /* receive timeout */
|
||||
#define SO_ERROR 0x1007 /* get error status and clear */
|
||||
#define SO_TYPE 0x1008 /* get socket type */
|
||||
|
||||
/*
|
||||
* Options for connect and disconnect data and options. Used only by
|
||||
* non-TCP/IP transports such as DECNet, OSI TP4, etc.
|
||||
*/
|
||||
#define SO_CONNDATA 0x7000
|
||||
#define SO_CONNOPT 0x7001
|
||||
#define SO_DISCDATA 0x7002
|
||||
#define SO_DISCOPT 0x7003
|
||||
#define SO_CONNDATALEN 0x7004
|
||||
#define SO_CONNOPTLEN 0x7005
|
||||
#define SO_DISCDATALEN 0x7006
|
||||
#define SO_DISCOPTLEN 0x7007
|
||||
|
||||
/*
|
||||
* Option for opening sockets for synchronous access.
|
||||
*/
|
||||
#define SO_OPENTYPE 0x7008
|
||||
|
||||
#define SO_SYNCHRONOUS_ALERT 0x10
|
||||
#define SO_SYNCHRONOUS_NONALERT 0x20
|
||||
|
||||
/*
|
||||
* Other NT-specific options.
|
||||
*/
|
||||
#define SO_MAXDG 0x7009
|
||||
#define SO_MAXPATHDG 0x700A
|
||||
|
||||
/*
|
||||
* TCP options.
|
||||
*/
|
||||
#define TCP_NODELAY 0x0001
|
||||
#define TCP_BSDURGENT 0x7000
|
||||
|
||||
/*
|
||||
* Address families.
|
||||
*/
|
||||
#define AF_UNSPEC 0 /* unspecified */
|
||||
#define AF_UNIX 1 /* local to host (pipes, portals) */
|
||||
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
|
||||
#define AF_IMPLINK 3 /* arpanet imp addresses */
|
||||
#define AF_PUP 4 /* pup protocols: e.g. BSP */
|
||||
#define AF_CHAOS 5 /* mit CHAOS protocols */
|
||||
#define AF_IPX 6 /* IPX and SPX */
|
||||
#define AF_NS 6 /* XEROX NS protocols */
|
||||
#define AF_ISO 7 /* ISO protocols */
|
||||
#define AF_OSI AF_ISO /* OSI is ISO */
|
||||
#define AF_ECMA 8 /* european computer manufacturers */
|
||||
#define AF_DATAKIT 9 /* datakit protocols */
|
||||
#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
|
||||
#define AF_SNA 11 /* IBM SNA */
|
||||
#define AF_DECnet 12 /* DECnet */
|
||||
#define AF_DLI 13 /* Direct data link interface */
|
||||
#define AF_LAT 14 /* LAT */
|
||||
#define AF_HYLINK 15 /* NSC Hyperchannel */
|
||||
#define AF_APPLETALK 16 /* AppleTalk */
|
||||
#define AF_NETBIOS 17 /* NetBios-style addresses */
|
||||
|
||||
#define AF_MAX 18
|
||||
|
||||
/*
|
||||
* Structure used by kernel to store most
|
||||
* addresses.
|
||||
*/
|
||||
struct sockaddr {
|
||||
u_short sa_family;
|
||||
char sa_data[14];
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure used by kernel to pass protocol
|
||||
* information in raw sockets.
|
||||
*/
|
||||
struct sockproto {
|
||||
u_short sp_family;
|
||||
u_short sp_protocol;
|
||||
};
|
||||
|
||||
/*
|
||||
* Protocol families, same as address families for now.
|
||||
*/
|
||||
#define PF_UNSPEC AF_UNSPEC
|
||||
#define PF_UNIX AF_UNIX
|
||||
#define PF_INET AF_INET
|
||||
#define PF_IMPLINK AF_IMPLINK
|
||||
#define PF_PUP AF_PUP
|
||||
#define PF_CHAOS AF_CHAOS
|
||||
#define PF_NS AF_NS
|
||||
#define PF_IPX AF_IPX
|
||||
#define PF_ISO AF_ISO
|
||||
#define PF_OSI AF_OSI
|
||||
#define PF_ECMA AF_ECMA
|
||||
#define PF_DATAKIT AF_DATAKIT
|
||||
#define PF_CCITT AF_CCITT
|
||||
#define PF_SNA AF_SNA
|
||||
#define PF_DECnet AF_DECnet
|
||||
#define PF_DLI AF_DLI
|
||||
#define PF_LAT AF_LAT
|
||||
#define PF_HYLINK AF_HYLINK
|
||||
#define PF_APPLETALK AF_APPLETALK
|
||||
|
||||
#define PF_MAX AF_MAX
|
||||
|
||||
/*
|
||||
* Structure used for manipulating linger option.
|
||||
*/
|
||||
struct linger {
|
||||
u_short l_onoff;
|
||||
u_short l_linger;
|
||||
};
|
||||
|
||||
/*
|
||||
* Level number for (get/set)sockopt() to apply to socket itself.
|
||||
*/
|
||||
#define SOL_SOCKET 0xffff /* options for socket level */
|
||||
|
||||
/*
|
||||
* Maximum queue length specifiable by listen.
|
||||
*/
|
||||
#define SOMAXCONN 5
|
||||
|
||||
#define MSG_OOB 0x1 /* process out-of-band data */
|
||||
#define MSG_PEEK 0x2 /* peek at incoming message */
|
||||
#define MSG_DONTROUTE 0x4 /* send without using routing tables */
|
||||
|
||||
#define MSG_MAXIOVLEN 16
|
||||
|
||||
#define MSG_PARTIAL 0x8000 /* partial send or recv for message xport */
|
||||
|
||||
/*
|
||||
* Define constant based on rfc883, used by gethostbyxxxx() calls.
|
||||
*/
|
||||
#define MAXGETHOSTSTRUCT 1024
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN MAXGETHOSTSTRUCT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define flags to be used with the WSAAsyncSelect() call.
|
||||
*/
|
||||
#define FD_READ 0x01
|
||||
#define FD_WRITE 0x02
|
||||
#define FD_OOB 0x04
|
||||
#define FD_ACCEPT 0x08
|
||||
#define FD_CONNECT 0x10
|
||||
#define FD_CLOSE 0x20
|
||||
|
||||
/*
|
||||
* All Windows Sockets error constants are biased by WSABASEERR from
|
||||
* the "normal"
|
||||
*/
|
||||
#define WSABASEERR 10000
|
||||
/*
|
||||
* Windows Sockets definitions of regular Microsoft C error constants
|
||||
*/
|
||||
#define WSAEINTR (WSABASEERR+4)
|
||||
#define WSAEBADF (WSABASEERR+9)
|
||||
#define WSAEACCES (WSABASEERR+13)
|
||||
#define WSAEFAULT (WSABASEERR+14)
|
||||
#define WSAEINVAL (WSABASEERR+22)
|
||||
#define WSAEMFILE (WSABASEERR+24)
|
||||
|
||||
/*
|
||||
* Windows Sockets definitions of regular Berkeley error constants
|
||||
*/
|
||||
#define WSAEWOULDBLOCK (WSABASEERR+35)
|
||||
#define WSAEINPROGRESS (WSABASEERR+36)
|
||||
#define WSAEALREADY (WSABASEERR+37)
|
||||
#define WSAENOTSOCK (WSABASEERR+38)
|
||||
#define WSAEDESTADDRREQ (WSABASEERR+39)
|
||||
#define WSAEMSGSIZE (WSABASEERR+40)
|
||||
#define WSAEPROTOTYPE (WSABASEERR+41)
|
||||
#define WSAENOPROTOOPT (WSABASEERR+42)
|
||||
#define WSAEPROTONOSUPPORT (WSABASEERR+43)
|
||||
#define WSAESOCKTNOSUPPORT (WSABASEERR+44)
|
||||
#define WSAEOPNOTSUPP (WSABASEERR+45)
|
||||
#define WSAEPFNOSUPPORT (WSABASEERR+46)
|
||||
#define WSAEAFNOSUPPORT (WSABASEERR+47)
|
||||
#define WSAEADDRINUSE (WSABASEERR+48)
|
||||
#define WSAEADDRNOTAVAIL (WSABASEERR+49)
|
||||
#define WSAENETDOWN (WSABASEERR+50)
|
||||
#define WSAENETUNREACH (WSABASEERR+51)
|
||||
#define WSAENETRESET (WSABASEERR+52)
|
||||
#define WSAECONNABORTED (WSABASEERR+53)
|
||||
#define WSAECONNRESET (WSABASEERR+54)
|
||||
#define WSAENOBUFS (WSABASEERR+55)
|
||||
#define WSAEISCONN (WSABASEERR+56)
|
||||
#define WSAENOTCONN (WSABASEERR+57)
|
||||
#define WSAESHUTDOWN (WSABASEERR+58)
|
||||
#define WSAETOOMANYREFS (WSABASEERR+59)
|
||||
#define WSAETIMEDOUT (WSABASEERR+60)
|
||||
#define WSAECONNREFUSED (WSABASEERR+61)
|
||||
#define WSAELOOP (WSABASEERR+62)
|
||||
#define WSAENAMETOOLONG (WSABASEERR+63)
|
||||
#define WSAEHOSTDOWN (WSABASEERR+64)
|
||||
#define WSAEHOSTUNREACH (WSABASEERR+65)
|
||||
#define WSAENOTEMPTY (WSABASEERR+66)
|
||||
#define WSAEPROCLIM (WSABASEERR+67)
|
||||
#define WSAEUSERS (WSABASEERR+68)
|
||||
#define WSAEDQUOT (WSABASEERR+69)
|
||||
#define WSAESTALE (WSABASEERR+70)
|
||||
#define WSAEREMOTE (WSABASEERR+71)
|
||||
|
||||
#define WSAEDISCON (WSABASEERR+101)
|
||||
|
||||
/*
|
||||
* Extended Windows Sockets error constant definitions
|
||||
*/
|
||||
#define WSASYSNOTREADY (WSABASEERR+91)
|
||||
#define WSAVERNOTSUPPORTED (WSABASEERR+92)
|
||||
#define WSANOTINITIALISED (WSABASEERR+93)
|
||||
|
||||
/*
|
||||
* Error return codes from gethostbyname() and gethostbyaddr()
|
||||
* (when using the resolver). Note that these errors are
|
||||
* retrieved via WSAGetLastError() and must therefore follow
|
||||
* the rules for avoiding clashes with error numbers from
|
||||
* specific implementations or language run-time systems.
|
||||
* For this reason the codes are based at WSABASEERR+1001.
|
||||
* Note also that [WSA]NO_ADDRESS is defined only for
|
||||
* compatibility purposes.
|
||||
*/
|
||||
|
||||
#define h_errno WSAGetLastError()
|
||||
|
||||
/* Authoritative Answer: Host not found */
|
||||
#define WSAHOST_NOT_FOUND (WSABASEERR+1001)
|
||||
#define HOST_NOT_FOUND WSAHOST_NOT_FOUND
|
||||
|
||||
/* Non-Authoritative: Host not found, or SERVERFAIL */
|
||||
#define WSATRY_AGAIN (WSABASEERR+1002)
|
||||
#define TRY_AGAIN WSATRY_AGAIN
|
||||
|
||||
/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
||||
#define WSANO_RECOVERY (WSABASEERR+1003)
|
||||
#define NO_RECOVERY WSANO_RECOVERY
|
||||
|
||||
/* Valid name, no data record of requested type */
|
||||
#define WSANO_DATA (WSABASEERR+1004)
|
||||
#define NO_DATA WSANO_DATA
|
||||
|
||||
/* no address, look for MX record */
|
||||
#define WSANO_ADDRESS WSANO_DATA
|
||||
#define NO_ADDRESS WSANO_ADDRESS
|
||||
|
||||
/*
|
||||
* Windows Sockets errors redefined as regular Berkeley error constants.
|
||||
* These are commented out in Windows NT to avoid conflicts with errno.h.
|
||||
* Use the WSA constants instead.
|
||||
*/
|
||||
#if 0
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EALREADY WSAEALREADY
|
||||
#define ENOTSOCK WSAENOTSOCK
|
||||
#define EDESTADDRREQ WSAEDESTADDRREQ
|
||||
#define EMSGSIZE WSAEMSGSIZE
|
||||
#define EPROTOTYPE WSAEPROTOTYPE
|
||||
#define ENOPROTOOPT WSAENOPROTOOPT
|
||||
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
||||
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
||||
#define EOPNOTSUPP WSAEOPNOTSUPP
|
||||
#define EPFNOSUPPORT WSAEPFNOSUPPORT
|
||||
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
#define EADDRINUSE WSAEADDRINUSE
|
||||
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
#define ENETDOWN WSAENETDOWN
|
||||
#define ENETUNREACH WSAENETUNREACH
|
||||
#define ENETRESET WSAENETRESET
|
||||
#define ECONNABORTED WSAECONNABORTED
|
||||
#define ECONNRESET WSAECONNRESET
|
||||
#define ENOBUFS WSAENOBUFS
|
||||
#define EISCONN WSAEISCONN
|
||||
#define ENOTCONN WSAENOTCONN
|
||||
#define ESHUTDOWN WSAESHUTDOWN
|
||||
#define ETOOMANYREFS WSAETOOMANYREFS
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#define ECONNREFUSED WSAECONNREFUSED
|
||||
#define ELOOP WSAELOOP
|
||||
#define ENAMETOOLONG WSAENAMETOOLONG
|
||||
#define EHOSTDOWN WSAEHOSTDOWN
|
||||
#define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#define ENOTEMPTY WSAENOTEMPTY
|
||||
#define EPROCLIM WSAEPROCLIM
|
||||
#define EUSERS WSAEUSERS
|
||||
#define EDQUOT WSAEDQUOT
|
||||
#define ESTALE WSAESTALE
|
||||
#define EREMOTE WSAEREMOTE
|
||||
#endif
|
||||
|
||||
/* Socket function prototypes */
|
||||
|
||||
SOCKET PASCAL accept (SOCKET s, struct sockaddr *addr,
|
||||
int *addrlen);
|
||||
|
||||
int PASCAL bind (SOCKET s, const struct sockaddr *addr, int namelen);
|
||||
|
||||
int PASCAL closesocket (SOCKET s);
|
||||
|
||||
int PASCAL connect (SOCKET s, const struct sockaddr *name, int namelen);
|
||||
|
||||
int PASCAL ioctlsocket (SOCKET s, long cmd, u_long *argp);
|
||||
|
||||
int PASCAL getpeername (SOCKET s, struct sockaddr *name,
|
||||
int * namelen);
|
||||
|
||||
int PASCAL getsockname (SOCKET s, struct sockaddr *name,
|
||||
int * namelen);
|
||||
|
||||
int PASCAL getsockopt (SOCKET s, int level, int optname,
|
||||
char * optval, int *optlen);
|
||||
|
||||
u_long PASCAL htonl (u_long hostlong);
|
||||
|
||||
/* For some reason WSOCK.LIB has htons defined as a 4 byte paramter?! */
|
||||
#ifdef _WIN32
|
||||
u_short PASCAL htons (u_long hostshort);
|
||||
#else
|
||||
u_short PASCAL htons (u_short hostshort);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
unsigned long PASCAL inet_addr (const char * cp);
|
||||
|
||||
char * PASCAL inet_ntoa (struct in_addr in);
|
||||
|
||||
int PASCAL listen (SOCKET s, int backlog);
|
||||
|
||||
u_long PASCAL ntohl (u_long netlong);
|
||||
|
||||
/* For some reason WSOCK.LIB has ntohs defined as a 4 byte paramter?! */
|
||||
#ifdef _WIN32
|
||||
u_short PASCAL ntohs (u_long netshort);
|
||||
#else
|
||||
u_short PASCAL ntohs (u_short netshort);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
int PASCAL recv (SOCKET s, char * buf, int len, int flags);
|
||||
|
||||
int PASCAL recvfrom (SOCKET s, char * buf, int len, int flags,
|
||||
struct sockaddr *from, int * fromlen);
|
||||
|
||||
int PASCAL select (int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, const struct timeval *timeout);
|
||||
|
||||
int PASCAL send (SOCKET s, const char * buf, int len, int flags);
|
||||
|
||||
int PASCAL sendto (SOCKET s, const char * buf, int len, int flags,
|
||||
const struct sockaddr *to, int tolen);
|
||||
|
||||
int PASCAL setsockopt (SOCKET s, int level, int optname,
|
||||
const char * optval, int optlen);
|
||||
|
||||
int PASCAL shutdown (SOCKET s, int how);
|
||||
|
||||
SOCKET PASCAL socket (int af, int type, int protocol);
|
||||
|
||||
/* Database function prototypes */
|
||||
|
||||
struct hostent * PASCAL gethostbyaddr(const char * addr,
|
||||
int len, int type);
|
||||
|
||||
struct hostent * PASCAL gethostbyname(const char * name);
|
||||
|
||||
int PASCAL gethostname (char * name, int namelen);
|
||||
|
||||
struct servent * PASCAL getservbyport(int port, const char * proto);
|
||||
|
||||
struct servent * PASCAL getservbyname(const char * name,
|
||||
const char * proto);
|
||||
|
||||
struct protoent * PASCAL getprotobynumber(int proto);
|
||||
|
||||
struct protoent * PASCAL getprotobyname(const char * name);
|
||||
|
||||
/* Microsoft Windows Extension function prototypes */
|
||||
|
||||
/* int PASCAL WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData); */
|
||||
int PASCAL WSAStartup(int wVersionRequired, LPWSADATA lpWSAData);
|
||||
|
||||
|
||||
int PASCAL WSACleanup(void);
|
||||
|
||||
void PASCAL WSASetLastError(int iError);
|
||||
|
||||
int PASCAL WSAGetLastError(void);
|
||||
|
||||
WINBOOL PASCAL WSAIsBlocking(void);
|
||||
|
||||
int PASCAL WSAUnhookBlockingHook(void);
|
||||
|
||||
FARPROC PASCAL WSASetBlockingHook(FARPROC lpBlockFunc);
|
||||
|
||||
int PASCAL WSACancelBlockingCall(void);
|
||||
|
||||
HANDLE PASCAL WSAAsyncGetServByName(HWND hWnd, u_int wMsg,
|
||||
const char * name,
|
||||
const char * proto,
|
||||
char * buf, int buflen);
|
||||
|
||||
HANDLE PASCAL WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, int port,
|
||||
const char * proto, char * buf,
|
||||
int buflen);
|
||||
|
||||
HANDLE PASCAL WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg,
|
||||
const char * name, char * buf,
|
||||
int buflen);
|
||||
|
||||
HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg,
|
||||
int number, char * buf,
|
||||
int buflen);
|
||||
|
||||
HANDLE PASCAL WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
|
||||
const char * name, char * buf,
|
||||
int buflen);
|
||||
|
||||
HANDLE PASCAL WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg,
|
||||
const char * addr, int len, int type,
|
||||
char * buf, int buflen);
|
||||
|
||||
int PASCAL WSACancelAsyncRequest(HANDLE hAsyncTaskHandle);
|
||||
|
||||
int PASCAL WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg,
|
||||
long lEvent);
|
||||
|
||||
int PASCAL WSARecvEx (SOCKET s, char * buf, int len, int *flags);
|
||||
|
||||
/* Microsoft Windows Extended data types */
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
typedef struct sockaddr *PSOCKADDR;
|
||||
typedef struct sockaddr *LPSOCKADDR;
|
||||
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
typedef struct sockaddr_in *PSOCKADDR_IN;
|
||||
typedef struct sockaddr_in *LPSOCKADDR_IN;
|
||||
|
||||
typedef struct linger LINGER;
|
||||
typedef struct linger *PLINGER;
|
||||
typedef struct linger *LPLINGER;
|
||||
|
||||
typedef struct in_addr IN_ADDR;
|
||||
typedef struct in_addr *PIN_ADDR;
|
||||
typedef struct in_addr *LPIN_ADDR;
|
||||
|
||||
typedef struct fd_set FD_SET;
|
||||
typedef struct fd_set *PFD_SET;
|
||||
typedef struct fd_set *LPFD_SET;
|
||||
|
||||
typedef struct hostent HOSTENT;
|
||||
typedef struct hostent *PHOSTENT;
|
||||
typedef struct hostent *LPHOSTENT;
|
||||
|
||||
typedef struct servent SERVENT;
|
||||
typedef struct servent *PSERVENT;
|
||||
typedef struct servent *LPSERVENT;
|
||||
|
||||
typedef struct protoent PROTOENT;
|
||||
typedef struct protoent *PPROTOENT;
|
||||
typedef struct protoent *LPPROTOENT;
|
||||
|
||||
typedef struct timeval TIMEVAL;
|
||||
typedef struct timeval *PTIMEVAL;
|
||||
typedef struct timeval *LPTIMEVAL;
|
||||
|
||||
/*
|
||||
* Windows message parameter composition and decomposition
|
||||
* macros.
|
||||
*
|
||||
* WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
|
||||
* when constructing the response to a WSAAsyncGetXByY() routine.
|
||||
*/
|
||||
#define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error)
|
||||
/*
|
||||
* WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
|
||||
* when constructing the response to WSAAsyncSelect().
|
||||
*/
|
||||
#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error)
|
||||
/*
|
||||
* WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
|
||||
* to extract the buffer length from the lParam in the response
|
||||
* to a WSAGetXByY().
|
||||
*/
|
||||
#define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam)
|
||||
/*
|
||||
* WSAGETASYNCERROR is intended for use by the Windows Sockets application
|
||||
* to extract the error code from the lParam in the response
|
||||
* to a WSAGetXByY().
|
||||
*/
|
||||
#define WSAGETASYNCERROR(lParam) HIWORD(lParam)
|
||||
/*
|
||||
* WSAGETSELECTEVENT is intended for use by the Windows Sockets application
|
||||
* to extract the event code from the lParam in the response
|
||||
* to a WSAAsyncSelect().
|
||||
*/
|
||||
#define WSAGETSELECTEVENT(lParam) LOWORD(lParam)
|
||||
/*
|
||||
* WSAGETSELECTERROR is intended for use by the Windows Sockets application
|
||||
* to extract the error code from the lParam in the response
|
||||
* to a WSAAsyncSelect().
|
||||
*/
|
||||
#define WSAGETSELECTERROR(lParam) HIWORD(lParam)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _GNU_H_WINDOWS32_SOCKETS */
|
778
reactos/include/string.h
Normal file
778
reactos/include/string.h
Normal file
@@ -0,0 +1,778 @@
|
||||
/*
|
||||
* Adapted from linux for the reactos kernel, march 1998 -- David Welch
|
||||
* Removed extern specifier from ___strtok and ___wcstok, june 1998 -- Boudewijn Dekker
|
||||
* Added stricmp and strnicmp -- Boudewijn Dekker
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _LINUX_STRING_H_
|
||||
#define _LINUX_STRING_H_
|
||||
|
||||
#include <types.h> /* for size_t */
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
char * ___strtok; // removed extern specifier 02-06-98, BD
|
||||
|
||||
extern char * strcpy(char *,const char *);
|
||||
extern char * strncpy(char *,const char *, __kernel_size_t);
|
||||
extern char * strcat(char *, const char *);
|
||||
extern char * strncat(char *, const char *, __kernel_size_t);
|
||||
extern char * strchr(const char *,int);
|
||||
extern char * strrchr(const char *,int);
|
||||
extern char * strpbrk(const char *,const char *);
|
||||
extern char * strtok(char *,const char *);
|
||||
extern char * strstr(const char *,const char *);
|
||||
extern __kernel_size_t strlen(const char *);
|
||||
extern __kernel_size_t strnlen(const char *,__kernel_size_t);
|
||||
extern __kernel_size_t strspn(const char *,const char *);
|
||||
extern int strcmp(const char *,const char *);
|
||||
extern int strncmp(const char *,const char *,__kernel_size_t);
|
||||
extern int stricmp(const char* cs,const char * ct);
|
||||
extern int strnicmp(const char* cs,const char * ct, size_t count);
|
||||
|
||||
extern void * memset(void *,int,__kernel_size_t);
|
||||
extern void * memcpy(void *,const void *,__kernel_size_t);
|
||||
extern void * memmove(void *,const void *,__kernel_size_t);
|
||||
extern void * memscan(void *,int,__kernel_size_t);
|
||||
extern int memcmp(const void *,const void *,__kernel_size_t);
|
||||
|
||||
|
||||
/*
|
||||
* Include machine specific inline routines
|
||||
*/
|
||||
#ifndef _I386_STRING_H_
|
||||
#define _I386_STRING_H_
|
||||
|
||||
/*
|
||||
* On a 486 or Pentium, we are better off not using the
|
||||
* byte string operations. But on a 386 or a PPro the
|
||||
* byte string ops are faster than doing it by hand
|
||||
* (MUCH faster on a Pentium).
|
||||
*
|
||||
* Also, the byte strings actually work correctly. Forget
|
||||
* the i486 routines for now as they may be broken..
|
||||
*/
|
||||
#if FIXED_486_STRING && (CPU == 486 || CPU == 586)
|
||||
#include <asm/string-486.h>
|
||||
#else
|
||||
|
||||
/*
|
||||
* This string-include defines all string functions as inline
|
||||
* functions. Use gcc. It also assumes ds=es=data space, this should be
|
||||
* normal. Most of the string-functions are rather heavily hand-optimized,
|
||||
* see especially strtok,strstr,str[c]spn. They should work, but are not
|
||||
* very easy to understand. Everything is done entirely within the register
|
||||
* set, making the functions fast and clean. String instructions have been
|
||||
* used through-out, making for "slightly" unclear code :-)
|
||||
*
|
||||
* Copyright (C) 1991, 1992 Linus Torvalds
|
||||
*/
|
||||
|
||||
#define __HAVE_ARCH_STRCPY
|
||||
extern inline char * strcpy(char * dest,const char *src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest):"si","di","ax","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRNCPY
|
||||
extern inline char * strncpy(char * dest,const char *src,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tdecl %2\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"rep\n\t"
|
||||
"stosb\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCAT
|
||||
extern inline char * strcat(char * dest,const char * src)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"decl %1\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRNCAT
|
||||
extern inline char * strncat(char * dest,const char * src,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"decl %1\n\t"
|
||||
"movl %4,%3\n"
|
||||
"1:\tdecl %3\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsb\n\t"
|
||||
"stosb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\txorl %2,%2\n\t"
|
||||
"stosb"
|
||||
: /* no output */
|
||||
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
|
||||
:"si","di","ax","cx","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCMP
|
||||
extern inline int strcmp(const char * cs,const char * ct)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 2f\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"jmp 3f\n"
|
||||
"2:\tsbbl %%eax,%%eax\n\t"
|
||||
"orb $1,%%eax\n"
|
||||
"3:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRNCMP
|
||||
extern inline int strncmp(const char * cs,const char * ct,size_t count)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tdecl %3\n\t"
|
||||
"js 2f\n\t"
|
||||
"lodsb\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 3f\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\txorl %%eax,%%eax\n\t"
|
||||
"jmp 4f\n"
|
||||
"3:\tsbbl %%eax,%%eax\n\t"
|
||||
"orb $1,%%al\n"
|
||||
"4:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCHR
|
||||
extern inline char * strchr(const char * s, int c)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movb %%al,%%ah\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"cmpb %%ah,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"movl $1,%1\n"
|
||||
"2:\tmovl %1,%0\n\t"
|
||||
"decl %0"
|
||||
:"=a" (__res):"S" (s),"0" (c):"si");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRRCHR
|
||||
extern inline char * strrchr(const char * s, int c)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movb %%al,%%ah\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"cmpb %%ah,%%al\n\t"
|
||||
"jne 2f\n\t"
|
||||
"leal -1(%%esi),%0\n"
|
||||
"2:\ttestb %%al,%%al\n\t"
|
||||
"jne 1b"
|
||||
:"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRSPN
|
||||
extern inline size_t strspn(const char * cs, const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 1b\n"
|
||||
"2:\tdecl %0"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"ax","cx","dx","di");
|
||||
return __res-cs;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRCSPN
|
||||
extern inline size_t strcspn(const char * cs, const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 1b\n"
|
||||
"2:\tdecl %0"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"ax","cx","dx","di");
|
||||
return __res-cs;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRPBRK
|
||||
extern inline char * strpbrk(const char * cs,const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 2f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 1b\n\t"
|
||||
"decl %0\n\t"
|
||||
"jmp 3f\n"
|
||||
"2:\txorl %0,%0\n"
|
||||
"3:"
|
||||
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
|
||||
:"ax","cx","dx","di");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRSTR
|
||||
extern inline char * strstr(const char * cs,const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t" \
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
|
||||
"movl %%ecx,%%edx\n"
|
||||
"1:\tmovl %4,%%edi\n\t"
|
||||
"movl %%esi,%%eax\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repe\n\t"
|
||||
"cmpsb\n\t"
|
||||
"je 2f\n\t" /* also works for empty string, see above */
|
||||
"xchgl %%eax,%%esi\n\t"
|
||||
"incl %%esi\n\t"
|
||||
"cmpb $0,-1(%%eax)\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"2:"
|
||||
:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
|
||||
:"cx","dx","di","si");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRLEN
|
||||
extern inline size_t strlen(const char * s)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %0\n\t"
|
||||
"decl %0"
|
||||
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di");
|
||||
return __res;
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_STRTOK
|
||||
extern inline char * strtok(char * s,const char * ct)
|
||||
{
|
||||
register char * __res;
|
||||
__asm__ __volatile__(
|
||||
"testl %1,%1\n\t"
|
||||
"jne 1f\n\t"
|
||||
"testl %0,%0\n\t"
|
||||
"je 8f\n\t"
|
||||
"movl %0,%1\n"
|
||||
"1:\txorl %0,%0\n\t"
|
||||
"movl $-1,%%ecx\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"cld\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"notl %%ecx\n\t"
|
||||
"decl %%ecx\n\t"
|
||||
"je 7f\n\t" /* empty delimiter-string */
|
||||
"movl %%ecx,%%edx\n"
|
||||
"2:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 7f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 2b\n\t"
|
||||
"decl %1\n\t"
|
||||
"cmpb $0,(%1)\n\t"
|
||||
"je 7f\n\t"
|
||||
"movl %1,%0\n"
|
||||
"3:\tlodsb\n\t"
|
||||
"testb %%al,%%al\n\t"
|
||||
"je 5f\n\t"
|
||||
"movl %4,%%edi\n\t"
|
||||
"movl %%edx,%%ecx\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"jne 3b\n\t"
|
||||
"decl %1\n\t"
|
||||
"cmpb $0,(%1)\n\t"
|
||||
"je 5f\n\t"
|
||||
"movb $0,(%1)\n\t"
|
||||
"incl %1\n\t"
|
||||
"jmp 6f\n"
|
||||
"5:\txorl %1,%1\n"
|
||||
"6:\tcmpb $0,(%0)\n\t"
|
||||
"jne 7f\n\t"
|
||||
"xorl %0,%0\n"
|
||||
"7:\ttestl %0,%0\n\t"
|
||||
"jne 8f\n\t"
|
||||
"movl %0,%1\n"
|
||||
"8:"
|
||||
:"=b" (__res),"=S" (___strtok)
|
||||
:"0" (___strtok),"1" (s),"g" (ct)
|
||||
:"ax","cx","dx","di","memory");
|
||||
return __res;
|
||||
}
|
||||
|
||||
|
||||
#define __HAVE_ARCH_STRICMP
|
||||
extern inline int stricmp(const char* cs,const char * ct)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\tmovb (%%esi), %%eax\n\t"
|
||||
"movb (%%edi), %%dl \n\t"
|
||||
"cmpb $0x5A, %%al\n\t"
|
||||
"ja 2f\t\n"
|
||||
"cmpb $0x40, %%al\t\n"
|
||||
"jbe 2f\t\n"
|
||||
"addb $0x20, %%al\t\n"
|
||||
"2:\t cmpb $0x5A, %%dl\t\n"
|
||||
"ja 3f\t\n"
|
||||
"cmpb $0x40, %%dl\t\n"
|
||||
"jbe 3f\t\n"
|
||||
"addb $0x20, %%dl\t\n"
|
||||
"3:\t inc %%esi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"cmpb %%al, %%dl\t\n"
|
||||
"jne 4f\n\t"
|
||||
"cmpb $00, %%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"xorl %%eax,%%eax\n\t"
|
||||
"jmp 5f\n"
|
||||
"4:\tsbbl %%eax,%%eax\n\t"
|
||||
"orb $1,%%eax\n"
|
||||
"5:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
|
||||
#define __HAVE_ARCH_STRNICMP
|
||||
extern inline int strnicmp(const char* cs,const char * ct, size_t count)
|
||||
{
|
||||
register int __res;
|
||||
|
||||
|
||||
__asm__ __volatile__(
|
||||
"cld\n"
|
||||
"1:\t decl %3\n\t"
|
||||
"js 6f\n\t"
|
||||
"movb (%%esi), %%al\n\t"
|
||||
"movb (%%edi), %%dl \n\t"
|
||||
"cmpb $0x5A, %%al\n\t"
|
||||
"ja 2f\t\n"
|
||||
"cmpb $0x40, %%al\t\n"
|
||||
"jbe 2f\t\n"
|
||||
"addb $0x20, %%al\t\n"
|
||||
"2:\t cmpb $0x5A, %%dl\t\n"
|
||||
"ja 3f\t\n"
|
||||
"cmpb $0x40, %%dl\t\n"
|
||||
"jbe 3f\t\n"
|
||||
"addb $0x20, %%dl\t\n"
|
||||
"3:\t inc %%esi\t\n"
|
||||
"inc %%edi\t\n"
|
||||
"cmpb %%al, %%dl\t\n"
|
||||
"jne 4f\n\t"
|
||||
"cmpb $00, %%al\n\t"
|
||||
"jne 1b\n\t"
|
||||
"6:xorl %%eax,%%eax\n\t"
|
||||
"jmp 5f\n"
|
||||
"4:\tsbbl %%eax,%%eax\n\t"
|
||||
"orb $1,%%eax\n"
|
||||
"5:"
|
||||
:"=a" (__res):"S" (cs),"D" (ct), "c" (count):"si","di", "cx");
|
||||
|
||||
|
||||
return __res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern inline void * __memcpy(void * to, const void * from, size_t n)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep ; movsl\n\t"
|
||||
"testb $2,%b1\n\t"
|
||||
"je 1f\n\t"
|
||||
"movsw\n"
|
||||
"1:\ttestb $1,%b1\n\t"
|
||||
"je 2f\n\t"
|
||||
"movsb\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from)
|
||||
: "cx","di","si","memory");
|
||||
return (to);
|
||||
}
|
||||
|
||||
/*
|
||||
* This looks horribly ugly, but the compiler can optimize it totally,
|
||||
* as the count is constant.
|
||||
*/
|
||||
extern inline void * __constant_memcpy(void * to, const void * from, size_t n)
|
||||
{
|
||||
switch (n) {
|
||||
case 0:
|
||||
return to;
|
||||
case 1:
|
||||
*(unsigned char *)to = *(const unsigned char *)from;
|
||||
return to;
|
||||
case 2:
|
||||
*(unsigned short *)to = *(const unsigned short *)from;
|
||||
return to;
|
||||
case 3:
|
||||
*(unsigned short *)to = *(const unsigned short *)from;
|
||||
*(2+(unsigned char *)to) = *(2+(const unsigned char *)from);
|
||||
return to;
|
||||
case 4:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
return to;
|
||||
case 8:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
return to;
|
||||
case 12:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
|
||||
return to;
|
||||
case 16:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
|
||||
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
|
||||
return to;
|
||||
case 20:
|
||||
*(unsigned long *)to = *(const unsigned long *)from;
|
||||
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
|
||||
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
|
||||
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
|
||||
*(4+(unsigned long *)to) = *(4+(const unsigned long *)from);
|
||||
return to;
|
||||
}
|
||||
#define COMMON(x) \
|
||||
__asm__("cld\n\t" \
|
||||
"rep ; movsl" \
|
||||
x \
|
||||
: /* no outputs */ \
|
||||
: "c" (n/4),"D" ((long) to),"S" ((long) from) \
|
||||
: "cx","di","si","memory");
|
||||
|
||||
switch (n % 4) {
|
||||
case 0: COMMON(""); return to;
|
||||
case 1: COMMON("\n\tmovsb"); return to;
|
||||
case 2: COMMON("\n\tmovsw"); return to;
|
||||
case 3: COMMON("\n\tmovsw\n\tmovsb"); return to;
|
||||
}
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
#define memcpy(t, f, n) \
|
||||
(__builtin_constant_p(n) ? \
|
||||
__constant_memcpy((t),(f),(n)) : \
|
||||
__memcpy((t),(f),(n)))
|
||||
|
||||
#define __HAVE_ARCH_MEMMOVE
|
||||
extern inline void * memmove(void * dest,const void * src, size_t n)
|
||||
{
|
||||
if (dest<src)
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep\n\t"
|
||||
"movsb"
|
||||
: /* no output */
|
||||
:"c" (n),"S" (src),"D" (dest)
|
||||
:"cx","si","di");
|
||||
else
|
||||
__asm__ __volatile__(
|
||||
"std\n\t"
|
||||
"rep\n\t"
|
||||
"movsb\n\t"
|
||||
"cld"
|
||||
: /* no output */
|
||||
:"c" (n),
|
||||
"S" (n-1+(const char *)src),
|
||||
"D" (n-1+(char *)dest)
|
||||
:"cx","si","di","memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define memcmp __builtin_memcmp
|
||||
|
||||
#define __HAVE_ARCH_MEMCHR
|
||||
extern inline void * memchr(const void * cs,int c,size_t count)
|
||||
{
|
||||
register void * __res;
|
||||
if (!count)
|
||||
return NULL;
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"repne\n\t"
|
||||
"scasb\n\t"
|
||||
"je 1f\n\t"
|
||||
"movl $1,%0\n"
|
||||
"1:\tdecl %0"
|
||||
:"=D" (__res):"a" (c),"D" (cs),"c" (count)
|
||||
:"cx");
|
||||
return __res;
|
||||
}
|
||||
|
||||
extern inline void * __memset_generic(void * s, char c,size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep\n\t"
|
||||
"stosb"
|
||||
: /* no output */
|
||||
:"a" (c),"D" (s),"c" (count)
|
||||
:"cx","di","memory");
|
||||
return s;
|
||||
}
|
||||
|
||||
/* we might want to write optimized versions of these later */
|
||||
#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count))
|
||||
|
||||
/*
|
||||
* memset(x,0,y) is a reasonably common thing to do, so we want to fill
|
||||
* things 32 bits at a time even when we don't know the size of the
|
||||
* area at compile-time..
|
||||
*/
|
||||
extern inline void * __constant_c_memset(void * s, unsigned long c, size_t count)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cld\n\t"
|
||||
"rep ; stosl\n\t"
|
||||
"testb $2,%b1\n\t"
|
||||
"je 1f\n\t"
|
||||
"stosw\n"
|
||||
"1:\ttestb $1,%b1\n\t"
|
||||
"je 2f\n\t"
|
||||
"stosb\n"
|
||||
"2:"
|
||||
: /* no output */
|
||||
:"a" (c), "q" (count), "c" (count/4), "D" ((long) s)
|
||||
:"cx","di","memory");
|
||||
return (s);
|
||||
}
|
||||
|
||||
/* Added by Gertjan van Wingerde to make minix and sysv module work */
|
||||
#define __HAVE_ARCH_STRNLEN
|
||||
extern inline size_t strnlen(const char * s, size_t count)
|
||||
{
|
||||
register int __res;
|
||||
__asm__ __volatile__(
|
||||
"movl %1,%0\n\t"
|
||||
"jmp 2f\n"
|
||||
"1:\tcmpb $0,(%0)\n\t"
|
||||
"je 3f\n\t"
|
||||
"incl %0\n"
|
||||
"2:\tdecl %2\n\t"
|
||||
"cmpl $-1,%2\n\t"
|
||||
"jne 1b\n"
|
||||
"3:\tsubl %1,%0"
|
||||
:"=a" (__res)
|
||||
:"c" (s),"d" (count)
|
||||
:"dx");
|
||||
return __res;
|
||||
}
|
||||
/* end of additional stuff */
|
||||
|
||||
/*
|
||||
* This looks horribly ugly, but the compiler can optimize it totally,
|
||||
* as we by now know that both pattern and count is constant..
|
||||
*/
|
||||
extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
|
||||
{
|
||||
switch (count) {
|
||||
case 0:
|
||||
return s;
|
||||
case 1:
|
||||
*(unsigned char *)s = pattern;
|
||||
return s;
|
||||
case 2:
|
||||
*(unsigned short *)s = pattern;
|
||||
return s;
|
||||
case 3:
|
||||
*(unsigned short *)s = pattern;
|
||||
*(2+(unsigned char *)s) = pattern;
|
||||
return s;
|
||||
case 4:
|
||||
*(unsigned long *)s = pattern;
|
||||
return s;
|
||||
}
|
||||
#define COMMON(x) \
|
||||
__asm__("cld\n\t" \
|
||||
"rep ; stosl" \
|
||||
x \
|
||||
: /* no outputs */ \
|
||||
: "a" (pattern),"c" (count/4),"D" ((long) s) \
|
||||
: "cx","di","memory")
|
||||
|
||||
switch (count % 4) {
|
||||
case 0: COMMON(""); return s;
|
||||
case 1: COMMON("\n\tstosb"); return s;
|
||||
case 2: COMMON("\n\tstosw"); return s;
|
||||
case 3: COMMON("\n\tstosw\n\tstosb"); return s;
|
||||
}
|
||||
#undef COMMON
|
||||
}
|
||||
|
||||
#define __constant_c_x_memset(s, c, count) \
|
||||
(__builtin_constant_p(count) ? \
|
||||
__constant_c_and_count_memset((s),(c),(count)) : \
|
||||
__constant_c_memset((s),(c),(count)))
|
||||
|
||||
#define __memset(s, c, count) \
|
||||
(__builtin_constant_p(count) ? \
|
||||
__constant_count_memset((s),(c),(count)) : \
|
||||
__memset_generic((s),(c),(count)))
|
||||
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define memset(s, c, count) \
|
||||
(__builtin_constant_p(c) ? \
|
||||
__constant_c_x_memset((s),(0x01010101UL*(unsigned char)c),(count)) : \
|
||||
__memset((s),(c),(count)))
|
||||
|
||||
/*
|
||||
* find the first occurrence of byte 'c', or 1 past the area if none
|
||||
*/
|
||||
#define __HAVE_ARCH_MEMSCAN
|
||||
extern inline void * memscan(void * addr, int c, size_t size)
|
||||
{
|
||||
if (!size)
|
||||
return addr;
|
||||
__asm__("cld
|
||||
repnz; scasb
|
||||
jnz 1f
|
||||
dec %%edi
|
||||
1: "
|
||||
: "=D" (addr), "=c" (size)
|
||||
: "0" (addr), "1" (size), "a" (c));
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_STRING_H_ */
|
||||
|
||||
|
4559
reactos/include/structs.h
Normal file
4559
reactos/include/structs.h
Normal file
File diff suppressed because it is too large
Load Diff
61
reactos/include/types.h
Normal file
61
reactos/include/types.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Added wide character type wchar_t, june 1998 -- Boudewijn Dekker
|
||||
*/
|
||||
#ifndef _LINUX_TYPES_H
|
||||
#define _LINUX_TYPES_H
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _I386_TYPES_H
|
||||
#define _I386_TYPES_H
|
||||
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These aren't exported outside the kernel to avoid name space clashes
|
||||
*/
|
||||
#ifdef __KERNEL__
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef signed long long s64;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef size_t __kernel_size_t;
|
||||
//typedef unsigned short wchar_t;
|
||||
|
||||
|
||||
#endif /* _LINUX_TYPES_H */
|
3000
reactos/include/unicode.h
Normal file
3000
reactos/include/unicode.h
Normal file
File diff suppressed because it is too large
Load Diff
92
reactos/include/windows.h
Normal file
92
reactos/include/windows.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
windows.h
|
||||
|
||||
Include this file if you wish to use the Windows32 API Library
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
||||
This file is part of the Windows32 API Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation,
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_H_WINDOWS_H
|
||||
#define _GNU_H_WINDOWS_H
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* Base definitions */
|
||||
#include <base.h>
|
||||
|
||||
/* WIN32 messages */
|
||||
#ifndef _WIN32_LEAN_AND_MEAN
|
||||
#include <messages.h>
|
||||
#endif
|
||||
|
||||
/* WIN32 definitions */
|
||||
#include <defines.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* WIN32 structures */
|
||||
#include <structs.h>
|
||||
|
||||
/* WIN32 functions */
|
||||
#ifndef _WIN32_LEAN_AND_MEAN
|
||||
#include <funcs.h>
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
/* WIN32 error codes */
|
||||
#include <errors.h>
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
/* Windows sockets specification version 1.1 */
|
||||
#ifdef Win32_Winsock
|
||||
#ifndef _WIN32_LEAN_AND_MEAN
|
||||
#include <sockets.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* There is a conflict with BOOL between Objective-C and Win32,
|
||||
so the Windows32 API Library defines and uses WINBOOL.
|
||||
However, if we are not using Objective-C then define the normal
|
||||
windows BOOL so Win32 programs compile normally. If you are
|
||||
using Objective-C then you must use WINBOOL for Win32 operations.
|
||||
*/
|
||||
#ifndef __OBJC__
|
||||
typedef WINBOOL BOOL;
|
||||
#endif /* !__OBJC__ */
|
||||
|
||||
/* How do we get the VM page size on NT? */
|
||||
#ifndef vm_page_size
|
||||
#define vm_page_size 4096
|
||||
#endif
|
||||
|
||||
#endif /* ! defined (RC_INVOKED) */
|
||||
|
||||
#endif /* _GNU_H_WINDOWS_H */
|
44
reactos/include/wstring.h
Normal file
44
reactos/include/wstring.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Adapted from linux for the reactos kernel, march 1998 -- David Welch
|
||||
* Added wide character string functions, june 1998 -- Boudewijn Dekker
|
||||
* Removed extern specifier from ___wcstok, june 1998 -- Boudewijn Dekker
|
||||
* Added wcsicmp and wcsnicmp -- Boudewijn Dekker
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_WSTRING_H_
|
||||
#define _LINUX_WSTRING_H_
|
||||
|
||||
#include <types.h> /* for size_t */
|
||||
|
||||
typedef unsigned short wchar_t;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *) 0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//wchar_t * ___wcstok = NULL;
|
||||
extern wchar_t * wcscpy(wchar_t *,const wchar_t *);
|
||||
extern wchar_t * wcsncpy(wchar_t *,const wchar_t *, __kernel_size_t);
|
||||
extern wchar_t * wcscat(wchar_t *, const wchar_t *);
|
||||
extern wchar_t * wcsncat(wchar_t *, const wchar_t *, __kernel_size_t);
|
||||
extern int wcscmp(const wchar_t *,const wchar_t *);
|
||||
extern int wcsncmp(const wchar_t *,const wchar_t *,__kernel_size_t);
|
||||
wchar_t* wcschr(wchar_t* str, wchar_t ch);
|
||||
extern wchar_t * wcsrchr(const wchar_t *,wchar_t);
|
||||
extern wchar_t * wcspbrk(const wchar_t *,const wchar_t *);
|
||||
extern wchar_t * wcstok(wchar_t *,const wchar_t *);
|
||||
extern wchar_t * wcsstr(const wchar_t *,const wchar_t *);
|
||||
extern size_t wcsnlen(const wchar_t * s, size_t count);
|
||||
extern int wcsicmp(const wchar_t* cs,const wchar_t * ct);
|
||||
extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
58
reactos/lib/kernel32/file/file.c
Normal file
58
reactos/lib/kernel32/file/file.c
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
/*
|
||||
* Win32 File Api functions
|
||||
* Author: Boudewijn Dekker
|
||||
* to do: many more to add ..
|
||||
*/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// AnsiOrOemtoUnicode
|
||||
// pupose: internal procedure used in file api
|
||||
|
||||
NTSTATUS AnsiOrOemtoUnicode(PUNICODE_STRING DestinationString,PANSI_STRING SourceString, BOOLEAN AllocateDestinationString);
|
||||
|
||||
|
||||
BOOLEAN bIsFileApiAnsi; // set the file api to ansi or oem
|
||||
|
||||
|
||||
NTSTATUS AnsiOrOemtoUnicode(PUNICODE_STRING DestinationString,PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
|
||||
{
|
||||
if ( bIsFileApiAnsi ) {
|
||||
return __AnsiStringToUnicodeString(DestinationString, SourceString, AllocateDestinationString);
|
||||
else
|
||||
return __OemStringToUnicodeString(DestinationString, SourceString, AllocateDestinationString);
|
||||
|
||||
}
|
||||
|
||||
|
||||
WINBASEAPI
|
||||
VOID
|
||||
WINAPI
|
||||
SetFileApisToOEM(VOID)
|
||||
{
|
||||
bIsFileApiAnsi = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBASEAPI
|
||||
VOID
|
||||
WINAPI
|
||||
SetFileApisToANSI(VOID)
|
||||
{
|
||||
bIsFileApiAnsi = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WINBASEAPI
|
||||
BOOLEAN
|
||||
WINAPI
|
||||
AreFileApisANSI(VOID)
|
||||
{
|
||||
return bIsFileApiAnsi;
|
||||
|
||||
}
|
138
reactos/lib/kernel32/file/lfile.c
Normal file
138
reactos/lib/kernel32/file/lfile.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* created: Boudewijn Dekker
|
||||
* org. source: WINE
|
||||
* date: june 1998
|
||||
* todo: check the _lopen for correctness
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include <wstring.h>
|
||||
|
||||
|
||||
|
||||
|
||||
long _hread(
|
||||
HFILE hFile,
|
||||
LPVOID lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
{
|
||||
DWORD NumberOfBytesRead;
|
||||
if ( ReadFile((HANDLE)hFile,(LPCVOID)lpBuffer,(DWORD)lBytes,&NumberOfBytesRead, NULL) == FALSE )
|
||||
return -1;
|
||||
else
|
||||
return NumberOfBytesRead;
|
||||
|
||||
}
|
||||
|
||||
long
|
||||
_lread(HFILE fd,LPVOID buffer,long count)
|
||||
{
|
||||
return _hread(fd,buffer, count);
|
||||
}
|
||||
|
||||
|
||||
long _hwrite(
|
||||
HFILE hFile,
|
||||
LPCSTR lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
{
|
||||
|
||||
DWORD NumberOfBytesWritten;
|
||||
if ( lBytes == 0 ) {
|
||||
if ( SetEndOfFile((HANDLE) hFile ) == FALSE )
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if ( WriteFile((HANDLE)hFile,(LPCVOID)lpBuffer,(DWORD)lBytes, &NumberOfBytesWritten,NULL) == FALSE )
|
||||
return -1;
|
||||
else
|
||||
return NumberOfBytesWritten;
|
||||
|
||||
}
|
||||
|
||||
|
||||
long _lwrite(
|
||||
HFILE hFile,
|
||||
LPCSTR lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
{
|
||||
return _hwrite(hFile,lpBuffer,lBytes);
|
||||
}
|
||||
|
||||
#define OF_OPENMASK (OF_READ|OF_READWRITE|OF_WRITE|OF_CREATE)
|
||||
#define OF_FILEMASK (OF_DELETE|OF_PARSE)
|
||||
#define OF_MASK (OF_OPENMASK|OF_FILEMASK)
|
||||
|
||||
HFILE _open( LPCSTR lpPathName, int iReadWrite )
|
||||
{
|
||||
|
||||
|
||||
|
||||
HFILE fd;
|
||||
int nFunction;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Don't assume a 1:1 relationship between OF_* modes and O_* modes */
|
||||
/* Here we translate the read/write permission bits (which had better */
|
||||
/* be the low 2 bits. If not, we're in trouble. Other bits are */
|
||||
/* passed through unchanged */
|
||||
|
||||
nFunction = wFunction & 3;
|
||||
|
||||
switch (wFunction & 3) {
|
||||
case OF_READ:
|
||||
nFunction |= O_RDONLY;
|
||||
break;
|
||||
case OF_READWRITE:
|
||||
nFunction |= O_RDWR;
|
||||
break;
|
||||
case OF_WRITE:
|
||||
nFunction |= O_WRONLY;
|
||||
break;
|
||||
default:
|
||||
//ERRSTR((LF_ERROR, "_lopen: bad file open mode %x\n", wFunction));
|
||||
return HFILE_ERROR;
|
||||
}
|
||||
SetLastError(0);
|
||||
fd = CreateFileA( filename,nFunction,OPEN_EXISTING,
|
||||
NULL,OPEN_EXISTING,NULL,NULL);
|
||||
if (fd == INVALID_HANDLE_VALUE )
|
||||
return HFILE_ERROR;
|
||||
return fd;
|
||||
}
|
||||
|
||||
int _creat(const char *filename, int pmode)
|
||||
{
|
||||
SetLastError(0);
|
||||
return CreateFileA( filename,GENERIC_READ & GENERIC_WRITE,FILE_SHARE_WRITE,
|
||||
NULL,CREATE_ALWAYS,pmode & 0x00003FB7,NULL);
|
||||
}
|
||||
|
||||
|
||||
int _lclose(
|
||||
HFILE hFile
|
||||
)
|
||||
{
|
||||
if ( CloseHandle((HANDLE)hFile) )
|
||||
return 0;
|
||||
else
|
||||
rerturn -1;
|
||||
}
|
||||
|
||||
LONG _llseek(
|
||||
HFILE hFile,
|
||||
LONG lOffset,
|
||||
int iOrigin
|
||||
)
|
||||
{
|
||||
return SetFilePointer((HANDLE) hFile, lOffset, NULL,(DWORD)iOrigin );
|
||||
}
|
||||
|
||||
|
665
reactos/lib/kernel32/kernel32.def
Normal file
665
reactos/lib/kernel32/kernel32.def
Normal file
@@ -0,0 +1,665 @@
|
||||
;
|
||||
; kernel32.def
|
||||
;
|
||||
; Exports for KERNEL32 DLL
|
||||
;
|
||||
; Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
;
|
||||
; Author: Scott Christley <scottc@net-community.com>
|
||||
; Date: 1996
|
||||
;
|
||||
; This file is part of the Windows32 API Library.
|
||||
;
|
||||
; This library is free software; you can redistribute it and/or
|
||||
; modify it under the terms of the GNU Library General Public
|
||||
; License as published by the Free Software Foundation; either
|
||||
; version 2 of the License, or (at your option) any later version.
|
||||
;
|
||||
; This library is distributed in the hope that it will be useful,
|
||||
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
; Library General Public License for more details.
|
||||
;
|
||||
; If you are interested in a warranty or support for this source code,
|
||||
; contact Scott Christley <scottc@net-community.com> for more information.
|
||||
;
|
||||
; You should have received a copy of the GNU Library General Public
|
||||
; License along with this library; see the file COPYING.LIB.
|
||||
; If not, write to the Free Software Foundation,
|
||||
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
;
|
||||
LIBRARY KERNEL32
|
||||
EXPORTS
|
||||
AddAtomA@4
|
||||
AddAtomW@4
|
||||
AddConsoleAliasA@12
|
||||
AddConsoleAliasW@12
|
||||
AllocConsole@0
|
||||
AreFileApisANSI@0
|
||||
BackupRead@28
|
||||
BackupSeek@24
|
||||
BackupWrite@28
|
||||
BaseAttachCompleteThunk@0
|
||||
Beep@8
|
||||
BeginUpdateResourceA@8
|
||||
BeginUpdateResourceW@8
|
||||
BuildCommDCBA@8
|
||||
BuildCommDCBAndTimeoutsA@12
|
||||
BuildCommDCBAndTimeoutsW@12
|
||||
BuildCommDCBW@8
|
||||
CallNamedPipeA@28
|
||||
CallNamedPipeW@28
|
||||
ClearCommBreak@4
|
||||
ClearCommError@12
|
||||
CloseConsoleHandle@4
|
||||
CloseHandle@4
|
||||
CloseProfileUserMapping@0
|
||||
CmdBatNotification@4
|
||||
CommConfigDialogA@12
|
||||
CommConfigDialogW@12
|
||||
CompareFileTime@8
|
||||
CompareStringA@24
|
||||
CompareStringW@24
|
||||
ConnectNamedPipe@8
|
||||
ConsoleMenuControl@12
|
||||
ContinueDebugEvent@12
|
||||
ConvertDefaultLocale@4
|
||||
CopyFileA@12
|
||||
CopyFileW@12
|
||||
CreateConsoleScreenBuffer@20
|
||||
CreateDirectoryA@8
|
||||
CreateDirectoryExA@12
|
||||
CreateDirectoryExW@12
|
||||
CreateDirectoryW@8
|
||||
CreateEventA@16
|
||||
CreateEventW@16
|
||||
CreateFileA@28
|
||||
CreateFileMappingA@24
|
||||
CreateFileMappingW@24
|
||||
CreateFileW@28
|
||||
CreateIoCompletionPort@16
|
||||
CreateMailslotA@16
|
||||
CreateMailslotW@16
|
||||
CreateMutexA@12
|
||||
CreateMutexW@12
|
||||
CreateNamedPipeA@32
|
||||
CreateNamedPipeW@32
|
||||
CreatePipe@16
|
||||
CreateProcessA@40
|
||||
CreateProcessW@40
|
||||
CreateRemoteThread@28
|
||||
CreateSemaphoreA@16
|
||||
CreateSemaphoreW@16
|
||||
CreateTapePartition@16
|
||||
CreateThread@24
|
||||
CreateVirtualBuffer@12
|
||||
DebugActiveProcess@4
|
||||
DebugBreak@0
|
||||
DefineDosDeviceA@12
|
||||
DefineDosDeviceW@12
|
||||
DeleteAtom@4
|
||||
DeleteCriticalSection@4
|
||||
DeleteFileA@4
|
||||
DeleteFileW@4
|
||||
DeviceIoControl@32
|
||||
DisableThreadLibraryCalls@4
|
||||
DisconnectNamedPipe@4
|
||||
DosDateTimeToFileTime@12
|
||||
DuplicateConsoleHandle@16
|
||||
DuplicateHandle@28
|
||||
EndUpdateResourceA@8
|
||||
EndUpdateResourceW@8
|
||||
EnterCriticalSection@4
|
||||
EnumCalendarInfoA@16
|
||||
EnumCalendarInfoW@16
|
||||
EnumDateFormatsA@12
|
||||
EnumDateFormatsW@12
|
||||
EnumResourceLanguagesA@20
|
||||
EnumResourceLanguagesW@20
|
||||
EnumResourceNamesA@16
|
||||
EnumResourceNamesW@16
|
||||
EnumResourceTypesA@12
|
||||
EnumResourceTypesW@12
|
||||
EnumSystemCodePagesA@8
|
||||
EnumSystemCodePagesW@8
|
||||
EnumSystemLocalesA@8
|
||||
EnumSystemLocalesW@8
|
||||
EnumTimeFormatsA@12
|
||||
EnumTimeFormatsW@12
|
||||
EraseTape@12
|
||||
EscapeCommFunction@8
|
||||
ExitProcess@4
|
||||
ExitThread@4
|
||||
ExitVDM@8
|
||||
ExpandEnvironmentStringsA@12
|
||||
ExpandEnvironmentStringsW@12
|
||||
ExpungeConsoleCommandHistoryA@4
|
||||
ExpungeConsoleCommandHistoryW@4
|
||||
ExtendVirtualBuffer@8
|
||||
FatalAppExitA@8
|
||||
FatalAppExitW@8
|
||||
FatalExit@4
|
||||
FileTimeToDosDateTime@12
|
||||
FileTimeToLocalFileTime@8
|
||||
FileTimeToSystemTime@8
|
||||
FillConsoleOutputAttribute@20
|
||||
FillConsoleOutputCharacterA@20
|
||||
FillConsoleOutputCharacterW@20
|
||||
FindAtomA@4
|
||||
FindAtomW@4
|
||||
FindClose@4
|
||||
FindCloseChangeNotification@4
|
||||
FindFirstChangeNotificationA@12
|
||||
FindFirstChangeNotificationW@12
|
||||
FindFirstFileA@8
|
||||
FindFirstFileW@8
|
||||
FindNextChangeNotification@4
|
||||
FindNextFileA@8
|
||||
FindNextFileW@8
|
||||
FindResourceA@12
|
||||
FindResourceExA@16
|
||||
FindResourceExW@16
|
||||
FindResourceW@12
|
||||
FlushConsoleInputBuffer@4
|
||||
FlushFileBuffers@4
|
||||
FlushInstructionCache@12
|
||||
FlushViewOfFile@8
|
||||
FoldStringA@20
|
||||
FoldStringW@20
|
||||
FormatMessageA@28
|
||||
FormatMessageW@28
|
||||
FreeConsole@0
|
||||
FreeEnvironmentStringsA@4
|
||||
FreeEnvironmentStringsW@4
|
||||
FreeLibrary@4
|
||||
FreeLibraryAndExitThread@8
|
||||
FreeResource@4
|
||||
FreeVirtualBuffer@4
|
||||
GenerateConsoleCtrlEvent@8
|
||||
GetACP@0
|
||||
GetAtomNameA@12
|
||||
GetAtomNameW@12
|
||||
GetBinaryType@8
|
||||
GetBinaryTypeA@8
|
||||
GetBinaryTypeW@8
|
||||
GetCPInfo@8
|
||||
GetCommConfig@12
|
||||
GetCommMask@8
|
||||
GetCommModemStatus@8
|
||||
GetCommProperties@8
|
||||
GetCommState@8
|
||||
GetCommTimeouts@8
|
||||
GetCommandLineA@0
|
||||
GetCommandLineW@0
|
||||
GetCompressedFileSizeA@8
|
||||
GetCompressedFileSizeW@8
|
||||
GetComputerNameA@8
|
||||
GetComputerNameW@8
|
||||
GetConsoleAliasA@16
|
||||
GetConsoleAliasExesA@8
|
||||
GetConsoleAliasExesLengthA@0
|
||||
GetConsoleAliasExesLengthW@0
|
||||
GetConsoleAliasExesW@8
|
||||
GetConsoleAliasW@16
|
||||
GetConsoleAliasesA@12
|
||||
GetConsoleAliasesLengthA@4
|
||||
GetConsoleAliasesLengthW@4
|
||||
GetConsoleAliasesW@12
|
||||
GetConsoleCP@0
|
||||
GetConsoleCommandHistoryA@12
|
||||
GetConsoleCommandHistoryLengthA@4
|
||||
GetConsoleCommandHistoryLengthW@4
|
||||
GetConsoleCommandHistoryW@12
|
||||
GetConsoleCursorInfo@8
|
||||
GetConsoleDisplayMode@4
|
||||
GetConsoleFontInfo@16
|
||||
GetConsoleFontSize@8
|
||||
GetConsoleHardwareState@12
|
||||
GetConsoleInputWaitHandle@0
|
||||
GetConsoleMode@8
|
||||
GetConsoleOutputCP@0
|
||||
GetConsoleScreenBufferInfo@8
|
||||
GetConsoleTitleA@8
|
||||
GetConsoleTitleW@8
|
||||
GetCurrencyFormatA@24
|
||||
GetCurrencyFormatW@24
|
||||
GetCurrentConsoleFont@12
|
||||
GetCurrentDirectoryA@8
|
||||
GetCurrentDirectoryW@8
|
||||
GetCurrentProcess@0
|
||||
GetCurrentProcessId@0
|
||||
GetCurrentThread@0
|
||||
GetCurrentThreadId@0
|
||||
GetDateFormatA@24
|
||||
GetDateFormatW@24
|
||||
GetDefaultCommConfigA@12
|
||||
GetDefaultCommConfigW@12
|
||||
GetDiskFreeSpaceA@20
|
||||
GetDiskFreeSpaceW@20
|
||||
GetDriveTypeA@4
|
||||
GetDriveTypeW@4
|
||||
GetEnvironmentStrings@0
|
||||
GetEnvironmentStringsA@0
|
||||
GetEnvironmentStringsW@0
|
||||
GetEnvironmentVariableA@12
|
||||
GetEnvironmentVariableW@12
|
||||
GetExitCodeProcess@8
|
||||
GetExitCodeThread@8
|
||||
GetFileAttributesA@4
|
||||
GetFileAttributesW@4
|
||||
GetFileInformationByHandle@8
|
||||
GetFileSize@8
|
||||
GetFileTime@16
|
||||
GetFileType@4
|
||||
GetFullPathNameA@16
|
||||
GetFullPathNameW@16
|
||||
GetHandleInformation@8
|
||||
GetLargestConsoleWindowSize@4
|
||||
GetLastError@0
|
||||
GetLocalTime@4
|
||||
GetLocaleInfoA@16
|
||||
GetLocaleInfoW@16
|
||||
GetLogicalDriveStringsA@8
|
||||
GetLogicalDriveStringsW@8
|
||||
GetLogicalDrives@0
|
||||
GetMailslotInfo@20
|
||||
GetModuleFileNameA@12
|
||||
GetModuleFileNameW@12
|
||||
GetModuleHandleA@4
|
||||
GetModuleHandleW@4
|
||||
GetNamedPipeHandleStateA@28
|
||||
GetNamedPipeHandleStateW@28
|
||||
GetNamedPipeInfo@20
|
||||
GetNextVDMCommand@4
|
||||
GetNumberFormatA@24
|
||||
GetNumberFormatW@24
|
||||
GetNumberOfConsoleFonts@0
|
||||
GetNumberOfConsoleInputEvents@8
|
||||
GetNumberOfConsoleMouseButtons@4
|
||||
GetOEMCP@0
|
||||
GetOverlappedResult@16
|
||||
GetPriorityClass@4
|
||||
GetPrivateProfileIntA@16
|
||||
GetPrivateProfileIntW@16
|
||||
GetPrivateProfileSectionA@16
|
||||
GetPrivateProfileSectionNamesA@12
|
||||
GetPrivateProfileSectionNamesW@12
|
||||
GetPrivateProfileSectionW@16
|
||||
GetPrivateProfileStringA@24
|
||||
GetPrivateProfileStringW@24
|
||||
GetPrivateProfileStructA@20
|
||||
GetPrivateProfileStructW@20
|
||||
GetProcAddress@8
|
||||
GetProcessAffinityMask@12
|
||||
GetProcessHeap@0
|
||||
GetProcessHeaps@8
|
||||
GetProcessShutdownParameters@8
|
||||
GetProcessTimes@20
|
||||
GetProcessVersion@4
|
||||
GetProcessWorkingSetSize@12
|
||||
GetProfileIntA@12
|
||||
GetProfileIntW@12
|
||||
GetProfileSectionA@12
|
||||
GetProfileSectionW@12
|
||||
GetProfileStringA@20
|
||||
GetProfileStringW@20
|
||||
GetQueuedCompletionStatus@20
|
||||
GetShortPathNameA@12
|
||||
GetShortPathNameW@12
|
||||
GetStartupInfoA@4
|
||||
GetStartupInfoW@4
|
||||
GetStdHandle@4
|
||||
GetStringTypeA@20
|
||||
GetStringTypeExA@20
|
||||
GetStringTypeExW@20
|
||||
GetStringTypeW@16
|
||||
GetSystemDefaultLCID@0
|
||||
GetSystemDefaultLangID@0
|
||||
GetSystemDirectoryA@8
|
||||
GetSystemDirectoryW@8
|
||||
GetSystemInfo@4
|
||||
GetSystemPowerStatus@4
|
||||
GetSystemTime@4
|
||||
GetSystemTimeAdjustment@12
|
||||
GetSystemTimeAsFileTime@4
|
||||
GetTapeParameters@16
|
||||
GetTapePosition@20
|
||||
GetTapeStatus@4
|
||||
GetTempFileNameA@16
|
||||
GetTempFileNameW@16
|
||||
GetTempPathA@8
|
||||
GetTempPathW@8
|
||||
GetThreadContext@8
|
||||
_imp__GetThreadContext@8
|
||||
GetThreadLocale@0
|
||||
GetThreadPriority@4
|
||||
GetThreadSelectorEntry@12
|
||||
GetThreadTimes@20
|
||||
GetTickCount@0
|
||||
GetTimeFormatA@24
|
||||
GetTimeFormatW@24
|
||||
GetTimeZoneInformation@4
|
||||
GetUserDefaultLCID@0
|
||||
GetUserDefaultLangID@0
|
||||
GetVDMCurrentDirectories@8
|
||||
GetVersion@0
|
||||
GetVersionExA@4
|
||||
GetVersionExW@4
|
||||
GetVolumeInformationA@32
|
||||
GetVolumeInformationW@32
|
||||
GetWindowsDirectoryA@8
|
||||
GetWindowsDirectoryW@8
|
||||
GlobalAddAtomA@4
|
||||
GlobalAddAtomW@4
|
||||
GlobalAlloc@8
|
||||
GlobalCompact@4
|
||||
GlobalDeleteAtom@4
|
||||
GlobalFindAtomA@4
|
||||
GlobalFindAtomW@4
|
||||
GlobalFix@4
|
||||
GlobalFlags@4
|
||||
GlobalFree@4
|
||||
GlobalGetAtomNameA@12
|
||||
GlobalGetAtomNameW@12
|
||||
GlobalHandle@4
|
||||
GlobalLock@4
|
||||
GlobalMemoryStatus@4
|
||||
GlobalReAlloc@12
|
||||
GlobalSize@4
|
||||
GlobalUnWire@4
|
||||
GlobalUnfix@4
|
||||
GlobalUnlock@4
|
||||
GlobalWire@4
|
||||
HeapAlloc@12
|
||||
HeapCompact@8
|
||||
HeapCreate@12
|
||||
HeapCreateTagsW@16
|
||||
HeapDestroy@4
|
||||
HeapExtend@16
|
||||
HeapFree@12
|
||||
HeapLock@4
|
||||
HeapQueryTagW@20
|
||||
HeapReAlloc@16
|
||||
HeapSize@12
|
||||
HeapSummary@12
|
||||
HeapUnlock@4
|
||||
HeapUsage@20
|
||||
HeapValidate@12
|
||||
HeapWalk@8
|
||||
InitAtomTable@4
|
||||
InitializeCriticalSection@4
|
||||
InterlockedDecrement@4
|
||||
InterlockedExchange@8
|
||||
InterlockedIncrement@4
|
||||
InvalidateConsoleDIBits@8
|
||||
IsBadCodePtr@4
|
||||
IsBadHugeReadPtr@8
|
||||
IsBadHugeWritePtr@8
|
||||
IsBadReadPtr@8
|
||||
IsBadStringPtrA@8
|
||||
IsBadStringPtrW@8
|
||||
IsBadWritePtr@8
|
||||
IsDBCSLeadByte@4
|
||||
IsDBCSLeadByteEx@8
|
||||
IsDebuggerPresent@0
|
||||
IsValidCodePage@4
|
||||
IsValidLocale@8
|
||||
LCMapStringA@24
|
||||
LCMapStringW@24
|
||||
LeaveCriticalSection@4
|
||||
LoadLibraryA@4
|
||||
LoadLibraryExA@12
|
||||
LoadLibraryExW@12
|
||||
LoadLibraryW@4
|
||||
LoadModule@8
|
||||
LoadResource@8
|
||||
LocalAlloc@8
|
||||
LocalCompact@4
|
||||
LocalFileTimeToFileTime@8
|
||||
LocalFlags@4
|
||||
LocalFree@4
|
||||
LocalHandle@4
|
||||
LocalLock@4
|
||||
LocalReAlloc@12
|
||||
LocalShrink@8
|
||||
LocalSize@4
|
||||
LocalUnlock@4
|
||||
LockFile@20
|
||||
LockFileEx@24
|
||||
LockResource@4
|
||||
MapViewOfFile@20
|
||||
MapViewOfFileEx@24
|
||||
MoveFileA@8
|
||||
MoveFileExA@12
|
||||
MoveFileExW@12
|
||||
MoveFileW@8
|
||||
MulDiv@12
|
||||
MultiByteToWideChar@24
|
||||
OpenConsoleW@16
|
||||
OpenEventA@12
|
||||
OpenEventW@12
|
||||
OpenFile@12
|
||||
OpenFileMappingA@12
|
||||
OpenFileMappingW@12
|
||||
OpenMutexA@12
|
||||
OpenMutexW@12
|
||||
OpenProcess@12
|
||||
OpenProfileUserMapping@0
|
||||
OpenSemaphoreA@12
|
||||
OpenSemaphoreW@12
|
||||
OutputDebugStringA@4
|
||||
OutputDebugStringW@4
|
||||
PeekConsoleInputA@16
|
||||
PeekConsoleInputW@16
|
||||
PeekNamedPipe@24
|
||||
PostQueuedCompletionStatus@16
|
||||
PrepareTape@12
|
||||
PulseEvent@4
|
||||
PurgeComm@8
|
||||
QueryDosDeviceA@12
|
||||
QueryDosDeviceW@12
|
||||
QueryPerformanceCounter@4
|
||||
QueryPerformanceFrequency@4
|
||||
QueryWin31IniFilesMappedToRegistry@16
|
||||
RaiseException@16
|
||||
ReadConsoleA@20
|
||||
ReadConsoleInputA@16
|
||||
ReadConsoleInputW@16
|
||||
ReadConsoleOutputA@20
|
||||
ReadConsoleOutputAttribute@20
|
||||
ReadConsoleOutputCharacterA@20
|
||||
ReadConsoleOutputCharacterW@20
|
||||
ReadConsoleOutputW@20
|
||||
ReadConsoleW@20
|
||||
ReadFile@20
|
||||
ReadFileEx@20
|
||||
ReadProcessMemory@20
|
||||
RegisterConsoleVDM@44
|
||||
RegisterWaitForInputIdle@4
|
||||
RegisterWowBaseHandlers@4
|
||||
RegisterWowExec@4
|
||||
ReleaseMutex@4
|
||||
ReleaseSemaphore@12
|
||||
RemoveDirectoryA@4
|
||||
RemoveDirectoryW@4
|
||||
ResetEvent@4
|
||||
ResumeThread@4
|
||||
RtlFillMemory@12
|
||||
RtlMoveMemory@12
|
||||
RtlUnwind@16
|
||||
RtlZeroMemory@8
|
||||
ScrollConsoleScreenBufferA@20
|
||||
ScrollConsoleScreenBufferW@20
|
||||
SearchPathA@24
|
||||
SearchPathW@24
|
||||
SetCommBreak@4
|
||||
SetCommConfig@12
|
||||
SetCommMask@8
|
||||
SetCommState@8
|
||||
SetCommTimeouts@8
|
||||
SetComputerNameA@4
|
||||
SetComputerNameW@4
|
||||
SetConsoleActiveScreenBuffer@4
|
||||
SetConsoleCP@4
|
||||
SetConsoleCommandHistoryMode@4
|
||||
SetConsoleCtrlHandler@8
|
||||
SetConsoleCursor@8
|
||||
SetConsoleCursorInfo@8
|
||||
SetConsoleCursorPosition@8
|
||||
SetConsoleDisplayMode@12
|
||||
SetConsoleFont@8
|
||||
SetConsoleHardwareState@12
|
||||
SetConsoleKeyShortcuts@16
|
||||
SetConsoleMaximumWindowSize@8
|
||||
SetConsoleMenuClose@4
|
||||
SetConsoleMode@8
|
||||
SetConsoleNumberOfCommandsA@8
|
||||
SetConsoleNumberOfCommandsW@8
|
||||
SetConsoleOutputCP@4
|
||||
SetConsolePalette@12
|
||||
SetConsoleScreenBufferSize@8
|
||||
SetConsoleTextAttribute@8
|
||||
SetConsoleTitleA@4
|
||||
SetConsoleTitleW@4
|
||||
SetConsoleWindowInfo@12
|
||||
SetCurrentDirectoryA@4
|
||||
SetCurrentDirectoryW@4
|
||||
SetDefaultCommConfigA@12
|
||||
SetDefaultCommConfigW@12
|
||||
SetEndOfFile@4
|
||||
SetEnvironmentVariableA@8
|
||||
SetEnvironmentVariableW@8
|
||||
SetErrorMode@4
|
||||
SetEvent@4
|
||||
SetFileApisToANSI@0
|
||||
SetFileApisToOEM@0
|
||||
SetFileAttributesA@8
|
||||
SetFileAttributesW@8
|
||||
SetFilePointer@16
|
||||
SetFileTime@16
|
||||
SetHandleCount@4
|
||||
SetHandleInformation@12
|
||||
SetLastConsoleEventActive@0
|
||||
SetLastError@4
|
||||
SetLocalTime@4
|
||||
SetLocaleInfoA@12
|
||||
SetLocaleInfoW@12
|
||||
SetMailslotInfo@8
|
||||
SetNamedPipeHandleState@16
|
||||
SetPriorityClass@8
|
||||
SetProcessShutdownParameters@8
|
||||
SetProcessWorkingSetSize@12
|
||||
SetStdHandle@8
|
||||
SetSystemPowerState@8
|
||||
SetSystemTime@4
|
||||
SetSystemTimeAdjustment@8
|
||||
SetTapeParameters@12
|
||||
SetTapePosition@24
|
||||
SetThreadAffinityMask@8
|
||||
SetThreadContext@8
|
||||
_imp__SetThreadContext@8
|
||||
SetThreadLocale@4
|
||||
SetThreadPriority@8
|
||||
SetTimeZoneInformation@4
|
||||
SetUnhandledExceptionFilter@4
|
||||
SetVDMCurrentDirectories@8
|
||||
SetVolumeLabelA@8
|
||||
SetVolumeLabelW@8
|
||||
SetupComm@12
|
||||
ShowConsoleCursor@8
|
||||
SizeofResource@8
|
||||
Sleep@4
|
||||
SleepEx@8
|
||||
SuspendThread@4
|
||||
SystemTimeToFileTime@8
|
||||
SystemTimeToTzSpecificLocalTime@12
|
||||
TerminateProcess@8
|
||||
TerminateThread@8
|
||||
TlsAlloc@0
|
||||
TlsFree@4
|
||||
TlsGetValue@4
|
||||
TlsSetValue@8
|
||||
TransactNamedPipe@28
|
||||
TransmitCommChar@8
|
||||
TrimVirtualBuffer@4
|
||||
UnhandledExceptionFilter@4
|
||||
UnlockFile@20
|
||||
UnlockFileEx@20
|
||||
UnmapViewOfFile@4
|
||||
UpdateResourceA@24
|
||||
UpdateResourceW@24
|
||||
VDMConsoleOperation@8
|
||||
VDMOperationStarted@4
|
||||
VerLanguageNameA@12
|
||||
VerLanguageNameW@12
|
||||
VerifyConsoleIoHandle@4
|
||||
VirtualAlloc@16
|
||||
VirtualBufferExceptionHandler@12
|
||||
VirtualFree@12
|
||||
VirtualLock@8
|
||||
VirtualProtect@16
|
||||
VirtualProtectEx@20
|
||||
VirtualQuery@12
|
||||
VirtualQueryEx@16
|
||||
VirtualUnlock@8
|
||||
WaitCommEvent@12
|
||||
WaitForDebugEvent@8
|
||||
WaitForMultipleObjects@16
|
||||
WaitForMultipleObjectsEx@20
|
||||
WaitForSingleObject@8
|
||||
WaitForSingleObjectEx@12
|
||||
WaitNamedPipeA@8
|
||||
WaitNamedPipeW@8
|
||||
WideCharToMultiByte@32
|
||||
WinExec@8
|
||||
WriteConsoleA@20
|
||||
WriteConsoleInputA@16
|
||||
WriteConsoleInputVDMA@16
|
||||
WriteConsoleInputVDMW@16
|
||||
WriteConsoleInputW@16
|
||||
WriteConsoleOutputA@20
|
||||
WriteConsoleOutputAttribute@20
|
||||
WriteConsoleOutputCharacterA@20
|
||||
WriteConsoleOutputCharacterW@20
|
||||
WriteConsoleOutputW@20
|
||||
WriteConsoleW@20
|
||||
WriteFile@20
|
||||
WriteFileEx@20
|
||||
WritePrivateProfileSectionA@12
|
||||
WritePrivateProfileSectionW@12
|
||||
WritePrivateProfileStringA@16
|
||||
WritePrivateProfileStringW@16
|
||||
WritePrivateProfileStructA@20
|
||||
WritePrivateProfileStructW@20
|
||||
WriteProcessMemory@20
|
||||
WriteProfileSectionA@8
|
||||
WriteProfileSectionW@8
|
||||
WriteProfileStringA@12
|
||||
WriteProfileStringW@12
|
||||
WriteTapemark@16
|
||||
_hread@12
|
||||
_hwrite@12
|
||||
_lclose@4
|
||||
_lcreat@8
|
||||
_llseek@12
|
||||
_lopen@8
|
||||
_lread@12
|
||||
_lwrite@12
|
||||
lstrcat@8
|
||||
lstrcatA@8
|
||||
lstrcatW@8
|
||||
lstrcmp@8
|
||||
lstrcmpA@8
|
||||
lstrcmpW@8
|
||||
lstrcmpi@8
|
||||
lstrcmpiA@8
|
||||
lstrcmpiW@8
|
||||
lstrcpy@8
|
||||
lstrcpyA@8
|
||||
lstrcpyW@8
|
||||
lstrcpyn@12
|
||||
lstrcpynA@12
|
||||
lstrcpynW@12
|
||||
lstrlen@4
|
||||
lstrlenA@4
|
||||
lstrlenW@4
|
10
reactos/lib/kernel32/makefile
Normal file
10
reactos/lib/kernel32/makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
all: dummy
|
||||
|
||||
OBJECTS = file/file.o file/lfile.o mem/virtual.o mem/local.o mem/global.o
|
||||
|
||||
kernel32_lib: $(OBJECTS)
|
||||
$(LD) --oformat=coff-go32 -Ttext b0000000 $(LDFLAGS) $(OBJECTS) -o kernel32.dll
|
||||
|
||||
dummy:
|
||||
|
||||
include ../../rules.mak
|
320
reactos/lib/kernel32/mem/global.cc
Normal file
320
reactos/lib/kernel32/mem/global.cc
Normal file
@@ -0,0 +1,320 @@
|
||||
/*
|
||||
* Win32 Global/Local heap functions (GlobalXXX, LocalXXX).
|
||||
* These functions included in Win32 for compatibility with 16 bit Windows
|
||||
* Especially the moveable blocks and handles are oldish.
|
||||
* But the ability to directly allocate memory with GPTR and LPTR is widely
|
||||
* used.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define MAGIC_GLOBAL_USED 0x5342BEEF
|
||||
#define GLOBAL_LOCK_MAX 0xFF
|
||||
|
||||
typedef struct __GLOBAL_LOCAL_HANDLE
|
||||
{
|
||||
ULONG Magic;
|
||||
LPVOID Pointer;
|
||||
BYTE Flags;
|
||||
BYTE LockCount;
|
||||
} GLOBAL_HANDLE, LOCAL_HANDLE, *PGLOBAL_HANDLE, *PLOCAL_HANDLE;
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalAlloc(UINT flags, DWORD size)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
|
||||
aprintf("GlobalAlloc( 0x%X, 0x%lX )\n", flags, size );
|
||||
|
||||
if((flags & GMEM_MOVEABLE)==0) /* POINTER */
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size);
|
||||
return (HGLOBAL) palloc;
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
|
||||
|
||||
phandle=__HeapAllocFragment(__ProcessHeap, 0, sizeof(GLOBAL_HANDLE));
|
||||
if(size)
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=(HANDLE) &(phandle->Pointer);
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
else
|
||||
phandle->Pointer=NULL;
|
||||
phandle->Magic=MAGIC_GLOBAL_USED;
|
||||
phandle->Flags=flags>>8;
|
||||
phandle->LockCount=0;
|
||||
HeapUnlock(__ProcessHeap);
|
||||
|
||||
return (HGLOBAL) &(phandle->Pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI GlobalLock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
LPVOID palloc;
|
||||
|
||||
aprintf("GlobalLock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return (LPVOID) hmem;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if(phandle->LockCount<GLOBAL_LOCK_MAX)
|
||||
phandle->LockCount++;
|
||||
palloc=phandle->Pointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalLock: invalid handle\n");
|
||||
palloc=(LPVOID) hmem;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return palloc;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI GlobalUnlock(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
BOOL locked;
|
||||
|
||||
aprintf("GlobalUnlock( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
return FALSE;
|
||||
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
if((phandle->LockCount<GLOBAL_LOCK_MAX)&&(phandle->LockCount>0))
|
||||
phandle->LockCount--;
|
||||
|
||||
locked=(phandle->LockCount==0) ? TRUE : FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalUnlock: invalid handle\n");
|
||||
locked=FALSE;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return locked;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalHandle(LPCVOID pmem)
|
||||
{
|
||||
aprintf("GlobalHandle( 0x%lX )\n", (ULONG) pmem );
|
||||
|
||||
if(((ULONG)pmem%8)==0) /* FIXED */
|
||||
return (HGLOBAL) pmem;
|
||||
else /* MOVEABLE */
|
||||
return (HGLOBAL) *(LPVOID *)(pmem-sizeof(HANDLE));
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hmem, DWORD size, UINT flags)
|
||||
{
|
||||
LPVOID palloc;
|
||||
HGLOBAL hnew;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalReAlloc( 0x%lX, 0x%lX, 0x%X )\n", (ULONG) hmem, size, flags );
|
||||
|
||||
hnew=NULL;
|
||||
HeapLock(__ProcessHeap);
|
||||
if(flags & GMEM_MODIFY) /* modify flags */
|
||||
{
|
||||
if( (((ULONG)hmem%8)==0) && (flags & GMEM_MOVEABLE))
|
||||
{
|
||||
/* make a fixed block moveable
|
||||
* actually only NT is able to do this. And it's soo simple
|
||||
*/
|
||||
size=HeapSize(__ProcessHeap, 0, (LPVOID) hmem);
|
||||
hnew=GlobalAlloc( flags, size);
|
||||
palloc=GlobalLock(hnew);
|
||||
memcpy(palloc, (LPVOID) hmem, size);
|
||||
GlobalUnlock(hnew);
|
||||
GlobalFree(hmem);
|
||||
}
|
||||
else if((((ULONG)hmem%8) != 0)&&(flags & GMEM_DISCARDABLE))
|
||||
{
|
||||
/* change the flags to make our block "discardable" */
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
phandle->Flags = phandle->Flags | (GMEM_DISCARDABLE >> 8);
|
||||
hnew=hmem;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
hnew=NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(((ULONG)hmem%8)!=0)
|
||||
{
|
||||
/* reallocate fixed memory */
|
||||
hnew=(HANDLE)HeapReAlloc(__ProcessHeap, 0, (LPVOID) hmem, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reallocate a moveable block */
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
else if(size!=0)
|
||||
{
|
||||
hnew=hmem;
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
palloc=HeapReAlloc(__ProcessHeap, 0,
|
||||
phandle->Pointer-sizeof(HANDLE),
|
||||
size+sizeof(HANDLE) );
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE));
|
||||
*(PHANDLE)palloc=hmem;
|
||||
phandle->Pointer=palloc+sizeof(HANDLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(phandle->Pointer)
|
||||
{
|
||||
HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
phandle->Pointer=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
return hnew;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HGLOBAL WINAPI GlobalFree(HGLOBAL hmem)
|
||||
{
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalFree( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%4)==0) /* POINTER */
|
||||
{
|
||||
HeapFree(__ProcessHeap, 0, (LPVOID) hmem);
|
||||
}
|
||||
else /* HANDLE */
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
if(phandle->LockCount!=0)
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
if(phandle->Pointer)
|
||||
HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE));
|
||||
__HeapFreeFragment(__ProcessHeap, 0, phandle);
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return hmem;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
DWORD WINAPI GlobalSize(HGLOBAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
aprintf("GlobalSize( 0x%lX )\n", (ULONG) hmem );
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=HeapSize(__ProcessHeap, 0, hmem);
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=HeapSize(__ProcessHeap, 0, (phandle->Pointer)-sizeof(HANDLE))-4;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI GlobalWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalLock( hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnWire -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI GlobalUnWire(HGLOBAL hmem)
|
||||
{
|
||||
return GlobalUnlock( hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
VOID WINAPI GlobalFix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalLock( hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalUnfix -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
VOID WINAPI GlobalUnfix(HGLOBAL hmem)
|
||||
{
|
||||
GlobalUnlock( hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* GlobalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI GlobalFlags(HGLOBAL hmem)
|
||||
{
|
||||
return LocalFlags( (HLOCAL) hmem);
|
||||
}
|
||||
|
1007
reactos/lib/kernel32/mem/heap.c
Normal file
1007
reactos/lib/kernel32/mem/heap.c
Normal file
File diff suppressed because it is too large
Load Diff
123
reactos/lib/kernel32/mem/local.c
Normal file
123
reactos/lib/kernel32/mem/local.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1996, Onno Hovers, All rights reserved
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/mem/local.cc
|
||||
* PURPOSE: Manages the local heap
|
||||
* PROGRAMER: Onno Hovers (original wfc version)
|
||||
* David Welch (adapted for ReactOS)
|
||||
* UPDATE HISTORY:
|
||||
* 9/4/98: Adapted from the wfc project
|
||||
*/
|
||||
|
||||
|
||||
/* NOTES
|
||||
*
|
||||
* The local heap is the same as the global heap for win32 and both are only
|
||||
* required for legacy apps
|
||||
*
|
||||
*/
|
||||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <kernel32/heap.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFlags -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalFlags(HLOCAL hmem)
|
||||
{
|
||||
DWORD retval;
|
||||
PGLOBAL_HANDLE phandle;
|
||||
|
||||
if(((ULONG)hmem%8)==0)
|
||||
{
|
||||
retval=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
HeapLock(__ProcessHeap);
|
||||
phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4);
|
||||
if(phandle->Magic==MAGIC_GLOBAL_USED)
|
||||
{
|
||||
retval=phandle->LockCount + (phandle->Flags<<8);
|
||||
if(phandle->Pointer==0)
|
||||
retval|= LMEM_DISCARDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf("GlobalSize: invalid handle\n");
|
||||
retval=0;
|
||||
}
|
||||
HeapUnlock(__ProcessHeap);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* LocalAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalAlloc(UINT flags, UINT size)
|
||||
{
|
||||
return (HLOCAL) GlobalAlloc( flags, size );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalLock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
LPVOID WINAPI LocalLock(HLOCAL hmem)
|
||||
{
|
||||
return GlobalLock( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalUnlock -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
BOOL WINAPI LocalUnlock(HLOCAL hmem)
|
||||
{
|
||||
return GlobalUnlock( (HGLOBAL) hmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalHandle -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalHandle(LPCVOID pmem)
|
||||
{
|
||||
return (HLOCAL) GlobalHandle(pmem);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalReAlloc -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalReAlloc(HLOCAL hmem, UINT size, UINT flags)
|
||||
{
|
||||
return (HLOCAL) GlobalReAlloc( (HGLOBAL) hmem, size, flags);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalFree -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
HLOCAL WINAPI LocalFree(HLOCAL hmem)
|
||||
{
|
||||
return (HLOCAL) GlobalFree( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalSize -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalSize(HLOCAL hmem)
|
||||
{
|
||||
return GlobalSize( (HGLOBAL) hmem );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* LocalShrink -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
UINT WINAPI LocalShrink(HLOCAL hmem, UINT newsize)
|
||||
{
|
||||
return (__ProcessHeap->End - (LPVOID) __ProcessHeap);
|
||||
}
|
23
reactos/lib/kernel32/mem/utils.cc
Normal file
23
reactos/lib/kernel32/mem/utils.cc
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user mode libraries
|
||||
* FILE: kernel32/mem/utils.cc
|
||||
* PURPOSE: Various simple memory initalizations functions
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
VOID ZeroMemory(PVOID Destination, DWORD Length)
|
||||
{
|
||||
#ifdef __i386__
|
||||
|
||||
#endif /* __i386__ */
|
||||
}
|
||||
|
||||
VOID CopyMemory(PVOID Destination, CONST VOID* Source, DWORD Length)
|
||||
{
|
||||
#ifdef __i386__
|
||||
#endif /* __i386__ */
|
||||
}
|
||||
|
||||
|
19
reactos/lib/kernel32/mem/virtual.c
Normal file
19
reactos/lib/kernel32/mem/virtual.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/kernel32/mem/virtual.c
|
||||
* PURPOSE: Passing the Virtualxxx functions onto the kernel
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
WINBOOL STDCALL VirtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType)
|
||||
{
|
||||
return(VirtualFreeEx(GetCurrentProcess(),lpAddress,dwSize,dwFreeType));
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user