--- /dev/null
+loaders\dos\loadros kernel\kimage.bin %1 %2 %3 %4\r
--- /dev/null
+
+ 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.
+\f
+ 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.)
+\f
+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.
+\f
+ 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.
+\f
+ 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
+\f
+ 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.
--- /dev/null
+This file attempts to document the functions made publically available by\r
+the various subsystems.\r
+\r
+* Formatted I/O operations *\r
+\r
+NAME: int vsprintf(char *buf, const char *fmt, va_list args)\r
+NAME: int sprintf(char* buf, const char* fmt, ...)\r
+WHERE: internal/kernel.h\r
+FUNCTION: The same as the standard c library versions\r
+\r
+* PIO operations *\r
+\r
+NAME: in[b/w/l](port)\r
+WHERE: internal/io.h\r
+FUNCTION: Read an IO port of the specified size (byte/word or long)\r
+RETURNS: The value read\r
+\r
+NAME: out[b/w/l](port,val)\r
+WHERE: internal/io.h\r
+FUNCTION: Write an IO port of the specified size (byte/word or long)\r
+\r
+NAME: in_p[b/w/l](port)\r
+WHERE: internal/io.h\r
+FUNCTION: Read an IO port of the specified size (byte/word or long) with\r
+ a pause\r
+RETURNS: The value read\r
+\r
+NAME: out_p[b/w/l](port,val)\r
+WHERE: internal/io.h\r
+FUNCTION: Write an IO port of the specified size (byte/word or long) with\r
+ a pause\r
+\r
+* Bit operations *\r
+\r
+NAME: int set_bit(int nr, void* addr)\r
+NAME: int clear_bit(int nr, void* addr)\r
+NAME: int change_bit(int nr, void* addr)\r
+WHERE: internal/bitops.h>\r
+FUNCTION: Operate on a bit in the word pointed to by addr\r
+RETURN: 0 if the bit was cleared before the operations\r
+ non-zero otherwise\r
+\r
+* Debugging functions *\r
+\r
+NAME: DPRINT(fmt,....)\r
+WHERE: internal/debug.h\r
+FUNCTION: Outputs a string to the console if NDEBUG isn't defined before\r
+including internal/debug.h, a NOP otherwise\r
+ARGUMENTS: The same as printf\r
+\r
+NAME: printk\r
+WHERE: internal/kernel.h\r
+FUNCTION: Outputs a string to the console\r
+ARGUMENTS: The same as printf\r
+\r
+* Memory managment functions *\r
+\r
+NAME: unsigned int physical_to_linear(unsigned int paddr)\r
+WHERE: hal/page.h\r
+FUNCTION: Converts a physical address to a linear one\r
+RECEIVES:\r
+ paddr = the physical address to convert\r
+RETURNS: A virtual address where the memory at that physical address can be \r
+accessed\r
+\r
+NAME: void* ExAllocatePool(unsigned int size, unsigned int type = 0);\r
+WHERE: internal/pool.h\r
+FUNCTION: Allocates a block of memory\r
+RECEIVES:\r
+ size = the size of the block to allocate\r
+ type = will be whether to allocate pagable memory\r
+RETURNS: The address of the block\r
+NOTE: This isn't interrupt safe\r
+\r
+NAME: void ExFreePool(void* block)\r
+WHERE: internal/pool.h\r
+FUNCTION: Frees a block of memory\r
+\r
+NAME: void free_page(unsigned int physical_base, unsigned int nr = 1)\r
+WHERE: internal/mm.h\r
+FUNCTION: Adds a continuous range of physical memory to the free list\r
+\r
+NAME: unsigned int get_free_page(void)\r
+WHERE: internal/mm.h\r
+FUNCTION: Gets a free page\r
+RETURNS: Its physical address\r
+\r
+NAME: unsigned int get_page_physical_address(unsigned int vaddr)\r
+WHERE: internal/mm.h\r
+FUNCTION: Gets the physical address of a page\r
+\r
+NAME: void mark_page_not_writable(unsigned int vaddr)\r
+WHERE: internal/mm.h\r
+FUNCTION: Prevent writing the page\r
+\r
+* DMA functions *\r
+\r
+NAME: unsigned int get_dma_page(unsigned int max_address)\r
+WHERE: internal/mm.h\r
+FUNCTION: Gets a page with a restricted physical address i.e. suitable for\r
+ dma\r
+RETURNS: The physical address of the page\r
+\r
+NAME: void disable_dma(unsigned int dmanr)\r
+WHERE: internal/dma.h\r
+FUNCTION: Disables the specified dma channel\r
+\r
+NAME: void enable_dma(unsigned int dmanr)\r
+WHERE: internal/dma.h\r
+FUNCTION: Enables the specified dma channel\r
+\r
+NAME: void clear_dma_ff(unsigned int dmanr)\r
+WHERE: internal/dma.h\r
+FUNCTION: Clear the dma flip-flop\r
+\r
+NAME: void set_dma_mode(unsigned int dmanr, char mode)\r
+WHERE: internal/dma.h\r
+FUNCTION: Sets the type of dma transfer\r
+\r
+NAME: void set_dma_page(unsigned int dmanr, char pagenr)\r
+WHERE: internal/dma.h\r
+FUNCTION: Set only the page register bits of the transfer address\r
+\r
+NAME: void set_dma_addr(unsigned int dmanr, unsigned int a)\r
+WHERE: internal/dma.h\r
+FUNCTION: Set the transfer address for dma\r
+NOTE: Assumes flip-flop is clear\r
+\r
+NAME: void set_dma_count(unsigned int dmanr, unsigned int count)\r
+WHERE: internal/dma.h\r
+FUNCTION: Sets the size of the transfer\r
+ARGUMENTS:\r
+ count = the number of bytes to transfer\r
+NOTE: Count must be even for channels 5-7\r
+\r
+NAME: int get_dma_residue(unsigned int dmanr)\r
+WHERE: internal/dma.h\r
+FUNCTION: Gets the residue remaining after a dma transfer on the channel\r
+\r
+\r
--- /dev/null
+* Kernel bugs not fixed
+
--- /dev/null
+Kernel Development FAQ (for v0.0.7)\r
+\r
+This attempts to answer some of the common questions people developing for\r
+the kernel might want to ask (or at least what I think they should ask).\r
+Obviously I can only detail those parts which I have written so other\r
+developers please fill in the gaps.\r
+\r
+Q: What is this, what are you people, what's going on\r
+A: This is the ReactOS, an operating system intended as a clone of windows\r
+NT. See the project website (http://www.sid-dis.com/reactos/) for more details.\r
+\r
+Q: Why ReactOS\r
+A: To condemn Bill Gates to penury.\r
+\r
+Q: What do I need to compile the kernel\r
+A: DJGPP, get it from http://www.delorie.com/djgpp\r
+\r
+Q: How do I compile the kernel\r
+A: Unpack the zip. It is important not to install the kernel in the same\r
+directory as a previous version, this has caused a bit of confusion in the \r
+past. Edit the makefile in the top level directory, in particular select the\r
+correct host to build from. Then run make in the top directory\r
+\r
+Q: What files are created when I make the kernel\r
+A: The following files are created in the kernel directory\r
+ kimage = the kernel as a coff executable\r
+ kimage.bin = the kernel as a raw binary image\r
+ kernel.sym = a list of the kernel symbols\r
+\r
+Q: How do I load the kernel\r
+A: Run the boot.bat batch file.\r
+\r
+Q: Does it boot from disk\r
+A: Not at the moment.\r
+\r
+Q: When I run the kernel it crashes\r
+A: The kernel (at the moment) can only be loaded from a clean system. That\r
+is one without EMM386 or any version of windows loaded. A quick way to\r
+ensure this (if you have windows 95) is to set the program to run in msdos\r
+mode and specify an empty config.sys and autoexec.bat. See the windows help\r
+for more information.\r
+\r
+If you do that and the problem persists then contact the kernel team\r
+(ros-kernel@sid-dis.com) as it is probably a bug in the kernel \r
+\r
+Q6: How do I load a module with the kernel\r
+A: Add the names of any modules to be loaded to the command line of boot.bat.\r
+\r
+Q7: I want to add code to the kernel, how do I get it to be compiled\r
+A: You will need to edit the Makefile in kernel directory. There should be\r
+a statement like this \r
+\r
+ OBJECTS = hal/head.o hal/exp.o kernel/vsprintf.o \\r
+ ....\r
+ kernel/irqhand.o hal/page.o mm/virtual.o kernel/error.o \\r
+ kernel/exports.o kernel/module.o\r
+\r
+Add the name of the object file (the file produced when your code is\r
+compiled) to the end of the statement (in this case after kernel/module.o).\r
+If you need to go onto a new line then add a slash to the end of the\r
+previous line. It is also very important to use an editor which preserves\r
+tabs.\r
+\r
+Q8: I want to add code to the kernel, how do I make it official\r
+A: Contact the kernel mailing list ros-kernel@sid-dis.com or our coordinator\r
+dwinkley@whitworth.edu. If it is for a specific section then the kernel\r
+website (http://www.geocities.com/SiliconValley/Peaks/1957) has a list of\r
+those working on individual areas, you might what to contact one of them\r
+instead.\r
+\r
+Q9: What header files should I use\r
+A: Don't include the usual DJGPP headers like stdio.h unless you are using\r
+something compiler based like stdargs.h. To use the DJGPP headers requires\r
+linking with libc which is useless in kernel mode.\r
+\r
+All the header files are in the top-level include directory which is laid\r
+out like this\r
+ include = general win32 api declarations\r
+ include/internal = private kernel headers\r
+ include/internal/hal = HAL headers\r
+ include/ddk = header files with declarations for modules\r
+\r
+There should be a file called api.txt which documents all of the functions\r
+(and which header files they need).\r
+\r
+Q11: I want to export my function for modules to use, how do I do that\r
+A: Add the function to the list in kernel/exports.lst, then remake the\r
+kernel. Note the function must be declared as extern "C".\r
+\r
+Q12: I want to make my functions part of the kernel interface to user mode,\r
+A: That section isn't finished yet, though it will probably mean adding a\r
+pointer to the function and the size of its parameters to a internal table\r
+somewhere.\r
+\r
+Q14: I want to write a module, what are the guidelines\r
+A: See modules.txt in this directory\r
+\r
+Q15: I want to write an ISR (interrupt service routine)\r
+A: See irq.txt in this directory\r
+\r
+Q16: I want to use DMA\r
+A: Firstly this answer covers only DMA via the dma chips *not*\r
+busmaster DMA.\r
+\r
+To program the dma chip use the functions in internal/dma.h (look in api.txt\r
+for details). PC DMA can only go to memory with a physical address below\r
+1mb (or 16mb on some systems), use the get_dma_page to allocate this kind\r
+of memory.\r
+\r
+Q17: You haven't answered my question\r
+A: Send your questions to ros-kernel@sid-dis.com\r
+\r
+\r
+- David Welch (welch@mcmail.com)\r
--- /dev/null
+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
+
+*
--- /dev/null
+\r
+ PORTABLE EXECUTABLE FORMAT\r
+\r
+ Author: Micheal J. O'Leary\r
+\r
+\r
+ Preface\r
+ \r
+ This document was edited and released by Microsoft Developer\r
+ Support. It describes the binary portable executable format for NT.\r
+ The information is provided at this point because we feel it will\r
+ make the work of application development easier. Unfortunately, the\r
+ information in this document may change before the final release of\r
+ Windows NT. Microsoft is NOT committing to stay with these formats\r
+ by releasing this document. Questions or follow-ups for any of the\r
+ information presented here should be posted to CompuServe MSWIN32\r
+ forum, section 6.\r
+ --Steve Firebaugh\r
+ Microsoft Developer Support\r
+ \r
+ \r
+\r
+Contents\r
+\r
+ 1. Overview\r
+\r
+ 2. PE Header\r
+\r
+ 3. Object Table\r
+\r
+ 4. Image Pages\r
+\r
+ 5. Exports\r
+ 5.1 Export Directory Table\r
+ 5.2 Export Address Table\r
+ 5.3 Export Name Table Pointers\r
+ 5.4 Export Ordinal Table\r
+ 5.5 Export Name Table\r
+\r
+ 6. Imports\r
+ 6.1 Import Directory Table\r
+ 6.2 Import Lookup Table\r
+ 6.3 Hint-Name Table\r
+ 6.4 Import Address Table\r
+\r
+ 7. Thread Local Storage\r
+ 7.1 Thread Local Storage Directory Table\r
+ 7.2 Thread Local Storage CallBack Table\r
+\r
+ 8. Resources\r
+ 8.1 Resource Directory Table\r
+ 8.2 Resource Example\r
+\r
+ 9. Fixup Table\r
+ 9.1 Fixup Block\r
+\r
+ 10. Debug Information\r
+ 10.1 Debug Directory\r
+\r
+\r
+\r
+1. Overview\r
+\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ <ÄÄ¿ <ÄÄÄÄÄ Base of Image Header\r
+ ³ DOS 2 Compatible ³ ³\r
+ ³ EXE Header ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³\r
+ ³ unused ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³\r
+ ³ OEM Identifier ³ ³\r
+ ³ OEM Info ³ ³\r
+ ³ ³ ³ DOS 2.0 Section\r
+ ³ Offset to ³ ³ (for DOS compatibility only)\r
+ ³ PE Header ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³\r
+ ³ DOS 2.0 Stub ³ ³\r
+ ³ Program & ³ ³\r
+ ³ Reloc. Table ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ <ÄÄÙ\r
+ ³ unused ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ <ÄÄÄÄÄÄÄÄÄ Aligned on 8 byte boundary\r
+ ³ PE Header ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ Object Table ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ Image Pages ³\r
+ ³ import info ³\r
+ ³ export info ³\r
+ ³ fixup info ³\r
+ ³ resource info³\r
+ ³ debug info ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 1. A typical 32-bit Portable EXE File Layout\r
+\r
+\r
+\r
+2. PE Header\r
+\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ SIGNATURE BYTES ³ CPU TYPE ³ # OBJECTS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ TIME/DATE STAMP ³ RESERVED ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³ NT HDR SIZE³ FLAGS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³LMAJOR³LMINOR³ RESERVED ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³ RESERVED ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ENTRYPOINT RVA ³ RESERVED ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³ IMAGE BASE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ OBJECT ALIGN ³ FILE ALIGN ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ OS MAJOR ³ OS MINOR ³USER MAJOR ³USER MINOR ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ SUBSYS MAJOR³ SUBSYS MINOR³ RESERVED ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ IMAGE SIZE ³ HEADER SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ FILE CHECKSUM ³ SUBSYSTEM ³ DLL FLAGS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ STACK RESERVE SIZE ³ STACK COMMIT SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ HEAP RESERVE SIZE ³ HEAP COMMIT SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³ # INTERESTING RVA/SIZES ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ EXPORT TABLE RVA ³ TOTAL EXPORT DATA SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ IMPORT TABLE RVA ³ TOTAL IMPORT DATA SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESOURCE TABLE RVA ³ TOTAL RESOURCE DATA SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ EXCEPTION TABLE RVA ³ TOTAL EXCEPTION DATA SIZE³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ SECURITY TABLE RVA ³ TOTAL SECURITY DATA SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ FIXUP TABLE RVA ³ TOTAL FIXUP DATA SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ DEBUG TABLE RVA ³ TOTAL DEBUG DIRECTORIES ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ IMAGE DESCRIPTION RVA ³ TOTAL DESCRIPTION SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ MACHINE SPECIFIC RVA ³ MACHINE SPECIFIC SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ THREAD LOCAL STORAGE RVA ³ TOTAL TLS SIZE ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 2. PE Header\r
+\r
+Notes:\r
+\r
+ o A VA is a virtual address that is already biased by the Image\r
+ Base found in the PE Header. A RVA is a virtual address that is\r
+ relative to the Image Base.\r
+ \r
+ o An RVA in the PE Header which has a value of zero indicates the\r
+ field isn't used.\r
+ \r
+ o Image pages are aligned and zero padded to a File Align\r
+ boundary. The bases of all other tables and structures must be\r
+ aligned on DWORD (4 byte) boundary. Thus, all VA's and RVA's\r
+ must be on a 32 bit boundary. All table and structure fields\r
+ must be aligned on their "natural" boundaries, with the possible\r
+ exception of the Debug Info.\r
+ \r
+SIGNATURE BYTES = DB * 4.\r
+Current value is "PE/0/0". Thats PE followed by two zeros (nulls).\r
+\r
+CPU TYPE = DW CPU Type.\r
+This field specifies the type of CPU compatibility required by this\r
+image to run. The values are:\r
+\r
+ o 0000h __unknown\r
+ \r
+ o 014Ch __80386\r
+ \r
+ o 014Dh __80486\r
+ \r
+ o 014Eh __80586\r
+ \r
+ o 0162h __MIPS Mark I (R2000, R3000)\r
+ \r
+ o 0163h __MIPS Mark II (R6000)\r
+ \r
+ o 0166h __MIPS Mark III (R4000)\r
+ \r
+# OBJECTS = DW Number of object entries.\r
+This field specifies the number of entries in the Object Table.\r
+\r
+TIME/DATE STAMP = DD Used to store the time and date the file was\r
+created or modified by the linker.\r
+\r
+NT HDR SIZE = DW This is the number of remaining bytes in the NT\r
+header that follow the FLAGS field.\r
+\r
+FLAGS = DW Flag bits for the image.\r
+The flag bits have the following definitons:\r
+\r
+ o 0000h __Program image.\r
+ \r
+ o 0002h __Image is executable.\r
+ If this bit isn't set, then it indicates that either errors\r
+ where detected at link time or that the image is being\r
+ incrementally linked and therefore can't be loaded.\r
+ \r
+ o 0200h __Fixed.\r
+ Indicates that if the image can't be loaded at the Image Base,\r
+ then don't load it.\r
+ \r
+ o 2000h __Library image.\r
+ \r
+LMAJOR/LMINOR = DB Linker major/minor version number.\r
+\r
+ENTRYPOINT RVA = DD Entrypoint relative virtual address.\r
+The address is relative to the Image Base. The address is the\r
+starting address for program images and the library initialization\r
+and library termination address for library images.\r
+\r
+IMAGE BASE = DD The virtual base of the image.\r
+This will be the virtual address of the first byte of the file (Dos\r
+Header). This must be a multiple of 64K.\r
+\r
+OBJECT ALIGN = DD The alignment of the objects. This must be a power\r
+of 2 between 512 and 256M inclusive. The default is 64K.\r
+\r
+FILE ALIGN = DD Alignment factor used to align image pages. The\r
+alignment factor (in bytes) used to align the base of the image pages\r
+and to determine the granularity of per-object trailing zero pad.\r
+Larger alignment factors will cost more file space; smaller alignment\r
+factors will impact demand load performance, perhaps significantly.\r
+Of the two, wasting file space is preferable. This value should be a\r
+power of 2 between 512 and 64K inclusive.\r
+\r
+OS MAJOR/MINOR = DW OS version number required to run this image.\r
+\r
+USER MAJOR/MINOR # = DW User major/minor version number.\r
+This is useful for differentiating between revisions of\r
+images/dynamic linked libraries. The values are specified at link\r
+time by the user.\r
+\r
+SUBSYS MAJOR/MINOR # = DW Subsystem major/minor version number.\r
+\r
+IMAGE SIZE = DD The virtual size (in bytes) of the image.\r
+This includes all headers. The total image size must be a multiple\r
+of Object Align.\r
+\r
+HEADER SIZE = DD Total header size.\r
+The combined size of the Dos Header, PE Header and Object Table.\r
+\r
+FILE CHECKSUM = DD Checksum for entire file. Set to 0 by the linker.\r
+\r
+SUBSYSTEM = DW NT Subsystem required to run this image.\r
+The values are:\r
+\r
+ o 0000h __Unknown\r
+ \r
+ o 0001h __Native\r
+ \r
+ o 0002h __Windows GUI\r
+ \r
+ o 0003h __Windows Character\r
+ \r
+ o 0005h __OS/2 Character\r
+ \r
+ o 0007h __Posix Character\r
+ \r
+DLL FLAGS = DW Indicates special loader requirements.\r
+This flag has the following bit values:\r
+\r
+ o 0001h __Per-Process Library Initialization.\r
+ \r
+ o 0002h __Per-Process Library Termination.\r
+ \r
+ o 0004h __Per-Thread Library Initialization.\r
+ \r
+ o 0008h __Per-Thread Library Termination.\r
+ \r
+All other bits are reserved for future use and should be set to zero.\r
+\r
+STACK RESERVE SIZE = DD Stack size needed for image.\r
+The memory is reserved, but only the STACK COMMIT SIZE is committed.\r
+The next page of the stack is a 'guarded page'. When the application\r
+hits the guarded page, the guarded page becomes valid, and the next\r
+page becomes the guarded page. This continues until the RESERVE SIZE\r
+is reached.\r
+\r
+STACK COMMIT SIZE = DD Stack commit size.\r
+\r
+HEAP RESERVE SIZE = DD Size of local heap to reserve.\r
+\r
+HEAP COMMIT SIZE = DD Amount to commit in local heap.\r
+\r
+# INTERESTING VA/SIZES = DD Indicates the size of the VA/SIZE array\r
+that follows.\r
+\r
+EXPORT TABLE RVA = DD Relative Virtual Address of the Export Table.\r
+This address is relative to the Image Base.\r
+\r
+IMPORT TABLE RVA = DD Relative Virtual Address of the Import Table.\r
+This address is relative to the Image Base.\r
+\r
+RESOURCE TABLE RVA = DD Relative Virtual Address of the Resource\r
+Table. This address is relative to the Image Base.\r
+\r
+EXCEPTION TABLE RVA = DD Relative Virtual Address of the Exception\r
+Table. This address is relative to the Image Base.\r
+\r
+SECURITY TABLE RVA = DD Relative Virtual Address of the Security\r
+Table. This address is relative to the Image Base.\r
+\r
+FIXUP TABLE RVA = DD Relative Virtual Address of the Fixup Table.\r
+This address is relative to the Image Base.\r
+\r
+DEBUG TABLE RVA = DD Relative Virtual Address of the Debug Table.\r
+This address is relative to the Image Base.\r
+\r
+IMAGE DESCRIPTION RVA = DD Relative Virtual Address of the\r
+description string specified in the module definiton file.\r
+\r
+MACHINE SPECIFIC RVA = DD Relative Virtual Address of a machine\r
+specific value. This address is relative to the Image Base.\r
+\r
+TOTAL EXPORT DATA SIZE = DD Total size of the export data.\r
+\r
+TOTAL IMPORT DATA SIZE = DD Total size of the import data.\r
+\r
+TOTAL RESOURCE DATA SIZE = DD Total size of the resource data.\r
+\r
+TOTAL EXCEPTION DATA SIZE = DD Total size of the exception data.\r
+\r
+TOTAL SECURITY DATA SIZE = DD Total size of the security data.\r
+\r
+TOTAL FIXUP DATA SIZE = DD Total size of the fixup data.\r
+\r
+TOTAL DEBUG DIRECTORIES = DD Total number of debug directories.\r
+\r
+TOTAL DESCRIPTION SIZE = DD Total size of the description data.\r
+\r
+MACHINE SPECIFIC SIZE = DD A machine specific value.\r
+\r
+\r
+\r
+3. Object Table\r
+\r
+The number of entries in the Object Table is given by the # Objects\r
+field in the PE Header. Entries in the Object Table are numbered\r
+starting from one. The object table immediately follows the PE\r
+Header. The code and data memory object entries are in the order\r
+chosen by the linker. The virtual addresses for objects must be\r
+assigned by the linker such that they are in ascending order and\r
+adjacent, and must be a multiple of Object Align in the PE header.\r
+\r
+Each Object Table entry has the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ OBJECT NAME ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ VIRTUAL SIZE ³ RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ PHYSICAL SIZE ³ PHYSICAL OFFSET ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³ RESERVED ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³ OBJECT FLAGS ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 3. Object Table\r
+\r
+OBJECT NAME = DB * 8 Object name. This is an eight-byte null-padded\r
+ASCII string representing the object name.\r
+\r
+VIRTUAL SIZE = DD Virtual memory size. The size of the object that\r
+will be allocated when the object is loaded. Any difference between\r
+PHYSICAL SIZE and VIRTUAL SIZE is zero filled.\r
+\r
+RVA = DD Relative Virtual Address. The virtual address the object is\r
+currently relocated to, relative to the Image Base. Each Object's\r
+virtual address space consumes a multiple of Object Align (power of 2\r
+between 512 and 256M inclusive. Default is 64K), and immediately\r
+follows the previous Object in the virtual address space (the virtual\r
+address space for a image must be dense).\r
+\r
+PHYSICAL SIZE = DD Physical file size of initialized data. The size\r
+of the initialized data in the file for the object. The physical\r
+size must be a multiple of the File Align field in the PE Header, and\r
+must be less than or equal to the Virtual Size.\r
+\r
+PHYSICAL OFFSET = DD Physical offset for object's first page. This\r
+offset is relative to beginning of the EXE file, and is aligned on a\r
+multiple of the File Align field in the PE Header. The offset is\r
+used as a seek value.\r
+\r
+OBJECT FLAGS = DD Flag bits for the object. The object flag bits\r
+have the following definitions:\r
+\r
+ o 000000020h __Code object.\r
+ \r
+ o 000000040h __Initialized data object.\r
+ \r
+ o 000000080h __Uninitialized data object.\r
+ \r
+ o 040000000h __Object must not be cached.\r
+ \r
+ o 080000000h __Object is not pageable.\r
+ \r
+ o 100000000h __Object is shared.\r
+ \r
+ o 200000000h __Executable object.\r
+ \r
+ o 400000000h __Readable object.\r
+ \r
+ o 800000000h __Writeable object.\r
+ \r
+All other bits are reserved for future use and should be set to zero.\r
+\r
+4. Image Pages\r
+\r
+The Image Pages section contains all initialized data for all\r
+objects. The seek offset for the first page in each object is\r
+specified in the object table and is aligned on a File Align\r
+boundary. The objects are ordered by the RVA. Every object begins\r
+on a multiple of Object Align.\r
+\r
+\r
+\r
+5. Exports\r
+\r
+A typical file layout for the export information follows:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DIRECTORY TABLE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ADDRESS TABLE ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NAME PTR TABLE ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ORDINAL TABLE ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NAME STRINGS ³\r
+ ³ ³\r
+ ³ ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 4. Export File Layout\r
+\r
+5.1 Export Directory Table\r
+\r
+The export information begins with the Export Directory Table which\r
+describes the remainder of the export information. The Export\r
+Directory Table contains address information that is used to resolve\r
+fixup references to the entry points within this image.\r
+\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ EXPORT FLAGS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ TIME/DATE STAMP ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ MAJOR VERSION ³ MINOR VERSION ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NAME RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ORDINAL BASE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ # EAT ENTRIES ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ # NAME PTRS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ADDRESS TABLE RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NAME PTR TABLE RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ORDINAL TABLE RVA ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 5. Export Directory Table Entry\r
+\r
+EXPORT FLAGS = DD Currently set to zero.\r
+\r
+TIME/DATE STAMP = DD Time/Date the export data was created.\r
+\r
+MAJOR/MINOR VERSION = DW A user settable major/minor version number.\r
+\r
+NAME RVA = DD Relative Virtual Address of the Dll asciiz Name.\r
+This is the address relative to the Image Base.\r
+\r
+ORDINAL BASE = DD First valid exported ordinal.\r
+This field specifies the starting ordinal number for the export\r
+address table for this image. Normally set to 1.\r
+\r
+# EAT ENTRIES = DD Indicates number of entries in the Export Address\r
+Table.\r
+\r
+# NAME PTRS = DD This indicates the number of entries in the Name Ptr\r
+Table (and parallel Ordinal Table).\r
+\r
+ADDRESS TABLE RVA = DD Relative Virtual Address of the Export Address\r
+Table.\r
+This address is relative to the Image Base.\r
+\r
+NAME TABLE RVA = DD Relative Virtual Address of the Export Name Table\r
+Pointers.\r
+This address is relative to the beginning of the Image Base. This\r
+table is an array of RVA's with # NAMES entries.\r
+\r
+ORDINAL TABLE RVA = DD Relative Virtual Address of Export Ordinals\r
+Table Entry.\r
+This address is relative to the beginning of the Image Base.\r
+\r
+5.2 Export Address Table\r
+\r
+The Export Address Table contains the address of exported entrypoints\r
+and exported data and absolutes. An ordinal number is used to index\r
+the Export Address Table. The ORDINAL BASE must be subracted from the\r
+ordinal number before indexing into this table.\r
+\r
+Export Address Table entry formats are described below:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ EXPORTED RVA ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 6. Export Address Table Entry\r
+\r
+EXPORTED RVA = DD Export address.\r
+This field contains the relative virtual address of the exported\r
+entry (relative to the Image Base).\r
+\r
+5.3 Export Name Table Pointers\r
+\r
+The export name table pointers array contains address into the Export\r
+Name Table. The pointers are 32-bits each, and are relative to the\r
+Image Base. The pointers are ordered lexically to allow binary\r
+searches.\r
+\r
+5.4 Export Ordinal Table\r
+\r
+The Export Name Table Pointers and the Export Ordinal Table form two\r
+parallel arrays, separated to allow natural field alignment. The\r
+export ordinal table array contains the Export Address Table ordinal\r
+numbers associated with the named export referenced by corresponding\r
+Export Name Table Pointers.\r
+\r
+The ordinals are 16-bits each, and already include the Ordinal Base\r
+stored in the Export Directory Table.\r
+\r
+5.5 Export Name Table\r
+\r
+The export name table contains optional ASCII names for exported\r
+entries in the image. These tables are used with the array of Export\r
+Name Table Pointers and the array of Export Ordinals to translate a\r
+procedure name string into an ordinal number by searching for a\r
+matching name string. The ordinal number is used to locate the entry\r
+point information in the export address table.\r
+\r
+Import references by name require the Export Name Table Pointers\r
+table to be binary searched to find the matching name, then the\r
+corresponding Export Ordinal Table is known to contain the entry\r
+point ordinal number. Import references by ordinal number provide\r
+the fastest lookup since searching the name table is not required.\r
+\r
+Each name table entry has the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ ASCII STRING ::: :::::::: '\0' ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 7. Export Name Table Entry\r
+\r
+ASCII STRING = DB ASCII String.\r
+The string is case sensitive and is terminated by a null byte.\r
+\r
+\r
+\r
+6. Imports\r
+\r
+A typical file layout for the import information follows:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DIRECTORY TABLE ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL DIR ENTRY ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DLL1 LOOKUP TABLE ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DLL2 LOOKUP TABLE ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ Dll3 LOOKUP TABLE ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ HINT-NAME TABLE ³\r
+ ³ ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DLL1 ADDRESS TABLE ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DLL2 ADDRESS TABLE ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DLL3 ADDRESS TABLE ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 8. Import File Layout\r
+\r
+6.1 Import Directory Table\r
+\r
+The import information begins with the Import Directory Table which\r
+describes the remainder of the import information. The Import\r
+Directory Table contains address information that is used to resolve\r
+fixup references to the entry points within a DLL image. The import\r
+directory table consists of an array of Import Directory Entries, one\r
+entry for each DLL this image references. The last directory entry is\r
+empty (NULL) which indicates the end of the directory table.\r
+\r
+An Import Directory Entry has the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ IMPORT FLAGS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ TIME/DATE STAMP ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ MAJOR VERSION ³ MINOR VERSION ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NAME RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ IMPORT LOOKUP TABLE RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ IMPORT ADDRESS TABLE RVA ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 9. Import Directory Entry\r
+\r
+IMPORT FLAGS = DD Currently set to zero.\r
+\r
+TIME/DATE STAMP = DD Time/Date the import data was pre-snapped or\r
+zero if not pre-snapped.\r
+\r
+MAJOR/MINOR VERSION = DW The major/minor version number of the dll\r
+being referenced.\r
+\r
+NAME RVA = DD Relative Virtual Address of the Dll asciiz Name.\r
+This is the address relative to the Image Base.\r
+\r
+IMPORT LOOKUP TABLE RVA = DD This field contains the address of the\r
+start of the import lookup table for this image. The address is\r
+relative to the beginning of the Image Base.\r
+\r
+IMPORT ADDRESS TABLE RVA = DD This field contains the address of the\r
+start of the import addresses for this image. The address is\r
+relative to the beginning of the Image Base.\r
+\r
+6.2 Import Lookup Table\r
+\r
+The Import Lookup Table is an array of ordinal or hint/name RVA's for\r
+each DLL. The last entry is empty (NULL) which indicates the end of\r
+the table.\r
+\r
+The last element is empty.\r
+\r
+ 3 0\r
+ 1\r
+ ÚÄÒÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³0º ORDINAL#/HINT-NAME TABLE RVA ³\r
+ ÀÄÐÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 10. Import Address Table Format\r
+\r
+ORDINAL/HINT-NAME TABLE RVA = 31-bits (mask = 7fffffffh) Ordinal\r
+Number or Name Table RVA.\r
+If the import is by ordinal, this field contains a 31 bit ordinal\r
+number. If the import is by name, this field contains a 31 bit\r
+address relative to the Image Base to the Hint-Name Table.\r
+\r
+O = 1-bit (mask = 80000000h) Import by ordinal flag.\r
+\r
+ o 00000000h __Import by name.\r
+ \r
+ o 80000000h __Import by ordinal.\r
+ \r
+6.3 Hint-Name Table\r
+\r
+The Hint-Name Table format follows:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ HINT ³ ASCII STRING |||³\r
+ ÃÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄ´\r
+ ³|||||||||||||||||³ '\0' PAD ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+ \r
+ The PAD field is optional.\r
+ \r
+Figure 11. Import Hint-Name Table\r
+\r
+HINT = DW Hint into Export Name Table Pointers.\r
+The hint value is used to index the Export Name Table Pointers array,\r
+allowing faster by-name imports. If the hint is incorrect, then a\r
+binary search is performed on the Export Name Ptr Table.\r
+\r
+ASCII STRING = DB ASCII String.\r
+The string is case sensitive and is terminated by a null byte.\r
+\r
+PAD = DB Zero pad byte.\r
+A trailing zero pad byte appears after the trailing null byte if\r
+necessary to align the next entry on an even boundary.\r
+\r
+The loader overwrites the import address table when loading the image\r
+with the 32-bit address of the import.\r
+\r
+\r
+\r
+6.4 Import Address Table\r
+\r
+The Import Address Table is an array of addresses of the imported\r
+routines for each DLL. The last entry is empty (NULL) which indicates\r
+the end of the table.\r
+\r
+7. Thread Local Storage\r
+\r
+Thread local storage is a special contiguous block of data. Each\r
+thread will gets its own block upon creation of the thread.\r
+\r
+The file layout for thread local storage follows:\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ DIRECTORY TABLE ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ TLS DATA ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ INDEX VARIABLE ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ CALLBACK ADDRESSES ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+\r
+Figure 12. Thread Local Storage Layout\r
+\r
+7.1 Thread Local Storage Directory Table\r
+\r
+The Thread Local Storage Directory Table contains address information\r
+that is used to describe the rest of TLS.\r
+\r
+The Thread Local Storage Directory Table has the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ START DATA BLOCK VA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ END DATA BLOCK VA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ INDEX VA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ CALLBACK TABLE VA ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 13. Thread Local Storage Directory Table\r
+\r
+START DATA BLOCK VA = DD Virtual Address of the start of the thread\r
+local storage data block.\r
+\r
+END DATA BLOCK VA = DD Virtual Address of the end of the thread local\r
+storage data block.\r
+\r
+INDEX VA = DD Virtual Address of the index variable used to access\r
+the thread local storage data block.\r
+\r
+CALLBACK TABLE VA = DD Virtual Address of the callback table.\r
+\r
+7.2 Thread Local Storage CallBack Table\r
+\r
+The Thread Local Storage Callbacks is an array of Virtual Address of\r
+functions to be called by the loader after thread creation and thread\r
+termination. The last entry is empty (NULL) which indicates the end\r
+of the table.\r
+\r
+The Thread Local Storage CallBack Table has the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ FUNCTION1 VA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ FUNCTION2 VA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ NULL ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 14. Thread Local Storage CallBack Table\r
+\r
+8. Resources\r
+\r
+Resources are indexed by a multiple level binary-sorted tree\r
+structure. The overall design can incorporate 2**31 levels, however,\r
+NT uses only three: the highest is TYPE, then NAME, then LANGUAGE.\r
+\r
+A typical file layout for the resource information follows:\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ RESOURCE DIRECTORY ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESOURCE DATA ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ³ ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 15. Resource File Layout\r
+\r
+\r
+The Resource directory is made up of the following tables:\r
+\r
+\r
+\r
+8.1 Resource Directory Table\r
+ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+³ RESOURCE FLAGS ³\r
+ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+³ TIME/DATE STAMP ³\r
+ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+³ MAJOR VERSION ³ MINOR VERSION ³\r
+ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+³ # NAME ENTRY ³ # ID ENTRY ³\r
+ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+³ RESOURCE DIR ENTRIES ³\r
+ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+\r
+Figure 16. Resource Table Entry\r
+\r
+\r
+RESOURCE FLAGS = DD Currently set to zero.\r
+\r
+TIME/DATE STAMP = DD Time/Date the resource data was created by the\r
+resource compiler.\r
+\r
+MAJOR/MINOR VERSION = DW A user settable major/minor version number.\r
+\r
+# NAME ENTRY = DW The number of name entries.\r
+This field contains the number of entries at the beginning of the\r
+array of directory entries which have actual string names associated\r
+with them.\r
+\r
+# ID ENTRY = DW The number of ID integer entries.\r
+This field contains the number of 32-bit integer IDs as their names\r
+in the array of directory entries.\r
+\r
+The resource directory is followed by a variable length array of\r
+directory entries. # NAME ENTRY is the number of entries at the\r
+beginning of the array that have actual names associated with each\r
+entry. The entires are in ascending order, case insensitive strings.\r
+# ID ENTRY identifies the number of entries that have 32-bit integer\r
+IDs as their name. These entries are also sorted in ascending order.\r
+\r
+This structure allows fast lookup by either name or number, but for\r
+any given resource entry only one form of lookup is supported, not\r
+both. This is consistent with the syntax of the .RC file and the .RES\r
+file.\r
+\r
+\r
+\r
+The array of directory entries have the following format:\r
+ 3 0\r
+ 1\r
+ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+³ NAME RVA/INTEGER ID ³\r
+ÃÄÒÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+³Eº DATA ENTRY RVA/SUBDIR RVA ³\r
+ÀÄÐÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+\r
+Figure 17. Resource Directory Entry\r
+\r
+\r
+INTERGER ID = DD ID.\r
+This field contains a integer ID field to identify a resource.\r
+\r
+NAME RVA = DD Name RVA address.\r
+This field contains a 31-bit address relative to the beginning of the\r
+Image Base to a Resource Directory String Entry.\r
+\r
+E = 1-bit (mask 80000000h) Unescape bit.\r
+This bit is zero for unescaped Resource Data Entries.\r
+\r
+DATA RVA = 31-bits (mask 7fffffffh) Data entry address.\r
+This field contains a 31-bit address relative to the beginning of the\r
+Image Base to a Resource Data Entry.\r
+\r
+E = 1-bit (mask 80000000h) Escape bit.\r
+This bit is 1 for escaped Subdirectory Entry.\r
+\r
+DATA RVA = 31-bits (mask 7fffffffh) Directory entries.\r
+This field contains a 31-bit address relative to the beginning of the\r
+Image Base to Subdirectory Entry.\r
+\r
+\r
+\r
+Each resource directory string entry has the following format:\r
+ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+³ LENGTH ³ UNICODE STRING ³\r
+ÃÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄ´\r
+³ ³\r
+ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+\r
+Figure 18. Resource Directory String Entry\r
+\r
+\r
+LENGTH = DW Length of string.\r
+\r
+UNICODE STRING = DW UNICODE String.\r
+\r
+All of these string objects are stored together after the last\r
+resource directory entry and before the first resource data object.\r
+This minimizes the impact of these variable length objects on the\r
+alignment of the fixed size directory entry objects. The length needs\r
+to be word aligned.\r
+\r
+\r
+\r
+Each Resource Data Entry has the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ DATA RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ CODEPAGE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ RESERVED ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 19. Resource Data Entry\r
+\r
+\r
+\r
+DATA RVA = DD Address of Resource Data.\r
+This field contains 32-bit virtaul address of the resource data\r
+(relative to the Image Base).\r
+\r
+SIZE = DD Size of Resource Data.\r
+This field contains the size of the resource data for this resource.\r
+\r
+CODEPAGE = DD Codepage.\r
+\r
+RESERVED = DD Reserved - must be zero.\r
+\r
+Each resource data entry describes a leaf node in the resource\r
+directory tree. It contains an address which is relative to the\r
+beginning of Image Base, a size field that gives the number of bytes\r
+of data at that address, a CodePage that should be used when decoding\r
+code point values within the resource data. Typically for new\r
+applications the code page would be the unicode code page.\r
+\r
+\r
+\r
+8.2 Resource Example\r
+\r
+The following is an example for an app. which wants to use the following data\r
+as resources:\r
+\r
+ TypeId# NameId# Language ID Resource Data\r
+ 00000001 00000001 0 00010001\r
+ 00000001 00000001 1 10010001\r
+ 00000001 00000002 0 00010002\r
+ 00000001 00000003 0 00010003\r
+ 00000002 00000001 0 00020001\r
+ 00000002 00000002 0 00020002\r
+ 00000002 00000003 0 00020003\r
+ 00000002 00000004 0 00020004\r
+ 00000009 00000001 0 00090001\r
+ 00000009 00000009 0 00090009\r
+ 00000009 00000009 1 10090009\r
+ 00000009 00000009 2 20090009\r
+\r
+Then the Resource Directory in the Portable format looks like:\r
+Offset Data\r
+0000: 00000000 00000000 00000000 00030000 (3 entries in this directory)\r
+0010: 00000001 80000028 (TypeId #1, Subdirectory at offset 0x28)\r
+0018: 00000002 80000050 (TypeId #2, Subdirectory at offset 0x50)\r
+0020: 00000009 80000080 (TypeId #9, Subdirectory at offset 0x80)\r
+0028: 00000000 00000000 00000000 00030000 (3 entries in this directory)\r
+0038: 00000001 800000A0 (NameId #1, Subdirectory at offset 0xA0)\r
+0040: 00000002 00000108 (NameId #2, data desc at offset 0x108)\r
+0048: 00000003 00000118 (NameId #3, data desc at offset 0x118)\r
+0050: 00000000 00000000 00000000 00040000 (4 entries in this directory)\r
+0060: 00000001 00000128 (NameId #1, data desc at offset 0x128)\r
+0068: 00000002 00000138 (NameId #2, data desc at offset 0x138)\r
+0070: 00000003 00000148 (NameId #3, data desc at offset 0x148)\r
+0078: 00000004 00000158 (NameId #4, data desc at offset 0x158)\r
+0080: 00000000 00000000 00000000 00020000 (2 entries in this directory)\r
+0090: 00000001 00000168 (NameId #1, data desc at offset 0x168)\r
+0098: 00000009 800000C0 (NameId #9, Subdirectory at offset 0xC0)\r
+00A0: 00000000 00000000 00000000 00020000 (2 entries in this directory)\r
+00B0: 00000000 000000E8 (Language ID 0, data desc at offset 0xE8\r
+00B8: 00000001 000000F8 (Language ID 1, data desc at offset 0xF8\r
+00C0: 00000000 00000000 00000000 00030000 (3 entries in this directory)\r
+00D0: 00000001 00000178 (Language ID 0, data desc at offset 0x178\r
+00D8: 00000001 00000188 (Language ID 1, data desc at offset 0x188\r
+00E0: 00000001 00000198 (Language ID 2, data desc at offset 0x198\r
+\r
+00E8: 000001A8 (At offset 0x1A8, for TypeId #1, NameId #1, Language id #0\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+00F8: 000001AC (At offset 0x1AC, for TypeId #1, NameId #1, Language id #1\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0108: 000001B0 (At offset 0x1B0, for TypeId #1, NameId #2,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0118: 000001B4 (At offset 0x1B4, for TypeId #1, NameId #3,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0128: 000001B8 (At offset 0x1B8, for TypeId #2, NameId #1,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0138: 000001BC (At offset 0x1BC, for TypeId #2, NameId #2,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0148: 000001C0 (At offset 0x1C0, for TypeId #2, NameId #3,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0158: 000001C4 (At offset 0x1C4, for TypeId #2, NameId #4,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0168: 000001C8 (At offset 0x1C8, for TypeId #9, NameId #1,\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0178: 000001CC (At offset 0x1CC, for TypeId #9, NameId #9, Language id #0\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0188: 000001D0 (At offset 0x1D0, for TypeId #9, NameId #9, Language id #1\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+0198: 000001D4 (At offset 0x1D4, for TypeId #9, NameId #9, Language id #2\r
+ 00000004 (4 bytes of data)\r
+ 00000000 (codepage)\r
+ 00000000 (reserved)\r
+\r
+And the data for the resources will look like:\r
+01A8: 00010001\r
+01AC: 10010001\r
+01B0: 00010002\r
+01B4: 00010003\r
+01B8: 00020001\r
+01BC: 00020002\r
+01C0: 00020003\r
+01C4: 00020004\r
+01C8: 00090001\r
+01CC: 00090009\r
+01D0: 10090009\r
+01D4: 20090009\r
+\r
+\r
+9. Fixup Table\r
+\r
+The Fixup Table contains entries for all fixups in the image. The\r
+Total Fixup Data Size in the PE Header is the number of bytes in the\r
+fixup table. The fixup table is broken into blocks of fixups. Each\r
+block represents the fixups for a 4K page.\r
+\r
+Fixups that are resolved by the linker do not need to be processed by\r
+the loader, unless the load image can't be loaded at the Image Base\r
+specified in the PE Header.\r
+\r
+9.1 Fixup Block\r
+\r
+Fixup blocks have the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³ PAGE RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ BLOCK SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ TYPE/OFFSET ³ TYPE/OFFSET ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ TYPE/OFFSET ³ ... ³\r
+ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 20. Fixup Block Format\r
+\r
+To apply a fixup, a delta needs to be calculated. The 32-bit delta\r
+is the difference between the preferred base, and the base where the\r
+image is actually loaded. If the image is loaded at its preferred\r
+base, the delta would be zero, and thus the fixups would not have to\r
+be applied. Each block must start on a DWORD boundary. The ABSOLUTE\r
+fixup type can be used to pad a block.\r
+\r
+PAGE RVA = DD Page RVA. The image base plus the page rva is added to\r
+each offset to create the virtual address of where the fixup needs to\r
+be applied.\r
+\r
+BLOCK SIZE = DD Number of bytes in the fixup block. This includes the\r
+PAGE RVA and SIZE fields.\r
+\r
+TYPE/OFFSET is defined as:\r
+\r
+ 1 1 0\r
+ 5 1\r
+ ÚÄÄÄÄÒÄÄÄÄÄÄÄÄÄÄÄÄ¿\r
+ ³TYPEº OFFSET ³\r
+ ÀÄÄÄÄÐÄÄÄÄÄÄÄÄÄÄÄÄÙ\r
+Figure 21. Fixup Record Format\r
+\r
+TYPE = 4-bit fixup type. This value has the following definitions:\r
+\r
+ o 0h __ABSOLUTE. This is a NOP. The fixup is skipped.\r
+ \r
+ o 1h __HIGH. Add the high 16-bits of the delta to the 16-bit field\r
+ at Offset. The 16-bit field represents the high value of a 32-\r
+ bit word.\r
+ \r
+ o 2h __LOW. Add the low 16-bits of the delta to the 16-bit field\r
+ at Offset. The 16-bit field represents the low half value of a\r
+ 32-bit word. This fixup will only be emitted for a RISC machine\r
+ when the image Object Align isn't the default of 64K.\r
+ \r
+ o 3h __HIGHLOW. Apply the 32-bit delta to the 32-bit field at\r
+ Offset.\r
+ \r
+ o 4h __HIGHADJUST. This fixup requires a full 32-bit value. The\r
+ high 16-bits is located at Offset, and the low 16-bits is\r
+ located in the next Offset array element (this array element is\r
+ included in the SIZE field). The two need to be combined into a\r
+ signed variable. Add the 32-bit delta. Then add 0x8000 and\r
+ store the high 16-bits of the signed variable to the 16-bit\r
+ field at Offset.\r
+ \r
+ o 5h __MIPSJMPADDR.\r
+ \r
+All other values are reserved.\r
+\r
+\r
+\r
+10. Debug Information\r
+\r
+The debug information is defined by the debugger and is not\r
+controlled by the portable EXE format or linker. The only data\r
+defined by the portable EXE format is the Debug Directory Table.\r
+\r
+10.1 Debug Directory\r
+\r
+The debug directory table consists of one or more entries that have\r
+the following format:\r
+\r
+ ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿\r
+ ³ DEBUG FLAGS ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ TIME/DATE STAMP ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ MAJOR VERSION ³ MINOR VERSION ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ DEBUG TYPE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ DATA SIZE ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ DATA RVA ³\r
+ ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´\r
+ ³ DATA SEEK ³\r
+ ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ\r
+ \r
+Figure 22. Debug Directory Entry\r
+\r
+DEBUG FLAGS = DD Set to zero for now.\r
+\r
+TIME/DATE STAMP = DD Time/Date the debug data was created.\r
+\r
+MAJOR/MINOR VERSION = DW Version stamp.\r
+This stamp can be used to determine the version of the debug data.\r
+\r
+DEBUG TYPE = DD Format type.\r
+To support multiple debuggers, this field determines the format of\r
+the debug information. This value has the following definitions:\r
+\r
+ o 0001h __Image contains COFF symbolics.\r
+ \r
+ o 0001h __Image contains CodeView symbolics.\r
+ \r
+ o 0001h __Image contains FPO symbolics.\r
+ \r
+DATA SIZE = DD The number of bytes in the debug data. This is the\r
+size of the actual debug data and does not include the debug\r
+directory.\r
+\r
+DATA RVA = DD The relative virtual address of the debug data. This\r
+address is relative to the beginning of the Image Base.\r
+\r
+DATA SEEK = DD The seek value from the beginning of the file to the\r
+debug data.\r
+\r
+If the image contains more than one type of debug information, then\r
+the next debug directory will immediately follow the first debug\r
+directory.\r
--- /dev/null
+This contains documentation describing the internals of the various kernel
+subsystems and a few other useful bits of information.
--- /dev/null
+** 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.
+
--- /dev/null
+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
--- /dev/null
+** 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
--- /dev/null
+* 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
--- /dev/null
+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
\ No newline at end of file
--- /dev/null
+/*
+ ASCIIFunctions.h
+
+ Declarations for all the Win32 ASCII Functions
+
+ 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_ASCIIFUNCTIONS
+#define _GNU_H_WINDOWS32_ASCIIFUNCTIONS
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+WINBOOL
+STDCALL
+GetBinaryTypeA(
+ LPCSTR lpApplicationName,
+ LPDWORD lpBinaryType
+ );
+
+DWORD
+STDCALL
+GetShortPathNameA(
+ LPCSTR lpszLongPath,
+ LPSTR lpszShortPath,
+ DWORD cchBuffer
+ );
+
+LPSTR
+STDCALL
+GetEnvironmentStringsA(
+ VOID
+ );
+
+WINBOOL
+STDCALL
+FreeEnvironmentStringsA(
+ LPSTR
+ );
+
+DWORD
+STDCALL
+FormatMessageA(
+ DWORD dwFlags,
+ LPCVOID lpSource,
+ DWORD dwMessageId,
+ DWORD dwLanguageId,
+ LPSTR lpBuffer,
+ DWORD nSize,
+ va_list *Arguments
+ );
+
+HANDLE
+STDCALL
+CreateMailslotA(
+ LPCSTR lpName,
+ DWORD nMaxMessageSize,
+ DWORD lReadTimeout,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+int
+STDCALL
+lstrcmpA(
+ LPCSTR lpString1,
+ LPCSTR lpString2
+ );
+
+int
+STDCALL
+lstrcmpiA(
+ LPCSTR lpString1,
+ LPCSTR lpString2
+ );
+
+LPSTR
+STDCALL
+lstrcpynA(
+ LPSTR lpString1,
+ LPCSTR lpString2,
+ int iMaxLength
+ );
+
+LPSTR
+STDCALL
+lstrcpyA(
+ LPSTR lpString1,
+ LPCSTR lpString2
+ );
+
+LPSTR
+STDCALL
+lstrcatA(
+ LPSTR lpString1,
+ LPCSTR lpString2
+ );
+
+int
+STDCALL
+lstrlenA(
+ LPCSTR lpString
+ );
+
+HANDLE
+STDCALL
+CreateMutexA(
+ LPSECURITY_ATTRIBUTES lpMutexAttributes,
+ WINBOOL bInitialOwner,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+OpenMutexA(
+ DWORD dwDesiredAccess,
+ WINBOOL bInheritHandle,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+CreateEventA(
+ LPSECURITY_ATTRIBUTES lpEventAttributes,
+ WINBOOL bManualReset,
+ WINBOOL bInitialState,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+OpenEventA(
+ DWORD dwDesiredAccess,
+ WINBOOL bInheritHandle,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+CreateSemaphoreA(
+ LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
+ LONG lInitialCount,
+ LONG lMaximumCount,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+OpenSemaphoreA(
+ DWORD dwDesiredAccess,
+ WINBOOL bInheritHandle,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+CreateFileMappingA(
+ HANDLE hFile,
+ LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
+ DWORD flProtect,
+ DWORD dwMaximumSizeHigh,
+ DWORD dwMaximumSizeLow,
+ LPCSTR lpName
+ );
+
+HANDLE
+STDCALL
+OpenFileMappingA(
+ DWORD dwDesiredAccess,
+ WINBOOL bInheritHandle,
+ LPCSTR lpName
+ );
+
+DWORD
+STDCALL
+GetLogicalDriveStringsA(
+ DWORD nBufferLength,
+ LPSTR lpBuffer
+ );
+
+HINSTANCE
+STDCALL
+LoadLibraryA(
+ LPCSTR lpLibFileName
+ );
+
+HINSTANCE
+STDCALL
+LoadLibraryExA(
+ LPCSTR lpLibFileName,
+ HANDLE hFile,
+ DWORD dwFlags
+ );
+
+DWORD
+STDCALL
+GetModuleFileNameA(
+ HINSTANCE hModule,
+ LPSTR lpFilename,
+ DWORD nSize
+ );
+
+HMODULE
+STDCALL
+GetModuleHandleA(
+ LPCSTR lpModuleName
+ );
+
+VOID
+STDCALL
+FatalAppExitA(
+ UINT uAction,
+ LPCSTR lpMessageText
+ );
+
+LPSTR
+STDCALL
+GetCommandLineA(
+ VOID
+ );
+
+DWORD
+STDCALL
+GetEnvironmentVariableA(
+ LPCSTR lpName,
+ LPSTR lpBuffer,
+ DWORD nSize
+ );
+
+WINBOOL
+STDCALL
+SetEnvironmentVariableA(
+ LPCSTR lpName,
+ LPCSTR lpValue
+ );
+
+DWORD
+STDCALL
+ExpandEnvironmentStringsA(
+ LPCSTR lpSrc,
+ LPSTR lpDst,
+ DWORD nSize
+ );
+
+VOID
+STDCALL
+OutputDebugStringA(
+ LPCSTR lpOutputString
+ );
+
+HRSRC
+STDCALL
+FindResourceA(
+ HINSTANCE hModule,
+ LPCSTR lpName,
+ LPCSTR lpType
+ );
+
+HRSRC
+STDCALL
+FindResourceExA(
+ HINSTANCE hModule,
+ LPCSTR lpType,
+ LPCSTR lpName,
+ WORD wLanguage
+ );
+
+WINBOOL
+STDCALL
+EnumResourceTypesA(
+ HINSTANCE hModule,
+ ENUMRESTYPEPROC lpEnumFunc,
+ LONG lParam
+ );
+
+WINBOOL
+STDCALL
+EnumResourceNamesA(
+ HINSTANCE hModule,
+ LPCSTR lpType,
+ ENUMRESNAMEPROC lpEnumFunc,
+ LONG lParam
+ );
+
+WINBOOL
+STDCALL
+EnumResourceLanguagesA(
+ HINSTANCE hModule,
+ LPCSTR lpType,
+ LPCSTR lpName,
+ ENUMRESLANGPROC lpEnumFunc,
+ LONG lParam
+ );
+
+HANDLE
+STDCALL
+BeginUpdateResourceA(
+ LPCSTR pFileName,
+ WINBOOL bDeleteExistingResources
+ );
+
+WINBOOL
+STDCALL
+UpdateResourceA(
+ HANDLE hUpdate,
+ LPCSTR lpType,
+ LPCSTR lpName,
+ WORD wLanguage,
+ LPVOID lpData,
+ DWORD cbData
+ );
+
+WINBOOL
+STDCALL
+EndUpdateResourceA(
+ HANDLE hUpdate,
+ WINBOOL fDiscard
+ );
+
+ATOM
+STDCALL
+GlobalAddAtomA(
+ LPCSTR lpString
+ );
+
+ATOM
+STDCALL
+GlobalFindAtomA(
+ LPCSTR lpString
+ );
+
+UINT
+STDCALL
+GlobalGetAtomNameA(
+ ATOM nAtom,
+ LPSTR lpBuffer,
+ int nSize
+ );
+
+ATOM
+STDCALL
+AddAtomA(
+ LPCSTR lpString
+ );
+
+ATOM
+STDCALL
+FindAtomA(
+ LPCSTR lpString
+ );
+
+UINT
+STDCALL
+GetAtomNameA(
+ ATOM nAtom,
+ LPSTR lpBuffer,
+ int nSize
+ );
+
+UINT
+STDCALL
+GetProfileIntA(
+ LPCSTR lpAppName,
+ LPCSTR lpKeyName,
+ INT nDefault
+ );
+
+DWORD
+STDCALL
+GetProfileStringA(
+ LPCSTR lpAppName,
+ LPCSTR lpKeyName,
+ LPCSTR lpDefault,
+ LPSTR lpReturnedString,
+ DWORD nSize
+ );
+
+WINBOOL
+STDCALL
+WriteProfileStringA(
+ LPCSTR lpAppName,
+ LPCSTR lpKeyName,
+ LPCSTR lpString
+ );
+
+DWORD
+STDCALL
+GetProfileSectionA(
+ LPCSTR lpAppName,
+ LPSTR lpReturnedString,
+ DWORD nSize
+ );
+
+WINBOOL
+STDCALL
+WriteProfileSectionA(
+ LPCSTR lpAppName,
+ LPCSTR lpString
+ );
+
+UINT
+STDCALL
+GetPrivateProfileIntA(
+ LPCSTR lpAppName,
+ LPCSTR lpKeyName,
+ INT nDefault,
+ LPCSTR lpFileName
+ );
+
+DWORD
+STDCALL
+GetPrivateProfileStringA(
+ LPCSTR lpAppName,
+ LPCSTR lpKeyName,
+ LPCSTR lpDefault,
+ LPSTR lpReturnedString,
+ DWORD nSize,
+ LPCSTR lpFileName
+ );
+
+WINBOOL
+STDCALL
+WritePrivateProfileStringA(
+ LPCSTR lpAppName,
+ LPCSTR lpKeyName,
+ LPCSTR lpString,
+ LPCSTR lpFileName
+ );
+
+DWORD
+STDCALL
+GetPrivateProfileSectionA(
+ LPCSTR lpAppName,
+ LPSTR lpReturnedString,
+ DWORD nSize,
+ LPCSTR lpFileName
+ );
+
+WINBOOL
+STDCALL
+WritePrivateProfileSectionA(
+ LPCSTR lpAppName,
+ LPCSTR lpString,
+ LPCSTR lpFileName
+ );
+
+UINT
+STDCALL
+GetDriveTypeA(
+ LPCSTR lpRootPathName
+ );
+
+UINT
+STDCALL
+GetSystemDirectoryA(
+ LPSTR lpBuffer,
+ UINT uSize
+ );
+
+DWORD
+STDCALL
+GetTempPathA(
+ DWORD nBufferLength,
+ LPSTR lpBuffer
+ );
+
+UINT
+STDCALL
+GetTempFileNameA(
+ LPCSTR lpPathName,
+ LPCSTR lpPrefixString,
+ UINT uUnique,
+ LPSTR lpTempFileName
+ );
+
+UINT
+STDCALL
+GetWindowsDirectoryA(
+ LPSTR lpBuffer,
+ UINT uSize
+ );
+
+WINBOOL
+STDCALL
+SetCurrentDirectoryA(
+ LPCSTR lpPathName
+ );
+
+DWORD
+STDCALL
+GetCurrentDirectoryA(
+ DWORD nBufferLength,
+ LPSTR lpBuffer
+ );
+
+WINBOOL
+STDCALL
+GetDiskFreeSpaceA(
+ LPCSTR lpRootPathName,
+ LPDWORD lpSectorsPerCluster,
+ LPDWORD lpBytesPerSector,
+ LPDWORD lpNumberOfFreeClusters,
+ LPDWORD lpTotalNumberOfClusters
+ );
+
+WINBOOL
+STDCALL
+CreateDirectoryA(
+ LPCSTR lpPathName,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+WINBOOL
+STDCALL
+CreateDirectoryExA(
+ LPCSTR lpTemplateDirectory,
+ LPCSTR lpNewDirectory,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+WINBOOL
+STDCALL
+RemoveDirectoryA(
+ LPCSTR lpPathName
+ );
+
+DWORD
+STDCALL
+GetFullPathNameA(
+ LPCSTR lpFileName,
+ DWORD nBufferLength,
+ LPSTR lpBuffer,
+ LPSTR *lpFilePart
+ );
+
+WINBOOL
+STDCALL
+DefineDosDeviceA(
+ DWORD dwFlags,
+ LPCSTR lpDeviceName,
+ LPCSTR lpTargetPath
+ );
+
+DWORD
+STDCALL
+QueryDosDeviceA(
+ LPCSTR lpDeviceName,
+ LPSTR lpTargetPath,
+ DWORD ucchMax
+ );
+
+HANDLE
+STDCALL
+CreateFileA(
+ LPCSTR lpFileName,
+ DWORD dwDesiredAccess,
+ DWORD dwShareMode,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ DWORD dwCreationDisposition,
+ DWORD dwFlagsAndAttributes,
+ HANDLE hTemplateFile
+ );
+
+WINBOOL
+STDCALL
+SetFileAttributesA(
+ LPCSTR lpFileName,
+ DWORD dwFileAttributes
+ );
+
+DWORD
+STDCALL
+GetFileAttributesA(
+ LPCSTR lpFileName
+ );
+
+DWORD
+STDCALL
+GetCompressedFileSizeA(
+ LPCSTR lpFileName,
+ LPDWORD lpFileSizeHigh
+ );
+
+WINBOOL
+STDCALL
+DeleteFileA(
+ LPCSTR lpFileName
+ );
+
+DWORD
+STDCALL
+SearchPathA(
+ LPCSTR lpPath,
+ LPCSTR lpFileName,
+ LPCSTR lpExtension,
+ DWORD nBufferLength,
+ LPSTR lpBuffer,
+ LPSTR *lpFilePart
+ );
+
+WINBOOL
+STDCALL
+CopyFileA(
+ LPCSTR lpExistingFileName,
+ LPCSTR lpNewFileName,
+ WINBOOL bFailIfExists
+ );
+
+WINBOOL
+STDCALL
+MoveFileA(
+ LPCSTR lpExistingFileName,
+ LPCSTR lpNewFileName
+ );
+
+WINBOOL
+STDCALL
+MoveFileExA(
+ LPCSTR lpExistingFileName,
+ LPCSTR lpNewFileName,
+ DWORD dwFlags
+ );
+
+HANDLE
+STDCALL
+CreateNamedPipeA(
+ LPCSTR lpName,
+ DWORD dwOpenMode,
+ DWORD dwPipeMode,
+ DWORD nMaxInstances,
+ DWORD nOutBufferSize,
+ DWORD nInBufferSize,
+ DWORD nDefaultTimeOut,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+WINBOOL
+STDCALL
+GetNamedPipeHandleStateA(
+ HANDLE hNamedPipe,
+ LPDWORD lpState,
+ LPDWORD lpCurInstances,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout,
+ LPSTR lpUserName,
+ DWORD nMaxUserNameSize
+ );
+
+WINBOOL
+STDCALL
+CallNamedPipeA(
+ LPCSTR lpNamedPipeName,
+ LPVOID lpInBuffer,
+ DWORD nInBufferSize,
+ LPVOID lpOutBuffer,
+ DWORD nOutBufferSize,
+ LPDWORD lpBytesRead,
+ DWORD nTimeOut
+ );
+
+WINBOOL
+STDCALL
+WaitNamedPipeA(
+ LPCSTR lpNamedPipeName,
+ DWORD nTimeOut
+ );
+
+WINBOOL
+STDCALL
+SetVolumeLabelA(
+ LPCSTR lpRootPathName,
+ LPCSTR lpVolumeName
+ );
+
+WINBOOL
+STDCALL
+GetVolumeInformationA(
+ LPCSTR lpRootPathName,
+ LPSTR lpVolumeNameBuffer,
+ DWORD nVolumeNameSize,
+ LPDWORD lpVolumeSerialNumber,
+ LPDWORD lpMaximumComponentLength,
+ LPDWORD lpFileSystemFlags,
+ LPSTR lpFileSystemNameBuffer,
+ DWORD nFileSystemNameSize
+ );
+
+WINBOOL
+STDCALL
+ClearEventLogA (
+ HANDLE hEventLog,
+ LPCSTR lpBackupFileName
+ );
+
+WINBOOL
+STDCALL
+BackupEventLogA (
+ HANDLE hEventLog,
+ LPCSTR lpBackupFileName
+ );
+
+HANDLE
+STDCALL
+OpenEventLogA (
+ LPCSTR lpUNCServerName,
+ LPCSTR lpSourceName
+ );
+
+HANDLE
+STDCALL
+RegisterEventSourceA (
+ LPCSTR lpUNCServerName,
+ LPCSTR lpSourceName
+ );
+
+HANDLE
+STDCALL
+OpenBackupEventLogA (
+ LPCSTR lpUNCServerName,
+ LPCSTR lpFileName
+ );
+
+WINBOOL
+STDCALL
+ReadEventLogA (
+ HANDLE hEventLog,
+ DWORD dwReadFlags,
+ DWORD dwRecordOffset,
+ LPVOID lpBuffer,
+ DWORD nNumberOfBytesToRead,
+ DWORD *pnBytesRead,
+ DWORD *pnMinNumberOfBytesNeeded
+ );
+
+WINBOOL
+STDCALL
+ReportEventA (
+ HANDLE hEventLog,
+ WORD wType,
+ WORD wCategory,
+ DWORD dwEventID,
+ PSID lpUserSid,
+ WORD wNumStrings,
+ DWORD dwDataSize,
+ LPCSTR *lpStrings,
+ LPVOID lpRawData
+ );
+
+WINBOOL
+STDCALL
+AccessCheckAndAuditAlarmA (
+ LPCSTR SubsystemName,
+ LPVOID HandleId,
+ LPSTR ObjectTypeName,
+ LPSTR ObjectName,
+ PSECURITY_DESCRIPTOR SecurityDescriptor,
+ DWORD DesiredAccess,
+ PGENERIC_MAPPING GenericMapping,
+ WINBOOL ObjectCreation,
+ LPDWORD GrantedAccess,
+ LPBOOL AccessStatus,
+ LPBOOL pfGenerateOnClose
+ );
+
+WINBOOL
+STDCALL
+ObjectOpenAuditAlarmA (
+ LPCSTR SubsystemName,
+ LPVOID HandleId,
+ LPSTR ObjectTypeName,
+ LPSTR ObjectName,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
+ HANDLE ClientToken,
+ DWORD DesiredAccess,
+ DWORD GrantedAccess,
+ PPRIVILEGE_SET Privileges,
+ WINBOOL ObjectCreation,
+ WINBOOL AccessGranted,
+ LPBOOL GenerateOnClose
+ );
+
+WINBOOL
+STDCALL
+ObjectPrivilegeAuditAlarmA (
+ LPCSTR SubsystemName,
+ LPVOID HandleId,
+ HANDLE ClientToken,
+ DWORD DesiredAccess,
+ PPRIVILEGE_SET Privileges,
+ WINBOOL AccessGranted
+ );
+
+WINBOOL
+STDCALL
+ObjectCloseAuditAlarmA (
+ LPCSTR SubsystemName,
+ LPVOID HandleId,
+ WINBOOL GenerateOnClose
+ );
+
+WINBOOL
+STDCALL
+PrivilegedServiceAuditAlarmA (
+ LPCSTR SubsystemName,
+ LPCSTR ServiceName,
+ HANDLE ClientToken,
+ PPRIVILEGE_SET Privileges,
+ WINBOOL AccessGranted
+ );
+
+WINBOOL
+STDCALL
+SetFileSecurityA (
+ LPCSTR lpFileName,
+ SECURITY_INFORMATION SecurityInformation,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor
+ );
+
+WINBOOL
+STDCALL
+GetFileSecurityA (
+ LPCSTR lpFileName,
+ SECURITY_INFORMATION RequestedInformation,
+ PSECURITY_DESCRIPTOR pSecurityDescriptor,
+ DWORD nLength,
+ LPDWORD lpnLengthNeeded
+ );
+
+HANDLE
+STDCALL
+FindFirstChangeNotificationA(
+ LPCSTR lpPathName,
+ WINBOOL bWatchSubtree,
+ DWORD dwNotifyFilter
+ );
+
+WINBOOL
+STDCALL
+IsBadStringPtrA(
+ LPCSTR lpsz,
+ UINT ucchMax
+ );
+
+WINBOOL
+STDCALL
+LookupAccountSidA(
+ LPCSTR lpSystemName,
+ PSID Sid,
+ LPSTR Name,
+ LPDWORD cbName,
+ LPSTR ReferencedDomainName,
+ LPDWORD cbReferencedDomainName,
+ PSID_NAME_USE peUse
+ );
+
+WINBOOL
+STDCALL
+LookupAccountNameA(
+ LPCSTR lpSystemName,
+ LPCSTR lpAccountName,
+ PSID Sid,
+ LPDWORD cbSid,
+ LPSTR ReferencedDomainName,
+ LPDWORD cbReferencedDomainName,
+ PSID_NAME_USE peUse
+ );
+
+WINBOOL
+STDCALL
+LookupPrivilegeValueA(
+ LPCSTR lpSystemName,
+ LPCSTR lpName,
+ PLUID lpLuid
+ );
+
+WINBOOL
+STDCALL
+LookupPrivilegeNameA(
+ LPCSTR lpSystemName,
+ PLUID lpLuid,
+ LPSTR lpName,
+ LPDWORD cbName
+ );
+
+WINBOOL
+STDCALL
+LookupPrivilegeDisplayNameA(
+ LPCSTR lpSystemName,
+ LPCSTR lpName,
+ LPSTR lpDisplayName,
+ LPDWORD cbDisplayName,
+ LPDWORD lpLanguageId
+ );
+
+WINBOOL
+STDCALL
+BuildCommDCBA(
+ LPCSTR lpDef,
+ LPDCB lpDCB
+ );
+
+WINBOOL
+STDCALL
+BuildCommDCBAndTimeoutsA(
+ LPCSTR lpDef,
+ LPDCB lpDCB,
+ LPCOMMTIMEOUTS lpCommTimeouts
+ );
+
+WINBOOL
+STDCALL
+CommConfigDialogA(
+ LPCSTR lpszName,
+ HWND hWnd,
+ LPCOMMCONFIG lpCC
+ );
+
+WINBOOL
+STDCALL
+GetDefaultCommConfigA(
+ LPCSTR lpszName,
+ LPCOMMCONFIG lpCC,
+ LPDWORD lpdwSize
+ );
+
+WINBOOL
+STDCALL
+SetDefaultCommConfigA(
+ LPCSTR lpszName,
+ LPCOMMCONFIG lpCC,
+ DWORD dwSize
+ );
+
+WINBOOL
+STDCALL
+GetComputerNameA (
+ LPSTR lpBuffer,
+ LPDWORD nSize
+ );
+
+WINBOOL
+STDCALL
+SetComputerNameA (
+ LPCSTR lpComputerName
+ );
+
+WINBOOL
+STDCALL
+GetUserNameA (
+ LPSTR lpBuffer,
+ LPDWORD nSize
+ );
+
+int
+STDCALL
+wvsprintfA(
+ LPSTR,
+ LPCSTR,
+ va_list arglist);
+
+int
+CDECL
+wsprintfA(LPSTR, LPCSTR, ...);
+
+HKL
+STDCALL
+LoadKeyboardLayoutA(
+ LPCSTR pwszKLID,
+ UINT Flags);
+
+WINBOOL
+STDCALL
+GetKeyboardLayoutNameA(
+ LPSTR pwszKLID);
+
+HDESK
+STDCALL
+CreateDesktopA(
+ LPSTR lpszDesktop,
+ LPSTR lpszDevice,
+ LPDEVMODE pDevmode,
+ DWORD dwFlags,
+ DWORD dwDesiredAccess,
+ LPSECURITY_ATTRIBUTES lpsa);
+
+HDESK
+STDCALL
+OpenDesktopA(
+ LPSTR lpszDesktop,
+ DWORD dwFlags,
+ WINBOOL fInherit,
+ DWORD dwDesiredAccess);
+
+WINBOOL
+STDCALL
+EnumDesktopsA(
+ HWINSTA hwinsta,
+ DESKTOPENUMPROC lpEnumFunc,
+ LPARAM lParam);
+
+HWINSTA
+STDCALL
+CreateWindowStationA(
+ LPSTR lpwinsta,
+ DWORD dwReserved,
+ DWORD dwDesiredAccess,
+ LPSECURITY_ATTRIBUTES lpsa);
+
+HWINSTA
+STDCALL
+OpenWindowStationA(
+ LPSTR lpszWinSta,
+ WINBOOL fInherit,
+ DWORD dwDesiredAccess);
+
+WINBOOL
+STDCALL
+EnumWindowStationsA(
+ ENUMWINDOWSTATIONPROC lpEnumFunc,
+ LPARAM lParam);
+
+WINBOOL
+STDCALL
+GetUserObjectInformationA(
+ HANDLE hObj,
+ int nIndex,
+ PVOID pvInfo,
+ DWORD nLength,
+ LPDWORD lpnLengthNeeded);
+
+WINBOOL
+STDCALL
+SetUserObjectInformationA(
+ HANDLE hObj,
+ int nIndex,
+ PVOID pvInfo,
+ DWORD nLength);
+
+UINT
+STDCALL
+RegisterWindowMessageA(
+ LPCSTR lpString);
+
+WINBOOL
+STDCALL
+GetMessageA(
+ LPMSG lpMsg,
+ HWND hWnd ,
+ UINT wMsgFilterMin,
+ UINT wMsgFilterMax);
+
+LONG
+STDCALL
+DispatchMessageA(
+ CONST MSG *lpMsg);
+
+WINBOOL
+STDCALL
+PeekMessageA(
+ LPMSG lpMsg,
+ HWND hWnd ,
+ UINT wMsgFilterMin,
+ UINT wMsgFilterMax,
+ UINT wRemoveMsg);
+
+LRESULT
+STDCALL
+SendMessageA(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+LRESULT
+STDCALL
+SendMessageTimeoutA(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam,
+ UINT fuFlags,
+ UINT uTimeout,
+ LPDWORD lpdwResult);
+
+WINBOOL
+STDCALL
+SendNotifyMessageA(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+WINBOOL
+STDCALL
+SendMessageCallbackA(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam,
+ SENDASYNCPROC lpResultCallBack,
+ DWORD dwData);
+
+WINBOOL
+STDCALL
+PostMessageA(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+WINBOOL
+STDCALL
+PostThreadMessageA(
+ DWORD idThread,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+LRESULT
+STDCALL
+DefWindowProcA(
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+LRESULT
+STDCALL
+CallWindowProcA(
+ WNDPROC lpPrevWndFunc,
+ HWND hWnd,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+ATOM
+STDCALL
+RegisterClassA(
+ CONST WNDCLASS *lpWndClass);
+
+WINBOOL
+STDCALL
+UnregisterClassA(
+ LPCSTR lpClassName,
+ HINSTANCE hInstance);
+
+WINBOOL
+STDCALL
+GetClassInfoA(
+ HINSTANCE hInstance ,
+ LPCSTR lpClassName,
+ LPWNDCLASS lpWndClass);
+
+ATOM
+STDCALL
+RegisterClassExA(CONST WNDCLASSEX *);
+
+WINBOOL
+STDCALL
+GetClassInfoExA(HINSTANCE, LPCSTR, LPWNDCLASSEX);
+
+HWND
+STDCALL
+CreateWindowExA(
+ DWORD dwExStyle,
+ LPCSTR lpClassName,
+ LPCSTR lpWindowName,
+ DWORD dwStyle,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight,
+ HWND hWndParent ,
+ HMENU hMenu,
+ HINSTANCE hInstance,
+ LPVOID lpParam);
+
+HWND
+STDCALL
+CreateDialogParamA(
+ HINSTANCE hInstance,
+ LPCSTR lpTemplateName,
+ HWND hWndParent ,
+ DLGPROC lpDialogFunc,
+ LPARAM dwInitParam);
+
+HWND
+STDCALL
+CreateDialogIndirectParamA(
+ HINSTANCE hInstance,
+ LPCDLGTEMPLATE lpTemplate,
+ HWND hWndParent,
+ DLGPROC lpDialogFunc,
+ LPARAM dwInitParam);
+
+int
+STDCALL
+DialogBoxParamA(
+ HINSTANCE hInstance,
+ LPCSTR lpTemplateName,
+ HWND hWndParent ,
+ DLGPROC lpDialogFunc,
+ LPARAM dwInitParam);
+
+int
+STDCALL
+DialogBoxIndirectParamA(
+ HINSTANCE hInstance,
+ LPCDLGTEMPLATE hDialogTemplate,
+ HWND hWndParent ,
+ DLGPROC lpDialogFunc,
+ LPARAM dwInitParam);
+
+WINBOOL
+STDCALL
+SetDlgItemTextA(
+ HWND hDlg,
+ int nIDDlgItem,
+ LPCSTR lpString);
+
+UINT
+STDCALL
+GetDlgItemTextA(
+ HWND hDlg,
+ int nIDDlgItem,
+ LPSTR lpString,
+ int nMaxCount);
+
+LONG
+STDCALL
+SendDlgItemMessageA(
+ HWND hDlg,
+ int nIDDlgItem,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+LRESULT
+STDCALL
+DefDlgProcA(
+ HWND hDlg,
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+WINBOOL
+STDCALL
+CallMsgFilterA(
+ LPMSG lpMsg,
+ int nCode);
+
+UINT
+STDCALL
+RegisterClipboardFormatA(
+ LPCSTR lpszFormat);
+
+int
+STDCALL
+GetClipboardFormatNameA(
+ UINT format,
+ LPSTR lpszFormatName,
+ int cchMaxCount);
+
+WINBOOL
+STDCALL
+CharToOemA(
+ LPCSTR lpszSrc,
+ LPSTR lpszDst);
+
+WINBOOL
+STDCALL
+OemToCharA(
+ LPCSTR lpszSrc,
+ LPSTR lpszDst);
+
+WINBOOL
+STDCALL
+CharToOemBuffA(
+ LPCSTR lpszSrc,
+ LPSTR lpszDst,
+ DWORD cchDstLength);
+
+WINBOOL
+STDCALL
+OemToCharBuffA(
+ LPCSTR lpszSrc,
+ LPSTR lpszDst,
+ DWORD cchDstLength);
+
+LPSTR
+STDCALL
+CharUpperA(
+ LPSTR lpsz);
+
+DWORD
+STDCALL
+CharUpperBuffA(
+ LPSTR lpsz,
+ DWORD cchLength);
+
+LPSTR
+STDCALL
+CharLowerA(
+ LPSTR lpsz);
+
+DWORD
+STDCALL
+CharLowerBuffA(
+ LPSTR lpsz,
+ DWORD cchLength);
+
+LPSTR
+STDCALL
+CharNextA(
+ LPCSTR lpsz);
+
+LPSTR
+STDCALL
+CharPrevA(
+ LPCSTR lpszStart,
+ LPCSTR lpszCurrent);
+
+WINBOOL
+STDCALL
+IsCharAlphaA(
+ CHAR ch);
+
+WINBOOL
+STDCALL
+IsCharAlphaNumericA(
+ CHAR ch);
+
+WINBOOL
+STDCALL
+IsCharUpperA(
+ CHAR ch);
+
+WINBOOL
+STDCALL
+IsCharLowerA(
+ CHAR ch);
+
+int
+STDCALL
+GetKeyNameTextA(
+ LONG lParam,
+ LPSTR lpString,
+ int nSize
+ );
+
+SHORT
+STDCALL
+VkKeyScanA(
+ CHAR ch);
+
+SHORT
+STDCALL VkKeyScanExA(
+ CHAR ch,
+ HKL dwhkl);
+
+UINT
+STDCALL
+MapVirtualKeyA(
+ UINT uCode,
+ UINT uMapType);
+
+UINT
+STDCALL
+MapVirtualKeyExA(
+ UINT uCode,
+ UINT uMapType,
+ HKL dwhkl);
+
+HACCEL
+STDCALL
+LoadAcceleratorsA(
+ HINSTANCE hInstance,
+ LPCSTR lpTableName);
+
+HACCEL
+STDCALL
+CreateAcceleratorTableA(
+ LPACCEL, int);
+
+int
+STDCALL
+CopyAcceleratorTableA(
+ HACCEL hAccelSrc,
+ LPACCEL lpAccelDst,
+ int cAccelEntries);
+
+int
+STDCALL
+TranslateAcceleratorA(
+ HWND hWnd,
+ HACCEL hAccTable,
+ LPMSG lpMsg);
+
+HMENU
+STDCALL
+LoadMenuA(
+ HINSTANCE hInstance,
+ LPCSTR lpMenuName);
+
+HMENU
+STDCALL
+LoadMenuIndirectA(
+ CONST MENUTEMPLATE *lpMenuTemplate);
+
+WINBOOL
+STDCALL
+ChangeMenuA(
+ HMENU hMenu,
+ UINT cmd,
+ LPCSTR lpszNewItem,
+ UINT cmdInsert,
+ UINT flags);
+
+int
+STDCALL
+GetMenuStringA(
+ HMENU hMenu,
+ UINT uIDItem,
+ LPSTR lpString,
+ int nMaxCount,
+ UINT uFlag);
+
+WINBOOL
+STDCALL
+InsertMenuA(
+ HMENU hMenu,
+ UINT uPosition,
+ UINT uFlags,
+ UINT uIDNewItem,
+ LPCSTR lpNewItem
+ );
+
+WINBOOL
+STDCALL
+AppendMenuA(
+ HMENU hMenu,
+ UINT uFlags,
+ UINT uIDNewItem,
+ LPCSTR lpNewItem
+ );
+
+WINBOOL
+STDCALL
+ModifyMenuA(
+ HMENU hMnu,
+ UINT uPosition,
+ UINT uFlags,
+ UINT uIDNewItem,
+ LPCSTR lpNewItem
+ );
+
+WINBOOL
+STDCALL
+InsertMenuItemA(
+ HMENU,
+ UINT,
+ WINBOOL,
+ LPCMENUITEMINFO
+ );
+
+WINBOOL
+STDCALL
+GetMenuItemInfoA(
+ HMENU,
+ UINT,
+ WINBOOL,
+ LPMENUITEMINFO
+ );
+
+WINBOOL
+STDCALL
+SetMenuItemInfoA(
+ HMENU,
+ UINT,
+ WINBOOL,
+ LPCMENUITEMINFO
+ );
+
+int
+STDCALL
+DrawTextA(
+ HDC hDC,
+ LPCSTR lpString,
+ int nCount,
+ LPRECT lpRect,
+ UINT uFormat);
+
+int
+STDCALL
+DrawTextExA(HDC, LPSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
+
+WINBOOL
+STDCALL
+GrayStringA(
+ HDC hDC,
+ HBRUSH hBrush,
+ GRAYSTRINGPROC lpOutputFunc,
+ LPARAM lpData,
+ int nCount,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight);
+
+WINBOOL
+STDCALL
+DrawStateA(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT);
+
+LONG
+STDCALL
+TabbedTextOutA(
+ HDC hDC,
+ int X,
+ int Y,
+ LPCSTR lpString,
+ int nCount,
+ int nTabPositions,
+ LPINT lpnTabStopPositions,
+ int nTabOrigin);
+
+DWORD
+STDCALL
+GetTabbedTextExtentA(
+ HDC hDC,
+ LPCSTR lpString,
+ int nCount,
+ int nTabPositions,
+ LPINT lpnTabStopPositions);
+
+WINBOOL
+STDCALL
+SetPropA(
+ HWND hWnd,
+ LPCSTR lpString,
+ HANDLE hData);
+
+HANDLE
+STDCALL
+GetPropA(
+ HWND hWnd,
+ LPCSTR lpString);
+
+HANDLE
+STDCALL
+RemovePropA(
+ HWND hWnd,
+ LPCSTR lpString);
+
+int
+STDCALL
+EnumPropsExA(
+ HWND hWnd,
+ PROPENUMPROCEX lpEnumFunc,
+ LPARAM lParam);
+
+int
+STDCALL
+EnumPropsA(
+ HWND hWnd,
+ PROPENUMPROC lpEnumFunc);
+
+WINBOOL
+STDCALL
+SetWindowTextA(
+ HWND hWnd,
+ LPCSTR lpString);
+
+int
+STDCALL
+GetWindowTextA(
+ HWND hWnd,
+ LPSTR lpString,
+ int nMaxCount);
+
+int
+STDCALL
+GetWindowTextLengthA(
+ HWND hWnd);
+
+int
+STDCALL
+MessageBoxA(
+ HWND hWnd ,
+ LPCSTR lpText,
+ LPCSTR lpCaption,
+ UINT uType);
+
+int
+STDCALL
+MessageBoxExA(
+ HWND hWnd ,
+ LPCSTR lpText,
+ LPCSTR lpCaption,
+ UINT uType,
+ WORD wLanguageId);
+
+int
+STDCALL
+MessageBoxIndirectA(LPMSGBOXPARAMS);
+
+LONG
+STDCALL
+GetWindowLongA(
+ HWND hWnd,
+ int nIndex);
+
+LONG
+STDCALL
+SetWindowLongA(
+ HWND hWnd,
+ int nIndex,
+ LONG dwNewLong);
+
+DWORD
+STDCALL
+GetClassLongA(
+ HWND hWnd,
+ int nIndex);
+
+DWORD
+STDCALL
+SetClassLongA(
+ HWND hWnd,
+ int nIndex,
+ LONG dwNewLong);
+
+HWND
+STDCALL
+FindWindowA(
+ LPCSTR lpClassName ,
+ LPCSTR lpWindowName);
+
+HWND
+STDCALL
+FindWindowExA(HWND, HWND, LPCSTR, LPCSTR);
+
+int
+STDCALL
+GetClassNameA(
+ HWND hWnd,
+ LPSTR lpClassName,
+ int nMaxCount);
+
+HHOOK
+STDCALL
+SetWindowsHookExA(
+ int idHook,
+ HOOKPROC lpfn,
+ HINSTANCE hmod,
+ DWORD dwThreadId);
+
+HBITMAP
+STDCALL
+LoadBitmapA(
+ HINSTANCE hInstance,
+ LPCSTR lpBitmapName);
+
+HCURSOR
+STDCALL
+LoadCursorA(
+ HINSTANCE hInstance,
+ LPCSTR lpCursorName);
+
+HCURSOR
+STDCALL
+LoadCursorFromFileA(
+ LPCSTR lpFileName);
+
+HICON
+STDCALL
+LoadIconA(
+ HINSTANCE hInstance,
+ LPCSTR lpIconName);
+
+HANDLE
+STDCALL
+LoadImageA(
+ HINSTANCE,
+ LPCSTR,
+ UINT,
+ int,
+ int,
+ UINT);
+
+int
+STDCALL
+LoadStringA(
+ HINSTANCE hInstance,
+ UINT uID,
+ LPSTR lpBuffer,
+ int nBufferMax);
+
+WINBOOL
+STDCALL
+IsDialogMessageA(
+ HWND hDlg,
+ LPMSG lpMsg);
+
+int
+STDCALL
+DlgDirListA(
+ HWND hDlg,
+ LPSTR lpPathSpec,
+ int nIDListBox,
+ int nIDStaticPath,
+ UINT uFileType);
+
+WINBOOL
+STDCALL
+DlgDirSelectExA(
+ HWND hDlg,
+ LPSTR lpString,
+ int nCount,
+ int nIDListBox);
+
+int
+STDCALL
+DlgDirListComboBoxA(
+ HWND hDlg,
+ LPSTR lpPathSpec,
+ int nIDComboBox,
+ int nIDStaticPath,
+ UINT uFiletype);
+
+WINBOOL
+STDCALL
+DlgDirSelectComboBoxExA(
+ HWND hDlg,
+ LPSTR lpString,
+ int nCount,
+ int nIDComboBox);
+
+LRESULT
+STDCALL
+DefFrameProcA(
+ HWND hWnd,
+ HWND hWndMDIClient ,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+LRESULT
+STDCALL
+DefMDIChildProcA(
+ HWND hWnd,
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam);
+
+HWND
+STDCALL
+CreateMDIWindowA(
+ LPSTR lpClassName,
+ LPSTR lpWindowName,
+ DWORD dwStyle,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight,
+ HWND hWndParent,
+ HINSTANCE hInstance,
+ LPARAM lParam
+ );
+
+WINBOOL
+STDCALL
+WinHelpA(
+ HWND hWndMain,
+ LPCSTR lpszHelp,
+ UINT uCommand,
+ DWORD dwData
+ );
+
+LONG
+STDCALL
+ChangeDisplaySettingsA(
+ LPDEVMODE lpDevMode,
+ DWORD dwFlags);
+
+WINBOOL
+STDCALL
+EnumDisplaySettingsA(
+ LPCSTR lpszDeviceName,
+ DWORD iModeNum,
+ LPDEVMODE lpDevMode);
+
+WINBOOL
+STDCALL
+SystemParametersInfoA(
+ UINT uiAction,
+ UINT uiParam,
+ PVOID pvParam,
+ UINT fWinIni);
+
+int
+STDCALL
+AddFontResourceA(LPCSTR);
+
+HMETAFILE
+STDCALL
+CopyMetaFileA(HMETAFILE, LPCSTR);
+
+HFONT
+STDCALL
+CreateFontIndirectA(CONST LOGFONT *);
+
+HDC
+STDCALL
+CreateICA(LPCSTR, LPCSTR , LPCSTR , CONST DEVMODE *);
+
+HDC
+STDCALL
+CreateMetaFileA(LPCSTR);
+
+WINBOOL
+STDCALL
+CreateScalableFontResourceA(DWORD, LPCSTR, LPCSTR, LPCSTR);
+
+int
+STDCALL
+DeviceCapabilitiesA(LPCSTR, LPCSTR, WORD,
+ LPSTR, CONST DEVMODE *);
+
+int
+STDCALL
+EnumFontFamiliesExA(HDC, LPLOGFONT, FONTENUMEXPROC, LPARAM,DWORD);
+
+int
+STDCALL
+EnumFontFamiliesA(HDC, LPCSTR, FONTENUMPROC, LPARAM);
+
+int
+STDCALL
+EnumFontsA(HDC, LPCSTR, ENUMFONTSPROC, LPARAM);
+
+WINBOOL
+STDCALL
+GetCharWidthA(HDC, UINT, UINT, LPINT);
+
+WINBOOL
+STDCALL
+GetCharWidth32A(HDC, UINT, UINT, LPINT);
+
+WINBOOL
+STDCALL
+GetCharWidthFloatA(HDC, UINT, UINT, PFLOAT);
+
+WINBOOL
+STDCALL
+GetCharABCWidthsA(HDC, UINT, UINT, LPABC);
+
+WINBOOL
+STDCALL
+GetCharABCWidthsFloatA(HDC, UINT, UINT, LPABCFLOAT);
+DWORD
+STDCALL
+GetGlyphOutlineA(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2 *);
+
+HMETAFILE
+STDCALL
+GetMetaFileA(LPCSTR);
+
+UINT
+STDCALL
+GetOutlineTextMetricsA(HDC, UINT, LPOUTLINETEXTMETRIC);
+
+WINBOOL
+STDCALL
+GetTextExtentPointA(
+ HDC,
+ LPCSTR,
+ int,
+ LPSIZE
+ );
+
+WINBOOL
+STDCALL
+GetTextExtentPoint32A(
+ HDC,
+ LPCSTR,
+ int,
+ LPSIZE
+ );
+
+WINBOOL
+STDCALL
+GetTextExtentExPointA(
+ HDC,
+ LPCSTR,
+ int,
+ int,
+ LPINT,
+ LPINT,
+ LPSIZE
+ );
+
+DWORD
+STDCALL
+GetCharacterPlacementA(HDC, LPCSTR, int, int, LPGCP_RESULTS, DWORD);
+
+HDC
+STDCALL
+ResetDCA(HDC, CONST DEVMODE *);
+
+WINBOOL
+STDCALL
+RemoveFontResourceA(LPCSTR);
+
+HENHMETAFILE
+STDCALL
+CopyEnhMetaFileA(HENHMETAFILE, LPCSTR);
+
+HDC
+STDCALL
+CreateEnhMetaFileA(HDC, LPCSTR, CONST RECT *, LPCSTR);
+
+HENHMETAFILE
+STDCALL
+GetEnhMetaFileA(LPCSTR);
+
+UINT
+STDCALL
+GetEnhMetaFileDescriptionA(HENHMETAFILE, UINT, LPSTR );
+
+WINBOOL
+STDCALL
+GetTextMetricsA(HDC, LPTEXTMETRIC);
+
+int
+STDCALL
+StartDocA(HDC, CONST DOCINFO *);
+
+int
+STDCALL
+GetObjectA(HGDIOBJ, int, LPVOID);
+
+WINBOOL
+STDCALL
+TextOutA(HDC, int, int, LPCSTR, int);
+
+WINBOOL
+STDCALL
+ExtTextOutA(HDC, int, int, UINT, CONST RECT *,LPCSTR, UINT, CONST INT *);
+
+WINBOOL
+STDCALL
+PolyTextOutA(HDC, CONST POLYTEXT *, int);
+
+int
+STDCALL
+GetTextFaceA(HDC, int, LPSTR);
+
+DWORD
+STDCALL
+GetKerningPairsA(HDC, DWORD, LPKERNINGPAIR);
+
+HCOLORSPACE
+STDCALL
+CreateColorSpaceA(LPLOGCOLORSPACE);
+
+WINBOOL
+STDCALL
+GetLogColorSpaceA(HCOLORSPACE,LPLOGCOLORSPACE,DWORD);
+
+WINBOOL
+STDCALL
+GetICMProfileA(HDC,DWORD,LPSTR);
+
+WINBOOL
+STDCALL
+SetICMProfileA(HDC,LPSTR);
+
+WINBOOL
+STDCALL
+UpdateICMRegKeyA(DWORD, DWORD, LPSTR, UINT);
+
+int
+STDCALL
+EnumICMProfilesA(HDC,ICMENUMPROC,LPARAM);
+
+int
+STDCALL
+PropertySheetA(LPCPROPSHEETHEADER lppsph);
+
+HIMAGELIST
+STDCALL
+ImageList_LoadImageA(HINSTANCE hi, LPCSTR lpbmp, int cx, int cGrow, COLORREF crMask, UINT uType, UINT uFlags);
+
+HWND
+STDCALL
+CreateStatusWindowA(LONG style, LPCSTR lpszText, HWND hwndParent, UINT wID);
+
+void
+STDCALL
+DrawStatusTextA(HDC hDC, LPRECT lprc, LPCSTR pszText, UINT uFlags);
+
+WINBOOL
+STDCALL
+GetOpenFileNameA(LPOPENFILENAME);
+
+WINBOOL
+STDCALL
+GetSaveFileNameA(LPOPENFILENAME);
+
+short
+STDCALL
+GetFileTitleA(LPCSTR, LPSTR, WORD);
+
+WINBOOL
+STDCALL
+ChooseColorA(LPCHOOSECOLOR);
+
+HWND
+STDCALL
+FindTextA(LPFINDREPLACE);
+
+HWND
+STDCALL
+ReplaceTextA(LPFINDREPLACE);
+
+WINBOOL
+STDCALL
+ChooseFontA(LPCHOOSEFONT);
+
+WINBOOL
+STDCALL
+PrintDlgA(LPPRINTDLG);
+
+WINBOOL
+STDCALL
+PageSetupDlgA( LPPAGESETUPDLG );
+
+WINBOOL
+STDCALL
+CreateProcessA(
+ LPCSTR lpApplicationName,
+ LPSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ WINBOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCSTR lpCurrentDirectory,
+ LPSTARTUPINFO lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation
+ );
+
+VOID
+STDCALL
+GetStartupInfoA(
+ LPSTARTUPINFO lpStartupInfo
+ );
+
+HANDLE
+STDCALL
+FindFirstFileA(
+ LPCSTR lpFileName,
+ LPWIN32_FIND_DATA lpFindFileData
+ );
+
+WINBOOL
+STDCALL
+FindNextFileA(
+ HANDLE hFindFile,
+ LPWIN32_FIND_DATA lpFindFileData
+ );
+
+WINBOOL
+STDCALL
+GetVersionExA(
+ LPOSVERSIONINFO lpVersionInformation
+ );
+
+#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y,\
+nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\
+CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,\
+nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
+
+#define CreateDialogA(hInstance, lpName, hWndParent, lpDialogFunc) \
+CreateDialogParamA(hInstance, lpName, hWndParent, lpDialogFunc, 0L)
+
+#define CreateDialogIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+
+#define DialogBoxA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+DialogBoxParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+
+#define DialogBoxIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+DialogBoxIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+
+HDC
+STDCALL
+CreateDCA(LPCSTR, LPCSTR , LPCSTR , CONST DEVMODE *);
+
+DWORD
+STDCALL
+VerInstallFileA(
+ DWORD uFlags,
+ LPSTR szSrcFileName,
+ LPSTR szDestFileName,
+ LPSTR szSrcDir,
+ LPSTR szDestDir,
+ LPSTR szCurDir,
+ LPSTR szTmpFile,
+ PUINT lpuTmpFileLen
+ );
+
+DWORD
+STDCALL
+GetFileVersionInfoSizeA(
+ LPSTR lptstrFilename,
+ LPDWORD lpdwHandle
+ );
+
+WINBOOL
+STDCALL
+GetFileVersionInfoA(
+ LPSTR lptstrFilename,
+ DWORD dwHandle,
+ DWORD dwLen,
+ LPVOID lpData
+ );
+
+DWORD
+STDCALL
+VerLanguageNameA(
+ DWORD wLang,
+ LPSTR szLang,
+ DWORD nSize
+ );
+
+WINBOOL
+STDCALL
+VerQueryValueA(
+ const LPVOID pBlock,
+ LPSTR lpSubBlock,
+ LPVOID * lplpBuffer,
+ PUINT puLen
+ );
+
+DWORD
+STDCALL
+VerFindFileA(
+ DWORD uFlags,
+ LPSTR szFileName,
+ LPSTR szWinDir,
+ LPSTR szAppDir,
+ LPSTR szCurDir,
+ PUINT lpuCurDirLen,
+ LPSTR szDestDir,
+ PUINT lpuDestDirLen
+ );
+
+LONG
+STDCALL
+RegConnectRegistryA (
+ LPSTR lpMachineName,
+ HKEY hKey,
+ PHKEY phkResult
+ );
+
+LONG
+STDCALL
+RegCreateKeyA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ PHKEY phkResult
+ );
+
+LONG
+STDCALL
+RegCreateKeyExA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ DWORD Reserved,
+ LPSTR lpClass,
+ DWORD dwOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ PHKEY phkResult,
+ LPDWORD lpdwDisposition
+ );
+
+LONG
+STDCALL
+RegDeleteKeyA (
+ HKEY hKey,
+ LPCSTR lpSubKey
+ );
+
+LONG
+STDCALL
+RegDeleteValueA (
+ HKEY hKey,
+ LPCSTR lpValueName
+ );
+
+LONG
+STDCALL
+RegEnumKeyA (
+ HKEY hKey,
+ DWORD dwIndex,
+ LPSTR lpName,
+ DWORD cbName
+ );
+
+LONG
+STDCALL
+RegEnumKeyExA (
+ HKEY hKey,
+ DWORD dwIndex,
+ LPSTR lpName,
+ LPDWORD lpcbName,
+ LPDWORD lpReserved,
+ LPSTR lpClass,
+ LPDWORD lpcbClass,
+ PFILETIME lpftLastWriteTime
+ );
+
+LONG
+STDCALL
+RegEnumValueA (
+ HKEY hKey,
+ DWORD dwIndex,
+ LPSTR lpValueName,
+ LPDWORD lpcbValueName,
+ LPDWORD lpReserved,
+ LPDWORD lpType,
+ LPBYTE lpData,
+ LPDWORD lpcbData
+ );
+
+LONG
+STDCALL
+RegLoadKeyA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ LPCSTR lpFile
+ );
+
+LONG
+STDCALL
+RegOpenKeyA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ PHKEY phkResult
+ );
+
+LONG
+STDCALL
+RegOpenKeyExA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ DWORD ulOptions,
+ REGSAM samDesired,
+ PHKEY phkResult
+ );
+
+LONG
+STDCALL
+RegQueryInfoKeyA (
+ HKEY hKey,
+ LPSTR lpClass,
+ LPDWORD lpcbClass,
+ LPDWORD lpReserved,
+ LPDWORD lpcSubKeys,
+ LPDWORD lpcbMaxSubKeyLen,
+ LPDWORD lpcbMaxClassLen,
+ LPDWORD lpcValues,
+ LPDWORD lpcbMaxValueNameLen,
+ LPDWORD lpcbMaxValueLen,
+ LPDWORD lpcbSecurityDescriptor,
+ PFILETIME lpftLastWriteTime
+ );
+
+LONG
+STDCALL
+RegQueryValueA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ LPSTR lpValue,
+ PLONG lpcbValue
+ );
+
+LONG
+STDCALL
+RegQueryMultipleValuesA (
+ HKEY hKey,
+ PVALENT val_list,
+ DWORD num_vals,
+ LPSTR lpValueBuf,
+ LPDWORD ldwTotsize
+ );
+
+LONG
+STDCALL
+RegQueryValueExA (
+ HKEY hKey,
+ LPCSTR lpValueName,
+ LPDWORD lpReserved,
+ LPDWORD lpType,
+ LPBYTE lpData,
+ LPDWORD lpcbData
+ );
+
+LONG
+STDCALL
+RegReplaceKeyA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ LPCSTR lpNewFile,
+ LPCSTR lpOldFile
+ );
+
+LONG
+STDCALL
+RegRestoreKeyA (
+ HKEY hKey,
+ LPCSTR lpFile,
+ DWORD dwFlags
+ );
+
+LONG
+STDCALL
+RegSaveKeyA (
+ HKEY hKey,
+ LPCSTR lpFile,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+LONG
+STDCALL
+RegSetValueA (
+ HKEY hKey,
+ LPCSTR lpSubKey,
+ DWORD dwType,
+ LPCSTR lpData,
+ DWORD cbData
+ );
+
+LONG
+STDCALL
+RegSetValueExA (
+ HKEY hKey,
+ LPCSTR lpValueName,
+ DWORD Reserved,
+ DWORD dwType,
+ CONST BYTE* lpData,
+ DWORD cbData
+ );
+
+LONG
+STDCALL
+RegUnLoadKeyA (
+ HKEY hKey,
+ LPCSTR lpSubKey
+ );
+
+WINBOOL
+STDCALL
+InitiateSystemShutdownA(
+ LPSTR lpMachineName,
+ LPSTR lpMessage,
+ DWORD dwTimeout,
+ WINBOOL bForceAppsClosed,
+ WINBOOL bRebootAfterShutdown
+ );
+
+WINBOOL
+STDCALL
+AbortSystemShutdownA(
+ LPSTR lpMachineName
+ );
+
+int
+STDCALL
+CompareStringA(
+ LCID Locale,
+ DWORD dwCmpFlags,
+ LPCSTR lpString1,
+ int cchCount1,
+ LPCSTR lpString2,
+ int cchCount2);
+
+int
+STDCALL
+LCMapStringA(
+ LCID Locale,
+ DWORD dwMapFlags,
+ LPCSTR lpSrcStr,
+ int cchSrc,
+ LPSTR lpDestStr,
+ int cchDest);
+
+int
+STDCALL
+GetLocaleInfoA(
+ LCID Locale,
+ LCTYPE LCType,
+ LPSTR lpLCData,
+ int cchData);
+
+WINBOOL
+STDCALL
+SetLocaleInfoA(
+ LCID Locale,
+ LCTYPE LCType,
+ LPCSTR lpLCData);
+
+int
+STDCALL
+GetTimeFormatA(
+ LCID Locale,
+ DWORD dwFlags,
+ CONST SYSTEMTIME *lpTime,
+ LPCSTR lpFormat,
+ LPSTR lpTimeStr,
+ int cchTime);
+
+int
+STDCALL
+GetDateFormatA(
+ LCID Locale,
+ DWORD dwFlags,
+ CONST SYSTEMTIME *lpDate,
+ LPCSTR lpFormat,
+ LPSTR lpDateStr,
+ int cchDate);
+
+int
+STDCALL
+GetNumberFormatA(
+ LCID Locale,
+ DWORD dwFlags,
+ LPCSTR lpValue,
+ CONST NUMBERFMT *lpFormat,
+ LPSTR lpNumberStr,
+ int cchNumber);
+
+int
+STDCALL
+GetCurrencyFormatA(
+ LCID Locale,
+ DWORD dwFlags,
+ LPCSTR lpValue,
+ CONST CURRENCYFMT *lpFormat,
+ LPSTR lpCurrencyStr,
+ int cchCurrency);
+
+WINBOOL
+STDCALL
+EnumCalendarInfoA(
+ CALINFO_ENUMPROC lpCalInfoEnumProc,
+ LCID Locale,
+ CALID Calendar,
+ CALTYPE CalType);
+
+WINBOOL
+STDCALL
+EnumTimeFormatsA(
+ TIMEFMT_ENUMPROC lpTimeFmtEnumProc,
+ LCID Locale,
+ DWORD dwFlags);
+
+WINBOOL
+STDCALL
+EnumDateFormatsA(
+ DATEFMT_ENUMPROC lpDateFmtEnumProc,
+ LCID Locale,
+ DWORD dwFlags);
+
+WINBOOL
+STDCALL
+GetStringTypeExA(
+ LCID Locale,
+ DWORD dwInfoType,
+ LPCSTR lpSrcStr,
+ int cchSrc,
+ LPWORD lpCharType);
+
+WINBOOL
+STDCALL
+GetStringTypeA(
+ LCID Locale,
+ DWORD dwInfoType,
+ LPCSTR lpSrcStr,
+ int cchSrc,
+ LPWORD lpCharType);
+
+
+int
+STDCALL
+FoldStringA(
+ DWORD dwMapFlags,
+ LPCSTR lpSrcStr,
+ int cchSrc,
+ LPSTR lpDestStr,
+ int cchDest);
+
+WINBOOL
+STDCALL
+EnumSystemLocalesA(
+ LOCALE_ENUMPROC lpLocaleEnumProc,
+ DWORD dwFlags);
+
+WINBOOL
+STDCALL
+EnumSystemCodePagesA(
+ CODEPAGE_ENUMPROC lpCodePageEnumProc,
+ DWORD dwFlags);
+
+WINBOOL
+STDCALL
+PeekConsoleInputA(
+ HANDLE hConsoleInput,
+ PINPUT_RECORD lpBuffer,
+ DWORD nLength,
+ LPDWORD lpNumberOfEventsRead
+ );
+
+WINBOOL
+STDCALL
+ReadConsoleInputA(
+ HANDLE hConsoleInput,
+ PINPUT_RECORD lpBuffer,
+ DWORD nLength,
+ LPDWORD lpNumberOfEventsRead
+ );
+
+WINBOOL
+STDCALL
+WriteConsoleInputA(
+ HANDLE hConsoleInput,
+ CONST INPUT_RECORD *lpBuffer,
+ DWORD nLength,
+ LPDWORD lpNumberOfEventsWritten
+ );
+
+WINBOOL
+STDCALL
+ReadConsoleOutputA(
+ HANDLE hConsoleOutput,
+ PCHAR_INFO lpBuffer,
+ COORD dwBufferSize,
+ COORD dwBufferCoord,
+ PSMALL_RECT lpReadRegion
+ );
+
+WINBOOL
+STDCALL
+WriteConsoleOutputA(
+ HANDLE hConsoleOutput,
+ CONST CHAR_INFO *lpBuffer,
+ COORD dwBufferSize,
+ COORD dwBufferCoord,
+ PSMALL_RECT lpWriteRegion
+ );
+
+WINBOOL
+STDCALL
+ReadConsoleOutputCharacterA(
+ HANDLE hConsoleOutput,
+ LPSTR lpCharacter,
+ DWORD nLength,
+ COORD dwReadCoord,
+ LPDWORD lpNumberOfCharsRead
+ );
+
+WINBOOL
+STDCALL
+WriteConsoleOutputCharacterA(
+ HANDLE hConsoleOutput,
+ LPCSTR lpCharacter,
+ DWORD nLength,
+ COORD dwWriteCoord,
+ LPDWORD lpNumberOfCharsWritten
+ );
+
+WINBOOL
+STDCALL
+FillConsoleOutputCharacterA(
+ HANDLE hConsoleOutput,
+ CHAR cCharacter,
+ DWORD nLength,
+ COORD dwWriteCoord,
+ LPDWORD lpNumberOfCharsWritten
+ );
+
+WINBOOL
+STDCALL
+ScrollConsoleScreenBufferA(
+ HANDLE hConsoleOutput,
+ CONST SMALL_RECT *lpScrollRectangle,
+ CONST SMALL_RECT *lpClipRectangle,
+ COORD dwDestinationOrigin,
+ CONST CHAR_INFO *lpFill
+ );
+
+DWORD
+STDCALL
+GetConsoleTitleA(
+ LPSTR lpConsoleTitle,
+ DWORD nSize
+ );
+
+WINBOOL
+STDCALL
+SetConsoleTitleA(
+ LPCSTR lpConsoleTitle
+ );
+
+WINBOOL
+STDCALL
+ReadConsoleA(
+ HANDLE hConsoleInput,
+ LPVOID lpBuffer,
+ DWORD nNumberOfCharsToRead,
+ LPDWORD lpNumberOfCharsRead,
+ LPVOID lpReserved
+ );
+
+WINBOOL
+STDCALL
+WriteConsoleA(
+ HANDLE hConsoleOutput,
+ CONST VOID *lpBuffer,
+ DWORD nNumberOfCharsToWrite,
+ LPDWORD lpNumberOfCharsWritten,
+ LPVOID lpReserved
+ );
+
+DWORD STDCALL
+WNetAddConnectionA(
+ LPCSTR lpRemoteName,
+ LPCSTR lpPassword,
+ LPCSTR lpLocalName
+ );
+
+DWORD STDCALL
+WNetAddConnection2A(
+ LPNETRESOURCE lpNetResource,
+ LPCSTR lpPassword,
+ LPCSTR lpUserName,
+ DWORD dwFlags
+ );
+
+DWORD STDCALL
+WNetAddConnection3A(
+ HWND hwndOwner,
+ LPNETRESOURCE lpNetResource,
+ LPCSTR lpPassword,
+ LPCSTR lpUserName,
+ DWORD dwFlags
+ );
+
+DWORD STDCALL
+WNetCancelConnectionA(
+ LPCSTR lpName,
+ WINBOOL fForce
+ );
+
+DWORD STDCALL
+WNetCancelConnection2A(
+ LPCSTR lpName,
+ DWORD dwFlags,
+ WINBOOL fForce
+ );
+
+DWORD STDCALL
+WNetGetConnectionA(
+ LPCSTR lpLocalName,
+ LPSTR lpRemoteName,
+ LPDWORD lpnLength
+ );
+
+DWORD STDCALL
+WNetUseConnectionA(
+ HWND hwndOwner,
+ LPNETRESOURCE lpNetResource,
+ LPCSTR lpUserID,
+ LPCSTR lpPassword,
+ DWORD dwFlags,
+ LPSTR lpAccessName,
+ LPDWORD lpBufferSize,
+ LPDWORD lpResult
+ );
+
+DWORD STDCALL
+WNetSetConnectionA(
+ LPCSTR lpName,
+ DWORD dwProperties,
+ LPVOID pvValues
+ );
+
+DWORD STDCALL
+WNetConnectionDialog1A(
+ LPCONNECTDLGSTRUCT lpConnDlgStruct
+ );
+
+DWORD STDCALL
+WNetDisconnectDialog1A(
+ LPDISCDLGSTRUCT lpConnDlgStruct
+ );
+
+DWORD STDCALL
+WNetOpenEnumA(
+ DWORD dwScope,
+ DWORD dwType,
+ DWORD dwUsage,
+ LPNETRESOURCE lpNetResource,
+ LPHANDLE lphEnum
+ );
+
+DWORD STDCALL
+WNetEnumResourceA(
+ HANDLE hEnum,
+ LPDWORD lpcCount,
+ LPVOID lpBuffer,
+ LPDWORD lpBufferSize
+ );
+
+DWORD STDCALL
+WNetGetUniversalNameA(
+ LPCSTR lpLocalPath,
+ DWORD dwInfoLevel,
+ LPVOID lpBuffer,
+ LPDWORD lpBufferSize
+ );
+
+DWORD STDCALL
+WNetGetUserA(
+ LPCSTR lpName,
+ LPSTR lpUserName,
+ LPDWORD lpnLength
+ );
+
+DWORD STDCALL
+WNetGetProviderNameA(
+ DWORD dwNetType,
+ LPSTR lpProviderName,
+ LPDWORD lpBufferSize
+ );
+
+DWORD STDCALL
+WNetGetNetworkInformationA(
+ LPCSTR lpProvider,
+ LPNETINFOSTRUCT lpNetInfoStruct
+ );
+
+DWORD STDCALL
+WNetGetLastErrorA(
+ LPDWORD lpError,
+ LPSTR lpErrorBuf,
+ DWORD nErrorBufSize,
+ LPSTR lpNameBuf,
+ DWORD nNameBufSize
+ );
+
+DWORD STDCALL
+MultinetGetConnectionPerformanceA(
+ LPNETRESOURCE lpNetResource,
+ LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct
+ );
+
+WINBOOL
+STDCALL
+ChangeServiceConfigA(
+ SC_HANDLE hService,
+ DWORD dwServiceType,
+ DWORD dwStartType,
+ DWORD dwErrorControl,
+ LPCSTR lpBinaryPathName,
+ LPCSTR lpLoadOrderGroup,
+ LPDWORD lpdwTagId,
+ LPCSTR lpDependencies,
+ LPCSTR lpServiceStartName,
+ LPCSTR lpPassword,
+ LPCSTR lpDisplayName
+ );
+
+SC_HANDLE
+STDCALL
+CreateServiceA(
+ SC_HANDLE hSCManager,
+ LPCSTR lpServiceName,
+ LPCSTR lpDisplayName,
+ DWORD dwDesiredAccess,
+ DWORD dwServiceType,
+ DWORD dwStartType,
+ DWORD dwErrorControl,
+ LPCSTR lpBinaryPathName,
+ LPCSTR lpLoadOrderGroup,
+ LPDWORD lpdwTagId,
+ LPCSTR lpDependencies,
+ LPCSTR lpServiceStartName,
+ LPCSTR lpPassword
+ );
+
+WINBOOL
+STDCALL
+EnumDependentServicesA(
+ SC_HANDLE hService,
+ DWORD dwServiceState,
+ LPENUM_SERVICE_STATUS lpServices,
+ DWORD cbBufSize,
+ LPDWORD pcbBytesNeeded,
+ LPDWORD lpServicesReturned
+ );
+
+WINBOOL
+STDCALL
+EnumServicesStatusA(
+ SC_HANDLE hSCManager,
+ DWORD dwServiceType,
+ DWORD dwServiceState,
+ LPENUM_SERVICE_STATUS lpServices,
+ DWORD cbBufSize,
+ LPDWORD pcbBytesNeeded,
+ LPDWORD lpServicesReturned,
+ LPDWORD lpResumeHandle
+ );
+
+WINBOOL
+STDCALL
+GetServiceKeyNameA(
+ SC_HANDLE hSCManager,
+ LPCSTR lpDisplayName,
+ LPSTR lpServiceName,
+ LPDWORD lpcchBuffer
+ );
+
+WINBOOL
+STDCALL
+GetServiceDisplayNameA(
+ SC_HANDLE hSCManager,
+ LPCSTR lpServiceName,
+ LPSTR lpDisplayName,
+ LPDWORD lpcchBuffer
+ );
+
+SC_HANDLE
+STDCALL
+OpenSCManagerA(
+ LPCSTR lpMachineName,
+ LPCSTR lpDatabaseName,
+ DWORD dwDesiredAccess
+ );
+
+SC_HANDLE
+STDCALL
+OpenServiceA(
+ SC_HANDLE hSCManager,
+ LPCSTR lpServiceName,
+ DWORD dwDesiredAccess
+ );
+
+WINBOOL
+STDCALL
+QueryServiceConfigA(
+ SC_HANDLE hService,
+ LPQUERY_SERVICE_CONFIG lpServiceConfig,
+ DWORD cbBufSize,
+ LPDWORD pcbBytesNeeded
+ );
+
+WINBOOL
+STDCALL
+QueryServiceLockStatusA(
+ SC_HANDLE hSCManager,
+ LPQUERY_SERVICE_LOCK_STATUS lpLockStatus,
+ DWORD cbBufSize,
+ LPDWORD pcbBytesNeeded
+ );
+
+SERVICE_STATUS_HANDLE
+STDCALL
+RegisterServiceCtrlHandlerA(
+ LPCSTR lpServiceName,
+ LPHANDLER_FUNCTION lpHandlerProc
+ );
+
+WINBOOL
+STDCALL
+StartServiceCtrlDispatcherA(
+ LPSERVICE_TABLE_ENTRY lpServiceStartTable
+ );
+
+WINBOOL
+STDCALL
+StartServiceA(
+ SC_HANDLE hService,
+ DWORD dwNumServiceArgs,
+ LPCSTR *lpServiceArgVectors
+ );
+
+/* Extensions to OpenGL */
+
+WINBOOL STDCALL
+wglUseFontBitmapsA(HDC, DWORD, DWORD, DWORD);
+
+WINBOOL STDCALL
+wglUseFontOutlinesA(HDC, DWORD, DWORD, DWORD, FLOAT,
+ FLOAT, int, LPGLYPHMETRICSFLOAT);
+
+/* ------------------------------------- */
+/* From shellapi.h in old Cygnus headers */
+
+unsigned int WINAPI
+DragQueryFileA(HDROP, unsigned int, char *, unsigned int);
+
+HICON WINAPI
+ExtractAssociatedIconA (HINSTANCE, char *, WORD *);
+
+HICON WINAPI
+ExtractIconA (HINSTANCE, const char *, unsigned int);
+
+HINSTANCE WINAPI
+FindExecutableA (const char *, const char *, char *);
+
+int WINAPI
+ShellAboutA (HWND, const char *, const char *, HICON);
+
+HINSTANCE WINAPI
+ShellExecuteA (HWND, const char *, const char *, char *, const char *, int);
+
+/* end of stuff from shellapi.h in old Cygnus headers */
+/* -------------------------------------------------- */
+/* From ddeml.h in old Cygnus headers */
+
+HSZ WINAPI
+DdeCreateStringHandleA (DWORD, char *, int);
+
+UINT WINAPI
+DdeInitializeA (DWORD *, CALLB, DWORD, DWORD);
+
+DWORD WINAPI
+DdeQueryStringA (DWORD, HSZ, char *, DWORD, int);
+
+/* end of stuff from ddeml.h in old Cygnus headers */
+/* ----------------------------------------------- */
+
+WINBOOL STDCALL LogonUserA (LPSTR, LPSTR, LPSTR, DWORD, DWORD, HANDLE *);
+WINBOOL STDCALL CreateProcessAsUserA (HANDLE, LPCTSTR, LPTSTR,
+ SECURITY_ATTRIBUTES*, SECURITY_ATTRIBUTES*, WINBOOL, DWORD, LPVOID,
+ LPCTSTR, STARTUPINFO*, PROCESS_INFORMATION*);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _GNU_H_WINDOWS32_ASCIIFUNCTIONS */
--- /dev/null
+/* \r
+ Base.h\r
+\r
+ Base definitions\r
+\r
+ Copyright (C) 1996, 1997 Free Software Foundation, Inc.\r
+\r
+ Author: Scott Christley <scottc@net-community.com>\r
+\r
+ This file is part of the Windows32 API Library.\r
+\r
+ This library is free software; you can redistribute it and/or\r
+ modify it under the terms of the GNU Library General Public\r
+ License as published by the Free Software Foundation; either\r
+ version 2 of the License, or (at your option) any later version.\r
+ \r
+ This library is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ Library General Public License for more details.\r
+\r
+ If you are interested in a warranty or support for this source code,\r
+ contact Scott Christley <scottc@net-community.com> for more information.\r
+ \r
+ You should have received a copy of the GNU Library General Public\r
+ License along with this library; see the file COPYING.LIB.\r
+ If not, write to the Free Software Foundation, \r
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+*/ \r
+\r
+#ifndef _GNU_H_WINDOWS32_BASE\r
+#define _GNU_H_WINDOWS32_BASE\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+#ifndef NULL\r
+#ifdef __cplusplus\r
+#define NULL (0)\r
+#else\r
+#define NULL ((void *)0)\r
+#endif\r
+#endif /* !NULL */\r
+\r
+#define FALSE 0\r
+#define TRUE 1\r
+\r
+#ifndef RC_INVOKED\r
+\r
+/* typedef ACMDRIVERENUMCB;\r
+typedef ACMDRIVERPROC;\r
+typedef ACMFILERCHOOSEHOOKPROC;\r
+typedef ACMFILTERENUMCB;\r
+typedef ACMFILTERTAGENUMCB;\r
+typedef ACMFORMATCHOOSEHOOKPROC;\r
+typedef ACMFORMATENUMCB;\r
+typedef ACMFORMATTAGENUMCB;\r
+typedef APPLET_PROC;\r
+*/\r
+typedef unsigned short ATOM;\r
+/* Changed from BOOL to WINBOOL to avoid Objective-C conflict */\r
+typedef int WINBOOL;\r
+typedef unsigned char BOOLEAN;\r
+typedef unsigned char BYTE;\r
+typedef unsigned long CALTYPE;\r
+typedef unsigned long CALID;\r
+typedef char CCHAR;\r
+typedef unsigned long COLORREF;\r
+#define CONST const\r
+\r
+/* Check VOID before defining CHAR, SHORT, and LONG */\r
+#ifndef VOID\r
+#define VOID void\r
+typedef char CHAR;\r
+typedef short SHORT;\r
+typedef long LONG;\r
+#endif\r
+\r
+/*\r
+typedef CTRYID;\r
+typedef DLGPROC;\r
+*/\r
+typedef unsigned int DWORD; /* was unsigned long */\r
+typedef double DWORDLONG, *PDWORDLONG;\r
+/*\r
+typedef EDITWORDBREAKPROC;\r
+typedef ENHMFENUMPROC;\r
+typedef ENUMRESLANGPROC;\r
+typedef ENUMRESNAMEPROC;\r
+typedef ENUMRESTYPEPROC;\r
+*/\r
+typedef float FLOAT;\r
+/* typedef GLOBALHANDLE; */\r
+typedef void *HANDLE;\r
+typedef HANDLE HACCEL;\r
+typedef HANDLE HBITMAP;\r
+typedef HANDLE HBRUSH;\r
+typedef HANDLE HCOLORSPACE;\r
+typedef HANDLE HCONV;\r
+typedef HANDLE HCONVLIST;\r
+typedef HANDLE HCURSOR;\r
+typedef HANDLE HDBC;\r
+typedef HANDLE HDC;\r
+typedef HANDLE HDDEDATA;\r
+typedef HANDLE HDESK;\r
+typedef HANDLE HDROP;\r
+typedef HANDLE HDWP;\r
+typedef HANDLE HENHMETAFILE;\r
+typedef HANDLE HENV;\r
+typedef int HFILE;\r
+typedef HANDLE HFONT;\r
+typedef HANDLE HGDIOBJ;\r
+typedef HANDLE HGLOBAL;\r
+typedef HANDLE HGLRC;\r
+typedef HANDLE HHOOK;\r
+typedef HANDLE HICON;\r
+typedef HANDLE HIMAGELIST;\r
+typedef HANDLE HINSTANCE;\r
+typedef HANDLE HKEY, *PHKEY;\r
+typedef HANDLE HKL;\r
+typedef HANDLE HLOCAL;\r
+typedef HANDLE HMENU;\r
+typedef HANDLE HMETAFILE;\r
+typedef HANDLE HMODULE;\r
+typedef HANDLE HPALETTE;\r
+typedef HANDLE HPEN;\r
+typedef HANDLE HRASCONN;\r
+typedef long HRESULT;\r
+typedef HANDLE HRGN;\r
+typedef HANDLE HRSRC;\r
+typedef HANDLE HSTMT;\r
+typedef HANDLE HSZ;\r
+typedef HANDLE HWINSTA;\r
+typedef HANDLE HWND;\r
+typedef int INT;\r
+typedef unsigned short LANGID;\r
+typedef DWORD LCID;\r
+typedef DWORD LCTYPE;\r
+/* typedef LOCALHANDLE */\r
+typedef double LONGLONG, *PLONGLONG;\r
+typedef unsigned short *LP;\r
+typedef long LPARAM;\r
+typedef WINBOOL *LPBOOL;\r
+typedef BYTE *LPBYTE;\r
+typedef CONST CHAR *LPCCH;\r
+typedef CHAR *LPCH;\r
+typedef COLORREF *LPCOLORREF;\r
+typedef const char *LPCSTR;\r
+typedef char* PCSZ;\r
+ \r
+#ifdef UNICODE\r
+typedef const unsigned short *LPCTSTR;\r
+#else\r
+typedef const char *LPCTSTR;\r
+#endif /* UNICODE */\r
+\r
+typedef const unsigned short *LPCWCH;\r
+typedef const unsigned short *LPCWSTR;\r
+typedef DWORD *LPDWORD;\r
+/* typedef LPFRHOOKPROC; */\r
+typedef HANDLE *LPHANDLE;\r
+/* typedef LPHANDLER_FUNCTION; */\r
+typedef int *LPINT;\r
+typedef long *LPLONG;\r
+typedef char *LPSTR;\r
+\r
+#ifdef UNICODE\r
+typedef unsigned short *LPTCH;\r
+typedef unsigned short *LPTSTR;\r
+#else\r
+typedef char *LPTCH;\r
+typedef char *LPTSTR;\r
+#endif /* UNICODE */\r
+\r
+typedef long LRESULT;\r
+typedef void *LPVOID;\r
+typedef const void *LPCVOID;\r
+typedef unsigned short *LPWCH;\r
+typedef unsigned short *LPWORD;\r
+typedef unsigned short *LPWSTR;\r
+typedef unsigned short *PWSTR;\r
+/* typedef NPSTR; */\r
+typedef unsigned short *NWPSTR;\r
+typedef WINBOOL *PWINBOOL;\r
+typedef BYTE *PBOOLEAN;\r
+typedef BYTE *PBYTE;\r
+typedef const CHAR *PCCH;\r
+typedef CHAR *PCH;\r
+typedef CHAR *PCHAR;\r
+typedef const char *PCSTR;\r
+typedef const unsigned short *PCWCH;\r
+typedef const unsigned short *PCWSTR;\r
+typedef DWORD *PDWORD;\r
+typedef float *PFLOAT;\r
+typedef HANDLE *PHANDLE;\r
+/* typedef PHKEY; */\r
+typedef int *PINT;\r
+/* typedef LCID *PLCID; */\r
+typedef long *PLONG;\r
+typedef short *PSHORT;\r
+/* typedef PSID; */\r
+typedef char *PSTR;\r
+typedef char *PSZ;\r
+\r
+#ifdef UNICODE\r
+typedef unsigned short *PTBYTE;\r
+typedef unsigned short *PTCH;\r
+typedef unsigned short *PTCHAR;\r
+typedef unsigned short *PTSTR;\r
+#else\r
+typedef unsigned char *PTBYTE;\r
+typedef char *PTCH;\r
+typedef char *PTCHAR;\r
+typedef char *PTSTR;\r
+#endif /* UNICODE */\r
+\r
+typedef unsigned char *PUCHAR;\r
+typedef unsigned int *PUINT;\r
+typedef unsigned long *PULONG;\r
+typedef unsigned short *PUSHORT;\r
+typedef void *PVOID;\r
+typedef unsigned short *PWCH;\r
+typedef unsigned short *PWCHAR;\r
+typedef unsigned short *PWORD;\r
+/*\r
+typedef PWSTR;\r
+typedef REGSAM;\r
+*/\r
+\r
+typedef short RETCODE;\r
+\r
+typedef HANDLE SC_HANDLE;\r
+typedef LPVOID SC_LOCK;\r
+typedef SC_HANDLE *LPSC_HANDLE;\r
+typedef DWORD SERVICE_STATUS_HANDLE;\r
+/* typedef SPHANDLE; */\r
+\r
+#ifdef UNICODE\r
+typedef unsigned short TBYTE;\r
+typedef unsigned short TCHAR;\r
+typedef unsigned short BCHAR;\r
+#else\r
+typedef unsigned char TBYTE;\r
+typedef char TCHAR;\r
+typedef BYTE BCHAR;\r
+#endif /* UNICODE */\r
+\r
+typedef unsigned char UCHAR;\r
+typedef unsigned int UINT;\r
+typedef unsigned long ULONG;\r
+typedef unsigned short USHORT;\r
+typedef unsigned short WCHAR;\r
+typedef unsigned short WORD;\r
+typedef unsigned int WPARAM;\r
+/* typedef YIELDPROC; */\r
+\r
+/* Only use __stdcall under WIN32 compiler */\r
+#ifdef i386\r
+#define STDCALL __attribute__ ((stdcall))\r
+#define CDECL __attribute((cdecl))\r
+#define CALLBACK WINAPI\r
+#define PASCAL WINAPI\r
+#else\r
+#define STDCALL\r
+#define CDECL\r
+#define CALLBACK\r
+#define PASCAL\r
+#endif\r
+#define WINAPI STDCALL\r
+#define APIENTRY STDCALL\r
+#define WINGDIAPI\r
+\r
+#define _export\r
+\r
+/*\r
+ Enumerations\r
+*/\r
+typedef enum _ACL_INFORMATION_CLASS {\r
+ AclRevisionInformation = 1, \r
+ AclSizeInformation \r
+} ACL_INFORMATION_CLASS; \r
+ \r
+typedef enum _MEDIA_TYPE { \r
+ Unknown, \r
+ F5_1Pt2_512, \r
+ F3_1Pt44_512, \r
+ F3_2Pt88_512, \r
+ F3_20Pt8_512, \r
+ F3_720_512, \r
+ F5_360_512, \r
+ F5_320_512, \r
+ F5_320_1024, \r
+ F5_180_512, \r
+ F5_160_512, \r
+ RemovableMedia, \r
+ FixedMedia \r
+} MEDIA_TYPE; \r
+ \r
+#define RASCS_DONE 0x2000\r
+#define RASCS_PAUSED 0x1000\r
+typedef enum _RASCONNSTATE { \r
+ RASCS_OpenPort = 0, \r
+ RASCS_PortOpened, \r
+ RASCS_ConnectDevice, \r
+ RASCS_DeviceConnected, \r
+ RASCS_AllDevicesConnected, \r
+ RASCS_Authenticate, \r
+ RASCS_AuthNotify, \r
+ RASCS_AuthRetry, \r
+ RASCS_AuthCallback, \r
+ RASCS_AuthChangePassword, \r
+ RASCS_AuthProject, \r
+ RASCS_AuthLinkSpeed, \r
+ RASCS_AuthAck, \r
+ RASCS_ReAuthenticate, \r
+ RASCS_Authenticated, \r
+ RASCS_PrepareForCallback, \r
+ RASCS_WaitForModemReset, \r
+ RASCS_WaitForCallback,\r
+ RASCS_Projected, \r
+ \r
+ RASCS_StartAuthentication, \r
+ RASCS_CallbackComplete, \r
+ RASCS_LogonNetwork, \r
+ \r
+ RASCS_Interactive = RASCS_PAUSED, \r
+ RASCS_RetryAuthentication, \r
+ RASCS_CallbackSetByCaller, \r
+ RASCS_PasswordExpired, \r
+ \r
+ RASCS_Connected = RASCS_DONE, \r
+ RASCS_Disconnected \r
+} RASCONNSTATE ; \r
+ \r
+typedef enum _RASPROJECTION { \r
+ RASP_Amb = 0x10000, \r
+ RASP_PppNbf = 0x803F, \r
+ RASP_PppIpx = 0x802B, \r
+ RASP_PppIp = 0x8021 \r
+} RASPROJECTION ; \r
+ \r
+typedef enum _SECURITY_IMPERSONATION_LEVEL {\r
+ SecurityAnonymous, \r
+ SecurityIdentification, \r
+ SecurityImpersonation, \r
+ SecurityDelegation \r
+} SECURITY_IMPERSONATION_LEVEL; \r
+ \r
+typedef enum _SID_NAME_USE { \r
+ SidTypeUser = 1, \r
+ SidTypeGroup, \r
+ SidTypeDomain, \r
+ SidTypeAlias, \r
+ SidTypeWellKnownGroup, \r
+ SidTypeDeletedAccount, \r
+ SidTypeInvalid, \r
+ SidTypeUnknown \r
+} SID_NAME_USE, *PSID_NAME_USE; \r
+ \r
+typedef enum _TOKEN_INFORMATION_CLASS {\r
+ TokenUser = 1, \r
+ TokenGroups, \r
+ TokenPrivileges, \r
+ TokenOwner, \r
+ TokenPrimaryGroup, \r
+ TokenDefaultDacl, \r
+ TokenSource, \r
+ TokenType, \r
+ TokenImpersonationLevel, \r
+ TokenStatistics \r
+} TOKEN_INFORMATION_CLASS; \r
+ \r
+typedef enum tagTOKEN_TYPE {\r
+ TokenPrimary = 1, \r
+ TokenImpersonation \r
+} TOKEN_TYPE; \r
+ \r
+#endif /* ! defined (RC_INVOKED) */\r
+\r
+/*\r
+ Macros\r
+*/\r
+#define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) (void)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(id), (LPARAM)(NMHDR FAR*)(pnmhdr)) \r
+\r
+#define GetBValue(rgb) ((BYTE) ((rgb) >> 16)) \r
+#define GetGValue(rgb) ((BYTE) (((WORD) (rgb)) >> 8)) \r
+#define GetRValue(rgb) ((BYTE) (rgb)) \r
+#define RGB(r, g ,b) ((DWORD) (((BYTE) (r) | ((WORD) (g) << 8)) | (((DWORD) (BYTE) (b)) << 16))) \r
+\r
+#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam)) \r
+\r
+#define HIBYTE(w) ((BYTE) (((WORD) (w) >> 8) & 0xFF)) \r
+#define HIWORD(l) ((WORD) (((DWORD) (l) >> 16) & 0xFFFF)) \r
+#define LOBYTE(w) ((BYTE) (w)) \r
+#define LOWORD(l) ((WORD) (l)) \r
+#define MAKELONG(a, b) ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) << 16)) \r
+#define MAKEWORD(a, b) ((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8)) \r
+\r
+/* original Cygnus headers also had the following defined: */\r
+#define SEXT_HIWORD(l) ((((int)l) >> 16))\r
+#define ZEXT_HIWORD(l) ((((unsigned int)l) >> 16))\r
+#define SEXT_LOWORD(l) ((int)(short)l)\r
+\r
+#define INDEXTOOVERLAYMASK(i) ((i) << 8) \r
+#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12) \r
+\r
+#define MAKEINTATOM(i) (LPTSTR) ((DWORD) ((WORD) (i))) \r
+#define MAKEINTRESOURCE(i) (LPTSTR) ((DWORD) ((WORD) (i)))\r
+\r
+#define MAKELANGID(p, s) ((((WORD) (s)) << 10) | (WORD) (p)) \r
+#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff) \r
+#define SUBLANGID(lgid) ((WORD )(lgid) >> 10) \r
+\r
+#define LANGIDFROMLCID(lcid) ((WORD) (lcid)) \r
+#define SORTIDFROMLCID(lcid) ((WORD )((((DWORD)(lcid)) & 0x000FFFFF) >> 16)) \r
+#define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid))))) \r
+#define MAKELPARAM(l, h) ((LPARAM) MAKELONG(l, h)) \r
+#define MAKELRESULT(l, h) ((LRESULT) MAKELONG(l, h)) \r
+#define MAKEPOINTS(l) (*((POINTS FAR *) & (l))) \r
+#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) \r
+#define MAKEWPARAM(l, h) ((WPARAM) MAKELONG(l, h)) \r
+\r
+#ifndef max\r
+#define max(a, b) (((a) > (b)) ? (a) : (b)) \r
+#endif\r
+\r
+#ifndef min\r
+#define min(a, b) (((a) < (b)) ? (a) : (b)) \r
+#endif\r
+\r
+#define PALETTEINDEX(i) ((COLORREF) (0x01000000 | (DWORD) (WORD) (i))) \r
+#define PALETTERGB(r, g, b) (0x02000000 | RGB(r, g, b)) \r
+#define POINTSTOPOINT(pt, pts) {(pt).x = (SHORT) LOWORD(pts); (pt).y = (SHORT) HIWORD(pts);} \r
+#define POINTTOPOINTS(pt) (MAKELONG((short) ((pt).x), (short) ((pt).y))) \r
+\r
+#define INDEXTOOVERLAYMASK(i) ((i) << 8) \r
+#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12) \r
+\r
+#ifdef UNICODE\r
+#define TEXT(quote) L##quote \r
+#else\r
+#define TEXT(quote) quote\r
+#endif\r
+\r
+#ifndef RC_INVOKED\r
+\r
+/*\r
+ Definitions for callback procedures\r
+*/\r
+typedef int CALLBACK (*BFFCALLBACK) (HWND, UINT, LPARAM, LPARAM);\r
+typedef UINT CALLBACK (*LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef UINT CALLBACK (*LPCFHOOKPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef DWORD CALLBACK (*PTHREAD_START_ROUTINE) (LPVOID);\r
+typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;\r
+typedef DWORD CALLBACK (*EDITSTREAMCALLBACK) (DWORD, LPBYTE, LONG, LONG);\r
+typedef UINT CALLBACK (*LPFRHOOKPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef UINT CALLBACK (*LPOFNHOOKPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef UINT CALLBACK (*LPPRINTHOOKPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef UINT CALLBACK (*LPSETUPHOOKPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef WINBOOL CALLBACK (*DLGPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef int CALLBACK (*PFNPROPSHEETCALLBACK) (HWND, UINT, LPARAM);\r
+typedef VOID CALLBACK (*LPSERVICE_MAIN_FUNCTION) (DWORD, LPTSTR);\r
+typedef int CALLBACK (*PFNTVCOMPARE) (LPARAM, LPARAM, LPARAM);\r
+typedef LRESULT CALLBACK (*WNDPROC) (HWND, UINT, WPARAM, LPARAM);\r
+typedef int CALLBACK (*FARPROC)(void);\r
+typedef FARPROC PROC;\r
+typedef WINBOOL CALLBACK (*ENUMRESTYPEPROC) (HANDLE, LPTSTR, LONG);\r
+typedef WINBOOL CALLBACK (*ENUMRESNAMEPROC) (HANDLE, LPCTSTR, LPTSTR, LONG);\r
+typedef WINBOOL CALLBACK (*ENUMRESLANGPROC) (HANDLE, LPCTSTR, LPCTSTR, WORD, LONG);\r
+typedef FARPROC DESKTOPENUMPROC;\r
+typedef WINBOOL CALLBACK (*ENUMWINDOWSPROC) (HWND, LPARAM);\r
+typedef WINBOOL CALLBACK (*ENUMWINDOWSTATIONPROC) (LPTSTR, LPARAM);\r
+typedef VOID CALLBACK (*SENDASYNCPROC) (HWND, UINT, DWORD, LRESULT);\r
+typedef VOID CALLBACK (*TIMERPROC) (HWND, UINT, UINT, DWORD);\r
+typedef FARPROC GRAYSTRINGPROC;\r
+typedef WINBOOL CALLBACK (*DRAWSTATEPROC) (HDC, LPARAM, WPARAM, int, int);\r
+typedef WINBOOL CALLBACK (*PROPENUMPROCEX) (HWND, LPCTSTR, HANDLE, DWORD);\r
+typedef WINBOOL CALLBACK (*PROPENUMPROC) (HWND, LPCTSTR, HANDLE);\r
+typedef LRESULT CALLBACK (*HOOKPROC) (int, WPARAM, LPARAM);\r
+typedef VOID CALLBACK (*ENUMOBJECTSPROC) (LPVOID, LPARAM);\r
+typedef VOID CALLBACK (*LINEDDAPROC) (int, int, LPARAM);\r
+typedef WINBOOL CALLBACK (*ABORTPROC) (HDC, int);\r
+typedef UINT CALLBACK (*LPPAGEPAINTHOOK) (HWND, UINT, WPARAM, LPARAM );\r
+typedef UINT CALLBACK (*LPPAGESETUPHOOK) (HWND, UINT, WPARAM, LPARAM );\r
+typedef int CALLBACK (*ICMENUMPROC) (LPTSTR, LPARAM);\r
+typedef LONG (*EDITWORDBREAKPROCEX) (char *, LONG, BYTE, INT);\r
+typedef int CALLBACK (*PFNLVCOMPARE) (LPARAM, LPARAM, LPARAM);\r
+typedef WINBOOL CALLBACK (*LOCALE_ENUMPROC) (LPTSTR);\r
+typedef WINBOOL CALLBACK (*CODEPAGE_ENUMPROC) (LPTSTR);\r
+typedef WINBOOL CALLBACK (*DATEFMT_ENUMPROC) (LPTSTR);\r
+typedef WINBOOL CALLBACK (*TIMEFMT_ENUMPROC) (LPTSTR);\r
+typedef WINBOOL CALLBACK (*CALINFO_ENUMPROC) (LPTSTR);\r
+typedef WINBOOL CALLBACK (*PHANDLER_ROUTINE) (DWORD);\r
+typedef WINBOOL CALLBACK (*LPHANDLER_FUNCTION) (DWORD);\r
+typedef UINT CALLBACK (*PFNGETPROFILEPATH) (LPCTSTR, LPSTR, UINT);\r
+typedef UINT CALLBACK (*PFNRECONCILEPROFILE) (LPCTSTR, LPCTSTR, DWORD);\r
+typedef WINBOOL CALLBACK (*PFNPROCESSPOLICIES) (HWND, LPCTSTR, LPCTSTR, LPCTSTR, DWORD);\r
+\r
+#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}\r
+#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}\r
+#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}\r
+#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}\r
+#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}\r
+#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}\r
+\r
+#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")\r
+#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")\r
+#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")\r
+#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")\r
+#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")\r
+#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")\r
+#define SE_TCB_NAME TEXT("SeTcbPrivilege")\r
+#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")\r
+#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")\r
+#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")\r
+#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")\r
+#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")\r
+#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")\r
+#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")\r
+#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")\r
+#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")\r
+#define SE_BACKUP_NAME TEXT("SeBackupPrivilege")\r
+#define SE_RESTORE_NAME TEXT("SeRestorePrivilege")\r
+#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")\r
+#define SE_DEBUG_NAME TEXT("SeDebugPrivilege")\r
+#define SE_AUDIT_NAME TEXT("SeAuditPrivilege")\r
+#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")\r
+#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")\r
+#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")\r
+\r
+#define SERVICES_ACTIVE_DATABASEW L"ServicesActive"\r
+#define SERVICES_FAILED_DATABASEW L"ServicesFailed"\r
+#define SERVICES_ACTIVE_DATABASEA "ServicesActive"\r
+#define SERVICES_FAILED_DATABASEA "ServicesFailed"\r
+#define SC_GROUP_IDENTIFIERW L'+'\r
+#define SC_GROUP_IDENTIFIERA '+'\r
+\r
+#ifdef UNICODE\r
+#define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEW\r
+#define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEW\r
+#define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERW\r
+#else \r
+#define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEA\r
+#define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEA\r
+#define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERA\r
+#endif /* UNICODE */\r
+\r
+/* ---------------------------------- */\r
+/* From ddeml.h in old Cygnus headers */\r
+\r
+typedef void (*CALLB) (void);\r
+typedef CALLB PFNCALLBACK;\r
+\r
+typedef WINBOOL SECURITY_CONTEXT_TRACKING_MODE;\r
+\r
+/* End of stuff from ddeml.h in old Cygnus headers */\r
+/* ----------------------------------------------- */\r
+\r
+typedef FARPROC WNDENUMPROC;\r
+typedef FARPROC ENHMFENUMPROC;\r
+typedef DWORD CCSTYLE, *PCCSTYLE, *LPCCSTYLE;\r
+typedef DWORD CCSTYLEFLAGA, *PCCSTYLEFLAGA, *LPCCSTYLEFLAGA;\r
+#define DECLARE_HANDLE(s) typedef HANDLE s\r
+\r
+#endif /* ! defined (RC_INVOKED) */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+#endif /* _GNU_H_WINDOWS32_BASE */\r
--- /dev/null
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */\r
+#ifndef __dj_include_coff_h_\r
+#define __dj_include_coff_h_\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+//#ifndef __dj_ENFORCE_ANSI_FREESTANDING\r
+\r
+//#ifndef __STRICT_ANSI__\r
+\r
+//#ifndef _POSIX_SOURCE\r
+\r
+/*** coff information for Intel 386/486. */\r
+\r
+/********************** FILE HEADER **********************/\r
+\r
+struct external_filehdr {\r
+ unsigned short f_magic; /* magic number */\r
+ unsigned short f_nscns; /* number of sections */\r
+ unsigned long f_timdat; /* time & date stamp */\r
+ unsigned long f_symptr; /* file pointer to symtab */\r
+ unsigned long f_nsyms; /* number of symtab entries */\r
+ unsigned short f_opthdr; /* sizeof(optional hdr) */\r
+ unsigned short f_flags; /* flags */\r
+};\r
+\r
+\r
+/* Bits for f_flags:\r
+ * F_RELFLG relocation info stripped from file\r
+ * F_EXEC file is executable (no unresolved external references)\r
+ * F_LNNO line numbers stripped from file\r
+ * F_LSYMS local symbols stripped from file\r
+ * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax)\r
+ */\r
+\r
+#define F_RELFLG (0x0001)\r
+#define F_EXEC (0x0002)\r
+#define F_LNNO (0x0004)\r
+#define F_LSYMS (0x0008)\r
+\r
+\r
+\r
+#define I386MAGIC 0x14c\r
+#define I386AIXMAGIC 0x175\r
+#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC)\r
+\r
+\r
+#define FILHDR struct external_filehdr\r
+#define FILHSZ sizeof(FILHDR)\r
+\r
+\r
+/********************** AOUT "OPTIONAL HEADER" **********************/\r
+\r
+\r
+typedef struct \r
+{\r
+ unsigned short magic; /* type of file */\r
+ unsigned short vstamp; /* version stamp */\r
+ unsigned long tsize; /* text size in bytes, padded to FW bdry*/\r
+ unsigned long dsize; /* initialized data " " */\r
+ unsigned long bsize; /* uninitialized data " " */\r
+ unsigned long entry; /* entry pt. */\r
+ unsigned long text_start; /* base of text used for this file */\r
+ unsigned long data_start; /* base of data used for this file */\r
+}\r
+AOUTHDR;\r
+\r
+\r
+typedef struct gnu_aout {\r
+ unsigned long info;\r
+ unsigned long tsize;\r
+ unsigned long dsize;\r
+ unsigned long bsize;\r
+ unsigned long symsize;\r
+ unsigned long entry;\r
+ unsigned long txrel;\r
+ unsigned long dtrel;\r
+ } GNU_AOUT;\r
+\r
+#define AOUTSZ (sizeof(AOUTHDR))\r
+\r
+#define OMAGIC 0404 /* object files, eg as output */\r
+#define ZMAGIC 0413 /* demand load format, eg normal ld output */\r
+#define STMAGIC 0401 /* target shlib */\r
+#define SHMAGIC 0443 /* host shlib */\r
+\r
+\r
+/********************** SECTION HEADER **********************/\r
+\r
+\r
+struct external_scnhdr {\r
+ char s_name[8]; /* section name */\r
+ unsigned long s_paddr; /* physical address, aliased s_nlib */\r
+ unsigned long s_vaddr; /* virtual address */\r
+ unsigned long s_size; /* section size */\r
+ unsigned long s_scnptr; /* file ptr to raw data for section */\r
+ unsigned long s_relptr; /* file ptr to relocation */\r
+ unsigned long s_lnnoptr; /* file ptr to line numbers */\r
+ unsigned short s_nreloc; /* number of relocation entries */\r
+ unsigned short s_nlnno; /* number of line number entries*/\r
+ unsigned long s_flags; /* flags */\r
+};\r
+\r
+#define SCNHDR struct external_scnhdr\r
+#define SCNHSZ sizeof(SCNHDR)\r
+\r
+/*\r
+ * names of "special" sections\r
+ */\r
+#define _TEXT ".text"\r
+#define _DATA ".data"\r
+#define _BSS ".bss"\r
+#define _COMMENT ".comment"\r
+#define _LIB ".lib"\r
+\r
+/*\r
+ * s_flags "type"\r
+ */\r
+#define STYP_TEXT (0x0020) /* section contains text only */\r
+#define STYP_DATA (0x0040) /* section contains data only */\r
+#define STYP_BSS (0x0080) /* section contains bss only */\r
+\r
+/********************** LINE NUMBERS **********************/\r
+\r
+/* 1 line number entry for every "breakpointable" source line in a section.\r
+ * Line numbers are grouped on a per function basis; first entry in a function\r
+ * grouping will have l_lnno = 0 and in place of physical address will be the\r
+ * symbol table index of the function name.\r
+ */\r
+struct external_lineno {\r
+ union {\r
+ unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */\r
+ unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */\r
+ } l_addr;\r
+ unsigned short l_lnno; /* line number */\r
+};\r
+\r
+\r
+#define LINENO struct external_lineno\r
+#define LINESZ sizeof(LINENO)\r
+\r
+\r
+/********************** SYMBOLS **********************/\r
+\r
+#define E_SYMNMLEN 8 /* # characters in a symbol name */\r
+#define E_FILNMLEN 14 /* # characters in a file name */\r
+#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */\r
+\r
+struct external_syment \r
+{\r
+ union {\r
+ char e_name[E_SYMNMLEN];\r
+ struct {\r
+ unsigned long e_zeroes __attribute__((packed));\r
+ unsigned long e_offset __attribute__((packed));\r
+ } e;\r
+ } e;\r
+ unsigned long e_value __attribute__((packed));\r
+ short e_scnum;\r
+ unsigned short e_type;\r
+ unsigned char e_sclass;\r
+ unsigned char e_numaux;\r
+};\r
+\r
+#define N_BTMASK (0xf)\r
+#define N_TMASK (0x30)\r
+#define N_BTSHFT (4)\r
+#define N_TSHIFT (2)\r
+ \r
+union external_auxent {\r
+ struct {\r
+ unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */\r
+ union {\r
+ struct {\r
+ unsigned short x_lnno; /* declaration line number */\r
+ unsigned short x_size; /* str/union/array size */\r
+ } x_lnsz;\r
+ unsigned long x_fsize __attribute__((packed)); /* size of function */\r
+ } x_misc;\r
+ union {\r
+ struct { /* if ISFCN, tag, or .bb */\r
+ unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */\r
+ unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */\r
+ } x_fcn;\r
+ struct { /* if ISARY, up to 4 dimen. */\r
+ unsigned short x_dimen[E_DIMNUM];\r
+ } x_ary;\r
+ } x_fcnary;\r
+ unsigned short x_tvndx; /* tv index */\r
+ } x_sym;\r
+\r
+ union {\r
+ char x_fname[E_FILNMLEN];\r
+ struct {\r
+ unsigned long x_zeroes __attribute__((packed));\r
+ unsigned long x_offset __attribute__((packed));\r
+ } x_n;\r
+ } x_file;\r
+\r
+ struct {\r
+ unsigned long x_scnlen __attribute__((packed)); /* section length */\r
+ unsigned short x_nreloc; /* # relocation entries */\r
+ unsigned short x_nlinno; /* # line numbers */\r
+ } x_scn;\r
+\r
+ struct {\r
+ unsigned long x_tvfill __attribute__((packed)); /* tv fill value */\r
+ unsigned short x_tvlen; /* length of .tv */\r
+ unsigned short x_tvran[2]; /* tv range */\r
+ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */\r
+\r
+\r
+};\r
+\r
+#define SYMENT struct external_syment\r
+#define SYMESZ sizeof(SYMENT)\r
+#define AUXENT union external_auxent\r
+#define AUXESZ sizeof(AUXENT)\r
+\r
+\r
+# define _ETEXT "etext"\r
+\r
+\r
+/* Relocatable symbols have number of the section in which they are defined,\r
+ or one of the following: */\r
+\r
+#define N_UNDEF ((short)0) /* undefined symbol */\r
+#define N_ABS ((short)-1) /* value of symbol is absolute */\r
+#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */\r
+#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */\r
+#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/\r
+\r
+/*\r
+ * Type of a symbol, in low N bits of the word\r
+ */\r
+#define T_NULL 0\r
+#define T_VOID 1 /* function argument (only used by compiler) */\r
+#define T_CHAR 2 /* character */\r
+#define T_SHORT 3 /* short integer */\r
+#define T_INT 4 /* integer */\r
+#define T_LONG 5 /* long integer */\r
+#define T_FLOAT 6 /* floating point */\r
+#define T_DOUBLE 7 /* double word */\r
+#define T_STRUCT 8 /* structure */\r
+#define T_UNION 9 /* union */\r
+#define T_ENUM 10 /* enumeration */\r
+#define T_MOE 11 /* member of enumeration*/\r
+#define T_UCHAR 12 /* unsigned character */\r
+#define T_USHORT 13 /* unsigned short */\r
+#define T_UINT 14 /* unsigned integer */\r
+#define T_ULONG 15 /* unsigned long */\r
+#define T_LNGDBL 16 /* long double */\r
+\r
+/*\r
+ * derived types, in n_type\r
+*/\r
+#define DT_NON (0) /* no derived type */\r
+#define DT_PTR (1) /* pointer */\r
+#define DT_FCN (2) /* function */\r
+#define DT_ARY (3) /* array */\r
+\r
+#define BTYPE(x) ((x) & N_BTMASK)\r
+\r
+#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))\r
+#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))\r
+#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))\r
+#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)\r
+#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))\r
+\r
+/********************** STORAGE CLASSES **********************/\r
+\r
+/* This used to be defined as -1, but now n_sclass is unsigned. */\r
+#define C_EFCN 0xff /* physical end of function */\r
+#define C_NULL 0\r
+#define C_AUTO 1 /* automatic variable */\r
+#define C_EXT 2 /* external symbol */\r
+#define C_STAT 3 /* static */\r
+#define C_REG 4 /* register variable */\r
+#define C_EXTDEF 5 /* external definition */\r
+#define C_LABEL 6 /* label */\r
+#define C_ULABEL 7 /* undefined label */\r
+#define C_MOS 8 /* member of structure */\r
+#define C_ARG 9 /* function argument */\r
+#define C_STRTAG 10 /* structure tag */\r
+#define C_MOU 11 /* member of union */\r
+#define C_UNTAG 12 /* union tag */\r
+#define C_TPDEF 13 /* type definition */\r
+#define C_USTATIC 14 /* undefined static */\r
+#define C_ENTAG 15 /* enumeration tag */\r
+#define C_MOE 16 /* member of enumeration */\r
+#define C_REGPARM 17 /* register parameter */\r
+#define C_FIELD 18 /* bit field */\r
+#define C_AUTOARG 19 /* auto argument */\r
+#define C_LASTENT 20 /* dummy entry (end of block) */\r
+#define C_BLOCK 100 /* ".bb" or ".eb" */\r
+#define C_FCN 101 /* ".bf" or ".ef" */\r
+#define C_EOS 102 /* end of structure */\r
+#define C_FILE 103 /* file name */\r
+#define C_LINE 104 /* line # reformatted as symbol table entry */\r
+#define C_ALIAS 105 /* duplicate tag */\r
+#define C_HIDDEN 106 /* ext symbol in dmert public lib */\r
+\r
+/********************** RELOCATION DIRECTIVES **********************/\r
+\r
+\r
+\r
+struct external_reloc {\r
+ unsigned long r_vaddr __attribute__((packed));\r
+ unsigned long r_symndx __attribute__((packed));\r
+ unsigned short r_type;\r
+};\r
+\r
+\r
+#define RELOC struct external_reloc\r
+#define RELSZ sizeof(RELOC)\r
+\r
+#define RELOC_REL32 20 /* 32-bit PC-relative address */\r
+#define RELOC_ADDR32 6 /* 32-bit absolute address */\r
+\r
+#define DEFAULT_DATA_SECTION_ALIGNMENT 4\r
+#define DEFAULT_BSS_SECTION_ALIGNMENT 4\r
+#define DEFAULT_TEXT_SECTION_ALIGNMENT 4\r
+/* For new sections we havn't heard of before */\r
+#define DEFAULT_SECTION_ALIGNMENT 4\r
+\r
+//#endif /* !_POSIX_SOURCE */\r
+//#endif /* !__STRICT_ANSI__ */\r
+//#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */\r
+\r
+#ifndef __dj_ENFORCE_FUNCTION_CALLS\r
+#endif /* !__dj_ENFORCE_FUNCTION_CALLS */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* !__dj_include_coff_h_ */\r
--- /dev/null
+
+// 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;
+
--- /dev/null
+/* GENERAL DEFINITIONS ****************************************************/\r
+\r
+#include <internal/hal/irq.h>\r
+\r
+\r
+\r
+/*\r
+ * PURPOSE: Number of a thread priority levels\r
+ */\r
+#define NR_PRIORITY_LEVELS (32)\r
+\r
+/*\r
+ * PURPOSE: Type of queue to insert a work item in\r
+ */\r
+enum\r
+{\r
+ CriticalWorkQueue,\r
+ DelayedWorkQueue,\r
+ HyperCriticalWorkQueue,\r
+};\r
+\r
+/*\r
+ * Types of memory to allocate\r
+ */\r
+enum\r
+{\r
+ NonPagedPool,\r
+ NonPagedPoolMustSucceed,\r
+ NonPagedPoolCacheAligned,\r
+ NonPagedPoolCacheAlignedMustS,\r
+ PagedPool,\r
+ PagedPoolCacheAligned,\r
+};\r
+\r
+/*\r
+ * PURPOSE: Irp flags\r
+ */\r
+enum\r
+{\r
+ /*\r
+ * Read any data from the actual backing media\r
+ */\r
+ IRP_NOCACHE,\r
+ \r
+ /*\r
+ * The I/O operation is performing paging\r
+ */\r
+ IRP_PAGING_IO,\r
+ \r
+ /*\r
+ * The IRP is for a mount operation\r
+ */\r
+ IRP_MOUNT_COMPLETION,\r
+ \r
+ /*\r
+ * The API expects synchronous behaviour\r
+ */\r
+ IRP_SYNCHRONOUS_API,\r
+ \r
+ /*\r
+ * The IRP is associated with a larger operation\r
+ */\r
+ IRP_ASSOCIATED_IRP,\r
+ \r
+ /*\r
+ * The AssociatedIrp.SystemBuffer field is valid\r
+ */\r
+ IRP_BUFFERED_IO,\r
+ \r
+ /*\r
+ * The system buffer was allocated from pool and should be deallocated \r
+ * by the I/O manager\r
+ */\r
+ IRP_DEALLOCATE_BUFFER,\r
+ \r
+ /*\r
+ * The IRP is for an input operation\r
+ */\r
+ IRP_INPUT_OPERATION,\r
+ \r
+ /*\r
+ * The paging operation should complete synchronously \r
+ */\r
+ IRP_SYNCHRONOUS_PAGING_IO,\r
+ \r
+ /*\r
+ * The IRP represents a filesystem create operation\r
+ */\r
+ IRP_CREATE_OPERATION,\r
+ \r
+ /*\r
+ * The IRP represents a filesystem read operation\r
+ */\r
+ IRP_READ_OPERATION,\r
+ \r
+ /*\r
+ * The IRP represents a filesystem write operation\r
+ */\r
+ IRP_WRITE_OPERATION,\r
+ \r
+ /*\r
+ * The IRP represents a filesystem close operation\r
+ */\r
+ IRP_CLOSE_OPERATION,\r
+ \r
+ /*\r
+ * Asynchronous behavior is advised but not required\r
+ */\r
+ IRP_DEFER_IO_COMPLETION,\r
+};\r
+\r
+/*\r
+ * I/O operation flags\r
+ */\r
+enum\r
+{\r
+ /*\r
+ * Force an access check even if opened in kernel mode\r
+ */\r
+ SL_FORCE_ACCESS_CHECK,\r
+ \r
+ /*\r
+ * The file being opened is a paging file\r
+ */\r
+ SL_OPEN_PAGING_FILE,\r
+ \r
+ SL_OPEN_TARGET_DIRECTORY,\r
+ \r
+ SL_CASE_SENSITIVE,\r
+ \r
+ SL_KEY_SPECIFIED,\r
+ \r
+ SL_OVERRIDE_VERIFY_VOLUME,\r
+ \r
+ SL_WRITE_THROUGH,\r
+ \r
+ SL_FT_SEQUENTIAL_WRITE,\r
+ \r
+ SL_FAIL_IMMEDIATELY,\r
+ \r
+ SL_EXCLUSIVE_LOCK,\r
+ \r
+ SL_RESTART_SCAN,\r
+ \r
+ SL_RETURN_SINGLE_ENTRY,\r
+ \r
+ SL_INDEX_SPECIFIED,\r
+ \r
+ SL_WATCH_TREE,\r
+ \r
+ SL_ALLOW_RAW_MOUNT, \r
+};\r
+\r
+/*\r
+ * Possible flags for the device object flags\r
+ */\r
+enum\r
+{\r
+ DO_BUFFERED_IO = 0x1,\r
+ DO_DIRECT_IO = 0x2,\r
+};\r
+\r
+/*\r
+ * Possible status codes\r
+ * FIXME: These may not be the actual values used by NT\r
+ */\r
+enum\r
+{\r
+ STATUS_SUCCESS,\r
+ STATUS_INSUFFICIENT_RESOURCES,\r
+ STATUS_OBJECT_NAME_EXISTS,\r
+ STATUS_OBJECT_NAME_COLLISION,\r
+// STATUS_DATATYPE_MISALIGNMENT,\r
+ STATUS_CTL_FILE_NOT_SUPPORTED,\r
+// STATUS_ACCESS_VIOLATION,\r
+ STATUS_PORT_ALREADY_SET,\r
+ STATUS_SECTION_NOT_IMAGE,\r
+ STATUS_BAD_WORKING_SET_LIMIT,\r
+ STATUS_INCOMPATIBLE_FILE_MAP,\r
+ STATUS_HANDLE_NOT_WAITABLE,\r
+ STATUS_PORT_DISCONNECTED,\r
+ STATUS_NOT_LOCKED,\r
+ STATUS_NOT_MAPPED_VIEW,\r
+ STATUS_UNABLE_TO_FREE_VM,\r
+ STATUS_UNABLE_TO_DELETE_SECTION,\r
+ STATUS_MORE_PROCESSING_REQUIRED,\r
+ STATUS_INVALID_CID,\r
+ STATUS_BAD_INITIAL_STACK,\r
+ STATUS_INVALID_VOLUME_LABEL,\r
+ STATUS_SECTION_NOT_EXTENDED,\r
+ STATUS_NOT_MAPPED_DATA,\r
+ STATUS_INFO_LENGTH_MISMATCH,\r
+ STATUS_INVALID_INFO_CLASS,\r
+ STATUS_SUSPEND_COUNT_EXCEEDED,\r
+ STATUS_NOTIFY_ENUM_DIR,\r
+ STATUS_REGISTRY_RECOVERED,\r
+ STATUS_REGISTRY_IO_FAILED,\r
+ STATUS_KEY_DELETED,\r
+ STATUS_NO_LOG_SPACE,\r
+ STATUS_KEY_HAS_CHILDREN,\r
+ STATUS_CHILD_MUST_BE_VOLATILE,\r
+ STATUS_REGISTRY_CORRUPT,\r
+ STATUS_DLL_NOT_FOUND,\r
+ STATUS_DLL_INIT_FAILED,\r
+ STATUS_ORDINAL_NOT_FOUND,\r
+ STATUS_ENTRYPOINT_NOT_FOUND,\r
+// STATUS_PENDING,\r
+ STATUS_MORE_ENTRIES,\r
+// STATUS_INTEGER_OVERFLOW,\r
+ STATUS_BUFFER_OVERFLOW,\r
+ STATUS_NO_MORE_FILES,\r
+ STATUS_NO_INHERITANCE,\r
+ STATUS_NO_MORE_EAS,\r
+ STATUS_NO_MORE_ENTRIES,\r
+ STATUS_GUIDS_EXHAUSTED,\r
+ STATUS_AGENTS_EXHAUSTED,\r
+ STATUS_UNSUCCESSFUL,\r
+ STATUS_NOT_IMPLEMENTED,\r
+ STATUS_ILLEGAL_FUNCTION,\r
+// STATUS_IN_PAGE_ERROR,\r
+ STATUS_PAGEFILE_QUOTA,\r
+ STATUS_COMMITMENT_LIMIT,\r
+ STATUS_SECTION_TOO_BIG,\r
+ RPC_NT_SS_IN_NULL_CONTEXT,\r
+ RPC_NT_INVALID_BINDING,\r
+// STATUS_INVALID_HANDLE,\r
+ STATUS_OBJECT_FILE_MISMATCH,\r
+ STATUS_FILE_CLOSED,\r
+ STATUS_INVALID_PORT_HANDLE,\r
+ STATUS_NOT_COMMITTED,\r
+ STATUS_INVALID_PARAMETER,\r
+ STATUS_INVALID_PARAMETER_1,\r
+ STATUS_INVALID_PARAMETER_2,\r
+ STATUS_INVALID_PARAMETER_3,\r
+ STATUS_INVALID_PARAMETER_4,\r
+ STATUS_INVALID_PARAMETER_5,\r
+ STATUS_INVALID_PARAMETER_6,\r
+ STATUS_INVALID_PARAMETER_7,\r
+ STATUS_INVALID_PARAMETER_8,\r
+ STATUS_INVALID_PARAMETER_9,\r
+ STATUS_INVALID_PARAMETER_10,\r
+ STATUS_INVALID_PARAMETER_11,\r
+ STATUS_INVALID_PARAMETER_12,\r
+ STATUS_INVALID_PARAMETER_MAX,\r
+ STATUS_INVALID_PAGE_PROTECTION,\r
+ STATUS_RESOURCE_DATA_NOT_FOUND,\r
+ STATUS_RESOURCE_TYPE_NOT_FOUND,\r
+ STATUS_RESOURCE_NAME_NOT_FOUND,\r
+ STATUS_RESOURCE_LANG_NOT_FOUND,\r
+ STATUS_NO_SUCH_DEVICE,\r
+ STATUS_NO_SUCH_FILE,\r
+ STATUS_INVALID_DEVICE_REQUEST,\r
+ STATUS_END_OF_FILE,\r
+ STATUS_FILE_FORCED_CLOSED,\r
+ STATUS_WRONG_VOLUME,\r
+ STATUS_NO_MEDIA,\r
+ STATUS_NO_MEDIA_IN_DEVICE,\r
+ STATUS_NONEXISTENT_SECTOR,\r
+ STATUS_WORKING_SET_QUOTA,\r
+// STATUS_NO_MEMORY,\r
+ STATUS_CONFLICTING_ADDRESS,\r
+ STATUS_INVALID_SYSTEM_SERVICE,\r
+ STATUS_THREAD_IS_TERMINATING,\r
+ STATUS_PROCESS_IS_TERMINATING,\r
+ STATUS_INVALID_LOCK_SEQUENCE,\r
+ STATUS_INVALID_VIEW_SIZE,\r
+ STATUS_ALREADY_COMMITTED,\r
+ STATUS_ACCESS_DENIED,\r
+ STATUS_FILE_IS_A_DIRECTORY,\r
+ STATUS_CANNOT_DELETE,\r
+ STATUS_INVALID_COMPUTER_NAME,\r
+ STATUS_FILE_DELETED,\r
+ STATUS_DELETE_PENDING,\r
+ STATUS_PORT_CONNECTION_REFUSED,\r
+ STATUS_NO_SUCH_PRIVILEGE,\r
+ STATUS_PRIVILEGE_NOT_HELD,\r
+ STATUS_CANNOT_IMPERSONATE,\r
+ STATUS_LOGON_FAILURE,\r
+ STATUS_ACCOUNT_RESTRICTION,\r
+ STATUS_INVALID_LOGON_HOURS,\r
+ STATUS_INVALID_WORKSTATION,\r
+ STATUS_BUFFER_TOO_SMALL,\r
+ STATUS_UNABLE_TO_DECOMMIT_VM,\r
+ STATUS_DISK_CORRUPT_ERROR,\r
+ STATUS_OBJECT_NAME_INVALID,\r
+ STATUS_OBJECT_NAME_NOT_FOUND,\r
+// STATUS_OBJECT_NAME_COLLISION,\r
+ STATUS_OBJECT_PATH_INVALID,\r
+ STATUS_OBJECT_PATH_NOT_FOUND,\r
+ STATUS_DFS_EXIT_PATH_FOUND,\r
+ STATUS_OBJECT_PATH_SYNTAX_BAD,\r
+ STATUS_DATA_OVERRUN,\r
+ STATUS_DATA_LATE_ERROR,\r
+ STATUS_DATA_ERROR,\r
+ STATUS_CRC_ERROR,\r
+ STATUS_SHARING_VIOLATION,\r
+ STATUS_QUOTA_EXCEEDED,\r
+ STATUS_MUTANT_NOT_OWNED,\r
+ STATUS_SEMAPHORE_LIMIT_EXCEEDED,\r
+ STATUS_DISK_FULL,\r
+ STATUS_LOCK_NOT_GRANTED,\r
+};\r
+\r
+/*\r
+ * Possible device types\r
+ */\r
+enum\r
+{\r
+ /*\r
+ * Standard define types\r
+ */\r
+ FILE_DEVICE_BEEP,\r
+ FILE_DEVICE_CDROM,\r
+ FILE_DEVICE_CONTROLLER,\r
+ FILE_DEVICE_DISK,\r
+ FILE_DEVICE_INPORT_PORT,\r
+ FILE_DEVICE_KEYBOARD,\r
+ FILE_DEVICE_MIDI_IN,\r
+ FILE_DEVICE_MIDI_OUT,\r
+ FILE_DEVICE_MOUSE,\r
+ FILE_DEVICE_NULL,\r
+ FILE_DEVICE_PARALLEL_PORT,\r
+ FILE_DEVICE_PRINTER,\r
+ FILE_DEVICE_SCANNER,\r
+ FILE_DEVICE_SERIAL_MOUSE_PORT,\r
+ FILE_DEVICE_SERIAL_PORT,\r
+ FILE_DEVICE_SCREEN,\r
+ FILE_DEVICE_TAPE,\r
+ FILE_DEVICE_UNKNOWN,\r
+ FILE_DEVICE_VIDEO,\r
+ FILE_DEVICE_VIRTUAL_DISK,\r
+ FILE_DEVICE_WAVE_IN,\r
+ FILE_DEVICE_WAVE_OUT,\r
+ FILE_DEVICE_8042_PORT,\r
+ \r
+ /*\r
+ * Values beyond this are reserved for ISVs\r
+ */\r
+ FILE_DEVICE_FIRST_FREE = 32768\r
+};\r
+\r
+\r
+\r
+/*\r
+ * Possible device characteristics\r
+ */\r
+enum\r
+{\r
+ FILE_REMOVABLE_MEDIA = 0x1,\r
+ FILE_READ_ONLY_DEVICE = 0x2,\r
+ FILE_FLOPPY_DISKETTE = 0x4,\r
+ FILE_WRITE_ONCE_MEDIA = 0x8,\r
+ FILE_REMOTE_DEVICE = 0x10,\r
+};\r
+\r
+/*\r
+ * PURPOSE: Bus types\r
+ */\r
+enum\r
+{\r
+ Internal,\r
+ Isa,\r
+ MicroChannel,\r
+ TurboChannel,\r
+ PCIBus,\r
+ MaximumInterfaceType,\r
+};\r
+ \r
+/*\r
+ * This is a list of bug check types (not MS's)\r
+ */\r
+enum\r
+{\r
+ KBUG_NONE,\r
+ KBUG_ORPHANED_IRP,\r
+ KBUG_IO_STACK_OVERFLOW,\r
+ KBUG_OUT_OF_MEMORY,\r
+ KBUG_POOL_FREE_LIST_CORRUPT,\r
+ \r
+ /*\r
+ * These are well known but the actual value is unknown\r
+ */\r
+ NO_PAGES_AVAILABLE,\r
+ \r
+ /*\r
+ * These are well known (MS) bug types\r
+ * (Reference: NT Insider 1997 - http://www.osr.com)\r
+ */\r
+ IRQL_NOT_LESS_OR_EQUAL = 0xa,\r
+ KMODE_EXCEPTION_NOT_HANDLED = 0x1e,\r
+ UNEXPECTED_KERNEL_MODE_TRAP = 0x7f,\r
+ PAGE_FAULT_IN_NON_PAGED_AREA = 0x50,\r
+};\r
+\r
+/*\r
+ * PURPOSE: Object attributes\r
+ */\r
+enum\r
+{\r
+ OBJ_INHERIT = 0x1,\r
+ OBJ_PERMANENT = 0x2,\r
+ OBJ_EXCLUSIVE = 0x4,\r
+ OBJ_CASE_INSENSITIVE = 0x8,\r
+ OBJ_OPENIF = 0x10,\r
+};\r
+\r
+/*\r
+ * PURPOSE: DPC priorities\r
+ */\r
+enum\r
+{\r
+ High,\r
+ Medium,\r
+ Low,\r
+};\r
+\r
+/*\r
+ * PURPOSE: Timer types\r
+ */\r
+enum\r
+ {\r
+ NotificationTimer,\r
+ SynchronizationTimer, \r
+ };\r
+ \r
+/*\r
+ * PURPOSE: Some drivers use these\r
+ */\r
+#define IN\r
+#define OUT\r
+#define OPTIONAL\r
+\r
+/*\r
+ * PURPOSE: Power IRP minor function numbers\r
+ */\r
+enum\r
+{\r
+ IRP_MN_QUERY_POWER,\r
+ IRP_MN_SET_POWER,\r
+ IRP_MN_WAIT_WAKE,\r
+ IRP_MN_QUERY_CAPABILITIES,\r
+ IRP_MN_POWER_SEQUENCE,\r
+};\r
+\r
+/*\r
+ * FIXME: These are not in the correct order\r
+ */\r
+enum\r
+{ \r
+ IRP_MJ_CREATE,\r
+ IRP_MJ_CREATE_NAMED_PIPE,\r
+ IRP_MJ_CLOSE,\r
+ IRP_MJ_READ,\r
+ IRP_MJ_WRITE,\r
+ IRP_MJ_QUERY_INFORMATION,\r
+ IRP_MJ_SET_INFORMATION,\r
+ IRP_MJ_QUERY_EA,\r
+ IRP_MJ_SET_EA,\r
+ IRP_MJ_FLUSH_BUFFERS,\r
+ IRP_MJ_QUERY_VOLUME_INFORMATION,\r
+ IRP_MJ_SET_VOLUME_INFORMATION,\r
+ IRP_MJ_DIRECTORY_CONTROL,\r
+ IRP_MJ_FILE_SYSTEM_CONTROL, \r
+ IRP_MJ_DEVICE_CONTROL,\r
+ IRP_MJ_INTERNAL_DEVICE_CONTROL,\r
+ IRP_MJ_SHUTDOWN,\r
+ IRP_MJ_LOCK_CONTROL,\r
+ IRP_MJ_CLEANUP,\r
+ IRP_MJ_CREATE_MAILSLOT,\r
+ IRP_MJ_QUERY_SECURITY,\r
+ IRP_MJ_SET_SECURITY,\r
+ IRP_MJ_QUERY_POWER,\r
+ IRP_MJ_SET_POWER,\r
+ IRP_MJ_DEVICE_CHANGE,\r
+ IRP_MJ_QUERY_QUOTA,\r
+ IRP_MJ_SET_QUOTA,\r
+ IRP_MJ_PNP_POWER,\r
+ IRP_MJ_MAXIMUM_FUNCTION,\r
+};\r
+\r
+/*\r
+ * PURPOSE: Used all over\r
+ */\r
+enum\r
+{\r
+ KernelMode,\r
+ UserMode,\r
+};\r
+ \r
+/*\r
+ * PURPOSE: Arguments to MmProbeAndLockPages\r
+ */\r
+enum\r
+{\r
+ IoReadAccess,\r
+ IoWriteAccess,\r
+ IoModifyAccess,\r
+};\r
+\r
+#define MAXIMUM_VOLUME_LABEL_LENGTH (32)\r
+\r
+/*\r
+ * IRQ levels\r
+ */\r
+enum\r
+{\r
+ PASSIVE_LEVEL,\r
+ \r
+ /*\r
+ * Which order for these (only DISPATCH_LEVEL is important for now)\r
+ */\r
+ APC_LEVEL,\r
+ DISPATCH_LEVEL,\r
+ \r
+ /*\r
+ * Above here are device specific IRQ levels\r
+ */\r
+ FIRST_DEVICE_SPECIFIC_LEVEL,\r
+ HIGH_LEVEL = FIRST_DEVICE_SPECIFIC_LEVEL + NR_DEVICE_SPECIFIC_LEVELS,\r
+};\r
+ \r
--- /dev/null
+/* EXECUTIVE ROUTINES ******************************************************/
+
+//VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex);
+
+
+/*
+ * FUNCTION: Releases previously allocated memory
+ * ARGUMENTS:
+ * block = block to free
+ */
+VOID ExFreePool(PVOID block);
+
+/*
+ * 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);
+
+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);
+
--- /dev/null
+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;
--- /dev/null
+/* 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);
+
+PEPROCESS 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 _DRIVER_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);
--- /dev/null
+/*
+ *
+ */
+
+#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 *************************************************************/
+
+typedef ULONG INTERFACE_TYPE;
+typedef INTERFACE_TYPE* PINTERFACE_TYPE;
+typedef ULONG CONFIGURATION_TYPE;
+typedef CONFIGURATION_TYPE* PCONFIGURATION_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 ***********************************************************/
+
+/*
+ * PURPOSE: Special timer associated with each device
+ */
+typedef struct _IO_TIMER
+{
+} 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;
+ BOOLEAN InvokeOnSuccess;
+ BOOLEAN InvokeOnError;
+ BOOLEAN InvokeOnCancel;
+
+ /*
+ * 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 _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;
+// PETHREAD Thread;
+ PVOID Thread;
+ PCHAR AuxiliaryBuffer;
+ LIST_ENTRY ListEntry;
+ struct _IO_STACK_LOCATION* CurrentStackLocation;
+// PFILE_OBJECT OriginalFileObject;
+ PVOID 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 NTSTATUS (*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 _FILE_OBJECT
+{
+ PDEVICE_OBJECT DeviceObject;
+ PVOID FsContext;
+} FILE_OBJECT, *PFILE_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 PKEY_VALUE_FULL_INFORMATION_DEFINED
+typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
+ PUNICODE_STRING PathName,
+ INTERFACE_TYPE BusType,
+ ULONG BusNumber,
+ PKEY_VALUE_FULL_INFORMATION* BusKey,
+ CONFIGURATION_TYPE ControllerType,
+ ULONG ControllerNumber,
+ PKEY_VALUE_FULL_INFORMATION* CtrlKey,
+ CONFIGURATION_TYPE PeripheralType,
+ ULONG PeripheralNumber,
+ PKEY_VALUE_FULL_INFORMATION* PrphKey);
+#endif
+
+#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;
+
+#endif __INCLUDE_DDK_IOTYPES_H
--- /dev/null
+/* KERNEL FUNCTIONS ********************************************************/
+
+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);
+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);
--- /dev/null
+typedef LONG KPRIORITY;
+
+typedef VOID (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
+typedef BOOLEAN (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext);
+
+typedef struct
+{
+} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
+
+typedef struct
+{
+} KMUTEX, *PKMUTEX;
+
+typedef struct
+{
+} KSEMAPHORE, *PKSEMAPHORE;
+
+typedef struct
+{
+} KTHREAD, *PKTHREAD;
+
+
+/*
+ * PURPOSE: Included in every object that a thread can wait on
+ */
+typedef struct
+{
+ /*
+ * PURPOSE: True if the object is signaling a change of state
+ */
+ BOOLEAN signaled;
+
+ /*
+ * PURPOSE: Head of the queue of threads waiting on this object
+ */
+ LIST_ENTRY wait_queue_head;
+
+ /*
+ * PURPOSE: True if all the threads waiting should be woken when the
+ * object changes state
+ */
+ BOOLEAN wake_all;
+
+} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
+
+
+/*
+ * PURPOSE: Describes an event
+ */
+typedef struct _KEVENT
+{
+ /*
+ * PURPOSE: So we can use the general wait routine
+ */
+ DISPATCHER_HEADER hdr;
+
+ /*
+ * PURPOSE: Type of event, notification or synchronization
+ */
+ EVENT_TYPE type;
+} KEVENT, *PKEVENT;
+
+
+typedef struct _KSPIN_LOCK
+{
+ KIRQL irql;
+} KSPIN_LOCK, *PKSPIN_LOCK;
+
+typedef struct
+{
+} KAPC;
+
+typedef struct
+{
+} UNICODE_STRING;
+
+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
+{
+ LIST_ENTRY ListHead;
+ BOOLEAN Busy;
+ KSPIN_LOCK Lock;
+} KDEVICE_QUEUE, *PKDEVICE_QUEUE;
+
+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;
--- /dev/null
+/* MEMORY MANAGMENT ******************************************************/
+
+/*
+ * 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
+ */
+#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(Va, Size)
+
+/*
+ * 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 MmInitalizeMdl(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);
--- /dev/null
+typedef struct _MDL
+/*
+ * PURPOSE: Describes a user buffer passed to a system API
+ */
+{
+ /*
+ * Base address of the buffer in user mode
+ */
+ PVOID Base;
+
+ /*
+ * Length of the buffer in bytes
+ */
+ ULONG Length;
+
+ /*
+ * System address of buffer or NULL if not mapped
+ */
+ PVOID SysBase;
+
+ /*
+ * Below this is a variable length list of page physical address
+ */
+} MDL, *PMDL;
--- /dev/null
+/*\r
+ * COPYRIGHT: See COPYING in the top level directory\r
+ * PROJECT: ReactOS kernel\r
+ * FILE: include/ddk/ntddk.h\r
+ * PURPOSE: Interface definitions for drivers\r
+ * PROGRAMMER: David Welch (welch@mcmail.com)\r
+ * UPDATE HISTORY:\r
+ * 15/05/98: Created\r
+ */\r
+\r
+#ifndef __NTDDK_H\r
+#define __NTDDK_H\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+/* INCLUDES ***************************************************************/\r
+\r
+#include <windows.h>\r
+#include <internal/hal/page.h>\r
+\r
+#include <ddk/defines.h>\r
+#include <ddk/types.h>\r
+#include <ddk/structs.h>\r
+#include <internal/hal/ddk.h>\r
+#include <ddk/rtl.h>\r
+#include <ddk/zw.h>\r
+#include <ddk/exfuncs.h>\r
+#include <ddk/mmfuncs.h>\r
+#include <ddk/kefuncs.h>\r
+#include <ddk/iofuncs.h> \r
+#include <ddk/psfuncs.h>\r
+ \r
+#ifdef __cplusplus\r
+};\r
+#endif\r
+\r
+#endif /* __NTDDK_H */\r
+\r
--- /dev/null
+/* 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);
--- /dev/null
+struct _DIRECTORY_OBJECT;
+
+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
+ */
+ LPCSTR 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
+ */
+ LPCSTR 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;
+
+ /*
+ * 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;
+
+ /*
+ * PURPOSE: Attributes of the object
+ */
+ ULONG Attributes;
+
+ //SECURITY_DESCRIPTOR SecurityDescriptor
+ //SecurityQualityOfService
+
+ struct _DIRECTORY_OBJECT* parent;
+ char* name;
+ char* path;
+
+} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
--- /dev/null
+
+
+typedef NTSTATUS (*PKSTART_ROUTINE)(PVOID StartContext);
+
+/*
+ * 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);
--- /dev/null
+#ifndef __INCLUDE_DDK_PSTYPES_H
+#define __INCLUDE_DDK_PSTYPES_H
+
+#include <kernel32/heap.h>
+
+typedef struct _CLIENT_ID
+{
+ HANDLE UniqueProcess;
+ HANDLE UniqueThread;
+} CLIENT_ID, *PCLIENT_ID;
+
+//typedef void* HEAP;
+typedef void* HANDLE_TABLE;
+typedef void* ATOMTABLE;
+
+typedef struct _pPebInfo {
+ LPWSTR lpCommandLine;
+ DWORD cb;
+ HANDLE hStdInput; //18
+ HANDLE hStdput;
+ 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;
+ DWORD nActiveStdHandle;
+ void *HeapIndex;
+ DWORD dwTlsBits[2]; // tls in use bits
+ WORD NumberOfProcessors;
+ WORD NtGlobalFlag;
+ DWORD dwCriticalSectionTime;
+ 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;
+
+typedef NT_PEB *PPEB;
+
+
+
+typedef struct _NT_TIB {
+ struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
+ PVOID StackBase;
+ PVOID StackLimit;
+ PVOID SubSystemTib;
+ union {
+ PVOID FiberData;
+ ULONG Version;
+ } s;
+ PVOID ArbitraryUserPointer;
+ struct _NT_TIB *Self;
+} NT_TIB, *PNT_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;
+
+
+typedef NT_TEB *PINITIAL_TEB;
+
+typedef struct _EPROCESS
+{
+} EPROCESS, *PEPROCESS;
+
+typedef struct _ETHREAD
+{
+} ETHREAD, *PETHREAD;
+
+#endif /* __INCLUDE_DDK_PSTYPES_H */
--- /dev/null
+/*
+ *
+ */
+
+#ifndef __DDK_RTL_H
+#define __DDK_RTL_H
+
+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 */
+
+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);
+
+
+#endif /* __DDK_RTL_H */
--- /dev/null
+/* SYSTEM STRUCTURES ******************************************************/\r
+\r
+#include <internal/hal/hal.h>\r
+#include <ddk/cfgtypes.h>\r
+#include <ddk/ketypes.h>\r
+#include <ddk/obtypes.h>\r
+#include <ddk/mmtypes.h>\r
+#include <ddk/iotypes.h>\r
+#include <ddk/extypes.h>\r
+#include <ddk/pstypes.h>\r
+\r
+/*\r
+ * PURPOSE: Thread object\r
+ */\r
+typedef struct \r
+{\r
+ CSHORT Type;\r
+ CSHORT Size;\r
+ \r
+ /*\r
+ * PURPOSE: Entry in the linked list of threads\r
+ */\r
+ LIST_ENTRY Entry;\r
+ \r
+ /*\r
+ * PURPOSE: Current state of the thread\r
+ */\r
+ ULONG State;\r
+ \r
+ /*\r
+ * PURPOSE: Priority modifier of the thread\r
+ */\r
+ ULONG Priority;\r
+ \r
+ /*\r
+ * PURPOSE: Pointer to our parent process\r
+ */\r
+// PEPROCESS Parent;\r
+ \r
+ /*\r
+ * PURPOSE: Handle of our parent process\r
+ */\r
+ HANDLE ParentHandle;\r
+ \r
+ /*\r
+ * PURPOSE: Not currently used \r
+ */\r
+ ULONG AffinityMask;\r
+ \r
+ /*\r
+ * PURPOSE: Saved thread context\r
+ */\r
+ hal_thread_state context;\r
+ \r
+} THREAD_OBJECT, *PTHREAD_OBJECT;\r
+\r
+\r
+\r
+/*\r
+ * PURPOSE: Object describing the wait a thread is currently performing\r
+ */\r
+typedef struct\r
+{\r
+ /*\r
+ * PURPOSE: Pointer to the waiting thread\r
+ */\r
+ PTHREAD_OBJECT thread;\r
+ \r
+ /*\r
+ * PURPOSE: Entry in the wait queue for the object being waited on\r
+ */\r
+ LIST_ENTRY Entry;\r
+ \r
+ /*\r
+ * PURPOSE: Pointer to the object being waited on\r
+ */\r
+ DISPATCHER_HEADER* wait_object;\r
+ \r
+} KWAIT_BLOCK, *PKWAIT_BLOCK;\r
+ \r
+typedef struct _ADAPTER_OBJECT\r
+{\r
+} ADAPTER_OBJECT, *PADAPTER_OBJECT;\r
+\r
+typedef struct _CONTROLLER_OBJECT\r
+{\r
+ PVOID ControllerExtension; \r
+} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;\r
+ \r
+typedef struct _STRING\r
+{\r
+ /*\r
+ * Length in bytes of the string stored in buffer\r
+ */\r
+ USHORT Length;\r
+ \r
+ /*\r
+ * Maximum length of the string \r
+ */\r
+ USHORT MaximumLength;\r
+ \r
+ /*\r
+ * String\r
+ */\r
+ PCHAR Buffer;\r
+} STRING, *PSTRING;\r
+\r
+typedef struct _ANSI_STRING\r
+{\r
+ /*\r
+ * Length in bytes of the string stored in buffer\r
+ */\r
+ USHORT Length;\r
+ \r
+ /*\r
+ * Maximum length of the string \r
+ */\r
+ USHORT MaximumLength;\r
+ \r
+ /*\r
+ * String\r
+ */\r
+ PCHAR Buffer;\r
+} ANSI_STRING, *PANSI_STRING;\r
+\r
+typedef struct _KTIMER\r
+{\r
+ /*\r
+ * Pointers to maintain the linked list of activated timers\r
+ */\r
+ LIST_ENTRY entry;\r
+ \r
+ /*\r
+ * Absolute expiration time in system time units\r
+ */\r
+ unsigned long long expire_time;\r
+\r
+ /*\r
+ * Optional dpc associated with the timer \r
+ */\r
+ PKDPC dpc;\r
+ \r
+ /*\r
+ * True if the timer is signaled\r
+ */\r
+ BOOLEAN signaled;\r
+ \r
+ /*\r
+ * True if the timer is in the system timer queue\r
+ */\r
+ BOOLEAN running;\r
+ \r
+ /*\r
+ * Type of the timer either Notification or Synchronization\r
+ */\r
+ TIMER_TYPE type;\r
+ \r
+ /*\r
+ * Period of the timer in milliseconds (zero if once-only)\r
+ */\r
+ ULONG period;\r
+ \r
+} KTIMER, *PKTIMER;\r
+\r
+\r
+\r
+\r
+typedef struct _IO_RESOURCE_DESCRIPTOR\r
+{\r
+ UCHAR Option;\r
+ UCHAR Type;\r
+ UCHAR SharedDisposition;\r
+ \r
+ /*\r
+ * Reserved for system use\r
+ */\r
+ UCHAR Spare1; \r
+ \r
+ USHORT Flags;\r
+ \r
+ /*\r
+ * Reserved for system use\r
+ */\r
+ UCHAR Spare2;\r
+ \r
+ union\r
+ {\r
+ struct\r
+ {\r
+ ULONG Length;\r
+ ULONG Alignment;\r
+ PHYSICAL_ADDRESS MinimumAddress;\r
+ PHYSICAL_ADDRESS MaximumAddress;\r
+ } Port;\r
+ struct\r
+ {\r
+ ULONG Length;\r
+ ULONG Alignment;\r
+ PHYSICAL_ADDRESS MinimumAddress;\r
+ PHYSICAL_ADDRESS MaximumAddress;\r
+ } Memory;\r
+ struct\r
+ { \r
+ ULONG MinimumVector;\r
+ ULONG MaximumVector;\r
+ } Interrupt;\r
+ struct\r
+ {\r
+ ULONG MinimumChannel;\r
+ ULONG MaximumChannel;\r
+ } Dma;\r
+ } u; \r
+} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;\r
+\r
+typedef struct _IO_RESOURCE_LIST\r
+{\r
+ USHORT Version;\r
+ USHORT Revision;\r
+ ULONG Count;\r
+ IO_RESOURCE_DESCRIPTOR Descriptors[1];\r
+} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;\r
+\r
+typedef struct _IO_RESOURCES_REQUIREMENTS_LIST\r
+{\r
+ /*\r
+ * List size in bytes\r
+ */\r
+ ULONG ListSize;\r
+ \r
+ /*\r
+ * System defined enum for the bus\r
+ */\r
+ INTERFACE_TYPE InterfaceType;\r
+ \r
+ ULONG BusNumber;\r
+ ULONG SlotNumber;\r
+ ULONG Reserved[3];\r
+ ULONG AlternativeLists;\r
+ IO_RESOURCE_LIST List[1]; \r
+} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;\r
+\r
+typedef struct\r
+{\r
+ UCHAR Type;\r
+ UCHAR ShareDisposition;\r
+ USHORT Flags;\r
+ union\r
+ {\r
+ struct\r
+ {\r
+ PHYSICAL_ADDRESS Start;\r
+ ULONG Length;\r
+ } Port;\r
+ struct\r
+ {\r
+ ULONG Level;\r
+ ULONG Vector;\r
+ ULONG Affinity;\r
+ } Interrupt;\r
+ struct\r
+ {\r
+ PHYSICAL_ADDRESS Start;\r
+ ULONG Length;\r
+ } Memory;\r
+ struct\r
+ {\r
+ ULONG Channel;\r
+ ULONG Port;\r
+ ULONG Reserved1;\r
+ } Dma;\r
+ struct\r
+ {\r
+ ULONG DataSize;\r
+ ULONG Reserved1;\r
+ ULONG Reserved2;\r
+ } DeviceSpecificData;\r
+ } u;\r
+} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;\r
+\r
+typedef struct\r
+{\r
+ USHORT Version;\r
+ USHORT Revision;\r
+ ULONG Count;\r
+ CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];\r
+} CM_PARTIAL_RESOURCE_LIST;\r
+\r
+typedef struct\r
+{\r
+ INTERFACE_TYPE InterfaceType;\r
+ ULONG BusNumber;\r
+ CM_PARTIAL_RESOURCE_LIST PartialResourceList;\r
+} CM_FULL_RESOURCE_DESCRIPTOR;\r
+\r
+typedef struct\r
+{\r
+ ULONG Count;\r
+ CM_FULL_RESOURCE_DESCRIPTOR List[1];\r
+} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;\r
+\r
+struct _KINTERRUPT;\r
+\r
+typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt, \r
+ PVOID ServiceContext);\r
+\r
+typedef struct _KINTERRUPT\r
+{\r
+ ULONG Vector;\r
+ KAFFINITY ProcessorEnableMask;\r
+ PKSPIN_LOCK IrqLock;\r
+ BOOLEAN Shareable;\r
+ BOOLEAN FloatingSave;\r
+ PKSERVICE_ROUTINE ServiceRoutine;\r
+ PVOID ServiceContext;\r
+ LIST_ENTRY Entry;\r
+ KIRQL SynchLevel;\r
+} KINTERRUPT, *PKINTERRUPT;\r
+\r
--- /dev/null
+#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;
+typedef KAFFINITY *PKAFFINITY;
+
+//typedef LONG KPRIORITY;
+
+typedef LONG NTSTATUS;
+
+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;
+
+/*
+ * Unicode string type
+ * FIXME: Real unicode please
+ */
+typedef char* PUNICODE_STRING;
+
+#if REAL_UNICODE
+typedef struct _UNICODE_STRING
+{
+ USHORT Length;
+ USHORT MaximumLength;
+ PWSTR Buffer;
+} UNICODE_STRING, *PUNICODE_STRING;
+#endif
+
+typedef enum _SECTION_INHERIT {
+ ViewShare = 1,
+ ViewUnmap = 2
+} SECTION_INHERIT;
+
+/*
+ * Various other types (all quite pointless)
+ */
+//typedef ULONG DEVICE_TYPE;
+typedef ULONG KPROCESSOR_MODE;
+typedef ULONG KIRQL;
+typedef KIRQL* PKIRQL;
+typedef ULONG IO_ALLOCATION_ACTION;
+//typedef ULONG INTERFACE_TYPE;
+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 ULONG SECTION_INHERIT;
+typedef ULONG EVENT_TYPE;
+//typedef ULONG KAFFINITY;
+//typedef KAFFINITY* PKAFFINITY;
+typedef ULONG PHYSICAL_ADDRESS;
+typedef PHYSICAL_ADDRESS* PPHYSICAL_ADDRESS;
+typedef ULONG WAIT_TYPE;
+typedef ULONG KWAIT_REASON;
+typedef ULONG KINTERRUPT_MODE;
+typedef USHORT CSHORT;
+
+#endif
--- /dev/null
+/*\r
+ * COPYRIGHT: See COPYING in the top level directory\r
+ * PROJECT: ReactOS kernel\r
+ * PURPOSE: System call definitions\r
+ * FILE: include/ddk/zw.h\r
+ * REVISION HISTORY: \r
+ * ??/??/??: First few functions (David Welch)\r
+ * ??/??/??: Complete implementation by Boudewijn Dekker\r
+ * 13/07/98: Reorganised things a bit (David Welch)\r
+ */\r
+\r
+#ifndef __DDK_ZW_H\r
+#define __DDK_ZW_H\r
+\r
+#include <windows.h>\r
+\r
+/*\r
+ * FUNCTION: Closes an object handle\r
+ * ARGUMENTS:\r
+ * Handle = Handle to the object\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwClose(HANDLE Handle);\r
+\r
+/*\r
+ * FUNCTION: Creates or opens a directory object, which is a container for\r
+ * other objects\r
+ * ARGUMENTS:\r
+ * DirectoryHandle (OUT) = Points to a variable which stores the\r
+ * handle for the directory on success\r
+ * DesiredAccess = Type of access the caller requires to the directory\r
+ * ObjectAttributes = Structures specifing the object attributes,\r
+ * initialized with InitializeObjectAttributes\r
+ * RETURNS: Status \r
+ */\r
+NTSTATUS ZwCreateDirectoryObject(PHANDLE DirectoryHandle,\r
+ ACCESS_MASK DesiredAccess,\r
+ POBJECT_ATTRIBUTES ObjectAttributes);\r
+\r
+/*\r
+ * FUNCTION: Creates or opens a registry key\r
+ * ARGUMENTS:\r
+ * KeyHandle (OUT) = Points to a variable which stores the handle\r
+ * for the key on success\r
+ * DesiredAccess = Access desired by the caller to the key \r
+ * ObjectAttributes = Initialized object attributes for the key\r
+ * TitleIndex = Who knows?\r
+ * Class = Object class of the key?\r
+ * CreateOptions = Options for the key creation\r
+ * Disposition (OUT) = Points to a variable which a status value\r
+ * indicating whether a new key was created\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwCreateKey(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess,\r
+ POBJECT_ATTRIBUTES ObjectAttributes,\r
+ ULONG TitleIndex, PUNICODE_STRING Class,\r
+ ULONG CreateOptions, PULONG Disposition);\r
+\r
+/*\r
+ * FUNCTION: Deletes a registry key\r
+ * ARGUMENTS:\r
+ * KeyHandle = Handle of the key\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwDeleteKey(HANDLE KeyHandle);\r
+\r
+/*\r
+ * FUNCTION: Returns information about the subkeys of an open key\r
+ * ARGUMENTS:\r
+ * KeyHandle = Handle of the key whose subkeys are to enumerated\r
+ * Index = zero based index of the subkey for which information is\r
+ * request\r
+ * KeyInformationClass = Type of information returned\r
+ * KeyInformation (OUT) = Caller allocated buffer for the information\r
+ * about the key\r
+ * Length = Length in bytes of the KeyInformation buffer\r
+ * ResultLength (OUT) = Caller allocated storage which holds\r
+ * the number of bytes of information retrieved\r
+ * on return\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwEnumerateKey(HANDLE KeyHandle, ULONG Index, \r
+ KEY_INFORMATION_CLASS KeyInformationClass,\r
+ PVOID KeyInformation, ULONG Length, \r
+ PULONG ResultLength);\r
+\r
+/*\r
+ * FUNCTION: Returns information about the value entries of an open key\r
+ * ARGUMENTS:\r
+ * KeyHandle = Handle of the key whose value entries are to enumerated\r
+ * Index = zero based index of the subkey for which information is\r
+ * request\r
+ * KeyInformationClass = Type of information returned\r
+ * KeyInformation (OUT) = Caller allocated buffer for the information\r
+ * about the key\r
+ * Length = Length in bytes of the KeyInformation buffer\r
+ * ResultLength (OUT) = Caller allocated storage which holds\r
+ * the number of bytes of information retrieved\r
+ * on return\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwEnumerateValueKey(HANDLE KeyHandle, ULONG Index, \r
+ KEY_VALUE_INFORMATION_CLASS KeyInformationClass,\r
+ PVOID KeyInformation, ULONG Length, \r
+ PULONG ResultLength);\r
+\r
+\r
+/*\r
+ * FUNCTION: Forces a registry key to be committed to disk\r
+ * ARGUMENTS:\r
+ * KeyHandle = Handle of the key to be written to disk\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwFlushKey(HANDLE KeyHandle);\r
+\r
+/*\r
+ * FUNCTION: Changes the attributes of an object to temporary\r
+ * ARGUMENTS:\r
+ * Handle = Handle for the object\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwMakeTemporaryObject(HANDLE Handle);\r
+\r
+/*\r
+ * FUNCTION: Maps a view of a section into the virtual address space of a \r
+ * process\r
+ * ARGUMENTS:\r
+ * SectionHandle = Handle of the section\r
+ * ProcessHandle = Handle of the process\r
+ * BaseAddress = Desired base address (or NULL) on entry\r
+ * Actual base address of the view on exit\r
+ * ZeroBits = Number of high order address bits that must be zero\r
+ * CommitSize = Size in bytes of the initially committed section of \r
+ * the view \r
+ * SectionOffset = Offset in bytes from the beginning of the section\r
+ * to the beginning of the view\r
+ * ViewSize = Desired length of map (or zero to map all) on entry\r
+ * Actual length mapped on exit\r
+ * InheritDisposition = Specified how the view is to be shared with\r
+ * child processes\r
+ * AllocateType = Type of allocation for the pages\r
+ * Protect = Protection for the committed region of the view\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwMapViewOfSection(HANDLE SectionHandle,\r
+ HANDLE ProcessHandle,\r
+ PVOID* BaseAddress,\r
+ ULONG ZeroBits,\r
+ ULONG CommitSize,\r
+ PLARGE_INTEGER SectionOffset,\r
+ PULONG ViewSize,\r
+ SECTION_INHERIT InheritDisposition,\r
+ ULONG AllocationType,\r
+ ULONG Protect);\r
+\r
+/*\r
+ * FUNCTION: Opens an existing key in the registry\r
+ * ARGUMENTS:\r
+ * KeyHandle (OUT) = Caller supplied storage for the resulting handle\r
+ * DesiredAccess = Requested access to the key\r
+ * ObjectAttribute = Initialized attributes for the object\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwOpenKey(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess,\r
+ POBJECT_ATTRIBUTES ObjectAttributes);\r
+\r
+/*\r
+ * FUNCTION: Opens an existing section object\r
+ * ARGUMENTS:\r
+ * KeyHandle (OUT) = Caller supplied storage for the resulting handle\r
+ * DesiredAccess = Requested access to the key\r
+ * ObjectAttribute = Initialized attributes for the object\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwOpenSection(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess,\r
+ POBJECT_ATTRIBUTES ObjectAttributes);\r
+\r
+/*\r
+ * FUNCTION: Returns information about an open file\r
+ * ARGUMENTS:\r
+ * FileHandle = Handle of the file to be queried\r
+ * IoStatusBlock (OUT) = Caller supplied storage for the result\r
+ * FileInformation (OUT) = Caller supplied storage for the file\r
+ * information\r
+ * Length = Length in bytes of the buffer for file information\r
+ * FileInformationClass = Type of information to be returned\r
+ * RETURNS: Status\r
+ */\r
+NTSTATUS ZwQueryInformationFile(HANDLE FileHandle,\r
+ PIO_STATUS_BLOCK IoStatusBlock,\r
+ PVOID FileInformation,\r
+ ULONG Length,\r
+ FILE_INFORMATION_CLASS FileInformationClass);\r
+\r
+#ifndef _NTNATIVE\r
+#define _NTNATIVE\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif /* __cplusplus */\r
+\r
+#include <kernel32/heap.h>\r
+ \r
+#if KERNEL_SUPPORTS_OBJECT_ATTRIBUTES_CORRECTLY\r
+typedef struct _OBJECT_ATTRIBUTES {\r
+ ULONG Length;\r
+ HANDLE RootDirectory;\r
+ PUNICODE_STRING ObjectName;\r
+ ULONG Attributes;\r
+ SECURITY_DESCRIPTOR *SecurityDescriptor; \r
+ SECURITY_QUALITY_OF_SERVICE *SecurityQualityOfService; \r
+} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;\r
+#endif\r
+ \r
+#if IOTYPES_DIDNT_DECLARE_THIS\r
+typedef struct _IO_STATUS_BLOCK {\r
+ NTSTATUS Status;\r
+ ULONG Information;\r
+} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;\r
+#endif\r
+\r
+\r
+//typedef LARGE_INTEGER *PLARGE_INTEGER;\r
+\r
+//\r
+\r
+#define NtCurrentProcess() ( (HANDLE) 0xFFFFFFFF )\r
+#define NtCurrentThread() ( (HANDLE) 0xFFFFFFFE )\r
+\r
+\r
+\r
+// event access mask\r
+\r
+#define EVENT_READ_ACCESS 0x0001\r
+#define EVENT_WRITE_ACCESS 0x0002\r
+\r
+\r
+//process q