From 0f94427db073a20c24f9d85c8531fbe16490af43 Mon Sep 17 00:00:00 2001 From: The ReactOS Manager Date: Tue, 23 Jan 1996 01:02:17 +0000 Subject: [PATCH] Initial revision svn path=/trunk/; revision=2 --- reactos/boot.bat | 1 + reactos/copying_rex | 340 + reactos/doc/api.txt | 140 + reactos/doc/buglist | 2 + reactos/doc/faq.txt | 114 + reactos/doc/internal/mm.txt | 10 + reactos/doc/internal/pe.txt | 1253 ++++ reactos/doc/internal/readme.txt | 2 + reactos/doc/irq.txt | 135 + reactos/doc/irql.txt | 21 + reactos/doc/modules.txt | 33 + reactos/doc/todo | 31 + reactos/doc/wstring.txt | 16 + reactos/include/ascii.h | 2979 +++++++++ reactos/include/base.h | 572 ++ reactos/include/coff.h | 339 + reactos/include/ddk/cfgtypes.h | 72 + reactos/include/ddk/defines.h | 521 ++ reactos/include/ddk/exfuncs.h | 35 + reactos/include/ddk/extypes.h | 18 + reactos/include/ddk/iofuncs.h | 504 ++ reactos/include/ddk/iotypes.h | 393 ++ reactos/include/ddk/kefuncs.h | 124 + reactos/include/ddk/ketypes.h | 141 + reactos/include/ddk/mmfuncs.h | 285 + reactos/include/ddk/mmtypes.h | 24 + reactos/include/ddk/ntddk.h | 41 + reactos/include/ddk/obfuncs.h | 44 + reactos/include/ddk/obtypes.h | 149 + reactos/include/ddk/psfuncs.h | 27 + reactos/include/ddk/pstypes.h | 111 + reactos/include/ddk/rtl.h | 184 + reactos/include/ddk/structs.h | 318 + reactos/include/ddk/types.h | 85 + reactos/include/ddk/zw.h | 1537 +++++ reactos/include/defines.h | 5167 +++++++++++++++ reactos/include/errors.h | 713 +++ reactos/include/funcs.h | 7484 ++++++++++++++++++++++ reactos/include/internal/bitops.h | 140 + reactos/include/internal/ctype.h | 34 + reactos/include/internal/debug.h | 70 + reactos/include/internal/dma.h | 267 + reactos/include/internal/hal/ddk.h | 146 + reactos/include/internal/hal/hal.h | 71 + reactos/include/internal/hal/io.h | 167 + reactos/include/internal/hal/irq.h | 7 + reactos/include/internal/hal/page.h | 76 + reactos/include/internal/hal/segment.h | 343 + reactos/include/internal/hal/segment.inc | 6 + reactos/include/internal/iomgr.h | 29 + reactos/include/internal/kernel.h | 93 + reactos/include/internal/linkage.h | 5 + reactos/include/internal/mm.h | 146 + reactos/include/internal/module.h | 34 + reactos/include/internal/objmgr.h | 89 + reactos/include/internal/pool.h | 19 + reactos/include/internal/psmgr.h | 50 + reactos/include/internal/stddef.h | 10 + reactos/include/internal/string.h | 680 ++ reactos/include/internal/symbol.h | 13 + reactos/include/internal/types.h | 56 + reactos/include/internal/version.h | 17 + reactos/include/kernel32/atom.h | 57 + reactos/include/kernel32/heap.h | 110 + reactos/include/kernel32/process.h | 63 + reactos/include/kernel32/thread.h | 56 + reactos/include/messages.h | 1095 ++++ reactos/include/ntdll/pagesize.h | 7 + reactos/include/sockets.h | 965 +++ reactos/include/string.h | 778 +++ reactos/include/structs.h | 4559 +++++++++++++ reactos/include/types.h | 61 + reactos/include/unicode.h | 3000 +++++++++ reactos/include/windows.h | 86 + reactos/include/wstring.h | 535 ++ reactos/lib/kernel32/file/file.c | 58 + reactos/lib/kernel32/file/lfile.c | 138 + reactos/lib/kernel32/makefile | 10 + reactos/lib/kernel32/mem/global.cc | 320 + reactos/lib/kernel32/mem/heap.c | 1007 +++ reactos/lib/kernel32/mem/local.c | 123 + reactos/lib/kernel32/mem/utils.cc | 23 + reactos/lib/kernel32/mem/virtual.c | 19 + reactos/lib/kernel32/misc/atom.c | 527 ++ reactos/lib/kernel32/process/proc.c | 137 + reactos/lib/kernel32/string/lstring.cc | 123 + reactos/lib/kernel32/thread/thread.c | 83 + reactos/lib/makefile | 12 + reactos/lib/ntdll/genntdll | Bin 0 -> 9418 bytes reactos/lib/ntdll/genntdll.c | 87 + reactos/lib/ntdll/makefile | 7 + reactos/lib/ntdll/ntdll.c | 10 + reactos/lib/ntdll/ntdll.cll | 4 + reactos/lib/ntdll/ntdll.s | 22 + reactos/loaders/boot/boot.asm | 291 + reactos/loaders/boot/boot.bin | Bin 0 -> 512 bytes reactos/loaders/boot/boot.inc | 196 + reactos/loaders/boot/boot.lst | 640 ++ reactos/loaders/boot/boot.mak | 56 + reactos/loaders/boot/boot.map | 8 + reactos/loaders/boot/bootbk.asm | 294 + reactos/loaders/boot/osldr.asm | 340 + reactos/loaders/boot/osldr.bin | Bin 0 -> 401 bytes reactos/loaders/boot/osldr.txt | 12 + reactos/loaders/dos/loadros.asm | 693 ++ reactos/loaders/dos/loadros.com | Bin 0 -> 3360 bytes reactos/loaders/dos/makefile | 8 + reactos/makefile.dos | 62 + reactos/makefile_rex | 62 + reactos/readme_rex | 20 + reactos/rules.mak | 64 + 111 files changed, 43361 insertions(+) create mode 100644 reactos/boot.bat create mode 100644 reactos/copying_rex create mode 100644 reactos/doc/api.txt create mode 100644 reactos/doc/buglist create mode 100644 reactos/doc/faq.txt create mode 100644 reactos/doc/internal/mm.txt create mode 100644 reactos/doc/internal/pe.txt create mode 100644 reactos/doc/internal/readme.txt create mode 100644 reactos/doc/irq.txt create mode 100644 reactos/doc/irql.txt create mode 100644 reactos/doc/modules.txt create mode 100644 reactos/doc/todo create mode 100644 reactos/doc/wstring.txt create mode 100644 reactos/include/ascii.h create mode 100644 reactos/include/base.h create mode 100644 reactos/include/coff.h create mode 100644 reactos/include/ddk/cfgtypes.h create mode 100644 reactos/include/ddk/defines.h create mode 100644 reactos/include/ddk/exfuncs.h create mode 100644 reactos/include/ddk/extypes.h create mode 100644 reactos/include/ddk/iofuncs.h create mode 100644 reactos/include/ddk/iotypes.h create mode 100644 reactos/include/ddk/kefuncs.h create mode 100644 reactos/include/ddk/ketypes.h create mode 100644 reactos/include/ddk/mmfuncs.h create mode 100644 reactos/include/ddk/mmtypes.h create mode 100644 reactos/include/ddk/ntddk.h create mode 100644 reactos/include/ddk/obfuncs.h create mode 100644 reactos/include/ddk/obtypes.h create mode 100644 reactos/include/ddk/psfuncs.h create mode 100644 reactos/include/ddk/pstypes.h create mode 100644 reactos/include/ddk/rtl.h create mode 100644 reactos/include/ddk/structs.h create mode 100644 reactos/include/ddk/types.h create mode 100644 reactos/include/ddk/zw.h create mode 100644 reactos/include/defines.h create mode 100644 reactos/include/errors.h create mode 100644 reactos/include/funcs.h create mode 100644 reactos/include/internal/bitops.h create mode 100644 reactos/include/internal/ctype.h create mode 100644 reactos/include/internal/debug.h create mode 100644 reactos/include/internal/dma.h create mode 100644 reactos/include/internal/hal/ddk.h create mode 100644 reactos/include/internal/hal/hal.h create mode 100644 reactos/include/internal/hal/io.h create mode 100644 reactos/include/internal/hal/irq.h create mode 100644 reactos/include/internal/hal/page.h create mode 100644 reactos/include/internal/hal/segment.h create mode 100644 reactos/include/internal/hal/segment.inc create mode 100644 reactos/include/internal/iomgr.h create mode 100644 reactos/include/internal/kernel.h create mode 100644 reactos/include/internal/linkage.h create mode 100644 reactos/include/internal/mm.h create mode 100644 reactos/include/internal/module.h create mode 100644 reactos/include/internal/objmgr.h create mode 100644 reactos/include/internal/pool.h create mode 100644 reactos/include/internal/psmgr.h create mode 100644 reactos/include/internal/stddef.h create mode 100644 reactos/include/internal/string.h create mode 100644 reactos/include/internal/symbol.h create mode 100644 reactos/include/internal/types.h create mode 100644 reactos/include/internal/version.h create mode 100644 reactos/include/kernel32/atom.h create mode 100644 reactos/include/kernel32/heap.h create mode 100644 reactos/include/kernel32/process.h create mode 100644 reactos/include/kernel32/thread.h create mode 100644 reactos/include/messages.h create mode 100644 reactos/include/ntdll/pagesize.h create mode 100644 reactos/include/sockets.h create mode 100644 reactos/include/string.h create mode 100644 reactos/include/structs.h create mode 100644 reactos/include/types.h create mode 100644 reactos/include/unicode.h create mode 100644 reactos/include/windows.h create mode 100644 reactos/include/wstring.h create mode 100644 reactos/lib/kernel32/file/file.c create mode 100644 reactos/lib/kernel32/file/lfile.c create mode 100644 reactos/lib/kernel32/makefile create mode 100644 reactos/lib/kernel32/mem/global.cc create mode 100644 reactos/lib/kernel32/mem/heap.c create mode 100644 reactos/lib/kernel32/mem/local.c create mode 100644 reactos/lib/kernel32/mem/utils.cc create mode 100644 reactos/lib/kernel32/mem/virtual.c create mode 100644 reactos/lib/kernel32/misc/atom.c create mode 100644 reactos/lib/kernel32/process/proc.c create mode 100644 reactos/lib/kernel32/string/lstring.cc create mode 100644 reactos/lib/kernel32/thread/thread.c create mode 100644 reactos/lib/makefile create mode 100644 reactos/lib/ntdll/genntdll create mode 100644 reactos/lib/ntdll/genntdll.c create mode 100644 reactos/lib/ntdll/makefile create mode 100644 reactos/lib/ntdll/ntdll.c create mode 100644 reactos/lib/ntdll/ntdll.cll create mode 100644 reactos/lib/ntdll/ntdll.s create mode 100644 reactos/loaders/boot/boot.asm create mode 100644 reactos/loaders/boot/boot.bin create mode 100644 reactos/loaders/boot/boot.inc create mode 100644 reactos/loaders/boot/boot.lst create mode 100644 reactos/loaders/boot/boot.mak create mode 100644 reactos/loaders/boot/boot.map create mode 100644 reactos/loaders/boot/bootbk.asm create mode 100644 reactos/loaders/boot/osldr.asm create mode 100644 reactos/loaders/boot/osldr.bin create mode 100644 reactos/loaders/boot/osldr.txt create mode 100644 reactos/loaders/dos/loadros.asm create mode 100644 reactos/loaders/dos/loadros.com create mode 100644 reactos/loaders/dos/makefile create mode 100644 reactos/makefile.dos create mode 100644 reactos/makefile_rex create mode 100644 reactos/readme_rex create mode 100644 reactos/rules.mak diff --git a/reactos/boot.bat b/reactos/boot.bat new file mode 100644 index 00000000000..f85739b58e1 --- /dev/null +++ b/reactos/boot.bat @@ -0,0 +1 @@ +loaders\dos\loadros kernel\kimage.bin %1 %2 %3 %4 diff --git a/reactos/copying_rex b/reactos/copying_rex new file mode 100644 index 00000000000..dc63aaca038 --- /dev/null +++ b/reactos/copying_rex @@ -0,0 +1,340 @@ + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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. + + , 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. diff --git a/reactos/doc/api.txt b/reactos/doc/api.txt new file mode 100644 index 00000000000..379023ffb71 --- /dev/null +++ b/reactos/doc/api.txt @@ -0,0 +1,140 @@ +This file attempts to document the functions made publically available by +the various subsystems. + +* Formatted I/O operations * + +NAME: int vsprintf(char *buf, const char *fmt, va_list args) +NAME: int sprintf(char* buf, const char* fmt, ...) +WHERE: internal/kernel.h +FUNCTION: The same as the standard c library versions + +* PIO operations * + +NAME: in[b/w/l](port) +WHERE: internal/io.h +FUNCTION: Read an IO port of the specified size (byte/word or long) +RETURNS: The value read + +NAME: out[b/w/l](port,val) +WHERE: internal/io.h +FUNCTION: Write an IO port of the specified size (byte/word or long) + +NAME: in_p[b/w/l](port) +WHERE: internal/io.h +FUNCTION: Read an IO port of the specified size (byte/word or long) with + a pause +RETURNS: The value read + +NAME: out_p[b/w/l](port,val) +WHERE: internal/io.h +FUNCTION: Write an IO port of the specified size (byte/word or long) with + a pause + +* Bit operations * + +NAME: int set_bit(int nr, void* addr) +NAME: int clear_bit(int nr, void* addr) +NAME: int change_bit(int nr, void* addr) +WHERE: internal/bitops.h> +FUNCTION: Operate on a bit in the word pointed to by addr +RETURN: 0 if the bit was cleared before the operations + non-zero otherwise + +* Debugging functions * + +NAME: DPRINT(fmt,....) +WHERE: internal/debug.h +FUNCTION: Outputs a string to the console if NDEBUG isn't defined before +including internal/debug.h, a NOP otherwise +ARGUMENTS: The same as printf + +NAME: printk +WHERE: internal/kernel.h +FUNCTION: Outputs a string to the console +ARGUMENTS: The same as printf + +* Memory managment functions * + +NAME: unsigned int physical_to_linear(unsigned int paddr) +WHERE: hal/page.h +FUNCTION: Converts a physical address to a linear one +RECEIVES: + paddr = the physical address to convert +RETURNS: A virtual address where the memory at that physical address can be +accessed + +NAME: void* ExAllocatePool(unsigned int size, unsigned int type = 0); +WHERE: internal/pool.h +FUNCTION: Allocates a block of memory +RECEIVES: + size = the size of the block to allocate + type = will be whether to allocate pagable memory +RETURNS: The address of the block +NOTE: This isn't interrupt safe + +NAME: void ExFreePool(void* block) +WHERE: internal/pool.h +FUNCTION: Frees a block of memory + +NAME: void free_page(unsigned int physical_base, unsigned int nr = 1) +WHERE: internal/mm.h +FUNCTION: Adds a continuous range of physical memory to the free list + +NAME: unsigned int get_free_page(void) +WHERE: internal/mm.h +FUNCTION: Gets a free page +RETURNS: Its physical address + +NAME: unsigned int get_page_physical_address(unsigned int vaddr) +WHERE: internal/mm.h +FUNCTION: Gets the physical address of a page + +NAME: void mark_page_not_writable(unsigned int vaddr) +WHERE: internal/mm.h +FUNCTION: Prevent writing the page + +* DMA functions * + +NAME: unsigned int get_dma_page(unsigned int max_address) +WHERE: internal/mm.h +FUNCTION: Gets a page with a restricted physical address i.e. suitable for + dma +RETURNS: The physical address of the page + +NAME: void disable_dma(unsigned int dmanr) +WHERE: internal/dma.h +FUNCTION: Disables the specified dma channel + +NAME: void enable_dma(unsigned int dmanr) +WHERE: internal/dma.h +FUNCTION: Enables the specified dma channel + +NAME: void clear_dma_ff(unsigned int dmanr) +WHERE: internal/dma.h +FUNCTION: Clear the dma flip-flop + +NAME: void set_dma_mode(unsigned int dmanr, char mode) +WHERE: internal/dma.h +FUNCTION: Sets the type of dma transfer + +NAME: void set_dma_page(unsigned int dmanr, char pagenr) +WHERE: internal/dma.h +FUNCTION: Set only the page register bits of the transfer address + +NAME: void set_dma_addr(unsigned int dmanr, unsigned int a) +WHERE: internal/dma.h +FUNCTION: Set the transfer address for dma +NOTE: Assumes flip-flop is clear + +NAME: void set_dma_count(unsigned int dmanr, unsigned int count) +WHERE: internal/dma.h +FUNCTION: Sets the size of the transfer +ARGUMENTS: + count = the number of bytes to transfer +NOTE: Count must be even for channels 5-7 + +NAME: int get_dma_residue(unsigned int dmanr) +WHERE: internal/dma.h +FUNCTION: Gets the residue remaining after a dma transfer on the channel + + diff --git a/reactos/doc/buglist b/reactos/doc/buglist new file mode 100644 index 00000000000..096fb3e8cf1 --- /dev/null +++ b/reactos/doc/buglist @@ -0,0 +1,2 @@ +* Kernel bugs not fixed + diff --git a/reactos/doc/faq.txt b/reactos/doc/faq.txt new file mode 100644 index 00000000000..69b3e10617c --- /dev/null +++ b/reactos/doc/faq.txt @@ -0,0 +1,114 @@ +Kernel Development FAQ (for v0.0.7) + +This attempts to answer some of the common questions people developing for +the kernel might want to ask (or at least what I think they should ask). +Obviously I can only detail those parts which I have written so other +developers please fill in the gaps. + +Q: What is this, what are you people, what's going on +A: This is the ReactOS, an operating system intended as a clone of windows +NT. See the project website (http://www.sid-dis.com/reactos/) for more details. + +Q: Why ReactOS +A: To condemn Bill Gates to penury. + +Q: What do I need to compile the kernel +A: DJGPP, get it from http://www.delorie.com/djgpp + +Q: How do I compile the kernel +A: Unpack the zip. It is important not to install the kernel in the same +directory as a previous version, this has caused a bit of confusion in the +past. Edit the makefile in the top level directory, in particular select the +correct host to build from. Then run make in the top directory + +Q: What files are created when I make the kernel +A: The following files are created in the kernel directory + kimage = the kernel as a coff executable + kimage.bin = the kernel as a raw binary image + kernel.sym = a list of the kernel symbols + +Q: How do I load the kernel +A: Run the boot.bat batch file. + +Q: Does it boot from disk +A: Not at the moment. + +Q: When I run the kernel it crashes +A: The kernel (at the moment) can only be loaded from a clean system. That +is one without EMM386 or any version of windows loaded. A quick way to +ensure this (if you have windows 95) is to set the program to run in msdos +mode and specify an empty config.sys and autoexec.bat. See the windows help +for more information. + +If you do that and the problem persists then contact the kernel team +(ros-kernel@sid-dis.com) as it is probably a bug in the kernel + +Q6: How do I load a module with the kernel +A: Add the names of any modules to be loaded to the command line of boot.bat. + +Q7: I want to add code to the kernel, how do I get it to be compiled +A: You will need to edit the Makefile in kernel directory. There should be +a statement like this + + OBJECTS = hal/head.o hal/exp.o kernel/vsprintf.o \ + .... + kernel/irqhand.o hal/page.o mm/virtual.o kernel/error.o \ + kernel/exports.o kernel/module.o + +Add the name of the object file (the file produced when your code is +compiled) to the end of the statement (in this case after kernel/module.o). +If you need to go onto a new line then add a slash to the end of the +previous line. It is also very important to use an editor which preserves +tabs. + +Q8: I want to add code to the kernel, how do I make it official +A: Contact the kernel mailing list ros-kernel@sid-dis.com or our coordinator +dwinkley@whitworth.edu. If it is for a specific section then the kernel +website (http://www.geocities.com/SiliconValley/Peaks/1957) has a list of +those working on individual areas, you might what to contact one of them +instead. + +Q9: What header files should I use +A: Don't include the usual DJGPP headers like stdio.h unless you are using +something compiler based like stdargs.h. To use the DJGPP headers requires +linking with libc which is useless in kernel mode. + +All the header files are in the top-level include directory which is laid +out like this + include = general win32 api declarations + include/internal = private kernel headers + include/internal/hal = HAL headers + include/ddk = header files with declarations for modules + +There should be a file called api.txt which documents all of the functions +(and which header files they need). + +Q11: I want to export my function for modules to use, how do I do that +A: Add the function to the list in kernel/exports.lst, then remake the +kernel. Note the function must be declared as extern "C". + +Q12: I want to make my functions part of the kernel interface to user mode, +A: That section isn't finished yet, though it will probably mean adding a +pointer to the function and the size of its parameters to a internal table +somewhere. + +Q14: I want to write a module, what are the guidelines +A: See modules.txt in this directory + +Q15: I want to write an ISR (interrupt service routine) +A: See irq.txt in this directory + +Q16: I want to use DMA +A: Firstly this answer covers only DMA via the dma chips *not* +busmaster DMA. + +To program the dma chip use the functions in internal/dma.h (look in api.txt +for details). PC DMA can only go to memory with a physical address below +1mb (or 16mb on some systems), use the get_dma_page to allocate this kind +of memory. + +Q17: You haven't answered my question +A: Send your questions to ros-kernel@sid-dis.com + + +- David Welch (welch@mcmail.com) diff --git a/reactos/doc/internal/mm.txt b/reactos/doc/internal/mm.txt new file mode 100644 index 00000000000..880bee07976 --- /dev/null +++ b/reactos/doc/internal/mm.txt @@ -0,0 +1,10 @@ +This document describes the implementation of the memory managment + + +* ReactOS memory map + +0x00000000 - 0xc0000000 = User memory +0xc0000000 - 0xd0000000 = Kernel memory +0xd0000000 - 0xffffffff = Identify map of physical memory + +* diff --git a/reactos/doc/internal/pe.txt b/reactos/doc/internal/pe.txt new file mode 100644 index 00000000000..69e19e41618 --- /dev/null +++ b/reactos/doc/internal/pe.txt @@ -0,0 +1,1253 @@ + + PORTABLE EXECUTABLE FORMAT + + Author: Micheal J. O'Leary + + + Preface + + This document was edited and released by Microsoft Developer + Support. It describes the binary portable executable format for NT. + The information is provided at this point because we feel it will + make the work of application development easier. Unfortunately, the + information in this document may change before the final release of + Windows NT. Microsoft is NOT committing to stay with these formats + by releasing this document. Questions or follow-ups for any of the + information presented here should be posted to CompuServe MSWIN32 + forum, section 6. + --Steve Firebaugh + Microsoft Developer Support + + + +Contents + + 1. Overview + + 2. PE Header + + 3. Object Table + + 4. Image Pages + + 5. Exports + 5.1 Export Directory Table + 5.2 Export Address Table + 5.3 Export Name Table Pointers + 5.4 Export Ordinal Table + 5.5 Export Name Table + + 6. Imports + 6.1 Import Directory Table + 6.2 Import Lookup Table + 6.3 Hint-Name Table + 6.4 Import Address Table + + 7. Thread Local Storage + 7.1 Thread Local Storage Directory Table + 7.2 Thread Local Storage CallBack Table + + 8. Resources + 8.1 Resource Directory Table + 8.2 Resource Example + + 9. Fixup Table + 9.1 Fixup Block + + 10. Debug Information + 10.1 Debug Directory + + + +1. Overview + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ <ÄÄ¿ <ÄÄÄÄÄ Base of Image Header + ³ DOS 2 Compatible ³ ³ + ³ EXE Header ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ + ³ unused ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ + ³ OEM Identifier ³ ³ + ³ OEM Info ³ ³ + ³ ³ ³ DOS 2.0 Section + ³ Offset to ³ ³ (for DOS compatibility only) + ³ PE Header ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ + ³ DOS 2.0 Stub ³ ³ + ³ Program & ³ ³ + ³ Reloc. Table ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ <ÄÄÙ + ³ unused ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ <ÄÄÄÄÄÄÄÄÄ Aligned on 8 byte boundary + ³ PE Header ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ Object Table ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ Image Pages ³ + ³ import info ³ + ³ export info ³ + ³ fixup info ³ + ³ resource info³ + ³ debug info ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 1. A typical 32-bit Portable EXE File Layout + + + +2. PE Header + + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ SIGNATURE BYTES ³ CPU TYPE ³ # OBJECTS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ TIME/DATE STAMP ³ RESERVED ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ NT HDR SIZE³ FLAGS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÂÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³LMAJOR³LMINOR³ RESERVED ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÁÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ RESERVED ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ENTRYPOINT RVA ³ RESERVED ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ IMAGE BASE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ OBJECT ALIGN ³ FILE ALIGN ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ OS MAJOR ³ OS MINOR ³USER MAJOR ³USER MINOR ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ SUBSYS MAJOR³ SUBSYS MINOR³ RESERVED ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ IMAGE SIZE ³ HEADER SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ FILE CHECKSUM ³ SUBSYSTEM ³ DLL FLAGS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ STACK RESERVE SIZE ³ STACK COMMIT SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ HEAP RESERVE SIZE ³ HEAP COMMIT SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ # INTERESTING RVA/SIZES ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ EXPORT TABLE RVA ³ TOTAL EXPORT DATA SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ IMPORT TABLE RVA ³ TOTAL IMPORT DATA SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESOURCE TABLE RVA ³ TOTAL RESOURCE DATA SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ EXCEPTION TABLE RVA ³ TOTAL EXCEPTION DATA SIZE³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ SECURITY TABLE RVA ³ TOTAL SECURITY DATA SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ FIXUP TABLE RVA ³ TOTAL FIXUP DATA SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ DEBUG TABLE RVA ³ TOTAL DEBUG DIRECTORIES ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ IMAGE DESCRIPTION RVA ³ TOTAL DESCRIPTION SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ MACHINE SPECIFIC RVA ³ MACHINE SPECIFIC SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ THREAD LOCAL STORAGE RVA ³ TOTAL TLS SIZE ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 2. PE Header + +Notes: + + o A VA is a virtual address that is already biased by the Image + Base found in the PE Header. A RVA is a virtual address that is + relative to the Image Base. + + o An RVA in the PE Header which has a value of zero indicates the + field isn't used. + + o Image pages are aligned and zero padded to a File Align + boundary. The bases of all other tables and structures must be + aligned on DWORD (4 byte) boundary. Thus, all VA's and RVA's + must be on a 32 bit boundary. All table and structure fields + must be aligned on their "natural" boundaries, with the possible + exception of the Debug Info. + +SIGNATURE BYTES = DB * 4. +Current value is "PE/0/0". Thats PE followed by two zeros (nulls). + +CPU TYPE = DW CPU Type. +This field specifies the type of CPU compatibility required by this +image to run. The values are: + + o 0000h __unknown + + o 014Ch __80386 + + o 014Dh __80486 + + o 014Eh __80586 + + o 0162h __MIPS Mark I (R2000, R3000) + + o 0163h __MIPS Mark II (R6000) + + o 0166h __MIPS Mark III (R4000) + +# OBJECTS = DW Number of object entries. +This field specifies the number of entries in the Object Table. + +TIME/DATE STAMP = DD Used to store the time and date the file was +created or modified by the linker. + +NT HDR SIZE = DW This is the number of remaining bytes in the NT +header that follow the FLAGS field. + +FLAGS = DW Flag bits for the image. +The flag bits have the following definitons: + + o 0000h __Program image. + + o 0002h __Image is executable. + If this bit isn't set, then it indicates that either errors + where detected at link time or that the image is being + incrementally linked and therefore can't be loaded. + + o 0200h __Fixed. + Indicates that if the image can't be loaded at the Image Base, + then don't load it. + + o 2000h __Library image. + +LMAJOR/LMINOR = DB Linker major/minor version number. + +ENTRYPOINT RVA = DD Entrypoint relative virtual address. +The address is relative to the Image Base. The address is the +starting address for program images and the library initialization +and library termination address for library images. + +IMAGE BASE = DD The virtual base of the image. +This will be the virtual address of the first byte of the file (Dos +Header). This must be a multiple of 64K. + +OBJECT ALIGN = DD The alignment of the objects. This must be a power +of 2 between 512 and 256M inclusive. The default is 64K. + +FILE ALIGN = DD Alignment factor used to align image pages. The +alignment factor (in bytes) used to align the base of the image pages +and to determine the granularity of per-object trailing zero pad. +Larger alignment factors will cost more file space; smaller alignment +factors will impact demand load performance, perhaps significantly. +Of the two, wasting file space is preferable. This value should be a +power of 2 between 512 and 64K inclusive. + +OS MAJOR/MINOR = DW OS version number required to run this image. + +USER MAJOR/MINOR # = DW User major/minor version number. +This is useful for differentiating between revisions of +images/dynamic linked libraries. The values are specified at link +time by the user. + +SUBSYS MAJOR/MINOR # = DW Subsystem major/minor version number. + +IMAGE SIZE = DD The virtual size (in bytes) of the image. +This includes all headers. The total image size must be a multiple +of Object Align. + +HEADER SIZE = DD Total header size. +The combined size of the Dos Header, PE Header and Object Table. + +FILE CHECKSUM = DD Checksum for entire file. Set to 0 by the linker. + +SUBSYSTEM = DW NT Subsystem required to run this image. +The values are: + + o 0000h __Unknown + + o 0001h __Native + + o 0002h __Windows GUI + + o 0003h __Windows Character + + o 0005h __OS/2 Character + + o 0007h __Posix Character + +DLL FLAGS = DW Indicates special loader requirements. +This flag has the following bit values: + + o 0001h __Per-Process Library Initialization. + + o 0002h __Per-Process Library Termination. + + o 0004h __Per-Thread Library Initialization. + + o 0008h __Per-Thread Library Termination. + +All other bits are reserved for future use and should be set to zero. + +STACK RESERVE SIZE = DD Stack size needed for image. +The memory is reserved, but only the STACK COMMIT SIZE is committed. +The next page of the stack is a 'guarded page'. When the application +hits the guarded page, the guarded page becomes valid, and the next +page becomes the guarded page. This continues until the RESERVE SIZE +is reached. + +STACK COMMIT SIZE = DD Stack commit size. + +HEAP RESERVE SIZE = DD Size of local heap to reserve. + +HEAP COMMIT SIZE = DD Amount to commit in local heap. + +# INTERESTING VA/SIZES = DD Indicates the size of the VA/SIZE array +that follows. + +EXPORT TABLE RVA = DD Relative Virtual Address of the Export Table. +This address is relative to the Image Base. + +IMPORT TABLE RVA = DD Relative Virtual Address of the Import Table. +This address is relative to the Image Base. + +RESOURCE TABLE RVA = DD Relative Virtual Address of the Resource +Table. This address is relative to the Image Base. + +EXCEPTION TABLE RVA = DD Relative Virtual Address of the Exception +Table. This address is relative to the Image Base. + +SECURITY TABLE RVA = DD Relative Virtual Address of the Security +Table. This address is relative to the Image Base. + +FIXUP TABLE RVA = DD Relative Virtual Address of the Fixup Table. +This address is relative to the Image Base. + +DEBUG TABLE RVA = DD Relative Virtual Address of the Debug Table. +This address is relative to the Image Base. + +IMAGE DESCRIPTION RVA = DD Relative Virtual Address of the +description string specified in the module definiton file. + +MACHINE SPECIFIC RVA = DD Relative Virtual Address of a machine +specific value. This address is relative to the Image Base. + +TOTAL EXPORT DATA SIZE = DD Total size of the export data. + +TOTAL IMPORT DATA SIZE = DD Total size of the import data. + +TOTAL RESOURCE DATA SIZE = DD Total size of the resource data. + +TOTAL EXCEPTION DATA SIZE = DD Total size of the exception data. + +TOTAL SECURITY DATA SIZE = DD Total size of the security data. + +TOTAL FIXUP DATA SIZE = DD Total size of the fixup data. + +TOTAL DEBUG DIRECTORIES = DD Total number of debug directories. + +TOTAL DESCRIPTION SIZE = DD Total size of the description data. + +MACHINE SPECIFIC SIZE = DD A machine specific value. + + + +3. Object Table + +The number of entries in the Object Table is given by the # Objects +field in the PE Header. Entries in the Object Table are numbered +starting from one. The object table immediately follows the PE +Header. The code and data memory object entries are in the order +chosen by the linker. The virtual addresses for objects must be +assigned by the linker such that they are in ascending order and +adjacent, and must be a multiple of Object Align in the PE header. + +Each Object Table entry has the following format: + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ OBJECT NAME ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ VIRTUAL SIZE ³ RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ PHYSICAL SIZE ³ PHYSICAL OFFSET ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ RESERVED ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ OBJECT FLAGS ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 3. Object Table + +OBJECT NAME = DB * 8 Object name. This is an eight-byte null-padded +ASCII string representing the object name. + +VIRTUAL SIZE = DD Virtual memory size. The size of the object that +will be allocated when the object is loaded. Any difference between +PHYSICAL SIZE and VIRTUAL SIZE is zero filled. + +RVA = DD Relative Virtual Address. The virtual address the object is +currently relocated to, relative to the Image Base. Each Object's +virtual address space consumes a multiple of Object Align (power of 2 +between 512 and 256M inclusive. Default is 64K), and immediately +follows the previous Object in the virtual address space (the virtual +address space for a image must be dense). + +PHYSICAL SIZE = DD Physical file size of initialized data. The size +of the initialized data in the file for the object. The physical +size must be a multiple of the File Align field in the PE Header, and +must be less than or equal to the Virtual Size. + +PHYSICAL OFFSET = DD Physical offset for object's first page. This +offset is relative to beginning of the EXE file, and is aligned on a +multiple of the File Align field in the PE Header. The offset is +used as a seek value. + +OBJECT FLAGS = DD Flag bits for the object. The object flag bits +have the following definitions: + + o 000000020h __Code object. + + o 000000040h __Initialized data object. + + o 000000080h __Uninitialized data object. + + o 040000000h __Object must not be cached. + + o 080000000h __Object is not pageable. + + o 100000000h __Object is shared. + + o 200000000h __Executable object. + + o 400000000h __Readable object. + + o 800000000h __Writeable object. + +All other bits are reserved for future use and should be set to zero. + +4. Image Pages + +The Image Pages section contains all initialized data for all +objects. The seek offset for the first page in each object is +specified in the object table and is aligned on a File Align +boundary. The objects are ordered by the RVA. Every object begins +on a multiple of Object Align. + + + +5. Exports + +A typical file layout for the export information follows: + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DIRECTORY TABLE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ADDRESS TABLE ³ + ³ ³ + ³ ³ + ³ ³ + ³ ³ + ³ ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NAME PTR TABLE ³ + ³ ³ + ³ ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ORDINAL TABLE ³ + ³ ³ + ³ ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NAME STRINGS ³ + ³ ³ + ³ ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 4. Export File Layout + +5.1 Export Directory Table + +The export information begins with the Export Directory Table which +describes the remainder of the export information. The Export +Directory Table contains address information that is used to resolve +fixup references to the entry points within this image. + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ EXPORT FLAGS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ TIME/DATE STAMP ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ MAJOR VERSION ³ MINOR VERSION ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NAME RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ORDINAL BASE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ # EAT ENTRIES ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ # NAME PTRS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ADDRESS TABLE RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NAME PTR TABLE RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ORDINAL TABLE RVA ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 5. Export Directory Table Entry + +EXPORT FLAGS = DD Currently set to zero. + +TIME/DATE STAMP = DD Time/Date the export data was created. + +MAJOR/MINOR VERSION = DW A user settable major/minor version number. + +NAME RVA = DD Relative Virtual Address of the Dll asciiz Name. +This is the address relative to the Image Base. + +ORDINAL BASE = DD First valid exported ordinal. +This field specifies the starting ordinal number for the export +address table for this image. Normally set to 1. + +# EAT ENTRIES = DD Indicates number of entries in the Export Address +Table. + +# NAME PTRS = DD This indicates the number of entries in the Name Ptr +Table (and parallel Ordinal Table). + +ADDRESS TABLE RVA = DD Relative Virtual Address of the Export Address +Table. +This address is relative to the Image Base. + +NAME TABLE RVA = DD Relative Virtual Address of the Export Name Table +Pointers. +This address is relative to the beginning of the Image Base. This +table is an array of RVA's with # NAMES entries. + +ORDINAL TABLE RVA = DD Relative Virtual Address of Export Ordinals +Table Entry. +This address is relative to the beginning of the Image Base. + +5.2 Export Address Table + +The Export Address Table contains the address of exported entrypoints +and exported data and absolutes. An ordinal number is used to index +the Export Address Table. The ORDINAL BASE must be subracted from the +ordinal number before indexing into this table. + +Export Address Table entry formats are described below: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ EXPORTED RVA ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 6. Export Address Table Entry + +EXPORTED RVA = DD Export address. +This field contains the relative virtual address of the exported +entry (relative to the Image Base). + +5.3 Export Name Table Pointers + +The export name table pointers array contains address into the Export +Name Table. The pointers are 32-bits each, and are relative to the +Image Base. The pointers are ordered lexically to allow binary +searches. + +5.4 Export Ordinal Table + +The Export Name Table Pointers and the Export Ordinal Table form two +parallel arrays, separated to allow natural field alignment. The +export ordinal table array contains the Export Address Table ordinal +numbers associated with the named export referenced by corresponding +Export Name Table Pointers. + +The ordinals are 16-bits each, and already include the Ordinal Base +stored in the Export Directory Table. + +5.5 Export Name Table + +The export name table contains optional ASCII names for exported +entries in the image. These tables are used with the array of Export +Name Table Pointers and the array of Export Ordinals to translate a +procedure name string into an ordinal number by searching for a +matching name string. The ordinal number is used to locate the entry +point information in the export address table. + +Import references by name require the Export Name Table Pointers +table to be binary searched to find the matching name, then the +corresponding Export Ordinal Table is known to contain the entry +point ordinal number. Import references by ordinal number provide +the fastest lookup since searching the name table is not required. + +Each name table entry has the following format: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ ASCII STRING ::: :::::::: '\0' ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 7. Export Name Table Entry + +ASCII STRING = DB ASCII String. +The string is case sensitive and is terminated by a null byte. + + + +6. Imports + +A typical file layout for the import information follows: + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DIRECTORY TABLE ³ + ³ ³ + ³ ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL DIR ENTRY ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DLL1 LOOKUP TABLE ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DLL2 LOOKUP TABLE ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ Dll3 LOOKUP TABLE ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ HINT-NAME TABLE ³ + ³ ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DLL1 ADDRESS TABLE ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DLL2 ADDRESS TABLE ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DLL3 ADDRESS TABLE ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 8. Import File Layout + +6.1 Import Directory Table + +The import information begins with the Import Directory Table which +describes the remainder of the import information. The Import +Directory Table contains address information that is used to resolve +fixup references to the entry points within a DLL image. The import +directory table consists of an array of Import Directory Entries, one +entry for each DLL this image references. The last directory entry is +empty (NULL) which indicates the end of the directory table. + +An Import Directory Entry has the following format: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ IMPORT FLAGS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ TIME/DATE STAMP ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ MAJOR VERSION ³ MINOR VERSION ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NAME RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ IMPORT LOOKUP TABLE RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ IMPORT ADDRESS TABLE RVA ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 9. Import Directory Entry + +IMPORT FLAGS = DD Currently set to zero. + +TIME/DATE STAMP = DD Time/Date the import data was pre-snapped or +zero if not pre-snapped. + +MAJOR/MINOR VERSION = DW The major/minor version number of the dll +being referenced. + +NAME RVA = DD Relative Virtual Address of the Dll asciiz Name. +This is the address relative to the Image Base. + +IMPORT LOOKUP TABLE RVA = DD This field contains the address of the +start of the import lookup table for this image. The address is +relative to the beginning of the Image Base. + +IMPORT ADDRESS TABLE RVA = DD This field contains the address of the +start of the import addresses for this image. The address is +relative to the beginning of the Image Base. + +6.2 Import Lookup Table + +The Import Lookup Table is an array of ordinal or hint/name RVA's for +each DLL. The last entry is empty (NULL) which indicates the end of +the table. + +The last element is empty. + + 3 0 + 1 + ÚÄÒÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³0º ORDINAL#/HINT-NAME TABLE RVA ³ + ÀÄÐÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 10. Import Address Table Format + +ORDINAL/HINT-NAME TABLE RVA = 31-bits (mask = 7fffffffh) Ordinal +Number or Name Table RVA. +If the import is by ordinal, this field contains a 31 bit ordinal +number. If the import is by name, this field contains a 31 bit +address relative to the Image Base to the Hint-Name Table. + +O = 1-bit (mask = 80000000h) Import by ordinal flag. + + o 00000000h __Import by name. + + o 80000000h __Import by ordinal. + +6.3 Hint-Name Table + +The Hint-Name Table format follows: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ HINT ³ ASCII STRING |||³ + ÃÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄ´ + ³|||||||||||||||||³ '\0' PAD ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + + + The PAD field is optional. + +Figure 11. Import Hint-Name Table + +HINT = DW Hint into Export Name Table Pointers. +The hint value is used to index the Export Name Table Pointers array, +allowing faster by-name imports. If the hint is incorrect, then a +binary search is performed on the Export Name Ptr Table. + +ASCII STRING = DB ASCII String. +The string is case sensitive and is terminated by a null byte. + +PAD = DB Zero pad byte. +A trailing zero pad byte appears after the trailing null byte if +necessary to align the next entry on an even boundary. + +The loader overwrites the import address table when loading the image +with the 32-bit address of the import. + + + +6.4 Import Address Table + +The Import Address Table is an array of addresses of the imported +routines for each DLL. The last entry is empty (NULL) which indicates +the end of the table. + +7. Thread Local Storage + +Thread local storage is a special contiguous block of data. Each +thread will gets its own block upon creation of the thread. + +The file layout for thread local storage follows: + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ DIRECTORY TABLE ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ TLS DATA ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ INDEX VARIABLE ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ CALLBACK ADDRESSES ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 12. Thread Local Storage Layout + +7.1 Thread Local Storage Directory Table + +The Thread Local Storage Directory Table contains address information +that is used to describe the rest of TLS. + +The Thread Local Storage Directory Table has the following format: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ START DATA BLOCK VA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ END DATA BLOCK VA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ INDEX VA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ CALLBACK TABLE VA ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 13. Thread Local Storage Directory Table + +START DATA BLOCK VA = DD Virtual Address of the start of the thread +local storage data block. + +END DATA BLOCK VA = DD Virtual Address of the end of the thread local +storage data block. + +INDEX VA = DD Virtual Address of the index variable used to access +the thread local storage data block. + +CALLBACK TABLE VA = DD Virtual Address of the callback table. + +7.2 Thread Local Storage CallBack Table + +The Thread Local Storage Callbacks is an array of Virtual Address of +functions to be called by the loader after thread creation and thread +termination. The last entry is empty (NULL) which indicates the end +of the table. + +The Thread Local Storage CallBack Table has the following format: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ FUNCTION1 VA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ FUNCTION2 VA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ NULL ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 14. Thread Local Storage CallBack Table + +8. Resources + +Resources are indexed by a multiple level binary-sorted tree +structure. The overall design can incorporate 2**31 levels, however, +NT uses only three: the highest is TYPE, then NAME, then LANGUAGE. + +A typical file layout for the resource information follows: + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ RESOURCE DIRECTORY ³ + ³ ³ + ³ ³ + ³ ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESOURCE DATA ³ + ³ ³ + ³ ³ + ³ ³ + ³ ³ + ³ ³ + ³ ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 15. Resource File Layout + + +The Resource directory is made up of the following tables: + + + +8.1 Resource Directory Table +ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ +³ RESOURCE FLAGS ³ +ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +³ TIME/DATE STAMP ³ +ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +³ MAJOR VERSION ³ MINOR VERSION ³ +ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +³ # NAME ENTRY ³ # ID ENTRY ³ +ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +³ RESOURCE DIR ENTRIES ³ +ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 16. Resource Table Entry + + +RESOURCE FLAGS = DD Currently set to zero. + +TIME/DATE STAMP = DD Time/Date the resource data was created by the +resource compiler. + +MAJOR/MINOR VERSION = DW A user settable major/minor version number. + +# NAME ENTRY = DW The number of name entries. +This field contains the number of entries at the beginning of the +array of directory entries which have actual string names associated +with them. + +# ID ENTRY = DW The number of ID integer entries. +This field contains the number of 32-bit integer IDs as their names +in the array of directory entries. + +The resource directory is followed by a variable length array of +directory entries. # NAME ENTRY is the number of entries at the +beginning of the array that have actual names associated with each +entry. The entires are in ascending order, case insensitive strings. +# ID ENTRY identifies the number of entries that have 32-bit integer +IDs as their name. These entries are also sorted in ascending order. + +This structure allows fast lookup by either name or number, but for +any given resource entry only one form of lookup is supported, not +both. This is consistent with the syntax of the .RC file and the .RES +file. + + + +The array of directory entries have the following format: + 3 0 + 1 +ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ +³ NAME RVA/INTEGER ID ³ +ÃÄÒÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ +³Eº DATA ENTRY RVA/SUBDIR RVA ³ +ÀÄÐÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 17. Resource Directory Entry + + +INTERGER ID = DD ID. +This field contains a integer ID field to identify a resource. + +NAME RVA = DD Name RVA address. +This field contains a 31-bit address relative to the beginning of the +Image Base to a Resource Directory String Entry. + +E = 1-bit (mask 80000000h) Unescape bit. +This bit is zero for unescaped Resource Data Entries. + +DATA RVA = 31-bits (mask 7fffffffh) Data entry address. +This field contains a 31-bit address relative to the beginning of the +Image Base to a Resource Data Entry. + +E = 1-bit (mask 80000000h) Escape bit. +This bit is 1 for escaped Subdirectory Entry. + +DATA RVA = 31-bits (mask 7fffffffh) Directory entries. +This field contains a 31-bit address relative to the beginning of the +Image Base to Subdirectory Entry. + + + +Each resource directory string entry has the following format: +ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ +³ LENGTH ³ UNICODE STRING ³ +ÃÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄ´ +³ ³ +ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 18. Resource Directory String Entry + + +LENGTH = DW Length of string. + +UNICODE STRING = DW UNICODE String. + +All of these string objects are stored together after the last +resource directory entry and before the first resource data object. +This minimizes the impact of these variable length objects on the +alignment of the fixed size directory entry objects. The length needs +to be word aligned. + + + +Each Resource Data Entry has the following format: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ DATA RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ CODEPAGE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ RESERVED ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 19. Resource Data Entry + + + +DATA RVA = DD Address of Resource Data. +This field contains 32-bit virtaul address of the resource data +(relative to the Image Base). + +SIZE = DD Size of Resource Data. +This field contains the size of the resource data for this resource. + +CODEPAGE = DD Codepage. + +RESERVED = DD Reserved - must be zero. + +Each resource data entry describes a leaf node in the resource +directory tree. It contains an address which is relative to the +beginning of Image Base, a size field that gives the number of bytes +of data at that address, a CodePage that should be used when decoding +code point values within the resource data. Typically for new +applications the code page would be the unicode code page. + + + +8.2 Resource Example + +The following is an example for an app. which wants to use the following data +as resources: + + TypeId# NameId# Language ID Resource Data + 00000001 00000001 0 00010001 + 00000001 00000001 1 10010001 + 00000001 00000002 0 00010002 + 00000001 00000003 0 00010003 + 00000002 00000001 0 00020001 + 00000002 00000002 0 00020002 + 00000002 00000003 0 00020003 + 00000002 00000004 0 00020004 + 00000009 00000001 0 00090001 + 00000009 00000009 0 00090009 + 00000009 00000009 1 10090009 + 00000009 00000009 2 20090009 + +Then the Resource Directory in the Portable format looks like: +Offset Data +0000: 00000000 00000000 00000000 00030000 (3 entries in this directory) +0010: 00000001 80000028 (TypeId #1, Subdirectory at offset 0x28) +0018: 00000002 80000050 (TypeId #2, Subdirectory at offset 0x50) +0020: 00000009 80000080 (TypeId #9, Subdirectory at offset 0x80) +0028: 00000000 00000000 00000000 00030000 (3 entries in this directory) +0038: 00000001 800000A0 (NameId #1, Subdirectory at offset 0xA0) +0040: 00000002 00000108 (NameId #2, data desc at offset 0x108) +0048: 00000003 00000118 (NameId #3, data desc at offset 0x118) +0050: 00000000 00000000 00000000 00040000 (4 entries in this directory) +0060: 00000001 00000128 (NameId #1, data desc at offset 0x128) +0068: 00000002 00000138 (NameId #2, data desc at offset 0x138) +0070: 00000003 00000148 (NameId #3, data desc at offset 0x148) +0078: 00000004 00000158 (NameId #4, data desc at offset 0x158) +0080: 00000000 00000000 00000000 00020000 (2 entries in this directory) +0090: 00000001 00000168 (NameId #1, data desc at offset 0x168) +0098: 00000009 800000C0 (NameId #9, Subdirectory at offset 0xC0) +00A0: 00000000 00000000 00000000 00020000 (2 entries in this directory) +00B0: 00000000 000000E8 (Language ID 0, data desc at offset 0xE8 +00B8: 00000001 000000F8 (Language ID 1, data desc at offset 0xF8 +00C0: 00000000 00000000 00000000 00030000 (3 entries in this directory) +00D0: 00000001 00000178 (Language ID 0, data desc at offset 0x178 +00D8: 00000001 00000188 (Language ID 1, data desc at offset 0x188 +00E0: 00000001 00000198 (Language ID 2, data desc at offset 0x198 + +00E8: 000001A8 (At offset 0x1A8, for TypeId #1, NameId #1, Language id #0 + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +00F8: 000001AC (At offset 0x1AC, for TypeId #1, NameId #1, Language id #1 + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0108: 000001B0 (At offset 0x1B0, for TypeId #1, NameId #2, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0118: 000001B4 (At offset 0x1B4, for TypeId #1, NameId #3, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0128: 000001B8 (At offset 0x1B8, for TypeId #2, NameId #1, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0138: 000001BC (At offset 0x1BC, for TypeId #2, NameId #2, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0148: 000001C0 (At offset 0x1C0, for TypeId #2, NameId #3, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0158: 000001C4 (At offset 0x1C4, for TypeId #2, NameId #4, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0168: 000001C8 (At offset 0x1C8, for TypeId #9, NameId #1, + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0178: 000001CC (At offset 0x1CC, for TypeId #9, NameId #9, Language id #0 + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0188: 000001D0 (At offset 0x1D0, for TypeId #9, NameId #9, Language id #1 + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) +0198: 000001D4 (At offset 0x1D4, for TypeId #9, NameId #9, Language id #2 + 00000004 (4 bytes of data) + 00000000 (codepage) + 00000000 (reserved) + +And the data for the resources will look like: +01A8: 00010001 +01AC: 10010001 +01B0: 00010002 +01B4: 00010003 +01B8: 00020001 +01BC: 00020002 +01C0: 00020003 +01C4: 00020004 +01C8: 00090001 +01CC: 00090009 +01D0: 10090009 +01D4: 20090009 + + +9. Fixup Table + +The Fixup Table contains entries for all fixups in the image. The +Total Fixup Data Size in the PE Header is the number of bytes in the +fixup table. The fixup table is broken into blocks of fixups. Each +block represents the fixups for a 4K page. + +Fixups that are resolved by the linker do not need to be processed by +the loader, unless the load image can't be loaded at the Image Base +specified in the PE Header. + +9.1 Fixup Block + +Fixup blocks have the following format: + + ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³ PAGE RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ BLOCK SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ TYPE/OFFSET ³ TYPE/OFFSET ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ TYPE/OFFSET ³ ... ³ + ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + +Figure 20. Fixup Block Format + +To apply a fixup, a delta needs to be calculated. The 32-bit delta +is the difference between the preferred base, and the base where the +image is actually loaded. If the image is loaded at its preferred +base, the delta would be zero, and thus the fixups would not have to +be applied. Each block must start on a DWORD boundary. The ABSOLUTE +fixup type can be used to pad a block. + +PAGE RVA = DD Page RVA. The image base plus the page rva is added to +each offset to create the virtual address of where the fixup needs to +be applied. + +BLOCK SIZE = DD Number of bytes in the fixup block. This includes the +PAGE RVA and SIZE fields. + +TYPE/OFFSET is defined as: + + 1 1 0 + 5 1 + ÚÄÄÄÄÒÄÄÄÄÄÄÄÄÄÄÄÄ¿ + ³TYPEº OFFSET ³ + ÀÄÄÄÄÐÄÄÄÄÄÄÄÄÄÄÄÄÙ +Figure 21. Fixup Record Format + +TYPE = 4-bit fixup type. This value has the following definitions: + + o 0h __ABSOLUTE. This is a NOP. The fixup is skipped. + + o 1h __HIGH. Add the high 16-bits of the delta to the 16-bit field + at Offset. The 16-bit field represents the high value of a 32- + bit word. + + o 2h __LOW. Add the low 16-bits of the delta to the 16-bit field + at Offset. The 16-bit field represents the low half value of a + 32-bit word. This fixup will only be emitted for a RISC machine + when the image Object Align isn't the default of 64K. + + o 3h __HIGHLOW. Apply the 32-bit delta to the 32-bit field at + Offset. + + o 4h __HIGHADJUST. This fixup requires a full 32-bit value. The + high 16-bits is located at Offset, and the low 16-bits is + located in the next Offset array element (this array element is + included in the SIZE field). The two need to be combined into a + signed variable. Add the 32-bit delta. Then add 0x8000 and + store the high 16-bits of the signed variable to the 16-bit + field at Offset. + + o 5h __MIPSJMPADDR. + +All other values are reserved. + + + +10. Debug Information + +The debug information is defined by the debugger and is not +controlled by the portable EXE format or linker. The only data +defined by the portable EXE format is the Debug Directory Table. + +10.1 Debug Directory + +The debug directory table consists of one or more entries that have +the following format: + + ÚÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿ + ³ DEBUG FLAGS ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ TIME/DATE STAMP ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ MAJOR VERSION ³ MINOR VERSION ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ DEBUG TYPE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ DATA SIZE ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ DATA RVA ³ + ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ + ³ DATA SEEK ³ + ÀÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ + +Figure 22. Debug Directory Entry + +DEBUG FLAGS = DD Set to zero for now. + +TIME/DATE STAMP = DD Time/Date the debug data was created. + +MAJOR/MINOR VERSION = DW Version stamp. +This stamp can be used to determine the version of the debug data. + +DEBUG TYPE = DD Format type. +To support multiple debuggers, this field determines the format of +the debug information. This value has the following definitions: + + o 0001h __Image contains COFF symbolics. + + o 0001h __Image contains CodeView symbolics. + + o 0001h __Image contains FPO symbolics. + +DATA SIZE = DD The number of bytes in the debug data. This is the +size of the actual debug data and does not include the debug +directory. + +DATA RVA = DD The relative virtual address of the debug data. This +address is relative to the beginning of the Image Base. + +DATA SEEK = DD The seek value from the beginning of the file to the +debug data. + +If the image contains more than one type of debug information, then +the next debug directory will immediately follow the first debug +directory. diff --git a/reactos/doc/internal/readme.txt b/reactos/doc/internal/readme.txt new file mode 100644 index 00000000000..b0a4593f171 --- /dev/null +++ b/reactos/doc/internal/readme.txt @@ -0,0 +1,2 @@ +This contains documentation describing the internals of the various kernel +subsystems and a few other useful bits of information. diff --git a/reactos/doc/irq.txt b/reactos/doc/irq.txt new file mode 100644 index 00000000000..1a5a17405ed --- /dev/null +++ b/reactos/doc/irq.txt @@ -0,0 +1,135 @@ +** Introduction + +This attempts to document the ReactOS irq handling. As of v0.0.8 this has +changed to be more nt like, I will attempt to summarize the new +implementation for those unavailable with nt device driver writing. Note, +ReactOS doesn't have an exact implementation but the omissions are, except +where noted, not user visible. + +** Steps in grabbing an irq vector + +* Call HalConnectInterrupt + +PROTOTYPE: + +ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType, + ULONG BusNumber, + ULONG BusInterruptLevel, + ULONG BusInterruptVector, + OUT PKIRQL Irql, + OUT PKAFFINITY Affinity) + +PURPOSE: + +Translates a bus dependant interrupt vector to a system vector + +ARGUMENTS: + + InterfaceType = Type of bus to which the device to receive interrupts + from is connected to. Currently only 'Internal' is + recognized + BusNumber = Number of the bus the device is connected to + (currently ignored) + BusInterruptLevel = Bus specific interrupt level (currently ignored) + BusInterruptVector = Bus specific vector. Currently this is the same + as the normal vector (09 is the keyboard vector + for example) + Irql = On return contains the DIRQL for the vector + Affinity = On return contains the affinity mask for the vector + (currently unimplemented) + +RETURNS: + The system mapped vector + +* Call IoConnectInterrupt + +PROTOTYPE: + +NTSTATUS IoConnectInterrupt(OUT PKINTERRUPT* InterruptObject, + PKSERVICE_ROUTINE ServiceRoutine, + PVOID ServiceContext, + PKSPIN_LOCK SpinLock, + ULONG Vector, + KIRQL Irql, + KIRQL SynchronizeIrql, + KINTERRUPT_MODE InterruptMode, + BOOLEAN ShareVector, + KAFFINITY ProcessorEnableMask, + BOOLEAN FloatingSave) + +PURPOSE: + +Connect a service routine to an interrupt vector + +ARGUMENTS: + + InterruptObject = Points to an object describes the interrupt on + return + ServiceRoutine = Function to be called when the device interrupts + ServiceContext = Parameters to be passed to the service routine + SpinLock = Should be NULL + Vector = System mapped vector returned from HalGetInterruptVector + Irql = DIRQL returned from HalGetInterruptVector + SynchronizeIrql = Should be the same as Irql + InterruptMode = Device interrupt type (currently ignored) + ShareVector = True if the interrupt vector can shared + ProcessorEnableMask = Currently ignored + FloatingSave = Should be false + +RETURNS: Status + +* Sample code for snarfing an interrupt vector + + + void grab_my_irq() + { + ULONG MappedIrq; + KIRQL Dirql; + KAFFINITY Affinity; + PKINTERRUPT IrqObject; + + MappedIrq = HalGetInterruptVector(Internal, + 0, + 0, + MY_VECTOR, + &Dirql, + &Affinity); + IoConnectInterrupt(&IrqObject, + my_irq_service_routine, + my_context, + NULL, + MappedIrq, + Dirql, + Dirql, + 0, + FALSE, // Not sharable + Affinity, + FALSE); + } + +** Designing an interrupt service routine + +An interrupt service routine should have the following prototype + + BOOLEAN my_irq_service_routine(PKINTERRUPT Interrupt, + PVOID ServiceContext); + +ARGUMENTS: + + Interrupt = The same as the object returned from the + IoConnectInterrupt + ServiceContext = A user defined parameters + (passed to IoConnectInterrupt) + +RETURNS: + + True if it handled the interrupt, false if it should be passed onto + other devices sharing the same vector + +NOTES: + + While an isr is executing all devices of a lower or equal priority + can't interrupt. For this reason it is important that an isr + should complete in a short an interval as possible. The set of + routines an isr can call is also restricted. + diff --git a/reactos/doc/irql.txt b/reactos/doc/irql.txt new file mode 100644 index 00000000000..de4ce316a66 --- /dev/null +++ b/reactos/doc/irql.txt @@ -0,0 +1,21 @@ +This document describes the state of a uniprocessor PC at each of the IRQ +levels supported by the ReactOS kernel + +PASSIVE_LEVEL: IF bit clear in the processor flags + All irqs umasked at the PIC + +APC_LEVEL: Unknown +WAKE_LEVEL: Unknown + +DISPATCH_LEVEL: IF bit clear in the processor flags + All irqs umasked at the PIC + Thread dispatching disabled + +DIRQL (Device specific IRQ level): + IF bit clear in the processor flags + Device's irq and all lower priority irqs masked at the PIC + Thread dispatching disabled + +HIGH_LEVEL: IF bit set in the processor flags + All irqs masked at the PIC + Thread dispatching disabled diff --git a/reactos/doc/modules.txt b/reactos/doc/modules.txt new file mode 100644 index 00000000000..c7bcff51976 --- /dev/null +++ b/reactos/doc/modules.txt @@ -0,0 +1,33 @@ +** Introduction + +This is (an incomplete) guide to writing device drivers (and other kernel +extensions) for ReactOS. + +** Setting up the build environment + +Create a new subdirectory in the modules directory and copy one of the +existing module makefiles into it. Customize the makefile to compile the +source files for the module. Note: generally it is not necessary to specify +the compiler or compiler flags to use. + +** Initializing a module + +On loading the kernel will call the module function + +PROTOTYPE: + + NTSTATUS ModuleEntry(PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath) + +PURPOSE: + + Initializing the module + +ARGUMENTS: + + DriverObject = Pointer to an object describing the driver + RegistryPath = Currently NULL + +RETURNS: + + STATUS_SUCCESS = If the module initialized successfully diff --git a/reactos/doc/todo b/reactos/doc/todo new file mode 100644 index 00000000000..04ccbc46daa --- /dev/null +++ b/reactos/doc/todo @@ -0,0 +1,31 @@ +* Kernel things implemented [exceptions in brackets] + +Spinlocks [Uniprocessor only] +IRQ levels [Not APC_LEVEL or WAKE_LEVEL, uniprocessor only] +ISRs [Partial, uniprocessor only] +Timers [Untested] +DPCs [Untested] +Objects [Partial] +Namespace [Partial] +Handle tables [One process only] +Threads [Some initial work] +RTL list functions [All except sequenced lists] +Zones [Untested] +Memory pool [Working but semantics partially incompatiable] +Device objects [Some but no support for layering] +IRP [Partial] +Memory sections [Partial, no file mappings] +PCI interface [Probes but no support] +CreateFile API [Device only] +ReadFile/WriteFile API [Device only] +MDL functions [Untested] + +* Kernel things unimplemented (partial) + +Add support for source level debugging to Bochs +Support for remote debugging +Process managment +Dispatcher objects (Mutex, Semaphore etc) +Investigate user and kernel mode APCs +Asynchronous I/O +Optimization diff --git a/reactos/doc/wstring.txt b/reactos/doc/wstring.txt new file mode 100644 index 00000000000..271adcd56dd --- /dev/null +++ b/reactos/doc/wstring.txt @@ -0,0 +1,16 @@ +subject wstring.zip +author Boudewijn Dekker +date 06-06-98 + + +I wrote some inline wide character string functions. It are modified version +of the ones in string.h. I added four more function nl stricmp, strnicmp, +wcsicmp, and wcsnicmp. These are the case insensitive variants of +strcmp, strncmp and wcscmp, wcsncmp. I tested all the functions but I +would urge anyone to tested again. I removed an extern specifier +__wcstok and strtok cause I it caused an compilation error when +using strtok or wcstok. Please could someone see if this correct. +I also used these string functions in lstring api functions. + + +Boudewijn Dekker \ No newline at end of file diff --git a/reactos/include/ascii.h b/reactos/include/ascii.h new file mode 100644 index 00000000000..8c74f748a86 --- /dev/null +++ b/reactos/include/ascii.h @@ -0,0 +1,2979 @@ +/* + ASCIIFunctions.h + + Declarations for all the Win32 ASCII Functions + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + + 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 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 */ diff --git a/reactos/include/base.h b/reactos/include/base.h new file mode 100644 index 00000000000..14bfec708d7 --- /dev/null +++ b/reactos/include/base.h @@ -0,0 +1,572 @@ +/* + Base.h + + Base definitions + + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + + Author: Scott Christley + + 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 for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _GNU_H_WINDOWS32_BASE +#define _GNU_H_WINDOWS32_BASE + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef NULL +#ifdef __cplusplus +#define NULL (0) +#else +#define NULL ((void *)0) +#endif +#endif /* !NULL */ + +#define FALSE 0 +#define TRUE 1 + +#ifndef RC_INVOKED + +/* typedef ACMDRIVERENUMCB; +typedef ACMDRIVERPROC; +typedef ACMFILERCHOOSEHOOKPROC; +typedef ACMFILTERENUMCB; +typedef ACMFILTERTAGENUMCB; +typedef ACMFORMATCHOOSEHOOKPROC; +typedef ACMFORMATENUMCB; +typedef ACMFORMATTAGENUMCB; +typedef APPLET_PROC; +*/ +typedef unsigned short ATOM; +/* Changed from BOOL to WINBOOL to avoid Objective-C conflict */ +typedef int WINBOOL; +typedef unsigned char BOOLEAN; +typedef unsigned char BYTE; +typedef unsigned long CALTYPE; +typedef unsigned long CALID; +typedef char CCHAR; +typedef unsigned long COLORREF; +#define CONST const + +/* Check VOID before defining CHAR, SHORT, and LONG */ +#ifndef VOID +#define VOID void +typedef char CHAR; +typedef short SHORT; +typedef long LONG; +#endif + +/* +typedef CTRYID; +typedef DLGPROC; +*/ +typedef unsigned int DWORD; /* was unsigned long */ +typedef double DWORDLONG, *PDWORDLONG; +/* +typedef EDITWORDBREAKPROC; +typedef ENHMFENUMPROC; +typedef ENUMRESLANGPROC; +typedef ENUMRESNAMEPROC; +typedef ENUMRESTYPEPROC; +*/ +typedef float FLOAT; +/* typedef GLOBALHANDLE; */ +typedef void *HANDLE; +typedef HANDLE HACCEL; +typedef HANDLE HBITMAP; +typedef HANDLE HBRUSH; +typedef HANDLE HCOLORSPACE; +typedef HANDLE HCONV; +typedef HANDLE HCONVLIST; +typedef HANDLE HCURSOR; +typedef HANDLE HDBC; +typedef HANDLE HDC; +typedef HANDLE HDDEDATA; +typedef HANDLE HDESK; +typedef HANDLE HDROP; +typedef HANDLE HDWP; +typedef HANDLE HENHMETAFILE; +typedef HANDLE HENV; +typedef int HFILE; +typedef HANDLE HFONT; +typedef HANDLE HGDIOBJ; +typedef HANDLE HGLOBAL; +typedef HANDLE HGLRC; +typedef HANDLE HHOOK; +typedef HANDLE HICON; +typedef HANDLE HIMAGELIST; +typedef HANDLE HINSTANCE; +typedef HANDLE HKEY, *PHKEY; +typedef HANDLE HKL; +typedef HANDLE HLOCAL; +typedef HANDLE HMENU; +typedef HANDLE HMETAFILE; +typedef HANDLE HMODULE; +typedef HANDLE HPALETTE; +typedef HANDLE HPEN; +typedef HANDLE HRASCONN; +typedef long HRESULT; +typedef HANDLE HRGN; +typedef HANDLE HRSRC; +typedef HANDLE HSTMT; +typedef HANDLE HSZ; +typedef HANDLE HWINSTA; +typedef HANDLE HWND; +typedef int INT; +typedef unsigned short LANGID; +typedef DWORD LCID; +typedef DWORD LCTYPE; +/* typedef LOCALHANDLE */ +typedef double LONGLONG, *PLONGLONG; +typedef unsigned short *LP; +typedef long LPARAM; +typedef WINBOOL *LPBOOL; +typedef BYTE *LPBYTE; +typedef CONST CHAR *LPCCH; +typedef CHAR *LPCH; +typedef COLORREF *LPCOLORREF; +typedef const char *LPCSTR; +typedef char* PCSZ; + +#ifdef UNICODE +typedef const unsigned short *LPCTSTR; +#else +typedef const char *LPCTSTR; +#endif /* UNICODE */ + +typedef const unsigned short *LPCWCH; +typedef const unsigned short *LPCWSTR; +typedef DWORD *LPDWORD; +/* typedef LPFRHOOKPROC; */ +typedef HANDLE *LPHANDLE; +/* typedef LPHANDLER_FUNCTION; */ +typedef int *LPINT; +typedef long *LPLONG; +typedef char *LPSTR; + +#ifdef UNICODE +typedef unsigned short *LPTCH; +typedef unsigned short *LPTSTR; +#else +typedef char *LPTCH; +typedef char *LPTSTR; +#endif /* UNICODE */ + +typedef long LRESULT; +typedef void *LPVOID; +typedef const void *LPCVOID; +typedef unsigned short *LPWCH; +typedef unsigned short *LPWORD; +typedef unsigned short *LPWSTR; +typedef unsigned short *PWSTR; +/* typedef NPSTR; */ +typedef unsigned short *NWPSTR; +typedef WINBOOL *PWINBOOL; +typedef BYTE *PBOOLEAN; +typedef BYTE *PBYTE; +typedef const CHAR *PCCH; +typedef CHAR *PCH; +typedef CHAR *PCHAR; +typedef const char *PCSTR; +typedef const unsigned short *PCWCH; +typedef const unsigned short *PCWSTR; +typedef DWORD *PDWORD; +typedef float *PFLOAT; +typedef HANDLE *PHANDLE; +/* typedef PHKEY; */ +typedef int *PINT; +/* typedef LCID *PLCID; */ +typedef long *PLONG; +typedef short *PSHORT; +/* typedef PSID; */ +typedef char *PSTR; +typedef char *PSZ; + +#ifdef UNICODE +typedef unsigned short *PTBYTE; +typedef unsigned short *PTCH; +typedef unsigned short *PTCHAR; +typedef unsigned short *PTSTR; +#else +typedef unsigned char *PTBYTE; +typedef char *PTCH; +typedef char *PTCHAR; +typedef char *PTSTR; +#endif /* UNICODE */ + +typedef unsigned char *PUCHAR; +typedef unsigned int *PUINT; +typedef unsigned long *PULONG; +typedef unsigned short *PUSHORT; +typedef void *PVOID; +typedef unsigned short *PWCH; +typedef unsigned short *PWCHAR; +typedef unsigned short *PWORD; +/* +typedef PWSTR; +typedef REGSAM; +*/ + +typedef short RETCODE; + +typedef HANDLE SC_HANDLE; +typedef LPVOID SC_LOCK; +typedef SC_HANDLE *LPSC_HANDLE; +typedef DWORD SERVICE_STATUS_HANDLE; +/* typedef SPHANDLE; */ + +#ifdef UNICODE +typedef unsigned short TBYTE; +typedef unsigned short TCHAR; +typedef unsigned short BCHAR; +#else +typedef unsigned char TBYTE; +typedef char TCHAR; +typedef BYTE BCHAR; +#endif /* UNICODE */ + +typedef unsigned char UCHAR; +typedef unsigned int UINT; +typedef unsigned long ULONG; +typedef unsigned short USHORT; +typedef unsigned short WCHAR; +typedef unsigned short WORD; +typedef unsigned int WPARAM; +/* typedef YIELDPROC; */ + +/* Only use __stdcall under WIN32 compiler */ +#ifdef i386 +#define STDCALL __attribute__ ((stdcall)) +#define CDECL __attribute((cdecl)) +#define CALLBACK WINAPI +#define PASCAL WINAPI +#else +#define STDCALL +#define CDECL +#define CALLBACK +#define PASCAL +#endif +#define WINAPI STDCALL +#define APIENTRY STDCALL +#define WINGDIAPI + +#define _export + +/* + Enumerations +*/ +typedef enum _ACL_INFORMATION_CLASS { + AclRevisionInformation = 1, + AclSizeInformation +} ACL_INFORMATION_CLASS; + +typedef enum _MEDIA_TYPE { + Unknown, + F5_1Pt2_512, + F3_1Pt44_512, + F3_2Pt88_512, + F3_20Pt8_512, + F3_720_512, + F5_360_512, + F5_320_512, + F5_320_1024, + F5_180_512, + F5_160_512, + RemovableMedia, + FixedMedia +} MEDIA_TYPE; + +#define RASCS_DONE 0x2000 +#define RASCS_PAUSED 0x1000 +typedef enum _RASCONNSTATE { + RASCS_OpenPort = 0, + RASCS_PortOpened, + RASCS_ConnectDevice, + RASCS_DeviceConnected, + RASCS_AllDevicesConnected, + RASCS_Authenticate, + RASCS_AuthNotify, + RASCS_AuthRetry, + RASCS_AuthCallback, + RASCS_AuthChangePassword, + RASCS_AuthProject, + RASCS_AuthLinkSpeed, + RASCS_AuthAck, + RASCS_ReAuthenticate, + RASCS_Authenticated, + RASCS_PrepareForCallback, + RASCS_WaitForModemReset, + RASCS_WaitForCallback, + RASCS_Projected, + + RASCS_StartAuthentication, + RASCS_CallbackComplete, + RASCS_LogonNetwork, + + RASCS_Interactive = RASCS_PAUSED, + RASCS_RetryAuthentication, + RASCS_CallbackSetByCaller, + RASCS_PasswordExpired, + + RASCS_Connected = RASCS_DONE, + RASCS_Disconnected +} RASCONNSTATE ; + +typedef enum _RASPROJECTION { + RASP_Amb = 0x10000, + RASP_PppNbf = 0x803F, + RASP_PppIpx = 0x802B, + RASP_PppIp = 0x8021 +} RASPROJECTION ; + +typedef enum _SECURITY_IMPERSONATION_LEVEL { + SecurityAnonymous, + SecurityIdentification, + SecurityImpersonation, + SecurityDelegation +} SECURITY_IMPERSONATION_LEVEL; + +typedef enum _SID_NAME_USE { + SidTypeUser = 1, + SidTypeGroup, + SidTypeDomain, + SidTypeAlias, + SidTypeWellKnownGroup, + SidTypeDeletedAccount, + SidTypeInvalid, + SidTypeUnknown +} SID_NAME_USE, *PSID_NAME_USE; + +typedef enum _TOKEN_INFORMATION_CLASS { + TokenUser = 1, + TokenGroups, + TokenPrivileges, + TokenOwner, + TokenPrimaryGroup, + TokenDefaultDacl, + TokenSource, + TokenType, + TokenImpersonationLevel, + TokenStatistics +} TOKEN_INFORMATION_CLASS; + +typedef enum tagTOKEN_TYPE { + TokenPrimary = 1, + TokenImpersonation +} TOKEN_TYPE; + +#endif /* ! defined (RC_INVOKED) */ + +/* + Macros +*/ +#define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) (void)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(id), (LPARAM)(NMHDR FAR*)(pnmhdr)) + +#define GetBValue(rgb) ((BYTE) ((rgb) >> 16)) +#define GetGValue(rgb) ((BYTE) (((WORD) (rgb)) >> 8)) +#define GetRValue(rgb) ((BYTE) (rgb)) +#define RGB(r, g ,b) ((DWORD) (((BYTE) (r) | ((WORD) (g) << 8)) | (((DWORD) (BYTE) (b)) << 16))) + +#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) (fn)((hwnd), (int)(wParam), (NMHDR FAR*)(lParam)) + +#define HIBYTE(w) ((BYTE) (((WORD) (w) >> 8) & 0xFF)) +#define HIWORD(l) ((WORD) (((DWORD) (l) >> 16) & 0xFFFF)) +#define LOBYTE(w) ((BYTE) (w)) +#define LOWORD(l) ((WORD) (l)) +#define MAKELONG(a, b) ((LONG) (((WORD) (a)) | ((DWORD) ((WORD) (b))) << 16)) +#define MAKEWORD(a, b) ((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8)) + +/* original Cygnus headers also had the following defined: */ +#define SEXT_HIWORD(l) ((((int)l) >> 16)) +#define ZEXT_HIWORD(l) ((((unsigned int)l) >> 16)) +#define SEXT_LOWORD(l) ((int)(short)l) + +#define INDEXTOOVERLAYMASK(i) ((i) << 8) +#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12) + +#define MAKEINTATOM(i) (LPTSTR) ((DWORD) ((WORD) (i))) +#define MAKEINTRESOURCE(i) (LPTSTR) ((DWORD) ((WORD) (i))) + +#define MAKELANGID(p, s) ((((WORD) (s)) << 10) | (WORD) (p)) +#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff) +#define SUBLANGID(lgid) ((WORD )(lgid) >> 10) + +#define LANGIDFROMLCID(lcid) ((WORD) (lcid)) +#define SORTIDFROMLCID(lcid) ((WORD )((((DWORD)(lcid)) & 0x000FFFFF) >> 16)) +#define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD)(srtid))) << 16) | ((DWORD)((WORD)(lgid))))) +#define MAKELPARAM(l, h) ((LPARAM) MAKELONG(l, h)) +#define MAKELRESULT(l, h) ((LRESULT) MAKELONG(l, h)) +#define MAKEPOINTS(l) (*((POINTS FAR *) & (l))) +#define MAKEROP4(fore,back) (DWORD)((((back) << 8) & 0xFF000000) | (fore)) +#define MAKEWPARAM(l, h) ((WPARAM) MAKELONG(l, h)) + +#ifndef max +#define max(a, b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#define PALETTEINDEX(i) ((COLORREF) (0x01000000 | (DWORD) (WORD) (i))) +#define PALETTERGB(r, g, b) (0x02000000 | RGB(r, g, b)) +#define POINTSTOPOINT(pt, pts) {(pt).x = (SHORT) LOWORD(pts); (pt).y = (SHORT) HIWORD(pts);} +#define POINTTOPOINTS(pt) (MAKELONG((short) ((pt).x), (short) ((pt).y))) + +#define INDEXTOOVERLAYMASK(i) ((i) << 8) +#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12) + +#ifdef UNICODE +#define TEXT(quote) L##quote +#else +#define TEXT(quote) quote +#endif + +#ifndef RC_INVOKED + +/* + Definitions for callback procedures +*/ +typedef int CALLBACK (*BFFCALLBACK) (HWND, UINT, LPARAM, LPARAM); +typedef UINT CALLBACK (*LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM); +typedef UINT CALLBACK (*LPCFHOOKPROC) (HWND, UINT, WPARAM, LPARAM); +typedef DWORD CALLBACK (*PTHREAD_START_ROUTINE) (LPVOID); +typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; +typedef DWORD CALLBACK (*EDITSTREAMCALLBACK) (DWORD, LPBYTE, LONG, LONG); +typedef UINT CALLBACK (*LPFRHOOKPROC) (HWND, UINT, WPARAM, LPARAM); +typedef UINT CALLBACK (*LPOFNHOOKPROC) (HWND, UINT, WPARAM, LPARAM); +typedef UINT CALLBACK (*LPPRINTHOOKPROC) (HWND, UINT, WPARAM, LPARAM); +typedef UINT CALLBACK (*LPSETUPHOOKPROC) (HWND, UINT, WPARAM, LPARAM); +typedef WINBOOL CALLBACK (*DLGPROC) (HWND, UINT, WPARAM, LPARAM); +typedef int CALLBACK (*PFNPROPSHEETCALLBACK) (HWND, UINT, LPARAM); +typedef VOID CALLBACK (*LPSERVICE_MAIN_FUNCTION) (DWORD, LPTSTR); +typedef int CALLBACK (*PFNTVCOMPARE) (LPARAM, LPARAM, LPARAM); +typedef LRESULT CALLBACK (*WNDPROC) (HWND, UINT, WPARAM, LPARAM); +typedef int CALLBACK (*FARPROC)(void); +typedef FARPROC PROC; +typedef WINBOOL CALLBACK (*ENUMRESTYPEPROC) (HANDLE, LPTSTR, LONG); +typedef WINBOOL CALLBACK (*ENUMRESNAMEPROC) (HANDLE, LPCTSTR, LPTSTR, LONG); +typedef WINBOOL CALLBACK (*ENUMRESLANGPROC) (HANDLE, LPCTSTR, LPCTSTR, WORD, LONG); +typedef FARPROC DESKTOPENUMPROC; +typedef WINBOOL CALLBACK (*ENUMWINDOWSPROC) (HWND, LPARAM); +typedef WINBOOL CALLBACK (*ENUMWINDOWSTATIONPROC) (LPTSTR, LPARAM); +typedef VOID CALLBACK (*SENDASYNCPROC) (HWND, UINT, DWORD, LRESULT); +typedef VOID CALLBACK (*TIMERPROC) (HWND, UINT, UINT, DWORD); +typedef FARPROC GRAYSTRINGPROC; +typedef WINBOOL CALLBACK (*DRAWSTATEPROC) (HDC, LPARAM, WPARAM, int, int); +typedef WINBOOL CALLBACK (*PROPENUMPROCEX) (HWND, LPCTSTR, HANDLE, DWORD); +typedef WINBOOL CALLBACK (*PROPENUMPROC) (HWND, LPCTSTR, HANDLE); +typedef LRESULT CALLBACK (*HOOKPROC) (int, WPARAM, LPARAM); +typedef VOID CALLBACK (*ENUMOBJECTSPROC) (LPVOID, LPARAM); +typedef VOID CALLBACK (*LINEDDAPROC) (int, int, LPARAM); +typedef WINBOOL CALLBACK (*ABORTPROC) (HDC, int); +typedef UINT CALLBACK (*LPPAGEPAINTHOOK) (HWND, UINT, WPARAM, LPARAM ); +typedef UINT CALLBACK (*LPPAGESETUPHOOK) (HWND, UINT, WPARAM, LPARAM ); +typedef int CALLBACK (*ICMENUMPROC) (LPTSTR, LPARAM); +typedef LONG (*EDITWORDBREAKPROCEX) (char *, LONG, BYTE, INT); +typedef int CALLBACK (*PFNLVCOMPARE) (LPARAM, LPARAM, LPARAM); +typedef WINBOOL CALLBACK (*LOCALE_ENUMPROC) (LPTSTR); +typedef WINBOOL CALLBACK (*CODEPAGE_ENUMPROC) (LPTSTR); +typedef WINBOOL CALLBACK (*DATEFMT_ENUMPROC) (LPTSTR); +typedef WINBOOL CALLBACK (*TIMEFMT_ENUMPROC) (LPTSTR); +typedef WINBOOL CALLBACK (*CALINFO_ENUMPROC) (LPTSTR); +typedef WINBOOL CALLBACK (*PHANDLER_ROUTINE) (DWORD); +typedef WINBOOL CALLBACK (*LPHANDLER_FUNCTION) (DWORD); +typedef UINT CALLBACK (*PFNGETPROFILEPATH) (LPCTSTR, LPSTR, UINT); +typedef UINT CALLBACK (*PFNRECONCILEPROFILE) (LPCTSTR, LPCTSTR, DWORD); +typedef WINBOOL CALLBACK (*PFNPROCESSPOLICIES) (HWND, LPCTSTR, LPCTSTR, LPCTSTR, DWORD); + +#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} +#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} +#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} +#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} +#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} +#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} + +#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege") +#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege") +#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege") +#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege") +#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege") +#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege") +#define SE_TCB_NAME TEXT("SeTcbPrivilege") +#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") +#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege") +#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege") +#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege") +#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege") +#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege") +#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege") +#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege") +#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege") +#define SE_BACKUP_NAME TEXT("SeBackupPrivilege") +#define SE_RESTORE_NAME TEXT("SeRestorePrivilege") +#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege") +#define SE_DEBUG_NAME TEXT("SeDebugPrivilege") +#define SE_AUDIT_NAME TEXT("SeAuditPrivilege") +#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege") +#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") +#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") + +#define SERVICES_ACTIVE_DATABASEW L"ServicesActive" +#define SERVICES_FAILED_DATABASEW L"ServicesFailed" +#define SERVICES_ACTIVE_DATABASEA "ServicesActive" +#define SERVICES_FAILED_DATABASEA "ServicesFailed" +#define SC_GROUP_IDENTIFIERW L'+' +#define SC_GROUP_IDENTIFIERA '+' + +#ifdef UNICODE +#define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEW +#define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEW +#define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERW +#else +#define SERVICES_ACTIVE_DATABASE SERVICES_ACTIVE_DATABASEA +#define SERVICES_FAILED_DATABASE SERVICES_FAILED_DATABASEA +#define SC_GROUP_IDENTIFIER SC_GROUP_IDENTIFIERA +#endif /* UNICODE */ + +/* ---------------------------------- */ +/* From ddeml.h in old Cygnus headers */ + +typedef void (*CALLB) (void); +typedef CALLB PFNCALLBACK; + +typedef WINBOOL SECURITY_CONTEXT_TRACKING_MODE; + +/* End of stuff from ddeml.h in old Cygnus headers */ +/* ----------------------------------------------- */ + +typedef FARPROC WNDENUMPROC; +typedef FARPROC ENHMFENUMPROC; +typedef DWORD CCSTYLE, *PCCSTYLE, *LPCCSTYLE; +typedef DWORD CCSTYLEFLAGA, *PCCSTYLEFLAGA, *LPCCSTYLEFLAGA; +#define DECLARE_HANDLE(s) typedef HANDLE s + +#endif /* ! defined (RC_INVOKED) */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_BASE */ diff --git a/reactos/include/coff.h b/reactos/include/coff.h new file mode 100644 index 00000000000..9eb5d0131cf --- /dev/null +++ b/reactos/include/coff.h @@ -0,0 +1,339 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#ifndef __dj_include_coff_h_ +#define __dj_include_coff_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +//#ifndef __dj_ENFORCE_ANSI_FREESTANDING + +//#ifndef __STRICT_ANSI__ + +//#ifndef _POSIX_SOURCE + +/*** coff information for Intel 386/486. */ + +/********************** FILE HEADER **********************/ + +struct external_filehdr { + unsigned short f_magic; /* magic number */ + unsigned short f_nscns; /* number of sections */ + unsigned long f_timdat; /* time & date stamp */ + unsigned long f_symptr; /* file pointer to symtab */ + unsigned long f_nsyms; /* number of symtab entries */ + unsigned short f_opthdr; /* sizeof(optional hdr) */ + unsigned short f_flags; /* flags */ +}; + + +/* Bits for f_flags: + * F_RELFLG relocation info stripped from file + * F_EXEC file is executable (no unresolved external references) + * F_LNNO line numbers stripped from file + * F_LSYMS local symbols stripped from file + * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) + */ + +#define F_RELFLG (0x0001) +#define F_EXEC (0x0002) +#define F_LNNO (0x0004) +#define F_LSYMS (0x0008) + + + +#define I386MAGIC 0x14c +#define I386AIXMAGIC 0x175 +#define I386BADMAG(x) (((x).f_magic!=I386MAGIC) && (x).f_magic!=I386AIXMAGIC) + + +#define FILHDR struct external_filehdr +#define FILHSZ sizeof(FILHDR) + + +/********************** AOUT "OPTIONAL HEADER" **********************/ + + +typedef struct +{ + unsigned short magic; /* type of file */ + unsigned short vstamp; /* version stamp */ + unsigned long tsize; /* text size in bytes, padded to FW bdry*/ + unsigned long dsize; /* initialized data " " */ + unsigned long bsize; /* uninitialized data " " */ + unsigned long entry; /* entry pt. */ + unsigned long text_start; /* base of text used for this file */ + unsigned long data_start; /* base of data used for this file */ +} +AOUTHDR; + + +typedef struct gnu_aout { + unsigned long info; + unsigned long tsize; + unsigned long dsize; + unsigned long bsize; + unsigned long symsize; + unsigned long entry; + unsigned long txrel; + unsigned long dtrel; + } GNU_AOUT; + +#define AOUTSZ (sizeof(AOUTHDR)) + +#define OMAGIC 0404 /* object files, eg as output */ +#define ZMAGIC 0413 /* demand load format, eg normal ld output */ +#define STMAGIC 0401 /* target shlib */ +#define SHMAGIC 0443 /* host shlib */ + + +/********************** SECTION HEADER **********************/ + + +struct external_scnhdr { + char s_name[8]; /* section name */ + unsigned long s_paddr; /* physical address, aliased s_nlib */ + unsigned long s_vaddr; /* virtual address */ + unsigned long s_size; /* section size */ + unsigned long s_scnptr; /* file ptr to raw data for section */ + unsigned long s_relptr; /* file ptr to relocation */ + unsigned long s_lnnoptr; /* file ptr to line numbers */ + unsigned short s_nreloc; /* number of relocation entries */ + unsigned short s_nlnno; /* number of line number entries*/ + unsigned long s_flags; /* flags */ +}; + +#define SCNHDR struct external_scnhdr +#define SCNHSZ sizeof(SCNHDR) + +/* + * names of "special" sections + */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" +#define _COMMENT ".comment" +#define _LIB ".lib" + +/* + * s_flags "type" + */ +#define STYP_TEXT (0x0020) /* section contains text only */ +#define STYP_DATA (0x0040) /* section contains data only */ +#define STYP_BSS (0x0080) /* section contains bss only */ + +/********************** LINE NUMBERS **********************/ + +/* 1 line number entry for every "breakpointable" source line in a section. + * Line numbers are grouped on a per function basis; first entry in a function + * grouping will have l_lnno = 0 and in place of physical address will be the + * symbol table index of the function name. + */ +struct external_lineno { + union { + unsigned long l_symndx __attribute__((packed)); /* function name symbol index, iff l_lnno == 0 */ + unsigned long l_paddr __attribute__((packed)); /* (physical) address of line number */ + } l_addr; + unsigned short l_lnno; /* line number */ +}; + + +#define LINENO struct external_lineno +#define LINESZ sizeof(LINENO) + + +/********************** SYMBOLS **********************/ + +#define E_SYMNMLEN 8 /* # characters in a symbol name */ +#define E_FILNMLEN 14 /* # characters in a file name */ +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +struct external_syment +{ + union { + char e_name[E_SYMNMLEN]; + struct { + unsigned long e_zeroes __attribute__((packed)); + unsigned long e_offset __attribute__((packed)); + } e; + } e; + unsigned long e_value __attribute__((packed)); + short e_scnum; + unsigned short e_type; + unsigned char e_sclass; + unsigned char e_numaux; +}; + +#define N_BTMASK (0xf) +#define N_TMASK (0x30) +#define N_BTSHFT (4) +#define N_TSHIFT (2) + +union external_auxent { + struct { + unsigned long x_tagndx __attribute__((packed)); /* str, un, or enum tag indx */ + union { + struct { + unsigned short x_lnno; /* declaration line number */ + unsigned short x_size; /* str/union/array size */ + } x_lnsz; + unsigned long x_fsize __attribute__((packed)); /* size of function */ + } x_misc; + union { + struct { /* if ISFCN, tag, or .bb */ + unsigned long x_lnnoptr __attribute__((packed)); /* ptr to fcn line # */ + unsigned long x_endndx __attribute__((packed)); /* entry ndx past block end */ + } x_fcn; + struct { /* if ISARY, up to 4 dimen. */ + unsigned short x_dimen[E_DIMNUM]; + } x_ary; + } x_fcnary; + unsigned short x_tvndx; /* tv index */ + } x_sym; + + union { + char x_fname[E_FILNMLEN]; + struct { + unsigned long x_zeroes __attribute__((packed)); + unsigned long x_offset __attribute__((packed)); + } x_n; + } x_file; + + struct { + unsigned long x_scnlen __attribute__((packed)); /* section length */ + unsigned short x_nreloc; /* # relocation entries */ + unsigned short x_nlinno; /* # line numbers */ + } x_scn; + + struct { + unsigned long x_tvfill __attribute__((packed)); /* tv fill value */ + unsigned short x_tvlen; /* length of .tv */ + unsigned short x_tvran[2]; /* tv range */ + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ + + +}; + +#define SYMENT struct external_syment +#define SYMESZ sizeof(SYMENT) +#define AUXENT union external_auxent +#define AUXESZ sizeof(AUXENT) + + +# define _ETEXT "etext" + + +/* Relocatable symbols have number of the section in which they are defined, + or one of the following: */ + +#define N_UNDEF ((short)0) /* undefined symbol */ +#define N_ABS ((short)-1) /* value of symbol is absolute */ +#define N_DEBUG ((short)-2) /* debugging symbol -- value is meaningless */ +#define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ +#define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/ + +/* + * Type of a symbol, in low N bits of the word + */ +#define T_NULL 0 +#define T_VOID 1 /* function argument (only used by compiler) */ +#define T_CHAR 2 /* character */ +#define T_SHORT 3 /* short integer */ +#define T_INT 4 /* integer */ +#define T_LONG 5 /* long integer */ +#define T_FLOAT 6 /* floating point */ +#define T_DOUBLE 7 /* double word */ +#define T_STRUCT 8 /* structure */ +#define T_UNION 9 /* union */ +#define T_ENUM 10 /* enumeration */ +#define T_MOE 11 /* member of enumeration*/ +#define T_UCHAR 12 /* unsigned character */ +#define T_USHORT 13 /* unsigned short */ +#define T_UINT 14 /* unsigned integer */ +#define T_ULONG 15 /* unsigned long */ +#define T_LNGDBL 16 /* long double */ + +/* + * derived types, in n_type +*/ +#define DT_NON (0) /* no derived type */ +#define DT_PTR (1) /* pointer */ +#define DT_FCN (2) /* function */ +#define DT_ARY (3) /* array */ + +#define BTYPE(x) ((x) & N_BTMASK) + +#define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT)) +#define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT)) +#define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT)) +#define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG) +#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) + +/********************** STORAGE CLASSES **********************/ + +/* This used to be defined as -1, but now n_sclass is unsigned. */ +#define C_EFCN 0xff /* physical end of function */ +#define C_NULL 0 +#define C_AUTO 1 /* automatic variable */ +#define C_EXT 2 /* external symbol */ +#define C_STAT 3 /* static */ +#define C_REG 4 /* register variable */ +#define C_EXTDEF 5 /* external definition */ +#define C_LABEL 6 /* label */ +#define C_ULABEL 7 /* undefined label */ +#define C_MOS 8 /* member of structure */ +#define C_ARG 9 /* function argument */ +#define C_STRTAG 10 /* structure tag */ +#define C_MOU 11 /* member of union */ +#define C_UNTAG 12 /* union tag */ +#define C_TPDEF 13 /* type definition */ +#define C_USTATIC 14 /* undefined static */ +#define C_ENTAG 15 /* enumeration tag */ +#define C_MOE 16 /* member of enumeration */ +#define C_REGPARM 17 /* register parameter */ +#define C_FIELD 18 /* bit field */ +#define C_AUTOARG 19 /* auto argument */ +#define C_LASTENT 20 /* dummy entry (end of block) */ +#define C_BLOCK 100 /* ".bb" or ".eb" */ +#define C_FCN 101 /* ".bf" or ".ef" */ +#define C_EOS 102 /* end of structure */ +#define C_FILE 103 /* file name */ +#define C_LINE 104 /* line # reformatted as symbol table entry */ +#define C_ALIAS 105 /* duplicate tag */ +#define C_HIDDEN 106 /* ext symbol in dmert public lib */ + +/********************** RELOCATION DIRECTIVES **********************/ + + + +struct external_reloc { + unsigned long r_vaddr __attribute__((packed)); + unsigned long r_symndx __attribute__((packed)); + unsigned short r_type; +}; + + +#define RELOC struct external_reloc +#define RELSZ sizeof(RELOC) + +#define RELOC_REL32 20 /* 32-bit PC-relative address */ +#define RELOC_ADDR32 6 /* 32-bit absolute address */ + +#define DEFAULT_DATA_SECTION_ALIGNMENT 4 +#define DEFAULT_BSS_SECTION_ALIGNMENT 4 +#define DEFAULT_TEXT_SECTION_ALIGNMENT 4 +/* For new sections we havn't heard of before */ +#define DEFAULT_SECTION_ALIGNMENT 4 + +//#endif /* !_POSIX_SOURCE */ +//#endif /* !__STRICT_ANSI__ */ +//#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ + +#ifndef __dj_ENFORCE_FUNCTION_CALLS +#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ + +#ifdef __cplusplus +} +#endif + +#endif /* !__dj_include_coff_h_ */ diff --git a/reactos/include/ddk/cfgtypes.h b/reactos/include/ddk/cfgtypes.h new file mode 100644 index 00000000000..ae318a70b7f --- /dev/null +++ b/reactos/include/ddk/cfgtypes.h @@ -0,0 +1,72 @@ + +// registry key structures + + +typedef struct _KEY_BASIC_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG NameLength; + WCHAR Name[1]; // variable size +} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION; + +typedef struct _KEY_NODE_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG NameLength; + WCHAR Name[1]; // variable size +} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION; + +typedef struct _KEY_FULL_INFORMATION { + LARGE_INTEGER LastWriteTime; + ULONG TitleIndex; + ULONG ClassOffset; + ULONG ClassLength; + ULONG SubKeys; + ULONG MaxNameLen; + ULONG MaxClassLen; + ULONG Values; + ULONG MaxValueNameLen; + ULONG MaxValueDataLen; + WCHAR Class[1]; // variable size +} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION; + + +typedef struct _KEY_WRITE_TIME_INFORMATION { + LARGE_INTEGER LastWriteTime; +} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION; + + +// key query value structures + +typedef struct _KEY_VALUE_BASIC_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG NameLength; + WCHAR Name[1]; // variable size +} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION; + +typedef struct _KEY_VALUE_FULL_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG DataOffset; + ULONG DataLength; + ULONG NameLength; + WCHAR Name[1]; // variable size +} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION; + +typedef struct _KEY_VALUE_PARTIAL_INFORMATION { + ULONG TitleIndex; + ULONG Type; + ULONG DataLength; + UCHAR Data[1]; // variable size +} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION; + +typedef struct _KEY_VALUE_ENTRY { + PUNICODE_STRING ValueName; + ULONG DataLength; + ULONG DataOffset; + ULONG Type; +} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY; + diff --git a/reactos/include/ddk/defines.h b/reactos/include/ddk/defines.h new file mode 100644 index 00000000000..d7c662b2898 --- /dev/null +++ b/reactos/include/ddk/defines.h @@ -0,0 +1,521 @@ +/* GENERAL DEFINITIONS ****************************************************/ + +#include + + + +/* + * PURPOSE: Number of a thread priority levels + */ +#define NR_PRIORITY_LEVELS (32) + +/* + * PURPOSE: Type of queue to insert a work item in + */ +enum +{ + CriticalWorkQueue, + DelayedWorkQueue, + HyperCriticalWorkQueue, +}; + +/* + * Types of memory to allocate + */ +enum +{ + NonPagedPool, + NonPagedPoolMustSucceed, + NonPagedPoolCacheAligned, + NonPagedPoolCacheAlignedMustS, + PagedPool, + PagedPoolCacheAligned, +}; + +/* + * PURPOSE: Irp flags + */ +enum +{ + /* + * Read any data from the actual backing media + */ + IRP_NOCACHE, + + /* + * The I/O operation is performing paging + */ + IRP_PAGING_IO, + + /* + * The IRP is for a mount operation + */ + IRP_MOUNT_COMPLETION, + + /* + * The API expects synchronous behaviour + */ + IRP_SYNCHRONOUS_API, + + /* + * The IRP is associated with a larger operation + */ + IRP_ASSOCIATED_IRP, + + /* + * The AssociatedIrp.SystemBuffer field is valid + */ + IRP_BUFFERED_IO, + + /* + * The system buffer was allocated from pool and should be deallocated + * by the I/O manager + */ + IRP_DEALLOCATE_BUFFER, + + /* + * The IRP is for an input operation + */ + IRP_INPUT_OPERATION, + + /* + * The paging operation should complete synchronously + */ + IRP_SYNCHRONOUS_PAGING_IO, + + /* + * The IRP represents a filesystem create operation + */ + IRP_CREATE_OPERATION, + + /* + * The IRP represents a filesystem read operation + */ + IRP_READ_OPERATION, + + /* + * The IRP represents a filesystem write operation + */ + IRP_WRITE_OPERATION, + + /* + * The IRP represents a filesystem close operation + */ + IRP_CLOSE_OPERATION, + + /* + * Asynchronous behavior is advised but not required + */ + IRP_DEFER_IO_COMPLETION, +}; + +/* + * I/O operation flags + */ +enum +{ + /* + * Force an access check even if opened in kernel mode + */ + SL_FORCE_ACCESS_CHECK, + + /* + * The file being opened is a paging file + */ + SL_OPEN_PAGING_FILE, + + SL_OPEN_TARGET_DIRECTORY, + + SL_CASE_SENSITIVE, + + SL_KEY_SPECIFIED, + + SL_OVERRIDE_VERIFY_VOLUME, + + SL_WRITE_THROUGH, + + SL_FT_SEQUENTIAL_WRITE, + + SL_FAIL_IMMEDIATELY, + + SL_EXCLUSIVE_LOCK, + + SL_RESTART_SCAN, + + SL_RETURN_SINGLE_ENTRY, + + SL_INDEX_SPECIFIED, + + SL_WATCH_TREE, + + SL_ALLOW_RAW_MOUNT, +}; + +/* + * Possible flags for the device object flags + */ +enum +{ + DO_BUFFERED_IO = 0x1, + DO_DIRECT_IO = 0x2, +}; + +/* + * Possible status codes + * FIXME: These may not be the actual values used by NT + */ +enum +{ + STATUS_SUCCESS, + STATUS_INSUFFICIENT_RESOURCES, + STATUS_OBJECT_NAME_EXISTS, + STATUS_OBJECT_NAME_COLLISION, +// STATUS_DATATYPE_MISALIGNMENT, + STATUS_CTL_FILE_NOT_SUPPORTED, +// STATUS_ACCESS_VIOLATION, + STATUS_PORT_ALREADY_SET, + STATUS_SECTION_NOT_IMAGE, + STATUS_BAD_WORKING_SET_LIMIT, + STATUS_INCOMPATIBLE_FILE_MAP, + STATUS_HANDLE_NOT_WAITABLE, + STATUS_PORT_DISCONNECTED, + STATUS_NOT_LOCKED, + STATUS_NOT_MAPPED_VIEW, + STATUS_UNABLE_TO_FREE_VM, + STATUS_UNABLE_TO_DELETE_SECTION, + STATUS_MORE_PROCESSING_REQUIRED, + STATUS_INVALID_CID, + STATUS_BAD_INITIAL_STACK, + STATUS_INVALID_VOLUME_LABEL, + STATUS_SECTION_NOT_EXTENDED, + STATUS_NOT_MAPPED_DATA, + STATUS_INFO_LENGTH_MISMATCH, + STATUS_INVALID_INFO_CLASS, + STATUS_SUSPEND_COUNT_EXCEEDED, + STATUS_NOTIFY_ENUM_DIR, + STATUS_REGISTRY_RECOVERED, + STATUS_REGISTRY_IO_FAILED, + STATUS_KEY_DELETED, + STATUS_NO_LOG_SPACE, + STATUS_KEY_HAS_CHILDREN, + STATUS_CHILD_MUST_BE_VOLATILE, + STATUS_REGISTRY_CORRUPT, + STATUS_DLL_NOT_FOUND, + STATUS_DLL_INIT_FAILED, + STATUS_ORDINAL_NOT_FOUND, + STATUS_ENTRYPOINT_NOT_FOUND, +// STATUS_PENDING, + STATUS_MORE_ENTRIES, +// STATUS_INTEGER_OVERFLOW, + STATUS_BUFFER_OVERFLOW, + STATUS_NO_MORE_FILES, + STATUS_NO_INHERITANCE, + STATUS_NO_MORE_EAS, + STATUS_NO_MORE_ENTRIES, + STATUS_GUIDS_EXHAUSTED, + STATUS_AGENTS_EXHAUSTED, + STATUS_UNSUCCESSFUL, + STATUS_NOT_IMPLEMENTED, + STATUS_ILLEGAL_FUNCTION, +// STATUS_IN_PAGE_ERROR, + STATUS_PAGEFILE_QUOTA, + STATUS_COMMITMENT_LIMIT, + STATUS_SECTION_TOO_BIG, + RPC_NT_SS_IN_NULL_CONTEXT, + RPC_NT_INVALID_BINDING, +// STATUS_INVALID_HANDLE, + STATUS_OBJECT_FILE_MISMATCH, + STATUS_FILE_CLOSED, + STATUS_INVALID_PORT_HANDLE, + STATUS_NOT_COMMITTED, + STATUS_INVALID_PARAMETER, + STATUS_INVALID_PARAMETER_1, + STATUS_INVALID_PARAMETER_2, + STATUS_INVALID_PARAMETER_3, + STATUS_INVALID_PARAMETER_4, + STATUS_INVALID_PARAMETER_5, + STATUS_INVALID_PARAMETER_6, + STATUS_INVALID_PARAMETER_7, + STATUS_INVALID_PARAMETER_8, + STATUS_INVALID_PARAMETER_9, + STATUS_INVALID_PARAMETER_10, + STATUS_INVALID_PARAMETER_11, + STATUS_INVALID_PARAMETER_12, + STATUS_INVALID_PARAMETER_MAX, + STATUS_INVALID_PAGE_PROTECTION, + STATUS_RESOURCE_DATA_NOT_FOUND, + STATUS_RESOURCE_TYPE_NOT_FOUND, + STATUS_RESOURCE_NAME_NOT_FOUND, + STATUS_RESOURCE_LANG_NOT_FOUND, + STATUS_NO_SUCH_DEVICE, + STATUS_NO_SUCH_FILE, + STATUS_INVALID_DEVICE_REQUEST, + STATUS_END_OF_FILE, + STATUS_FILE_FORCED_CLOSED, + STATUS_WRONG_VOLUME, + STATUS_NO_MEDIA, + STATUS_NO_MEDIA_IN_DEVICE, + STATUS_NONEXISTENT_SECTOR, + STATUS_WORKING_SET_QUOTA, +// STATUS_NO_MEMORY, + STATUS_CONFLICTING_ADDRESS, + STATUS_INVALID_SYSTEM_SERVICE, + STATUS_THREAD_IS_TERMINATING, + STATUS_PROCESS_IS_TERMINATING, + STATUS_INVALID_LOCK_SEQUENCE, + STATUS_INVALID_VIEW_SIZE, + STATUS_ALREADY_COMMITTED, + STATUS_ACCESS_DENIED, + STATUS_FILE_IS_A_DIRECTORY, + STATUS_CANNOT_DELETE, + STATUS_INVALID_COMPUTER_NAME, + STATUS_FILE_DELETED, + STATUS_DELETE_PENDING, + STATUS_PORT_CONNECTION_REFUSED, + STATUS_NO_SUCH_PRIVILEGE, + STATUS_PRIVILEGE_NOT_HELD, + STATUS_CANNOT_IMPERSONATE, + STATUS_LOGON_FAILURE, + STATUS_ACCOUNT_RESTRICTION, + STATUS_INVALID_LOGON_HOURS, + STATUS_INVALID_WORKSTATION, + STATUS_BUFFER_TOO_SMALL, + STATUS_UNABLE_TO_DECOMMIT_VM, + STATUS_DISK_CORRUPT_ERROR, + STATUS_OBJECT_NAME_INVALID, + STATUS_OBJECT_NAME_NOT_FOUND, +// STATUS_OBJECT_NAME_COLLISION, + STATUS_OBJECT_PATH_INVALID, + STATUS_OBJECT_PATH_NOT_FOUND, + STATUS_DFS_EXIT_PATH_FOUND, + STATUS_OBJECT_PATH_SYNTAX_BAD, + STATUS_DATA_OVERRUN, + STATUS_DATA_LATE_ERROR, + STATUS_DATA_ERROR, + STATUS_CRC_ERROR, + STATUS_SHARING_VIOLATION, + STATUS_QUOTA_EXCEEDED, + STATUS_MUTANT_NOT_OWNED, + STATUS_SEMAPHORE_LIMIT_EXCEEDED, + STATUS_DISK_FULL, + STATUS_LOCK_NOT_GRANTED, +}; + +/* + * Possible device types + */ +enum +{ + /* + * Standard define types + */ + FILE_DEVICE_BEEP, + FILE_DEVICE_CDROM, + FILE_DEVICE_CONTROLLER, + FILE_DEVICE_DISK, + FILE_DEVICE_INPORT_PORT, + FILE_DEVICE_KEYBOARD, + FILE_DEVICE_MIDI_IN, + FILE_DEVICE_MIDI_OUT, + FILE_DEVICE_MOUSE, + FILE_DEVICE_NULL, + FILE_DEVICE_PARALLEL_PORT, + FILE_DEVICE_PRINTER, + FILE_DEVICE_SCANNER, + FILE_DEVICE_SERIAL_MOUSE_PORT, + FILE_DEVICE_SERIAL_PORT, + FILE_DEVICE_SCREEN, + FILE_DEVICE_TAPE, + FILE_DEVICE_UNKNOWN, + FILE_DEVICE_VIDEO, + FILE_DEVICE_VIRTUAL_DISK, + FILE_DEVICE_WAVE_IN, + FILE_DEVICE_WAVE_OUT, + FILE_DEVICE_8042_PORT, + + /* + * Values beyond this are reserved for ISVs + */ + FILE_DEVICE_FIRST_FREE = 32768 +}; + + + +/* + * Possible device characteristics + */ +enum +{ + FILE_REMOVABLE_MEDIA = 0x1, + FILE_READ_ONLY_DEVICE = 0x2, + FILE_FLOPPY_DISKETTE = 0x4, + FILE_WRITE_ONCE_MEDIA = 0x8, + FILE_REMOTE_DEVICE = 0x10, +}; + +/* + * PURPOSE: Bus types + */ +enum +{ + Internal, + Isa, + MicroChannel, + TurboChannel, + PCIBus, + MaximumInterfaceType, +}; + +/* + * This is a list of bug check types (not MS's) + */ +enum +{ + KBUG_NONE, + KBUG_ORPHANED_IRP, + KBUG_IO_STACK_OVERFLOW, + KBUG_OUT_OF_MEMORY, + KBUG_POOL_FREE_LIST_CORRUPT, + + /* + * These are well known but the actual value is unknown + */ + NO_PAGES_AVAILABLE, + + /* + * These are well known (MS) bug types + * (Reference: NT Insider 1997 - http://www.osr.com) + */ + IRQL_NOT_LESS_OR_EQUAL = 0xa, + KMODE_EXCEPTION_NOT_HANDLED = 0x1e, + UNEXPECTED_KERNEL_MODE_TRAP = 0x7f, + PAGE_FAULT_IN_NON_PAGED_AREA = 0x50, +}; + +/* + * PURPOSE: Object attributes + */ +enum +{ + OBJ_INHERIT = 0x1, + OBJ_PERMANENT = 0x2, + OBJ_EXCLUSIVE = 0x4, + OBJ_CASE_INSENSITIVE = 0x8, + OBJ_OPENIF = 0x10, +}; + +/* + * PURPOSE: DPC priorities + */ +enum +{ + High, + Medium, + Low, +}; + +/* + * PURPOSE: Timer types + */ +enum + { + NotificationTimer, + SynchronizationTimer, + }; + +/* + * PURPOSE: Some drivers use these + */ +#define IN +#define OUT +#define OPTIONAL + +/* + * PURPOSE: Power IRP minor function numbers + */ +enum +{ + IRP_MN_QUERY_POWER, + IRP_MN_SET_POWER, + IRP_MN_WAIT_WAKE, + IRP_MN_QUERY_CAPABILITIES, + IRP_MN_POWER_SEQUENCE, +}; + +/* + * FIXME: These are not in the correct order + */ +enum +{ + IRP_MJ_CREATE, + IRP_MJ_CREATE_NAMED_PIPE, + IRP_MJ_CLOSE, + IRP_MJ_READ, + IRP_MJ_WRITE, + IRP_MJ_QUERY_INFORMATION, + IRP_MJ_SET_INFORMATION, + IRP_MJ_QUERY_EA, + IRP_MJ_SET_EA, + IRP_MJ_FLUSH_BUFFERS, + IRP_MJ_QUERY_VOLUME_INFORMATION, + IRP_MJ_SET_VOLUME_INFORMATION, + IRP_MJ_DIRECTORY_CONTROL, + IRP_MJ_FILE_SYSTEM_CONTROL, + IRP_MJ_DEVICE_CONTROL, + IRP_MJ_INTERNAL_DEVICE_CONTROL, + IRP_MJ_SHUTDOWN, + IRP_MJ_LOCK_CONTROL, + IRP_MJ_CLEANUP, + IRP_MJ_CREATE_MAILSLOT, + IRP_MJ_QUERY_SECURITY, + IRP_MJ_SET_SECURITY, + IRP_MJ_QUERY_POWER, + IRP_MJ_SET_POWER, + IRP_MJ_DEVICE_CHANGE, + IRP_MJ_QUERY_QUOTA, + IRP_MJ_SET_QUOTA, + IRP_MJ_PNP_POWER, + IRP_MJ_MAXIMUM_FUNCTION, +}; + +/* + * PURPOSE: Used all over + */ +enum +{ + KernelMode, + UserMode, +}; + +/* + * PURPOSE: Arguments to MmProbeAndLockPages + */ +enum +{ + IoReadAccess, + IoWriteAccess, + IoModifyAccess, +}; + +#define MAXIMUM_VOLUME_LABEL_LENGTH (32) + +/* + * IRQ levels + */ +enum +{ + PASSIVE_LEVEL, + + /* + * Which order for these (only DISPATCH_LEVEL is important for now) + */ + APC_LEVEL, + DISPATCH_LEVEL, + + /* + * Above here are device specific IRQ levels + */ + FIRST_DEVICE_SPECIFIC_LEVEL, + HIGH_LEVEL = FIRST_DEVICE_SPECIFIC_LEVEL + NR_DEVICE_SPECIFIC_LEVELS, +}; + diff --git a/reactos/include/ddk/exfuncs.h b/reactos/include/ddk/exfuncs.h new file mode 100644 index 00000000000..224241ae768 --- /dev/null +++ b/reactos/include/ddk/exfuncs.h @@ -0,0 +1,35 @@ +/* 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); + diff --git a/reactos/include/ddk/extypes.h b/reactos/include/ddk/extypes.h new file mode 100644 index 00000000000..81ed7c368e6 --- /dev/null +++ b/reactos/include/ddk/extypes.h @@ -0,0 +1,18 @@ +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; diff --git a/reactos/include/ddk/iofuncs.h b/reactos/include/ddk/iofuncs.h new file mode 100644 index 00000000000..4b4499cf96d --- /dev/null +++ b/reactos/include/ddk/iofuncs.h @@ -0,0 +1,504 @@ +/* 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); diff --git a/reactos/include/ddk/iotypes.h b/reactos/include/ddk/iotypes.h new file mode 100644 index 00000000000..08696017c7a --- /dev/null +++ b/reactos/include/ddk/iotypes.h @@ -0,0 +1,393 @@ +/* + * + */ + +#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 diff --git a/reactos/include/ddk/kefuncs.h b/reactos/include/ddk/kefuncs.h new file mode 100644 index 00000000000..bbc42d2f30b --- /dev/null +++ b/reactos/include/ddk/kefuncs.h @@ -0,0 +1,124 @@ +/* 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); diff --git a/reactos/include/ddk/ketypes.h b/reactos/include/ddk/ketypes.h new file mode 100644 index 00000000000..32f5348a1e1 --- /dev/null +++ b/reactos/include/ddk/ketypes.h @@ -0,0 +1,141 @@ +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; diff --git a/reactos/include/ddk/mmfuncs.h b/reactos/include/ddk/mmfuncs.h new file mode 100644 index 00000000000..4c0b8fce3d9 --- /dev/null +++ b/reactos/include/ddk/mmfuncs.h @@ -0,0 +1,285 @@ +/* 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); diff --git a/reactos/include/ddk/mmtypes.h b/reactos/include/ddk/mmtypes.h new file mode 100644 index 00000000000..bf3cd42251a --- /dev/null +++ b/reactos/include/ddk/mmtypes.h @@ -0,0 +1,24 @@ +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; diff --git a/reactos/include/ddk/ntddk.h b/reactos/include/ddk/ntddk.h new file mode 100644 index 00000000000..dcd5805717a --- /dev/null +++ b/reactos/include/ddk/ntddk.h @@ -0,0 +1,41 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: include/ddk/ntddk.h + * PURPOSE: Interface definitions for drivers + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + * 15/05/98: Created + */ + +#ifndef __NTDDK_H +#define __NTDDK_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* INCLUDES ***************************************************************/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +}; +#endif + +#endif /* __NTDDK_H */ + diff --git a/reactos/include/ddk/obfuncs.h b/reactos/include/ddk/obfuncs.h new file mode 100644 index 00000000000..76cb1c2db71 --- /dev/null +++ b/reactos/include/ddk/obfuncs.h @@ -0,0 +1,44 @@ +/* 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); diff --git a/reactos/include/ddk/obtypes.h b/reactos/include/ddk/obtypes.h new file mode 100644 index 00000000000..41f5baeae08 --- /dev/null +++ b/reactos/include/ddk/obtypes.h @@ -0,0 +1,149 @@ +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; diff --git a/reactos/include/ddk/psfuncs.h b/reactos/include/ddk/psfuncs.h new file mode 100644 index 00000000000..cbbb9dbba92 --- /dev/null +++ b/reactos/include/ddk/psfuncs.h @@ -0,0 +1,27 @@ + + +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); diff --git a/reactos/include/ddk/pstypes.h b/reactos/include/ddk/pstypes.h new file mode 100644 index 00000000000..e7fdeb4be09 --- /dev/null +++ b/reactos/include/ddk/pstypes.h @@ -0,0 +1,111 @@ +#ifndef __INCLUDE_DDK_PSTYPES_H +#define __INCLUDE_DDK_PSTYPES_H + +#include + +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 */ diff --git a/reactos/include/ddk/rtl.h b/reactos/include/ddk/rtl.h new file mode 100644 index 00000000000..f4ad7716d1d --- /dev/null +++ b/reactos/include/ddk/rtl.h @@ -0,0 +1,184 @@ +/* + * + */ + +#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 */ diff --git a/reactos/include/ddk/structs.h b/reactos/include/ddk/structs.h new file mode 100644 index 00000000000..6ea04d0a791 --- /dev/null +++ b/reactos/include/ddk/structs.h @@ -0,0 +1,318 @@ +/* SYSTEM STRUCTURES ******************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * PURPOSE: Thread object + */ +typedef struct +{ + CSHORT Type; + CSHORT Size; + + /* + * PURPOSE: Entry in the linked list of threads + */ + LIST_ENTRY Entry; + + /* + * PURPOSE: Current state of the thread + */ + ULONG State; + + /* + * PURPOSE: Priority modifier of the thread + */ + ULONG Priority; + + /* + * PURPOSE: Pointer to our parent process + */ +// PEPROCESS Parent; + + /* + * PURPOSE: Handle of our parent process + */ + HANDLE ParentHandle; + + /* + * PURPOSE: Not currently used + */ + ULONG AffinityMask; + + /* + * PURPOSE: Saved thread context + */ + hal_thread_state context; + +} THREAD_OBJECT, *PTHREAD_OBJECT; + + + +/* + * PURPOSE: Object describing the wait a thread is currently performing + */ +typedef struct +{ + /* + * PURPOSE: Pointer to the waiting thread + */ + PTHREAD_OBJECT thread; + + /* + * PURPOSE: Entry in the wait queue for the object being waited on + */ + LIST_ENTRY Entry; + + /* + * PURPOSE: Pointer to the object being waited on + */ + DISPATCHER_HEADER* wait_object; + +} KWAIT_BLOCK, *PKWAIT_BLOCK; + +typedef struct _ADAPTER_OBJECT +{ +} ADAPTER_OBJECT, *PADAPTER_OBJECT; + +typedef struct _CONTROLLER_OBJECT +{ + PVOID ControllerExtension; +} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT; + +typedef struct _STRING +{ + /* + * Length in bytes of the string stored in buffer + */ + USHORT Length; + + /* + * Maximum length of the string + */ + USHORT MaximumLength; + + /* + * String + */ + PCHAR Buffer; +} STRING, *PSTRING; + +typedef struct _ANSI_STRING +{ + /* + * Length in bytes of the string stored in buffer + */ + USHORT Length; + + /* + * Maximum length of the string + */ + USHORT MaximumLength; + + /* + * String + */ + PCHAR Buffer; +} ANSI_STRING, *PANSI_STRING; + +typedef struct _KTIMER +{ + /* + * Pointers to maintain the linked list of activated timers + */ + LIST_ENTRY entry; + + /* + * Absolute expiration time in system time units + */ + unsigned long long expire_time; + + /* + * Optional dpc associated with the timer + */ + PKDPC dpc; + + /* + * True if the timer is signaled + */ + BOOLEAN signaled; + + /* + * True if the timer is in the system timer queue + */ + BOOLEAN running; + + /* + * Type of the timer either Notification or Synchronization + */ + TIMER_TYPE type; + + /* + * Period of the timer in milliseconds (zero if once-only) + */ + ULONG period; + +} KTIMER, *PKTIMER; + + + + +typedef struct _IO_RESOURCE_DESCRIPTOR +{ + UCHAR Option; + UCHAR Type; + UCHAR SharedDisposition; + + /* + * Reserved for system use + */ + UCHAR Spare1; + + USHORT Flags; + + /* + * Reserved for system use + */ + UCHAR Spare2; + + union + { + struct + { + ULONG Length; + ULONG Alignment; + PHYSICAL_ADDRESS MinimumAddress; + PHYSICAL_ADDRESS MaximumAddress; + } Port; + struct + { + ULONG Length; + ULONG Alignment; + PHYSICAL_ADDRESS MinimumAddress; + PHYSICAL_ADDRESS MaximumAddress; + } Memory; + struct + { + ULONG MinimumVector; + ULONG MaximumVector; + } Interrupt; + struct + { + ULONG MinimumChannel; + ULONG MaximumChannel; + } Dma; + } u; +} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR; + +typedef struct _IO_RESOURCE_LIST +{ + USHORT Version; + USHORT Revision; + ULONG Count; + IO_RESOURCE_DESCRIPTOR Descriptors[1]; +} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST; + +typedef struct _IO_RESOURCES_REQUIREMENTS_LIST +{ + /* + * List size in bytes + */ + ULONG ListSize; + + /* + * System defined enum for the bus + */ + INTERFACE_TYPE InterfaceType; + + ULONG BusNumber; + ULONG SlotNumber; + ULONG Reserved[3]; + ULONG AlternativeLists; + IO_RESOURCE_LIST List[1]; +} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST; + +typedef struct +{ + UCHAR Type; + UCHAR ShareDisposition; + USHORT Flags; + union + { + struct + { + PHYSICAL_ADDRESS Start; + ULONG Length; + } Port; + struct + { + ULONG Level; + ULONG Vector; + ULONG Affinity; + } Interrupt; + struct + { + PHYSICAL_ADDRESS Start; + ULONG Length; + } Memory; + struct + { + ULONG Channel; + ULONG Port; + ULONG Reserved1; + } Dma; + struct + { + ULONG DataSize; + ULONG Reserved1; + ULONG Reserved2; + } DeviceSpecificData; + } u; +} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR; + +typedef struct +{ + USHORT Version; + USHORT Revision; + ULONG Count; + CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]; +} CM_PARTIAL_RESOURCE_LIST; + +typedef struct +{ + INTERFACE_TYPE InterfaceType; + ULONG BusNumber; + CM_PARTIAL_RESOURCE_LIST PartialResourceList; +} CM_FULL_RESOURCE_DESCRIPTOR; + +typedef struct +{ + ULONG Count; + CM_FULL_RESOURCE_DESCRIPTOR List[1]; +} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST; + +struct _KINTERRUPT; + +typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt, + PVOID ServiceContext); + +typedef struct _KINTERRUPT +{ + ULONG Vector; + KAFFINITY ProcessorEnableMask; + PKSPIN_LOCK IrqLock; + BOOLEAN Shareable; + BOOLEAN FloatingSave; + PKSERVICE_ROUTINE ServiceRoutine; + PVOID ServiceContext; + LIST_ENTRY Entry; + KIRQL SynchLevel; +} KINTERRUPT, *PKINTERRUPT; + diff --git a/reactos/include/ddk/types.h b/reactos/include/ddk/types.h new file mode 100644 index 00000000000..f7b4524d95e --- /dev/null +++ b/reactos/include/ddk/types.h @@ -0,0 +1,85 @@ +#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 diff --git a/reactos/include/ddk/zw.h b/reactos/include/ddk/zw.h new file mode 100644 index 00000000000..ad6265da3cd --- /dev/null +++ b/reactos/include/ddk/zw.h @@ -0,0 +1,1537 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: System call definitions + * FILE: include/ddk/zw.h + * REVISION HISTORY: + * ??/??/??: First few functions (David Welch) + * ??/??/??: Complete implementation by Boudewijn Dekker + * 13/07/98: Reorganised things a bit (David Welch) + */ + +#ifndef __DDK_ZW_H +#define __DDK_ZW_H + +#include + +/* + * FUNCTION: Closes an object handle + * ARGUMENTS: + * Handle = Handle to the object + * RETURNS: Status + */ +NTSTATUS ZwClose(HANDLE Handle); + +/* + * FUNCTION: Creates or opens a directory object, which is a container for + * other objects + * ARGUMENTS: + * DirectoryHandle (OUT) = Points to a variable which stores the + * handle for the directory on success + * DesiredAccess = Type of access the caller requires to the directory + * ObjectAttributes = Structures specifing the object attributes, + * initialized with InitializeObjectAttributes + * RETURNS: Status + */ +NTSTATUS ZwCreateDirectoryObject(PHANDLE DirectoryHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes); + +/* + * FUNCTION: Creates or opens a registry key + * ARGUMENTS: + * KeyHandle (OUT) = Points to a variable which stores the handle + * for the key on success + * DesiredAccess = Access desired by the caller to the key + * ObjectAttributes = Initialized object attributes for the key + * TitleIndex = Who knows? + * Class = Object class of the key? + * CreateOptions = Options for the key creation + * Disposition (OUT) = Points to a variable which a status value + * indicating whether a new key was created + * RETURNS: Status + */ +NTSTATUS ZwCreateKey(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + ULONG TitleIndex, PUNICODE_STRING Class, + ULONG CreateOptions, PULONG Disposition); + +/* + * FUNCTION: Deletes a registry key + * ARGUMENTS: + * KeyHandle = Handle of the key + * RETURNS: Status + */ +NTSTATUS ZwDeleteKey(HANDLE KeyHandle); + +/* + * FUNCTION: Returns information about the subkeys of an open key + * ARGUMENTS: + * KeyHandle = Handle of the key whose subkeys are to enumerated + * Index = zero based index of the subkey for which information is + * request + * KeyInformationClass = Type of information returned + * KeyInformation (OUT) = Caller allocated buffer for the information + * about the key + * Length = Length in bytes of the KeyInformation buffer + * ResultLength (OUT) = Caller allocated storage which holds + * the number of bytes of information retrieved + * on return + * RETURNS: Status + */ +NTSTATUS ZwEnumerateKey(HANDLE KeyHandle, ULONG Index, + KEY_INFORMATION_CLASS KeyInformationClass, + PVOID KeyInformation, ULONG Length, + PULONG ResultLength); + +/* + * FUNCTION: Returns information about the value entries of an open key + * ARGUMENTS: + * KeyHandle = Handle of the key whose value entries are to enumerated + * Index = zero based index of the subkey for which information is + * request + * KeyInformationClass = Type of information returned + * KeyInformation (OUT) = Caller allocated buffer for the information + * about the key + * Length = Length in bytes of the KeyInformation buffer + * ResultLength (OUT) = Caller allocated storage which holds + * the number of bytes of information retrieved + * on return + * RETURNS: Status + */ +NTSTATUS ZwEnumerateValueKey(HANDLE KeyHandle, ULONG Index, + KEY_VALUE_INFORMATION_CLASS KeyInformationClass, + PVOID KeyInformation, ULONG Length, + PULONG ResultLength); + + +/* + * FUNCTION: Forces a registry key to be committed to disk + * ARGUMENTS: + * KeyHandle = Handle of the key to be written to disk + * RETURNS: Status + */ +NTSTATUS ZwFlushKey(HANDLE KeyHandle); + +/* + * FUNCTION: Changes the attributes of an object to temporary + * ARGUMENTS: + * Handle = Handle for the object + * RETURNS: Status + */ +NTSTATUS ZwMakeTemporaryObject(HANDLE Handle); + +/* + * FUNCTION: Maps a view of a section into the virtual address space of a + * process + * ARGUMENTS: + * SectionHandle = Handle of the section + * ProcessHandle = Handle of the process + * BaseAddress = Desired base address (or NULL) on entry + * Actual base address of the view on exit + * ZeroBits = Number of high order address bits that must be zero + * CommitSize = Size in bytes of the initially committed section of + * the view + * SectionOffset = Offset in bytes from the beginning of the section + * to the beginning of the view + * ViewSize = Desired length of map (or zero to map all) on entry + * Actual length mapped on exit + * InheritDisposition = Specified how the view is to be shared with + * child processes + * AllocateType = Type of allocation for the pages + * Protect = Protection for the committed region of the view + * RETURNS: Status + */ +NTSTATUS ZwMapViewOfSection(HANDLE SectionHandle, + HANDLE ProcessHandle, + PVOID* BaseAddress, + ULONG ZeroBits, + ULONG CommitSize, + PLARGE_INTEGER SectionOffset, + PULONG ViewSize, + SECTION_INHERIT InheritDisposition, + ULONG AllocationType, + ULONG Protect); + +/* + * FUNCTION: Opens an existing key in the registry + * ARGUMENTS: + * KeyHandle (OUT) = Caller supplied storage for the resulting handle + * DesiredAccess = Requested access to the key + * ObjectAttribute = Initialized attributes for the object + * RETURNS: Status + */ +NTSTATUS ZwOpenKey(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes); + +/* + * FUNCTION: Opens an existing section object + * ARGUMENTS: + * KeyHandle (OUT) = Caller supplied storage for the resulting handle + * DesiredAccess = Requested access to the key + * ObjectAttribute = Initialized attributes for the object + * RETURNS: Status + */ +NTSTATUS ZwOpenSection(PHANDLE KeyHandle, ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes); + +/* + * FUNCTION: Returns information about an open file + * ARGUMENTS: + * FileHandle = Handle of the file to be queried + * IoStatusBlock (OUT) = Caller supplied storage for the result + * FileInformation (OUT) = Caller supplied storage for the file + * information + * Length = Length in bytes of the buffer for file information + * FileInformationClass = Type of information to be returned + * RETURNS: Status + */ +NTSTATUS ZwQueryInformationFile(HANDLE FileHandle, + PIO_STATUS_BLOCK IoStatusBlock, + PVOID FileInformation, + ULONG Length, + FILE_INFORMATION_CLASS FileInformationClass); + +#ifndef _NTNATIVE +#define _NTNATIVE + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#if KERNEL_SUPPORTS_OBJECT_ATTRIBUTES_CORRECTLY +typedef struct _OBJECT_ATTRIBUTES { + ULONG Length; + HANDLE RootDirectory; + PUNICODE_STRING ObjectName; + ULONG Attributes; + SECURITY_DESCRIPTOR *SecurityDescriptor; + SECURITY_QUALITY_OF_SERVICE *SecurityQualityOfService; +} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; +#endif + +#if IOTYPES_DIDNT_DECLARE_THIS +typedef struct _IO_STATUS_BLOCK { + NTSTATUS Status; + ULONG Information; +} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; +#endif + + +//typedef LARGE_INTEGER *PLARGE_INTEGER; + +// + +#define NtCurrentProcess() ( (HANDLE) 0xFFFFFFFF ) +#define NtCurrentThread() ( (HANDLE) 0xFFFFFFFE ) + + + +// event access mask + +#define EVENT_READ_ACCESS 0x0001 +#define EVENT_WRITE_ACCESS 0x0002 + + +//process query / set information class + +#define ProcessBasicInformation 0 +#define ProcessQuotaLimits 1 +#define ProcessIoCounters 2 +#define ProcessVmCounters 3 +#define ProcessTimes 4 +#define ProcessBasePriority 5 +#define ProcessRaisePriority 6 +#define ProcessDebugPort 7 +#define ProcessExceptionPort 8 +#define ProcessAccessToken 9 +#define ProcessLdtInformation 10 +#define ProcessLdtSize 11 +#define ProcessDefaultHardErrorMode 12 +#define ProcessIoPortHandlers 13 +#define ProcessPooledUsageAndLimits 14 +#define ProcessWorkingSetWatch 15 +#define ProcessUserModeIOPL 16 +#define ProcessEnableAlignmentFaultFixup 17 +#define ProcessPriorityClass 18 +#define ProcessWx86Information 19 +#define ProcessHandleCount 20 +#define ProcessAffinityMask 21 +#define MaxProcessInfoClass 22 + +// thread query / set information class + +#define ThreadBasicInformation 0 +#define ThreadTimes 1 +#define ThreadPriority 2 +#define ThreadBasePriority 3 +#define ThreadAffinityMask 4 +#define ThreadImpersonationToken 5 +#define ThreadDescriptorTableEntry 6 +#define ThreadEnableAlignmentFaultFixup 7 +#define ThreadEventPair 8 +#define ThreadQuerySetWin32StartAddress 9 +#define ThreadZeroTlsCell 10 +#define ThreadPerformanceCount 11 +#define ThreadAmILastThread 12 +#define ThreadIdealProcessor 13 +#define ThreadPriorityBoost 14 +#define MaxThreadInfoClass 15 + + +// key query information class + +#define KeyBasicInformation 0 +#define KeyNodeInformation 1 +#define KeyFullInformation 2 + + +// key set information class + +#define KeyWriteTimeInformation 0 + +// key value information class + +#define KeyValueBasicInformation 0 +#define KeyValueFullInformation 1 +#define KeyValuePartialInformation 2 + +// object handle information + +#define HandleBasicInformation 4 + +// system information + +#define SystemTimeAdjustmentInformation 28 + + +// file information + + +#define FileDirectoryInformation 1 +#define FileFullDirectoryInformation 2 +#define FileBothDirectoryInformation 3 +#define FileBasicInformation 4 +#define FileStandardInformation 5 +#define FileInternalInformation 6 +#define FileEaInformation 7 +#define FileAccessInformation 8 +#define FileNameInformation 9 +#define FileRenameInformation 10 +#define FileLinkInformation 11 +#define FileNamesInformation 12 +#define FileDispositionInformation 13 +#define FilePositionInformation 14 +#define FileFullEaInformation 15 +#define FileModeInformation 16 +#define FileAlignmentInformation 17 +#define FileAllInformation 18 +#define FileAllocationInformation 19 +#define FileEndOfFileInformation 20 +#define FileAlternateNameInformation 21 +#define FileStreamInformation 22 +#define FilePipeInformation 23 +#define FilePipeLocalInformation 24 +#define FilePipeRemoteInformation 25 +#define FileMailslotQueryInformation 26 +#define FileMailslotSetInformation 27 +#define FileCompressionInformation 28 +#define FileCopyOnWriteInformation 29 +#define FileCompletionInformation 30 +#define FileMoveClusterInformation 31 +#define FileOleClassIdInformation 32 +#define FileOleStateBitsInformation 33 +#define FileNetworkOpenInformation 34 +#define FileObjectIdInformation 35 +#define FileOleAllInformation 36 +#define FileOleDirectoryInformation 37 +#define FileContentIndexInformation 38 +#define FileInheritContentIndexInformation 39 +#define FileOleInformation 40 +#define FileMaximumInformation 41 + + + +//file system information class values + + + +#define FileFsVolumeInformation 1 +#define FileFsLabelInformation 2 +#define FileFsSizeInformation 3 +#define FileFsDeviceInformation 4 +#define FileFsAttributeInformation 5 +#define FileFsControlInformation 6 +#define FileFsQuotaQueryInformation 7 +#define FileFsQuotaSetInformation 8 +#define FileFsMaximumInformation 9 + +// wait type + +#define WaitAll 0 +#define WaitAny 1 + + +// key restore flags + +#define REG_WHOLE_HIVE_VOLATILE (0x00000001L) +#define REG_REFRESH_HIVE (0x00000002L) + + +#define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\') + +// object type access rights + +#define OBJECT_TYPE_CREATE (0x0001) +#define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1) + + +// directory access rights + +#define DIRECTORY_QUERY (0x0001) +#define DIRECTORY_TRAVERSE (0x0002) +#define DIRECTORY_CREATE_OBJECT (0x0004) +#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008) + +#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF) + +// symbolic link access rights + +#define SYMBOLIC_LINK_QUERY (0x0001) +#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1) + +typedef struct _PROCESS_WS_WATCH_INFORMATION { + PVOID FaultingPc; + PVOID FaultingVa; +} PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION; + +typedef struct _PROCESS_BASIC_INFORMATION { + NTSTATUS ExitStatus; + PPEB PebBaseAddress; + KAFFINITY AffinityMask; + KPRIORITY BasePriority; + ULONG UniqueProcessId; + ULONG InheritedFromUniqueProcessId; +} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION; + +typedef struct _QUOTA_LIMITS { + ULONG PagedPoolLimit; + ULONG NonPagedPoolLimit; + ULONG MinimumWorkingSetSize; + ULONG MaximumWorkingSetSize; + ULONG PagefileLimit; + LARGE_INTEGER TimeLimit; +} QUOTA_LIMITS, *PQUOTA_LIMITS; + +typedef struct _IO_COUNTERS { + ULONG ReadOperationCount; + ULONG WriteOperationCount; + ULONG OtherOperationCount; + LARGE_INTEGER ReadTransferCount; + LARGE_INTEGER WriteTransferCount; + LARGE_INTEGER OtherTransferCount; +} IO_COUNTERS, *PIO_COUNTERS; + + +typedef struct _VM_COUNTERS { + ULONG PeakVirtualSize; + ULONG VirtualSize; + ULONG PageFaultCount; + ULONG PeakWorkingSetSize; + ULONG WorkingSetSize; + ULONG QuotaPeakPagedPoolUsage; + ULONG QuotaPagedPoolUsage; + ULONG QuotaPeakNonPagedPoolUsage; + ULONG QuotaNonPagedPoolUsage; + ULONG PagefileUsage; + ULONG PeakPagefileUsage; +} VM_COUNTERS, *PVM_COUNTERS; + + +typedef struct _POOLED_USAGE_AND_LIMITS { + ULONG PeakPagedPoolUsage; + ULONG PagedPoolUsage; + ULONG PagedPoolLimit; + ULONG PeakNonPagedPoolUsage; + ULONG NonPagedPoolUsage; + ULONG NonPagedPoolLimit; + ULONG PeakPagefileUsage; + ULONG PagefileUsage; + ULONG PagefileLimit; +} POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS; + + +typedef struct _PROCESS_ACCESS_TOKEN { + HANDLE Token; + HANDLE Thread; + +} PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN; + +typedef struct _KERNEL_USER_TIMES { + LARGE_INTEGER CreateTime; + LARGE_INTEGER ExitTime; + LARGE_INTEGER KernelTime; + LARGE_INTEGER UserTime; +} KERNEL_USER_TIMES; +typedef KERNEL_USER_TIMES *PKERNEL_USER_TIMES; + +// exception structures + + +#define TEB_EXCEPTION_FRAME(pcontext) ((PEXCEPTION_FRAME)((TEB *)GET_SEL_BASE((pcontext)->SegFs))->except) + + +typedef struct _OBJECT_NAME_INFORMATION { + UNICODE_STRING Name; +} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; + + +// section information + + +// handle information + +//#define HANDLE_FLAG_INHERIT 0x00000001 +//#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x00000002 + + +typedef struct _HANDLE_INFO +{ + BOOL bInheritHanlde; + BOOL bProtectFromClose; +} HANDLE_INFO; +typedef HANDLE_INFO *PHANDLE_INFO; + + + +typedef struct _SYSTEM_TIME_ADJUSTMENT +{ + DWORD dwTimeAdjustment; + BOOL bTimeAdjustmentDisabled; +} SYSTEM_TIME_ADJUSTMENT, *PSYSTEM_TIME_ADJUSTMENT; + + +// file information + +// asynchorneous procedure call + + +typedef struct _FILE_BASIC_INFORMATION { + LARGE_INTEGER CreationTime; + LARGE_INTEGER LastAccessTime; + LARGE_INTEGER LastWriteTime; + LARGE_INTEGER ChangeTime; + ULONG FileAttributes; +} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION; + +typedef struct _FILE_STANDARD_INFORMATION { + LARGE_INTEGER AllocationSize; + LARGE_INTEGER EndOfFile; + ULONG NumberOfLinks; + BOOLEAN DeletePending; + BOOLEAN Directory; +} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION; + +typedef struct _FILE_POSITION_INFORMATION { + LARGE_INTEGER CurrentByteOffset; +} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION; + +typedef struct _FILE_ALIGNMENT_INFORMATION { + ULONG AlignmentRequirement; +} FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION; + +typedef struct _FILE_DISPOSITION_INFORMATION { + BOOLEAN DeleteFile; +} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION; + +typedef struct _FILE_END_OF_FILE_INFORMATION { + LARGE_INTEGER EndOfFile; +} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION; + + +typedef struct _FILE_FULL_EA_INFORMATION { + ULONG NextEntryOffset; + UCHAR Flags; + UCHAR EaNameLength; + USHORT EaValueLength; + CHAR EaName[1]; +} FILE_FULL_EA_INFORMATION; +typedef FILE_FULL_EA_INFORMATION *PFILE_FULL_EA_INFORMATION; + + + +// file system information structures + +typedef struct _FILE_FS_DEVICE_INFORMATION { + DEVICE_TYPE DeviceType; + ULONG Characteristics; +} FILE_FS_DEVICE_INFORMATION; +typedef FILE_FS_DEVICE_INFORMATION *PFILE_FS_DEVICE_INFORMATION; + + +// timer apc routine [ possible incompatible with ms winnt ] + +typedef +VOID +(*PTIMERAPCROUTINE) ( + PVOID Argument, + PVOID Context + ); + +// shutdown action [ possible incompatible with ms winnt ] +// this might be parameter to specify how to shutdown +typedef +VOID +(*SHUTDOWN_ACTION) ( + VOID + ); + + //NtAcceptConnectPort + //NtAccessCheck + //NtAccessCheckAndAuditAlarm + +NTSTATUS +STDCALL +NtAddAtom( + IN PUNICODE_STRING pString + ); + + //NtAdjustGroupsToken + //NtAdjustPrivilegesToken + //NtAlertResumeThread + //NtAlertThread + //NtAllocateLocallyUniqueId + //NtAllocateUuids + + +NTSTATUS +STDCALL +NtAllocateVirtualMemory( + IN HANDLE hProcess, + OUT LPVOID lpAddress, + IN ULONG uWillThingAbThis, + IN DWORD dwSize, + IN DWORD flAllocationType, + IN DWORD flProtect + ); + +// NtCallbackReturn +// NtCancelIoFile + +NTSTATUS +STDCALL +NtCancelTimer( + IN HANDLE TimerHandle, + IN BOOL Resume + ); + +NTSTATUS +STDCALL +NtClearEvent( + IN HANDLE EventHandle + ); + + +NTSTATUS +STDCALL +NtClose( + IN HANDLE Handle + ); + +// NtCloseObjectAuditAlarm +// NtCompleteConnectPort +// NtConnectPort + +NTSTATUS +STDCALL +NtContinue( + IN PCONTEXT Context + ); + +//NtCreateChannel + + +NTSTATUS +STDCALL +NtCreateDirectoryObject( + OUT PHANDLE DirectoryHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); + +NTSTATUS +STDCALL +NtCreateEvent( + OUT PHANDLE FileHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN BOOL ManualReset, + IN BOOL InitialState + ); +//NtCreateEventPair + + +NTSTATUS +STDCALL +NtCreateFile( + OUT PHANDLE FileHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PLARGE_INTEGER AllocationSize OPTIONAL, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN ULONG CreateDisposition, + IN ULONG CreateOptions, + IN PVOID EaBuffer OPTIONAL, + IN ULONG EaLength + ); + +// NtCreateIoCompletion + +NTSTATUS +STDCALL +NtCreateKey( + OUT PHANDLE KeyHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN ULONG TitleIndex, + IN PUNICODE_STRING Class OPTIONAL, + IN ULONG CreateOptions, + IN PULONG Disposition OPTIONAL + ); +// NtCreateMailslotFile +//-- NtCreateMutant +//-- NtCreateNamedPipeFile +//-- NtCreatePagingFile +//-- NtCreatePort + +NTSTATUS +STDCALL +NtCreateProcess( + OUT PHANDLE ProcessHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ParentProcess, + IN BOOLEAN InheritObjectTable, + IN HANDLE SectionHandle OPTIONAL, + IN HANDLE DebugPort OPTIONAL, + IN HANDLE ExceptionPort OPTIONAL + ); +// NtCreateProfile + +NTSTATUS +STDCALL +NtCreateSection( + OUT PHANDLE SectionHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN PLARGE_INTEGER MaximumSize OPTIONAL, + IN ULONG SectionPageProtection OPTIONAL, + IN ULONG AllocationAttributes, + IN HANDLE FileHandle OPTIONAL + ); + +NTSTATUS +STDCALL +NtCreateSemaphore( + OUT PHANDLE SemaphoreHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN ULONG InitialCount, + IN ULONG MaximumCount + ); +// NtCreateSymbolicLinkObject + +NTSTATUS +STDCALL +NtCreateThread( + OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ProcessHandle, + IN PCLIENT_ID ClientId, + IN PCONTEXT ThreadContext, + IN PINITIAL_TEB InitialTeb, + IN BOOLEAN CreateSuspended + ); + +NTSTATUS +STDCALL +NtCreateTimer( + OUT PHANDLE TimerHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN LONG ManualReset + ); +//-- NtCreateToken + +NT_TEB +STDCALL +NtCurrentTeb( + VOID + ); + +NTSTATUS +STDCALL +NtDelayExecution( + IN BOOL Alertable, + IN PLARGE_INTEGER Interval + ); + + +NTSTATUS +STDCALL +NtDeleteAtom( + IN ATOM Atom + ); + + +NTSTATUS +STDCALL +NtDeleteFile( + IN HANDLE FileHandle + ); + + +NTSTATUS +STDCALL +NtDeleteKey( + IN HANDLE KeyHandle + ); +// NtDeleteObjectAuditAlarm +// NtDeleteValueKey +// NtDeviceIoControlFile + +NTSTATUS +STDCALL +NtDisplayString( + IN PUNICODE_STRING DisplayString + ); + +NTSTATUS +STDCALL +NtDuplicateObject( + IN HANDLE SourceProcessHandle, + IN PHANDLE SourceHandle, + IN HANDLE TargetProcessHandle, + OUT PHANDLE TargetHandle, + IN ULONG dwDesiredAccess, + IN ULONG InheritHandle + ); +// NtDuplicateToken + +NTSTATUS +STDCALL +NtEnumerateKey( + IN HANDLE KeyHandle, + IN ULONG Index, + IN CINT KeyInformationClass, + OUT PVOID KeyInformation, + IN ULONG Length, + OUT PULONG ResultLength + ); + +NTSTATUS +STDCALL +NtEnumerateValueKey( + IN HANDLE KeyHandle, + IN ULONG Index, + IN CINT KeyValueInformationClass, + OUT PVOID KeyValueInformation, + IN ULONG Length, + OUT PULONG ResultLength + ); + //NtExtendSection + +ATOM +STDCALL +NtFindAtom( + IN PUNICODE_STRING AtomString + ); + +NTSTATUS +STDCALL +NtFlushBuffersFile( + IN HANDLE FileHandle + ); + +NTSTATUS +STDCALL +NtFlushInstructionCache( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN UINT Size + ); + +NTSTATUS +STDCALL +NtFlushKey( + IN HANDLE KeyHandle + ); + +/* + * FIXME: Is the return type correct? (David Welch) + */ +NTSTATUS +STDCALL +NtFlushVirtualMemory( + IN HANDLE ProcessHandle, + IN VOID *BaseAddress, + IN ULONG NumberOfBytesToFlush, + IN PULONG NumberOfBytesFlushed + ); + +VOID +STDCALL +NtFlushWriteBuffer ( + VOID + ); + +NTSTATUS +STDCALL +NtFreeVirtualMemory( + IN PHANDLE hProcess, + IN LPVOID lpAddress, // address of region of committed pages + IN DWORD dwSize, // size of region + IN DWORD dwFreeType + ); +//-- NtFsControlFile + +NTSTATUS +STDCALL +NtGetContextThread( + IN HANDLE ThreadHandle, + OUT PCONTEXT Context + ); +// NtGetPlugPlayEvent +// NtGetTickCount +// NtImpersonateClientOfPort +// NtImpersonateThread +// NtInitializeRegistry +// NtListenChannel +// NtListenPort + +NTSTATUS +STDCALL +NtLoadDriver( + IN PUNICODE_STRING DriverServiceName + ); + + //NtLoadKey2 + //NtLoadKey + //NtLockFile + //NtLockVirtualMemory + +NTSTATUS +STDCALL +NtMakeTemporaryObject( + OUT HANDLE Handle + ); + +NTSTATUS +STDCALL +NtMapViewOfSection( + IN HANDLE SectionHandle, + IN HANDLE ProcessHandle, + IN OUT PVOID *BaseAddress, + IN ULONG ZeroBits, + IN ULONG CommitSize, + IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, + IN OUT PULONG ViewSize, + IN SECTION_INHERIT InheritDisposition, + IN ULONG AllocationType, + IN ULONG Protect + ); + +// NtNotifyChangeDirectoryFile +// NtNotifyChangeKey +// NtOpenChannel + +NTSTATUS +STDCALL +NtOpenDirectoryObject( + OUT PHANDLE DirectoryHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); + +NTSTATUS +STDCALL +NtOpenEvent( + OUT PHANDLE EventHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); +// NtOpenEventPair + +NTSTATUS +STDCALL +NtOpenFile( + OUT PHANDLE FileHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN ULONG ShareAccess, + IN ULONG FileAttributes + ); +// NtOpenIoCompletion + +NTSTATUS +STDCALL +NtOpenKey( + OUT PHANDLE KeyHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); +// NtOpenMutant +// NtOpenObjectAuditAlarm +NTSTATUS NtOpenProcess ( + OUT PHANDLE ProcessHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN PCLIENT_ID ClientId + ); + +// NtOpenProcessToken + +NTSTATUS +STDCALL +NtOpenSection( + OUT PHANDLE SectionHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); +// NtOpenSemaphore +NTSTATUS +STDCALL +NtOpenSymbolicLinkObject( + OUT PHANDLE SymbolicLinkHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); + +NTSTATUS +STDCALL +NtOpenThread( + OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); +//NtOpenThreadToken + +NTSTATUS +STDCALL +NtOpenTimer( + OUT PHANDLE TimerHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes + ); +// NtPlugPlayControl +// NtPrivilegeCheck +// NtPrivilegeObjectAuditAlarm +// NtPrivilegedServiceAuditAlarm +// NtProtectVirtualMemory + +NTSTATUS +STDCALL +NtPulseEvent( + IN HANDLE EventHandle, + IN BOOL Unknown OPTIONAL + ); +// NtQueryAttributesFile +// NtQueryDefaultLocale +// NtQueryDirectoryFile + +NTSTATUS +STDCALL +NtQueryDirectoryObject( + IN HANDLE DirectoryHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PLARGE_INTEGER AllocationSize OPTIONAL, + IN ULONG FileAttributes, + IN ULONG ShareAccess, + IN PVOID Buffer , + IN ULONG Length + ); + +NTSTATUS +STDCALL +NtQueryEaFile( + IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID EaBuffer , + IN ULONG EaLength, + ULONG Unknown1 , + ULONG Unknown2 , + ULONG Unknown3 , + ULONG Unknown4 , + IN CINT FileInformationClass + ); +//-- NtQueryEvent +//-- NtQueryFullAttributesFile +//-- NtQueryInformationAtom + +NTSTATUS +STDCALL +NtQueryInformationFile( + IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID FileInformation, + IN ULONG Length, + IN CINT FileInformationClass + ); +//NtQueryInformationPort + +/* +ProcessWorkingSetWatch PROCESS_WS_WATCH_INFORMATION +ProcessBasicInfo PROCESS_BASIC_INFORMATION +ProcessQuotaLimits QUOTA_LIMITS +ProcessPooledQuotaLimits QUOTA_LIMITS +ProcessIoCounters IO_COUNTERS +ProcessVmCounters VM_COUNTERS +ProcessPooledUsageAndLimits POOLED_USAGE_AND_LIMITS +ProcessTimes KERNEL_USER_TIMES +*/ + + + +NTSTATUS +STDCALL +NtQueryInformationProcess( + IN HANDLE ProcessHandle, + IN CINT ProcessInformationClass, + OUT PVOID ProcessInformation, + IN ULONG ProcessInformationLength, + OUT PULONG ReturnLength + ); + +/* +ThreadTimes KERNEL_USER_TIMES +*/ + +NTSTATUS +STDCALL +NtQueryInformationThread( + IN HANDLE ThreadHandle, + IN CINT ThreadInformationClass, + OUT PVOID ThreadInformation, + IN ULONG ThreadInformationLength, + OUT PULONG ReturnLength + ); +// NtQueryInformationToken +// NtQueryIntervalProfile +// NtQueryIoCompletion + +NTSTATUS +STDCALL +NtQueryKey( + IN HANDLE KeyHandle, + IN CINT KeyInformationClass, + OUT PVOID KeyInformation, + IN ULONG Length, + OUT PULONG ResultLength + ); +//-- NtQueryMultipleValueKey +//-- NtQueryMutant + +NTSTATUS +STDCALL +NtQueryObject( + IN HANDLE ObjectHandle, + IN CINT HandleInformationClass, + OUT PHANDLE_INFO HandleInfo, + IN ULONG Length, + OUT PULONG ResultLength); + //NtQueryOleDirectoryFile + +NTSTATUS +STDCALL +NtQueryPerformanceCounter( + IN PULONG Count, + IN PULONG Frequency + ); + +// NtQuerySection +//-- NtQuerySecurityObject +//-- NtQuerySemaphore + +NTSTATUS +STDCALL +NtQuerySymbolicLinkObject( + IN HANDLE SymbolicLinkHandle, + OUT PUNICODE_STRING TargetName, /* target device name */ + IN PULONG Length + ); +//-- NtQuerySystemEnvironmentValue +NTSTATUS +STDCALL +NtQuerySystemInformation( + IN CINT SystemInformationClass, + OUT PVOID SystemInformation, + IN ULONG SystemInformationLength + ); + +NTSTATUS +STDCALL +NtQuerySystemTime ( + OUT PLARGE_INTEGER CurrentTime + ); +//-- NtQueryTimer +//-- NtQueryTimerResolution + +NTSTATUS +STDCALL +NtQueryValueKey( + IN HANDLE KeyHandle, + IN PUNICODE_STRING ValueName, + IN CINT KeyValueInformationClass, + OUT PVOID KeyValueInformation, + IN ULONG Length, + OUT PULONG ResultLength + ); +//-- NtQueryVirtualMemory + +NTSTATUS +STDCALL +NtQueryVolumeInformationFile( + IN HANDLE FileHandle, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID VolumeInformation, + IN ULONG Length, + IN CINT FSInformationClass // dont know + ); +// NtQueueApcThread + +NTSTATUS +STDCALL +NtRaiseException( + IN PEXCEPTION_RECORD ExceptionRecord, + IN PCONTEXT CONTEXT, + IN BOOL bUnknown OPTIONAL + ); + +NTSTATUS +STDCALL +NtRaiseHardError( + IN OUT ULONG Unknown1, + IN OUT ULONG Unknown2, + IN OUT PVOID Unknow3, + IN OUT ULONG Unknow4, + IN PEXCEPTION_RECORD ExceptionRecord + ); + + +NTSTATUS +STDCALL +NtReadFile( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + OUT PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset , + IN PULONG Key OPTIONAL + ); +NTSTATUS +NtReadFileScatter( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, + IN PVOID UserApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK UserIosb , + IN LARGE_INTEGER BufferDescription[], + IN ULONG BufferLength, + IN PLARGE_INTEGER ByteOffset, + IN PULONG Key OPTIONAL + ); + +//NtReadRequestData + +NTSTATUS +STDCALL +NtReadVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + OUT PVOID Buffer, + IN DWORD nSize, + OUT PDWORD lpNumberOfBytesRead + ); + //--NtRegisterThreadTerminatePort + //--NtReleaseMutant + +NTSTATUS +STDCALL +NtReleaseSemaphore( + IN HANDLE SemaphoreHandle, + IN ULONG ReleaseCount, + IN PULONG PreviousCount + ); + //NtRemoveIoCompletion + //NtReplaceKey + //NtReplyPort + //NtReplyWaitReceivePort + //NtReplyWaitReplyPort + //NtReplyWaitSendChannel + //NtRequestPort + //NtRequestWaitReplyPort + //--NtResetEvent + //NtRestoreKey + +NTSTATUS +STDCALL +NtResumeThread( + IN HANDLE ThreadHandle, + IN PCONTEXT Context + ); + //NtSaveKey + //NtSendWaitReplyChannel + //NtSetContextChannel + +NTSTATUS +STDCALL +NtSetContextThread( + IN HANDLE ThreadHandle, + IN PCONTEXT Context + ); + //--NtSetDefaultHardErrorPort + //--NtSetDefaultLocale + //--NtSetEaFile + //--NtSetEvent + //--NtSetHighEventPair + //--NtSetHighWaitLowEventPair + //--NtSetHighWaitLowThread + + +NTSTATUS +STDCALL +NtSetInformationFile( + IN HANDLE FileHandle, + IN PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID FileInformation, + IN ULONG Length, + IN CINT FileInformationClass + ); + +//KeyWriteTimeInformation KEY_WRITE_TIME_INFORMATION + +NTSTATUS +STDCALL +NtSetInformationKey( + IN HANDLE KeyHandle, + IN CINT KeySetInformationClass, + IN PVOID KeyInformation, + IN ULONG KeyInformationLength + ); +NTSTATUS +STDCALL +NtSetInformationObject( + IN HANDLE ObjectHandle, + IN CINT HandleInformationClass, + IN PVOID HandleInfo, + IN ULONG Length + ); +/* + +ProcessQuotaLimits QUOTA_LIMITS +ProcessAccessToken PROCESS_ACCESS_TOKEN + +*/ + +NTSTATUS +STDCALL +NtSetInformationProcess( + IN HANDLE ProcessHandle, + IN CINT ProcessInformationClass, + IN PVOID ProcessInformation, + IN ULONG ProcessInformationLength + ); + +NTSTATUS +STDCALL +NtSetInformationThread( + IN HANDLE ThreadHandle, + IN CINT ThreadInformationClass, + IN PVOID ThreadInformation, + IN ULONG ThreadInformationLength + ); +// NtSetInformationToken +// NtSetIntervalProfile +// NtSetIoCompletion +// NtSetLdtEntries +// NtSetLowEventPair +// NtSetLowWaitHighEventPair +// NtSetLowWaitHighThread +// NtSetSecurityObject + //NtSetSystemEnvironmentValue +/* +SystemTimeAdjustmentInformation SYSTEM_TIME_ADJUSTMENT +*/ +NTSTATUS +STDCALL +NtSetSystemInformation( + IN CINT SystemInformationClass, + IN PVOID SystemInformation, + IN ULONG SystemInformationLength + ); + //NtSetSystemPowerState + +NTSTATUS +STDCALL +NtSetSystemTime( + IN PLARGE_INTEGER SystemTime, + IN BOOL Unknown OPTIONAL + ); + +NTSTATUS +STDCALL +NtSetTimer( + IN HANDLE TimerHandle, + IN PLARGE_INTEGER DueTime, + IN PTIMERAPCROUTINE CompletionRoutine, + IN LPVOID ArgToCompletionRoutine, + IN BOOL Resume, + IN LONG Period + ); +// NtSetTimerResolution + +NTSTATUS +STDCALL +NtSetValueKey( + IN HANDLE KeyHandle, + IN PUNICODE_STRING ValueName, + IN ULONG TitleIndex , + IN ULONG Type, + IN PVOID Data, + IN ULONG DataSize + ); + +//-- NtSetVolumeInformationFile + +NTSTATUS +STDCALL +NtShutdownSystem( + IN SHUTDOWN_ACTION Action + ); +//-- NtSignalAndWaitForSingleObject +// NtStartProfile +// NtStopProfile + +NTSTATUS +STDCALL +NtSuspendThread( + IN HANDLE ThreadHandle, + IN PULONG PreviousSuspendCount + ); + //--NtSystemDebugControl + +NTSTATUS +STDCALL +NtTerminateProcess( + IN HANDLE ProcessHandle , + IN NTSTATUS ExitStatus + ); + +NTSTATUS +STDCALL +NtTerminateThread( + IN HANDLE ThreadHandle , + IN NTSTATUS ExitStatus + ); + + //--NtTestAlert + +NTSTATUS +STDCALL +NtUnloadDriver( + IN PUNICODE_STRING DriverServiceName + ); + + //--NtUnloadKey + //--NtUnlockFile + //--NtUnlockVirtualMemory + +NTSTATUS +STDCALL +NtUnmapViewOfSection( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress + ); + //NtVdmControl + //NtW32Call + +NTSTATUS +STDCALL +NtWaitForMultipleObjects ( + IN ULONG Count, + IN PVOID Object[], + IN CINT WaitType, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Time + ); + +NTSTATUS +STDCALL +NtWaitForSingleObject ( + IN PVOID Object, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Time + ); + //--NtWaitHighEventPair + //--NtWaitLowEventPair + +NTSTATUS +STDCALL +NtWriteFile( + IN HANDLE FileHandle, + IN HANDLE Event , + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID Buffer, + IN ULONG Length, + IN PLARGE_INTEGER ByteOffset , + IN PULONG Key OPTIONAL + ); + +NTSTATUS +STDCALL NtWriteFileScatter( + IN HANDLE FileHandle, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, + IN PVOID UserApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK UserIosb, + IN LARGE_INTEGER BufferDescription[], + IN ULONG BufferLength, + IN PLARGE_INTEGER ByteOffset, + IN PULONG Key OPTIONAL + ); + + //NtWriteRequestData + +NTSTATUS +STDCALL +NtWriteVirtualMemory( + IN HANDLE ProcessHandle, + IN VOID *Buffer, + IN ULONG Size, + OUT PULONG NumberOfBytesWritten + ); + +NTSTATUS +STDCALL +NtYieldExecution( + VOID + ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + +#endif /* __DDK_ZW_H */ diff --git a/reactos/include/defines.h b/reactos/include/defines.h new file mode 100644 index 00000000000..1cd80df3e70 --- /dev/null +++ b/reactos/include/defines.h @@ -0,0 +1,5167 @@ +/* + Defines.h + + Windows32 API definitions + + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + + Author: Scott Christley + + 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 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. +*/ +/* WARNING: This file is automatically generated. */ + +#ifndef _GNU_H_WINDOWS32_DEFINES +#define _GNU_H_WINDOWS32_DEFINES + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define MAX_PATH (260) +#define UNICODE_NULL ((WCHAR)0) +#define LF_FACESIZE (32) +#define LF_FULLFACESIZE (64) +#define ELF_VENDOR_SIZE (4) +#define SECURITY_STATIC_TRACKING (0) +#define SECURITY_DYNAMIC_TRACKING (1) +#define MAX_DEFAULTCHAR (2) +#define MAX_LEADBYTES (12) +#define EXCEPTION_MAXIMUM_PARAMETERS (15) +#define CCHDEVICENAME (32) +#define CCHFORMNAME (32) +#define MENU_TEXT_LEN (40) +#define MAX_LANA (254) +#define NCBNAMSZ (16) +#define NETBIOS_NAME_LEN (16) +#define OFS_MAXPATHNAME (128) +#define MAX_TAB_STOPS (32) +#define ANYSIZE_ARRAY (1) +#define RAS_MaxCallbackNumber (128) +#define RAS_MaxDeviceName (128) +#define RAS_MaxDeviceType (16) +#define RAS_MaxEntryName (256) +#define RAS_MaxIpAddress (15) +#define RAS_MaxIpxAddress (21) +#define RAS_MaxPhoneNumber (128) +#define UNLEN (256) +#define PWLEN (256) +#define CNLEN (15) +#define DNLEN (15) +/* Unsigned types max */ +#define MAXDWORD (0xFFFFFFFF) +#define MAXWORD (0xFFFF) +#define MAXBYTE (0xFF) +/* Signed types max/min */ +#define MINCHAR (0x80) +#define MAXCHAR (0x7F) +#define MINSHORT (0x8000) +#define MAXSHORT (0x7FFF) +#define MINLONG (0x80000000) +#define MAXLONG (0x7FFFFFFF) + +/* _llseek */ +#define FILE_BEGIN (0) +#define FILE_CURRENT (1) +#define FILE_END (2) + +/* _lopen, LZOpenFile, OpenFile */ +#define OF_READ (0) +#define OF_READWRITE (2) +#define OF_WRITE (1) +#define OF_SHARE_COMPAT (0) +#define OF_SHARE_DENY_NONE (64) +#define OF_SHARE_DENY_READ (48) +#define OF_SHARE_DENY_WRITE (32) +#define OF_SHARE_EXCLUSIVE (16) +#define OF_CANCEL (2048) +#define OF_CREATE (4096) +#define OF_DELETE (512) +#define OF_EXIST (16384) +#define OF_PARSE (256) +#define OF_PROMPT (8192) +#define OF_REOPEN (32768) +#define OF_VERIFY (1024) + +/* ActivateKeyboardLayout, LoadKeyboardLayout */ +#define HKL_NEXT (1) +#define HKL_PREV (0) +#define KLF_REORDER (8) +#define KLF_UNLOADPREVIOUS (4) +#define KLF_ACTIVATE (1) +#define KLF_NOTELLSHELL (128) +#define KLF_REPLACELANG (16) +#define KLF_SUBSTITUTE_OK (2) + +/* AppendMenu */ +#define MF_BITMAP (0x4L) +#define MF_DISABLED (0x2L) +#define MF_ENABLED (0L) +#define MF_GRAYED (0x1L) +#define MF_HELP (0x4000L) +#define MF_MENUBARBREAK (0x20L) +#define MF_MENUBREAK (0x40L) +#define MF_MOUSESELECT (0x8000L) +#define MF_OWNERDRAW (0x100L) +#define MF_POPUP (0x10L) +#define MF_SEPARATOR (0x800L) +#define MF_STRING (0L) +#define MF_SYSMENU (0x2000L) +#define MF_USECHECKBITMAPS (0x200L) + +/* Ternary Raster Operations - BitBlt */ +#define BLACKNESS 0x00000042 +#define NOTSRCERASE 0x001100A6 +#define NOTSRCCOPY 0x00330008 +#define SRCERASE 0x00440328 +#define DSTINVERT 0x00550009 +#define PATINVERT 0x005A0049 +#define SRCINVERT 0x00660046 +#define SRCAND 0x008800C6 +#define MERGEPAINT 0x00BB0226 +#define MERGECOPY 0x00C000CA +#define SRCCOPY 0x00CC0020 +#define SRCPAINT 0x00EE0086 +#define PATCOPY 0x00F00021 +#define PATPAINT 0x00FB0A09 +#define WHITENESS 0x00FF0062 + +/* Binary Raster Operations */ +#define R2_BLACK (1) +#define R2_COPYPEN (13) +#define R2_MASKNOTPEN (3) +#define R2_MASKPEN (9) +#define R2_MASKPENNOT (5) +#define R2_MERGENOTPEN (12) +#define R2_MERGEPEN (15) +#define R2_MERGEPENNOT (14) +#define R2_NOP (11) +#define R2_NOT (6) +#define R2_NOTCOPYPEN (4) +#define R2_NOTMASKPEN (8) +#define R2_NOTMERGEPEN (2) +#define R2_NOTXORPEN (10) +#define R2_WHITE (16) +#define R2_XORPEN (7) + +/* BroadcastSystemMessage */ +#define BSF_FLUSHDISK (4) +#define BSF_FORCEIFHUNG (32) +#define BSF_IGNORECURRENTTASK (2) +#define BSF_NOHANG (8) +#define BSF_POSTMESSAGE (16) +#define BSF_QUERY (1) +#define BSM_ALLCOMPONENTS (0) +#define BSM_APPLICATIONS (8) +#define BSM_INSTALLABLEDRIVERS (4) +#define BSM_NETDRIVER (2) +#define BSM_VXDS (1) +#define BROADCAST_QUERY_DENY (1112363332) + +/* BrowseCallbackProc */ + +/* CallNamedPipe */ +#define NMPWAIT_NOWAIT (1) +#define NMPWAIT_WAIT_FOREVER (-1) +#define NMPWAIT_USE_DEFAULT_WAIT (0) + +/* CascadeWindows, TileWindows */ +#define MDITILE_SKIPDISABLED (2) +#define MDITILE_HORIZONTAL (1) +#define MDITILE_VERTICAL (0) + +/* CBTProc */ +#define HCBT_ACTIVATE (5) +#define HCBT_CLICKSKIPPED (6) +#define HCBT_CREATEWND (3) +#define HCBT_DESTROYWND (4) +#define HCBT_KEYSKIPPED (7) +#define HCBT_MINMAX (1) +#define HCBT_MOVESIZE (0) +#define HCBT_QS (2) +#define HCBT_SETFOCUS (9) +#define HCBT_SYSCOMMAND (8) + +/* ChangeDisplaySettings */ +#define DM_BITSPERPEL (0x40000L) +#define DM_PELSWIDTH (0x80000L) +#define DM_PELSHEIGHT (0x100000L) +#define DM_DISPLAYFLAGS (0x200000L) +#define DM_DISPLAYFREQUENCY (0x400000L) +#define CDS_UPDATEREGISTRY (1) +#define CDS_TEST (2) +#define DISP_CHANGE_SUCCESSFUL (0) +#define DISP_CHANGE_RESTART (1) +#define DISP_CHANGE_BADFLAGS (-4) +#define DISP_CHANGE_FAILED (-1) +#define DISP_CHANGE_BADMODE (-2) +#define DISP_CHANGE_NOTUPDATED (-3) + +/* ChangeServiceConfig */ +#define SERVICE_NO_CHANGE (-1) +#define SERVICE_WIN32_OWN_PROCESS (16) +#define SERVICE_WIN32_SHARE_PROCESS (32) +#define SERVICE_KERNEL_DRIVER (1) +#define SERVICE_FILE_SYSTEM_DRIVER (2) +#define SERVICE_INTERACTIVE_PROCESS (256) +#define SERVICE_BOOT_START (0) +#define SERVICE_SYSTEM_START (1) +#define SERVICE_AUTO_START (2) +#define SERVICE_DEMAND_START (3) +#define SERVICE_DISABLED (4) + +/* SERVICE_STATUS structure */ +#define SERVICE_STOPPED (1) +#define SERVICE_START_PENDING (2) +#define SERVICE_STOP_PENDING (3) +#define SERVICE_RUNNING (4) +#define SERVICE_CONTINUE_PENDING (5) +#define SERVICE_PAUSE_PENDING (6) +#define SERVICE_PAUSED (7) +#define SERVICE_ACCEPT_STOP (1) +#define SERVICE_ACCEPT_PAUSE_CONTINUE (2) +#define SERVICE_ACCEPT_SHUTDOWN (4) + +/* CheckDlgButton */ +#define BST_CHECKED (1) +#define BST_INDETERMINATE (2) +#define BST_UNCHECKED (0) +#define BST_FOCUS (8) +#define BST_PUSHED (4) + +/* CheckMenuItem, HiliteMenuItem */ +#define MF_BYCOMMAND (0L) +#define MF_BYPOSITION (0x400L) +#define MF_CHECKED (0x8L) +#define MF_UNCHECKED (0L) +#define MF_HILITE (0x80L) +#define MF_UNHILITE (0L) + +/* ChildWindowFromPointEx */ +#define CWP_ALL (0) +#define CWP_SKIPINVISIBLE (1) +#define CWP_SKIPDISABLED (2) +#define CWP_SKIPTRANSPARENT (4) + +/* ClearCommError */ +#define CE_BREAK (16) +#define CE_DNS (2048) +#define CE_FRAME (8) +#define CE_IOE (1024) +#define CE_MODE (32768) +#define CE_OOP (4096) +#define CE_OVERRUN (2) +#define CE_PTO (512) +#define CE_RXOVER (1) +#define CE_RXPARITY (4) +#define CE_TXFULL (256) + +/* ChooseMatchToTarget */ + +/* CombineRgn */ +#define RGN_AND (1) +#define RGN_COPY (5) +#define RGN_DIFF (4) +#define RGN_OR (2) +#define RGN_XOR (3) +#define NULLREGION (1) +#define SIMPLEREGION (2) +#define COMPLEXREGION (3) +#define ERROR (0) + +/* CommonDlgExtendedError */ +#define CDERR_DIALOGFAILURE (0xffff) +#define CDERR_FINDRESFAILURE (6) +#define CDERR_INITIALIZATION (2) +#define CDERR_LOADRESFAILURE (7) +#define CDERR_LOADSTRFAILURE (5) +#define CDERR_LOCKRESFAILURE (8) +#define CDERR_MEMALLOCFAILURE (9) +#define CDERR_MEMLOCKFAILURE (10) +#define CDERR_NOHINSTANCE (4) +#define CDERR_NOHOOK (11) +#define CDERR_NOTEMPLATE (3) +#define CDERR_REGISTERMSGFAIL (12) +#define CDERR_STRUCTSIZE (1) +#define PDERR_CREATEICFAILURE (0x1000 + 10) +#define PDERR_DEFAULTDIFFERENT (0x1000 + 12) +#define PDERR_DNDMMISMATCH (0x1000 + 9) +#define PDERR_GETDEVMODEFAIL (0x1000 + 5) +#define PDERR_INITFAILURE (0x1000 + 6) +#define PDERR_LOADDRVFAILURE (0x1000 + 4) +#define PDERR_NODEFAULTPRN (0x1000 + 8) +#define PDERR_NODEVICES (0x1000 + 7) +#define PDERR_PARSEFAILURE (0x1000 + 2) +#define PDERR_PRINTERNOTFOUND (0x1000 + 11) +#define PDERR_RETDEFFAILURE (0x1000 + 3) +#define PDERR_SETUPFAILURE (0x1000 + 1) +#define CFERR_MAXLESSTHANMIN (0x2000 + 2) +#define CFERR_NOFONTS (0x2000 + 1) +#define FNERR_BUFFERTOOSMALL (0x3000 + 3) +#define FNERR_INVALIDFILENAME (0x3000 + 2) +#define FNERR_SUBCLASSFAILURE (0x3000 + 1) +#define FRERR_BUFFERLENGTHZERO (0x4000 + 1) + +/* CompareString, LCMapString */ +#define LOCALE_SYSTEM_DEFAULT (0x800L) +#define LOCALE_USER_DEFAULT (0x400L) +#define NORM_IGNORECASE (1) +#define NORM_IGNOREKANATYPE (65536) +#define NORM_IGNORENONSPACE (2) +#define NORM_IGNORESYMBOLS (4) +#define NORM_IGNOREWIDTH (131072) +#define SORT_STRINGSORT (4096) +#define LCMAP_BYTEREV (2048) +#define LCMAP_FULLWIDTH (8388608) +#define LCMAP_HALFWIDTH (4194304) +#define LCMAP_HIRAGANA (1048576) +#define LCMAP_KATAKANA (2097152) +#define LCMAP_LOWERCASE (256) +#define LCMAP_SORTKEY (1024) +#define LCMAP_UPPERCASE (512) + +/* ContinueDebugEvent */ +#define DBG_CONTINUE (0x10002L) +#define DBG_CONTROL_BREAK (0x40010008L) +#define DBG_CONTROL_C (0x40010005L) +#define DBG_EXCEPTION_NOT_HANDLED (0x80010001L) +#define DBG_TERMINATE_THREAD (0x40010003L) +#define DBG_TERMINATE_PROCESS (0x40010004L) + +/* ControlService */ +#define SERVICE_CONTROL_STOP (1) +#define SERVICE_CONTROL_PAUSE (2) +#define SERVICE_CONTROL_CONTINUE (3) +#define SERVICE_CONTROL_INTERROGATE (4) +#define SERVICE_CONTROL_SHUTDOWN (5) + +/* CopyImage, LoadImage */ +#define IMAGE_BITMAP (0) +#define IMAGE_CURSOR (2) +#define IMAGE_ENHMETAFILE (1) +#define IMAGE_ICON (1) +#define LR_COPYDELETEORG (8) +#define LR_COPYRETURNORG (4) +#define LR_MONOCHROME (1) +#define LR_CREATEDIBSECTION (8192) +#define LR_DEFAULTSIZE (64) + +/* CreateDesktop */ +#define DF_ALLOWOTHERACCOUNTHOOK (0x1L) +#define DESKTOP_CREATEMENU (0x4L) +#define DESKTOP_CREATEWINDOW (0x2L) +#define DESKTOP_ENUMERATE (0x40L) +#define DESKTOP_HOOKCONTROL (0x8L) +#define DESKTOP_JOURNALPLAYBACK (0x20L) +#define DESKTOP_JOURNALRECORD (0x10L) +#define DESKTOP_READOBJECTS (0x1L) +#define DESKTOP_SWITCHDESKTOP (0x100L) +#define DESKTOP_WRITEOBJECTS (0x80L) +#define WSF_VISIBLE (0x1L) + +/* CreateDIBitmap */ +#define CBM_INIT (0x4L) +#define DIB_PAL_COLORS (1) +#define DIB_RGB_COLORS (0) + +/* CreateFile, GetFileAttributes, SetFileAttributes */ +#define GENERIC_READ (0x80000000L) +#define GENERIC_WRITE (0x40000000L) +#define FILE_READ_DATA ( 0x0001 ) /* file & pipe */ +#define FILE_LIST_DIRECTORY ( 0x0001 ) /* directory */ + +#define FILE_WRITE_DATA ( 0x0002 ) /* file & pipe */ +#define FILE_ADD_FILE ( 0x0002 ) /* directory */ + +#define FILE_APPEND_DATA ( 0x0004 ) /* file */ +#define FILE_ADD_SUBDIRECTORY ( 0x0004 ) /* directory */ +#define FILE_CREATE_PIPE_INSTANCE ( 0x0004 ) /* named pipe */ + +#define FILE_READ_EA ( 0x0008 ) /* file & directory */ +#define FILE_READ_PROPERTIES FILE_READ_EA + +#define FILE_WRITE_EA ( 0x0010 ) /* file & directory */ +#define FILE_WRITE_PROPERTIES FILE_WRITE_EA + +#define FILE_EXECUTE ( 0x0020 ) /* file */ +#define FILE_TRAVERSE ( 0x0020 ) /* directory */ + +#define FILE_DELETE_CHILD ( 0x0040 ) /* directory */ + +#define FILE_READ_ATTRIBUTES ( 0x0080 ) /* all */ + +#define FILE_WRITE_ATTRIBUTES ( 0x0100 ) /* all */ + +#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) + +#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ |\ + FILE_READ_DATA |\ + FILE_READ_ATTRIBUTES |\ + FILE_READ_EA |\ + SYNCHRONIZE) + + +#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ + FILE_WRITE_DATA |\ + FILE_WRITE_ATTRIBUTES |\ + FILE_WRITE_EA |\ + FILE_APPEND_DATA |\ + SYNCHRONIZE) + + +#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ + FILE_READ_ATTRIBUTES |\ + FILE_EXECUTE |\ + SYNCHRONIZE) + +#define FILE_SHARE_DELETE (4) +#define FILE_SHARE_READ (1) +#define FILE_SHARE_WRITE (2) +#define CONSOLE_TEXTMODE_BUFFER (1) +#define CREATE_NEW (1) +#define CREATE_ALWAYS (2) +#define OPEN_EXISTING (3) +#define OPEN_ALWAYS (4) +#define TRUNCATE_EXISTING (5) +#define FILE_ATTRIBUTE_ARCHIVE (32) +#define FILE_ATTRIBUTE_COMPRESSED (2048) +#define FILE_ATTRIBUTE_NORMAL (128) +#define FILE_ATTRIBUTE_DIRECTORY (16) +#define FILE_ATTRIBUTE_HIDDEN (2) +#define FILE_ATTRIBUTE_READONLY (1) +#define FILE_ATTRIBUTE_SYSTEM (4) +#define FILE_ATTRIBUTE_TEMPORARY (256) +#define FILE_FLAG_WRITE_THROUGH (2147483648) +#define FILE_FLAG_OVERLAPPED (1073741824) +#define FILE_FLAG_NO_BUFFERING (536870912) +#define FILE_FLAG_RANDOM_ACCESS (268435456) +#define FILE_FLAG_SEQUENTIAL_SCAN (134217728) +#define FILE_FLAG_DELETE_ON_CLOSE (67108864) +#define FILE_FLAG_BACKUP_SEMANTICS (33554432) +#define FILE_FLAG_POSIX_SEMANTICS (16777216) +#define SECURITY_ANONYMOUS (0) +#define SECURITY_IDENTIFICATION (65536) +#define SECURITY_IMPERSONATION (131072) +#define SECURITY_DELEGATION (196608) +#define SECURITY_CONTEXT_TRACKING (262144) +#define SECURITY_EFFECTIVE_ONLY (524288) +#define SECURITY_SQOS_PRESENT (1048576) + +/* CreateFileMapping, VirtualAlloc, VirtualFree, VirtualProtect */ +#define SEC_COMMIT (134217728) +#define SEC_IMAGE (16777216) +#define SEC_NOCACHE (268435456) +#define SEC_RESERVE (67108864) +#define PAGE_READONLY (2) +#define PAGE_READWRITE (4) +#define PAGE_WRITECOPY (8) +#define PAGE_EXECUTE (16) +#define PAGE_EXECUTE_READ (32) +#define PAGE_EXECUTE_READWRITE (64) +#define PAGE_EXECUTE_WRITECOPY (128) +#define PAGE_GUARD (256) +#define PAGE_NOACCESS (1) +#define PAGE_NOCACHE (512) +#define MEM_COMMIT (4096) +#define MEM_FREE (65536) +#define MEM_RESERVE (8192) +#define MEM_IMAGE (16777216) +#define MEM_MAPPED (262144) +#define MEM_PRIVATE (131072) +#define MEM_DECOMMIT (16384) +#define MEM_RELEASE (32768) +#define MEM_TOP_DOWN (1048576) +#define EXCEPTION_GUARD_PAGE (0x80000001L) +#define SECTION_EXTEND_SIZE (0x10) +#define SECTION_MAP_READ (0x4) +#define SECTION_MAP_WRITE (0x2) +#define SECTION_QUERY (0x1) +#define SECTION_ALL_ACCESS (0xf001fL) + +/* CreateFont */ +#define FW_DONTCARE (0) +#define FW_THIN (100) +#define FW_EXTRALIGHT (200) +#define FW_LIGHT (300) +#define FW_NORMAL (400) +#define FW_REGULAR FW_NORMAL +#define FW_MEDIUM (500) +#define FW_SEMIBOLD (600) +#define FW_BOLD (700) +#define FW_EXTRABOLD (800) +#define FW_HEAVY (900) +#define ANSI_CHARSET (0) +#define DEFAULT_CHARSET (1) +#define SYMBOL_CHARSET (2) +#define SHIFTJIS_CHARSET (128) +#define HANGEUL_CHARSET (129) +#define GB2312_CHARSET (134) +#define CHINESEBIG5_CHARSET (136) +#define GREEK_CHARSET (161) +#define TURKISH_CHARSET (162) +#define HEBREW_CHARSET (177) +#define ARABIC_CHARSET (178) +#define BALTIC_CHARSET (186) +#define RUSSIAN_CHARSET (204) +#define THAI_CHARSET (222) +#define EASTEUROPE_CHARSET (238) +#define OEM_CHARSET (255) +#define OUT_DEFAULT_PRECIS (0) +#define OUT_STRING_PRECIS (1) +#define OUT_CHARACTER_PRECIS (2) +#define OUT_STROKE_PRECIS (3) +#define OUT_TT_PRECIS (4) +#define OUT_DEVICE_PRECIS (5) +#define OUT_RASTER_PRECIS (6) +#define OUT_TT_ONLY_PRECIS (7) +#define OUT_OUTLINE_PRECIS (8) +#define CLIP_DEFAULT_PRECIS (0) +#define CLIP_CHARACTER_PRECIS (1) +#define CLIP_STROKE_PRECIS (2) +#define CLIP_MASK (15) +#define CLIP_LH_ANGLES (16) +#define CLIP_TT_ALWAYS (32) +#define CLIP_EMBEDDED (128) +#define DEFAULT_QUALITY (0) +#define DRAFT_QUALITY (1) +#define PROOF_QUALITY (2) +#define DEFAULT_PITCH (0) +#define FIXED_PITCH (1) +#define VARIABLE_PITCH (2) +#define FF_DECORATIVE (80) +#define FF_DONTCARE (0) +#define FF_MODERN (48) +#define FF_ROMAN (16) +#define FF_SCRIPT (64) +#define FF_SWISS (32) + +/* CreateHatchBrush */ +#define HS_BDIAGONAL (3) +#define HS_CROSS (4) +#define HS_DIAGCROSS (5) +#define HS_FDIAGONAL (2) +#define HS_HORIZONTAL (0) +#define HS_VERTICAL (1) + +/* CreateIconFromResourceEx */ +#define LR_DEFAULTCOLOR (0) +#define LR_LOADREALSIZE (128) +#define LR_MONOCHROME (1) + +/* CreateMailslot, GetMailslotInfo */ +#define MAILSLOT_WAIT_FOREVER (0xffffffffL) +#define MAILSLOT_NO_MESSAGE (0xffffffffL) + +/* CreateMappedBitmap */ +#define CMB_MASKED (2) + +/* CreateNamedPipe */ +#define PIPE_ACCESS_DUPLEX (3) +#define PIPE_ACCESS_INBOUND (1) +#define PIPE_ACCESS_OUTBOUND (2) +#define WRITE_DAC (0x40000L) +#define WRITE_OWNER (0x80000L) +#define ACCESS_SYSTEM_SECURITY (0x1000000L) +#define PIPE_TYPE_BYTE (0) +#define PIPE_TYPE_MESSAGE (4) +#define PIPE_READMODE_BYTE (0) +#define PIPE_READMODE_MESSAGE (2) +#define PIPE_WAIT (0) +#define PIPE_NOWAIT (1) + +/* CreatePen, ExtCreatePen */ +#define PS_GEOMETRIC (65536) +#define PS_COSMETIC (0) +#define PS_ALTERNATE (8) +#define PS_SOLID (0) +#define PS_DASH (1) +#define PS_DOT (2) +#define PS_DASHDOT (3) +#define PS_DASHDOTDOT (4) +#define PS_NULL (5) +#define PS_USERSTYLE (7) +#define PS_INSIDEFRAME (6) +#define PS_ENDCAP_ROUND (0) +#define PS_ENDCAP_SQUARE (256) +#define PS_ENDCAP_FLAT (512) +#define PS_JOIN_BEVEL (4096) +#define PS_JOIN_MITER (8192) +#define PS_JOIN_ROUND (0) +#define PS_STYLE_MASK (15) +#define PS_ENDCAP_MASK (3840) +#define PS_TYPE_MASK (983040) + +/* CreatePolygonRgn */ +#define ALTERNATE (1) +#define WINDING (2) + +/* CreateProcess */ +#define CREATE_DEFAULT_ERROR_MODE (67108864) +#define CREATE_NEW_CONSOLE (16) +#define CREATE_NEW_PROCESS_GROUP (512) +#define CREATE_SEPARATE_WOW_VDM (2048) +#define CREATE_SUSPENDED (4) +#define CREATE_UNICODE_ENVIRONMENT (1024) +#define DEBUG_PROCESS (1) +#define DEBUG_ONLY_THIS_PROCESS (2) +#define DETACHED_PROCESS (8) +#define HIGH_PRIORITY_CLASS (128) +#define IDLE_PRIORITY_CLASS (64) +#define NORMAL_PRIORITY_CLASS (32) +#define REALTIME_PRIORITY_CLASS (256) + +/* CreateService */ +#define SERVICE_ALL_ACCESS (0xf01ffL) +#define SERVICE_CHANGE_CONFIG (2) +#define SERVICE_ENUMERATE_DEPENDENTS (8) +#define SERVICE_INTERROGATE (128) +#define SERVICE_PAUSE_CONTINUE (64) +#define SERVICE_QUERY_CONFIG (1) +#define SERVICE_QUERY_STATUS (4) +#define SERVICE_START (16) +#define SERVICE_STOP (32) +#define SERVICE_USER_DEFINED_CONTROL (256) +#define DELETE (0x10000L) +#define READ_CONTROL (0x20000L) +#define GENERIC_EXECUTE (0x20000000L) +#define SERVICE_WIN32_OWN_PROCESS (16) +#define SERVICE_WIN32_SHARE_PROCESS (32) +#define SERVICE_KERNEL_DRIVER (1) +#define SERVICE_FILE_SYSTEM_DRIVER (2) +#define SERVICE_INTERACTIVE_PROCESS (256) +#define SERVICE_BOOT_START (0) +#define SERVICE_SYSTEM_START (1) +#define SERVICE_AUTO_START (2) +#define SERVICE_DEMAND_START (3) +#define SERVICE_DISABLED (4) +#define SERVICE_ERROR_IGNORE (0) +#define SERVICE_ERROR_NORMAL (1) +#define SERVICE_ERROR_SEVERE (2) +#define SERVICE_ERROR_CRITICAL (3) + +/* CreateTapePartition, WriteTapemark */ +#define TAPE_FIXED_PARTITIONS (0L) +#define TAPE_INITIATOR_PARTITIONS (0x2L) +#define TAPE_SELECT_PARTITIONS (0x1L) +#define TAPE_FILEMARKS (0x1L) +#define TAPE_LONG_FILEMARKS (0x3L) +#define TAPE_SETMARKS (0L) +#define TAPE_SHORT_FILEMARKS (0x2L) + +/* CreateWindow */ +#define CW_USEDEFAULT (0x80000000) +#define WS_BORDER (0x800000L) +#define WS_CAPTION (0xc00000L) +#define WS_CHILD (0x40000000L) +#define WS_CHILDWINDOW (0x40000000L) +#define WS_CLIPCHILDREN (0x2000000L) +#define WS_CLIPSIBLINGS (0x4000000L) +#define WS_DISABLED (0x8000000L) +#define WS_DLGFRAME (0x400000L) +#define WS_GROUP (0x20000L) +#define WS_HSCROLL (0x100000L) +#define WS_ICONIC (0x20000000L) +#define WS_MAXIMIZE (0x1000000L) +#define WS_MAXIMIZEBOX (0x10000L) +#define WS_MINIMIZE (0x20000000L) +#define WS_MINIMIZEBOX (0x20000L) +#define WS_OVERLAPPED (0L) +#define WS_OVERLAPPEDWINDOW (0xcf0000L) +#define WS_POPUP (0x80000000L) +#define WS_POPUPWINDOW (0x80880000L) +#define WS_SIZEBOX (0x40000L) +#define WS_SYSMENU (0x80000L) +#define WS_TABSTOP (0x10000L) +#define WS_THICKFRAME (0x40000L) +#define WS_TILED (0L) +#define WS_TILEDWINDOW (0xcf0000L) +#define WS_VISIBLE (0x10000000L) +#define WS_VSCROLL (0x200000L) +#define MDIS_ALLCHILDSTYLES (0x1) +#define BS_3STATE (0x5L) +#define BS_AUTO3STATE (0x6L) +#define BS_AUTOCHECKBOX (0x3L) +#define BS_AUTORADIOBUTTON (0x9L) +#define BS_BITMAP (0x80L) +#define BS_BOTTOM (0x800L) +#define BS_CENTER (0x300L) +#define BS_CHECKBOX (0x2L) +#define BS_DEFPUSHBUTTON (0x1L) +#define BS_GROUPBOX (0x7L) +#define BS_ICON (0x40L) +#define BS_LEFT (0x100L) +#define BS_LEFTTEXT (0x20L) +#define BS_MULTILINE (0x2000L) +#define BS_NOTIFY (0x4000L) +#define BS_OWNERDRAW (0xbL) +#define BS_PUSHBUTTON (0L) +#define BS_PUSHLIKE (0x1000L) +#define BS_RADIOBUTTON (0x4L) +#define BS_RIGHT (0x200L) +#define BS_RIGHTBUTTON (0x20L) +#define BS_TEXT (0L) +#define BS_TOP (0x400L) +#define BS_USERBUTTON (0x8L) +#define BS_VCENTER (0xc00L) +#define CBS_AUTOHSCROLL (0x40L) +#define CBS_DISABLENOSCROLL (0x800L) +#define CBS_DROPDOWN (0x2L) +#define CBS_DROPDOWNLIST (0x3L) +#define CBS_HASSTRINGS (0x200L) +#define CBS_LOWERCASE (0x4000L) +#define CBS_NOINTEGRALHEIGHT (0x400L) +#define CBS_OEMCONVERT (0x80L) +#define CBS_OWNERDRAWFIXED (0x10L) +#define CBS_OWNERDRAWVARIABLE (0x20L) +#define CBS_SIMPLE (0x1L) +#define CBS_SORT (0x100L) +#define CBS_UPPERCASE (0x2000L) +#define ES_AUTOHSCROLL (0x80L) +#define ES_AUTOVSCROLL (0x40L) +#define ES_CENTER (0x1L) +#define ES_LEFT (0L) +#define ES_LOWERCASE (0x10L) +#define ES_MULTILINE (0x4L) +#define ES_NOHIDESEL (0x100L) +#define ES_NUMBER (0x2000L) +#define ES_OEMCONVERT (0x400L) +#define ES_PASSWORD (0x20L) +#define ES_READONLY (0x800L) +#define ES_RIGHT (0x2L) +#define ES_UPPERCASE (0x8L) +#define ES_WANTRETURN (0x1000L) +#define LBS_DISABLENOSCROLL (0x1000L) +#define LBS_EXTENDEDSEL (0x800L) +#define LBS_HASSTRINGS (0x40L) +#define LBS_MULTICOLUMN (0x200L) +#define LBS_MULTIPLESEL (0x8L) +#define LBS_NODATA (0x2000L) +#define LBS_NOINTEGRALHEIGHT (0x100L) +#define LBS_NOREDRAW (0x4L) +#define LBS_NOSEL (0x4000L) +#define LBS_NOTIFY (0x1L) +#define LBS_OWNERDRAWFIXED (0x10L) +#define LBS_OWNERDRAWVARIABLE (0x20L) +#define LBS_SORT (0x2L) +#define LBS_STANDARD (0xa00003L) +#define LBS_USETABSTOPS (0x80L) +#define LBS_WANTKEYBOARDINPUT (0x400L) +#define SBS_BOTTOMALIGN (0x4L) +#define SBS_HORZ (0L) +#define SBS_LEFTALIGN (0x2L) +#define SBS_RIGHTALIGN (0x4L) +#define SBS_SIZEBOX (0x8L) +#define SBS_SIZEBOXBOTTOMRIGHTALIGN (0x4L) +#define SBS_SIZEBOXTOPLEFTALIGN (0x2L) +#define SBS_SIZEGRIP (0x10L) +#define SBS_TOPALIGN (0x2L) +#define SBS_VERT (0x1L) +#define SS_BITMAP (0xeL) +#define SS_BLACKFRAME (0x7L) +#define SS_BLACKRECT (0x4L) +#define SS_CENTER (0x1L) +#define SS_CENTERIMAGE (0x200L) +#define SS_ENHMETAFILE (0xfL) +#define SS_ETCHEDFRAME (0x12L) +#define SS_ETCHEDHORZ (0x10L) +#define SS_ETCHEDVERT (0x11L) +#define SS_GRAYFRAME (0x8L) +#define SS_GRAYRECT (0x5L) +#define SS_ICON (0x3L) +#define SS_LEFT (0L) +#define SS_LEFTNOWORDWRAP (0xcL) +#define SS_NOPREFIX (0x80L) +#define SS_NOTIFY (0x100L) +#define SS_OWNERDRAW (0xdL) +#define SS_REALSIZEIMAGE (0x800L) +#define SS_RIGHT (0x2L) +#define SS_RIGHTJUST (0x400L) +#define SS_SIMPLE (0xbL) +#define SS_SUNKEN (0x1000L) +#define SS_USERITEM (0xaL) +#define SS_WHITEFRAME (0x9L) +#define SS_WHITERECT (0x6L) +#define DS_3DLOOK (0x4L) +#define DS_ABSALIGN (0x1L) +#define DS_CENTER (0x800L) +#define DS_CENTERMOUSE (0x1000L) +#define DS_CONTEXTHELP (0x2000L) +#define DS_CONTROL (0x400L) +#define DS_FIXEDSYS (0x8L) +#define DS_LOCALEDIT (0x20L) +#define DS_MODALFRAME (0x80L) +#define DS_NOFAILCREATE (0x10L) +#define DS_NOIDLEMSG (0x100L) +#define DS_SETFONT (0x40L) +#define DS_SETFOREGROUND (0x200L) +#define DS_SYSMODAL (0x2L) + +/* CreateWindowEx */ +#define WS_EX_ACCEPTFILES (0x10L) +#define WS_EX_APPWINDOW (0x40000L) +#define WS_EX_CLIENTEDGE (0x200L) +#define WS_EX_CONTEXTHELP (0x400L) +#define WS_EX_CONTROLPARENT (0x10000L) +#define WS_EX_DLGMODALFRAME (0x1L) +#define WS_EX_LEFT (0L) +#define WS_EX_LEFTSCROLLBAR (0x4000L) +#define WS_EX_LTRREADING (0L) +#define WS_EX_MDICHILD (0x40L) +#define WS_EX_NOPARENTNOTIFY (0x4L) +#define WS_EX_OVERLAPPEDWINDOW (0x300L) +#define WS_EX_PALETTEWINDOW (0x188L) +#define WS_EX_RIGHT (0x1000L) +#define WS_EX_RIGHTSCROLLBAR (0L) +#define WS_EX_RTLREADING (0x2000L) +#define WS_EX_STATICEDGE (0x20000L) +#define WS_EX_TOOLWINDOW (0x80L) +#define WS_EX_TOPMOST (0x8L) +#define WS_EX_TRANSPARENT (0x20L) +#define WS_EX_WINDOWEDGE (0x100L) + +/* CreateWindowStation */ +#define WINSTA_ACCESSCLIPBOARD (0x4L) +#define WINSTA_ACCESSGLOBALATOMS (0x20L) +#define WINSTA_CREATEDESKTOP (0x8L) +#define WINSTA_ENUMDESKTOPS (0x1L) +#define WINSTA_ENUMERATE (0x100L) +#define WINSTA_EXITWINDOWS (0x40L) +#define WINSTA_READATTRIBUTES (0x2L) +#define WINSTA_READSCREEN (0x200L) +#define WINSTA_WRITEATTRIBUTES (0x10L) + +/* DdeCallback */ + +/* DdeClientTransaction */ + +/* DdeEnableCallback */ + +/* DdeGetLastError */ + +/* DdeInitialize */ + +/* DdeNameService */ + +/* DebugProc */ +#define WH_CALLWNDPROC (4) +#define WH_CALLWNDPROCRET (12) +#define WH_CBT (5) +#define WH_DEBUG (9) +#define WH_GETMESSAGE (3) +#define WH_JOURNALPLAYBACK (1) +#define WH_JOURNALRECORD (0) +#define WH_KEYBOARD (2) +#define WH_MOUSE (7) +#define WH_MSGFILTER (-1) +#define WH_SHELL (10) +#define WH_SYSMSGFILTER (6) +#define WH_MSGFILTER (-1) +#define WH_FOREGROUNDIDLE (11) + +/* DefineDosDevice */ +#define DDD_RAW_TARGET_PATH (1) +#define DDD_REMOVE_DEFINITION (2) +#define DDD_EXACT_MATCH_ON_REMOVE (4) + +/* DeviceCapbilities */ +#define DC_BINNAMES (12) +#define DC_BINS (6) +#define DC_COPIES (18) +#define DC_DRIVER (11) +#define DC_DATATYPE_PRODUCED (21) +#define DC_DUPLEX (7) +#define DC_EMF_COMPLIANT (20) +#define DC_ENUMRESOLUTIONS (13) +#define DC_EXTRA (9) +#define DC_FIELDS (1) +#define DC_FILEDEPENDENCIES (14) +#define DC_MAXEXTENT (5) +#define DC_MINEXTENT (4) +#define DC_ORIENTATION (17) +#define DC_PAPERNAMES (16) +#define DC_PAPERS (2) +#define DC_PAPERSIZE (3) +#define DC_SIZE (8) +#define DC_TRUETYPE (15) +#define DCTT_BITMAP (0x1L) +#define DCTT_DOWNLOAD (0x2L) +#define DCTT_SUBDEV (0x4L) +#define DC_VERSION (10) +#define DC_BINADJUST (19) +#define DC_DATATYPE_PRODUCED (21) + +/* DeviceIoControl */ + +/* DlgDirList */ +#define DDL_ARCHIVE (32) +#define DDL_DIRECTORY (16) +#define DDL_DRIVES (16384) +#define DDL_EXCLUSIVE (32768) +#define DDL_HIDDEN (2) +#define DDL_READONLY (1) +#define DDL_READWRITE (0) +#define DDL_SYSTEM (4) +#define DDL_POSTMSGS (8192) + +/* DllEntryPoint */ +#define DLL_PROCESS_ATTACH (1) +#define DLL_THREAD_ATTACH (2) +#define DLL_PROCESS_DETACH (0) +#define DLL_THREAD_DETACH (3) + +/* DocumentProperties */ +#define DM_IN_BUFFER (8) +#define DM_MODIFY (8) +#define DM_IN_PROMPT (4) +#define DM_PROMPT (4) +#define DM_OUT_BUFFER (2) +#define DM_COPY (2) +#define DM_UPDATE (1) + +/* DrawAnimatedRects */ +#define IDANI_OPEN (1) +#define IDANI_CLOSE (2) + +/* DrawCaption */ +#define DC_ACTIVE (1) +#define DC_SMALLCAP (2) + +/* DrawEdge */ +#define BDR_RAISEDINNER (4) +#define BDR_SUNKENINNER (8) +#define BDR_RAISEDOUTER (1) +#define BDR_SUNKENOUTER (1) +#define EDGE_BUMP (9) +#define EDGE_ETCHED (6) +#define EDGE_RAISED (5) +#define EDGE_SUNKEN (10) +#define BF_ADJUST (8192) +#define BF_BOTTOM (8) +#define BF_BOTTOMLEFT (9) +#define BF_BOTTOMRIGHT (12) +#define BF_DIAGONAL (16) +#define BF_DIAGONAL_ENDBOTTOMLEFT (25) +#define BF_DIAGONAL_ENDBOTTOMRIGHT (28) +#define BF_DIAGONAL_ENDTOPLEFT (19) +#define BF_DIAGONAL_ENDTOPRIGHT (22) +#define BF_FLAT (16384) +#define BF_LEFT (1) +#define BF_MIDDLE (2048) +#define BF_MONO (32768) +#define BF_RECT (15) +#define BF_RIGHT (4) +#define BF_SOFT (4096) +#define BF_TOP (2) +#define BF_TOPLEFT (3) +#define BF_TOPRIGHT (6) + +/* DrawFrameControl */ +#define DFC_BUTTON (4) +#define DFC_CAPTION (1) +#define DFC_MENU (2) +#define DFC_SCROLL (3) +#define DFCS_BUTTON3STATE (8) +#define DFCS_BUTTONCHECK (0) +#define DFCS_BUTTONPUSH (16) +#define DFCS_BUTTONRADIO (4) +#define DFCS_BUTTONRADIOIMAGE (1) +#define DFCS_BUTTONRADIOMASK (2) +#define DFCS_CAPTIONCLOSE (0) +#define DFCS_CAPTIONHELP (4) +#define DFCS_CAPTIONMAX (2) +#define DFCS_CAPTIONMIN (1) +#define DFCS_CAPTIONRESTORE (3) +#define DFCS_MENUARROW (0) +#define DFCS_MENUBULLET (2) +#define DFCS_MENUCHECK (1) +#define DFCS_SCROLLCOMBOBOX (5) +#define DFCS_SCROLLDOWN (1) +#define DFCS_SCROLLLEFT (2) +#define DFCS_SCROLLRIGHT (3) +#define DFCS_SCROLLSIZEGRIP (8) +#define DFCS_SCROLLUP (0) +#define DFCS_ADJUSTRECT (8192) +#define DFCS_CHECKED (1024) +#define DFCS_FLAT (16384) +#define DFCS_INACTIVE (256) +#define DFCS_MONO (32768) +#define DFCS_PUSHED (512) + +/* DrawIconEx */ +#define DI_COMPAT (4) +#define DI_DEFAULTSIZE (8) +#define DI_IMAGE (2) +#define DI_MASK (1) +#define DI_NORMAL (3) + +/* DrawState */ +#define DST_BITMAP (4) +#define DST_COMPLEX (0) +#define DST_ICON (3) +#define DST_PREFIXTEXT (2) +#define DST_TEXT (1) +#define DSS_NORMAL (0) +#define DSS_UNION (16) +#define DSS_DISABLED (32) +#define DSS_MONO (128) + +/* DrawStatusText */ +#define SBT_NOBORDERS (256) +#define SBT_OWNERDRAW (4096) +#define SBT_POPOUT (512) +#define SBT_RTLREADING (1024) + +/* DrawText, DrawTextEx */ +#define DT_BOTTOM (8) +#define DT_CALCRECT (1024) +#define DT_CENTER (1) +#define DT_EDITCONTROL (8192) +#define DT_END_ELLIPSIS (32768) +#define DT_PATH_ELLIPSIS (16384) +#define DT_EXPANDTABS (64) +#define DT_EXTERNALLEADING (512) +#define DT_LEFT (0) +#define DT_MODIFYSTRING (65536) +#define DT_NOCLIP (256) +#define DT_NOPREFIX (2048) +#define DT_RIGHT (2) +#define DT_RTLREADING (131072) +#define DT_SINGLELINE (32) +#define DT_TABSTOP (128) +#define DT_TOP (0) +#define DT_VCENTER (4) +#define DT_WORDBREAK (16) +#define DT_INTERNAL (4096) + +/* DuplicateHandle, MapViewOfFile */ +#define DUPLICATE_CLOSE_SOURCE (1) +#define DUPLICATE_SAME_ACCESS (2) +#define FILE_MAP_ALL_ACCESS (0xf001fL) +#define FILE_MAP_READ (4) +#define FILE_MAP_WRITE (2) +#define FILE_MAP_COPY (1) +#define MUTEX_ALL_ACCESS (0x1f0001L) +#define MUTEX_MODIFY_STATE (1) +#define SYNCHRONIZE (0x100000L) +#define SEMAPHORE_ALL_ACCESS (0x1f0003L) +#define SEMAPHORE_MODIFY_STATE (2) +#define EVENT_ALL_ACCESS (0x1f0003L) +#define EVENT_MODIFY_STATE (2) +#define KEY_ALL_ACCESS (0xf003fL) +#define KEY_CREATE_LINK (32) +#define KEY_CREATE_SUB_KEY (4) +#define KEY_ENUMERATE_SUB_KEYS (8) +#define KEY_EXECUTE (0x20019L) +#define KEY_NOTIFY (16) +#define KEY_QUERY_VALUE (1) +#define KEY_READ (0x20019L) +#define KEY_SET_VALUE (2) +#define KEY_WRITE (0x20006L) +#define PROCESS_ALL_ACCESS (0x1f0fffL) +#define PROCESS_CREATE_PROCESS (128) +#define PROCESS_CREATE_THREAD (2) +#define PROCESS_DUP_HANDLE (64) +#define PROCESS_QUERY_INFORMATION (1024) +#define PROCESS_SET_INFORMATION (512) +#define PROCESS_TERMINATE (1) +#define PROCESS_VM_OPERATION (8) +#define PROCESS_VM_READ (16) +#define PROCESS_VM_WRITE (32) +#define THREAD_ALL_ACCESS (0x1f03ffL) +#define THREAD_DIRECT_IMPERSONATION (512) +#define THREAD_GET_CONTEXT (8) +#define THREAD_IMPERSONATE (256) +#define THREAD_QUERY_INFORMATION (64) +#define THREAD_SET_CONTEXT (16) +#define THREAD_SET_INFORMATION (32) +#define THREAD_SET_THREAD_TOKEN (128) +#define THREAD_SUSPEND_RESUME (2) +#define THREAD_TERMINATE (1) + +/* EditWordBreakProc */ +#define WB_ISDELIMITER (2) +#define WB_LEFT (0) +#define WB_RIGHT (1) + +/* EnableScrollBar */ +#define SB_BOTH (3) +#define SB_CTL (2) +#define SB_HORZ (0) +#define SB_VERT (1) +#define ESB_DISABLE_BOTH (3) +#define ESB_DISABLE_DOWN (2) +#define ESB_DISABLE_LEFT (1) +#define ESB_DISABLE_LTUP (1) +#define ESB_DISABLE_RIGHT (2) +#define ESB_DISABLE_RTDN (2) +#define ESB_DISABLE_UP (1) +#define ESB_ENABLE_BOTH (0) + +/* Scroll Bar notifications*/ +#define SB_LINEUP (0) +#define SB_LINEDOWN (1) +#define SB_LINELEFT (0) +#define SB_LINERIGHT (1) +#define SB_PAGEUP (2) +#define SB_PAGEDOWN (3) +#define SB_PAGELEFT (2) +#define SB_PAGERIGHT (3) +#define SB_THUMBPOSITION (4) +#define SB_THUMBTRACK (5) +#define SB_ENDSCROLL (8) +#define SB_LEFT (6) +#define SB_RIGHT (7) +#define SB_BOTTOM (7) +#define SB_TOP (6) + +/* EnumCalendarInfo */ +#define ENUM_ALL_CALENDARS (-1) + +/* EnumDateFormats */ +#define DATE_SHORTDATE (1) +#define DATE_LONGDATE (2) + +/* EnumDependentServices */ +#define SERVICE_ACTIVE (1) +#define SERVICE_INACTIVE (2) + +/* EnumFontFamExProc */ +#define DEVICE_FONTTYPE (2) +#define RASTER_FONTTYPE (1) +#define TRUETYPE_FONTTYPE (4) + +/* EnumObjects, GetCurrentObject, GetObjectType */ +#define OBJ_BRUSH (2) +#define OBJ_PEN (1) +#define OBJ_PAL (5) +#define OBJ_FONT (6) +#define OBJ_BITMAP (7) +#define OBJ_EXTPEN (11) +#define OBJ_REGION (8) +#define OBJ_DC (3) +#define OBJ_MEMDC (10) +#define OBJ_METAFILE (9) +#define OBJ_METADC (4) +#define OBJ_ENHMETAFILE (13) +#define OBJ_ENHMETADC (12) + +/* EnumPrinters */ + +/* EnumProtocols */ + +/* EnumResLangProc */ +#define RT_ACCELERATOR (MAKEINTRESOURCE(9)) +#define RT_BITMAP (MAKEINTRESOURCE(2)) +#define RT_DIALOG (MAKEINTRESOURCE(5)) +#define RT_FONT (MAKEINTRESOURCE(8)) +#define RT_FONTDIR (MAKEINTRESOURCE(7)) +#define RT_MENU (MAKEINTRESOURCE(4)) +#define RT_RCDATA (MAKEINTRESOURCE(10)) +#define RT_STRING (MAKEINTRESOURCE(6)) +#define RT_MESSAGETABLE (MAKEINTRESOURCE(11)) +#define RT_CURSOR (MAKEINTRESOURCE(1)) +#define RT_GROUP_CURSOR (MAKEINTRESOURCE(12)) +#define RT_ICON (MAKEINTRESOURCE(3)) +#define RT_GROUP_ICON (MAKEINTRESOURCE(13)) +#define RT_VERSION (MAKEINTRESOURCE(16)) + +/* EnumServicesStatus */ +#define SERVICE_WIN32 (48) +#define SERVICE_DRIVER (11) + +/* EnumSystemCodePages */ +#define CP_INSTALLED (1) +#define CP_SUPPORTED (2) + +/* EnumSystemLocales */ +#define LCID_INSTALLED (1) +#define LCID_SUPPORTED (2) + +/* EraseTape */ +#define TAPE_ERASE_LONG (0x1L) +#define TAPE_ERASE_SHORT (0L) + +/* Escape */ +#define SP_ERROR (-1) +#define SP_OUTOFDISK (-4) +#define SP_OUTOFMEMORY (-5) +#define SP_USERABORT (-3) +#define PHYSICALWIDTH (110) +#define PHYSICALHEIGHT (111) +#define PHYSICALOFFSETX (112) +#define PHYSICALOFFSETY (113) +#define SCALINGFACTORX (114) +#define SCALINGFACTORY (115) +#define QUERYESCSUPPORT (8) +#define ABORTDOC (2) +#define ENDDOC (11) +#define GETPHYSPAGESIZE (12) +#define GETPRINTINGOFFSET (13) +#define GETSCALINGFACTOR (14) +#define NEWFRAME (1) +#define NEXTBAND (3) +#define PASSTHROUGH (19) +#define SETABORTPROC (9) +#define STARTDOC (10) + +/* EscapeCommFunction */ +#define CLRDTR (6) +#define CLRRTS (4) +#define SETDTR (5) +#define SETRTS (3) +#define SETXOFF (1) +#define SETXON (2) +#define SETBREAK (8) +#define CLRBREAK (9) + +/* ExitWindowsEx */ +#define EWX_FORCE (4) +#define EWX_LOGOFF (0) +#define EWX_POWEROFF (8) +#define EWX_REBOOT (2) +#define EWX_SHUTDOWN (1) + +/* ExtFloodFill */ +#define FLOODFILLBORDER (0) +#define FLOODFILLSURFACE (1) + +/* ExtTextOut */ +#define ETO_CLIPPED (4) +#define ETO_GLYPH_INDEX (16) +#define ETO_OPAQUE (2) +#define ETO_RTLREADING (128) + +/* FillConsoleOutputAttribute */ +#define FOREGROUND_BLUE (1) +#define FOREGROUND_GREEN (2) +#define FOREGROUND_RED (4) +#define FOREGROUND_INTENSITY (8) +#define BACKGROUND_BLUE (16) +#define BACKGROUND_GREEN (32) +#define BACKGROUND_RED (64) +#define BACKGROUND_INTENSITY (128) + +/* FindFirstChangeNotification */ +#define FILE_NOTIFY_CHANGE_FILE_NAME (1) +#define FILE_NOTIFY_CHANGE_DIR_NAME (2) +#define FILE_NOTIFY_CHANGE_ATTRIBUTES (4) +#define FILE_NOTIFY_CHANGE_SIZE (8) +#define FILE_NOTIFY_CHANGE_LAST_WRITE (16) +#define FILE_NOTIFY_CHANGE_SECURITY (256) + +/* FindFirstPrinterChangeNotification */ + +/* FindNextPrinterNotification */ + +/* FMExtensionProc */ + +/* FoldString */ +#define MAP_FOLDCZONE (16) +#define MAP_FOLDDIGITS (128) +#define MAP_PRECOMPOSED (32) +#define MAP_COMPOSITE (64) + +/* ForegroundIdleProc */ +#define HC_ACTION (0) + +/* FormatMessage */ +#define FORMAT_MESSAGE_ALLOCATE_BUFFER (256) +#define FORMAT_MESSAGE_IGNORE_INSERTS (512) +#define FORMAT_MESSAGE_FROM_STRING (1024) +#define FORMAT_MESSAGE_FROM_HMODULE (2048) +#define FORMAT_MESSAGE_FROM_SYSTEM (4096) +#define FORMAT_MESSAGE_ARGUMENT_ARRAY (8192) +#define FORMAT_MESSAGE_MAX_WIDTH_MASK (255) + +/* GdiComment */ +#define GDICOMMENT_WINDOWS_METAFILE (-2147483647) +#define GDICOMMENT_BEGINGROUP (2) +#define GDICOMMENT_ENDGROUP (3) +#define GDICOMMENT_MULTIFORMATS (1073741828) +#define GDICOMMENT_IDENTIFIER (1128875079) + +/* GenerateConsoleCtrlEvent, HandlerRoutine */ +#define CTRL_C_EVENT (0) +#define CTRL_BREAK_EVENT (1) +#define CTRL_CLOSE_EVENT (2) +#define CTRL_LOGOFF_EVENT (5) +#define CTRL_SHUTDOWN_EVENT (6) + +/* GetAddressByName */ + +/* GetArcDirection */ +#define AD_COUNTERCLOCKWISE (1) +#define AD_CLOCKWISE (2) + +/* GetBinaryTypes */ +#define SCS_32BIT_BINARY (0) +#define SCS_DOS_BINARY (1) +#define SCS_OS216_BINARY (5) +#define SCS_PIF_BINARY (3) +#define SCS_POSIX_BINARY (4) +#define SCS_WOW_BINARY (2) + +/* GetBoundsRect, SetBoundsRect */ +#define DCB_DISABLE (8) +#define DCB_ENABLE (4) +#define DCB_RESET (1) +#define DCB_SET (3) +#define DCB_ACCUMULATE (2) + +/* GetCharacterPlacement, GetFontLanguageInfo */ +#define GCP_DBCS (1) +#define GCP_ERROR (0x8000) +#define GCP_CLASSIN (0x80000L) +#define GCP_DIACRITIC (256) +#define GCP_DISPLAYZWG (0x400000L) +#define GCP_GLYPHSHAPE (16) +#define GCP_JUSTIFY (0x10000L) +#define GCP_JUSTIFYIN (0x200000L) +#define GCP_KASHIDA (1024) +#define GCP_LIGATE (32) +#define GCP_MAXEXTENT (0x100000L) +#define GCP_NEUTRALOVERRIDE (0x2000000L) +#define GCP_NUMERICOVERRIDE (0x1000000L) +#define GCP_NUMERICSLATIN (0x4000000L) +#define GCP_NUMERICSLOCAL (0x8000000L) +#define GCP_REORDER (2) +#define GCP_SYMSWAPOFF (0x800000L) +#define GCP_USEKERNING (8) +#define FLI_GLYPHS (0x40000L) +#define FLI_MASK (0x103b) + +/* GetClassLong, GetClassWord */ +#define GCW_ATOM (-32) +#define GCL_CBCLSEXTRA (-20) +#define GCL_CBWNDEXTRA (-18) +#define GCL_HBRBACKGROUND (-10) +#define GCL_HCURSOR (-12) +#define GCL_HICON (-14) +#define GCL_HICONSM (-34) +#define GCL_HMODULE (-16) +#define GCL_MENUNAME (-8) +#define GCL_STYLE (-26) +#define GCL_WNDPROC (-24) + +/* GetClipboardFormat, SetClipboardData */ +#define CF_BITMAP (2) +#define CF_DIB (8) +#define CF_PALETTE (9) +#define CF_ENHMETAFILE (14) +#define CF_METAFILEPICT (3) +#define CF_OEMTEXT (7) +#define CF_TEXT (1) +#define CF_UNICODETEXT (13) +#define CF_DIF (5) +#define CF_DSPBITMAP (130) +#define CF_DSPENHMETAFILE (142) +#define CF_DSPMETAFILEPICT (131) +#define CF_DSPTEXT (129) +#define CF_GDIOBJFIRST (768) +#define CF_GDIOBJLAST (1023) +#define CF_HDROP (15) +#define CF_LOCALE (16) +#define CF_OWNERDISPLAY (128) +#define CF_PENDATA (10) +#define CF_PRIVATEFIRST (512) +#define CF_PRIVATELAST (767) +#define CF_RIFF (11) +#define CF_SYLK (4) +#define CF_WAVE (12) +#define CF_TIFF (6) + +/* GetCommMask */ +#define EV_BREAK (64) +#define EV_CTS (8) +#define EV_DSR (16) +#define EV_ERR (128) +#define EV_EVENT1 (2048) +#define EV_EVENT2 (4096) +#define EV_PERR (512) +#define EV_RING (256) +#define EV_RLSD (32) +#define EV_RX80FULL (1024) +#define EV_RXCHAR (1) +#define EV_RXFLAG (2) +#define EV_TXEMPTY (4) + +/* GetCommModemStatus */ +#define MS_CTS_ON (0x10L) +#define MS_DSR_ON (0x20L) +#define MS_RING_ON (0x40L) +#define MS_RLSD_ON (0x80L) + +/* GetComputerName */ +#define MAX_COMPUTERNAME_LENGTH (15) + +/* GetConsoleMode */ +#define ENABLE_LINE_INPUT (2) +#define ENABLE_ECHO_INPUT (4) +#define ENABLE_PROCESSED_INPUT (1) +#define ENABLE_WINDOW_INPUT (8) +#define ENABLE_MOUSE_INPUT (16) +#define ENABLE_PROCESSED_OUTPUT (1) +#define ENABLE_WRAP_AT_EOL_OUTPUT (2) + +/* GetCPInfo */ +#define CP_ACP (0) +#define CP_MACCP (2) +#define CP_OEMCP (1) + +/* GetDateFormat */ +#define DATE_SHORTDATE (1) +#define DATE_LONGDATE (2) +#define DATE_USE_ALT_CALENDAR (4) + +/* GetDCEx */ +#define DCX_WINDOW (0x1L) +#define DCX_CACHE (0x2L) +#define DCX_PARENTCLIP (0x20L) +#define DCX_CLIPSIBLINGS (0x10L) +#define DCX_CLIPCHILDREN (0x8L) +#define DCX_NORESETATTRS (0x4L) +#define DCX_LOCKWINDOWUPDATE (0x400L) +#define DCX_EXCLUDERGN (0x40L) +#define DCX_INTERSECTRGN (0x80L) +#define DCX_VALIDATE (0x200000L) + +/* GetDeviceCaps */ +#define DRIVERVERSION (0) +#define TECHNOLOGY (2) +#define DT_PLOTTER (0) +#define DT_RASDISPLAY (1) +#define DT_RASPRINTER (2) +#define DT_RASCAMERA (3) +#define DT_CHARSTREAM (4) +#define DT_METAFILE (5) +#define DT_DISPFILE (6) +#define HORZSIZE (4) +#define VERTSIZE (6) +#define HORZRES (8) +#define VERTRES (10) +#define LOGPIXELSX (88) +#define LOGPIXELSY (90) +#define BITSPIXEL (12) +#define PLANES (14) +#define NUMBRUSHES (16) +#define NUMPENS (18) +#define NUMFONTS (22) +#define NUMCOLORS (24) +#define ASPECTX (40) +#define ASPECTY (42) +#define ASPECTXY (44) +#define PDEVICESIZE (26) +#define CLIPCAPS (36) +#define SIZEPALETTE (104) +#define NUMRESERVED (106) +#define COLORRES (108) +#define PHYSICALWIDTH (110) +#define PHYSICALHEIGHT (111) +#define PHYSICALOFFSETX (112) +#define PHYSICALOFFSETY (113) +#define SCALINGFACTORX (114) +#define SCALINGFACTORY (115) +#define VREFRESH (116) +#define DESKTOPHORZRES (118) +#define DESKTOPVERTRES (117) +#define BLTALIGNMENT (119) +#define RASTERCAPS (38) +#define RC_BANDING (2) +#define RC_BITBLT (1) +#define RC_BITMAP64 (8) +#define RC_DI_BITMAP (128) +#define RC_DIBTODEV (512) +#define RC_FLOODFILL (4096) +#define RC_GDI20_OUTPUT (16) +#define RC_PALETTE (256) +#define RC_SCALING (4) +#define RC_STRETCHBLT (2048) +#define RC_STRETCHDIB (8192) +#define CURVECAPS (28) +#define CC_NONE (0) +#define CC_CIRCLES (1) +#define CC_PIE (2) +#define CC_CHORD (4) +#define CC_ELLIPSES (8) +#define CC_WIDE (16) +#define CC_STYLED (32) +#define CC_WIDESTYLED (64) +#define CC_INTERIORS (128) +#define CC_ROUNDRECT (256) +#define LINECAPS (30) +#define LC_NONE (0) +#define LC_POLYLINE (2) +#define LC_MARKER (4) +#define LC_POLYMARKER (8) +#define LC_WIDE (16) +#define LC_STYLED (32) +#define LC_WIDESTYLED (64) +#define LC_INTERIORS (128) +#define POLYGONALCAPS (32) +#define PC_NONE (0) +#define PC_POLYGON (1) +#define PC_RECTANGLE (2) +#define PC_WINDPOLYGON (4) +#define PC_SCANLINE (8) +#define PC_WIDE (16) +#define PC_STYLED (32) +#define PC_WIDESTYLED (64) +#define PC_INTERIORS (128) +#define TEXTCAPS (34) +#define TC_OP_CHARACTER (1) +#define TC_OP_STROKE (2) +#define TC_CP_STROKE (4) +#define TC_CR_90 (8) +#define TC_CR_ANY (16) +#define TC_SF_X_YINDEP (32) +#define TC_SA_DOUBLE (64) +#define TC_SA_INTEGER (128) +#define TC_SA_CONTIN (256) +#define TC_EA_DOUBLE (512) +#define TC_IA_ABLE (1024) +#define TC_UA_ABLE (2048) +#define TC_SO_ABLE (4096) +#define TC_RA_ABLE (8192) +#define TC_VA_ABLE (16384) +#define TC_RESERVED (32768) +#define TC_SCROLLBLT (65536) +#define PC_PATHS (512) + +/* GetDriveType */ +#define DRIVE_REMOVABLE (2) +#define DRIVE_FIXED (3) +#define DRIVE_REMOTE (4) +#define DRIVE_CDROM (5) +#define DRIVE_RAMDISK (6) +#define DRIVE_UNKNOWN (0) +#define DRIVE_NO_ROOT_DIR (1) + +/* GetExceptionCode */ +#define EXCEPTION_ACCESS_VIOLATION (0xc0000005L) +#define EXCEPTION_BREAKPOINT (0x80000003L) +#define EXCEPTION_DATATYPE_MISALIGNMENT (0x80000002L) +#define EXCEPTION_SINGLE_STEP (0x80000004L) +#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED (0xc000008cL) +#define EXCEPTION_FLT_DENORMAL_OPERAND (0xc000008dL) +#define EXCEPTION_FLT_DIVIDE_BY_ZERO (0xc000008eL) +#define EXCEPTION_FLT_INEXACT_RESULT (0xc000008fL) +#define EXCEPTION_FLT_INVALID_OPERATION (0xc0000090L) +#define EXCEPTION_FLT_OVERFLOW (0xc0000091L) +#define EXCEPTION_FLT_STACK_CHECK (0xc0000092L) +#define EXCEPTION_FLT_UNDERFLOW (0xc0000093L) +#define EXCEPTION_INT_DIVIDE_BY_ZERO (0xc0000094L) +#define EXCEPTION_INT_OVERFLOW (0xc0000095L) +#define EXCEPTION_INVALID_HANDLE (0xc0000008L) +#define EXCEPTION_PRIV_INSTRUCTION (0xc0000096L) +#define EXCEPTION_NONCONTINUABLE_EXCEPTION (0xc0000025L) +#define EXCEPTION_NONCONTINUABLE (0x1) +#define EXCEPTION_STACK_OVERFLOW (0xc00000fdL) +#define EXCEPTION_INVALID_DISPOSITION (0xc0000026L) + +/* GetFileType */ +#define FILE_TYPE_UNKNOWN (0) +#define FILE_TYPE_DISK (1) +#define FILE_TYPE_CHAR (2) +#define FILE_TYPE_PIPE (3) + +/* GetGlyphOutline */ +#define GGO_BITMAP (1) +#define GGO_NATIVE (2) +#define GGO_METRICS (0) +#define GGO_GRAY2_BITMAP (4) +#define GGO_GRAY4_BITMAP (5) +#define GGO_GRAY8_BITMAP (6) +#define GDI_ERROR (0xffffffffL) + +/* GetGraphicsMode */ +#define GM_COMPATIBLE (1) +#define GM_ADVANCED (2) + +/* GetHandleInformation */ +#define HANDLE_FLAG_INHERIT (1) +#define HANDLE_FLAG_PROTECT_FROM_CLOSE (2) + +/* GetIconInfo */ +#define IDC_ARROW (MAKEINTRESOURCE(32512)) +#define IDC_IBEAM (MAKEINTRESOURCE(32513)) +#define IDC_WAIT (MAKEINTRESOURCE(32514)) +#define IDC_CROSS (MAKEINTRESOURCE(32515)) +#define IDC_UPARROW (MAKEINTRESOURCE(32516)) +#define IDC_SIZENWSE (MAKEINTRESOURCE(32642)) +#define IDC_SIZENESW (MAKEINTRESOURCE(32643)) +#define IDC_SIZEWE (MAKEINTRESOURCE(32644)) +#define IDC_SIZENS (MAKEINTRESOURCE(32645)) +#define IDC_SIZEALL (MAKEINTRESOURCE(32646)) +#define IDC_NO (MAKEINTRESOURCE(32648)) +#define IDC_APPSTARTING (MAKEINTRESOURCE(32650)) +#define IDC_HELP (MAKEINTRESOURCE(32651)) +#define IDI_APPLICATION (MAKEINTRESOURCE(32512)) +#define IDI_HAND (MAKEINTRESOURCE(32513)) +#define IDI_QUESTION (MAKEINTRESOURCE(32514)) +#define IDI_EXCLAMATION (MAKEINTRESOURCE(32515)) +#define IDI_ASTERISK (MAKEINTRESOURCE(32516)) +#define IDI_WINLOGO (MAKEINTRESOURCE(32517)) +#define IDC_SIZE (MAKEINTRESOURCE(32640)) +#define IDC_ICON (MAKEINTRESOURCE(32641)) + +/* GetMapMode */ +#define MM_ANISOTROPIC (8) +#define MM_HIENGLISH (5) +#define MM_HIMETRIC (3) +#define MM_ISOTROPIC (7) +#define MM_LOENGLISH (4) +#define MM_LOMETRIC (2) +#define MM_TEXT (1) +#define MM_TWIPS (6) + +/* GetMenuDefaultItem */ +#define GMDI_GOINTOPOPUPS (0x2L) +#define GMDI_USEDISABLED (0x1L) + +/* PeekMessage */ +#define PM_NOREMOVE (0) +#define PM_REMOVE (1) +#define PM_NOYIELD (2) + +/* GetNamedPipeHandleState */ +#define PIPE_NOWAIT (1) +#define PIPE_READMODE_MESSAGE (2) + +/* GetNamedPipeInfo */ +#define PIPE_CLIENT_END (0) +#define PIPE_SERVER_END (1) +#define PIPE_TYPE_MESSAGE (4) + +/* GetNextWindow, GetWindow */ +#define GW_HWNDNEXT (2) +#define GW_HWNDPREV (3) +#define GW_CHILD (5) +#define GW_HWNDFIRST (0) +#define GW_HWNDLAST (1) +#define GW_OWNER (4) + +/* GetPath */ +#define PT_MOVETO (6) +#define PT_LINETO (2) +#define PT_BEZIERTO (4) +#define PT_CLOSEFIGURE (1) + +/* GetProcessShutdownParameters */ +#define SHUTDOWN_NORETRY (1) + +/* GetQueueStatus */ +#define QS_ALLEVENTS (191) +#define QS_ALLINPUT (255) +#define QS_HOTKEY (128) +#define QS_INPUT (7) +#define QS_KEY (1) +#define QS_MOUSE (6) +#define QS_MOUSEBUTTON (4) +#define QS_MOUSEMOVE (2) +#define QS_PAINT (32) +#define QS_POSTMESSAGE (8) +#define QS_SENDMESSAGE (64) +#define QS_TIMER (16) + +/* GetScrollInfo, SetScrollInfo */ +#define SIF_ALL (23) +#define SIF_PAGE (2) +#define SIF_POS (4) +#define SIF_RANGE (1) +#define SIF_DISABLENOSCROLL (8) + +/* GetStdHandle */ +#define STD_INPUT_HANDLE (DWORD)(-10) +#define STD_OUTPUT_HANDLE (DWORD)(-11) +#define STD_ERROR_HANDLE (DWORD)(-12) +#define INVALID_HANDLE_VALUE ((HANDLE)-1) + +/* GetStockObject */ +#define BLACK_BRUSH (4) +#define DKGRAY_BRUSH (3) +#define GRAY_BRUSH (2) +#define HOLLOW_BRUSH (5) +#define LTGRAY_BRUSH (1) +#define NULL_BRUSH (5) +#define WHITE_BRUSH (0) +#define BLACK_PEN (7) +#define NULL_PEN (8) +#define WHITE_PEN (6) +#define ANSI_FIXED_FONT (11) +#define ANSI_VAR_FONT (12) +#define DEVICE_DEFAULT_FONT (14) +#define DEFAULT_GUI_FONT (17) +#define OEM_FIXED_FONT (10) +#define SYSTEM_FONT (13) +#define SYSTEM_FIXED_FONT (16) +#define DEFAULT_PALETTE (15) + +/* GetStringTypeA */ +#define CT_CTYPE1 (1) +#define CT_CTYPE2 (2) +#define CT_CTYPE3 (4) +#define C1_UPPER (1) +#define C1_LOWER (2) +#define C1_DIGIT (4) +#define C1_SPACE (8) +#define C1_PUNCT (16) +#define C1_CNTRL (32) +#define C1_BLANK (64) +#define C1_XDIGIT (128) +#define C1_ALPHA (256) +#define C2_LEFTTORIGHT (1) +#define C2_RIGHTTOLEFT (2) +#define C2_EUROPENUMBER (3) +#define C2_EUROPESEPARATOR (4) +#define C2_EUROPETERMINATOR (5) +#define C2_ARABICNUMBER (6) +#define C2_COMMONSEPARATOR (7) +#define C2_BLOCKSEPARATOR (8) +#define C2_SEGMENTSEPARATOR (9) +#define C2_WHITESPACE (10) +#define C2_OTHERNEUTRAL (11) +#define C2_NOTAPPLICABLE (0) +#define C3_NONSPACING (1) +#define C3_DIACRITIC (2) +#define C3_VOWELMARK (4) +#define C3_SYMBOL (8) +#define C3_KATAKANA (16) +#define C3_HIRAGANA (32) +#define C3_HALFWIDTH (64) +#define C3_FULLWIDTH (128) +#define C3_IDEOGRAPH (256) +#define C3_KASHIDA (512) +#define C3_ALPHA (32768) +#define C3_NOTAPPLICABLE (0) + +/* GetSysColor */ +#define COLOR_3DDKSHADOW (21) +#define COLOR_3DFACE (15) +#define COLOR_3DHILIGHT (20) +#define COLOR_3DLIGHT (22) +#define COLOR_BTNHILIGHT (20) +#define COLOR_3DSHADOW (16) +#define COLOR_ACTIVEBORDER (10) +#define COLOR_ACTIVECAPTION (2) +#define COLOR_APPWORKSPACE (12) +#define COLOR_BACKGROUND (1) +#define COLOR_DESKTOP (1) +#define COLOR_BTNFACE (15) +#define COLOR_BTNHIGHLIGHT (20) +#define COLOR_BTNSHADOW (16) +#define COLOR_BTNTEXT (18) +#define COLOR_CAPTIONTEXT (9) +#define COLOR_GRAYTEXT (17) +#define COLOR_HIGHLIGHT (13) +#define COLOR_HIGHLIGHTTEXT (14) +#define COLOR_INACTIVEBORDER (11) +#define COLOR_INACTIVECAPTION (3) +#define COLOR_INACTIVECAPTIONTEXT (19) +#define COLOR_INFOBK (24) +#define COLOR_INFOTEXT (23) +#define COLOR_MENU (4) +#define COLOR_MENUTEXT (7) +#define COLOR_SCROLLBAR (0) +#define COLOR_WINDOW (5) +#define COLOR_WINDOWFRAME (6) +#define COLOR_WINDOWTEXT (8) + +/* GetSystemMetrics */ +#define SM_CYMIN (29) +#define SM_CXMIN (28) +#define SM_ARRANGE (56) +#define SM_CLEANBOOT (67) +/* The right value for SM_CEMETRICS for NT 3.5 is 75. For Windows 95 + and NT 4.0, it is 76. The meaning is undocumented, anyhow. */ +#define SM_CMETRICS (76) +#define SM_CMOUSEBUTTONS (43) +#define SM_CXBORDER (5) +#define SM_CYBORDER (6) +#define SM_CXCURSOR (13) +#define SM_CYCURSOR (14) +#define SM_CXDLGFRAME (7) +#define SM_CYDLGFRAME (8) +#define SM_CXDOUBLECLK (36) +#define SM_CYDOUBLECLK (37) +#define SM_CXDRAG (68) +#define SM_CYDRAG (69) +#define SM_CXEDGE (45) +#define SM_CYEDGE (46) +#define SM_CXFIXEDFRAME (7) +#define SM_CYFIXEDFRAME (8) +#define SM_CXFRAME (32) +#define SM_CYFRAME (33) +#define SM_CXFULLSCREEN (16) +#define SM_CYFULLSCREEN (17) +#define SM_CXHSCROLL (21) +#define SM_CYHSCROLL (3) +#define SM_CXHTHUMB (10) +#define SM_CXICON (11) +#define SM_CYICON (12) +#define SM_CXICONSPACING (38) +#define SM_CYICONSPACING (39) +#define SM_CXMAXIMIZED (61) +#define SM_CYMAXIMIZED (62) +#define SM_CXMAXTRACK (59) +#define SM_CYMAXTRACK (60) +#define SM_CXMENUCHECK (71) +#define SM_CYMENUCHECK (72) +#define SM_CXMENUSIZE (54) +#define SM_CYMENUSIZE (55) +#define SM_CXMINIMIZED (57) +#define SM_CYMINIMIZED (58) +#define SM_CXMINSPACING (47) +#define SM_CYMINSPACING (48) +#define SM_CXMINTRACK (34) +#define SM_CYMINTRACK (35) +#define SM_CXSCREEN (0) +#define SM_CYSCREEN (1) +#define SM_CXSIZE (30) +#define SM_CYSIZE (31) +#define SM_CXSIZEFRAME (32) +#define SM_CYSIZEFRAME (33) +#define SM_CXSMICON (49) +#define SM_CYSMICON (50) +#define SM_CXSMSIZE (52) +#define SM_CYSMSIZE (53) +#define SM_CXVSCROLL (2) +#define SM_CYHSCROLL (3) +#define SM_CXHSCROLL (21) +#define SM_CYVSCROLL (20) +#define SM_CYVTHUMB (9) +#define SM_CYCAPTION (4) +#define SM_CYKANJIWINDOW (18) +#define SM_CYMENU (15) +#define SM_CYSMCAPTION (51) +#define SM_DBCSENABLED (42) +#define SM_DEBUG (22) +#define SM_MENUDROPALIGNMENT (40) +#define SM_MIDEASTENABLED (74) +#define SM_MOUSEPRESENT (19) +#define SM_MOUSEWHEELPRESENT (75) +#define SM_NETWORK (63) +#define SM_PENWINDOWS (41) +#define SM_SECURE (44) +#define SM_SHOWSOUNDS (70) +#define SM_SLOWMACHINE (73) +#define SM_SWAPBUTTON (23) +#define ARW_BOTTOMLEFT (0L) +#define ARW_BOTTOMRIGHT (0x1L) +#define ARW_HIDE (0x8L) +#define ARW_TOPLEFT (0x2L) +#define ARW_TOPRIGHT (0x3L) +#define ARW_DOWN (0x4L) +#define ARW_LEFT (0L) +#define ARW_RIGHT (0L) +#define ARW_UP (0x4L) + +/* GetSystemPaletteUse */ +#define SYSPAL_NOSTATIC (2) +#define SYSPAL_STATIC (1) +#define SYSPAL_ERROR (0) + +/* GetTapeParameters, SetTapeParameters */ +#define GET_TAPE_MEDIA_INFORMATION (0) +#define GET_TAPE_DRIVE_INFORMATION (1) +#define SET_TAPE_MEDIA_INFORMATION (0) +#define SET_TAPE_DRIVE_INFORMATION (1) + +/* GetTapePosition */ +#define TAPE_ABSOLUTE_POSITION (0L) +#define TAPE_LOGICAL_POSITION (0x1L) + +/* GetTextAlign */ +#define TA_BASELINE (24) +#define TA_BOTTOM (8) +#define TA_TOP (0) +#define TA_CENTER (6) +#define TA_LEFT (0) +#define TA_RIGHT (2) +#define TA_RTLREADING (256) +#define TA_NOUPDATECP (0) +#define TA_UPDATECP (1) +#define VTA_BASELINE (24) +#define VTA_CENTER (6) + +/* GetThreadPriority */ +#define THREAD_PRIORITY_ABOVE_NORMAL (1) +#define THREAD_PRIORITY_BELOW_NORMAL (-1) +#define THREAD_PRIORITY_HIGHEST (2) +#define THREAD_PRIORITY_IDLE (-15) +#define THREAD_PRIORITY_LOWEST (-2) +#define THREAD_PRIORITY_NORMAL (0) +#define THREAD_PRIORITY_TIME_CRITICAL (15) +#define THREAD_PRIORITY_ERROR_RETURN (2147483647) +#define TLS_MINIMUM_AVAILABLE (64) + +/* GetTimeFormat */ +#define TIME_NOMINUTESORSECONDS (1) +#define TIME_NOSECONDS (2) +#define TIME_NOTIMEMARKER (4) +#define TIME_FORCE24HOURFORMAT (8) + +/* GetTimeZoneInformation */ +#define TIME_ZONE_ID_INVALID ((DWORD) -1) +#define TIME_ZONE_ID_UNKNOWN (0) +#define TIME_ZONE_ID_STANDARD (1) +#define TIME_ZONE_ID_DAYLIGHT (2) + +/* GetUserObjectInformation */ +#define UOI_FLAGS (1) +#define UOI_NAME (2) +#define UOI_TYPE (3) + +/* GetVolumeInformation */ +#define FS_CASE_IS_PRESERVED (2) +#define FS_CASE_SENSITIVE (1) +#define FS_UNICODE_STORED_ON_DISK (4) +#define FS_PERSISTENT_ACLS (8) +#define FS_FILE_COMPRESSION (16) +#define FS_VOL_IS_COMPRESSED (32768) + +/* GetWindowLong */ +#define GWL_EXSTYLE (-20) +#define GWL_STYLE (-16) +#define GWL_WNDPROC (-4) +#define GWL_HINSTANCE (-6) +#define GWL_HWNDPARENT (-8) +#define GWL_ID (-12) +#define GWL_USERDATA (-21) +#define DWL_DLGPROC (4) +#define DWL_MSGRESULT (0) +#define DWL_USER (8) + +/* GlobalAlloc, GlobalFlags */ +#define GMEM_FIXED (0) +#define GMEM_MOVEABLE (2) +#define GPTR (64) +#define GHND (66) +#define GMEM_DDESHARE (8192) +#define GMEM_DISCARDABLE (256) +#define GMEM_LOWER (4096) +#define GMEM_NOCOMPACT (16) +#define GMEM_NODISCARD (32) +#define GMEM_NOT_BANKED (4096) +#define GMEM_NOTIFY (16384) +#define GMEM_SHARE (8192) +#define GMEM_ZEROINIT (64) +#define GMEM_DISCARDED (16384) +#define GMEM_INVALID_HANDLE (32768) +#define GMEM_LOCKCOUNT (255) + +/* HeapAlloc, HeapReAlloc */ +#define HEAP_GENERATE_EXCEPTIONS (4) +#define HEAP_NO_SERIALIZE (1) +#define HEAP_ZERO_MEMORY (8) +#define STATUS_NO_MEMORY (0xc0000017L) +#define STATUS_ACCESS_VIOLATION (0xc0000005L) +#define HEAP_REALLOC_IN_PLACE_ONLY (16) + +/* ImageList_Create */ +#define ILC_COLOR (0) +#define ILC_COLOR4 (4) +#define ILC_COLOR8 (8) +#define ILC_COLOR16 (16) +#define ILC_COLOR24 (24) +#define ILC_COLOR32 (32) +#define ILC_COLORDDB (254) +#define ILC_MASK (1) +#define ILC_PALETTE (2048) + +/* ImageList_Draw, ImageList_DrawEx */ +#define ILD_BLEND25 (2) +#define ILD_BLEND50 (4) +#define ILD_SELECTED (4) +#define ILD_BLEND (4) +#define ILD_FOCUS (2) +#define ILD_MASK (16) +#define ILD_NORMAL (0) +#define ILD_TRANSPARENT (1) +#define CLR_NONE (0xffffffffL) +#define CLR_DEFAULT (0xff000000L) + +/* ImageList_LoadImage */ +#define LR_DEFAULTCOLOR (0) +#define LR_LOADFROMFILE (16) +#define LR_LOADMAP3DCOLORS (4096) +#define LR_LOADTRANSPARENT (32) +#define LR_MONOCHROME (1) + +/* ImmConfigureIME */ +#define IME_CONFIG_GENERAL (1) +#define IME_CONFIG_REGISTERWORD (2) +#define IME_CONFIG_SELECTDICTIONARY (3) + +/* ImmGetConversionList */ +#define GCL_CONVERSION (1) +#define GCL_REVERSECONVERSION (2) +#define GCL_REVERSE_LENGTH (3) + +/* ImmGetGuideLine */ +#define GGL_LEVEL (1) +#define GGL_INDEX (2) +#define GGL_STRING (3) +#define GGL_PRIVATE (4) +#define GL_LEVEL_ERROR (2) +#define GL_LEVEL_FATAL (1) +#define GL_LEVEL_INFORMATION (4) +#define GL_LEVEL_NOGUIDELINE (0) +#define GL_LEVEL_WARNING (3) +#define GL_ID_CANNOTSAVE (17) +#define GL_ID_NOCONVERT (32) +#define GL_ID_NODICTIONARY (16) +#define GL_ID_NOMODULE (1) +#define GL_ID_READINGCONFLICT (35) +#define GL_ID_TOOMANYSTROKE (34) +#define GL_ID_TYPINGERROR (33) +#define GL_ID_UNKNOWN (0) +#define GL_ID_INPUTREADING (36) +#define GL_ID_INPUTRADICAL (37) +#define GL_ID_INPUTCODE (38) +#define GL_ID_CHOOSECANDIDATE (40) +#define GL_ID_REVERSECONVERSION (41) + +/* ImmGetProperty */ +#define IGP_PROPERTY (4) +#define IGP_CONVERSION (8) +#define IGP_SENTENCE (12) +#define IGP_UI (16) +#define IGP_SETCOMPSTR (20) +#define IGP_SELECT (24) +#define IME_PROP_AT_CARET (65536) +#define IME_PROP_SPECIAL_UI (131072) +#define IME_PROP_CANDLIST_START_FROM_1 (262144) +#define IME_PROP_UNICODE (524288) +#define UI_CAP_2700 (1) +#define UI_CAP_ROT90 (2) +#define UI_CAP_ROTANY (4) +#define SCS_CAP_COMPSTR (1) +#define SCS_CAP_MAKEREAD (2) +#define SELECT_CAP_CONVERSION (1) +#define SELECT_CAP_SENTENCE (2) + +/* ImmNotifyIME */ +#define NI_CHANGECANDIDATELIST (19) +#define NI_CLOSECANDIDATE (17) +#define NI_COMPOSITIONSTR (21) +#define NI_OPENCANDIDATE (16) +#define NI_SELECTCANDIDATESTR (18) +#define NI_SETCANDIDATE_PAGESIZE (23) +#define NI_SETCANDIDATE_PAGESTART (22) +#define CPS_CANCEL (4) +#define CPS_COMPLETE (1) +#define CPS_CONVERT (2) +#define CPS_REVERT (3) + +/* ImmSetCompositionString */ +#define SCS_SETSTR (9) +#define SCS_CHANGEATTR (18) +#define SCS_CHANGECLAUSE (36) + +/* ImmUnregisterWord */ +#define IME_REGWORD_STYLE_EUDC (1) +#define IME_REGWORD_STYLE_USER_FIRST 0x80000000 +#define IME_REGWORD_STYLE_USER_LAST (-1) + +/* InitializeSecurityDescriptor */ +#define SECURITY_DESCRIPTOR_REVISION (1) + +/* IsTextUnicode */ +#define IS_TEXT_UNICODE_ASCII16 (1) +#define IS_TEXT_UNICODE_REVERSE_ASCII16 (16) +#define IS_TEXT_UNICODE_STATISTICS (2) +#define IS_TEXT_UNICODE_REVERSE_STATISTICS (32) +#define IS_TEXT_UNICODE_CONTROLS (4) +#define IS_TEXT_UNICODE_REVERSE_CONTROLS (64) +#define IS_TEXT_UNICODE_SIGNATURE (8) +#define IS_TEXT_UNICODE_REVERSE_SIGNATURE (128) +#define IS_TEXT_UNICODE_ILLEGAL_CHARS (256) +#define IS_TEXT_UNICODE_ODD_LENGTH (512) +#define IS_TEXT_UNICODE_NULL_BYTES (4096) +#define IS_TEXT_UNICODE_UNICODE_MASK (15) +#define IS_TEXT_UNICODE_REVERSE_MASK (240) +#define IS_TEXT_UNICODE_NOT_UNICODE_MASK (3840) +#define IS_TEXT_UNICODE_NOT_ASCII_MASK (61440) + +/* JournalPlaybackProc, KeyboardProc */ +#define HC_GETNEXT (1) +#define HC_SKIP (2) +#define HC_SYSMODALOFF (5) +#define HC_SYSMODALON (4) +#define HC_NOREMOVE (3) + +/* keybd_event */ +#define KEYEVENTF_EXTENDEDKEY (1) +#define KEYEVENTF_KEYUP (2) + +/* LoadBitmap */ +#define OBM_BTNCORNERS (32758) +#define OBM_BTSIZE (32761) +#define OBM_CHECK (32760) +#define OBM_CHECKBOXES (32759) +#define OBM_CLOSE (32754) +#define OBM_COMBO (32738) +#define OBM_DNARROW (32752) +#define OBM_DNARROWD (32742) +#define OBM_DNARROWI (32736) +#define OBM_LFARROW (32750) +#define OBM_LFARROWI (32734) +#define OBM_LFARROWD (32740) +#define OBM_MNARROW (32739) +#define OBM_OLD_CLOSE (32767) +#define OBM_OLD_DNARROW (32764) +#define OBM_OLD_LFARROW (32762) +#define OBM_OLD_REDUCE (32757) +#define OBM_OLD_RESTORE (32755) +#define OBM_OLD_RGARROW (32763) +#define OBM_OLD_UPARROW (32765) +#define OBM_OLD_ZOOM (32756) +#define OBM_REDUCE (32749) +#define OBM_REDUCED (32746) +#define OBM_RESTORE (32747) +#define OBM_RESTORED (32744) +#define OBM_RGARROW (32751) +#define OBM_RGARROWD (32741) +#define OBM_RGARROWI (32735) +#define OBM_SIZE (32766) +#define OBM_UPARROW (32753) +#define OBM_UPARROWD (32743) +#define OBM_UPARROWI (32737) +#define OBM_ZOOM (32748) +#define OBM_ZOOMD (32745) + +/* LoadLibraryEx */ +#define DONT_RESOLVE_DLL_REFERENCES (1) +#define LOAD_LIBRARY_AS_DATAFILE (2) +#define LOAD_WITH_ALTERED_SEARCH_PATH (8) + +/* LocalAlloc, LocalFlags */ +#define LPTR (64) +#define LHND (66) +#define NONZEROLHND (2) +#define NONZEROLPTR (0) +#define LMEM_NONZEROLHND (2) +#define LMEM_NONZEROLPTR (0) +#define LMEM_FIXED (0) +#define LMEM_MOVEABLE (2) +#define LMEM_NOCOMPACT (16) +#define LMEM_NODISCARD (32) +#define LMEM_ZEROINIT (64) +#define LMEM_MODIFY (128) +#define LMEM_LOCKCOUNT (255) +#define LMEM_DISCARDABLE (3840) +#define LMEM_DISCARDED (16384) +#define LMEM_INVALID_HANDLE (32768) + +/* LockFileEx */ +#define LOCKFILE_FAIL_IMMEDIATELY (1) +#define LOCKFILE_EXCLUSIVE_LOCK (2) + +/* LogonUser */ + +/* LZCopy, LZInit, LZRead */ + +/* MessageBeep, MessageBox */ +#define MB_USERICON (0x80L) +#define MB_ICONASTERISK (0x40L) +#define MB_ICONEXCLAMATION (0x30L) +#define MB_ICONWARNING (0x30L) +#define MB_ICONERROR (0x10L) +#define MB_ICONHAND (0x10L) +#define MB_ICONQUESTION (0x20L) +#define MB_OK (0L) +#define MB_ABORTRETRYIGNORE (0x2L) +#define MB_APPLMODAL (0L) +#define MB_DEFAULT_DESKTOP_ONLY (0x20000L) +#define MB_HELP (0x4000L) +#define MB_RIGHT (0x80000L) +#define MB_RTLREADING (0x100000L) +#define MB_TOPMOST (0x40000L) +#define MB_DEFBUTTON1 (0L) +#define MB_DEFBUTTON2 (0x100L) +#define MB_DEFBUTTON3 (0x200L) +#define MB_DEFBUTTON4 (0x300L) +#define MB_ICONINFORMATION (0x40L) +#define MB_ICONSTOP (0x10L) +#define MB_OKCANCEL (0x1L) +#define MB_RETRYCANCEL (0x5L) +#define MB_SERVICE_NOTIFICATION (0x40000L) +#define MB_SETFOREGROUND (0x10000L) +#define MB_SYSTEMMODAL (0x1000L) +#define MB_TASKMODAL (0x2000L) +#define MB_YESNO (0x4L) +#define MB_YESNOCANCEL (0x3L) +#define IDABORT (3) +#define IDCANCEL (2) +#define IDCLOSE (8) +#define IDHELP (9) +#define IDIGNORE (5) +#define IDNO (7) +#define IDOK (1) +#define IDRETRY (4) +#define IDYES (6) + +/* MessageProc */ +#define MSGF_DIALOGBOX (0) +#define MSGF_MENU (2) +#define MSGF_NEXTWINDOW (6) +#define MSGF_SCROLLBAR (5) +#define MSGF_MAINLOOP (8) +#define MSGF_USER (4096) + +/* ModifyWorldTransform */ +#define MWT_IDENTITY (1) +#define MWT_LEFTMULTIPLY (2) +#define MWT_RIGHTMULTIPLY (3) + +/* mouse_event */ +#define MOUSEEVENTF_ABSOLUTE (32768) +#define MOUSEEVENTF_MOVE (1) +#define MOUSEEVENTF_LEFTDOWN (2) +#define MOUSEEVENTF_LEFTUP (4) +#define MOUSEEVENTF_RIGHTDOWN (8) +#define MOUSEEVENTF_RIGHTUP (16) +#define MOUSEEVENTF_MIDDLEDOWN (32) +#define MOUSEEVENTF_MIDDLEUP (64) + +/* MoveFileEx */ +#define MOVEFILE_REPLACE_EXISTING (1) +#define MOVEFILE_COPY_ALLOWED (2) +#define MOVEFILE_DELAY_UNTIL_REBOOT (4) + +/* MsgWaitForMultipleObjects, WaitForMultipleObjectsEx */ +#define WAIT_OBJECT_0 (0L) +#define WAIT_ABANDONED_0 (0x80L) +#define WAIT_TIMEOUT (0x102L) +#define WAIT_IO_COMPLETION (0xc0L) +#define WAIT_ABANDONED (0x80L) +#define WAIT_FAILED (0xffffffffL) +#define MAXIMUM_WAIT_OBJECTS (0x40) +#define MAXIMUM_SUSPEND_COUNT (0x7f) + +/* MultiByteToWideChar */ +#define MB_PRECOMPOSED (1) +#define MB_COMPOSITE (2) +#define MB_ERR_INVALID_CHARS (8) +#define MB_USEGLYPHCHARS (4) + +/* NDdeSetTrustedShare */ + +/* NetAccessCheck */ + +/* NetServerEnum */ + +/* NetServiceControl */ + +/* NetUserEnum */ + +/* OpenProcessToken */ +#define TOKEN_ADJUST_DEFAULT (128) +#define TOKEN_ADJUST_GROUPS (64) +#define TOKEN_ADJUST_PRIVILEGES (32) +#define TOKEN_ALL_ACCESS (0xf00ffL) +#define TOKEN_ASSIGN_PRIMARY (1) +#define TOKEN_DUPLICATE (2) +#define TOKEN_EXECUTE (0x20000L) +#define TOKEN_IMPERSONATE (4) +#define TOKEN_QUERY (8) +#define TOKEN_QUERY_SOURCE (16) +#define TOKEN_READ (0x20008L) +#define TOKEN_WRITE (0x200e0L) + +/* OpenSCManager */ +#define SC_MANAGER_ALL_ACCESS (0xf003fL) +#define SC_MANAGER_CONNECT (1) +#define SC_MANAGER_CREATE_SERVICE (2) +#define SC_MANAGER_ENUMERATE_SERVICE (4) +#define SC_MANAGER_LOCK (8) +#define SC_MANAGER_QUERY_LOCK_STATUS (16) +#define SC_MANAGER_MODIFY_BOOT_CONFIG (32) + +/* PostMessage */ +#define HWND_BROADCAST ((HWND)0xFFFF) + +/* PrepareTape */ +#define TAPE_FORMAT (0x5L) +#define TAPE_LOAD (0L) +#define TAPE_LOCK (0x3L) +#define TAPE_TENSION (0x2L) +#define TAPE_UNLOAD (0x1L) +#define TAPE_UNLOCK (0x4L) + +/* PropertySheet */ +#define IS_PSREBOOTSYSTEM (3) +#define IS_PSRESTARTWINDOWS (2) + +/* PropSheetPageProc */ +#define PSPCB_CREATE (2) +#define PSPCB_RELEASE (1) + +/* PurgeComm */ +#define PURGE_TXABORT (1) +#define PURGE_RXABORT (2) +#define PURGE_TXCLEAR (4) +#define PURGE_RXCLEAR (8) + +/* QueryServiceObjectSecurity */ +#define OWNER_SECURITY_INFORMATION (0x1L) +#define GROUP_SECURITY_INFORMATION (0x2L) +#define DACL_SECURITY_INFORMATION (0x4L) +#define SACL_SECURITY_INFORMATION (0x8L) + +/* ReadEventLog, ReportEvent */ +#define EVENTLOG_FORWARDS_READ (4) +#define EVENTLOG_BACKWARDS_READ (8) +#define EVENTLOG_SEEK_READ (2) +#define EVENTLOG_SEQUENTIAL_READ (1) +#define EVENTLOG_ERROR_TYPE (1) +#define EVENTLOG_WARNING_TYPE (2) +#define EVENTLOG_INFORMATION_TYPE (4) +#define EVENTLOG_AUDIT_SUCCESS (8) +#define EVENTLOG_AUDIT_FAILURE (16) + +/* RedrawWindow */ +#define RDW_ERASE (4) +#define RDW_FRAME (1024) +#define RDW_INTERNALPAINT (2) +#define RDW_INVALIDATE (1) +#define RDW_NOERASE (32) +#define RDW_NOFRAME (2048) +#define RDW_NOINTERNALPAINT (16) +#define RDW_VALIDATE (8) +#define RDW_ERASENOW (512) +#define RDW_UPDATENOW (256) +#define RDW_ALLCHILDREN (128) +#define RDW_NOCHILDREN (64) + +/* RegCreateKey */ +#define HKEY_CLASSES_ROOT ((HKEY)0x80000000) +#define HKEY_CURRENT_USER ((HKEY)0x80000001) +#define HKEY_LOCAL_MACHINE ((HKEY)0x80000002) +#define HKEY_USERS ((HKEY)0x80000003) +#define HKEY_PERFORMANCE_DATA ((HKEY)0x80000004) +#define HKEY_CURRENT_CONFIG ((HKEY)0x80000005) +#define HKEY_DYN_DATA ((HKEY)0x00000006) + +/* RegCreateKeyEx */ +#define REG_OPTION_VOLATILE (0x1L) +#define REG_OPTION_NON_VOLATILE (0L) +#define REG_CREATED_NEW_KEY (0x1L) +#define REG_OPENED_EXISTING_KEY (0x2L) + +/* RegEnumValue */ +#define REG_BINARY (3) +#define REG_DWORD (4) +#define REG_DWORD_LITTLE_ENDIAN (4) +#define REG_DWORD_BIG_ENDIAN (5) +#define REG_EXPAND_SZ (2) +#define REG_FULL_RESOURCE_DESCRIPTOR (9) +#define REG_LINK (6) +#define REG_MULTI_SZ (7) +#define REG_NONE (0) +#define REG_RESOURCE_LIST (8) +#define REG_RESOURCE_REQUIREMENTS_LIST (10) +#define REG_SZ (1) + +/* RegisterHotKey */ +#define MOD_ALT (1) +#define MOD_CONTROL (2) +#define MOD_SHIFT (4) +#define MOD_WIN (8) +#define IDHOT_SNAPDESKTOP (-2) +#define IDHOT_SNAPWINDOW (-1) + +/* RegNotifyChangeKeyValue */ +#define REG_NOTIFY_CHANGE_NAME (0x1L) +#define REG_NOTIFY_CHANGE_ATTRIBUTES (0x2L) +#define REG_NOTIFY_CHANGE_LAST_SET (0x4L) +#define REG_NOTIFY_CHANGE_SECURITY (0x8L) + +/* ScrollWindowEx */ +#define SW_ERASE (4) +#define SW_INVALIDATE (2) +#define SW_SCROLLCHILDREN (1) + +/* SendMessageTimeout */ +#define SMTO_ABORTIFHUNG (2) +#define SMTO_BLOCK (1) +#define SMTO_NORMAL (0) + +/* SetBkMode */ +#define OPAQUE (2) +#define TRANSPARENT (1) + +/* SetDebugErrorLevel */ +#define SLE_ERROR (1) +#define SLE_MINORERROR (2) +#define SLE_WARNING (3) + +/* SetErrorMode */ +#define SEM_FAILCRITICALERRORS (1) +#define SEM_NOALIGNMENTFAULTEXCEPT (4) +#define SEM_NOGPFAULTERRORBOX (2) +#define SEM_NOOPENFILEERRORBOX (32768) + +/* SetICMMode */ +#define ICM_ON (2) +#define ICM_OFF (1) +#define ICM_QUERY (3) + +/* SetJob */ + +/* Locale Information */ +#define LOCALE_ILANGUAGE (1) +#define LOCALE_SLANGUAGE (2) +#define LOCALE_SENGLANGUAGE (4097) +#define LOCALE_SABBREVLANGNAME (3) +#define LOCALE_SNATIVELANGNAME (4) +#define LOCALE_ICOUNTRY (5) +#define LOCALE_SCOUNTRY (6) +#define LOCALE_SENGCOUNTRY (4098) +#define LOCALE_SABBREVCTRYNAME (7) +#define LOCALE_SNATIVECTRYNAME (8) +#define LOCALE_IDEFAULTLANGUAGE (9) +#define LOCALE_IDEFAULTCOUNTRY (10) +#define LOCALE_IDEFAULTANSICODEPAGE (4100) +#define LOCALE_IDEFAULTCODEPAGE (11) +#define LOCALE_SLIST (12) +#define LOCALE_IMEASURE (13) +#define LOCALE_SDECIMAL (14) +#define LOCALE_STHOUSAND (15) +#define LOCALE_SGROUPING (16) +#define LOCALE_IDIGITS (17) +#define LOCALE_ILZERO (18) +#define LOCALE_INEGNUMBER (4112) +#define LOCALE_SCURRENCY (20) +#define LOCALE_SMONDECIMALSEP (22) +#define LOCALE_SMONTHOUSANDSEP (23) +#define LOCALE_SMONGROUPING (24) +#define LOCALE_ICURRDIGITS (25) +#define LOCALE_ICURRENCY (27) +#define LOCALE_INEGCURR (28) +#define LOCALE_SDATE (29) +#define LOCALE_STIME (30) +#define LOCALE_STIMEFORMAT (4099) +#define LOCALE_SSHORTDATE (31) +#define LOCALE_SLONGDATE (32) +#define LOCALE_IDATE (33) +#define LOCALE_ILDATE (34) +#define LOCALE_ITIME (35) +#define LOCALE_ITLZERO (37) +#define LOCALE_IDAYLZERO (38) +#define LOCALE_IMONLZERO (39) +#define LOCALE_S1159 (40) +#define LOCALE_S2359 (41) +#define LOCALE_ICALENDARTYPE (4105) +#define LOCALE_IOPTIONALCALENDAR (4107) +#define LOCALE_IFIRSTDAYOFWEEK (4108) +#define LOCALE_IFIRSTWEEKOFYEAR (4109) +#define LOCALE_SDAYNAME1 (42) +#define LOCALE_SDAYNAME2 (43) +#define LOCALE_SDAYNAME3 (44) +#define LOCALE_SDAYNAME4 (45) +#define LOCALE_SDAYNAME5 (46) +#define LOCALE_SDAYNAME6 (47) +#define LOCALE_SDAYNAME7 (48) +#define LOCALE_SABBREVDAYNAME1 (49) +#define LOCALE_SABBREVDAYNAME2 (50) +#define LOCALE_SABBREVDAYNAME3 (51) +#define LOCALE_SABBREVDAYNAME4 (52) +#define LOCALE_SABBREVDAYNAME5 (53) +#define LOCALE_SABBREVDAYNAME6 (54) +#define LOCALE_SABBREVDAYNAME7 (55) +#define LOCALE_SMONTHNAME1 (56) +#define LOCALE_SMONTHNAME2 (57) +#define LOCALE_SMONTHNAME3 (58) +#define LOCALE_SMONTHNAME4 (59) +#define LOCALE_SMONTHNAME5 (60) +#define LOCALE_SMONTHNAME6 (61) +#define LOCALE_SMONTHNAME7 (62) +#define LOCALE_SMONTHNAME8 (63) +#define LOCALE_SMONTHNAME9 (64) +#define LOCALE_SMONTHNAME10 (65) +#define LOCALE_SMONTHNAME11 (66) +#define LOCALE_SMONTHNAME12 (67) +#define LOCALE_SMONTHNAME13 (4110) +#define LOCALE_SABBREVMONTHNAME1 (68) +#define LOCALE_SABBREVMONTHNAME2 (69) +#define LOCALE_SABBREVMONTHNAME3 (70) +#define LOCALE_SABBREVMONTHNAME4 (71) +#define LOCALE_SABBREVMONTHNAME5 (72) +#define LOCALE_SABBREVMONTHNAME6 (73) +#define LOCALE_SABBREVMONTHNAME7 (74) +#define LOCALE_SABBREVMONTHNAME8 (75) +#define LOCALE_SABBREVMONTHNAME9 (76) +#define LOCALE_SABBREVMONTHNAME10 (77) +#define LOCALE_SABBREVMONTHNAME11 (78) +#define LOCALE_SABBREVMONTHNAME12 (79) +#define LOCALE_SABBREVMONTHNAME13 (4111) +#define LOCALE_SPOSITIVESIGN (80) +#define LOCALE_SNEGATIVESIGN (81) +#define LOCALE_IPOSSIGNPOSN (82) +#define LOCALE_INEGSIGNPOSN (83) +#define LOCALE_IPOSSYMPRECEDES (84) +#define LOCALE_IPOSSEPBYSPACE (85) +#define LOCALE_INEGSYMPRECEDES (86) +#define LOCALE_INEGSEPBYSPACE (87) +#define LOCALE_NOUSEROVERRIDE (0x80000000) + +/* Calendar Type Information */ +#define CAL_ICALINTVALUE (1) +#define CAL_IYEAROFFSETRANGE (3) +#define CAL_SABBREVDAYNAME1 (14) +#define CAL_SABBREVDAYNAME2 (15) +#define CAL_SABBREVDAYNAME3 (16) +#define CAL_SABBREVDAYNAME4 (17) +#define CAL_SABBREVDAYNAME5 (18) +#define CAL_SABBREVDAYNAME6 (19) +#define CAL_SABBREVDAYNAME7 (20) +#define CAL_SABBREVMONTHNAME1 (34) +#define CAL_SABBREVMONTHNAME2 (35) +#define CAL_SABBREVMONTHNAME3 (36) +#define CAL_SABBREVMONTHNAME4 (37) +#define CAL_SABBREVMONTHNAME5 (38) +#define CAL_SABBREVMONTHNAME6 (39) +#define CAL_SABBREVMONTHNAME7 (40) +#define CAL_SABBREVMONTHNAME8 (41) +#define CAL_SABBREVMONTHNAME9 (42) +#define CAL_SABBREVMONTHNAME10 (43) +#define CAL_SABBREVMONTHNAME11 (44) +#define CAL_SABBREVMONTHNAME12 (45) +#define CAL_SABBREVMONTHNAME13 (46) +#define CAL_SCALNAME (2) +#define CAL_SDAYNAME1 (7) +#define CAL_SDAYNAME2 (8) +#define CAL_SDAYNAME3 (9) +#define CAL_SDAYNAME4 (10) +#define CAL_SDAYNAME5 (11) +#define CAL_SDAYNAME6 (12) +#define CAL_SDAYNAME7 (13) +#define CAL_SERASTRING (4) +#define CAL_SLONGDATE (6) +#define CAL_SMONTHNAME1 (21) +#define CAL_SMONTHNAME2 (22) +#define CAL_SMONTHNAME3 (23) +#define CAL_SMONTHNAME4 (24) +#define CAL_SMONTHNAME5 (25) +#define CAL_SMONTHNAME6 (26) +#define CAL_SMONTHNAME7 (27) +#define CAL_SMONTHNAME8 (28) +#define CAL_SMONTHNAME9 (29) +#define CAL_SMONTHNAME10 (30) +#define CAL_SMONTHNAME11 (31) +#define CAL_SMONTHNAME12 (32) +#define CAL_SMONTHNAME13 (33) +#define CAL_SSHORTDATE (5) + +/* SetProcessWorkingSetSize */ +#define PROCESS_SET_QUOTA (256) + +/* SetPrinter */ + +/* SetService */ + +/* SetStretchBltMode */ +#define BLACKONWHITE (1) +#define COLORONCOLOR (3) +#define HALFTONE (4) +#define STRETCH_ANDSCANS (1) +#define STRETCH_DELETESCANS (3) +#define STRETCH_HALFTONE (4) +#define STRETCH_ORSCANS (2) +#define WHITEONBLACK (2) + +/* SetSystemCursor */ +#define OCR_NORMAL (32512) +#define OCR_IBEAM (32513) +#define OCR_WAIT (32514) +#define OCR_CROSS (32515) +#define OCR_UP (32516) +#define OCR_SIZE (32640) +#define OCR_ICON (32641) +#define OCR_SIZENWSE (32642) +#define OCR_SIZENESW (32643) +#define OCR_SIZEWE (32644) +#define OCR_SIZENS (32645) +#define OCR_SIZEALL (32646) +#define OCR_NO (32648) +#define OCR_APPSTARTING (32650) + +/* SetTapePosition */ +#define TAPE_ABSOLUTE_BLOCK (0x1L) +#define TAPE_LOGICAL_BLOCK (0x2L) +#define TAPE_REWIND (0L) +#define TAPE_SPACE_END_OF_DATA (0x4L) +#define TAPE_SPACE_FILEMARKS (0x6L) +#define TAPE_SPACE_RELATIVE_BLOCKS (0x5L) +#define TAPE_SPACE_SEQUENTIAL_FMKS (0x7L) +#define TAPE_SPACE_SEQUENTIAL_SMKS (0x9L) +#define TAPE_SPACE_SETMARKS (0x8L) + +/* SetUnhandledExceptionFilter */ +#define EXCEPTION_EXECUTE_HANDLER (1) +#define EXCEPTION_CONTINUE_EXECUTION (-1) +#define EXCEPTION_CONTINUE_SEARCH (0) + +/* SetWindowPos, DeferWindowPos */ +#define HWND_BOTTOM ((HWND)1) +#define HWND_NOTOPMOST ((HWND)-2) +#define HWND_TOP ((HWND)0) +#define HWND_TOPMOST ((HWND)-1) +#define SWP_DRAWFRAME (32) +#define SWP_FRAMECHANGED (32) +#define SWP_HIDEWINDOW (128) +#define SWP_NOACTIVATE (16) +#define SWP_NOCOPYBITS (256) +#define SWP_NOMOVE (2) +#define SWP_NOSIZE (1) +#define SWP_NOREDRAW (8) +#define SWP_NOZORDER (4) +#define SWP_SHOWWINDOW (64) +#define SWP_NOOWNERZORDER (512) +#define SWP_NOREPOSITION (512) +#define SWP_NOSENDCHANGING (1024) + +/* SHAddToRecentDocs */ + +/* SHAppBarMessage */ + +/* SHChangeNotify */ + +/* ShellProc */ +#define HSHELL_ACTIVATESHELLWINDOW (3) +#define HSHELL_GETMINRECT (5) +#define HSHELL_LANGUAGE (8) +#define HSHELL_REDRAW (6) +#define HSHELL_TASKMAN (7) +#define HSHELL_WINDOWACTIVATED (4) +#define HSHELL_WINDOWCREATED (1) +#define HSHELL_WINDOWDESTROYED (2) + +/* SHGetFileInfo */ + +/* SHGetSpecialFolderLocation */ + +/* ShowWindow */ +#define SW_HIDE (0) +#define SW_MAXIMIZE (3) +#define SW_MINIMIZE (6) +#define SW_NORMAL (1) +#define SW_RESTORE (9) +#define SW_SHOW (5) +#define SW_SHOWDEFAULT (10) +#define SW_SHOWMAXIMIZED (3) +#define SW_SHOWMINIMIZED (2) +#define SW_SHOWMINNOACTIVE (7) +#define SW_SHOWNA (8) +#define SW_SHOWNOACTIVATE (4) +#define SW_SHOWNORMAL (1) +#define WPF_RESTORETOMAXIMIZED (2) +#define WPF_SETMINPOSITION (1) + +/* Sleep */ +#define INFINITE 0xFFFFFFFF + +/* SystemParametersInfo */ +#define SPI_GETACCESSTIMEOUT (60) +#define SPI_GETANIMATION (72) +#define SPI_GETBEEP (1) +#define SPI_GETBORDER (5) +#define SPI_GETDEFAULTINPUTLANG (89) +#define SPI_GETDRAGFULLWINDOWS (38) +#define SPI_GETFASTTASKSWITCH (35) +#define SPI_GETFILTERKEYS (50) +#define SPI_GETFONTSMOOTHING (74) +#define SPI_GETGRIDGRANULARITY (18) +#define SPI_GETHIGHCONTRAST (66) +#define SPI_GETICONMETRICS (45) +#define SPI_GETICONTITLELOGFONT (31) +#define SPI_GETICONTITLEWRAP (25) +#define SPI_GETKEYBOARDDELAY (22) +#define SPI_GETKEYBOARDPREF (68) +#define SPI_GETKEYBOARDSPEED (10) +#define SPI_GETLOWPOWERACTIVE (83) +#define SPI_GETLOWPOWERTIMEOUT (79) +#define SPI_GETMENUDROPALIGNMENT (27) +#define SPI_GETMINIMIZEDMETRICS (43) +#define SPI_GETMOUSE (3) +#define SPI_GETMOUSEKEYS (54) +#define SPI_GETMOUSETRAILS (94) +#define SPI_GETNONCLIENTMETRICS (41) +#define SPI_GETPOWEROFFACTIVE (84) +#define SPI_GETPOWEROFFTIMEOUT (80) +#define SPI_GETSCREENREADER (70) +#define SPI_GETSCREENSAVEACTIVE (16) +#define SPI_GETSCREENSAVETIMEOUT (14) +#define SPI_GETSERIALKEYS (62) +#define SPI_GETSHOWSOUNDS (56) +#define SPI_GETSOUNDSENTRY (64) +#define SPI_GETSTICKYKEYS (58) +#define SPI_GETTOGGLEKEYS (52) +#define SPI_GETWINDOWSEXTENSION (92) +#define SPI_GETWORKAREA (48) +#define SPI_ICONHORIZONTALSPACING (13) +#define SPI_ICONVERTICALSPACING (24) +#define SPI_LANGDRIVER (12) +#define SPI_SCREENSAVERRUNNING (97) +#define SPI_SETACCESSTIMEOUT (61) +#define SPI_SETANIMATION (73) +#define SPI_SETBEEP (2) +#define SPI_SETBORDER (6) +#define SPI_SETDEFAULTINPUTLANG (90) +#define SPI_SETDESKPATTERN (21) +#define SPI_SETDESKWALLPAPER (20) +#define SPI_SETDOUBLECLICKTIME (32) +#define SPI_SETDOUBLECLKHEIGHT (30) +#define SPI_SETDOUBLECLKWIDTH (29) +#define SPI_SETDRAGFULLWINDOWS (37) +#define SPI_SETDRAGHEIGHT (77) +#define SPI_SETDRAGWIDTH (76) +#define SPI_SETFASTTASKSWITCH (36) +#define SPI_SETFILTERKEYS (51) +#define SPI_SETFONTSMOOTHING (75) +#define SPI_SETGRIDGRANULARITY (19) +#define SPI_SETHANDHELD (78) +#define SPI_SETHIGHCONTRAST (67) +#define SPI_SETICONMETRICS (46) +#define SPI_SETICONTITLELOGFONT (34) +#define SPI_SETICONTITLEWRAP (26) +#define SPI_SETKEYBOARDDELAY (23) +#define SPI_SETKEYBOARDPREF (69) +#define SPI_SETKEYBOARDSPEED (11) +#define SPI_SETLANGTOGGLE (91) +#define SPI_SETLOWPOWERACTIVE (85) +#define SPI_SETLOWPOWERTIMEOUT (81) +#define SPI_SETMENUDROPALIGNMENT (28) +#define SPI_SETMINIMIZEDMETRICS (44) +#define SPI_SETMOUSE (4) +#define SPI_SETMOUSEBUTTONSWAP (33) +#define SPI_SETMOUSEKEYS (55) +#define SPI_SETMOUSETRAILS (93) +#define SPI_SETNONCLIENTMETRICS (42) +#define SPI_SETPENWINDOWS (49) +#define SPI_SETPOWEROFFACTIVE (86) +#define SPI_SETPOWEROFFTIMEOUT (82) +#define SPI_SETSCREENREADER (71) +#define SPI_SETSCREENSAVEACTIVE (17) +#define SPI_SETSCREENSAVETIMEOUT (15) +#define SPI_SETSERIALKEYS (63) +#define SPI_SETSHOWSOUNDS (57) +#define SPI_SETSOUNDSENTRY (65) +#define SPI_SETSTICKYKEYS (59) +#define SPI_SETTOGGLEKEYS (53) +#define SPI_SETWORKAREA (47) +#define SPIF_UPDATEINIFILE (1) +#define SPIF_SENDWININICHANGE (2) +#define SPIF_SENDCHANGE (2) + +/* TrackPopupMenu, TrackPopMenuEx */ +#define TPM_CENTERALIGN (0x4L) +#define TPM_LEFTALIGN (0L) +#define TPM_RIGHTALIGN (0x8L) +#define TPM_LEFTBUTTON (0L) +#define TPM_RIGHTBUTTON (0x2L) +#define TPM_HORIZONTAL (0L) +#define TPM_VERTICAL (0x40L) + +/* TranslateCharsetInfo */ +#define TCI_SRCCHARSET (1) +#define TCI_SRCCODEPAGE (2) +#define TCI_SRCFONTSIG (3) + +/* VerFindFile */ +#define VFFF_ISSHAREDFILE (1) +#define VFF_CURNEDEST (1) +#define VFF_FILEINUSE (2) +#define VFF_BUFFTOOSMALL (4) + +/* VerInstallFile */ +#define VIFF_FORCEINSTALL (1) +#define VIFF_DONTDELETEOLD (2) +#define VIF_TEMPFILE (0x1L) +#define VIF_MISMATCH (0x2L) +#define VIF_SRCOLD (0x4L) +#define VIF_DIFFLANG (0x8L) +#define VIF_DIFFCODEPG (0x10L) +#define VIF_DIFFTYPE (0x20L) +#define VIF_WRITEPROT (0x40L) +#define VIF_FILEINUSE (0x80L) +#define VIF_OUTOFSPACE (0x100L) +#define VIF_ACCESSVIOLATION (0x200L) +#define VIF_SHARINGVIOLATION (0x400L) +#define VIF_CANNOTCREATE (0x800L) +#define VIF_CANNOTDELETE (0x1000L) +#define VIF_CANNOTDELETECUR (0x4000L) +#define VIF_CANNOTRENAME (0x2000L) +#define VIF_OUTOFMEMORY (0x8000L) +#define VIF_CANNOTREADSRC (0x10000L) +#define VIF_CANNOTREADDST (0x20000L) +#define VIF_BUFFTOOSMALL (0x40000L) + +/* WideCharToMultiByte */ +#define WC_COMPOSITECHECK (512) +#define WC_DISCARDNS (16) +#define WC_SEPCHARS (32) +#define WC_DEFAULTCHAR (64) + +/* WinHelp */ +#define HELP_COMMAND (0x102L) +#define HELP_CONTENTS (0x3L) +#define HELP_CONTEXT (0x1L) +#define HELP_CONTEXTPOPUP (0x8L) +#define HELP_FORCEFILE (0x9L) +#define HELP_HELPONHELP (0x4L) +#define HELP_INDEX (0x3L) +#define HELP_KEY (0x101L) +#define HELP_MULTIKEY (0x201L) +#define HELP_PARTIALKEY (0x105L) +#define HELP_QUIT (0x2L) +#define HELP_SETCONTENTS (0x5L) +#define HELP_SETINDEX (0x5L) +#define HELP_CONTEXTMENU (0xa) +#define HELP_FINDER (0xb) +#define HELP_WM_HELP (0xc) +#define HELP_TCARD (0x8000) +#define HELP_TCARD_DATA (0x10) +#define HELP_TCARD_OTHER_CALLER (0x11) + +/* WNetAddConnectino2 */ +#define CONNECT_UPDATE_PROFILE (1) + +/* WNetConnectionDialog, WNetDisconnectDialog, WNetOpenEnum */ +#define RESOURCETYPE_DISK (1) +#define RESOURCETYPE_PRINT (2) +#define RESOURCETYPE_ANY (0) +#define RESOURCE_CONNECTED (1) +#define RESOURCE_GLOBALNET (2) +#define RESOURCE_REMEMBERED (3) +#define RESOURCEUSAGE_CONNECTABLE (1) +#define RESOURCEUSAGE_CONTAINER (2) + +/* WNetGetResourceInformation, WNetGetResourceParent */ +#define WN_BAD_NETNAME (0x43L) +#define WN_EXTENDED_ERROR (0x4b8L) +#define WN_MORE_DATA (0xeaL) +#define WN_NO_NETWORK (0x4c6L) +#define WN_SUCCESS (0L) +#define WN_ACCESS_DENIED (0x5L) +#define WN_BAD_PROVIDER (0x4b4L) +#define WN_NOT_AUTHENTICATED (0x4dcL) + +/* WNetGetUniversalName */ +#define UNIVERSAL_NAME_INFO_LEVEL (1) +#define REMOTE_NAME_INFO_LEVEL (2) + +/* GetExitCodeThread */ +#define STILL_ACTIVE (0x103L) + +/* COMMPROP structure */ +#define SP_SERIALCOMM (0x1L) +#define BAUD_075 (0x1L) +#define BAUD_110 (0x2L) +#define BAUD_134_5 (0x4L) +#define BAUD_150 (0x8L) +#define BAUD_300 (0x10L) +#define BAUD_600 (0x20L) +#define BAUD_1200 (0x40L) +#define BAUD_1800 (0x80L) +#define BAUD_2400 (0x100L) +#define BAUD_4800 (0x200L) +#define BAUD_7200 (0x400L) +#define BAUD_9600 (0x800L) +#define BAUD_14400 (0x1000L) +#define BAUD_19200 (0x2000L) +#define BAUD_38400 (0x4000L) +#define BAUD_56K (0x8000L) +#define BAUD_57600 (0x40000L) +#define BAUD_115200 (0x20000L) +#define BAUD_128K (0x10000L) +#define BAUD_USER (0x10000000L) +#define PST_FAX (0x21L) +#define PST_LAT (0x101L) +#define PST_MODEM (0x6L) +#define PST_NETWORK_BRIDGE (0x100L) +#define PST_PARALLELPORT (0x2L) +#define PST_RS232 (0x1L) +#define PST_RS422 (0x3L) +#define PST_RS423 (0x4L) +#define PST_RS449 (0x5L) +#define PST_SCANNER (0x22L) +#define PST_TCPIP_TELNET (0x102L) +#define PST_UNSPECIFIED (0L) +#define PST_X25 (0x103L) +#define PCF_16BITMODE (0x200L) +#define PCF_DTRDSR (0x1L) +#define PCF_INTTIMEOUTS (0x80L) +#define PCF_PARITY_CHECK (0x8L) +#define PCF_RLSD (0x4L) +#define PCF_RTSCTS (0x2L) +#define PCF_SETXCHAR (0x20L) +#define PCF_SPECIALCHARS (0x100L) +#define PCF_TOTALTIMEOUTS (0x40L) +#define PCF_XONXOFF (0x10L) +#define SP_BAUD (0x2L) +#define SP_DATABITS (0x4L) +#define SP_HANDSHAKING (0x10L) +#define SP_PARITY (0x1L) +#define SP_PARITY_CHECK (0x20L) +#define SP_RLSD (0x40L) +#define SP_STOPBITS (0x8L) +#define DATABITS_5 (1) +#define DATABITS_6 (2) +#define DATABITS_7 (4) +#define DATABITS_8 (8) +#define DATABITS_16 (16) +#define DATABITS_16X (32) +#define STOPBITS_10 (1) +#define STOPBITS_15 (2) +#define STOPBITS_20 (4) +#define PARITY_NONE (256) +#define PARITY_ODD (512) +#define PARITY_EVEN (1024) +#define PARITY_MARK (2048) +#define PARITY_SPACE (4096) +#define COMMPROP_INITIALIZED (0xe73cf52eL) + +/* DCB structure */ +#define CBR_110 (110) +#define CBR_300 (300) +#define CBR_600 (600) +#define CBR_1200 (1200) +#define CBR_2400 (2400) +#define CBR_4800 (4800) +#define CBR_9600 (9600) +#define CBR_14400 (14400) +#define CBR_19200 (19200) +#define CBR_38400 (38400) +#define CBR_56000 (56000) +#define CBR_57600 (57600) +#define CBR_115200 (115200) +#define CBR_128000 (128000) +#define CBR_256000 (256000) +#define DTR_CONTROL_DISABLE (0) +#define DTR_CONTROL_ENABLE (1) +#define DTR_CONTROL_HANDSHAKE (2) +#define RTS_CONTROL_DISABLE (0) +#define RTS_CONTROL_ENABLE (1) +#define RTS_CONTROL_HANDSHAKE (2) +#define RTS_CONTROL_TOGGLE (3) +#define EVENPARITY (2) +#define MARKPARITY (3) +#define NOPARITY (0) +#define ODDPARITY (1) +#define SPACEPARITY (4) +#define ONESTOPBIT (0) +#define ONE5STOPBITS (1) +#define TWOSTOPBITS (2) + +/* Debugging events */ +#define CREATE_PROCESS_DEBUG_EVENT (3) +#define CREATE_THREAD_DEBUG_EVENT (2) +#define EXCEPTION_DEBUG_EVENT (1) +#define EXIT_PROCESS_DEBUG_EVENT (5) +#define EXIT_THREAD_DEBUG_EVENT (4) +#define LOAD_DLL_DEBUG_EVENT (6) +#define OUTPUT_DEBUG_STRING_EVENT (8) +#define UNLOAD_DLL_DEBUG_EVENT (7) +#define RIP_EVENT (9) + +/* PROCESS_HEAP_ENTRY structure */ +#define PROCESS_HEAP_REGION (1) +#define PROCESS_HEAP_UNCOMMITTED_RANGE (2) +#define PROCESS_HEAP_ENTRY_BUSY (4) +#define PROCESS_HEAP_ENTRY_MOVEABLE (16) +#define PROCESS_HEAP_ENTRY_DDESHARE (32) + +/* Win32s */ +#define HINSTANCE_ERROR (32) + +/* WIN32_STREAM_ID structure */ +#define BACKUP_DATA (1) +#define BACKUP_EA_DATA (2) +#define BACKUP_SECURITY_DATA (3) +#define BACKUP_ALTERNATE_DATA (4) +#define BACKUP_LINK (5) +#define STREAM_MODIFIED_WHEN_READ (1) +#define STREAM_CONTAINS_SECURITY (2) + +/* STARTUPINFO structure */ +#define STARTF_USESHOWWINDOW (1) +#define STARTF_USEPOSITION (4) +#define STARTF_USESIZE (2) +#define STARTF_USECOUNTCHARS (8) +#define STARTF_USEFILLATTRIBUTE (16) +#define STARTF_RUNFULLSCREEN (32) +#define STARTF_FORCEONFEEDBACK (64) +#define STARTF_FORCEOFFFEEDBACK (128) +#define STARTF_USESTDHANDLES (256) +#define STARTF_USEHOTKEY (512) + +/* OSVERSIONINFO structure */ +#define VER_PLATFORM_WIN32s (0) +#define VER_PLATFORM_WIN32_WINDOWS (1) +#define VER_PLATFORM_WIN32_NT (2) + +/* PROPSHEETPAGE structure */ +#define MAXPROPPAGES (100) +#define PSP_DEFAULT (0) +#define PSP_DLGINDIRECT (1) +#define PSP_HASHELP (32) +#define PSP_USECALLBACK (128) +#define PSP_USEHICON (2) +#define PSP_USEICONID (4) +#define PSP_USEREFPARENT (64) +#define PSP_USETITLE (8) +#define PSP_RTLREADING (16) + +/* PROPSHEETHEADER structure */ +#define PSH_DEFAULT (0) +#define PSH_HASHELP (512) +#define PSH_MODELESS (1024) +#define PSH_NOAPPLYNOW (128) +#define PSH_PROPSHEETPAGE (8) +#define PSH_PROPTITLE (1) +#define PSH_USECALLBACK (256) +#define PSH_USEHICON (2) +#define PSH_USEICONID (4) +#define PSH_USEPSTARTPAGE (64) +#define PSH_WIZARD (32) +#define PSH_RTLREADING (2048) +#define PSCB_INITIALIZED (1) +#define PSCB_PRECREATE (2) + +/* PSN_APPLY message */ +#define PSNRET_NOERROR (0) +#define PSNRET_INVALID_NOCHANGEPAGE (2) + +/* Property Sheet */ +#define PSBTN_APPLYNOW (4) +#define PSBTN_BACK (0) +#define PSBTN_CANCEL (5) +#define PSBTN_FINISH (2) +#define PSBTN_HELP (6) +#define PSBTN_NEXT (1) +#define PSBTN_OK (3) +#define PSWIZB_BACK (1) +#define PSWIZB_NEXT (2) +#define PSWIZB_FINISH (4) +#define PSWIZB_DISABLEDFINISH (8) +#define ID_PSREBOOTSYSTEM (3) +#define ID_PSRESTARTWINDOWS (2) +#define WIZ_BODYCX (184) +#define WIZ_BODYX (92) +#define WIZ_CXBMP (80) +#define WIZ_CXDLG (276) +#define WIZ_CYDLG (140) + +/* VX_FIXEDFILEINFO structure */ +#define VS_FILE_INFO (MAKEINTRESOURCE(16)) +#define VS_VERSION_INFO (1) +#define VS_FF_DEBUG (0x1L) +#define VS_FF_INFOINFERRED (0x10L) +#define VS_FF_PATCHED (0x4L) +#define VS_FF_PRERELEASE (0x2L) +#define VS_FF_PRIVATEBUILD (0x8L) +#define VS_FF_SPECIALBUILD (0x20L) +#define VOS_UNKNOWN (0L) +#define VOS_DOS (0x10000L) +#define VOS_OS216 (0x20000L) +#define VOS_OS232 (0x30000L) +#define VOS_NT (0x40000L) +#define VOS_DOS_WINDOWS16 (0x10001L) +#define VOS_DOS_WINDOWS32 (0x10004L) +#define VOS_OS216_PM16 (0x20002L) +#define VOS_OS232_PM32 (0x30003L) +#define VOS_NT_WINDOWS32 (0x40004L) +#define VFT_UNKNOWN (0L) +#define VFT_APP (0x1L) +#define VFT_DLL (0x2L) +#define VFT_DRV (0x3L) +#define VFT_FONT (0x4L) +#define VFT_VXD (0x5L) +#define VFT_STATIC_LIB (0x7L) +#define VFT2_UNKNOWN (0L) +#define VFT2_DRV_PRINTER (0x1L) +#define VFT2_DRV_KEYBOARD (0x2L) +#define VFT2_DRV_LANGUAGE (0x3L) +#define VFT2_DRV_DISPLAY (0x4L) +#define VFT2_DRV_MOUSE (0x5L) +#define VFT2_DRV_NETWORK (0x6L) +#define VFT2_DRV_SYSTEM (0x7L) +#define VFT2_DRV_INSTALLABLE (0x8L) +#define VFT2_DRV_SOUND (0x9L) +#define VFT2_FONT_RASTER (0x1L) +#define VFT2_FONT_VECTOR (0x2L) +#define VFT2_FONT_TRUETYPE (0x3L) + +/* PANOSE structure */ +#define PAN_ANY (0) +#define PAN_NO_FIT (1) +#define PAN_FAMILY_TEXT_DISPLAY (2) +#define PAN_FAMILY_SCRIPT (3) +#define PAN_FAMILY_DECORATIVE (4) +#define PAN_FAMILY_PICTORIAL (5) +#define PAN_SERIF_COVE (2) +#define PAN_SERIF_OBTUSE_COVE (3) +#define PAN_SERIF_SQUARE_COVE (4) +#define PAN_SERIF_OBTUSE_SQUARE_COVE (5) +#define PAN_SERIF_SQUARE (6) +#define PAN_SERIF_THIN (7) +#define PAN_SERIF_BONE (8) +#define PAN_SERIF_EXAGGERATED (9) +#define PAN_SERIF_TRIANGLE (10) +#define PAN_SERIF_NORMAL_SANS (11) +#define PAN_SERIF_OBTUSE_SANS (12) +#define PAN_SERIF_PERP_SANS (13) +#define PAN_SERIF_FLARED (14) +#define PAN_SERIF_ROUNDED (15) +#define PAN_WEIGHT_VERY_LIGHT (2) +#define PAN_WEIGHT_LIGHT (3) +#define PAN_WEIGHT_THIN (4) +#define PAN_WEIGHT_BOOK (5) +#define PAN_WEIGHT_MEDIUM (6) +#define PAN_WEIGHT_DEMI (7) +#define PAN_WEIGHT_BOLD (8) +#define PAN_WEIGHT_HEAVY (9) +#define PAN_WEIGHT_BLACK (10) +#define PAN_WEIGHT_NORD (11) +#define PAN_PROP_OLD_STYLE (2) +#define PAN_PROP_MODERN (3) +#define PAN_PROP_EVEN_WIDTH (4) +#define PAN_PROP_EXPANDED (5) +#define PAN_PROP_CONDENSED (6) +#define PAN_PROP_VERY_EXPANDED (7) +#define PAN_PROP_VERY_CONDENSED (8) +#define PAN_PROP_MONOSPACED (9) +#define PAN_CONTRAST_NONE (2) +#define PAN_CONTRAST_VERY_LOW (3) +#define PAN_CONTRAST_LOW (4) +#define PAN_CONTRAST_MEDIUM_LOW (5) +#define PAN_CONTRAST_MEDIUM (6) +#define PAN_CONTRAST_MEDIUM_HIGH (7) +#define PAN_CONTRAST_HIGH (8) +#define PAN_CONTRAST_VERY_HIGH (9) +#define PAN_STROKE_GRADUAL_DIAG (2) +#define PAN_STROKE_GRADUAL_TRAN (3) +#define PAN_STROKE_GRADUAL_VERT (4) +#define PAN_STROKE_GRADUAL_HORZ (5) +#define PAN_STROKE_RAPID_VERT (6) +#define PAN_STROKE_RAPID_HORZ (7) +#define PAN_STROKE_INSTANT_VERT (8) +#define PAN_STRAIGHT_ARMS_HORZ (2) +#define PAN_STRAIGHT_ARMS_WEDGE (3) +#define PAN_STRAIGHT_ARMS_VERT (4) +#define PAN_STRAIGHT_ARMS_SINGLE_SERIF (5) +#define PAN_STRAIGHT_ARMS_DOUBLE_SERIF (6) +#define PAN_BENT_ARMS_HORZ (7) +#define PAN_BENT_ARMS_VERT (9) +#define PAN_BENT_ARMS_WEDGE (8) +#define PAN_BENT_ARMS_SINGLE_SERIF (10) +#define PAN_BENT_ARMS_DOUBLE_SERIF (11) +#define PAN_LETT_NORMAL_CONTACT (2) +#define PAN_LETT_NORMAL_WEIGHTED (3) +#define PAN_LETT_NORMAL_BOXED (4) +#define PAN_LETT_NORMAL_FLATTENED (5) +#define PAN_LETT_NORMAL_ROUNDED (6) +#define PAN_LETT_NORMAL_OFF_CENTER (7) +#define PAN_LETT_NORMAL_SQUARE (8) +#define PAN_LETT_OBLIQUE_CONTACT (9) +#define PAN_LETT_OBLIQUE_WEIGHTED (10) +#define PAN_LETT_OBLIQUE_BOXED (11) +#define PAN_LETT_OBLIQUE_FLATTENED (12) +#define PAN_LETT_OBLIQUE_ROUNDED (13) +#define PAN_LETT_OBLIQUE_OFF_CENTER (14) +#define PAN_LETT_OBLIQUE_SQUARE (15) +#define PAN_MIDLINE_STANDARD_TRIMMED (2) +#define PAN_MIDLINE_STANDARD_POINTED (3) +#define PAN_MIDLINE_STANDARD_SERIFED (4) +#define PAN_MIDLINE_HIGH_TRIMMED (5) +#define PAN_MIDLINE_HIGH_POINTED (6) +#define PAN_MIDLINE_HIGH_SERIFED (7) +#define PAN_MIDLINE_CONSTANT_TRIMMED (8) +#define PAN_MIDLINE_CONSTANT_POINTED (9) +#define PAN_MIDLINE_CONSTANT_SERIFED (10) +#define PAN_MIDLINE_LOW_TRIMMED (11) +#define PAN_MIDLINE_LOW_POINTED (12) +#define PAN_MIDLINE_LOW_SERIFED (13) +#define PAN_XHEIGHT_CONSTANT_SMALL (2) +#define PAN_XHEIGHT_CONSTANT_STD (3) +#define PAN_XHEIGHT_CONSTANT_LARGE (4) +#define PAN_XHEIGHT_DUCKING_SMALL (5) +#define PAN_XHEIGHT_DUCKING_STD (6) +#define PAN_XHEIGHT_DUCKING_LARGE (7) + +/* PALETTENTRY structure */ +#define PC_EXPLICIT (2) +#define PC_NOCOLLAPSE (4) +#define PC_RESERVED (1) + +/* LOGBRUSH structure */ +#define BS_DIBPATTERN (5) +#define BS_DIBPATTERN8X8 (8) +#define BS_DIBPATTERNPT (6) +#define BS_HATCHED (2) +#define BS_HOLLOW (1) +#define BS_NULL (1) +#define BS_PATTERN (3) +#define BS_PATTERN8X8 (7) +#define BS_SOLID (0) + +/* DEVMODE structure */ +#define DM_ORIENTATION (0x1L) +#define DM_PAPERSIZE (0x2L) +#define DM_PAPERLENGTH (0x4L) +#define DM_PAPERWIDTH (0x8L) +#define DM_SCALE (0x10L) +#define DM_COPIES (0x100L) +#define DM_DEFAULTSOURCE (0x200L) +#define DM_PRINTQUALITY (0x400L) +#define DM_COLOR (0x800L) +#define DM_DUPLEX (0x1000L) +#define DM_YRESOLUTION (0x2000L) +#define DM_TTOPTION (0x4000L) +#define DM_COLLATE (0x8000L) +#define DM_FORMNAME (0x10000L) +#define DM_LOGPIXELS (0x20000L) +#define DM_BITSPERPEL (0x40000L) +#define DM_PELSWIDTH (0x80000L) +#define DM_PELSHEIGHT (0x100000L) +#define DM_DISPLAYFLAGS (0x200000L) +#define DM_DISPLAYFREQUENCY (0x400000L) +#define DM_ICMMETHOD (0x800000L) +#define DM_ICMINTENT (0x1000000L) +#define DM_MEDIATYPE (0x2000000L) +#define DM_DITHERTYPE (0x4000000L) +#define DMORIENT_LANDSCAPE (2) +#define DMORIENT_PORTRAIT (1) +#define DMPAPER_LETTER (1) +#define DMPAPER_LEGAL (5) +#define DMPAPER_A4 (9) +#define DMPAPER_CSHEET (24) +#define DMPAPER_DSHEET (25) +#define DMPAPER_ESHEET (26) +#define DMPAPER_LETTERSMALL (2) +#define DMPAPER_TABLOID (3) +#define DMPAPER_LEDGER (4) +#define DMPAPER_STATEMENT (6) +#define DMPAPER_EXECUTIVE (7) +#define DMPAPER_A3 (8) +#define DMPAPER_A4SMALL (10) +#define DMPAPER_A5 (11) +#define DMPAPER_B4 (12) +#define DMPAPER_B5 (13) +#define DMPAPER_FOLIO (14) +#define DMPAPER_QUARTO (15) +#define DMPAPER_10X14 (16) +#define DMPAPER_11X17 (17) +#define DMPAPER_NOTE (18) +#define DMPAPER_ENV_9 (19) +#define DMPAPER_ENV_10 (20) +#define DMPAPER_ENV_11 (21) +#define DMPAPER_ENV_12 (22) +#define DMPAPER_ENV_14 (23) +#define DMPAPER_ENV_DL (27) +#define DMPAPER_ENV_C5 (28) +#define DMPAPER_ENV_C3 (29) +#define DMPAPER_ENV_C4 (30) +#define DMPAPER_ENV_C6 (31) +#define DMPAPER_ENV_C65 (32) +#define DMPAPER_ENV_B4 (33) +#define DMPAPER_ENV_B5 (34) +#define DMPAPER_ENV_B6 (35) +#define DMPAPER_ENV_ITALY (36) +#define DMPAPER_ENV_MONARCH (37) +#define DMPAPER_ENV_PERSONAL (38) +#define DMPAPER_FANFOLD_US (39) +#define DMPAPER_FANFOLD_STD_GERMAN (40) +#define DMPAPER_FANFOLD_LGL_GERMAN (41) +#define DMRES_HIGH (-4) +#define DMRES_MEDIUM (-3) +#define DMRES_LOW (-2) +#define DMRES_DRAFT (-1) +#define DMCOLOR_COLOR (2) +#define DMCOLOR_MONOCHROME (1) +#define DMDUP_SIMPLEX (1) +#define DMDUP_HORIZONTAL (3) +#define DMDUP_VERTICAL (2) +#define DMTT_BITMAP (1) +#define DMTT_DOWNLOAD (2) +#define DMTT_SUBDEV (3) +#define DMCOLLATE_TRUE (1) +#define DMCOLLATE_FALSE (0) +#define DM_GRAYSCALE (1) +#define DM_INTERLACED (2) +#define DMICMMETHOD_NONE (1) +#define DMICMMETHOD_SYSTEM (2) +#define DMICMMETHOD_DRIVER (3) +#define DMICMMETHOD_DEVICE (4) +#define DMICMMETHOD_USER (256) +#define DMICM_SATURATE (1) +#define DMICM_CONTRAST (2) +#define DMICM_COLORMETRIC (3) +#define DMICM_USER (256) +#define DMMEDIA_STANDARD (1) +#define DMMEDIA_GLOSSY (3) +#define DMMEDIA_TRANSPARENCY (2) +#define DMMEDIA_USER (256) +#define DMDITHER_NONE (1) +#define DMDITHER_COARSE (2) +#define DMDITHER_FINE (3) +#define DMDITHER_LINEART (4) +#define DMDITHER_GRAYSCALE (10) +#define DMDITHER_USER (256) + +/* RGNDATAHEADER structure */ +#define RDH_RECTANGLES (1) + +/* TTPOLYGONHEADER structure */ +#define TT_POLYGON_TYPE (24) + +/* TTPOLYCURVE structure */ +#define TT_PRIM_LINE (1) +#define TT_PRIM_QSPLINE (2) + +/* GCP_RESULTS structure */ +#define GCPCLASS_ARABIC (2) +#define GCPCLASS_HEBREW (2) +#define GCPCLASS_LATIN (1) +#define GCPCLASS_LATINNUMBER (5) +#define GCPCLASS_LOCALNUMBER (4) +#define GCPCLASS_LATINNUMERICSEPARATOR (7) +#define GCPCLASS_LATINNUMERICTERMINATOR (6) +#define GCPCLASS_NEUTRAL (3) +#define GCPCLASS_NUMERICSEPARATOR (8) +#define GCPCLASS_PREBOUNDLTR (128) +#define GCPCLASS_PREBOUNDRTL (64) +#define GCPCLASS_POSTBOUNDLTR (32) +#define GCPCLASS_POSTBOUNDRTL (16) +#define GCPGLYPH_LINKBEFORE (32768) +#define GCPGLYPH_LINKAFTER (16384) + +/* RASTERIZER_STATUS structure */ +#define TT_AVAILABLE (1) +#define TT_ENABLED (2) + +/* COLORADJUSTMENT structure */ +#define CA_NEGATIVE (1) +#define CA_LOG_FILTER (2) +#define ILLUMINANT_DEVICE_DEFAULT (0) +#define ILLUMINANT_A (1) +#define ILLUMINANT_B (2) +#define ILLUMINANT_C (3) +#define ILLUMINANT_D50 (4) +#define ILLUMINANT_D55 (5) +#define ILLUMINANT_D65 (6) +#define ILLUMINANT_D75 (7) +#define ILLUMINANT_F2 (8) +#define ILLUMINANT_TUNGSTEN (1) +#define ILLUMINANT_DAYLIGHT (3) +#define ILLUMINANT_FLUORESCENT (8) +#define ILLUMINANT_NTSC (3) + +/* DOCINFO structure */ +#define DI_APPBANDING (1) + +/* EMRMETAHEADER structure */ +#define EMR_HEADER (1) +#define ENHMETA_SIGNATURE (1179469088) + +/* RTF event masks */ +#define ENM_CHANGE (1) +#define ENM_CORRECTTEXT (4194304) +#define ENM_DROPFILES (1048576) +#define ENM_KEYEVENTS (65536) +#define ENM_MOUSEEVENTS (131072) +#define ENM_PROTECTED (2097152) +#define ENM_REQUESTRESIZE (262144) +#define ENM_SCROLL (4) +#define ENM_SELCHANGE (524288) +#define ENM_UPDATE (2) +#define ENM_NONE (0) + +/* RTF styles */ +#define ES_DISABLENOSCROLL (8192) +#define ES_EX_NOCALLOLEINIT (16777216) +#define ES_NOIME (524288) +#define ES_SAVESEL (32768) +#define ES_SELFIME (262144) +#define ES_SUNKEN (16384) +#define ES_VERTICAL (4194304) +#define ES_SELECTIONBAR (16777216) + +/* EM_SETOPTIONS message */ +#define ECOOP_SET (1) +#define ECOOP_OR (2) +#define ECOOP_AND (3) +#define ECOOP_XOR (4) +#define ECO_AUTOWORDSELECTION (1) +#define ECO_AUTOVSCROLL (64) +#define ECO_AUTOHSCROLL (128) +#define ECO_NOHIDESEL (256) +#define ECO_READONLY (2048) +#define ECO_WANTRETURN (4096) +#define ECO_SAVESEL (32768) +#define ECO_SELECTIONBAR (16777216) +#define ECO_VERTICAL (4194304) + +/* EM_SETCHARFORMAT message */ +#define SCF_WORD (2) +#define SCF_SELECTION (1) + +/* EM_STREAMOUT message */ +#define SF_TEXT (1) +#define SF_RTF (2) +#define SF_RTFNOOBJS (3) +#define SF_TEXTIZED (4) +#define SFF_SELECTION (32768) +#define SFF_PLAINRTF (16384) + +/* EM_FINDWORDBREAK message */ +#define WB_CLASSIFY (3) +#define WB_ISDELIMITER (2) +#define WB_LEFT (0) +#define WB_LEFTBREAK (6) +#define WB_PREVBREAK (6) +#define WB_MOVEWORDLEFT (4) +#define WB_MOVEWORDPREV (4) +#define WB_MOVEWORDRIGHT (5) +#define WB_MOVEWORDNEXT (5) +#define WB_RIGHT (1) +#define WB_RIGHTBREAK (7) +#define WB_NEXTBREAK (7) + +/* EM_GETPUNCTUATION message */ +#define PC_LEADING (2) +#define PC_FOLLOWING (1) +#define PC_DELIMITER (4) +#define PC_OVERFLOW (3) + +/* EM_SETWORDWRAPMODE message */ +#define WBF_WORDWRAP (16) +#define WBF_WORDBREAK (32) +#define WBF_OVERFLOW (64) +#define WBF_LEVEL1 (128) +#define WBF_LEVEL2 (256) +#define WBF_CUSTOM (512) +#define WBF_BREAKAFTER (64) +#define WBF_BREAKLINE (32) +#define WBF_ISWHITE (16) + +/* CHARFORMAT structure */ +#define CFM_BOLD (1) +#define CFM_COLOR (1073741824) +#define CFM_FACE (536870912) +#define CFM_ITALIC (2) +#define CFM_OFFSET (268435456) +#define CFM_PROTECTED (16) +#define CFM_SIZE (0x80000000) +#define CFM_STRIKEOUT (8) +#define CFM_UNDERLINE (4) +#define CFE_AUTOCOLOR (1073741824) +#define CFE_BOLD (1) +#define CFE_ITALIC (2) +#define CFE_STRIKEOUT (8) +#define CFE_UNDERLINE (4) +#define CFE_PROTECTED (16) + +/* PARAFORMAT structure */ +#define PFM_ALIGNMENT (8) +#define PFM_NUMBERING (32) +#define PFM_OFFSET (4) +#define PFM_OFFSETINDENT (0x80000000) +#define PFM_RIGHTINDENT (2) +#define PFM_STARTINDENT (1) +#define PFM_TABSTOPS (16) +#define PFN_BULLET (1) +#define PFA_LEFT (1) +#define PFA_RIGHT (2) +#define PFA_CENTER (3) + +/* SELCHANGE structure */ +#define SEL_EMPTY (0) +#define SEL_TEXT (1) +#define SEL_OBJECT (2) +#define SEL_MULTICHAR (4) +#define SEL_MULTIOBJECT (8) + +/* RTF clipboard formats */ +#define CF_RTF "Rich Text Format" +#define CF_RETEXTOBJ "RichEdit Text and Objects" + +/* DRAWITEMSTRUCT structure */ +#define ODT_BUTTON (4) +#define ODT_COMBOBOX (3) +#define ODT_LISTBOX (2) +#define ODT_LISTVIEW (102) +#define ODT_MENU (1) +#define ODT_STATIC (5) +#define ODT_TAB (101) +#define ODT_HEADER (100) +#define ODA_DRAWENTIRE (1) +#define ODA_FOCUS (4) +#define ODA_SELECT (2) +#define ODS_CHECKED (8) +#define ODS_COMBOBOXEDIT (4096) +#define ODS_DEFAULT (32) +#define ODS_DISABLED (4) +#define ODS_FOCUS (16) +#define ODS_GRAYED (2) +#define ODS_SELECTED (1) + +/* Common control window classes */ +#define ANIMATE_CLASSW L"SysAnimate32" +#define HOTKEY_CLASSW L"msctls_hotkey32" +#define PROGRESS_CLASSW L"msctls_progress32" +#define STATUSCLASSNAMEW L"msctls_statusbar32" +#define TOOLBARCLASSNAMEW L"ToolbarWindow32" +#define TOOLTIPS_CLASSW L"tooltips_class32" +#define TRACKBAR_CLASSW L"msctls_trackbar32" +#define UPDOWN_CLASSW L"msctls_updown32" +#define WC_HEADERW L"SysHeader32" +#define WC_LISTVIEWW L"SysListView32" +#define WC_TABCONTROLW L"SysTabControl32" +#define WC_TREEVIEWW L"SysTreeView32" + +/* Common control styles */ +#define CCS_ADJUSTABLE (0x20L) +#define CCS_BOTTOM (0x3L) +#define CCS_NODIVIDER (0x40L) +#define CCS_NOMOVEY (0x2L) +#define CCS_NOPARENTALIGN (0x8L) +#define CCS_NORESIZE (0x4L) +#define CCS_TOP (0x1L) +#define ANIMATE_CLASSA "SysAnimate32" +#define HOTKEY_CLASSA "msctls_hotkey32" +#define PROGRESS_CLASSA "msctls_progress32" +#define STATUSCLASSNAMEA "msctls_statusbar32" +#define TOOLBARCLASSNAMEA "ToolbarWindow32" +#define TOOLTIPS_CLASSA "tooltips_class32" +#define TRACKBAR_CLASSA "msctls_trackbar32" +#define UPDOWN_CLASSA "msctls_updown32" +#define WC_HEADERA "SysHeader32" +#define WC_LISTVIEWA "SysListView32" +#define WC_TABCONTROLA "SysTabControl32" +#define WC_TREEVIEWA "SysTreeView32" +#ifdef UNICODE +#define ANIMATE_CLASS ANIMATE_CLASSW +#define HOTKEY_CLASS HOTKEY_CLASSW +#define PROGRESS_CLASS PROGRESS_CLASSW +#define STATUSCLASSNAME STATUSCLASSNAMEW +#define TOOLBARCLASSNAME TOOLBARCLASSNAMEW +#define TOOLTIPS_CLASS TOOLTIPS_CLASSW +#define TRACKBAR_CLASS TRACKBAR_CLASSW +#define UPDOWN_CLASS UPDOWN_CLASSW +#define WC_HEADER WC_HEADERW +#define WC_LISTVIEW WC_LISTVIEWW +#define WC_TABCONTROL WC_TABCONTROLW +#define WC_TREEVIEW WC_TREEVIEWW +#else +#define ANIMATE_CLASS ANIMATE_CLASSA +#define HOTKEY_CLASS HOTKEY_CLASSA +#define PROGRESS_CLASS PROGRESS_CLASSA +#define STATUSCLASSNAME STATUSCLASSNAMEA +#define TOOLBARCLASSNAME TOOLBARCLASSNAMEA +#define TOOLTIPS_CLASS TOOLTIPS_CLASSA +#define TRACKBAR_CLASS TRACKBAR_CLASSA +#define UPDOWN_CLASS UPDOWN_CLASSA +#define WC_HEADER WC_HEADERA +#define WC_LISTVIEW WC_LISTVIEWA +#define WC_TABCONTROL WC_TABCONTROLA +#define WC_TREEVIEW WC_TREEVIEWA +#endif /* UNICODE */ + +/* Header control styles */ +#define HDS_BUTTONS (2) +#define HDS_HIDDEN (8) +#define HDS_HORZ (0) + +/* HD_ITEM structure */ +#define HDI_BITMAP (16) +#define HDI_FORMAT (4) +#define HDI_HEIGHT (1) +#define HDI_LPARAM (8) +#define HDI_TEXT (2) +#define HDI_WIDTH (1) +#define HDF_CENTER (2) +#define HDF_LEFT (0) +#define HDF_RIGHT (1) +#define HDF_RTLREADING (4) +#define HDF_BITMAP (8192) +#define HDF_OWNERDRAW (32768) +#define HDF_STRING (16384) +#define HDF_JUSTIFYMASK (3) + +/* HD_HITTESTINFO structure */ +#define HHT_NOWHERE (1) +#define HHT_ONDIVIDER (4) +#define HHT_ONDIVOPEN (8) +#define HHT_ONHEADER (2) +#define HHT_TOLEFT (2048) +#define HHT_TORIGHT (1024) + +/* TBADDBITMAP structure */ +#define HINST_COMMCTRL ((HINSTANCE)-1) +#define IDB_STD_LARGE_COLOR (1) +#define IDB_STD_SMALL_COLOR (0) +#define IDB_VIEW_LARGE_COLOR (5) +#define IDB_VIEW_SMALL_COLOR (4) +#define STD_COPY (1) +#define STD_CUT (0) +#define STD_DELETE (5) +#define STD_FILENEW (6) +#define STD_FILEOPEN (7) +#define STD_FILESAVE (8) +#define STD_FIND (12) +#define STD_HELP (11) +#define STD_PASTE (2) +#define STD_PRINT (14) +#define STD_PRINTPRE (9) +#define STD_PROPERTIES (10) +#define STD_REDOW (4) +#define STD_REPLACE (13) +#define STD_UNDO (3) +#define VIEW_LARGEICONS (0) +#define VIEW_SMALLICONS (1) +#define VIEW_LIST (2) +#define VIEW_DETAILS (3) +#define VIEW_SORTNAME (4) +#define VIEW_SORTSIZE (5) +#define VIEW_SORTDATE (6) +#define VIEW_SORTTYPE (7) + +/* Toolbar styles */ +#define TBSTYLE_ALTDRAG (1024) +#define TBSTYLE_TOOLTIPS (256) +#define TBSTYLE_WRAPABLE (512) +#define TBSTYLE_BUTTON (0) +#define TBSTYLE_CHECK (2) +#define TBSTYLE_CHECKGROUP (6) +#define TBSTYLE_GROUP (4) +#define TBSTYLE_SEP (1) + +/* Toolbar states */ +#define TBSTATE_CHECKED (1) +#define TBSTATE_ENABLED (4) +#define TBSTATE_HIDDEN (8) +#define TBSTATE_INDETERMINATE (16) +#define TBSTATE_PRESSED (2) +#define TBSTATE_WRAP (32) + +/* Tooltip styles */ +#define TTS_ALWAYSTIP (1) +#define TTS_NOPREFIX (2) + +/* TOOLINFO structure */ +#define TTF_IDISHWND (1) +#define TTF_CENTERTIP (2) +#define TTF_RTLREADING (4) +#define TTF_SUBCLASS (16) + +/* TTM_SETDELAYTIME message */ +#define TTDT_AUTOMATIC (0) +#define TTDT_AUTOPOP (2) +#define TTDT_INITIAL (3) +#define TTDT_RESHOW (1) + +/* Status window */ +#define SBARS_SIZEGRIP (256) +#define SBARS_SIZEGRIP (256) + +/* DL_DRAGGING message */ +#define DL_MOVECURSOR (3) +#define DL_COPYCURSOR (2) +#define DL_STOPCURSOR (1) + +/* Up-down control styles */ +#define UDS_ALIGNLEFT (8) +#define UDS_ALIGNRIGHT (4) +#define UDS_ARROWKEYS (32) +#define UDS_AUTOBUDDY (16) +#define UDS_HORZ (64) +#define UDS_NOTHOUSANDS (128) +#define UDS_SETBUDDYINT (2) +#define UDS_WRAP (1) + +/* UDM_SETRANGE message */ +#define UD_MAXVAL (32767) +#define UD_MINVAL (-32767) + +/* HKM_GETHOTKEY message */ +#define HOTKEYF_ALT (4) +#define HOTKEYF_CONTROL (2) +#define HOTKEYF_EXT (8) +#define HOTKEYF_SHIFT (1) + +/* HKM_SETRULES message */ +#define HKCOMB_A (8) +#define HKCOMB_C (4) +#define HKCOMB_CA (64) +#define HKCOMB_NONE (1) +#define HKCOMB_S (2) +#define HKCOMB_SA (32) +#define HKCOMB_SC (16) +#define HKCOMB_SCA (128) + +/* Trackbar styles */ +#define TBS_HORZ (0) +#define TBS_VERT (2) +#define TBS_AUTOTICKS (1) +#define TBS_NOTICKS (16) +#define TBS_TOP (4) +#define TBS_BOTTOM (0) +#define TBS_LEFT (4) +#define TBS_RIGHT (0) +#define TBS_BOTH (8) +#define TBS_ENABLESELRANGE (32) +#define TBS_FIXEDLENGTH (64) +#define TBS_NOTHUMB (128) +#define TB_BOTTOM (7) +#define TB_ENDTRACK (8) +#define TB_LINEDOWN (1) +#define TB_LINEUP (0) +#define TB_PAGEDOWN (3) +#define TB_PAGEUP (2) +#define TB_THUMBPOSITION (4) +#define TB_THUMBTRACK (5) +#define TB_TOP (6) + +/* List view styles */ +#define LVS_ALIGNLEFT (2048) +#define LVS_ALIGNTOP (0) +#define LVS_AUTOARRANGE (256) +#define LVS_EDITLABELS (512) +#define LVS_ICON (0) +#define LVS_LIST (3) +#define LVS_NOCOLUMNHEADER (16384) +#define LVS_NOLABELWRAP (128) +#define LVS_NOSCROLL (8192) +#define LVS_NOSORTHEADER (32768) +#define LVS_OWNERDRAWFIXED (1024) +#define LVS_REPORT (1) +#define LVS_SHAREIMAGELISTS (64) +#define LVS_SHOWSELALWAYS (8) +#define LVS_SINGLESEL (4) +#define LVS_SMALLICON (2) +#define LVS_SORTASCENDING (16) +#define LVS_SORTDESCENDING (32) +#define LVS_TYPESTYLEMASK (64512) +#define LVSIL_NORMAL (0) +#define LVSIL_SMALL (1) +#define LVSIL_STATE (2) +#define LVIS_CUT (4) +#define LVIS_DROPHILITED (8) +#define LVIS_FOCUSED (1) +#define LVIS_SELECTED (2) +#define LVIS_OVERLAYMASK (3840) +#define LVIS_STATEIMAGEMASK (61440) +#define LPSTR_TEXTCALLBACKW ((LPWSTR)-1L) +#define LPSTR_TEXTCALLBACKA ((LPSTR)-1L) +#ifdef UNICODE +#define LPSTR_TEXTCALLBACK LPSTR_TEXTCALLBACKW +#else +#define LPSTR_TEXTCALLBACK LPSTR_TEXTCALLBACKA +#endif /* UNICODE */ + +/* LV_ITEM structure */ +#define LVIF_TEXT (1) +#define LVIF_IMAGE (2) +#define LVIF_PARAM (4) +#define LVIF_STATE (8) +#define LVIF_DI_SETITEM (4096) + +/* LVM_GETNEXTITEM structure */ +#define LVNI_ABOVE (256) +#define LVNI_ALL (0) +#define LVNI_BELOW (512) +#define LVNI_TOLEFT (1024) +#define LVNI_TORIGHT (2048) +#define LVNI_CUT (4) +#define LVNI_DROPHILITED (8) +#define LVNI_FOCUSED (1) +#define LVNI_SELECTED (2) + +/* LV_FINDINFO structure */ +#define LVFI_PARAM (1) +#define LVFI_PARTIAL (8) +#define LVFI_STRING (2) +#define LVFI_WRAP (32) +#define LVFI_NEARESTXY (64) + +/* LV_HITTESTINFO structure */ +#define LVHT_ABOVE (8) +#define LVHT_BELOW (16) +#define LVHT_NOWHERE (1) +#define LVHT_ONITEMICON (2) +#define LVHT_ONITEMLABEL (4) +#define LVHT_ONITEMSTATEICON (8) +#define LVHT_TOLEFT (64) +#define LVHT_TORIGHT (32) + +/* LV_COLUMN structure */ +#define LVCF_FMT (1) +#define LVCF_SUBITEM (8) +#define LVCF_TEXT (4) +#define LVCF_WIDTH (2) +#define LVCFMT_CENTER (2) +#define LVCFMT_LEFT (0) +#define LVCFMT_RIGHT (1) + +/* ListView_GetItemRect */ +#define LVIR_BOUNDS (0) +#define LVIR_ICON (1) +#define LVIR_LABEL (2) +#define LVIR_SELECTBOUNDS (3) + +/* LVM_ARRANGE message */ +#define LVA_ALIGNLEFT (1) +#define LVA_ALIGNTOP (2) +#define LVA_DEFAULT (0) +#define LVA_SNAPTOGRID (5) + +/* LVM_SETCOLUMNWIDTH message */ +#define LVSCW_AUTOSIZE (-1) +#define LVSCW_AUTOSIZE_USEHEADER (-2) + +/* Tree View styles */ +#define TVS_DISABLEDRAGDROP (16) +#define TVS_EDITLABELS (8) +#define TVS_HASBUTTONS (1) +#define TVS_HASLINES (2) +#define TVS_LINESATROOT (4) +#define TVS_SHOWSELALWAYS (32) + +/* Tree View states */ +#define TVIS_BOLD (16) +#define TVIS_CUT (4) +#define TVIS_DROPHILITED (8) +#define TVIS_EXPANDED (32) +#define TVIS_EXPANDEDONCE (64) +#define TVIS_FOCUSED (1) +#define TVIS_OVERLAYMASK (3840) +#define TVIS_SELECTED (2) +#define TVIS_STATEIMAGEMASK (61440) +#define TVIS_USERMASK (61440) + +/* TV_ITEM structure */ +#define TVIF_CHILDREN (64) +#define TVIF_HANDLE (16) +#define TVIF_IMAGE (2) +#define TVIF_PARAM (4) +#define TVIF_SELECTEDIMAGE (32) +#define TVIF_STATE (8) +#define TVIF_TEXT (1) +#define I_CHILDRENCALLBACK (-1) +#define I_IMAGECALLBACK (-1) + +/* TV_INSERTSTRUCT structure */ +#define TVI_ROOT ((HTREEITEM)0xFFFF0000) +#define TVI_FIRST ((HTREEITEM)0xFFFF0001) +#define TVI_LAST ((HTREEITEM)0xFFFF0002) +#define TVI_SORT ((HTREEITEM)0xFFFF0003) + +/* TV_HITTESTINFO structure */ +#define TVHT_ABOVE (256) +#define TVHT_BELOW (512) +#define TVHT_NOWHERE (1) +#define TVHT_ONITEM (70) +#define TVHT_ONITEMBUTTON (16) +#define TVHT_ONITEMICON (2) +#define TVHT_ONITEMINDENT (8) +#define TVHT_ONITEMLABEL (4) +#define TVHT_ONITEMRIGHT (32) +#define TVHT_ONITEMSTATEICON (64) +#define TVHT_TOLEFT (2048) +#define TVHT_TORIGHT (1024) + +/* TVM_EXPAND message */ +#define TVE_COLLAPSE (1) +#define TVE_COLLAPSERESET (32768) +#define TVE_EXPAND (2) +#define TVE_TOGGLE (3) + +/* TVM_GETIMAGELIST message */ +#define TVSIL_NORMAL (0) +#define TVSIL_STATE (2) + +/* TVM_GETNEXTITEM message */ +#define TVGN_CARET (9) +#define TVGN_CHILD (4) +#define TVGN_DROPHILITE (8) +#define TVGN_FIRSTVISIBLE (5) +#define TVGN_NEXT (1) +#define TVGN_NEXTVISIBLE (6) +#define TVGN_PARENT (3) +#define TVGN_PREVIOUS (2) +#define TVGN_PREVIOUSVISIBLE (7) +#define TVGN_ROOT (0) + +/* TVN_SELCHANGED message */ +#define TVC_BYKEYBOARD (2) +#define TVC_BYMOUSE (1) +#define TVC_UNKNOWN (0) + +/* Tab control styles */ +#define TCS_BUTTONS (256) +#define TCS_FIXEDWIDTH (1024) +#define TCS_FOCUSNEVER (32768) +#define TCS_FOCUSONBUTTONDOWN (4096) +#define TCS_FORCEICONLEFT (16) +#define TCS_FORCELABELLEFT (32) +#define TCS_MULTILINE (512) +#define TCS_OWNERDRAWFIXED (8192) +#define TCS_RAGGEDRIGHT (2048) +#define TCS_RIGHTJUSTIFY (0) +#define TCS_SINGLELINE (0) +#define TCS_TABS (0) +#define TCS_TOOLTIPS (16384) + +/* TC_ITEM structure */ +#define TCIF_TEXT (1) +#define TCIF_IMAGE (2) +#define TCIF_PARAM (8) +#define TCIF_RTLREADING (4) + +/* TC_HITTESTINFO structure */ +#define TCHT_NOWHERE (1) +#define TCHT_ONITEM (6) +#define TCHT_ONITEMICON (2) +#define TCHT_ONITEMLABEL (4) + +/* Animation control styles */ +#define ACS_AUTOPLAY (4) +#define ACS_CENTER (1) +#define ACS_TRANSPARENT (2) + +/* MODEMDEVCAPS structure */ +#define DIALOPTION_BILLING (64) +#define DIALOPTION_QUIET (128) +#define DIALOPTION_DIALTONE (256) +#define MDMVOLFLAG_LOW (1) +#define MDMVOLFLAG_MEDIUM (2) +#define MDMVOLFLAG_HIGH (4) +#define MDMVOL_LOW (0) +#define MDMVOL_MEDIUM (1) +#define MDMVOL_HIGH (2) +#define MDMSPKRFLAG_OFF (1) +#define MDMSPKRFLAG_DIAL (2) +#define MDMSPKRFLAG_ON (4) +#define MDMSPKRFLAG_CALLSETUP (8) +#define MDMSPKR_OFF (0) +#define MDMSPKR_DIAL (1) +#define MDMSPKR_ON (2) +#define MDMSPKR_CALLSETUP (3) +#define MDM_BLIND_DIAL (512) +#define MDM_CCITT_OVERRIDE (64) +#define MDM_CELLULAR (8) +#define MDM_COMPRESSION (1) +#define MDM_ERROR_CONTROL (2) +#define MDM_FLOWCONTROL_HARD (16) +#define MDM_FLOWCONTROL_SOFT (32) +#define MDM_FORCED_EC (4) +#define MDM_SPEED_ADJUST (128) +#define MDM_TONE_DIAL (256) +#define MDM_V23_OVERRIDE (1024) + +/* Languages */ +#define LANG_BULGARIAN (2) +#define LANG_CHINESE (4) +#define LANG_CROATIAN (26) +#define LANG_CZECH (5) +#define LANG_DANISH (6) +#define LANG_DUTCH (19) +#define LANG_ENGLISH (9) +#define LANG_FINNISH (11) +#define LANG_FRENCH (12) +#define LANG_GERMAN (7) +#define LANG_GREEK (8) +#define LANG_HUNGARIAN (14) +#define LANG_ICELANDIC (15) +#define LANG_ITALIAN (16) +#define LANG_JAPANESE (17) +#define LANG_KOREAN (18) +#define LANG_NEUTRAL (0) +#define LANG_NORWEGIAN (20) +#define LANG_POLISH (21) +#define LANG_PORTUGUESE (22) +#define LANG_ROMANIAN (24) +#define LANG_RUSSIAN (25) +#define LANG_SLOVAK (27) +#define LANG_SLOVENIAN (36) +#define LANG_SPANISH (10) +#define LANG_SWEDISH (29) +#define LANG_TURKISH (31) +#define SUBLANG_CHINESE_SIMPLIFIED (2) +#define SUBLANG_CHINESE_TRADITIONAL (1) +#define SUBLANG_CHINESE_HONGKONG (3) +#define SUBLANG_CHINESE_SINGAPORE (4) +#define SUBLANG_DEFAULT (1) +#define SUBLANG_DUTCH (1) +#define SUBLANG_DUTCH_BELGIAN (2) +#define SUBLANG_ENGLISH_AUS (3) +#define SUBLANG_ENGLISH_CAN (4) +#define SUBLANG_ENGLISH_EIRE (6) +#define SUBLANG_ENGLISH_NZ (5) +#define SUBLANG_ENGLISH_UK (2) +#define SUBLANG_ENGLISH_US (1) +#define SUBLANG_FRENCH (1) +#define SUBLANG_FRENCH_BELGIAN (2) +#define SUBLANG_FRENCH_CANADIAN (3) +#define SUBLANG_FRENCH_SWISS (4) +#define SUBLANG_GERMAN (1) +#define SUBLANG_GERMAN_AUSTRIAN (3) +#define SUBLANG_GERMAN_SWISS (2) +#define SUBLANG_ITALIAN (1) +#define SUBLANG_ITALIAN_SWISS (2) +#define SUBLANG_NEUTRAL (0) +#define SUBLANG_NORWEGIAN_BOKMAL (1) +#define SUBLANG_NORWEGIAN_NYNORSK (2) +#define SUBLANG_PORTUGUESE (2) +#define SUBLANG_PORTUGUESE_BRAZILIAN (1) +#define SUBLANG_SPANISH (1) +#define SUBLANG_SPANISH_MEXICAN (2) +#define SUBLANG_SPANISH_MODERN (3) +#define SUBLANG_SYS_DEFAULT (2) +#define NLS_VALID_LOCALE_MASK (1048575) +#define SORT_DEFAULT (0) +#define SORT_JAPANESE_XJIS (0) +#define SORT_JAPANESE_UNICODE (1) +#define SORT_CHINESE_BIG5 (0) +#define SORT_CHINESE_UNICODE (1) +#define SORT_KOREAN_KSC (0) +#define SORT_KOREAN_UNICODE (1) + +/* SYSTEM_INFO structure */ +#define PROCESSOR_INTEL_386 (386) +#define PROCESSOR_INTEL_486 (486) +#define PROCESSOR_INTEL_PENTIUM (586) +#define PROCESSOR_MIPS_R4000 (4000) +#define PROCESSOR_ALPHA_21064 (21064) + +/* FSCTL_SET_COMPRESSION */ +#define COMPRESSION_FORMAT_NONE (0) +#define COMPRESSION_FORMAT_DEFAULT (1) +#define COMPRESSION_FORMAT_LZNT1 (2) + +/* TAPE_GET_DRIVE_PARAMETERS structure */ +#define TAPE_DRIVE_COMPRESSION (131072) +#define TAPE_DRIVE_ECC (65536) +#define TAPE_DRIVE_ERASE_BOP_ONLY (64) +#define TAPE_DRIVE_ERASE_LONG (32) +#define TAPE_DRIVE_ERASE_IMMEDIATE (128) +#define TAPE_DRIVE_ERASE_SHORT (16) +#define TAPE_DRIVE_FIXED (1) +#define TAPE_DRIVE_FIXED_BLOCK (1024) +#define TAPE_DRIVE_INITIATOR (4) +#define TAPE_DRIVE_PADDING (262144) +#define TAPE_DRIVE_GET_ABSOLUTE_BLK (1048576) +#define TAPE_DRIVE_GET_LOGICAL_BLK (2097152) +#define TAPE_DRIVE_REPORT_SMKS (524288) +#define TAPE_DRIVE_SELECT (2) +#define TAPE_DRIVE_SET_EOT_WZ_SIZE (4194304) +#define TAPE_DRIVE_TAPE_CAPACITY (256) +#define TAPE_DRIVE_TAPE_REMAINING (512) +#define TAPE_DRIVE_VARIABLE_BLOCK (2048) +#define TAPE_DRIVE_WRITE_PROTECT (4096) +#define TAPE_DRIVE_ABS_BLK_IMMED (-2147475456) +#define TAPE_DRIVE_ABSOLUTE_BLK (-2147479552) +#define TAPE_DRIVE_END_OF_DATA (-2147418112) +#define TAPE_DRIVE_FILEMARKS (-2147221504) +#define TAPE_DRIVE_LOAD_UNLOAD (-2147483647) +#define TAPE_DRIVE_LOAD_UNLD_IMMED (-2147483616) +#define TAPE_DRIVE_LOCK_UNLOCK (-2147483644) +#define TAPE_DRIVE_LOCK_UNLK_IMMED (-2147483520) +#define TAPE_DRIVE_LOG_BLK_IMMED (-2147450880) +#define TAPE_DRIVE_LOGICAL_BLK (-2147467264) +#define TAPE_DRIVE_RELATIVE_BLKS (-2147352576) +#define TAPE_DRIVE_REVERSE_POSITION (-2143289344) +#define TAPE_DRIVE_REWIND_IMMEDIATE (-2147483640) +#define TAPE_DRIVE_SEQUENTIAL_FMKS (-2146959360) +#define TAPE_DRIVE_SEQUENTIAL_SMKS (-2145386496) +#define TAPE_DRIVE_SET_BLOCK_SIZE (-2147483632) +#define TAPE_DRIVE_SET_COMPRESSION (-2147483136) +#define TAPE_DRIVE_SET_ECC (-2147483392) +#define TAPE_DRIVE_SET_PADDING (-2147482624) +#define TAPE_DRIVE_SET_REPORT_SMKS (-2147481600) +#define TAPE_DRIVE_SETMARKS (-2146435072) +#define TAPE_DRIVE_SPACE_IMMEDIATE (-2139095040) +#define TAPE_DRIVE_TENSION (-2147483646) +#define TAPE_DRIVE_TENSION_IMMED (-2147483584) +#define TAPE_DRIVE_WRITE_FILEMARKS (-2113929216) +#define TAPE_DRIVE_WRITE_LONG_FMKS (-2013265920) +#define TAPE_DRIVE_WRITE_MARK_IMMED (-1879048192) +#define TAPE_DRIVE_WRITE_SETMARKS (-2130706432) +#define TAPE_DRIVE_WRITE_SHORT_FMKS (-2080374784) + +/* Standard rights */ +#define STANDARD_RIGHTS_REQUIRED (0xf0000L) +#define STANDARD_RIGHTS_WRITE (0x20000L) +#define STANDARD_RIGHTS_READ (0x20000L) +#define STANDARD_RIGHTS_EXECUTE (0x20000L) +#define STANDARD_RIGHTS_ALL (0x1f0000L) +#define SPECIFIC_RIGHTS_ALL (0xffffL) + +/* ACCESS_MASK */ +#define MAXIMUM_ALLOWED (0x2000000L) +#define GENERIC_ALL (0x10000000L) + +/* SID */ +#define SECURITY_NULL_RID (0L) +#define SECURITY_WORLD_RID (0L) +#define SECURITY_LOCAL_RID (0L) +#define SECURITY_CREATOR_OWNER_RID (0L) +#define SECURITY_CREATOR_GROUP_RID (0x1L) +#define SECURITY_DIALUP_RID (0x1L) +#define SECURITY_NETWORK_RID (0x2L) +#define SECURITY_BATCH_RID (0x3L) +#define SECURITY_INTERACTIVE_RID (0x4L) +#define SECURITY_LOGON_IDS_RID (0x5L) +#define SECURITY_LOGON_IDS_RID_COUNT (0x3L) +#define SECURITY_SERVICE_RID (0x6L) +#define SECURITY_LOCAL_SYSTEM_RID (0x12L) +#define SECURITY_BUILTIN_DOMAIN_RID (0x20L) +#define DOMAIN_USER_RID_ADMIN (0x1f4L) +#define DOMAIN_USER_RID_GUEST (0x1f5L) +#define DOMAIN_GROUP_RID_ADMINS (0x200L) +#define DOMAIN_GROUP_RID_USERS (0x201L) +#define DOMAIN_ALIAS_RID_ADMINS (0x220L) +#define DOMAIN_ALIAS_RID_USERS (0x221L) +#define DOMAIN_ALIAS_RID_GUESTS (0x222L) +#define DOMAIN_ALIAS_RID_POWER_USERS (0x223L) +#define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x224L) +#define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x225L) +#define DOMAIN_ALIAS_RID_PRINT_OPS (0x226L) +#define DOMAIN_ALIAS_RID_BACKUP_OPS (0x227L) +#define DOMAIN_ALIAS_RID_REPLICATOR (0x228L) + +/* TOKEN_GROUPS structure */ +#define SE_GROUP_MANDATORY (0x1L) +#define SE_GROUP_ENABLED_BY_DEFAULT (0x2L) +#define SE_GROUP_ENABLED (0x4L) +#define SE_GROUP_OWNER (0x8L) +#define SE_GROUP_LOGON_ID (0xc0000000L) + +/* ACL Defines */ +#define ACL_REVISION (2) + +/* ACE_HEADER structure */ +#define ACCESS_ALLOWED_ACE_TYPE (0x0) +#define ACCESS_DENIED_ACE_TYPE (0x1) +#define SYSTEM_AUDIT_ACE_TYPE (0x2) +#define SYSTEM_ALARM_ACE_TYPE (0x3) + +/* ACE flags in the ACE_HEADER structure */ +#define OBJECT_INHERIT_ACE (0x1) +#define CONTAINER_INHERIT_ACE (0x2) +#define NO_PROPAGATE_INHERIT_ACE (0x4) +#define INHERIT_ONLY_ACE (0x8) +#define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) +#define FAILED_ACCESS_ACE_FLAG (0x80) + +/* SECURITY_DESCRIPTOR_CONTROL */ +#define SECURITY_DESCRIPTOR_REVISION (1) +#define SECURITY_DESCRIPTOR_MIN_LENGTH (20) +#define SE_OWNER_DEFAULTED (1) +#define SE_GROUP_DEFAULTED (2) +#define SE_DACL_PRESENT (4) +#define SE_DACL_DEFAULTED (8) +#define SE_SACL_PRESENT (16) +#define SE_SACL_DEFAULTED (32) +#define SE_SELF_RELATIVE (32768) + +/* PRIVILEGE_SET */ +#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x1L) +#define SE_PRIVILEGE_ENABLED (0x2L) +#define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) +#define PRIVILEGE_SET_ALL_NECESSARY (0x1) + +/* OPENFILENAME structure */ +#define OFN_ALLOWMULTISELECT (0x200) +#define OFN_CREATEPROMPT (0x2000) +#define OFN_ENABLEHOOK (0x20) +#define OFN_ENABLETEMPLATE (0x40) +#define OFN_ENABLETEMPLATEHANDLE (0x80) +#define OFN_EXPLORER (0x80000) +#define OFN_EXTENSIONDIFFERENT (0x400) +#define OFN_FILEMUSTEXIST (0x1000) +#define OFN_HIDEREADONLY (0x4) +#define OFN_LONGNAMES (0x200000) +#define OFN_NOCHANGEDIR (0x8) +#define OFN_NODEREFERENCELINKS (0x100000) +#define OFN_NOLONGNAMES (0x40000) +#define OFN_NONETWORKBUTTON (0x20000) +#define OFN_NOREADONLYRETURN (0x8000) +#define OFN_NOTESTFILECREATE (0x10000) +#define OFN_NOVALIDATE (0x100) +#define OFN_OVERWRITEPROMPT (0x2) +#define OFN_PATHMUSTEXIST (0x800) +#define OFN_READONLY (0x1) +#define OFN_SHAREAWARE (0x4000) +#define OFN_SHOWHELP (0x10) + +/* SHAREVISTRING message */ +#define OFN_SHAREFALLTHROUGH (0x2) +#define OFN_SHARENOWARN (0x1) +#define OFN_SHAREWARN (0) + +/* Open/Save notifications */ +#define CDN_INITDONE (0xfffffda7) +#define CDN_SELCHANGE (0xfffffda6) +#define CDN_FOLDERCHANGE (0xfffffda5) +#define CDN_SHAREVIOLATION (0xfffffda4) +#define CDN_HELP (0xfffffda3) +#define CDN_FILEOK (0xfffffda2) +#define CDN_TYPECHANGE (0xfffffda1) + +/* Open/Save messages */ +#define CDM_GETFILEPATH (0x465) +#define CDM_GETFOLDERIDLIST (0x467) +#define CDM_GETFOLDERPATH (0x466) +#define CDM_GETSPEC (0x464) +#define CDM_HIDECONTROL (0x469) +#define CDM_SETCONTROLTEXT (0x468) +#define CDM_SETDEFEXT (0x46a) + +/* CHOOSECOLOR structure */ +#define CC_ENABLEHOOK (0x10) +#define CC_ENABLETEMPLATE (0x20) +#define CC_ENABLETEMPLATEHANDLE (0x40) +#define CC_FULLOPEN (0x2) +#define CC_PREVENTFULLOPEN (0x4) +#define CC_RGBINIT (0x1) +#define CC_SHOWHELP (0x8) +#define CC_SOLIDCOLOR (0x80) + +/* FINDREPLACE structure */ +#define FR_DIALOGTERM (0x40) +#define FR_DOWN (0x1) +#define FR_ENABLEHOOK (0x100) +#define FR_ENABLETEMPLATE (0x200) +#define FR_ENABLETEMPLATEHANDLE (0x2000) +#define FR_FINDNEXT (0x8) +#define FR_HIDEUPDOWN (0x4000) +#define FR_HIDEMATCHCASE (0x8000) +#define FR_HIDEWHOLEWORD (0x10000) +#define FR_MATCHCASE (0x4) +#define FR_NOMATCHCASE (0x800) +#define FR_NOUPDOWN (0x400) +#define FR_NOWHOLEWORD (0x1000) +#define FR_REPLACE (0x10) +#define FR_REPLACEALL (0x20) +#define FR_SHOWHELP (0x80) +#define FR_WHOLEWORD (0x2) + +/* CHOOSEFONT structure */ +#define CF_APPLY (0x200L) +#define CF_ANSIONLY (0x400L) +#define CF_BOTH (0x3) +#define CF_TTONLY (0x40000L) +#define CF_EFFECTS (0x100L) +#define CF_ENABLEHOOK (0x8L) +#define CF_ENABLETEMPLATE (0x10L) +#define CF_ENABLETEMPLATEHANDLE (0x20L) +#define CF_FIXEDPITCHONLY (0x4000L) +#define CF_FORCEFONTEXIST (0x10000L) +#define CF_INITTOLOGFONTSTRUCT (0x40L) +#define CF_LIMITSIZE (0x2000L) +#define CF_NOOEMFONTS (0x800L) +#define CF_NOFACESEL (0x80000L) +#define CF_NOSCRIPTSEL (0x800000L) +#define CF_NOSTYLESEL (0x100000L) +#define CF_NOSIZESEL (0x200000L) +#define CF_NOSIMULATIONS (0x1000L) +#define CF_NOVECTORFONTS (0x800L) +#define CF_NOVERTFONTS (0x1000000L) +#define CF_PRINTERFONTS (0x2) +#define CF_SCALABLEONLY (0x20000L) +#define CF_SCREENFONTS (0x1) +#define CF_SCRIPTSONLY (0x400L) +#define CF_SELECTSCRIPT (0x400000L) +#define CF_SHOWHELP (0x4L) +#define CF_USESTYLE (0x80L) +#define CF_WYSIWYG (0x8000L) +#define BOLD_FONTTYPE (0x100) +#define ITALIC_FONTTYPE (0x200) +#define PRINTER_FONTTYPE (0x4000) +#define REGULAR_FONTTYPE (0x400) +#define SCREEN_FONTTYPE (0x2000) +#define SIMULATED_FONTTYPE (0x8000) + +/* Common dialog messages */ +#define COLOROKSTRINGW L"commdlg_ColorOK" +#define FILEOKSTRINGW L"commdlg_FileNameOK" +#define FINDMSGSTRINGW L"commdlg_FindReplace" +#define HELPMSGSTRINGW L"commdlg_help" +#define LBSELCHSTRINGW L"commdlg_LBSelChangedNotify" +#define SETRGBSTRINGW L"commdlg_SetRGBColor" +#define SHAREVISTRINGW L"commdlg_ShareViolation" +#define COLOROKSTRINGA "commdlg_ColorOK" +#define FILEOKSTRINGA "commdlg_FileNameOK" +#define FINDMSGSTRINGA "commdlg_FindReplace" +#define HELPMSGSTRINGA "commdlg_help" +#define LBSELCHSTRINGA "commdlg_LBSelChangedNotify" +#define SETRGBSTRINGA "commdlg_SetRGBColor" +#define SHAREVISTRINGA "commdlg_ShareViolation" +#ifdef UNICODE +#define COLOROKSTRING COLOROKSTRINGW +#define FILEOKSTRING FILEOKSTRINGW +#define FINDMSGSTRING FINDMSGSTRINGW +#define HELPMSGSTRING HELPMSGSTRINGW +#define LBSELCHSTRING LBSELCHSTRINGW +#define SETRGBSTRING SETRGBSTRINGW +#define SHAREVISTRING SHAREVISTRINGW +#else +#define COLOROKSTRING COLOROKSTRINGA +#define FILEOKSTRING FILEOKSTRINGA +#define FINDMSGSTRING FINDMSGSTRINGA +#define HELPMSGSTRING HELPMSGSTRINGA +#define LBSELCHSTRING LBSELCHSTRINGA +#define SETRGBSTRING SETRGBSTRINGA +#define SHAREVISTRING SHAREVISTRINGA +#endif + +/* LBSELCHSTRING message */ +#define CD_LBSELCHANGE (0) +#define CD_LBSELADD (2) +#define CD_LBSELSUB (1) +#define CD_LBSELNOITEMS (-1) + +/* DEVNAMES structure */ +#define DN_DEFAULTPRN (1) + +/* PRINTDLG structure */ +#define PD_ALLPAGES (0) +#define PD_COLLATE (16) +#define PD_DISABLEPRINTTOFILE (524288) +#define PD_ENABLEPRINTHOOK (4096) +#define PD_ENABLEPRINTTEMPLATE (16384) +#define PD_ENABLEPRINTTEMPLATEHANDLE (65536) +#define PD_ENABLESETUPHOOK (8192) +#define PD_ENABLESETUPTEMPLATE (32768) +#define PD_ENABLESETUPTEMPLATEHANDLE (131072) +#define PD_HIDEPRINTTOFILE (1048576) +#define PD_NOPAGENUMS (8) +#define PD_NOSELECTION (4) +#define PD_NOWARNING (128) +#define PD_PAGENUMS (2) +#define PD_PRINTSETUP (64) +#define PD_PRINTTOFILE (32) +#define PD_RETURNDC (256) +#define PD_RETURNDEFAULT (1024) +#define PD_RETURNIC (512) +#define PD_SELECTION (1) +#define PD_SHOWHELP (2048) +#define PD_USEDEVMODECOPIES (262144) +#define PD_USEDEVMODECOPIESANDCOLLATE (262144) + +/* PAGESETUPDLG structure */ +#define PSD_DEFAULTMINMARGINS (0) +#define PSD_DISABLEMARGINS (16) +#define PSD_DISABLEORIENTATION (256) +#define PSD_DISABLEPAGEPAINTING (524288) +#define PSD_DISABLEPAPER (512) +#define PSD_DISABLEPRINTER (32) +#define PSD_ENABLEPAGEPAINTHOOK (262144) +#define PSD_ENABLEPAGESETUPHOOK (8192) +#define PSD_ENABLEPAGESETUPTEMPLATE (32768) +#define PSD_ENABLEPAGESETUPTEMPLATEHANDLE (131072) +#define PSD_INHUNDREDTHSOFMILLIMETERS (8) +#define PSD_INTHOUSANDTHSOFINCHES (4) +#define PSD_INWININIINTLMEASURE (0) +#define PSD_MARGINS (2) +#define PSD_MINMARGINS (1) +#define PSD_NOWARNING (128) +#define PSD_RETURNDEFAULT (1024) +#define PSD_SHOWHELP (2048) + +/* WM_SHOWWINDOW message */ +#define SW_OTHERUNZOOM (4) +#define SW_OTHERZOOM (2) +#define SW_PARENTCLOSING (1) +#define SW_PARENTOPENING (3) + +/* Virtual Key codes */ +#define VK_LBUTTON (1) +#define VK_RBUTTON (2) +#define VK_CANCEL (3) +#define VK_MBUTTON (4) +#define VK_BACK (8) +#define VK_TAB (9) +#define VK_CLEAR (12) +#define VK_RETURN (13) +#define VK_SHIFT (16) +#define VK_CONTROL (17) +#define VK_MENU (18) +#define VK_PAUSE (19) +#define VK_CAPITAL (20) +#define VK_ESCAPE (27) +#define VK_SPACE (32) +#define VK_PRIOR (33) +#define VK_NEXT (34) +#define VK_END (35) +#define VK_HOME (36) +#define VK_LEFT (37) +#define VK_UP (38) +#define VK_RIGHT (39) +#define VK_DOWN (40) +#define VK_SELECT (41) +#define VK_PRINT (42) +#define VK_EXECUTE (43) +#define VK_SNAPSHOT (44) +#define VK_INSERT (45) +#define VK_DELETE (46) +#define VK_HELP (47) +#define VK_0 (48) +#define VK_1 (49) +#define VK_2 (50) +#define VK_3 (51) +#define VK_4 (52) +#define VK_5 (53) +#define VK_6 (54) +#define VK_7 (55) +#define VK_8 (56) +#define VK_9 (57) +#define VK_A (65) +#define VK_B (66) +#define VK_C (67) +#define VK_D (68) +#define VK_E (69) +#define VK_F (70) +#define VK_G (71) +#define VK_H (72) +#define VK_I (73) +#define VK_J (74) +#define VK_K (75) +#define VK_L (76) +#define VK_M (77) +#define VK_N (78) +#define VK_O (79) +#define VK_P (80) +#define VK_Q (81) +#define VK_R (82) +#define VK_S (83) +#define VK_T (84) +#define VK_U (85) +#define VK_V (86) +#define VK_W (87) +#define VK_X (88) +#define VK_Y (89) +#define VK_Z (90) +#define VK_NUMPAD0 (96) +#define VK_NUMPAD1 (97) +#define VK_NUMPAD2 (98) +#define VK_NUMPAD3 (99) +#define VK_NUMPAD4 (100) +#define VK_NUMPAD5 (101) +#define VK_NUMPAD6 (102) +#define VK_NUMPAD7 (103) +#define VK_NUMPAD8 (104) +#define VK_NUMPAD9 (105) +#define VK_MULTIPLY (106) +#define VK_ADD (107) +#define VK_SEPARATOR (108) +#define VK_SUBTRACT (109) +#define VK_DECIMAL (110) +#define VK_DIVIDE (111) +#define VK_F1 (112) +#define VK_F2 (113) +#define VK_F3 (114) +#define VK_F4 (115) +#define VK_F5 (116) +#define VK_F6 (117) +#define VK_F7 (118) +#define VK_F8 (119) +#define VK_F9 (120) +#define VK_F10 (121) +#define VK_F11 (122) +#define VK_F12 (123) +#define VK_F13 (124) +#define VK_F14 (125) +#define VK_F15 (126) +#define VK_F16 (127) +#define VK_F17 (128) +#define VK_F18 (129) +#define VK_F19 (130) +#define VK_F20 (131) +#define VK_F21 (132) +#define VK_F22 (133) +#define VK_F23 (134) +#define VK_F24 (135) + +/* GetAsyncKeyState */ +#define VK_NUMLOCK (144) +#define VK_SCROLL (145) +#define VK_LSHIFT (160) +#define VK_LCONTROL (162) +#define VK_LMENU (164) +#define VK_RSHIFT (161) +#define VK_RCONTROL (163) +#define VK_RMENU (165) + +/* ImmGetVirtualKey */ +#define VK_PROCESSKEY (229) + +/* Keystroke Message Flags */ +#define KF_ALTDOWN (8192) +#define KF_DLGMODE (2048) +#define KF_EXTENDED (256) +#define KF_MENUMODE (4096) +#define KF_REPEAT (16384) +#define KF_UP (32768) + +/* GetKeyboardLayoutName */ +#define KL_NAMELENGTH (9) + +/* WM_ACTIVATE message */ +#define WA_ACTIVE (1) +#define WA_CLICKACTIVE (2) +#define WA_INACTIVE (0) + +/* WM_ACTIVATE message */ +#define PWR_CRITICALRESUME (3) +#define PWR_SUSPENDREQUEST (1) +#define PWR_SUSPENDRESUME (2) +#define PWR_FAIL (-1) +#define PWR_OK (1) + +/* WM_NOTIFYFORMAT message */ +#define NF_QUERY (3) +#define NF_REQUERY (4) +#define NFR_ANSI (1) +#define NFR_UNICODE (2) + +/* WM_SIZING message */ +#define WMSZ_BOTTOM (6) +#define WMSZ_BOTTOMLEFT (7) +#define WMSZ_BOTTOMRIGHT (8) +#define WMSZ_LEFT (1) +#define WMSZ_RIGHT (2) +#define WMSZ_TOP (3) +#define WMSZ_TOPLEFT (4) +#define WMSZ_TOPRIGHT (5) + +/* WM_MOUSEACTIVATE message */ +#define MA_ACTIVATE (1) +#define MA_ACTIVATEANDEAT (2) +#define MA_NOACTIVATE (3) +#define MA_NOACTIVATEANDEAT (4) + +/* WM_SIZE message */ +#define SIZE_MAXHIDE (4) +#define SIZE_MAXIMIZED (2) +#define SIZE_MAXSHOW (3) +#define SIZE_MINIMIZED (1) +#define SIZE_RESTORED (0) + +/* WM_NCCALCSIZE message */ +#define WVR_ALIGNTOP (16) +#define WVR_ALIGNLEFT (32) +#define WVR_ALIGNBOTTOM (64) +#define WVR_ALIGNRIGHT (128) +#define WVR_HREDRAW (256) +#define WVR_VREDRAW (512) +#define WVR_REDRAW (768) +#define WVR_VALIDRECTS (1024) + +/* WM_NCHITTEST message */ +#define HTBOTTOM (15) +#define HTBOTTOMLEFT (16) +#define HTBOTTOMRIGHT (17) +#define HTCAPTION (2) +#define HTCLIENT (1) +#define HTERROR (-2) +#define HTGROWBOX (4) +#define HTHSCROLL (6) +#define HTLEFT (10) +#define HTMENU (5) +#define HTNOWHERE (0) +#define HTREDUCE (8) +#define HTRIGHT (11) +#define HTSIZE (4) +#define HTSYSMENU (3) +#define HTTOP (12) +#define HTTOPLEFT (13) +#define HTTOPRIGHT (14) +#define HTTRANSPARENT (-1) +#define HTVSCROLL (7) +#define HTZOOM (9) + +/* Mouse messages */ +#define MK_CONTROL (8) +#define MK_LBUTTON (1) +#define MK_MBUTTON (16) +#define MK_RBUTTON (2) +#define MK_SHIFT (4) + +/* WNDCLASS structure */ +#define CS_BYTEALIGNCLIENT (4096) +#define CS_BYTEALIGNWINDOW (8192) +#define CS_CLASSDC (64) +#define CS_DBLCLKS (8) +#define CS_GLOBALCLASS (16384) +#define CS_HREDRAW (2) +#define CS_KEYCVTWINDOW (4) +#define CS_NOCLOSE (512) +#define CS_NOKEYCVT (256) +#define CS_OWNDC (32) +#define CS_PARENTDC (128) +#define CS_SAVEBITS (2048) +#define CS_VREDRAW (1) +#define DLGWINDOWEXTRA (30) + +/* ACCEL structure */ +#define FALT (16) +#define FCONTROL (8) +#define FNOINVERT (2) +#define FSHIFT (4) +#define FVIRTKEY (1) + +/* MENUITEMINFO structure */ +#define MIIM_CHECKMARKS (8) +#define MIIM_DATA (32) +#define MIIM_ID (2) +#define MIIM_STATE (1) +#define MIIM_SUBMENU (4) +#define MIIM_TYPE (16) +#define MFT_BITMAP (0x4L) +#define MFT_MENUBARBREAK (0x20L) +#define MFT_MENUBREAK (0x40L) +#define MFT_OWNERDRAW (0x100L) +#define MFT_RADIOCHECK (0x200L) +#define MFT_RIGHTJUSTIFY (0x4000L) +#define MFT_SEPARATOR (0x800L) +#define MFT_STRING (0L) +#define MFS_CHECKED (0x8L) +#define MFS_DEFAULT (0x1000L) +#define MFS_DISABLED (0x3L) +#define MFS_ENABLED (0L) +#define MFS_GRAYED (0x3L) +#define MFS_HILITE (0x80L) +#define MFS_UNCHECKED (0L) +#define MFS_UNHILITE (0L) + +/* SERIALKEYS structure */ +#define SERKF_AVAILABLE (2) +#define SERKF_INDICATOR (4) +#define SERKF_SERIALKEYSON (1) + +/* FILTERKEYS structure */ +#define FKF_AVAILABLE (2) +#define FKF_CLICKON (64) +#define FKF_FILTERKEYSON (1) +#define FKF_HOTKEYACTIVE (4) +#define FKF_HOTKEYSOUND (16) +#define FKF_CONFIRMHOTKEY (8) +#define FKF_INDICATOR (32) + +/* HELPINFO structure */ +#define HELPINFO_MENUITEM (2) +#define HELPINFO_WINDOW (1) + +/* WM_PRINT message */ +#define PRF_CHECKVISIBLE (0x1L) +#define PRF_CHILDREN (0x10L) +#define PRF_CLIENT (0x4L) +#define PRF_ERASEBKGND (0x8L) +#define PRF_NONCLIENT (0x2L) +#define PRF_OWNED (0x20L) + +/* MapWindowPoints */ +#define HWND_DESKTOP ((HWND)0) + +/* WM_SYSCOMMAND message */ +#define SC_CLOSE (61536) +#define SC_CONTEXTHELP (61824) +#define SC_DEFAULT (61792) +#define SC_HOTKEY (61776) +#define SC_HSCROLL (61568) +#define SC_KEYMENU (61696) +#define SC_MAXIMIZE (61488) +#define SC_ZOOM (61488) +#define SC_MINIMIZE (61472) +#define SC_ICON (61472) +#define SC_MONITORPOWER (61808) +#define SC_MOUSEMENU (61584) +#define SC_MOVE (61456) +#define SC_NEXTWINDOW (61504) +#define SC_PREVWINDOW (61520) +#define SC_RESTORE (61728) +#define SC_SCREENSAVE (61760) +#define SC_SIZE (61440) +#define SC_TASKLIST (61744) +#define SC_VSCROLL (61552) + +/* DM_GETDEFID message */ +#define DC_HASDEFID (21323) + +/* WM_GETDLGCODE message */ +#define DLGC_BUTTON (8192) +#define DLGC_DEFPUSHBUTTON (16) +#define DLGC_HASSETSEL (8) +#define DLGC_RADIOBUTTON (64) +#define DLGC_STATIC (256) +#define DLGC_UNDEFPUSHBUTTON (32) +#define DLGC_WANTALLKEYS (4) +#define DLGC_WANTARROWS (1) +#define DLGC_WANTCHARS (128) +#define DLGC_WANTMESSAGE (4) +#define DLGC_WANTTAB (2) + +/* EM_SETMARGINS message */ +#define EC_LEFTMARGIN (1) +#define EC_RIGHTMARGIN (2) +#define EC_USEFONTINFO (65535) + +/* LB_SETCOUNT message */ +#define LB_ERR (-1) +#define LB_ERRSPACE (-2) +#define LB_OKAY (0) + +/* CB_DIR message */ +#define CB_ERR (-1) +#define CB_ERRSPACE (-2) + +/* WM_IME_CONTROL message */ +#define IMC_GETCANDIDATEPOS (7) +#define IMC_GETCOMPOSITIONFONT (9) +#define IMC_GETCOMPOSITIONWINDOW (11) +#define IMC_GETSTATUSWINDOWPOS (15) +#define IMC_CLOSESTATUSWINDOW (33) +#define IMC_OPENSTATUSWINDOW (34) +#define IMC_SETCANDIDATEPOS (8) +#define IMC_SETCOMPOSITIONFONT (10) +#define IMC_SETCOMPOSITIONWINDOW (12) +#define IMC_SETSTATUSWINDOWPOS (16) + +/* WM_IME_CONTROL message */ +#define IMN_CHANGECANDIDATE (3) +#define IMN_CLOSECANDIDATE (4) +#define IMN_CLOSESTATUSWINDOW (1) +#define IMN_GUIDELINE (13) +#define IMN_OPENCANDIDATE (5) +#define IMN_OPENSTATUSWINDOW (2) +#define IMN_SETCANDIDATEPOS (9) +#define IMN_SETCOMPOSITIONFONT (10) +#define IMN_SETCOMPOSITIONWINDOW (11) +#define IMN_SETCONVERSIONMODE (6) +#define IMN_SETOPENSTATUS (8) +#define IMN_SETSENTENCEMODE (7) +#define IMN_SETSTATUSWINDOWPOS (12) +#define IMN_PRIVATE (14) + +/* STICKYKEYS structure */ +#define SKF_AUDIBLEFEEDBACK (64) +#define SKF_AVAILABLE (2) +#define SKF_CONFIRMHOTKEY (8) +#define SKF_HOTKEYACTIVE (4) +#define SKF_HOTKEYSOUND (16) +#define SKF_INDICATOR (32) +#define SKF_STICKYKEYSON (1) +#define SKF_TRISTATE (128) +#define SKF_TWOKEYSOFF (256) + +/* MOUSEKEYS structure */ +#define MKF_AVAILABLE (2) +#define MKF_CONFIRMHOTKEY (8) +#define MKF_HOTKEYACTIVE (4) +#define MKF_HOTKEYSOUND (16) +#define MKF_INDICATOR (32) +#define MKF_MOUSEKEYSON (1) +#define MKF_MODIFIERS (64) +#define MKF_REPLACENUMBERS (128) + +/* SOUNDSENTRY structure */ +#define SSF_AVAILABLE (2) +#define SSF_SOUNDSENTRYON (1) +#define SSTF_BORDER (2) +#define SSTF_CHARS (1) +#define SSTF_DISPLAY (3) +#define SSTF_NONE (0) +#define SSGF_DISPLAY (3) +#define SSGF_NONE (0) +#define SSWF_CUSTOM (4) +#define SSWF_DISPLAY (3) +#define SSWF_NONE (0) +#define SSWF_TITLE (1) +#define SSWF_WINDOW (2) + +/* ACCESSTIMEOUT structure */ +#define ATF_ONOFFFEEDBACK (2) +#define ATF_TIMEOUTON (1) + +/* HIGHCONTRAST structure */ +#define HCF_AVAILABLE (2) +#define HCF_CONFIRMHOTKEY (8) +#define HCF_HIGHCONTRASTON (1) +#define HCF_HOTKEYACTIVE (4) +#define HCF_HOTKEYAVAILABLE (64) +#define HCF_HOTKEYSOUND (16) +#define HCF_INDICATOR (32) + +/* TOGGLEKEYS structure */ +#define TKF_AVAILABLE (2) +#define TKF_CONFIRMHOTKEY (8) +#define TKF_HOTKEYACTIVE (4) +#define TKF_HOTKEYSOUND (16) +#define TKF_TOGGLEKEYSON (1) + +/* Installable Policy */ +#define PP_DISPLAYERRORS (1) + +/* SERVICE_INFO structure */ +#define RESOURCEDISPLAYTYPE_DOMAIN (1) +#define RESOURCEDISPLAYTYPE_FILE (4) +#define RESOURCEDISPLAYTYPE_GENERIC (0) +#define RESOURCEDISPLAYTYPE_GROUP (5) +#define RESOURCEDISPLAYTYPE_SERVER (2) +#define RESOURCEDISPLAYTYPE_SHARE (3) + +/* KEY_EVENT_RECORD structure */ +#define CAPSLOCK_ON (128) +#define ENHANCED_KEY (256) +#define LEFT_ALT_PRESSED (2) +#define LEFT_CTRL_PRESSED (8) +#define NUMLOCK_ON (32) +#define RIGHT_ALT_PRESSED (1) +#define RIGHT_CTRL_PRESSED (4) +#define SCROLLLOCK_ON (64) +#define SHIFT_PRESSED (16) + +/* MOUSE_EVENT_RECORD structure */ +#define FROM_LEFT_1ST_BUTTON_PRESSED (1) +#define RIGHTMOST_BUTTON_PRESSED (2) +#define FROM_LEFT_2ND_BUTTON_PRESSED (4) +#define FROM_LEFT_3RD_BUTTON_PRESSED (8) +#define FROM_LEFT_4TH_BUTTON_PRESSED (16) +#define DOUBLE_CLICK (2) +#define MOUSE_MOVED (1) + +/* INPUT_RECORD structure */ +#define KEY_EVENT (1) +#define MOUSE_EVENT (2) +#define WINDOW_BUFFER_SIZE_EVENT (4) +#define MENU_EVENT (8) +#define FOCUS_EVENT (16) + +/* BITMAPINFOHEADER structure */ +#define BI_RGB (0L) +#define BI_RLE8 (1L) +#define BI_RLE4 (2L) +#define BI_BITFIELDS (3L) + +/* Extensions to OpenGL */ + +/* ChoosePixelFormat */ +#define PFD_DRAW_TO_WINDOW (0x4) +#define PFD_DRAW_TO_BITMAP (0x8) +#define PFD_SUPPORT_GDI (0x10) +#define PFD_SUPPORT_OPENGL (0x20) +#define PFD_DOUBLEBUFFER (0x1) +#define PFD_STEREO (0x2) +#define PFD_DOUBLEBUFFER_DONTCARE (0x40000000) +#define PFD_STEREO_DONTCARE (0x80000000) +#define PFD_TYPE_RGBA (0) +#define PFD_TYPE_COLORINDEX (1) +#define PFD_MAIN_PLANE (0) +#define PFD_OVERLAY_PLANE (1) +#define PFD_UNDERLAY_PLANE (-1) + +/* wglUseFontOutlines */ +#define WGL_FONT_LINES (0) +#define WGL_FONT_POLYGONS (1) + +/* LAYERPLANEDESCRIPTOR structure */ + +/* PIXELFORMATDESCRIPTOR structure */ +#define PFD_GENERIC_FORMAT (0x40) +#define PFD_NEED_PALETTE (0x80) +#define PFD_NEED_SYSTEM_PALETTE (0x100) +#define PFD_SWAP_COPY (0x400) +#define PFD_SWAP_EXCHANGE (0x200) + +/* TEXTMETRIC structure */ +#define TMPF_FIXED_PITCH (0x1) +#define TMPF_VECTOR (0x2) +#define TMPF_TRUETYPE (0x4) +#define TMPF_DEVICE (0x8) + +/* --------------------- old stuff, need to organize! --------------- */ + +/* BEGINNING of windowsx.h stuff from old headers: */ +#define __CRACK_VOID_F(fn,args) (void)(fn args) +#define __CRACK_BOOL_F(fn,args) (BOOL)(fn args) +#define __CRACK_HMENU_F(fn,args) (HMENU)(fn args) +#define __CRACK_HWND_F(fn,args) (HWND)(fn args) +#define __CRACK_LONG_F(fn, args) (LRESULT)(fn args) +#define __CRACK_ZERO_F(fn, args) (fn args,0) +#define GetFirstChild(h) GetTopWindow(h) +#define GetNextSibling(h) GetWindow(h, GW_HWNDNEXT) +#define GetWindowID(h) GetDlgCtrlID(h) +#define SubclassWindow(h, p) (SetWindowLong(h, GWL_WNDPROC, p)) + +#define GET_WM_COMMAND_CMD(w, l) HIWORD(w) +#define GET_WM_COMMAND_ID(w, l) LOWORD(w) +#define GET_WM_CTLCOLOR_HDC(w, l, msg) (HDC)(w) +#define GET_WM_CTLCOLOR_HWND(w, l, msg) (HWND)(l) +#define GET_WM_HSCROLL_CODE(w, l) LOWORD(w) +#define GET_WM_HSCROLL_HWND(w, l) (HWND)(l) +#define GET_WM_HSCROLL_POS(w, l) HIWORD(w) +#define GET_WM_MDIACTIVATE_FACTIVATE(h, a, b) (b == (LONG)h) +#define GET_WM_MDIACTIVATE_HWNDACTIVATE(a, b) (HWND)(b) +#define GET_WM_MDIACTIVATE_HWNDDEACT(a, b) (HWND)(a) +#define GET_WM_VSCROLL_CODE(w, l) LOWORD(w) +#define GET_WM_VSCROLL_HWND(w, l) (HWND)(l) +#define GET_WM_VSCROLL_POS(w, l) HIWORD(w) + +#define FORWARD_WM_CLOSE(h, fn) __CRACK_VOID_F(fn,(h, WM_CLOSE, 0, 0)) +#define FORWARD_WM_COMMAND(h, id, c, n, fn) __CRACK_VOID_F(fn,(h, WM_COMMAND, MAKEWPARAM(id,n), (LPARAM)c)) +#define FORWARD_WM_CREATE(h, p, fn) __CRACK_BOOL_F(fn,(h, WM_CREATE, 0, (LPARAM)p)) +#define FORWARD_WM_DESTROY(h, fn) __CRACK_VOID_F(fn,(h, WM_DESTROY, 0, 0)) +#define FORWARD_WM_ENABLE(h, e, fn) __CRACK_VOID_F(fn,(h, WM_ENABLE, (WPARAM)e, 0)) +#define FORWARD_WM_INITDIALOG(h, c, l, fn) __CRACK_BOOL_F(fn,(h, WM_INITDIALOG, (WPARAM)c, l)) +#define FORWARD_WM_MDICASCADE(h, c, fn) __CRACK_BOOL_F(fn,(h, WM_MDICASCADE, (WPARAM)c, 0)) +#define FORWARD_WM_MDIDESTROY(h, d, fn) __CRACK_VOID_F(fn,(h, WM_MDIDESTROY, (WPARAM)d, 0)) +#define FORWARD_WM_MDIGETACTIVE(h, fn) __CRACK_HWND_F(fn,(h, WM_MDIGETACTIVE, 0, 0)) +#define FORWARD_WM_MDIICONARRANGE(h, fn) __CRACK_VOID_F(fn,(h, WM_MDIICONARRANGE, 0, 0)) +#define FORWARD_WM_MDISETMENU(h, fr, hf, hw, fn) __CRACK_HMENU_F(fn,(h, WM_MDISETMENU, (WPARAM)((fr) ? (hf) : 0), (LPARAM)(hw))) +#define FORWARD_WM_MDITILE(h, c, fn) __CRACK_BOOL_F(fn,(h, WM_MDITILE, (WPARAM)(c), 0)) +#define FORWARD_WM_PAINT(h, fn) __CRACK_VOID_F(fn,(h, WM_PAINT, 0, 0)) +#define FORWARD_WM_QUERYENDSESSION(h, fn) __CRACK_BOOL_F(fn,(h, WM_QUERYENDSESSION, 0, 0)) +#define FORWARD_WM_SIZE(h, state, cx, cy, fn) __CRACK_VOID_F(fn,(h, WM_SIZE, (WPARAM)state, MAKELPARAM(cx, cy))) +#define FORWARD_WM_SYSCOMMAND(h, c, x, y, fn) __CRACK_VOID_F(fn,(h, WM_SYSCOMMAND, (WPARAM)c, MAKELPARAM(x, y))) + +#define HANDLE_WM_CLOSE(h, w, l, fn) __CRACK_ZERO_F(fn,(h)); +#define HANDLE_WM_COMMAND(h, w, l, fn) __CRACK_ZERO_F(fn,(h, SEXT_LOWORD(w), (HWND)l, HIWORD(w))) +#define HANDLE_WM_CREATE(h, w, l, fn) (LRESULT)((fn(h, (CREATESTRUCT *)l)) ? 0 : -1) +#define HANDLE_WM_DESTROY(h, w, l, fn) __CRACK_ZERO_F(fn,(h)) +#define HANDLE_WM_ENABLE(h, w, l, fn) __CRACK_ZERO_F(fn,(h, (BOOL)w)) +#define HANDLE_WM_INITDIALOG(h, w, l, fn) __CRACK_LONG_F(fn,(h, (HWND)w, l)) +#define HANDLE_WM_MDICASCADE(h, w, l, fn) __CRACK_LONG_F(fn, (h, (UINT)w) +#define HANDLE_WM_MDIDESTROY(h, w, l, fn) __CRACK_ZERO_F(fn,(h, (HWND)w)) +#define HANDLE_WM_MDIGETACTIVE(h, w, l, fn) __CRACK_LONG_F(fn,(h)) +#define HANDLE_WM_MDIICONARRANGE(h, w, l, fn) __CRACK_ZERO_F(fn,(h)) +#define HANDLE_WM_MDISETMENU(h, w, l, fn) __CRACK_LONG_F(fn,(h, (BOOL)w, (HMENU)w, (HMENU)l) +#define HANDLE_WM_MDITILE(h, w, l, fn) __CRACK_LONG_F(fn,(h, (UINT)w)) +#define HANDLE_WM_PAINT(h, w, l, fn) __CRACK_ZERO_F(fn,(h)) +#define HANDLE_WM_QUERYENDSESSION(h, w, l, fn) MAKELRESULT(fn(h), 0) +#define HANDLE_WM_SIZE(h, w, l, fn) __CRACK_ZERO_F(fn,(h, (UINT)w, SEXT_LOWORD(l), SEXT_HIWORD(l))) +#define HANDLE_WM_SYSCOMMAND(h, w, l, fn) __CRACK_ZERO_F(fn,(h, (UINT)w, SEXT_LOWORD(l), SEXT_HIWORD(l))) + +/* Totally disgusting! get wParam and lParam from the environment ! */ +#define HANDLE_MSG(h, message, fn) case message: return HANDLE_##message(h, wParam, lParam, fn) + +/* END OF windowsx.h stuff from old headers */ +/* ------------------------------------------------------------------ */ +/* BEGINNING of shellapi.h stuff from old headers */ + +#define SE_ERR_SHARE 26 +#define SE_ERR_ASSOCINCOMPLETE 27 +#define SE_ERR_DDETIMEOUT 28 +#define SE_ERR_DDEFAIL 29 +#define SE_ERR_DDEBUSY 30 +#define SE_ERR_NOASSOC 31 + +/* END OF shellapi.h stuff from old headers */ +/* ------------------------------------------------------------------ */ +/* From ddeml.h in old Cygnus headers */ + +#define XCLASS_BOOL 0x1000 +#define XCLASS_DATA 0x2000 +#define XCLASS_FLAGS 0x4000 +#define XCLASS_MASK 0xfc00 +#define XCLASS_NOTIFICATION 0x8000 +#define XTYPF_NOBLOCK 0x0002 +#define XTYP_ADVDATA 0x4010 +#define XTYP_ADVREQ 0x2022 +#define XTYP_ADVSTART 0x1030 +#define XTYP_ADVSTOP 0x8040 +#define XTYP_CONNECT 0x1062 +#define XTYP_CONNECT_CONFIRM 0x8072 +#define XTYP_DISCONNECT 0x80c2 +#define XTYP_EXECUTE 0x4050 +#define XTYP_POKE 0x4090 +#define XTYP_REQUEST 0x20b0 +#define XTYP_WILDCONNECT 0x20E2 +#define XTYP_REGISTER 0x80A2 +#define XTYP_ERROR 0x8002 +#define XTYP_XACT_COMPLETE 0x8080 +#define XTYP_UNREGISTER 0x80D2 + +#define DMLERR_DLL_USAGE 0x4004 +#define DMLERR_INVALIDPARAMETER 0x4006 +#define DMLERR_NOTPROCESSED 0x4009 +#define DMLERR_POSTMSG_FAILED 0x400c +#define DMLERR_SERVER_DIED 0x400e +#define DMLERR_SYS_ERROR 0x400f +#define DMLERR_BUSY 0x4001 +#define DMLERR_DATAACKTIMEOUT 0x4002 +#define DMLERR_ADVACKTIMEOUT 0x4000 +#define DMLERR_DLL_NOT_INITIALIZED 0x4003 +#define DMLERR_LOW_MEMORY 0x4007 +#define DMLERR_MEMORY_ERROR 0x4008 +#define DMLERR_POKEACKTIMEOUT 0x400b +#define DMLERR_NO_CONV_ESTABLISHED 0x400a +#define DMLERR_REENTRANCY 0x400d +#define DMLERR_UNFOUND_QUEUE_ID 0x4011 +#define DMLERR_UNADVACKTIMEOUT 0x4010 +#define DMLERR_EXECACKTIMEOUT 0x4005 +#define DDE_FACK 0x8000 +#define DDE_FNOTPROCESSED 0x0000 + +#define DNS_REGISTER 0x0001 +#define DNS_UNREGISTER 0x0002 +#define CP_WINANSI 1004 +#define CP_WINUNICODE 1200 +#define EXPENTRY CALLBACK +#define APPCLASS_STANDARD 0x00000000 + +/* End of stuff from ddeml.h in old Cygnus headers */ +/* ----------------------------------------------- */ + +#define BKMODE_LAST (2) + +#define CTLCOLOR_MSGBOX (0) +#define CTLCOLOR_EDIT (1) +#define CTLCOLOR_LISTBOX (2) +#define CTLCOLOR_BTN (3) +#define CTLCOLOR_DLG (4) +#define CTLCOLOR_SCROLLBAR (5) +#define CTLCOLOR_STATIC (6) +#define CTLCOLOR_MAX (7) + +#define META_SETMAPMODE (0x0103L) +#define META_SETWINDOWORG (0x020BL) +#define META_SETWINDOWEXT (0x020CL) + +#define POLYFILL_LAST (2) + +#define STATUS_WAIT_0 (0x00000000L) +#define STATUS_ABANDONED_WAIT_0 (0x00000080L) +#define STATUS_USER_APC (0x000000C0L) +#define STATUS_TIMEOUT (0x00000102L) +#define STATUS_PENDING (0x00000103L) +#define STATUS_GUARD_PAGE_VIOLATION (0x80000001L) +#define STATUS_DATATYPE_MISALIGNMENT (0x80000002L) +#define STATUS_BREAKPOINT (0x80000003L) +#define STATUS_SINGLE_STEP (0x80000004L) +#define STATUS_IN_PAGE_ERROR (0xC0000006L) +#define STATUS_INVALID_HANDLE (0xC0000008L) +#define STATUS_ILLEGAL_INSTRUCTION (0xC000001DL) +#define STATUS_NONCONTINUABLE_EXCEPTION (0xC0000025L) +#define STATUS_INVALID_DISPOSITION (0xC0000026L) +#define STATUS_ARRAY_BOUNDS_EXCEEDED (0xC000008CL) +#define STATUS_FLOAT_DENORMAL_OPERAND (0xC000008DL) +#define STATUS_FLOAT_DIVIDE_BY_ZERO (0xC000008EL) +#define STATUS_FLOAT_INEXACT_RESULT (0xC000008FL) +#define STATUS_FLOAT_INVALID_OPERATION (0xC0000090L) +#define STATUS_FLOAT_OVERFLOW (0xC0000091L) +#define STATUS_FLOAT_STACK_CHECK (0xC0000092L) +#define STATUS_FLOAT_UNDERFLOW (0xC0000093L) +#define STATUS_INTEGER_DIVIDE_BY_ZERO (0xC0000094L) +#define STATUS_INTEGER_OVERFLOW (0xC0000095L) +#define STATUS_PRIVILEGED_INSTRUCTION (0xC0000096L) +#define STATUS_STACK_OVERFLOW (0xC00000FDL) +#define STATUS_CONTROL_C_EXIT (0xC000013AL) + +#define EXCEPTION_CTRL_C + +#define PROCESSOR_ARCHITECTURE_INTEL 0 +#define PROCESSOR_ARCHITECTURE_MIPS 1 +#define PROCESSOR_ARCHITECTURE_ALPHA 2 +#define PROCESSOR_ARCHITECTURE_PPC 3 + +#define FreeModule(h) FreeLibrary(h) +#define MakeProcInstance(p,i) (p) +#define FreeProcInstance(p) (p) + +#define _fmemcpy memcpy + +/* Used by wxwindows. */ +#define SIZEFULLSCREEN SIZE_MAXIMIZED +#define SIZENORMAL SIZE_RESTORED +#define SIZEICONIC SIZE_MINIMIZED +#define NPLOGPALETTE PLOGPALETTE + +/* In the old winnt.h */ +#if 0 +#ifdef __ANAL__ +#define DECLARE_HANDLE(h) struct h##__ { int dummy; }; typedef struct h##__ *h +#else +#define DECLARE_HANDLE(h) typedef void *h +#endif +DECLARE_HANDLE(HANDLE); +#endif + +#ifdef __PPC__ +#define CONTEXT_CONTROL 1L +#define CONTEXT_FLOATING_POINT 2L +#define CONTEXT_INTEGER 4L +#define CONTEXT_DEBUG_REGISTERS 8L + +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) +#define CONTEXT_DEBUGGER (CONTEXT_FULL) + +#else /* x86 */ +/* The doc refered me to winnt.h, so I had to look... */ +#define SIZE_OF_80387_REGISTERS 80 + +/* Values for contextflags */ +#define CONTEXT_i386 0x10000 +#define CONTEXT_CONTROL (CONTEXT_i386 | 1) +#define CONTEXT_INTEGER (CONTEXT_i386 | 2) +#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4) +#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8) +#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10) +#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) + +/* our own invention */ +#define FLAG_TRACE_BIT 0x100 +#define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT) + +#endif + +#define ASCIICHAR AsciiChar +#define FAR +#define PACKED __attribute__((packed)) + +#define FILTER_TEMP_DUPLICATE_ACCOUNT (0x0001) +#define FILTER_NORMAL_ACCOUNT (0x0002) +#define FILTER_INTERDOMAIN_TRUST_ACCOUNT (0x0008) +#define FILTER_WORKSTATION_TRUST_ACCOUNT (0x0010) +#define FILTER_SERVER_TRUST_ACCOUNT (0x0020) + +#define LOGON32_LOGON_INTERACTIVE (0x02) +#define LOGON32_LOGON_BATCH (0x04) +#define LOGON32_LOGON_SERVICE (0x05) +#define LOGON32_PROVIDER_DEFAULT (0x00) +#define LOGON32_PROVIDER_WINNT35 (0x01) + +#define QID_SYNC 0xFFFFFFFF + +/* Magic numbers in PE executable header. */ + +#define IMAGE_DOS_SIGNATURE (0x5a4d) /* e_magic field */ +#define IMAGE_NT_SIGNATURE (0x4550) /* nt_signature field */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_DEFINES */ diff --git a/reactos/include/errors.h b/reactos/include/errors.h new file mode 100644 index 00000000000..9fd199d6dbc --- /dev/null +++ b/reactos/include/errors.h @@ -0,0 +1,713 @@ +/* + Errors.h + + Windows32 API error codes + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + + 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 for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _GNU_H_WINDOWS32_ERROR +#define _GNU_H_WINDOWS32_ERROR + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Numerical order */ + +#define LZERROR_UNKNOWNALG (-8) +#define LZERROR_BADVALUE (-7) +#define LZERROR_GLOBLOCK (-6) +#define LZERROR_GLOBALLOC (-5) +#define LZERROR_WRITE (-4) +#define LZERROR_READ (-3) +#define LZERROR_BADOUTHANDLE (-2) +#define LZERROR_BADINHANDLE (-1) +#define NO_ERROR 0L +#define ERROR_SUCCESS 0L +#define ERROR_INVALID_FUNCTION 1L +#define ERROR_FILE_NOT_FOUND 2L +#define ERROR_PATH_NOT_FOUND 3L +#define ERROR_TOO_MANY_OPEN_FILES 4L +#define ERROR_ACCESS_DENIED 5L +#define ERROR_INVALID_HANDLE 6L +#define ERROR_ARENA_TRASHED 7L +#define ERROR_NOT_ENOUGH_MEMORY 8L +#define ERROR_INVALID_BLOCK 9L +#define ERROR_BAD_ENVIRONMENT 10L +#define ERROR_BAD_FORMAT 11L +#define ERROR_INVALID_ACCESS 12L +#define ERROR_INVALID_DATA 13L +#define ERROR_OUTOFMEMORY 14L +#define ERROR_INVALID_DRIVE 15L +#define ERROR_CURRENT_DIRECTORY 16L +#define ERROR_NOT_SAME_DEVICE 17L +#define ERROR_NO_MORE_FILES 18L +#define ERROR_WRITE_PROTECT 19L +#define ERROR_BAD_UNIT 20L +#define ERROR_NOT_READY 21L +#define ERROR_BAD_COMMAND 22L +#define ERROR_CRC 23L +#define ERROR_BAD_LENGTH 24L +#define ERROR_SEEK 25L +#define ERROR_NOT_DOS_DISK 26L +#define ERROR_SECTOR_NOT_FOUND 27L +#define ERROR_OUT_OF_PAPER 28L +#define ERROR_WRITE_FAULT 29L +#define ERROR_READ_FAULT 30L +#define ERROR_GEN_FAILURE 31L +#define ERROR_SHARING_VIOLATION 32L +#define ERROR_LOCK_VIOLATION 33L +#define ERROR_WRONG_DISK 34L +#define ERROR_SHARING_BUFFER_EXCEEDED 36L +#define ERROR_HANDLE_EOF 38L +#define ERROR_HANDLE_DISK_FULL 39L +#define ERROR_NOT_SUPPORTED 50L +#define ERROR_REM_NOT_LIST 51L +#define ERROR_DUP_NAME 52L +#define ERROR_BAD_NETPATH 53L +#define ERROR_NETWORK_BUSY 54L +#define ERROR_DEV_NOT_EXIST 55L +#define ERROR_TOO_MANY_CMDS 56L +#define ERROR_ADAP_HDW_ERR 57L +#define ERROR_BAD_NET_RESP 58L +#define ERROR_UNEXP_NET_ERR 59L +#define ERROR_BAD_REM_ADAP 60L +#define ERROR_PRINTQ_FULL 61L +#define ERROR_NO_SPOOL_SPACE 62L +#define ERROR_PRINT_CANCELLED 63L +#define ERROR_NETNAME_DELETED 64L +#define ERROR_NETWORK_ACCESS_DENIED 65L +#define ERROR_BAD_DEV_TYPE 66L +#define ERROR_BAD_NET_NAME 67L +#define ERROR_TOO_MANY_NAMES 68L +#define ERROR_TOO_MANY_SESS 69L +#define ERROR_SHARING_PAUSED 70L +#define ERROR_REQ_NOT_ACCEP 71L +#define ERROR_REDIR_PAUSED 72L +#define ERROR_FILE_EXISTS 80L +#define ERROR_CANNOT_MAKE 82L +#define ERROR_FAIL_I24 83L +#define ERROR_OUT_OF_STRUCTURES 84L +#define ERROR_ALREADY_ASSIGNED 85L +#define ERROR_INVALID_PASSWORD 86L +#define ERROR_INVALID_PARAMETER 87L +#define ERROR_NET_WRITE_FAULT 88L +#define ERROR_NO_PROC_SLOTS 89L +#define ERROR_TOO_MANY_SEMAPHORES 100L +#define ERROR_EXCL_SEM_ALREADY_OWNED 101L +#define ERROR_SEM_IS_SET 102L +#define ERROR_TOO_MANY_SEM_REQUESTS 103L +#define ERROR_INVALID_AT_INTERRUPT_TIME 104L +#define ERROR_SEM_OWNER_DIED 105L +#define ERROR_SEM_USER_LIMIT 106L +#define ERROR_DISK_CHANGE 107L +#define ERROR_DRIVE_LOCKED 108L +#define ERROR_BROKEN_PIPE 109L +#define ERROR_OPEN_FAILED 110L +#define ERROR_BUFFER_OVERFLOW 111L +#define ERROR_DISK_FULL 112L +#define ERROR_NO_MORE_SEARCH_HANDLES 113L +#define ERROR_INVALID_TARGET_HANDLE 114L +#define ERROR_INVALID_CATEGORY 117L +#define ERROR_INVALID_VERIFY_SWITCH 118L +#define ERROR_BAD_DRIVER_LEVEL 119L +#define ERROR_CALL_NOT_IMPLEMENTED 120L +#define ERROR_SEM_TIMEOUT 121L +#define ERROR_INSUFFICIENT_BUFFER 122L +#define ERROR_INVALID_NAME 123L +#define ERROR_INVALID_LEVEL 124L +#define ERROR_NO_VOLUME_LABEL 125L +#define ERROR_MOD_NOT_FOUND 126L +#define ERROR_PROC_NOT_FOUND 127L +#define ERROR_WAIT_NO_CHILDREN 128L +#define ERROR_CHILD_NOT_COMPLETE 129L +#define ERROR_DIRECT_ACCESS_HANDLE 130L +#define ERROR_NEGATIVE_SEEK 131L +#define ERROR_SEEK_ON_DEVICE 132L +#define ERROR_IS_JOIN_TARGET 133L +#define ERROR_IS_JOINED 134L +#define ERROR_IS_SUBSTED 135L +#define ERROR_NOT_JOINED 136L +#define ERROR_NOT_SUBSTED 137L +#define ERROR_JOIN_TO_JOIN 138L +#define ERROR_SUBST_TO_SUBST 139L +#define ERROR_JOIN_TO_SUBST 140L +#define ERROR_SUBST_TO_JOIN 141L +#define ERROR_BUSY_DRIVE 142L +#define ERROR_SAME_DRIVE 143L +#define ERROR_DIR_NOT_ROOT 144L +#define ERROR_DIR_NOT_EMPTY 145L +#define ERROR_IS_SUBST_PATH 146L +#define ERROR_IS_JOIN_PATH 147L +#define ERROR_PATH_BUSY 148L +#define ERROR_IS_SUBST_TARGET 149L +#define ERROR_SYSTEM_TRACE 150L +#define ERROR_INVALID_EVENT_COUNT 151L +#define ERROR_TOO_MANY_MUXWAITERS 152L +#define ERROR_INVALID_LIST_FORMAT 153L +#define ERROR_LABEL_TOO_LONG 154L +#define ERROR_TOO_MANY_TCBS 155L +#define ERROR_SIGNAL_REFUSED 156L +#define ERROR_DISCARDED 157L +#define ERROR_NOT_LOCKED 158L +#define ERROR_BAD_THREADID_ADDR 159L +#define ERROR_BAD_ARGUMENTS 160L +#define ERROR_BAD_PATHNAME 161L +#define ERROR_SIGNAL_PENDING 162L +#define ERROR_MAX_THRDS_REACHED 164L +#define ERROR_LOCK_FAILED 167L +#define ERROR_BUSY 170L +#define ERROR_CANCEL_VIOLATION 173L +#define ERROR_ATOMIC_LOCKS_NOT_SUPPORTED 174L +#define ERROR_INVALID_SEGMENT_NUMBER 180L +#define ERROR_INVALID_ORDINAL 182L +#define ERROR_ALREADY_EXISTS 183L +#define ERROR_INVALID_FLAG_NUMBER 186L +#define ERROR_SEM_NOT_FOUND 187L +#define ERROR_INVALID_STARTING_CODESEG 188L +#define ERROR_INVALID_STACKSEG 189L +#define ERROR_INVALID_MODULETYPE 190L +#define ERROR_INVALID_EXE_SIGNATURE 191L +#define ERROR_EXE_MARKED_INVALID 192L +#define ERROR_BAD_EXE_FORMAT 193L +#define ERROR_ITERATED_DATA_EXCEEDS_64k 194L +#define ERROR_INVALID_MINALLOCSIZE 195L +#define ERROR_DYNLINK_FROM_INVALID_RING 196L +#define ERROR_IOPL_NOT_ENABLED 197L +#define ERROR_INVALID_SEGDPL 198L +#define ERROR_AUTODATASEG_EXCEEDS_64k 199L +#define ERROR_RING2SEG_MUST_BE_MOVABLE 200L +#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201L +#define ERROR_INFLOOP_IN_RELOC_CHAIN 202L +#define ERROR_ENVVAR_NOT_FOUND 203L +#define ERROR_NO_SIGNAL_SENT 205L +#define ERROR_FILENAME_EXCED_RANGE 206L +#define ERROR_RING2_STACK_IN_USE 207L +#define ERROR_META_EXPANSION_TOO_LONG 208L +#define ERROR_INVALID_SIGNAL_NUMBER 209L +#define ERROR_THREAD_1_INACTIVE 210L +#define ERROR_LOCKED 212L +#define ERROR_TOO_MANY_MODULES 214L +#define ERROR_NESTING_NOT_ALLOWED 215L +#define ERROR_BAD_PIPE 230L +#define ERROR_PIPE_BUSY 231L +#define ERROR_NO_DATA 232L +#define ERROR_PIPE_NOT_CONNECTED 233L +#define ERROR_MORE_DATA 234L +#define ERROR_VC_DISCONNECTED 240L +#define ERROR_INVALID_EA_NAME 254L +#define ERROR_EA_LIST_INCONSISTENT 255L +#define ERROR_NO_MORE_ITEMS 259L +#define ERROR_CANNOT_COPY 266L +#define ERROR_DIRECTORY 267L +#define ERROR_EAS_DIDNT_FIT 275L +#define ERROR_EA_FILE_CORRUPT 276L +#define ERROR_EA_TABLE_FULL 277L +#define ERROR_INVALID_EA_HANDLE 278L +#define ERROR_EAS_NOT_SUPPORTED 282L +#define ERROR_NOT_OWNER 288L +#define ERROR_TOO_MANY_POSTS 298L +#define ERROR_PARTIAL_COPY 299L +#define ERROR_MR_MID_NOT_FOUND 317L +#define ERROR_INVALID_ADDRESS 487L +#define ERROR_ARITHMETIC_OVERFLOW 534L +#define ERROR_PIPE_CONNECTED 535L +#define ERROR_PIPE_LISTENING 536L +#define ERROR_EA_ACCESS_DENIED 994L +#define ERROR_OPERATION_ABORTED 995L +#define ERROR_IO_INCOMPLETE 996L +#define ERROR_IO_PENDING 997L +#define ERROR_NOACCESS 998L +#define ERROR_SWAPERROR 999L +#define ERROR_STACK_OVERFLOW 1001L +#define ERROR_INVALID_MESSAGE 1002L +#define ERROR_CAN_NOT_COMPLETE 1003L +#define ERROR_INVALID_FLAGS 1004L +#define ERROR_UNRECOGNIZED_VOLUME 1005L +#define ERROR_FILE_INVALID 1006L +#define ERROR_FULLSCREEN_MODE 1007L +#define ERROR_NO_TOKEN 1008L +#define ERROR_BADDB 1009L +#define ERROR_BADKEY 1010L +#define ERROR_CANTOPEN 1011L +#define ERROR_CANTREAD 1012L +#define ERROR_CANTWRITE 1013L +#define ERROR_REGISTRY_RECOVERED 1014L +#define ERROR_REGISTRY_CORRUPT 1015L +#define ERROR_REGISTRY_IO_FAILED 1016L +#define ERROR_NOT_REGISTRY_FILE 1017L +#define ERROR_KEY_DELETED 1018L +#define ERROR_NO_LOG_SPACE 1019L +#define ERROR_KEY_HAS_CHILDREN 1020L +#define ERROR_CHILD_MUST_BE_VOLATILE 1021L +#define ERROR_NOTIFY_ENUM_DIR 1022L +#define ERROR_DEPENDENT_SERVICES_RUNNING 1051L +#define ERROR_INVALID_SERVICE_CONTROL 1052L +#define ERROR_SERVICE_REQUEST_TIMEOUT 1053L +#define ERROR_SERVICE_NO_THREAD 1054L +#define ERROR_SERVICE_DATABASE_LOCKED 1055L +#define ERROR_SERVICE_ALREADY_RUNNING 1056L +#define ERROR_INVALID_SERVICE_ACCOUNT 1057L +#define ERROR_SERVICE_DISABLED 1058L +#define ERROR_CIRCULAR_DEPENDENCY 1059L +#define ERROR_SERVICE_DOES_NOT_EXIST 1060L +#define ERROR_SERVICE_CANNOT_ACCEPT_CTRL 1061L +#define ERROR_SERVICE_NOT_ACTIVE 1062L +#define ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 1063L +#define ERROR_EXCEPTION_IN_SERVICE 1064L +#define ERROR_DATABASE_DOES_NOT_EXIST 1065L +#define ERROR_SERVICE_SPECIFIC_ERROR 1066L +#define ERROR_PROCESS_ABORTED 1067L +#define ERROR_SERVICE_DEPENDENCY_FAIL 1068L +#define ERROR_SERVICE_LOGON_FAILED 1069L +#define ERROR_SERVICE_START_HANG 1070L +#define ERROR_INVALID_SERVICE_LOCK 1071L +#define ERROR_SERVICE_MARKED_FOR_DELETE 1072L +#define ERROR_SERVICE_EXISTS 1073L +#define ERROR_ALREADY_RUNNING_LKG 1074L +#define ERROR_SERVICE_DEPENDENCY_DELETED 1075L +#define ERROR_BOOT_ALREADY_ACCEPTED 1076L +#define ERROR_SERVICE_NEVER_STARTED 1077L +#define ERROR_DUPLICATE_SERVICE_NAME 1078L +#define ERROR_END_OF_MEDIA 1100L +#define ERROR_FILEMARK_DETECTED 1101L +#define ERROR_BEGINNING_OF_MEDIA 1102L +#define ERROR_SETMARK_DETECTED 1103L +#define ERROR_NO_DATA_DETECTED 1104L +#define ERROR_PARTITION_FAILURE 1105L +#define ERROR_INVALID_BLOCK_LENGTH 1106L +#define ERROR_DEVICE_NOT_PARTITIONED 1107L +#define ERROR_UNABLE_TO_LOCK_MEDIA 1108L +#define ERROR_UNABLE_TO_UNLOAD_MEDIA 1109L +#define ERROR_MEDIA_CHANGED 1110L +#define ERROR_BUS_RESET 1111L +#define ERROR_NO_MEDIA_IN_DRIVE 1112L +#define ERROR_NO_UNICODE_TRANSLATION 1113L +#define ERROR_DLL_INIT_FAILED 1114L +#define ERROR_SHUTDOWN_IN_PROGRESS 1115L +#define ERROR_NO_SHUTDOWN_IN_PROGRESS 1116L +#define ERROR_IO_DEVICE 1117L +#define ERROR_SERIAL_NO_DEVICE 1118L +#define ERROR_IRQ_BUSY 1119L +#define ERROR_MORE_WRITES 1120L +#define ERROR_COUNTER_TIMEOUT 1121L +#define ERROR_FLOPPY_ID_MARK_NOT_FOUND 1122L +#define ERROR_FLOPPY_WRONG_CYLINDER 1123L +#define ERROR_FLOPPY_UNKNOWN_ERROR 1124L +#define ERROR_FLOPPY_BAD_REGISTERS 1125L +#define ERROR_DISK_RECALIBRATE_FAILED 1126L +#define ERROR_DISK_OPERATION_FAILED 1127L +#define ERROR_DISK_RESET_FAILED 1128L +#define ERROR_EOM_OVERFLOW 1129L +#define ERROR_NOT_ENOUGH_SERVER_MEMORY 1130L +#define ERROR_POSSIBLE_DEADLOCK 1131L +#define ERROR_MAPPED_ALIGNMENT 1132L +#define ERROR_SET_POWER_STATE_VETOED 1140L +#define ERROR_SET_POWER_STATE_FAILED 1141L +#define ERROR_OLD_WIN_VERSION 1150L +#define ERROR_APP_WRONG_OS 1151L +#define ERROR_SINGLE_INSTANCE_APP 1152L +#define ERROR_RMODE_APP 1153L +#define ERROR_INVALID_DLL 1154L +#define ERROR_NO_ASSOCIATION 1155L +#define ERROR_DDE_FAIL 1156L +#define ERROR_DLL_NOT_FOUND 1157L +#define ERROR_BAD_USERNAME 2202L +#define ERROR_NOT_CONNECTED 2250L +#define ERROR_OPEN_FILES 2401L +#define ERROR_ACTIVE_CONNECTIONS 2402L +#define ERROR_DEVICE_IN_USE 2404L +#define ERROR_BAD_DEVICE 1200L +#define ERROR_CONNECTION_UNAVAIL 1201L +#define ERROR_DEVICE_ALREADY_REMEMBERED 1202L +#define ERROR_NO_NET_OR_BAD_PATH 1203L +#define ERROR_BAD_PROVIDER 1204L +#define ERROR_CANNOT_OPEN_PROFILE 1205L +#define ERROR_BAD_PROFILE 1206L +#define ERROR_NOT_CONTAINER 1207L +#define ERROR_EXTENDED_ERROR 1208L +#define ERROR_INVALID_GROUPNAME 1209L +#define ERROR_INVALID_COMPUTERNAME 1210L +#define ERROR_INVALID_EVENTNAME 1211L +#define ERROR_INVALID_DOMAINNAME 1212L +#define ERROR_INVALID_SERVICENAME 1213L +#define ERROR_INVALID_NETNAME 1214L +#define ERROR_INVALID_SHARENAME 1215L +#define ERROR_INVALID_PASSWORDNAME 1216L +#define ERROR_INVALID_MESSAGENAME 1217L +#define ERROR_INVALID_MESSAGEDEST 1218L +#define ERROR_SESSION_CREDENTIAL_CONFLICT 1219L +#define ERROR_REMOTE_SESSION_LIMIT_EXCEEDED 1220L +#define ERROR_DUP_DOMAINNAME 1221L +#define ERROR_NO_NETWORK 1222L +#define ERROR_CANCELLED 1223L +#define ERROR_USER_MAPPED_FILE 1224L +#define ERROR_CONNECTION_REFUSED 1225L +#define ERROR_GRACEFUL_DISCONNECT 1226L +#define ERROR_ADDRESS_ALREADY_ASSOCIATED 1227L +#define ERROR_ADDRESS_NOT_ASSOCIATED 1228L +#define ERROR_CONNECTION_INVALID 1229L +#define ERROR_CONNECTION_ACTIVE 1230L +#define ERROR_NETWORK_UNREACHABLE 1231L +#define ERROR_HOST_UNREACHABLE 1232L +#define ERROR_PROTOCOL_UNREACHABLE 1233L +#define ERROR_PORT_UNREACHABLE 1234L +#define ERROR_REQUEST_ABORTED 1235L +#define ERROR_CONNECTION_ABORTED 1236L +#define ERROR_RETRY 1237L +#define ERROR_CONNECTION_COUNT_LIMIT 1238L +#define ERROR_LOGIN_TIME_RESTRICTION 1239L +#define ERROR_LOGIN_WKSTA_RESTRICTION 1240L +#define ERROR_INCORRECT_ADDRESS 1241L +#define ERROR_ALREADY_REGISTERED 1242L +#define ERROR_SERVICE_NOT_FOUND 1243L +#define ERROR_NOT_AUTHENTICATED 1244L +#define ERROR_NOT_LOGGED_ON 1245L +#define ERROR_CONTINUE 1246L +#define ERROR_ALREADY_INITIALIZED 1247L +#define ERROR_NO_MORE_DEVICES 1248L +#define ERROR_NOT_ALL_ASSIGNED 1300L +#define ERROR_SOME_NOT_MAPPED 1301L +#define ERROR_NO_QUOTAS_FOR_ACCOUNT 1302L +#define ERROR_LOCAL_USER_SESSION_KEY 1303L +#define ERROR_NULL_LM_PASSWORD 1304L +#define ERROR_UNKNOWN_REVISION 1305L +#define ERROR_REVISION_MISMATCH 1306L +#define ERROR_INVALID_OWNER 1307L +#define ERROR_INVALID_PRIMARY_GROUP 1308L +#define ERROR_NO_IMPERSONATION_TOKEN 1309L +#define ERROR_CANT_DISABLE_MANDATORY 1310L +#define ERROR_NO_LOGON_SERVERS 1311L +#define ERROR_NO_SUCH_LOGON_SESSION 1312L +#define ERROR_NO_SUCH_PRIVILEGE 1313L +#define ERROR_PRIVILEGE_NOT_HELD 1314L +#define ERROR_INVALID_ACCOUNT_NAME 1315L +#define ERROR_USER_EXISTS 1316L +#define ERROR_NO_SUCH_USER 1317L +#define ERROR_GROUP_EXISTS 1318L +#define ERROR_NO_SUCH_GROUP 1319L +#define ERROR_MEMBER_IN_GROUP 1320L +#define ERROR_MEMBER_NOT_IN_GROUP 1321L +#define ERROR_LAST_ADMIN 1322L +#define ERROR_WRONG_PASSWORD 1323L +#define ERROR_ILL_FORMED_PASSWORD 1324L +#define ERROR_PASSWORD_RESTRICTION 1325L +#define ERROR_LOGON_FAILURE 1326L +#define ERROR_ACCOUNT_RESTRICTION 1327L +#define ERROR_INVALID_LOGON_HOURS 1328L +#define ERROR_INVALID_WORKSTATION 1329L +#define ERROR_PASSWORD_EXPIRED 1330L +#define ERROR_ACCOUNT_DISABLED 1331L +#define ERROR_NONE_MAPPED 1332L +#define ERROR_TOO_MANY_LUIDS_REQUESTED 1333L +#define ERROR_LUIDS_EXHAUSTED 1334L +#define ERROR_INVALID_SUB_AUTHORITY 1335L +#define ERROR_INVALID_ACL 1336L +#define ERROR_INVALID_SID 1337L +#define ERROR_INVALID_SECURITY_DESCR 1338L +#define ERROR_BAD_INHERITANCE_ACL 1340L +#define ERROR_SERVER_DISABLED 1341L +#define ERROR_SERVER_NOT_DISABLED 1342L +#define ERROR_INVALID_ID_AUTHORITY 1343L +#define ERROR_ALLOTTED_SPACE_EXCEEDED 1344L +#define ERROR_INVALID_GROUP_ATTRIBUTES 1345L +#define ERROR_BAD_IMPERSONATION_LEVEL 1346L +#define ERROR_CANT_OPEN_ANONYMOUS 1347L +#define ERROR_BAD_VALIDATION_CLASS 1348L +#define ERROR_BAD_TOKEN_TYPE 1349L +#define ERROR_NO_SECURITY_ON_OBJECT 1350L +#define ERROR_CANT_ACCESS_DOMAIN_INFO 1351L +#define ERROR_INVALID_SERVER_STATE 1352L +#define ERROR_INVALID_DOMAIN_STATE 1353L +#define ERROR_INVALID_DOMAIN_ROLE 1354L +#define ERROR_NO_SUCH_DOMAIN 1355L +#define ERROR_DOMAIN_EXISTS 1356L +#define ERROR_DOMAIN_LIMIT_EXCEEDED 1357L +#define ERROR_INTERNAL_DB_CORRUPTION 1358L +#define ERROR_INTERNAL_ERROR 1359L +#define ERROR_GENERIC_NOT_MAPPED 1360L +#define ERROR_BAD_DESCRIPTOR_FORMAT 1361L +#define ERROR_NOT_LOGON_PROCESS 1362L +#define ERROR_LOGON_SESSION_EXISTS 1363L +#define ERROR_NO_SUCH_PACKAGE 1364L +#define ERROR_BAD_LOGON_SESSION_STATE 1365L +#define ERROR_LOGON_SESSION_COLLISION 1366L +#define ERROR_INVALID_LOGON_TYPE 1367L +#define ERROR_CANNOT_IMPERSONATE 1368L +#define ERROR_RXACT_INVALID_STATE 1369L +#define ERROR_RXACT_COMMIT_FAILURE 1370L +#define ERROR_SPECIAL_ACCOUNT 1371L +#define ERROR_SPECIAL_GROUP 1372L +#define ERROR_SPECIAL_USER 1373L +#define ERROR_MEMBERS_PRIMARY_GROUP 1374L +#define ERROR_TOKEN_ALREADY_IN_USE 1375L +#define ERROR_NO_SUCH_ALIAS 1376L +#define ERROR_MEMBER_NOT_IN_ALIAS 1377L +#define ERROR_MEMBER_IN_ALIAS 1378L +#define ERROR_ALIAS_EXISTS 1379L +#define ERROR_LOGON_NOT_GRANTED 1380L +#define ERROR_TOO_MANY_SECRETS 1381L +#define ERROR_SECRET_TOO_LONG 1382L +#define ERROR_INTERNAL_DB_ERROR 1383L +#define ERROR_TOO_MANY_CONTEXT_IDS 1384L +#define ERROR_LOGON_TYPE_NOT_GRANTED 1385L +#define ERROR_NT_CROSS_ENCRYPTION_REQUIRED 1386L +#define ERROR_NO_SUCH_MEMBER 1387L +#define ERROR_INVALID_MEMBER 1388L +#define ERROR_TOO_MANY_SIDS 1389L +#define ERROR_LM_CROSS_ENCRYPTION_REQUIRED 1390L +#define ERROR_NO_INHERITANCE 1391L +#define ERROR_FILE_CORRUPT 1392L +#define ERROR_DISK_CORRUPT 1393L +#define ERROR_NO_USER_SESSION_KEY 1394L +#define ERROR_LICENSE_QUOTA_EXCEEDED 1395L +#define ERROR_INVALID_WINDOW_HANDLE 1400L +#define ERROR_INVALID_MENU_HANDLE 1401L +#define ERROR_INVALID_CURSOR_HANDLE 1402L +#define ERROR_INVALID_ACCEL_HANDLE 1403L +#define ERROR_INVALID_HOOK_HANDLE 1404L +#define ERROR_INVALID_DWP_HANDLE 1405L +#define ERROR_TLW_WITH_WSCHILD 1406L +#define ERROR_CANNOT_FIND_WND_CLASS 1407L +#define ERROR_WINDOW_OF_OTHER_THREAD 1408L +#define ERROR_HOTKEY_ALREADY_REGISTERED 1409L +#define ERROR_CLASS_ALREADY_EXISTS 1410L +#define ERROR_CLASS_DOES_NOT_EXIST 1411L +#define ERROR_CLASS_HAS_WINDOWS 1412L +#define ERROR_INVALID_INDEX 1413L +#define ERROR_INVALID_ICON_HANDLE 1414L +#define ERROR_PRIVATE_DIALOG_INDEX 1415L +#define ERROR_LISTBOX_ID_NOT_FOUND 1416L +#define ERROR_NO_WILDCARD_CHARACTERS 1417L +#define ERROR_CLIPBOARD_NOT_OPEN 1418L +#define ERROR_HOTKEY_NOT_REGISTERED 1419L +#define ERROR_WINDOW_NOT_DIALOG 1420L +#define ERROR_CONTROL_ID_NOT_FOUND 1421L +#define ERROR_INVALID_COMBOBOX_MESSAGE 1422L +#define ERROR_WINDOW_NOT_COMBOBOX 1423L +#define ERROR_INVALID_EDIT_HEIGHT 1424L +#define ERROR_DC_NOT_FOUND 1425L +#define ERROR_INVALID_HOOK_FILTER 1426L +#define ERROR_INVALID_FILTER_PROC 1427L +#define ERROR_HOOK_NEEDS_HMOD 1428L +#define ERROR_GLOBAL_ONLY_HOOK 1429L +#define ERROR_JOURNAL_HOOK_SET 1430L +#define ERROR_HOOK_NOT_INSTALLED 1431L +#define ERROR_INVALID_LB_MESSAGE 1432L +#define ERROR_SETCOUNT_ON_BAD_LB 1433L +#define ERROR_LB_WITHOUT_TABSTOPS 1434L +#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD 1435L +#define ERROR_CHILD_WINDOW_MENU 1436L +#define ERROR_NO_SYSTEM_MENU 1437L +#define ERROR_INVALID_MSGBOX_STYLE 1438L +#define ERROR_INVALID_SPI_VALUE 1439L +#define ERROR_SCREEN_ALREADY_LOCKED 1440L +#define ERROR_HWNDS_HAVE_DIFF_PARENT 1441L +#define ERROR_NOT_CHILD_WINDOW 1442L +#define ERROR_INVALID_GW_COMMAND 1443L +#define ERROR_INVALID_THREAD_ID 1444L +#define ERROR_NON_MDICHILD_WINDOW 1445L +#define ERROR_POPUP_ALREADY_ACTIVE 1446L +#define ERROR_NO_SCROLLBARS 1447L +#define ERROR_INVALID_SCROLLBAR_RANGE 1448L +#define ERROR_INVALID_SHOWWIN_COMMAND 1449L +#define ERROR_NO_SYSTEM_RESOURCES 1450L +#define ERROR_NONPAGED_SYSTEM_RESOURCES 1451L +#define ERROR_PAGED_SYSTEM_RESOURCES 1452L +#define ERROR_WORKING_SET_QUOTA 1453L +#define ERROR_PAGEFILE_QUOTA 1454L +#define ERROR_COMMITMENT_LIMIT 1455L +#define ERROR_MENU_ITEM_NOT_FOUND 1456L +#define ERROR_EVENTLOG_FILE_CORRUPT 1500L +#define ERROR_EVENTLOG_CANT_START 1501L +#define ERROR_LOG_FILE_FULL 1502L +#define ERROR_EVENTLOG_FILE_CHANGED 1503L +#define RPC_S_INVALID_STRING_BINDING 1700L +#define RPC_S_WRONG_KIND_OF_BINDING 1701L +#define RPC_S_INVALID_BINDING 1702L +#define RPC_S_PROTSEQ_NOT_SUPPORTED 1703L +#define RPC_S_INVALID_RPC_PROTSEQ 1704L +#define RPC_S_INVALID_STRING_UUID 1705L +#define RPC_S_INVALID_ENDPOINT_FORMAT 1706L +#define RPC_S_INVALID_NET_ADDR 1707L +#define RPC_S_NO_ENDPOINT_FOUND 1708L +#define RPC_S_INVALID_TIMEOUT 1709L +#define RPC_S_OBJECT_NOT_FOUND 1710L +#define RPC_S_ALREADY_REGISTERED 1711L +#define RPC_S_TYPE_ALREADY_REGISTERED 1712L +#define RPC_S_ALREADY_LISTENING 1713L +#define RPC_S_NO_PROTSEQS_REGISTERED 1714L +#define RPC_S_NOT_LISTENING 1715L +#define RPC_S_UNKNOWN_MGR_TYPE 1716L +#define RPC_S_UNKNOWN_IF 1717L +#define RPC_S_NO_BINDINGS 1718L +#define RPC_S_NO_PROTSEQS 1719L +#define RPC_S_CANT_CREATE_ENDPOINT 1720L +#define RPC_S_OUT_OF_RESOURCES 1721L +#define RPC_S_SERVER_UNAVAILABLE 1722L +#define RPC_S_SERVER_TOO_BUSY 1723L +#define RPC_S_INVALID_NETWORK_OPTIONS 1724L +#define RPC_S_NO_CALL_ACTIVE 1725L +#define RPC_S_CALL_FAILED 1726L +#define RPC_S_CALL_FAILED_DNE 1727L +#define RPC_S_PROTOCOL_ERROR 1728L +#define RPC_S_UNSUPPORTED_TRANS_SYN 1730L +#define RPC_S_UNSUPPORTED_TYPE 1732L +#define RPC_S_INVALID_TAG 1733L +#define RPC_S_INVALID_BOUND 1734L +#define RPC_S_NO_ENTRY_NAME 1735L +#define RPC_S_INVALID_NAME_SYNTAX 1736L +#define RPC_S_UNSUPPORTED_NAME_SYNTAX 1737L +#define RPC_S_UUID_NO_ADDRESS 1739L +#define RPC_S_DUPLICATE_ENDPOINT 1740L +#define RPC_S_UNKNOWN_AUTHN_TYPE 1741L +#define RPC_S_MAX_CALLS_TOO_SMALL 1742L +#define RPC_S_STRING_TOO_LONG 1743L +#define RPC_S_PROTSEQ_NOT_FOUND 1744L +#define RPC_S_PROCNUM_OUT_OF_RANGE 1745L +#define RPC_S_BINDING_HAS_NO_AUTH 1746L +#define RPC_S_UNKNOWN_AUTHN_SERVICE 1747L +#define RPC_S_UNKNOWN_AUTHN_LEVEL 1748L +#define RPC_S_INVALID_AUTH_IDENTITY 1749L +#define RPC_S_UNKNOWN_AUTHZ_SERVICE 1750L +#define EPT_S_INVALID_ENTRY 1751L +#define EPT_S_CANT_PERFORM_OP 1752L +#define EPT_S_NOT_REGISTERED 1753L +#define RPC_S_NOTHING_TO_EXPORT 1754L +#define RPC_S_INCOMPLETE_NAME 1755L +#define RPC_S_INVALID_VERS_OPTION 1756L +#define RPC_S_NO_MORE_MEMBERS 1757L +#define RPC_S_NOT_ALL_OBJS_UNEXPORTED 1758L +#define RPC_S_INTERFACE_NOT_FOUND 1759L +#define RPC_S_ENTRY_ALREADY_EXISTS 1760L +#define RPC_S_ENTRY_NOT_FOUND 1761L +#define RPC_S_NAME_SERVICE_UNAVAILABLE 1762L +#define RPC_S_INVALID_NAF_ID 1763L +#define RPC_S_CANNOT_SUPPORT 1764L +#define RPC_S_NO_CONTEXT_AVAILABLE 1765L +#define RPC_S_INTERNAL_ERROR 1766L +#define RPC_S_ZERO_DIVIDE 1767L +#define RPC_S_ADDRESS_ERROR 1768L +#define RPC_S_FP_DIV_ZERO 1769L +#define RPC_S_FP_UNDERFLOW 1770L +#define RPC_S_FP_OVERFLOW 1771L +#define RPC_X_NO_MORE_ENTRIES 1772L +#define RPC_X_SS_CHAR_TRANS_OPEN_FAIL 1773L +#define RPC_X_SS_CHAR_TRANS_SHORT_FILE 1774L +#define RPC_X_SS_IN_NULL_CONTEXT 1775L +#define RPC_X_SS_CONTEXT_DAMAGED 1777L +#define RPC_X_SS_HANDLES_MISMATCH 1778L +#define RPC_X_SS_CANNOT_GET_CALL_HANDLE 1779L +#define RPC_X_NULL_REF_POINTER 1780L +#define RPC_X_ENUM_VALUE_OUT_OF_RANGE 1781L +#define RPC_X_BYTE_COUNT_TOO_SMALL 1782L +#define RPC_X_BAD_STUB_DATA 1783L +#define ERROR_INVALID_USER_BUFFER 1784L +#define ERROR_UNRECOGNIZED_MEDIA 1785L +#define ERROR_NO_TRUST_LSA_SECRET 1786L +#define ERROR_NO_TRUST_SAM_ACCOUNT 1787L +#define ERROR_TRUSTED_DOMAIN_FAILURE 1788L +#define ERROR_TRUSTED_RELATIONSHIP_FAILURE 1789L +#define ERROR_TRUST_FAILURE 1790L +#define RPC_S_CALL_IN_PROGRESS 1791L +#define ERROR_NETLOGON_NOT_STARTED 1792L +#define ERROR_ACCOUNT_EXPIRED 1793L +#define ERROR_REDIRECTOR_HAS_OPEN_HANDLES 1794L +#define ERROR_PRINTER_DRIVER_ALREADY_INSTALLED 1795L +#define ERROR_UNKNOWN_PORT 1796L +#define ERROR_UNKNOWN_PRINTER_DRIVER 1797L +#define ERROR_UNKNOWN_PRINTPROCESSOR 1798L +#define ERROR_INVALID_SEPARATOR_FILE 1799L +#define ERROR_INVALID_PRIORITY 1800L +#define ERROR_INVALID_PRINTER_NAME 1801L +#define ERROR_PRINTER_ALREADY_EXISTS 1802L +#define ERROR_INVALID_PRINTER_COMMAND 1803L +#define ERROR_INVALID_DATATYPE 1804L +#define ERROR_INVALID_ENVIRONMENT 1805L +#define RPC_S_NO_MORE_BINDINGS 1806L +#define ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 1807L +#define ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT 1808L +#define ERROR_NOLOGON_SERVER_TRUST_ACCOUNT 1809L +#define ERROR_DOMAIN_TRUST_INCONSISTENT 1810L +#define ERROR_SERVER_HAS_OPEN_HANDLES 1811L +#define ERROR_RESOURCE_DATA_NOT_FOUND 1812L +#define ERROR_RESOURCE_TYPE_NOT_FOUND 1813L +#define ERROR_RESOURCE_NAME_NOT_FOUND 1814L +#define ERROR_RESOURCE_LANG_NOT_FOUND 1815L +#define ERROR_NOT_ENOUGH_QUOTA 1816L +#define RPC_S_NO_INTERFACES 1817L +#define RPC_S_CALL_CANCELLED 1818L +#define RPC_S_BINDING_INCOMPLETE 1819L +#define RPC_S_COMM_FAILURE 1820L +#define RPC_S_UNSUPPORTED_AUTHN_LEVEL 1821L +#define RPC_S_NO_PRINC_NAME 1822L +#define RPC_S_NOT_RPC_ERROR 1823L +#define RPC_S_UUID_LOCAL_ONLY 1824L +#define RPC_S_SEC_PKG_ERROR 1825L +#define RPC_S_NOT_CANCELLED 1826L +#define RPC_X_INVALID_ES_ACTION 1827L +#define RPC_X_WRONG_ES_VERSION 1828L +#define RPC_X_WRONG_STUB_VERSION 1829L +#define RPC_S_GROUP_MEMBER_NOT_FOUND 1898L +#define EPT_S_CANT_CREATE 1899L +#define RPC_S_INVALID_OBJECT 1900L +#define ERROR_INVALID_TIME 1901L +#define ERROR_INVALID_FORM_NAME 1902L +#define ERROR_INVALID_FORM_SIZE 1903L +#define ERROR_ALREADY_WAITING 1904L +#define ERROR_PRINTER_DELETED 1905L +#define ERROR_INVALID_PRINTER_STATE 1906L +#define ERROR_PASSWORD_MUST_CHANGE 1907L +#define ERROR_DOMAIN_CONTROLLER_NOT_FOUND 1908L +#define ERROR_ACCOUNT_LOCKED_OUT 1909L +#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L +#define ERROR_INVALID_PIXEL_FORMAT 2000L +#define ERROR_BAD_DRIVER 2001L +#define ERROR_INVALID_WINDOW_STYLE 2002L +#define ERROR_METAFILE_NOT_SUPPORTED 2003L +#define ERROR_TRANSFORM_NOT_SUPPORTED 2004L +#define ERROR_CLIPPING_NOT_SUPPORTED 2005L +#define ERROR_UNKNOWN_PRINT_MONITOR 3000L +#define ERROR_PRINTER_DRIVER_IN_USE 3001L +#define ERROR_SPOOL_FILE_NOT_FOUND 3002L +#define ERROR_SPL_NO_STARTDOC 3003L +#define ERROR_SPL_NO_ADDJOB 3004L +#define ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED 3005L +#define ERROR_PRINT_MONITOR_ALREADY_INSTALLED 3006L +#define ERROR_WINS_INTERNAL 4000L +#define ERROR_CAN_NOT_DEL_LOCAL_WINS 4001L +#define ERROR_STATIC_INIT 4002L +#define ERROR_INC_BACKUP 4003L +#define ERROR_FULL_BACKUP 4004L +#define ERROR_REC_NON_EXISTENT 4005L +#define ERROR_RPL_NOT_ALLOWED 4006L +#define ERROR_NO_BROWSER_SERVERS_FOUND 6118L + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_ERROR */ diff --git a/reactos/include/funcs.h b/reactos/include/funcs.h new file mode 100644 index 00000000000..64fe7062c26 --- /dev/null +++ b/reactos/include/funcs.h @@ -0,0 +1,7484 @@ +/* + Functions.h + + Declarations for all the Windows32 API Functions + + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + + Author: Scott Christley + + 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 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_FUNCTIONS +#define _GNU_H_WINDOWS32_FUNCTIONS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* These functions were a real pain, having to figure out which + had Unicode/Ascii versions and which did not */ + +#ifndef UNICODE_ONLY +#include +#endif /* !UNICODE_ONLY */ + +#ifndef ANSI_ONLY +#include +#endif /* !ANSI_ONLY */ + +/* Define the approprate declaration based upon UNICODE or ASCII */ + +/* UNICODE */ +#ifdef UNICODE + +#define RegConnectRegistry RegConnectRegistryW +#define RegCreateKey RegCreateKeyW +#define RegCreateKeyEx RegCreateKeyExW +#define RegDeleteKey RegDeleteKeyW +#define RegDeleteValue RegDeleteValueW +#define RegEnumKey RegEnumKeyW +#define RegEnumKeyEx RegEnumKeyExW +#define RegEnumValue RegEnumValueW +#define RegLoadKey RegLoadKeyW +#define RegOpenKey RegOpenKeyW +#define RegOpenKeyEx RegOpenKeyExW +#define RegQueryInfoKey RegQueryInfoKeyW +#define RegQueryValue RegQueryValueW +#define RegQueryMultipleValues RegQueryMultipleValuesW +#define RegQueryValueEx RegQueryValueExW +#define RegReplaceKey RegReplaceKeyW +#define RegRestoreKey RegRestoreKeyW +#define RegSaveKey RegSaveKeyW +#define RegSetValue RegSetValueW +#define RegSetValueEx RegSetValueExW +#define AbortSystemShutdown AbortSystemShutdownW +#define InitiateSystemShutdown InitiateSystemShutdownW +#define RegUnLoadKey RegUnLoadKeyW +#define SetProp SetPropW +#define GetProp GetPropW +#define RemoveProp RemovePropW +#define EnumPropsEx EnumPropsExW +#define EnumProps EnumPropsW +#define SetWindowText SetWindowTextW +#define GetWindowText GetWindowTextW +#define GetWindowTextLength GetWindowTextLengthW +#define MessageBox MessageBoxW +#define MessageBoxEx MessageBoxExW +#define MessageBoxIndirect MessageBoxIndirectW +#define GetWindowLong GetWindowLongW +#define SetWindowLong SetWindowLongW +#define GetClassLong GetClassLongW +#define SetClassLong SetClassLongW +#define FindWindow FindWindowW +#define FindWindowEx FindWindowExW +#define GetClassName GetClassNameW +#define SetWindowsHookEx SetWindowsHookExW +#define LoadBitmap LoadBitmapW +#define LoadCursor LoadCursorW +#define LoadCursorFromFile LoadCursorFromFileW +#define LoadIcon LoadIconW +#define LoadImage LoadImageW +#define LoadString LoadStringW +#define IsDialogMessage IsDialogMessageW +#define DlgDirList DlgDirListW +#define DlgDirSelectEx DlgDirSelectExW +#define DlgDirListComboBox DlgDirListComboBoxW +#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExW +#define DefFrameProc DefFrameProcW +#define DefMDIChildProc DefMDIChildProcW +#define CreateMDIWindow CreateMDIWindowW +#define WinHelp WinHelpW +#define ChangeDisplaySettings ChangeDisplaySettingsW +#define EnumDisplaySettings EnumDisplaySettingsW +#define SystemParametersInfo SystemParametersInfoW +#define AddFontResource AddFontResourceW +#define CopyMetaFile CopyMetaFileW +#define CreateDC CreateDCW +#define CreateFontIndirect CreateFontIndirectW +#define CreateFont CreateFontW +#define CreateIC CreateICW +#define CreateMetaFile CreateMetaFileW +#define CreateScalableFontResource CreateScalableFontResourceW +#define DeviceCapabilities DeviceCapabilitiesW +#define EnumFontFamiliesEx EnumFontFamiliesExW +#define EnumFontFamilies EnumFontFamiliesW +#define EnumFonts EnumFontsW +#define GetCharWidth GetCharWidthW +#define GetCharWidth32 GetCharWidth32W +#define GetCharWidthFloat GetCharWidthFloatW +#define GetCharABCWidths GetCharABCWidthsW +#define GetCharABCWidthsFloat GetCharABCWidthsFloatW +#define GetGlyphOutline GetGlyphOutlineW +#define GetMetaFile GetMetaFileW +#define GetOutlineTextMetrics GetOutlineTextMetricsW +#define GetTextExtentPoint GetTextExtentPointW +#define GetTextExtentPoint32 GetTextExtentPoint32W +#define GetTextExtentExPoint GetTextExtentExPointW +#define GetCharacterPlacement GetCharacterPlacementW +#define ResetDC ResetDCW +#define RemoveFontResource RemoveFontResourceW +#define CopyEnhMetaFile CopyEnhMetaFileW +#define CreateEnhMetaFile CreateEnhMetaFileW +#define GetEnhMetaFile GetEnhMetaFileW +#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionW +#define GetTextMetrics GetTextMetricsW +#define StartDoc StartDocW +#define GetObject GetObjectW +#define TextOut TextOutW +#define ExtTextOut ExtTextOutW +#define PolyTextOut PolyTextOutW +#define GetTextFace GetTextFaceW +#define GetKerningPairs GetKerningPairsW +#define GetLogColorSpace GetLogColorSpaceW +#define CreateColorSpace CreateColorSpaceW +#define GetICMProfile GetICMProfileW +#define SetICMProfile SetICMProfileW +#define UpdateICMRegKey UpdateICMRegKeyW +#define EnumICMProfiles EnumICMProfilesW +#define CreatePropertySheetPage CreatePropertySheetPageW +#define PropertySheet PropertySheetW +#define ImageList_LoadImage ImageList_LoadImageW +#define CreateStatusWindow CreateStatusWindowW +#define DrawStatusText DrawStatusTextW +#define GetOpenFileName GetOpenFileNameW +#define GetSaveFileName GetSaveFileNameW +#define GetFileTitle GetFileTitleW +#define ChooseColor ChooseColorW +#define FindText FindTextW +#define ReplaceText ReplaceTextW +#define ChooseFont ChooseFontW +#define PrintDlg PrintDlgW +#define PageSetupDlg PageSetupDlgW +#define DefWindowProc DefWindowProcW +#define CallWindowProc CallWindowProcW +#define RegisterClass RegisterClassW +#define UnregisterClass UnregisterClassW +#define GetClassInfo GetClassInfoW +#define RegisterClassEx RegisterClassExW +#define GetClassInfoEx GetClassInfoExW +#define CreateWindowEx CreateWindowExW +#define CreateWindow CreateWindowW +#define CreateDialogParam CreateDialogParamW +#define CreateDialogIndirectParam CreateDialogIndirectParamW +#define CreateDialog CreateDialogW +#define CreateDialogIndirect CreateDialogIndirectW +#define DialogBoxParam DialogBoxParamW +#define DialogBoxIndirectParam DialogBoxIndirectParamW +#define DialogBox DialogBoxW +#define DialogBoxIndirect DialogBoxIndirectW +#define RegisterClipboardFormat RegisterClipboardFormatW +#define SetDlgItemText SetDlgItemTextW +#define GetDlgItemText GetDlgItemTextW +#define SendDlgItemMessage SendDlgItemMessageW +#define DefDlgProc DefDlgProcW +#define CallMsgFilter CallMsgFilterW +#define GetClipboardFormatName GetClipboardFormatNameW +#define CharToOem CharToOemW +#define OemToChar OemToCharW +#define CharToOemBuff CharToOemBuffW +#define OemToCharBuff OemToCharBuffW +#define CharUpper CharUpperW +#define CharUpperBuff CharUpperBuffW +#define CharLower CharLowerW +#define CharLowerBuff CharLowerBuffW +#define CharNext CharNextW +#define CharPrev CharPrevW +#define IsCharAlpha IsCharAlphaW +#define IsCharAlphaNumeric IsCharAlphaNumericW +#define IsCharUpper IsCharUpperW +#define IsCharLower IsCharLowerW +#define GetKeyNameText GetKeyNameTextW +#define VkKeyScan VkKeyScanW +#define VkKeyScanEx VkKeyScanExW +#define MapVirtualKey MapVirtualKeyW +#define MapVirtualKeyEx MapVirtualKeyExW +#define LoadAccelerators LoadAcceleratorsW +#define CreateAcceleratorTable CreateAcceleratorTableW +#define CopyAcceleratorTable CopyAcceleratorTableW +#define TranslateAccelerator TranslateAcceleratorW +#define LoadMenu LoadMenuW +#define LoadMenuIndirect LoadMenuIndirectW +#define ChangeMenu ChangeMenuW +#define GetMenuString GetMenuStringW +#define InsertMenu InsertMenuW +#define AppendMenu AppendMenuW +#define ModifyMenu ModifyMenuW +#define InsertMenuItem InsertMenuItemW +#define GetMenuItemInfo GetMenuItemInfoW +#define SetMenuItemInfo SetMenuItemInfoW +#define DrawText DrawTextW +#define DrawTextEx DrawTextExW +#define GrayString GrayStringW +#define DrawState DrawStateW +#define TabbedTextOut TabbedTextOutW +#define GetTabbedTextExtent GetTabbedTextExtentW +#define GetVersionEx GetVersionExW +#define wvsprintf wvsprintfW +#define wsprintf wsprintfW +#define LoadKeyboardLayout LoadKeyboardLayoutW +#define GetKeyboardLayoutName GetKeyboardLayoutNameW +#define CreateDesktop CreateDesktopW +#define OpenDesktop OpenDesktopW +#define EnumDesktops EnumDesktopsW +#define CreateWindowStation CreateWindowStationW +#define OpenWindowStation OpenWindowStationW +#define EnumWindowStations EnumWindowStationsW +#define IsBadStringPtr IsBadStringPtrW +#define LookupAccountSid LookupAccountSidW +#define LookupAccountName LookupAccountNameW +#define LookupPrivilegeValue LookupPrivilegeValueW +#define LookupPrivilegeName LookupPrivilegeNameW +#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameW +#define BuildCommDCB BuildCommDCBW +#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsW +#define CommConfigDialog CommConfigDialogW +#define GetDefaultCommConfig GetDefaultCommConfigW +#define SetDefaultCommConfig SetDefaultCommConfigW +#define GetComputerName GetComputerNameW +#define SetComputerName SetComputerNameW +#define GetUserName GetUserNameW +#define CreateMailslot CreateMailslotW +#define FormatMessage FormatMessageW +#define GetEnvironmentStrings GetEnvironmentStringsW +#define FreeEnvironmentStrings FreeEnvironmentStringsW +#define lstrcmp lstrcmpW +#define lstrcmpi lstrcmpiW +#define lstrcpyn lstrcpynW +#define lstrcpy lstrcpyW +#define lstrcat lstrcatW +#define lstrlen lstrlenW +#define GetBinaryType GetBinaryTypeW +#define GetShortPathName GetShortPathNameW +#define SetFileSecurity SetFileSecurityW +#define GetFileSecurity GetFileSecurityW +#define FindFirstChangeNotification FindFirstChangeNotificationW +#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmW +#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmW +#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmW +#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmW +#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmW +#define OpenEventLog OpenEventLogW +#define RegisterEventSource RegisterEventSourceW +#define OpenBackupEventLog OpenBackupEventLogW +#define ReadEventLog ReadEventLogW +#define ReportEvent ReportEventW +#define CreateProcess CreateProcessW +#define FatalAppExit FatalAppExitW +#define GetStartupInfo GetStartupInfoW +#define GetEnvironmentVariable GetEnvironmentVariableW +#define GetCommandLine GetCommandLineW +#define SetEnvironmentVariable SetEnvironmentVariableW +#define ExpandEnvironmentStrings ExpandEnvironmentStringsW +#define OutputDebugString OutputDebugStringW +#define FindResource FindResourceW +#define FindResourceEx FindResourceExW +#define EnumResourceTypes EnumResourceTypesW +#define EnumResourceNames EnumResourceNamesW +#define EnumResourceLanguages EnumResourceLanguagesW +#define BeginUpdateResource BeginUpdateResourceW +#define UpdateResource UpdateResourceW +#define EndUpdateResource EndUpdateResourceW +#define GlobalAddAtom GlobalAddAtomW +#define GlobalFindAtom GlobalFindAtomW +#define GlobalGetAtomName GlobalGetAtomNameW +#define AddAtom AddAtomW +#define FindAtom FindAtomW +#define GetAtomName GetAtomNameW +#define GetProfileInt GetProfileIntW +#define GetProfileString GetProfileStringW +#define WriteProfileString WriteProfileStringW +#define GetProfileSection GetProfileSectionW +#define WriteProfileSection WriteProfileSectionW +#define GetPrivateProfileInt GetPrivateProfileIntW +#define GetPrivateProfileString GetPrivateProfileStringW +#define WritePrivateProfileString WritePrivateProfileStringW +#define GetPrivateProfileSection GetPrivateProfileSectionW +#define WritePrivateProfileSection WritePrivateProfileSectionW +#define GetDriveType GetDriveTypeW +#define GetSystemDirectory GetSystemDirectoryW +#define GetTempPath GetTempPathW +#define GetTempFileName GetTempFileNameW +#define GetWindowsDirectory GetWindowsDirectoryW +#define SetCurrentDirectory SetCurrentDirectoryW +#define GetCurrentDirectory GetCurrentDirectoryW +#define GetDiskFreeSpace GetDiskFreeSpaceW +#define CreateDirectory CreateDirectoryW +#define CreateDirectoryEx CreateDirectoryExW +#define RemoveDirectory RemoveDirectoryW +#define GetFullPathName GetFullPathNameW +#define DefineDosDevice DefineDosDeviceW +#define QueryDosDevice QueryDosDeviceW +#define CreateFile CreateFileW +#define SetFileAttributes SetFileAttributesW +#define GetFileAttributes GetFileAttributesW +#define GetCompressedFileSize GetCompressedFileSizeW +#define DeleteFile DeleteFileW +#define FindFirstFile FindFirstFileW +#define FindNextFile FindNextFileW +#define SearchPath SearchPathW +#define CopyFile CopyFileW +#define MoveFile MoveFileW +#define MoveFileEx MoveFileExW +#define CreateNamedPipe CreateNamedPipeW +#define GetNamedPipeHandleState GetNamedPipeHandleStateW +#define CallNamedPipe CallNamedPipeW +#define WaitNamedPipe WaitNamedPipeW +#define SetVolumeLabel SetVolumeLabelW +#define GetVolumeInformation GetVolumeInformationW +#define ClearEventLog ClearEventLogW +#define BackupEventLog BackupEventLogW +#define CreateMutex CreateMutexW +#define OpenMutex OpenMutexW +#define CreateEvent CreateEventW +#define OpenEvent OpenEventW +#define CreateSemaphore CreateSemaphoreW +#define OpenSemaphore OpenSemaphoreW +#define CreateFileMapping CreateFileMappingW +#define OpenFileMapping OpenFileMappingW +#define GetLogicalDriveStrings GetLogicalDriveStringsW +#define LoadLibrary LoadLibraryW +#define LoadLibraryEx LoadLibraryExW +#define GetModuleFileName GetModuleFileNameW +#define GetModuleHandle GetModuleHandleW +#define GetUserObjectInformation GetUserObjectInformationW +#define SetUserObjectInformation SetUserObjectInformationW +#define RegisterWindowMessage RegisterWindowMessageW +#define GetMessage GetMessageW +#define DispatchMessage DispatchMessageW +#define PeekMessage PeekMessageW +#define SendMessage SendMessageW +#define SendMessageTimeout SendMessageTimeoutW +#define SendNotifyMessage SendNotifyMessageW +#define SendMessageCallback SendMessageCallbackW +#define PostMessage PostMessageW +#define PostThreadMessage PostThreadMessageW +#define VerFindFile VerFindFileW +#define VerInstallFile VerInstallFileW +#define GetFileVersionInfoSize GetFileVersionInfoSizeW +#define GetFileVersionInfo GetFileVersionInfoW +#define VerLanguageName VerLanguageNameW +#define VerQueryValue VerQueryValueW +#define CompareString CompareStringW +#define LCMapString LCMapStringW +#define GetLocaleInfo GetLocaleInfoW +#define SetLocaleInfo SetLocaleInfoW +#define GetTimeFormat GetTimeFormatW +#define GetDateFormat GetDateFormatW +#define GetNumberFormat GetNumberFormatW +#define GetCurrencyFormat GetCurrencyFormatW +#define EnumCalendarInfo EnumCalendarInfoW +#define EnumTimeFormats EnumTimeFormatsW +#define FoldString FoldStringW +#define EnumSystemCodePages EnumSystemCodePagesW +#define EnumSystemLocales EnumSystemLocalesW +#define GetStringTypeEx GetStringTypeExW +#define EnumDateFormats EnumDateFormatsW +#define GetConsoleTitle GetConsoleTitleW +#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW +#define SetConsoleTitle SetConsoleTitleW +#define ReadConsole ReadConsoleW +#define WriteConsole WriteConsoleW +#define PeekConsoleInput PeekConsoleInputW +#define ReadConsoleInput ReadConsoleInputW +#define WriteConsoleInput WriteConsoleInputW +#define ReadConsoleOutput ReadConsoleOutputW +#define WriteConsoleOutput WriteConsoleOutputW +#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW +#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW +#define FillConsoleOutputCharacter FillConsoleOutputCharacterW +#define WNetGetProviderName WNetGetProviderNameW +#define WNetGetNetworkInformation WNetGetNetworkInformationW +#define WNetGetLastError WNetGetLastErrorW +#define MultinetGetConnectionPerformance MultinetGetConnectionPerformanceW +#define WNetConnectionDialog1 WNetConnectionDialog1W +#define WNetDisconnectDialog1 WNetDisconnectDialog1W +#define WNetOpenEnum WNetOpenEnumW +#define WNetEnumResource WNetEnumResourceW +#define WNetGetUniversalName WNetGetUniversalNameW +#define WNetGetUser WNetGetUserW +#define WNetAddConnection WNetAddConnectionW +#define WNetAddConnection2 WNetAddConnection2W +#define WNetAddConnection3 WNetAddConnection3W +#define WNetCancelConnection WNetCancelConnectionW +#define WNetCancelConnection2 WNetCancelConnection2W +#define WNetGetConnection WNetGetConnectionW +#define WNetUseConnection WNetUseConnectionW +#define WNetSetConnection WNetSetConnectionW +#define CreateService CreateServiceW +#define ChangeServiceConfig ChangeServiceConfigW +#define EnumDependentServices EnumDependentServicesW +#define EnumServicesStatus EnumServicesStatusW +#define GetServiceKeyName GetServiceKeyNameW +#define GetServiceDisplayName GetServiceDisplayNameW +#define OpenSCManager OpenSCManagerW +#define OpenService OpenServiceW +#define QueryServiceConfig QueryServiceConfigW +#define QueryServiceLockStatus QueryServiceLockStatusW +#define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerW +#define StartServiceCtrlDispatcher StartServiceCtrlDispatcherW +#define StartService StartServiceW +#define DragQueryFile DragQueryFileW +#define ExtractAssociatedIcon ExtractAssociatedIconW +#define ExtractIcon ExtractIconW +#define FindExecutable FindExecutableW +#define ShellAbout ShellAboutW +#define ShellExecute ShellExecuteW +#define DdeCreateStringHandle DdeCreateStringHandleW +#define DdeInitialize DdeInitializeW +#define DdeQueryString DdeQueryStringW +#define LogonUser LogonUserW +#define CreateProcessAsUser CreateProcessAsUserW + +/* ASCII */ +#else + +#define RegConnectRegistry RegConnectRegistryA +#define RegCreateKey RegCreateKeyA +#define RegCreateKeyEx RegCreateKeyExA +#define RegDeleteKey RegDeleteKeyA +#define RegDeleteValue RegDeleteValueA +#define RegEnumKey RegEnumKeyA +#define RegEnumKeyEx RegEnumKeyExA +#define RegEnumValue RegEnumValueA +#define RegLoadKey RegLoadKeyA +#define RegOpenKey RegOpenKeyA +#define RegOpenKeyEx RegOpenKeyExA +#define RegQueryInfoKey RegQueryInfoKeyA +#define RegQueryValue RegQueryValueA +#define RegQueryMultipleValues RegQueryMultipleValuesA +#define RegQueryValueEx RegQueryValueExA +#define RegReplaceKey RegReplaceKeyA +#define RegRestoreKey RegRestoreKeyA +#define RegSaveKey RegSaveKeyA +#define RegSetValue RegSetValueA +#define RegSetValueEx RegSetValueExA +#define AbortSystemShutdown AbortSystemShutdownA +#define InitiateSystemShutdown InitiateSystemShutdownA +#define RegUnLoadKey RegUnLoadKeyA +#define LoadIcon LoadIconA +#define LoadImage LoadImageA +#define LoadString LoadStringA +#define IsDialogMessage IsDialogMessageA +#define DlgDirList DlgDirListA +#define DlgDirSelectEx DlgDirSelectExA +#define DlgDirListComboBox DlgDirListComboBoxA +#define DlgDirSelectComboBoxEx DlgDirSelectComboBoxExA +#define DefFrameProc DefFrameProcA +#define DefMDIChildProc DefMDIChildProcA +#define CreateMDIWindow CreateMDIWindowA +#define WinHelp WinHelpA +#define ChangeDisplaySettings ChangeDisplaySettingsA +#define EnumDisplaySettings EnumDisplaySettingsA +#define SystemParametersInfo SystemParametersInfoA +#define GetWindowLong GetWindowLongA +#define SetWindowLong SetWindowLongA +#define GetClassLong GetClassLongA +#define SetClassLong SetClassLongA +#define FindWindow FindWindowA +#define FindWindowEx FindWindowExA +#define GetClassName GetClassNameA +#define SetWindowsHookEx SetWindowsHookExA +#define LoadBitmap LoadBitmapA +#define LoadCursor LoadCursorA +#define LoadCursorFromFile LoadCursorFromFileA +#define SetProp SetPropA +#define GetProp GetPropA +#define RemoveProp RemovePropA +#define EnumPropsEx EnumPropsExA +#define EnumProps EnumPropsA +#define SetWindowText SetWindowTextA +#define GetWindowText GetWindowTextA +#define GetWindowTextLength GetWindowTextLengthA +#define MessageBox MessageBoxA +#define MessageBoxEx MessageBoxExA +#define MessageBoxIndirect MessageBoxIndirectA +#define AddFontResource AddFontResourceA +#define CopyMetaFile CopyMetaFileA +#define CreateDC CreateDCA +#define CreateFontIndirect CreateFontIndirectA +#define CreateFont CreateFontA +#define CreateIC CreateICA +#define CreateMetaFile CreateMetaFileA +#define CreateScalableFontResource CreateScalableFontResourceA +#define DeviceCapabilities DeviceCapabilitiesA +#define EnumFontFamiliesEx EnumFontFamiliesExA +#define EnumFontFamilies EnumFontFamiliesA +#define EnumFonts EnumFontsA +#define GetCharWidth GetCharWidthA +#define GetCharWidth32 GetCharWidth32A +#define GetCharWidthFloat GetCharWidthFloatA +#define GetCharABCWidths GetCharABCWidthsA +#define GetCharABCWidthsFloat GetCharABCWidthsFloatA +#define GetGlyphOutline GetGlyphOutlineA +#define GetMetaFile GetMetaFileA +#define GetOutlineTextMetrics GetOutlineTextMetricsA +#define GetTextExtentPoint GetTextExtentPointA +#define GetTextExtentPoint32 GetTextExtentPoint32A +#define GetTextExtentExPoint GetTextExtentExPointA +#define GetCharacterPlacement GetCharacterPlacementA +#define ResetDC ResetDCA +#define RemoveFontResource RemoveFontResourceA +#define CopyEnhMetaFile CopyEnhMetaFileA +#define CreateEnhMetaFile CreateEnhMetaFileA +#define GetEnhMetaFile GetEnhMetaFileA +#define GetEnhMetaFileDescription GetEnhMetaFileDescriptionA +#define GetTextMetrics GetTextMetricsA +#define StartDoc StartDocA +#define GetObject GetObjectA +#define TextOut TextOutA +#define ExtTextOut ExtTextOutA +#define PolyTextOut PolyTextOutA +#define GetTextFace GetTextFaceA +#define GetKerningPairs GetKerningPairsA +#define GetLogColorSpace GetLogColorSpaceA +#define CreateColorSpace CreateColorSpaceA +#define GetICMProfile GetICMProfileA +#define SetICMProfile SetICMProfileA +#define UpdateICMRegKey UpdateICMRegKeyA +#define EnumICMProfiles EnumICMProfilesA +#define CreatePropertySheetPage CreatePropertySheetPageA +#define PropertySheet PropertySheetA +#define ImageList_LoadImage ImageList_LoadImageA +#define CreateStatusWindow CreateStatusWindowA +#define DrawStatusText DrawStatusTextA +#define GetOpenFileName GetOpenFileNameA +#define GetSaveFileName GetSaveFileNameA +#define GetFileTitle GetFileTitleA +#define ChooseColor ChooseColorA +#define FindText FindTextA +#define ReplaceText ReplaceTextA +#define ChooseFont ChooseFontA +#define PrintDlg PrintDlgA +#define PageSetupDlg PageSetupDlgA +#define DefWindowProc DefWindowProcA +#define CallWindowProc CallWindowProcA +#define RegisterClass RegisterClassA +#define UnregisterClass UnregisterClassA +#define GetClassInfo GetClassInfoA +#define RegisterClassEx RegisterClassExA +#define GetClassInfoEx GetClassInfoExA +#define CreateWindowEx CreateWindowExA +#define CreateWindow CreateWindowA +#define CreateDialogParam CreateDialogParamA +#define CreateDialogIndirectParam CreateDialogIndirectParamA +#define CreateDialog CreateDialogA +#define CreateDialogIndirect CreateDialogIndirectA +#define DialogBoxParam DialogBoxParamA +#define DialogBoxIndirectParam DialogBoxIndirectParamA +#define DialogBox DialogBoxA +#define DialogBoxIndirect DialogBoxIndirectA +#define RegisterClipboardFormat RegisterClipboardFormatA +#define SetDlgItemText SetDlgItemTextA +#define GetDlgItemText GetDlgItemTextA +#define SendDlgItemMessage SendDlgItemMessageA +#define DefDlgProc DefDlgProcA +#define CallMsgFilter CallMsgFilterA +#define GetClipboardFormatName GetClipboardFormatNameA +#define CharToOem CharToOemA +#define OemToChar OemToCharA +#define CharToOemBuff CharToOemBuffA +#define OemToCharBuff OemToCharBuffA +#define CharUpper CharUpperA +#define CharUpperBuff CharUpperBuffA +#define CharLower CharLowerA +#define CharLowerBuff CharLowerBuffA +#define CharNext CharNextA +#define CharPrev CharPrevA +#define IsCharAlpha IsCharAlphaA +#define IsCharAlphaNumeric IsCharAlphaNumericA +#define IsCharUpper IsCharUpperA +#define IsCharLower IsCharLowerA +#define GetKeyNameText GetKeyNameTextA +#define VkKeyScan VkKeyScanA +#define VkKeyScanEx VkKeyScanExA +#define MapVirtualKey MapVirtualKeyA +#define MapVirtualKeyEx MapVirtualKeyExA +#define LoadAccelerators LoadAcceleratorsA +#define CreateAcceleratorTable CreateAcceleratorTableA +#define CopyAcceleratorTable CopyAcceleratorTableA +#define TranslateAccelerator TranslateAcceleratorA +#define LoadMenu LoadMenuA +#define LoadMenuIndirect LoadMenuIndirectA +#define ChangeMenu ChangeMenuA +#define GetMenuString GetMenuStringA +#define InsertMenu InsertMenuA +#define AppendMenu AppendMenuA +#define ModifyMenu ModifyMenuA +#define InsertMenuItem InsertMenuItemA +#define GetMenuItemInfo GetMenuItemInfoA +#define SetMenuItemInfo SetMenuItemInfoA +#define DrawText DrawTextA +#define DrawTextEx DrawTextExA +#define GrayString GrayStringA +#define DrawState DrawStateA +#define TabbedTextOut TabbedTextOutA +#define GetTabbedTextExtent GetTabbedTextExtentA +#define GetVersionEx GetVersionExA +#define wvsprintf wvsprintfA +#define wsprintf wsprintfA +#define LoadKeyboardLayout LoadKeyboardLayoutA +#define GetKeyboardLayoutName GetKeyboardLayoutNameA +#define CreateDesktop CreateDesktopA +#define OpenDesktop OpenDesktopA +#define EnumDesktops EnumDesktopsA +#define CreateWindowStation CreateWindowStationA +#define OpenWindowStation OpenWindowStationA +#define EnumWindowStations EnumWindowStationsA +#define IsBadStringPtr IsBadStringPtrA +#define LookupAccountSid LookupAccountSidA +#define LookupAccountName LookupAccountNameA +#define LookupPrivilegeValue LookupPrivilegeValueA +#define LookupPrivilegeName LookupPrivilegeNameA +#define LookupPrivilegeDisplayName LookupPrivilegeDisplayNameA +#define BuildCommDCB BuildCommDCBA +#define BuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsA +#define CommConfigDialog CommConfigDialogA +#define GetDefaultCommConfig GetDefaultCommConfigA +#define SetDefaultCommConfig SetDefaultCommConfigA +#define GetComputerName GetComputerNameA +#define SetComputerName SetComputerNameA +#define GetUserName GetUserNameA +#define CreateMailslot CreateMailslotA +#define FormatMessage FormatMessageA +#define GetEnvironmentStrings GetEnvironmentStringsA +#define FreeEnvironmentStrings FreeEnvironmentStringsA +#define lstrcmp lstrcmpA +#define lstrcmpi lstrcmpiA +#define lstrcpyn lstrcpynA +#define lstrcpy lstrcpyA +#define lstrcat lstrcatA +#define lstrlen lstrlenA +#define GetBinaryType GetBinaryTypeA +#define GetShortPathName GetShortPathNameA +#define SetFileSecurity SetFileSecurityA +#define GetFileSecurity GetFileSecurityA +#define FindFirstChangeNotification FindFirstChangeNotificationA +#define AccessCheckAndAuditAlarm AccessCheckAndAuditAlarmA +#define ObjectOpenAuditAlarm ObjectOpenAuditAlarmA +#define ObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmA +#define ObjectCloseAuditAlarm ObjectCloseAuditAlarmA +#define PrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmA +#define OpenEventLog OpenEventLogA +#define RegisterEventSource RegisterEventSourceA +#define OpenBackupEventLog OpenBackupEventLogA +#define ReadEventLog ReadEventLogA +#define ReportEvent ReportEventA +#define CreateProcess CreateProcessA +#define FatalAppExit FatalAppExitA +#define GetStartupInfo GetStartupInfoA +#define GetCommandLine GetCommandLineA +#define GetEnvironmentVariable GetEnvironmentVariableA +#define SetEnvironmentVariable SetEnvironmentVariableA +#define ExpandEnvironmentStrings ExpandEnvironmentStringsA +#define OutputDebugString OutputDebugStringA +#define FindResource FindResourceA +#define FindResourceEx FindResourceExA +#define EnumResourceTypes EnumResourceTypesA +#define EnumResourceNames EnumResourceNamesA +#define EnumResourceLanguages EnumResourceLanguagesA +#define BeginUpdateResource BeginUpdateResourceA +#define UpdateResource UpdateResourceA +#define EndUpdateResource EndUpdateResourceA +#define GlobalAddAtom GlobalAddAtomA +#define GlobalFindAtom GlobalFindAtomA +#define GlobalGetAtomName GlobalGetAtomNameA +#define AddAtom AddAtomA +#define FindAtom FindAtomA +#define GetProfileInt GetProfileIntA +#define GetAtomName GetAtomNameA +#define GetProfileString GetProfileStringA +#define WriteProfileString WriteProfileStringA +#define GetProfileSection GetProfileSectionA +#define WriteProfileSection WriteProfileSectionA +#define GetPrivateProfileInt GetPrivateProfileIntA +#define GetPrivateProfileString GetPrivateProfileStringA +#define WritePrivateProfileString WritePrivateProfileStringA +#define GetPrivateProfileSection GetPrivateProfileSectionA +#define WritePrivateProfileSection WritePrivateProfileSectionA +#define GetDriveType GetDriveTypeA +#define GetSystemDirectory GetSystemDirectoryA +#define GetTempPath GetTempPathA +#define GetTempFileName GetTempFileNameA +#define GetWindowsDirectory GetWindowsDirectoryA +#define SetCurrentDirectory SetCurrentDirectoryA +#define GetCurrentDirectory GetCurrentDirectoryA +#define GetDiskFreeSpace GetDiskFreeSpaceA +#define CreateDirectory CreateDirectoryA +#define CreateDirectoryEx CreateDirectoryExA +#define RemoveDirectory RemoveDirectoryA +#define GetFullPathName GetFullPathNameA +#define DefineDosDevice DefineDosDeviceA +#define QueryDosDevice QueryDosDeviceA +#define CreateFile CreateFileA +#define SetFileAttributes SetFileAttributesA +#define GetFileAttributes GetFileAttributesA +#define GetCompressedFileSize GetCompressedFileSizeA +#define DeleteFile DeleteFileA +#define FindFirstFile FindFirstFileA +#define FindNextFile FindNextFileA +#define SearchPath SearchPathA +#define CopyFile CopyFileA +#define MoveFile MoveFileA +#define MoveFileEx MoveFileExA +#define CreateNamedPipe CreateNamedPipeA +#define GetNamedPipeHandleState GetNamedPipeHandleStateA +#define CallNamedPipe CallNamedPipeA +#define WaitNamedPipe WaitNamedPipeA +#define SetVolumeLabel SetVolumeLabelA +#define GetVolumeInformation GetVolumeInformationA +#define ClearEventLog ClearEventLogA +#define BackupEventLog BackupEventLogA +#define CreateMutex CreateMutexA +#define OpenMutex OpenMutexA +#define CreateEvent CreateEventA +#define OpenEvent OpenEventA +#define CreateSemaphore CreateSemaphoreA +#define OpenSemaphore OpenSemaphoreA +#define CreateFileMapping CreateFileMappingA +#define OpenFileMapping OpenFileMappingA +#define GetLogicalDriveStrings GetLogicalDriveStringsA +#define LoadLibrary LoadLibraryA +#define LoadLibraryEx LoadLibraryExA +#define GetModuleFileName GetModuleFileNameA +#define GetModuleHandle GetModuleHandleA +#define GetUserObjectInformation GetUserObjectInformationA +#define SetUserObjectInformation SetUserObjectInformationA +#define RegisterWindowMessage RegisterWindowMessageA +#define GetMessage GetMessageA +#define DispatchMessage DispatchMessageA +#define PeekMessage PeekMessageA +#define SendMessage SendMessageA +#define SendMessageTimeout SendMessageTimeoutA +#define SendNotifyMessage SendNotifyMessageA +#define SendMessageCallback SendMessageCallbackA +#define PostMessage PostMessageA +#define PostThreadMessage PostThreadMessageA +#define VerFindFile VerFindFileA +#define VerInstallFile VerInstallFileA +#define GetFileVersionInfoSize GetFileVersionInfoSizeA +#define GetFileVersionInfo GetFileVersionInfoA +#define VerLanguageName VerLanguageNameA +#define VerQueryValue VerQueryValueA +#define CompareString CompareStringA +#define LCMapString LCMapStringA +#define GetLocaleInfo GetLocaleInfoA +#define SetLocaleInfo SetLocaleInfoA +#define GetTimeFormat GetTimeFormatA +#define GetDateFormat GetDateFormatA +#define GetNumberFormat GetNumberFormatA +#define GetCurrencyFormat GetCurrencyFormatA +#define EnumCalendarInfo EnumCalendarInfoA +#define EnumTimeFormats EnumTimeFormatsA +#define FoldString FoldStringA +#define EnumSystemCodePages EnumSystemCodePagesA +#define EnumSystemLocales EnumSystemLocalesA +#define GetStringTypeEx GetStringTypeExA +#define EnumDateFormats EnumDateFormatsA +#define GetConsoleTitle GetConsoleTitleA +#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA +#define SetConsoleTitle SetConsoleTitleA +#define ReadConsole ReadConsoleA +#define WriteConsole WriteConsoleA +#define PeekConsoleInput PeekConsoleInputA +#define ReadConsoleInput ReadConsoleInputA +#define WriteConsoleInput WriteConsoleInputA +#define ReadConsoleOutput ReadConsoleOutputA +#define WriteConsoleOutput WriteConsoleOutputA +#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA +#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA +#define FillConsoleOutputCharacter FillConsoleOutputCharacterA +#define MultinetGetConnectionPerformance MultinetGetConnectionPerformanceA +#define WNetGetLastError WNetGetLastErrorA +#define WNetGetProviderName WNetGetProviderNameA +#define WNetGetNetworkInformation WNetGetNetworkInformationA +#define WNetConnectionDialog1 WNetConnectionDialog1A +#define WNetDisconnectDialog1 WNetDisconnectDialog1A +#define WNetOpenEnum WNetOpenEnumA +#define WNetEnumResource WNetEnumResourceA +#define WNetGetUniversalName WNetGetUniversalNameA +#define WNetGetUser WNetGetUserA +#define WNetAddConnection WNetAddConnectionA +#define WNetAddConnection2 WNetAddConnection2A +#define WNetAddConnection3 WNetAddConnection3A +#define WNetCancelConnection WNetCancelConnectionA +#define WNetCancelConnection2 WNetCancelConnection2A +#define WNetGetConnection WNetGetConnectionA +#define WNetUseConnection WNetUseConnectionA +#define WNetSetConnection WNetSetConnectionA +#define OpenService OpenServiceA +#define QueryServiceConfig QueryServiceConfigA +#define QueryServiceLockStatus QueryServiceLockStatusA +#define RegisterServiceCtrlHandler RegisterServiceCtrlHandlerA +#define StartServiceCtrlDispatcher StartServiceCtrlDispatcherA +#define StartService StartServiceA +#define ChangeServiceConfig ChangeServiceConfigA +#define CreateService CreateServiceA +#define EnumDependentServices EnumDependentServicesA +#define EnumServicesStatus EnumServicesStatusA +#define GetServiceKeyName GetServiceKeyNameA +#define GetServiceDisplayName GetServiceDisplayNameA +#define OpenSCManager OpenSCManagerA +#define DragQueryFile DragQueryFileA +#define ExtractAssociatedIcon ExtractAssociatedIconA +#define ExtractIcon ExtractIconA +#define FindExecutable FindExecutableA +#define ShellAbout ShellAboutA +#define ShellExecute ShellExecuteA +#define DdeCreateStringHandle DdeCreateStringHandleA +#define DdeInitialize DdeInitializeA +#define DdeQueryString DdeQueryStringA +#define LogonUser LogonUserA +#define CreateProcessAsUser CreateProcessAsUserA + +#endif /* UNICODE and ASCII defines */ + +WINBOOL STDCALL AbnormalTermination(VOID); +int STDCALL AbortDoc(HDC); +WINBOOL STDCALL AbortPath(HDC); +WINBOOL STDCALL AbortPrinter(HANDLE); +WINBOOL CALLBACK AbortProc(HDC, int); +WINBOOL STDCALL AbortSystemShutdown(LPTSTR); +WINBOOL STDCALL AccessCheck( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + HANDLE ClientToken, + DWORD DesiredAccess, + PGENERIC_MAPPING GenericMapping, + PPRIVILEGE_SET PrivilegeSet, + LPDWORD PrivilegeSetLength, + LPDWORD GrantedAccess, + LPBOOL AccessStatus + ); + +WINBOOL STDCALL AccessCheckAndAuditAlarm( + LPCTSTR SubsystemName, + LPVOID HandleId, + LPTSTR ObjectTypeName, + LPTSTR ObjectName, + PSECURITY_DESCRIPTOR SecurityDescriptor, + DWORD DesiredAccess, + PGENERIC_MAPPING GenericMapping, + WINBOOL ObjectCreation, + LPDWORD GrantedAccess, + LPBOOL AccessStatus, + LPBOOL pfGenerateOnClose + ); + +LONG +STDCALL +InterlockedIncrement( + LPLONG lpAddend + ); + +LONG +STDCALL +InterlockedDecrement( + LPLONG lpAddend + ); + +LONG +STDCALL +InterlockedExchange( + LPLONG Target, + LONG Value + ); + +WINBOOL +STDCALL +FreeResource( + HGLOBAL hResData + ); + +LPVOID +STDCALL +LockResource( + HGLOBAL hResData + ); + +int +STDCALL +WinMain( + HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nShowCmd + ); + +WINBOOL +STDCALL +FreeLibrary( + HINSTANCE hLibModule + ); + + +VOID +STDCALL +FreeLibraryAndExitThread( + HMODULE hLibModule, + DWORD dwExitCode + ); + +WINBOOL +STDCALL +DisableThreadLibraryCalls( + HMODULE hLibModule + ); + +FARPROC +STDCALL +GetProcAddress( + HINSTANCE hModule, + LPCSTR lpProcName + ); + +DWORD +STDCALL +GetVersion( VOID ); + +HGLOBAL +STDCALL +GlobalAlloc( + UINT uFlags, + DWORD dwBytes + ); + +HGLOBAL +GlobalDiscard( + HGLOBAL hglbMem + ); + +HGLOBAL +STDCALL +GlobalReAlloc( + HGLOBAL hMem, + DWORD dwBytes, + UINT uFlags + ); + +DWORD +STDCALL +GlobalSize( + HGLOBAL hMem + ); + +UINT +STDCALL +GlobalFlags( + HGLOBAL hMem + ); + + +LPVOID +STDCALL +GlobalLock( + HGLOBAL hMem + ); + +HGLOBAL +STDCALL +GlobalHandle( + LPCVOID pMem + ); + + +WINBOOL +STDCALL +GlobalUnlock( + HGLOBAL hMem + ); + + +HGLOBAL +STDCALL +GlobalFree( + HGLOBAL hMem + ); + +UINT +STDCALL +GlobalCompact( + DWORD dwMinFree + ); + + +VOID +STDCALL +GlobalFix( + HGLOBAL hMem + ); + + +VOID +STDCALL +GlobalUnfix( + HGLOBAL hMem + ); + + +LPVOID +STDCALL +GlobalWire( + HGLOBAL hMem + ); + + +WINBOOL +STDCALL +GlobalUnWire( + HGLOBAL hMem + ); + + +VOID +STDCALL +GlobalMemoryStatus( + LPMEMORYSTATUS lpBuffer + ); + + +HLOCAL +STDCALL +LocalAlloc( + UINT uFlags, + UINT uBytes + ); + +HLOCAL +LocalDiscard( + HLOCAL hlocMem + ); + +HLOCAL +STDCALL +LocalReAlloc( + HLOCAL hMem, + UINT uBytes, + UINT uFlags + ); + + +LPVOID +STDCALL +LocalLock( + HLOCAL hMem + ); + + +HLOCAL +STDCALL +LocalHandle( + LPCVOID pMem + ); + + +WINBOOL +STDCALL +LocalUnlock( + HLOCAL hMem + ); + + +UINT +STDCALL +LocalSize( + HLOCAL hMem + ); + + +UINT +STDCALL +LocalFlags( + HLOCAL hMem + ); + + +HLOCAL +STDCALL +LocalFree( + HLOCAL hMem + ); + + +UINT +STDCALL +LocalShrink( + HLOCAL hMem, + UINT cbNewSize + ); + + +UINT +STDCALL +LocalCompact( + UINT uMinFree + ); + + +WINBOOL +STDCALL +FlushInstructionCache( + HANDLE hProcess, + LPCVOID lpBaseAddress, + DWORD dwSize + ); + + +LPVOID +STDCALL +VirtualAlloc( + LPVOID lpAddress, + DWORD dwSize, + DWORD flAllocationType, + DWORD flProtect + ); + + +WINBOOL +STDCALL +VirtualFree( + LPVOID lpAddress, + DWORD dwSize, + DWORD dwFreeType + ); + + +WINBOOL +STDCALL +VirtualProtect( + LPVOID lpAddress, + DWORD dwSize, + DWORD flNewProtect, + PDWORD lpflOldProtect + ); + + +DWORD +STDCALL +VirtualQuery( + LPCVOID lpAddress, + PMEMORY_BASIC_INFORMATION lpBuffer, + DWORD dwLength + ); + + +WINBOOL +STDCALL +VirtualProtectEx( + HANDLE hProcess, + LPVOID lpAddress, + DWORD dwSize, + DWORD flNewProtect, + PDWORD lpflOldProtect + ); + + +DWORD +STDCALL +VirtualQueryEx( + HANDLE hProcess, + LPCVOID lpAddress, + PMEMORY_BASIC_INFORMATION lpBuffer, + DWORD dwLength + ); + + +HANDLE +STDCALL +HeapCreate( + DWORD flOptions, + DWORD dwInitialSize, + DWORD dwMaximumSize + ); + +WINBOOL +STDCALL +HeapDestroy( + HANDLE hHeap + ); + +LPVOID +STDCALL +HeapAlloc( + HANDLE hHeap, + DWORD dwFlags, + DWORD dwBytes + ); + +LPVOID +STDCALL +HeapReAlloc( + HANDLE hHeap, + DWORD dwFlags, + LPVOID lpMem, + DWORD dwBytes + ); + +WINBOOL +STDCALL +HeapFree( + HANDLE hHeap, + DWORD dwFlags, + LPVOID lpMem + ); + +DWORD +STDCALL +HeapSize( + HANDLE hHeap, + DWORD dwFlags, + LPCVOID lpMem + ); + +WINBOOL +STDCALL +HeapValidate( + HANDLE hHeap, + DWORD dwFlags, + LPCVOID lpMem + ); + +UINT +STDCALL +HeapCompact( + HANDLE hHeap, + DWORD dwFlags + ); + +HANDLE +STDCALL +GetProcessHeap( VOID ); + +DWORD +STDCALL +GetProcessHeaps( + DWORD NumberOfHeaps, + PHANDLE ProcessHeaps + ); + +WINBOOL +STDCALL +HeapLock( + HANDLE hHeap + ); + +WINBOOL +STDCALL +HeapUnlock( + HANDLE hHeap + ); + +WINBOOL +STDCALL +HeapWalk( + HANDLE hHeap, + LPPROCESS_HEAP_ENTRY lpEntry + ); + +WINBOOL +STDCALL +GetProcessAffinityMask( + HANDLE hProcess, + LPDWORD lpProcessAffinityMask, + LPDWORD lpSystemAffinityMask + ); + +WINBOOL +STDCALL +GetProcessTimes( + HANDLE hProcess, + LPFILETIME lpCreationTime, + LPFILETIME lpExitTime, + LPFILETIME lpKernelTime, + LPFILETIME lpUserTime + ); + +WINBOOL +STDCALL +GetProcessWorkingSetSize( + HANDLE hProcess, + LPDWORD lpMinimumWorkingSetSize, + LPDWORD lpMaximumWorkingSetSize + ); + +WINBOOL +STDCALL +SetProcessWorkingSetSize( + HANDLE hProcess, + DWORD dwMinimumWorkingSetSize, + DWORD dwMaximumWorkingSetSize + ); + +HANDLE +STDCALL +OpenProcess( + DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + DWORD dwProcessId + ); + +HANDLE +STDCALL +GetCurrentProcess( + VOID + ); + +DWORD +STDCALL +GetCurrentProcessId( + VOID + ); + +VOID +STDCALL +ExitProcess( + UINT uExitCode + ) __attribute__ ((noreturn)); + +WINBOOL +STDCALL +TerminateProcess( + HANDLE hProcess, + UINT uExitCode + ); + +WINBOOL +STDCALL +GetExitCodeProcess( + HANDLE hProcess, + LPDWORD lpExitCode + ); + +VOID +STDCALL +FatalExit( + int ExitCode + ); + +VOID +STDCALL +RaiseException( + DWORD dwExceptionCode, + DWORD dwExceptionFlags, + DWORD nNumberOfArguments, + CONST DWORD *lpArguments + ); + +LONG +STDCALL +UnhandledExceptionFilter( + struct _EXCEPTION_POINTERS *ExceptionInfo + ); + +/* + TODO: what is TOP_LEVEL_EXCEPTION_FILTER? +LPTOP_LEVEL_EXCEPTION_FILTER +STDCALL +SetUnhandledExceptionFilter( + LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter + ); +*/ + + +HANDLE +STDCALL +CreateThread( + LPSECURITY_ATTRIBUTES lpThreadAttributes, + DWORD dwStackSize, + LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, + DWORD dwCreationFlags, + LPDWORD lpThreadId + ); + + +HANDLE +STDCALL +CreateRemoteThread( + HANDLE hProcess, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + DWORD dwStackSize, + LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, + DWORD dwCreationFlags, + LPDWORD lpThreadId + ); + + +HANDLE +STDCALL +GetCurrentThread( + VOID + ); + + +DWORD +STDCALL +GetCurrentThreadId( + VOID + ); + + +DWORD +STDCALL +SetThreadAffinityMask( + HANDLE hThread, + DWORD dwThreadAffinityMask + ); + + +WINBOOL +STDCALL +SetThreadPriority( + HANDLE hThread, + int nPriority + ); + + +int +STDCALL +GetThreadPriority( + HANDLE hThread + ); + + +WINBOOL +STDCALL +GetThreadTimes( + HANDLE hThread, + LPFILETIME lpCreationTime, + LPFILETIME lpExitTime, + LPFILETIME lpKernelTime, + LPFILETIME lpUserTime + ); + + +VOID +STDCALL +ExitThread( + DWORD dwExitCode + ); + + +WINBOOL +STDCALL +TerminateThread( + HANDLE hThread, + DWORD dwExitCode + ); + + +WINBOOL +STDCALL +GetExitCodeThread( + HANDLE hThread, + LPDWORD lpExitCode + ); + +WINBOOL +STDCALL +GetThreadSelectorEntry( + HANDLE hThread, + DWORD dwSelector, + LPLDT_ENTRY lpSelectorEntry + ); + + +DWORD +STDCALL +GetLastError( + VOID + ); + + +VOID +STDCALL +SetLastError( + DWORD dwErrCode + ); + + +WINBOOL +STDCALL +GetOverlappedResult( + HANDLE hFile, + LPOVERLAPPED lpOverlapped, + LPDWORD lpNumberOfBytesTransferred, + WINBOOL bWait + ); + + +HANDLE +STDCALL +CreateIoCompletionPort( + HANDLE FileHandle, + HANDLE ExistingCompletionPort, + DWORD CompletionKey, + DWORD NumberOfConcurrentThreads + ); + + +WINBOOL +STDCALL +GetQueuedCompletionStatus( + HANDLE CompletionPort, + LPDWORD lpNumberOfBytesTransferred, + LPDWORD lpCompletionKey, + LPOVERLAPPED *lpOverlapped, + DWORD dwMilliseconds + ); + +UINT +STDCALL +SetErrorMode( + UINT uMode + ); + + +WINBOOL +STDCALL +ReadProcessMemory( + HANDLE hProcess, + LPCVOID lpBaseAddress, + LPVOID lpBuffer, + DWORD nSize, + LPDWORD lpNumberOfBytesRead + ); + + +WINBOOL +STDCALL +WriteProcessMemory( + HANDLE hProcess, + LPVOID lpBaseAddress, + LPVOID lpBuffer, + DWORD nSize, + LPDWORD lpNumberOfBytesWritten + ); + + +WINBOOL +STDCALL +GetThreadContext( + HANDLE hThread, + LPCONTEXT lpContext + ); + + +WINBOOL +STDCALL +SetThreadContext( + HANDLE hThread, + CONST CONTEXT *lpContext + ); + + +DWORD +STDCALL +SuspendThread( + HANDLE hThread + ); + + +DWORD +STDCALL +ResumeThread( + HANDLE hThread + ); + + +VOID +STDCALL +DebugBreak( + VOID + ); + + +WINBOOL +STDCALL +WaitForDebugEvent( + LPDEBUG_EVENT lpDebugEvent, + DWORD dwMilliseconds + ); + + +WINBOOL +STDCALL +ContinueDebugEvent( + DWORD dwProcessId, + DWORD dwThreadId, + DWORD dwContinueStatus + ); + + +WINBOOL +STDCALL +DebugActiveProcess( + DWORD dwProcessId + ); + + +VOID +STDCALL +InitializeCriticalSection( + LPCRITICAL_SECTION lpCriticalSection + ); + + +VOID +STDCALL +EnterCriticalSection( + LPCRITICAL_SECTION lpCriticalSection + ); + + +VOID +STDCALL +LeaveCriticalSection( + LPCRITICAL_SECTION lpCriticalSection + ); + + +VOID +STDCALL +DeleteCriticalSection( + LPCRITICAL_SECTION lpCriticalSection + ); + + +WINBOOL +STDCALL +SetEvent( + HANDLE hEvent + ); + + +WINBOOL +STDCALL +ResetEvent( + HANDLE hEvent + ); + + +WINBOOL +STDCALL +PulseEvent( + HANDLE hEvent + ); + + +WINBOOL +STDCALL +ReleaseSemaphore( + HANDLE hSemaphore, + LONG lReleaseCount, + LPLONG lpPreviousCount + ); + + +WINBOOL +STDCALL +ReleaseMutex( + HANDLE hMutex + ); + + +DWORD +STDCALL +WaitForSingleObject( + HANDLE hHandle, + DWORD dwMilliseconds + ); + + +DWORD +STDCALL +WaitForMultipleObjects( + DWORD nCount, + CONST HANDLE *lpHandles, + WINBOOL bWaitAll, + DWORD dwMilliseconds + ); + + +VOID +STDCALL +Sleep( + DWORD dwMilliseconds + ); + + +HGLOBAL +STDCALL +LoadResource( + HINSTANCE hModule, + HRSRC hResInfo + ); + + +DWORD +STDCALL +SizeofResource( + HINSTANCE hModule, + HRSRC hResInfo + ); + + + +ATOM +STDCALL +GlobalDeleteAtom( + ATOM nAtom + ); + + +WINBOOL +STDCALL +InitAtomTable( + DWORD nSize + ); + + +ATOM +STDCALL +DeleteAtom( + ATOM nAtom + ); + + +UINT +STDCALL +SetHandleCount( + UINT uNumber + ); + + +DWORD +STDCALL +GetLogicalDrives( + VOID + ); + + +WINBOOL +STDCALL +LockFile( + HANDLE hFile, + DWORD dwFileOffsetLow, + DWORD dwFileOffsetHigh, + DWORD nNumberOfBytesToLockLow, + DWORD nNumberOfBytesToLockHigh + ); + + +WINBOOL +STDCALL +UnlockFile( + HANDLE hFile, + DWORD dwFileOffsetLow, + DWORD dwFileOffsetHigh, + DWORD nNumberOfBytesToUnlockLow, + DWORD nNumberOfBytesToUnlockHigh + ); + + +WINBOOL +STDCALL +LockFileEx( + HANDLE hFile, + DWORD dwFlags, + DWORD dwReserved, + DWORD nNumberOfBytesToLockLow, + DWORD nNumberOfBytesToLockHigh, + LPOVERLAPPED lpOverlapped + ); + +WINBOOL +STDCALL +UnlockFileEx( + HANDLE hFile, + DWORD dwReserved, + DWORD nNumberOfBytesToUnlockLow, + DWORD nNumberOfBytesToUnlockHigh, + LPOVERLAPPED lpOverlapped + ); + +WINBOOL +STDCALL +GetFileInformationByHandle( + HANDLE hFile, + LPBY_HANDLE_FILE_INFORMATION lpFileInformation + ); + + +DWORD +STDCALL +GetFileType( + HANDLE hFile + ); + + +DWORD +STDCALL +GetFileSize( + HANDLE hFile, + LPDWORD lpFileSizeHigh + ); + + +HANDLE +STDCALL +GetStdHandle( + DWORD nStdHandle + ); + + +WINBOOL +STDCALL +SetStdHandle( + DWORD nStdHandle, + HANDLE hHandle + ); + + +WINBOOL +STDCALL +WriteFile( + HANDLE hFile, + LPCVOID lpBuffer, + DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, + LPOVERLAPPED lpOverlapped + ); + + +WINBOOL +STDCALL +ReadFile( + HANDLE hFile, + LPVOID lpBuffer, + DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, + LPOVERLAPPED lpOverlapped + ); + + +WINBOOL +STDCALL +FlushFileBuffers( + HANDLE hFile + ); + + +WINBOOL +STDCALL +DeviceIoControl( + HANDLE hDevice, + DWORD dwIoControlCode, + LPVOID lpInBuffer, + DWORD nInBufferSize, + LPVOID lpOutBuffer, + DWORD nOutBufferSize, + LPDWORD lpBytesReturned, + LPOVERLAPPED lpOverlapped + ); + + +WINBOOL +STDCALL +SetEndOfFile( + HANDLE hFile + ); + + +DWORD +STDCALL +SetFilePointer( + HANDLE hFile, + LONG lDistanceToMove, + PLONG lpDistanceToMoveHigh, + DWORD dwMoveMethod + ); + + +WINBOOL +STDCALL +FindClose( + HANDLE hFindFile + ); + + +WINBOOL +STDCALL +GetFileTime( + HANDLE hFile, + LPFILETIME lpCreationTime, + LPFILETIME lpLastAccessTime, + LPFILETIME lpLastWriteTime + ); + + +WINBOOL +STDCALL +SetFileTime( + HANDLE hFile, + CONST FILETIME *lpCreationTime, + CONST FILETIME *lpLastAccessTime, + CONST FILETIME *lpLastWriteTime + ); + + +WINBOOL +STDCALL +CloseHandle( + HANDLE hObject + ); + + +WINBOOL +STDCALL +DuplicateHandle( + HANDLE hSourceProcessHandle, + HANDLE hSourceHandle, + HANDLE hTargetProcessHandle, + LPHANDLE lpTargetHandle, + DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + DWORD dwOptions + ); + + +WINBOOL +STDCALL +GetHandleInformation( + HANDLE hObject, + LPDWORD lpdwFlags + ); + + +WINBOOL +STDCALL +SetHandleInformation( + HANDLE hObject, + DWORD dwMask, + DWORD dwFlags + ); + +DWORD +STDCALL +LoadModule( + LPCSTR lpModuleName, + LPVOID lpParameterBlock + ); + + +UINT +STDCALL +WinExec( + LPCSTR lpCmdLine, + UINT uCmdShow + ); + + +WINBOOL +STDCALL +ClearCommBreak( + HANDLE hFile + ); + + +WINBOOL +STDCALL +ClearCommError( + HANDLE hFile, + LPDWORD lpErrors, + LPCOMSTAT lpStat + ); + + +WINBOOL +STDCALL +SetupComm( + HANDLE hFile, + DWORD dwInQueue, + DWORD dwOutQueue + ); + + +WINBOOL +STDCALL +EscapeCommFunction( + HANDLE hFile, + DWORD dwFunc + ); + + +WINBOOL +STDCALL +GetCommConfig( + HANDLE hCommDev, + LPCOMMCONFIG lpCC, + LPDWORD lpdwSize + ); + + +WINBOOL +STDCALL +GetCommMask( + HANDLE hFile, + LPDWORD lpEvtMask + ); + + +WINBOOL +STDCALL +GetCommProperties( + HANDLE hFile, + LPCOMMPROP lpCommProp + ); + + +WINBOOL +STDCALL +GetCommModemStatus( + HANDLE hFile, + LPDWORD lpModemStat + ); + + +WINBOOL +STDCALL +GetCommState( + HANDLE hFile, + LPDCB lpDCB + ); + + +WINBOOL +STDCALL +GetCommTimeouts( + HANDLE hFile, + LPCOMMTIMEOUTS lpCommTimeouts + ); + + +WINBOOL +STDCALL +PurgeComm( + HANDLE hFile, + DWORD dwFlags + ); + + +WINBOOL +STDCALL +SetCommBreak( + HANDLE hFile + ); + + +WINBOOL +STDCALL +SetCommConfig( + HANDLE hCommDev, + LPCOMMCONFIG lpCC, + DWORD dwSize + ); + + +WINBOOL +STDCALL +SetCommMask( + HANDLE hFile, + DWORD dwEvtMask + ); + + +WINBOOL +STDCALL +SetCommState( + HANDLE hFile, + LPDCB lpDCB + ); + + +WINBOOL +STDCALL +SetCommTimeouts( + HANDLE hFile, + LPCOMMTIMEOUTS lpCommTimeouts + ); + + +WINBOOL +STDCALL +TransmitCommChar( + HANDLE hFile, + char cChar + ); + + +WINBOOL +STDCALL +WaitCommEvent( + HANDLE hFile, + LPDWORD lpEvtMask, + LPOVERLAPPED lpOverlapped + ); + + + +DWORD +STDCALL +SetTapePosition( + HANDLE hDevice, + DWORD dwPositionMethod, + DWORD dwPartition, + DWORD dwOffsetLow, + DWORD dwOffsetHigh, + WINBOOL bImmediate + ); + + +DWORD +STDCALL +GetTapePosition( + HANDLE hDevice, + DWORD dwPositionType, + LPDWORD lpdwPartition, + LPDWORD lpdwOffsetLow, + LPDWORD lpdwOffsetHigh + ); + + +DWORD +STDCALL +PrepareTape( + HANDLE hDevice, + DWORD dwOperation, + WINBOOL bImmediate + ); + + +DWORD +STDCALL +EraseTape( + HANDLE hDevice, + DWORD dwEraseType, + WINBOOL bImmediate + ); + + +DWORD +STDCALL +CreateTapePartition( + HANDLE hDevice, + DWORD dwPartitionMethod, + DWORD dwCount, + DWORD dwSize + ); + + +DWORD +STDCALL +WriteTapemark( + HANDLE hDevice, + DWORD dwTapemarkType, + DWORD dwTapemarkCount, + WINBOOL bImmediate + ); + + +DWORD +STDCALL +GetTapeStatus( + HANDLE hDevice + ); + + +DWORD +STDCALL +GetTapeParameters( + HANDLE hDevice, + DWORD dwOperation, + LPDWORD lpdwSize, + LPVOID lpTapeInformation + ); + +DWORD +STDCALL +SetTapeParameters( + HANDLE hDevice, + DWORD dwOperation, + LPVOID lpTapeInformation + ); + +WINBOOL +STDCALL +Beep( + DWORD dwFreq, + DWORD dwDuration + ); + + +VOID +STDCALL +OpenSound( + VOID + ); + + +VOID +STDCALL +CloseSound( + VOID + ); + + +VOID +STDCALL +StartSound( + VOID + ); + + +VOID +STDCALL +StopSound( + VOID + ); + + +DWORD +STDCALL +WaitSoundState( + DWORD nState + ); + + +DWORD +STDCALL +SyncAllVoices( + VOID + ); + + +DWORD +STDCALL +CountVoiceNotes( + DWORD nVoice + ); + + +LPDWORD +STDCALL +GetThresholdEvent( + VOID + ); + + +DWORD +STDCALL +GetThresholdStatus( + VOID + ); + + +DWORD +STDCALL +SetSoundNoise( + DWORD nSource, + DWORD nDuration + ); + + +DWORD +STDCALL +SetVoiceAccent( + DWORD nVoice, + DWORD nTempo, + DWORD nVolume, + DWORD nMode, + DWORD nPitch + ); + + +DWORD +STDCALL +SetVoiceEnvelope( + DWORD nVoice, + DWORD nShape, + DWORD nRepeat + ); + + +DWORD +STDCALL +SetVoiceNote( + DWORD nVoice, + DWORD nValue, + DWORD nLength, + DWORD nCdots + ); + + +DWORD +STDCALL +SetVoiceQueueSize( + DWORD nVoice, + DWORD nBytes + ); + + +DWORD +STDCALL +SetVoiceSound( + DWORD nVoice, + DWORD Frequency, + DWORD nDuration + ); + + +DWORD +STDCALL +SetVoiceThreshold( + DWORD nVoice, + DWORD nNotes + ); + + +int +STDCALL +MulDiv( + int nNumber, + int nNumerator, + int nDenominator + ); + + +VOID +STDCALL +GetSystemTime( + LPSYSTEMTIME lpSystemTime + ); + + +WINBOOL +STDCALL +SetSystemTime( + CONST SYSTEMTIME *lpSystemTime + ); + + +VOID +STDCALL +GetLocalTime( + LPSYSTEMTIME lpSystemTime + ); + + +WINBOOL +STDCALL +SetLocalTime( + CONST SYSTEMTIME *lpSystemTime + ); + + +VOID +STDCALL +GetSystemInfo( + LPSYSTEM_INFO lpSystemInfo + ); + +WINBOOL +STDCALL +SystemTimeToTzSpecificLocalTime( + LPTIME_ZONE_INFORMATION lpTimeZoneInformation, + LPSYSTEMTIME lpUniversalTime, + LPSYSTEMTIME lpLocalTime + ); + + +DWORD +STDCALL +GetTimeZoneInformation( + LPTIME_ZONE_INFORMATION lpTimeZoneInformation + ); + + +WINBOOL +STDCALL +SetTimeZoneInformation( + CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation + ); + +WINBOOL +STDCALL +SystemTimeToFileTime( + CONST SYSTEMTIME *lpSystemTime, + LPFILETIME lpFileTime + ); + + +WINBOOL +STDCALL +FileTimeToLocalFileTime( + CONST FILETIME *lpFileTime, + LPFILETIME lpLocalFileTime + ); + + +WINBOOL +STDCALL +LocalFileTimeToFileTime( + CONST FILETIME *lpLocalFileTime, + LPFILETIME lpFileTime + ); + + +WINBOOL +STDCALL +FileTimeToSystemTime( + CONST FILETIME *lpFileTime, + LPSYSTEMTIME lpSystemTime + ); + + +LONG +STDCALL +CompareFileTime( + CONST FILETIME *lpFileTime1, + CONST FILETIME *lpFileTime2 + ); + + +WINBOOL +STDCALL +FileTimeToDosDateTime( + CONST FILETIME *lpFileTime, + LPWORD lpFatDate, + LPWORD lpFatTime + ); + + +WINBOOL +STDCALL +DosDateTimeToFileTime( + WORD wFatDate, + WORD wFatTime, + LPFILETIME lpFileTime + ); + + +DWORD +STDCALL +GetTickCount( + VOID + ); + + +WINBOOL +STDCALL +SetSystemTimeAdjustment( + DWORD dwTimeAdjustment, + WINBOOL bTimeAdjustmentDisabled + ); + + +WINBOOL +STDCALL +GetSystemTimeAdjustment( + PDWORD lpTimeAdjustment, + PDWORD lpTimeIncrement, + PWINBOOL lpTimeAdjustmentDisabled + ); + + +WINBOOL +STDCALL +CreatePipe( + PHANDLE hReadPipe, + PHANDLE hWritePipe, + LPSECURITY_ATTRIBUTES lpPipeAttributes, + DWORD nSize + ); + + +WINBOOL +STDCALL +ConnectNamedPipe( + HANDLE hNamedPipe, + LPOVERLAPPED lpOverlapped + ); + + +WINBOOL +STDCALL +DisconnectNamedPipe( + HANDLE hNamedPipe + ); + + +WINBOOL +STDCALL +SetNamedPipeHandleState( + HANDLE hNamedPipe, + LPDWORD lpMode, + LPDWORD lpMaxCollectionCount, + LPDWORD lpCollectDataTimeout + ); + + +WINBOOL +STDCALL +GetNamedPipeInfo( + HANDLE hNamedPipe, + LPDWORD lpFlags, + LPDWORD lpOutBufferSize, + LPDWORD lpInBufferSize, + LPDWORD lpMaxInstances + ); + + +WINBOOL +STDCALL +PeekNamedPipe( + HANDLE hNamedPipe, + LPVOID lpBuffer, + DWORD nBufferSize, + LPDWORD lpBytesRead, + LPDWORD lpTotalBytesAvail, + LPDWORD lpBytesLeftThisMessage + ); + + +WINBOOL +STDCALL +TransactNamedPipe( + HANDLE hNamedPipe, + LPVOID lpInBuffer, + DWORD nInBufferSize, + LPVOID lpOutBuffer, + DWORD nOutBufferSize, + LPDWORD lpBytesRead, + LPOVERLAPPED lpOverlapped + ); + + + +WINBOOL +STDCALL +GetMailslotInfo( + HANDLE hMailslot, + LPDWORD lpMaxMessageSize, + LPDWORD lpNextSize, + LPDWORD lpMessageCount, + LPDWORD lpReadTimeout + ); + + +WINBOOL +STDCALL +SetMailslotInfo( + HANDLE hMailslot, + DWORD lReadTimeout + ); + + +LPVOID +STDCALL +MapViewOfFile( + HANDLE hFileMappingObject, + DWORD dwDesiredAccess, + DWORD dwFileOffsetHigh, + DWORD dwFileOffsetLow, + DWORD dwNumberOfBytesToMap + ); + + +WINBOOL +STDCALL +FlushViewOfFile( + LPCVOID lpBaseAddress, + DWORD dwNumberOfBytesToFlush + ); + + +WINBOOL +STDCALL +UnmapViewOfFile( + LPVOID lpBaseAddress + ); + +HFILE +STDCALL +OpenFile( + LPCSTR lpFileName, + LPOFSTRUCT lpReOpenBuff, + UINT uStyle + ); + + +HFILE +STDCALL +_lopen( + LPCSTR lpPathName, + int iReadWrite + ); + + +HFILE +STDCALL +_lcreat( + LPCSTR lpPathName, + int iAttribute + ); + + +UINT +STDCALL +_lread( + HFILE hFile, + LPVOID lpBuffer, + UINT uBytes + ); + + +UINT +STDCALL +_lwrite( + HFILE hFile, + LPCSTR lpBuffer, + UINT uBytes + ); + + +long +STDCALL +_hread( + HFILE hFile, + LPVOID lpBuffer, + long lBytes + ); + + +long +STDCALL +_hwrite( + HFILE hFile, + LPCSTR lpBuffer, + long lBytes + ); + + +HFILE +STDCALL +_lclose( + HFILE hFile + ); + + +LONG +STDCALL +_llseek( + HFILE hFile, + LONG lOffset, + int iOrigin + ); + + +WINBOOL +STDCALL +IsTextUnicode( + CONST LPVOID lpBuffer, + int cb, + LPINT lpi + ); + + +DWORD +STDCALL +TlsAlloc( + VOID + ); + +LPVOID +STDCALL +TlsGetValue( + DWORD dwTlsIndex + ); + + +WINBOOL +STDCALL +TlsSetValue( + DWORD dwTlsIndex, + LPVOID lpTlsValue + ); + + +WINBOOL +STDCALL +TlsFree( + DWORD dwTlsIndex + ); + +DWORD +STDCALL +SleepEx( + DWORD dwMilliseconds, + WINBOOL bAlertable + ); + + +DWORD +STDCALL +WaitForSingleObjectEx( + HANDLE hHandle, + DWORD dwMilliseconds, + WINBOOL bAlertable + ); + + +DWORD +STDCALL +WaitForMultipleObjectsEx( + DWORD nCount, + CONST HANDLE *lpHandles, + WINBOOL bWaitAll, + DWORD dwMilliseconds, + WINBOOL bAlertable + ); + + +WINBOOL +STDCALL +ReadFileEx( + HANDLE hFile, + LPVOID lpBuffer, + DWORD nNumberOfBytesToRead, + LPOVERLAPPED lpOverlapped, + LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine + ); + + +WINBOOL +STDCALL +WriteFileEx( + HANDLE hFile, + LPCVOID lpBuffer, + DWORD nNumberOfBytesToWrite, + LPOVERLAPPED lpOverlapped, + LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine + ); + + +WINBOOL +STDCALL +BackupRead( + HANDLE hFile, + LPBYTE lpBuffer, + DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, + WINBOOL bAbort, + WINBOOL bProcessSecurity, + LPVOID *lpContext + ); + + +WINBOOL +STDCALL +BackupSeek( + HANDLE hFile, + DWORD dwLowBytesToSeek, + DWORD dwHighBytesToSeek, + LPDWORD lpdwLowByteSeeked, + LPDWORD lpdwHighByteSeeked, + LPVOID *lpContext + ); + + +WINBOOL +STDCALL +BackupWrite( + HANDLE hFile, + LPBYTE lpBuffer, + DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, + WINBOOL bAbort, + WINBOOL bProcessSecurity, + LPVOID *lpContext + ); + +WINBOOL +STDCALL +SetProcessShutdownParameters( + DWORD dwLevel, + DWORD dwFlags + ); + + +WINBOOL +STDCALL +GetProcessShutdownParameters( + LPDWORD lpdwLevel, + LPDWORD lpdwFlags + ); + + +VOID +STDCALL +SetFileApisToOEM( VOID ); + + +VOID +STDCALL +SetFileApisToANSI( VOID ); + + +WINBOOL +STDCALL +AreFileApisANSI( VOID ); + +WINBOOL +STDCALL +CloseEventLog ( + HANDLE hEventLog + ); + + +WINBOOL +STDCALL +DeregisterEventSource ( + HANDLE hEventLog + ); + + +WINBOOL +STDCALL +NotifyChangeEventLog ( + HANDLE hEventLog, + HANDLE hEvent + ); + + +WINBOOL +STDCALL +GetNumberOfEventLogRecords ( + HANDLE hEventLog, + PDWORD NumberOfRecords + ); + + +WINBOOL +STDCALL +GetOldestEventLogRecord ( + HANDLE hEventLog, + PDWORD OldestRecord + ); + +WINBOOL +STDCALL +DuplicateToken( + HANDLE ExistingTokenHandle, + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, + PHANDLE DuplicateTokenHandle + ); + + +WINBOOL +STDCALL +GetKernelObjectSecurity ( + HANDLE Handle, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded + ); + + +WINBOOL +STDCALL +ImpersonateNamedPipeClient( + HANDLE hNamedPipe + ); + + +WINBOOL +STDCALL +ImpersonateLoggedOnUser( + HANDLE hToken + ); + + +WINBOOL +STDCALL +ImpersonateSelf( + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel + ); + + + +WINBOOL +STDCALL +RevertToSelf ( + VOID + ); + + +WINBOOL +STDCALL +SetThreadToken ( + PHANDLE Thread, + HANDLE Token + ); + + +WINBOOL +STDCALL +AccessCheck ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + HANDLE ClientToken, + DWORD DesiredAccess, + PGENERIC_MAPPING GenericMapping, + PPRIVILEGE_SET PrivilegeSet, + LPDWORD PrivilegeSetLength, + LPDWORD GrantedAccess, + LPBOOL AccessStatus + ); + + + +WINBOOL +STDCALL +OpenProcessToken ( + HANDLE ProcessHandle, + DWORD DesiredAccess, + PHANDLE TokenHandle + ); + + + +WINBOOL +STDCALL +OpenThreadToken ( + HANDLE ThreadHandle, + DWORD DesiredAccess, + WINBOOL OpenAsSelf, + PHANDLE TokenHandle + ); + + + +WINBOOL +STDCALL +GetTokenInformation ( + HANDLE TokenHandle, + TOKEN_INFORMATION_CLASS TokenInformationClass, + LPVOID TokenInformation, + DWORD TokenInformationLength, + PDWORD ReturnLength + ); + + + +WINBOOL +STDCALL +SetTokenInformation ( + HANDLE TokenHandle, + TOKEN_INFORMATION_CLASS TokenInformationClass, + LPVOID TokenInformation, + DWORD TokenInformationLength + ); + + + +WINBOOL +STDCALL +AdjustTokenPrivileges ( + HANDLE TokenHandle, + WINBOOL DisableAllPrivileges, + PTOKEN_PRIVILEGES NewState, + DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, + PDWORD ReturnLength + ); + + + +WINBOOL +STDCALL +AdjustTokenGroups ( + HANDLE TokenHandle, + WINBOOL ResetToDefault, + PTOKEN_GROUPS NewState, + DWORD BufferLength, + PTOKEN_GROUPS PreviousState, + PDWORD ReturnLength + ); + + + +WINBOOL +STDCALL +PrivilegeCheck ( + HANDLE ClientToken, + PPRIVILEGE_SET RequiredPrivileges, + LPBOOL pfResult + ); + + + +WINBOOL +STDCALL +IsValidSid ( + PSID pSid + ); + + + +WINBOOL +STDCALL +EqualSid ( + PSID pSid1, + PSID pSid2 + ); + + + +WINBOOL +STDCALL +EqualPrefixSid ( + PSID pSid1, + PSID pSid2 + ); + + + +DWORD +STDCALL +GetSidLengthRequired ( + UCHAR nSubAuthorityCount + ); + + + +WINBOOL +STDCALL +AllocateAndInitializeSid ( + PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, + BYTE nSubAuthorityCount, + DWORD nSubAuthority0, + DWORD nSubAuthority1, + DWORD nSubAuthority2, + DWORD nSubAuthority3, + DWORD nSubAuthority4, + DWORD nSubAuthority5, + DWORD nSubAuthority6, + DWORD nSubAuthority7, + PSID *pSid + ); + + +PVOID +STDCALL +FreeSid( + PSID pSid + ); + + +WINBOOL +STDCALL +InitializeSid ( + PSID Sid, + PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, + BYTE nSubAuthorityCount + ); + + + +PSID_IDENTIFIER_AUTHORITY +STDCALL +GetSidIdentifierAuthority ( + PSID pSid + ); + + + +PDWORD +STDCALL +GetSidSubAuthority ( + PSID pSid, + DWORD nSubAuthority + ); + + + +PUCHAR +STDCALL +GetSidSubAuthorityCount ( + PSID pSid + ); + + + +DWORD +STDCALL +GetLengthSid ( + PSID pSid + ); + + + +WINBOOL +STDCALL +CopySid ( + DWORD nDestinationSidLength, + PSID pDestinationSid, + PSID pSourceSid + ); + + + +WINBOOL +STDCALL +AreAllAccessesGranted ( + DWORD GrantedAccess, + DWORD DesiredAccess + ); + + + +WINBOOL +STDCALL +AreAnyAccessesGranted ( + DWORD GrantedAccess, + DWORD DesiredAccess + ); + + + +VOID +STDCALL +MapGenericMask ( + PDWORD AccessMask, + PGENERIC_MAPPING GenericMapping + ); + + + +WINBOOL +STDCALL +IsValidAcl ( + PACL pAcl + ); + + + +WINBOOL +STDCALL +InitializeAcl ( + PACL pAcl, + DWORD nAclLength, + DWORD dwAclRevision + ); + + + +WINBOOL +STDCALL +GetAclInformation ( + PACL pAcl, + LPVOID pAclInformation, + DWORD nAclInformationLength, + ACL_INFORMATION_CLASS dwAclInformationClass + ); + + + +WINBOOL +STDCALL +SetAclInformation ( + PACL pAcl, + LPVOID pAclInformation, + DWORD nAclInformationLength, + ACL_INFORMATION_CLASS dwAclInformationClass + ); + + + +WINBOOL +STDCALL +AddAce ( + PACL pAcl, + DWORD dwAceRevision, + DWORD dwStartingAceIndex, + LPVOID pAceList, + DWORD nAceListLength + ); + + + +WINBOOL +STDCALL +DeleteAce ( + PACL pAcl, + DWORD dwAceIndex + ); + + + +WINBOOL +STDCALL +GetAce ( + PACL pAcl, + DWORD dwAceIndex, + LPVOID *pAce + ); + + + +WINBOOL +STDCALL +AddAccessAllowedAce ( + PACL pAcl, + DWORD dwAceRevision, + DWORD AccessMask, + PSID pSid + ); + + + +WINBOOL +STDCALL +AddAccessDeniedAce ( + PACL pAcl, + DWORD dwAceRevision, + DWORD AccessMask, + PSID pSid + ); + + + +WINBOOL +STDCALL +AddAuditAccessAce( + PACL pAcl, + DWORD dwAceRevision, + DWORD dwAccessMask, + PSID pSid, + WINBOOL bAuditSuccess, + WINBOOL bAuditFailure + ); + + + +WINBOOL +STDCALL +FindFirstFreeAce ( + PACL pAcl, + LPVOID *pAce + ); + + + +WINBOOL +STDCALL +InitializeSecurityDescriptor ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD dwRevision + ); + + + +WINBOOL +STDCALL +IsValidSecurityDescriptor ( + PSECURITY_DESCRIPTOR pSecurityDescriptor + ); + + + +DWORD +STDCALL +GetSecurityDescriptorLength ( + PSECURITY_DESCRIPTOR pSecurityDescriptor + ); + + + +WINBOOL +STDCALL +GetSecurityDescriptorControl ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSECURITY_DESCRIPTOR_CONTROL pControl, + LPDWORD lpdwRevision + ); + + + +WINBOOL +STDCALL +SetSecurityDescriptorDacl ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + WINBOOL bDaclPresent, + PACL pDacl, + WINBOOL bDaclDefaulted + ); + + + +WINBOOL +STDCALL +GetSecurityDescriptorDacl ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + LPBOOL lpbDaclPresent, + PACL *pDacl, + LPBOOL lpbDaclDefaulted + ); + + + +WINBOOL +STDCALL +SetSecurityDescriptorSacl ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + WINBOOL bSaclPresent, + PACL pSacl, + WINBOOL bSaclDefaulted + ); + + + +WINBOOL +STDCALL +GetSecurityDescriptorSacl ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + LPBOOL lpbSaclPresent, + PACL *pSacl, + LPBOOL lpbSaclDefaulted + ); + + + +WINBOOL +STDCALL +SetSecurityDescriptorOwner ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSID pOwner, + WINBOOL bOwnerDefaulted + ); + + + +WINBOOL +STDCALL +GetSecurityDescriptorOwner ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSID *pOwner, + LPBOOL lpbOwnerDefaulted + ); + + + +WINBOOL +STDCALL +SetSecurityDescriptorGroup ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSID pGroup, + WINBOOL bGroupDefaulted + ); + + + +WINBOOL +STDCALL +GetSecurityDescriptorGroup ( + PSECURITY_DESCRIPTOR pSecurityDescriptor, + PSID *pGroup, + LPBOOL lpbGroupDefaulted + ); + + + +WINBOOL +STDCALL +CreatePrivateObjectSecurity ( + PSECURITY_DESCRIPTOR ParentDescriptor, + PSECURITY_DESCRIPTOR CreatorDescriptor, + PSECURITY_DESCRIPTOR * NewDescriptor, + WINBOOL IsDirectoryObject, + HANDLE Token, + PGENERIC_MAPPING GenericMapping + ); + + + +WINBOOL +STDCALL +SetPrivateObjectSecurity ( + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR ModificationDescriptor, + PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor, + PGENERIC_MAPPING GenericMapping, + HANDLE Token + ); + + + +WINBOOL +STDCALL +GetPrivateObjectSecurity ( + PSECURITY_DESCRIPTOR ObjectDescriptor, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR ResultantDescriptor, + DWORD DescriptorLength, + PDWORD ReturnLength + ); + + + +WINBOOL +STDCALL +DestroyPrivateObjectSecurity ( + PSECURITY_DESCRIPTOR * ObjectDescriptor + ); + + + +WINBOOL +STDCALL +MakeSelfRelativeSD ( + PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, + PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, + LPDWORD lpdwBufferLength + ); + + + +WINBOOL +STDCALL +MakeAbsoluteSD ( + PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, + PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, + LPDWORD lpdwAbsoluteSecurityDescriptorSize, + PACL pDacl, + LPDWORD lpdwDaclSize, + PACL pSacl, + LPDWORD lpdwSaclSize, + PSID pOwner, + LPDWORD lpdwOwnerSize, + PSID pPrimaryGroup, + LPDWORD lpdwPrimaryGroupSize + ); + + + +WINBOOL +STDCALL +SetKernelObjectSecurity ( + HANDLE Handle, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR SecurityDescriptor + ); + + +WINBOOL +STDCALL +FindNextChangeNotification( + HANDLE hChangeHandle + ); + + +WINBOOL +STDCALL +FindCloseChangeNotification( + HANDLE hChangeHandle + ); + + +WINBOOL +STDCALL +VirtualLock( + LPVOID lpAddress, + DWORD dwSize + ); + + +WINBOOL +STDCALL +VirtualUnlock( + LPVOID lpAddress, + DWORD dwSize + ); + + +LPVOID +STDCALL +MapViewOfFileEx( + HANDLE hFileMappingObject, + DWORD dwDesiredAccess, + DWORD dwFileOffsetHigh, + DWORD dwFileOffsetLow, + DWORD dwNumberOfBytesToMap, + LPVOID lpBaseAddress + ); + + +WINBOOL +STDCALL +SetPriorityClass( + HANDLE hProcess, + DWORD dwPriorityClass + ); + + +DWORD +STDCALL +GetPriorityClass( + HANDLE hProcess + ); + + +WINBOOL +STDCALL +IsBadReadPtr( + CONST VOID *lp, + UINT ucb + ); + + +WINBOOL +STDCALL +IsBadWritePtr( + LPVOID lp, + UINT ucb + ); + + +WINBOOL +STDCALL +IsBadHugeReadPtr( + CONST VOID *lp, + UINT ucb + ); + + +WINBOOL +STDCALL +IsBadHugeWritePtr( + LPVOID lp, + UINT ucb + ); + + +WINBOOL +STDCALL +IsBadCodePtr( + FARPROC lpfn + ); + +WINBOOL +STDCALL +AllocateLocallyUniqueId( + PLUID Luid + ); + + +WINBOOL +STDCALL +QueryPerformanceCounter( + LARGE_INTEGER *lpPerformanceCount + ); + + +WINBOOL +STDCALL +QueryPerformanceFrequency( + LARGE_INTEGER *lpFrequency + ); + +VOID +STDCALL +MoveMemory ( + PVOID Destination, + CONST VOID *Source, + DWORD Length + ); + +VOID +STDCALL +FillMemory ( + PVOID Destination, + DWORD Length, + BYTE Fill + ); + +VOID +STDCALL +ZeroMemory ( + PVOID Destination, + DWORD Length + ); + +/* The memory functions don't seem to be defined in the libraries, so + define macro versions as well. */ +#define MoveMemory(t, s, c) memmove ((t), (s), (c)) +#define FillMemory(p, c, v) memset ((p), (v), (c)) +#define ZeroMemory(p, c) memset ((p), 0, (c)) + +#ifdef WIN95 +HKL +STDCALL +ActivateKeyboardLayout( + HKL hkl, + UINT Flags); +#else +WINBOOL +STDCALL +ActivateKeyboardLayout( + HKL hkl, + UINT Flags); +#endif /* WIN95 */ + + +int +STDCALL +ToUnicodeEx( + UINT wVirtKey, + UINT wScanCode, + PBYTE lpKeyState, + LPWSTR pwszBuff, + int cchBuff, + UINT wFlags, + HKL dwhkl); + + +WINBOOL +STDCALL +UnloadKeyboardLayout( + HKL hkl); + + +int +STDCALL +GetKeyboardLayoutList( + int nBuff, + HKL *lpList); + + +HKL +STDCALL +GetKeyboardLayout( + DWORD dwLayout + ); + + +HDESK +STDCALL +OpenInputDesktop( + DWORD dwFlags, + WINBOOL fInherit, + DWORD dwDesiredAccess); + +WINBOOL +STDCALL +EnumDesktopWindows( + HDESK hDesktop, + ENUMWINDOWSPROC lpfn, + LPARAM lParam); + + +WINBOOL +STDCALL +SwitchDesktop( + HDESK hDesktop); + + +WINBOOL +STDCALL +SetThreadDesktop( + HDESK hDesktop); + + +WINBOOL +STDCALL +CloseDesktop( + HDESK hDesktop); + + +HDESK +STDCALL +GetThreadDesktop( + DWORD dwThreadId); + + +WINBOOL +STDCALL +CloseWindowStation( + HWINSTA hWinSta); + + +WINBOOL +STDCALL +SetProcessWindowStation( + HWINSTA hWinSta); + + +HWINSTA +STDCALL +GetProcessWindowStation( + VOID); + + +WINBOOL +STDCALL +SetUserObjectSecurity( + HANDLE hObj, + PSECURITY_INFORMATION pSIRequested, + PSECURITY_DESCRIPTOR pSID); + + +WINBOOL +STDCALL +GetUserObjectSecurity( + HANDLE hObj, + PSECURITY_INFORMATION pSIRequested, + PSECURITY_DESCRIPTOR pSID, + DWORD nLength, + LPDWORD lpnLengthNeeded); + + +WINBOOL +STDCALL +TranslateMessage( + CONST MSG *lpMsg); + +WINBOOL +STDCALL +SetMessageQueue( + int cMessagesMax); + +WINBOOL +STDCALL +RegisterHotKey( + HWND hWnd , + int anID, + UINT fsModifiers, + UINT vk); + + +WINBOOL +STDCALL +UnregisterHotKey( + HWND hWnd, + int anID); + + +WINBOOL +STDCALL +ExitWindowsEx( + UINT uFlags, + DWORD dwReserved); + + +WINBOOL +STDCALL +SwapMouseButton( + WINBOOL fSwap); + + +DWORD +STDCALL +GetMessagePos( + VOID); + + +LONG +STDCALL +GetMessageTime( + VOID); + + +LONG +STDCALL +GetMessageExtraInfo( + VOID); + + +LPARAM +STDCALL +SetMessageExtraInfo( + LPARAM lParam); + + +long +STDCALL +BroadcastSystemMessage( + DWORD, + LPDWORD, + UINT, + WPARAM, + LPARAM); + +WINBOOL +STDCALL +AttachThreadInput( + DWORD idAttach, + DWORD idAttachTo, + WINBOOL fAttach); + + +WINBOOL +STDCALL +ReplyMessage( + LRESULT lResult); + + +WINBOOL +STDCALL +WaitMessage( + VOID); + + +DWORD +STDCALL +WaitForInputIdle( + HANDLE hProcess, + DWORD dwMilliseconds); + + +VOID +STDCALL +PostQuitMessage( + int nExitCode); + +WINBOOL +STDCALL +InSendMessage( + VOID); + + +UINT +STDCALL +GetDoubleClickTime( + VOID); + + +WINBOOL +STDCALL +SetDoubleClickTime( + UINT); + + +WINBOOL +STDCALL +IsWindow( + HWND hWnd); + + +WINBOOL +STDCALL +IsMenu( + HMENU hMenu); + + +WINBOOL +STDCALL +IsChild( + HWND hWndParent, + HWND hWnd); + + +WINBOOL +STDCALL +DestroyWindow( + HWND hWnd); + + +WINBOOL +STDCALL +ShowWindow( + HWND hWnd, + int nCmdShow); + + +WINBOOL +STDCALL +ShowWindowAsync( + HWND hWnd, + int nCmdShow); + + +WINBOOL +STDCALL +FlashWindow( + HWND hWnd, + WINBOOL bInvert); + + +WINBOOL +STDCALL +ShowOwnedPopups( + HWND hWnd, + WINBOOL fShow); + + +WINBOOL +STDCALL +OpenIcon( + HWND hWnd); + + +WINBOOL +STDCALL +CloseWindow( + HWND hWnd); + + +WINBOOL +STDCALL +MoveWindow( + HWND hWnd, + int X, + int Y, + int nWidth, + int nHeight, + WINBOOL bRepaint); + + +WINBOOL +STDCALL +SetWindowPos( + HWND hWnd, + HWND hWndInsertAfter , + int X, + int Y, + int cx, + int cy, + UINT uFlags); + + +WINBOOL +STDCALL +GetWindowPlacement( + HWND hWnd, + WINDOWPLACEMENT *lpwndpl); + + +WINBOOL +STDCALL +SetWindowPlacement( + HWND hWnd, + CONST WINDOWPLACEMENT *lpwndpl); + + +HDWP +STDCALL +BeginDeferWindowPos( + int nNumWindows); + + +HDWP +STDCALL +DeferWindowPos( + HDWP hWinPosInfo, + HWND hWnd, + HWND hWndInsertAfter, + int x, + int y, + int cx, + int cy, + UINT uFlags); + + +WINBOOL +STDCALL +EndDeferWindowPos( + HDWP hWinPosInfo); + + +WINBOOL +STDCALL +IsWindowVisible( + HWND hWnd); + + +WINBOOL +STDCALL +IsIconic( + HWND hWnd); + + +WINBOOL +STDCALL +AnyPopup( + VOID); + + +WINBOOL +STDCALL +BringWindowToTop( + HWND hWnd); + + +WINBOOL +STDCALL +IsZoomed( + HWND hWnd); + + +WINBOOL +STDCALL +EndDialog( + HWND hDlg, + int nResult); + + +HWND +STDCALL +GetDlgItem( + HWND hDlg, + int nIDDlgItem); + + +WINBOOL +STDCALL +SetDlgItemInt( + HWND hDlg, + int nIDDlgItem, + UINT uValue, + WINBOOL bSigned); + + +UINT +STDCALL +GetDlgItemInt( + HWND hDlg, + int nIDDlgItem, + WINBOOL *lpTranslated, + WINBOOL bSigned); + + +WINBOOL +STDCALL +CheckDlgButton( + HWND hDlg, + int nIDButton, + UINT uCheck); + + +WINBOOL +STDCALL +CheckRadioButton( + HWND hDlg, + int nIDFirstButton, + int nIDLastButton, + int nIDCheckButton); + + +UINT +STDCALL +IsDlgButtonChecked( + HWND hDlg, + int nIDButton); + + +HWND +STDCALL +GetNextDlgGroupItem( + HWND hDlg, + HWND hCtl, + WINBOOL bPrevious); + + +HWND +STDCALL +GetNextDlgTabItem( + HWND hDlg, + HWND hCtl, + WINBOOL bPrevious); + + +int +STDCALL +GetDlgCtrlID( + HWND hWnd); + + +long +STDCALL +GetDialogBaseUnits(VOID); + +WINBOOL +STDCALL +OpenClipboard( + HWND hWndNewOwner); + + +WINBOOL +STDCALL +CloseClipboard( + VOID); + + +HWND +STDCALL +GetClipboardOwner( + VOID); + + +HWND +STDCALL +SetClipboardViewer( + HWND hWndNewViewer); + + +HWND +STDCALL +GetClipboardViewer( + VOID); + + +WINBOOL +STDCALL +ChangeClipboardChain( + HWND hWndRemove, + HWND hWndNewNext); + + +HANDLE +STDCALL +SetClipboardData( + UINT uFormat, + HANDLE hMem); + + +HANDLE +STDCALL +GetClipboardData( + UINT uFormat); + + + +int +STDCALL +CountClipboardFormats( + VOID); + + +UINT +STDCALL +EnumClipboardFormats( + UINT format); + + +WINBOOL +STDCALL +EmptyClipboard( + VOID); + + +WINBOOL +STDCALL +IsClipboardFormatAvailable( + UINT format); + + +int +STDCALL +GetPriorityClipboardFormat( + UINT *paFormatPriorityList, + int cFormats); + + +HWND +STDCALL +GetOpenClipboardWindow( + VOID); + + +/* Despite the A these are ASCII functions! */ +LPSTR +STDCALL +CharNextExA( + WORD CodePage, + LPCSTR lpCurrentChar, + DWORD dwFlags); + + +LPSTR +STDCALL +CharPrevExA( + WORD CodePage, + LPCSTR lpStart, + LPCSTR lpCurrentChar, + DWORD dwFlags); + + +HWND +STDCALL +SetFocus( + HWND hWnd); + + +HWND +STDCALL +GetActiveWindow( + VOID); + + +HWND +STDCALL +GetFocus( + VOID); + + +UINT +STDCALL +GetKBCodePage( + VOID); + + +SHORT +STDCALL +GetKeyState( + int nVirtKey); + + +SHORT +STDCALL +GetAsyncKeyState( + int vKey); + + +WINBOOL +STDCALL +GetKeyboardState( + PBYTE lpKeyState); + + +WINBOOL +STDCALL +SetKeyboardState( + LPBYTE lpKeyState); + + +int +STDCALL +GetKeyboardType( + int nTypeFlag); + + +int +STDCALL +ToAscii( + UINT uVirtKey, + UINT uScanCode, + PBYTE lpKeyState, + LPWORD lpChar, + UINT uFlags); + + +int +STDCALL +ToAsciiEx( + UINT uVirtKey, + UINT uScanCode, + PBYTE lpKeyState, + LPWORD lpChar, + UINT uFlags, + HKL dwhkl); + + +int +STDCALL +ToUnicode( + UINT wVirtKey, + UINT wScanCode, + PBYTE lpKeyState, + LPWSTR pwszBuff, + int cchBuff, + UINT wFlags); + + +DWORD +STDCALL +OemKeyScan( + WORD wOemChar); + + +VOID +STDCALL +keybd_event( + BYTE bVk, + BYTE bScan, + DWORD dwFlags, + DWORD dwExtraInfo); + + +VOID +STDCALL +mouse_event( + DWORD dwFlags, + DWORD dx, + DWORD dy, + DWORD cButtons, + DWORD dwExtraInfo); + +WINBOOL +STDCALL +GetInputState( + VOID); + + +DWORD +STDCALL +GetQueueStatus( + UINT flags); + + +HWND +STDCALL +GetCapture( + VOID); + + +HWND +STDCALL +SetCapture( + HWND hWnd); + + +WINBOOL +STDCALL +ReleaseCapture( + VOID); + + +DWORD +STDCALL +MsgWaitForMultipleObjects( + DWORD nCount, + LPHANDLE pHandles, + WINBOOL fWaitAll, + DWORD dwMilliseconds, + DWORD dwWakeMask); + + +UINT +STDCALL +SetTimer( + HWND hWnd , + UINT nIDEvent, + UINT uElapse, + TIMERPROC lpTimerFunc); + + +WINBOOL +STDCALL +KillTimer( + HWND hWnd, + UINT uIDEvent); + + +WINBOOL +STDCALL +IsWindowUnicode( + HWND hWnd); + + +WINBOOL +STDCALL +EnableWindow( + HWND hWnd, + WINBOOL bEnable); + + +WINBOOL +STDCALL +IsWindowEnabled( + HWND hWnd); + + +WINBOOL +STDCALL +DestroyAcceleratorTable( + HACCEL hAccel); + +int +STDCALL +GetSystemMetrics( + int nIndex); + +HMENU +STDCALL +GetMenu( + HWND hWnd); + + +WINBOOL +STDCALL +SetMenu( + HWND hWnd, + HMENU hMenu); + + +WINBOOL +STDCALL +HiliteMenuItem( + HWND hWnd, + HMENU hMenu, + UINT uIDHiliteItem, + UINT uHilite); + + +UINT +STDCALL +GetMenuState( + HMENU hMenu, + UINT uId, + UINT uFlags); + + +WINBOOL +STDCALL +DrawMenuBar( + HWND hWnd); + + +HMENU +STDCALL +GetSystemMenu( + HWND hWnd, + WINBOOL bRevert); + + +HMENU +STDCALL +CreateMenu( + VOID); + + +HMENU +STDCALL +CreatePopupMenu( + VOID); + + +WINBOOL +STDCALL +DestroyMenu( + HMENU hMenu); + + +DWORD +STDCALL +CheckMenuItem( + HMENU hMenu, + UINT uIDCheckItem, + UINT uCheck); + + +WINBOOL +STDCALL +EnableMenuItem( + HMENU hMenu, + UINT uIDEnableItem, + UINT uEnable); + + +HMENU +STDCALL +GetSubMenu( + HMENU hMenu, + int nPos); + + +UINT +STDCALL +GetMenuItemID( + HMENU hMenu, + int nPos); + + +int +STDCALL +GetMenuItemCount( + HMENU hMenu); + +WINBOOL +STDCALL RemoveMenu( + HMENU hMenu, + UINT uPosition, + UINT uFlags); + + +WINBOOL +STDCALL +DeleteMenu( + HMENU hMenu, + UINT uPosition, + UINT uFlags); + + +WINBOOL +STDCALL +SetMenuItemBitmaps( + HMENU hMenu, + UINT uPosition, + UINT uFlags, + HBITMAP hBitmapUnchecked, + HBITMAP hBitmapChecked); + + +LONG +STDCALL +GetMenuCheckMarkDimensions( + VOID); + + +WINBOOL +STDCALL +TrackPopupMenu( + HMENU hMenu, + UINT uFlags, + int x, + int y, + int nReserved, + HWND hWnd, + CONST RECT *prcRect); + +UINT +STDCALL +GetMenuDefaultItem( + HMENU hMenu, + UINT fByPos, + UINT gmdiFlags); + +WINBOOL +STDCALL +SetMenuDefaultItem( + HMENU hMenu, + UINT uItem, + UINT fByPos); + +WINBOOL +STDCALL +GetMenuItemRect(HWND hWnd, + HMENU hMenu, + UINT uItem, + LPRECT lprcItem); + +int +STDCALL +MenuItemFromPoint(HWND hWnd, + HMENU hMenu, + POINT ptScreen); + + +DWORD +STDCALL +DragObject(HWND, HWND, UINT, DWORD, HCURSOR); + + +WINBOOL +STDCALL +DragDetect(HWND hwnd, + POINT pt); + + +WINBOOL +STDCALL +DrawIcon( + HDC hDC, + int X, + int Y, + HICON hIcon); + +WINBOOL +STDCALL +UpdateWindow( + HWND hWnd); + + +HWND +STDCALL +SetActiveWindow( + HWND hWnd); + + +HWND +STDCALL +GetForegroundWindow( + VOID); + +WINBOOL +STDCALL +PaintDesktop(HDC hdc); + + +WINBOOL +STDCALL +SetForegroundWindow( + HWND hWnd); + + +HWND +STDCALL +WindowFromDC( + HDC hDC); + + +HDC +STDCALL +GetDC( + HWND hWnd); + + +HDC +STDCALL +GetDCEx( + HWND hWnd , + HRGN hrgnClip, + DWORD flags); + + +HDC +STDCALL +GetWindowDC( + HWND hWnd); + + +int +STDCALL +ReleaseDC( + HWND hWnd, + HDC hDC); + + +HDC +STDCALL +BeginPaint( + HWND hWnd, + LPPAINTSTRUCT lpPaint); + + +WINBOOL +STDCALL +EndPaint( + HWND hWnd, + CONST PAINTSTRUCT *lpPaint); + + +WINBOOL +STDCALL +GetUpdateRect( + HWND hWnd, + LPRECT lpRect, + WINBOOL bErase); + + +int +STDCALL +GetUpdateRgn( + HWND hWnd, + HRGN hRgn, + WINBOOL bErase); + + +int +STDCALL +SetWindowRgn( + HWND hWnd, + HRGN hRgn, + WINBOOL bRedraw); + + +int +STDCALL +GetWindowRgn( + HWND hWnd, + HRGN hRgn); + + +int +STDCALL +ExcludeUpdateRgn( + HDC hDC, + HWND hWnd); + + +WINBOOL +STDCALL +InvalidateRect( + HWND hWnd , + CONST RECT *lpRect, + WINBOOL bErase); + + +WINBOOL +STDCALL +ValidateRect( + HWND hWnd , + CONST RECT *lpRect); + + +WINBOOL +STDCALL +InvalidateRgn( + HWND hWnd, + HRGN hRgn, + WINBOOL bErase); + + +WINBOOL +STDCALL +ValidateRgn( + HWND hWnd, + HRGN hRgn); + + +WINBOOL +STDCALL +RedrawWindow( + HWND hWnd, + CONST RECT *lprcUpdate, + HRGN hrgnUpdate, + UINT flags); + + +WINBOOL +STDCALL +LockWindowUpdate( + HWND hWndLock); + + +WINBOOL +STDCALL +ScrollWindow( + HWND hWnd, + int XAmount, + int YAmount, + CONST RECT *lpRect, + CONST RECT *lpClipRect); + + +WINBOOL +STDCALL +ScrollDC( + HDC hDC, + int dx, + int dy, + CONST RECT *lprcScroll, + CONST RECT *lprcClip , + HRGN hrgnUpdate, + LPRECT lprcUpdate); + + +int +STDCALL +ScrollWindowEx( + HWND hWnd, + int dx, + int dy, + CONST RECT *prcScroll, + CONST RECT *prcClip , + HRGN hrgnUpdate, + LPRECT prcUpdate, + UINT flags); + + +int +STDCALL +SetScrollPos( + HWND hWnd, + int nBar, + int nPos, + WINBOOL bRedraw); + + +int +STDCALL +GetScrollPos( + HWND hWnd, + int nBar); + + +WINBOOL +STDCALL +SetScrollRange( + HWND hWnd, + int nBar, + int nMinPos, + int nMaxPos, + WINBOOL bRedraw); + + +WINBOOL +STDCALL +GetScrollRange( + HWND hWnd, + int nBar, + LPINT lpMinPos, + LPINT lpMaxPos); + + +WINBOOL +STDCALL +ShowScrollBar( + HWND hWnd, + int wBar, + WINBOOL bShow); + + +WINBOOL +STDCALL +EnableScrollBar( + HWND hWnd, + UINT wSBflags, + UINT wArrows); + + +WINBOOL +STDCALL +GetClientRect( + HWND hWnd, + LPRECT lpRect); + + +WINBOOL +STDCALL +GetWindowRect( + HWND hWnd, + LPRECT lpRect); + + +WINBOOL +STDCALL +AdjustWindowRect( + LPRECT lpRect, + DWORD dwStyle, + WINBOOL bMenu); + + +WINBOOL +STDCALL +AdjustWindowRectEx( + LPRECT lpRect, + DWORD dwStyle, + WINBOOL bMenu, + DWORD dwExStyle); + +WINBOOL +STDCALL +SetWindowContextHelpId(HWND, DWORD); + +DWORD +STDCALL +GetWindowContextHelpId(HWND); + +WINBOOL +STDCALL +SetMenuContextHelpId(HMENU, DWORD); + +DWORD +STDCALL +GetMenuContextHelpId(HMENU); + + +WINBOOL +STDCALL +MessageBeep( + UINT uType); + + +int +STDCALL +ShowCursor( + WINBOOL bShow); + + +WINBOOL +STDCALL +SetCursorPos( + int X, + int Y); + + +HCURSOR +STDCALL +SetCursor( + HCURSOR hCursor); + + +WINBOOL +STDCALL +GetCursorPos( + LPPOINT lpPoint); + + +WINBOOL +STDCALL +ClipCursor( + CONST RECT *lpRect); + + +WINBOOL +STDCALL +GetClipCursor( + LPRECT lpRect); + + +HCURSOR +STDCALL +GetCursor( + VOID); + + +WINBOOL +STDCALL +CreateCaret( + HWND hWnd, + HBITMAP hBitmap , + int nWidth, + int nHeight); + + +UINT +STDCALL +GetCaretBlinkTime( + VOID); + + +WINBOOL +STDCALL +SetCaretBlinkTime( + UINT uMSeconds); + + +WINBOOL +STDCALL +DestroyCaret( + VOID); + + +WINBOOL +STDCALL +HideCaret( + HWND hWnd); + + +WINBOOL +STDCALL +ShowCaret( + HWND hWnd); + + +WINBOOL +STDCALL +SetCaretPos( + int X, + int Y); + + +WINBOOL +STDCALL +GetCaretPos( + LPPOINT lpPoint); + + +WINBOOL +STDCALL +ClientToScreen( + HWND hWnd, + LPPOINT lpPoint); + + +WINBOOL +STDCALL +ScreenToClient( + HWND hWnd, + LPPOINT lpPoint); + + +int +STDCALL +MapWindowPoints( + HWND hWndFrom, + HWND hWndTo, + LPPOINT lpPoints, + UINT cPoints); + + +HWND +STDCALL +WindowFromPoint( + POINT Point); + + +HWND +STDCALL +ChildWindowFromPoint( + HWND hWndParent, + POINT Point); + + +DWORD +STDCALL +GetSysColor( + int nIndex); + + +HBRUSH +STDCALL +GetSysColorBrush( + int nIndex); + + +WINBOOL +STDCALL +SetSysColors( + int cElements, + CONST INT * lpaElements, + CONST COLORREF * lpaRgbValues); + + +WINBOOL +STDCALL +DrawFocusRect( + HDC hDC, + CONST RECT * lprc); + + +int +STDCALL +FillRect( + HDC hDC, + CONST RECT *lprc, + HBRUSH hbr); + + +int +STDCALL +FrameRect( + HDC hDC, + CONST RECT *lprc, + HBRUSH hbr); + + +WINBOOL +STDCALL +InvertRect( + HDC hDC, + CONST RECT *lprc); + + +WINBOOL +STDCALL +SetRect( + LPRECT lprc, + int xLeft, + int yTop, + int xRight, + int yBottom); + + +WINBOOL +STDCALL +SetRectEmpty( + LPRECT lprc); + + +WINBOOL +STDCALL +CopyRect( + LPRECT lprcDst, + CONST RECT *lprcSrc); + + +WINBOOL +STDCALL +InflateRect( + LPRECT lprc, + int dx, + int dy); + + +WINBOOL +STDCALL +IntersectRect( + LPRECT lprcDst, + CONST RECT *lprcSrc1, + CONST RECT *lprcSrc2); + + +WINBOOL +STDCALL +UnionRect( + LPRECT lprcDst, + CONST RECT *lprcSrc1, + CONST RECT *lprcSrc2); + + +WINBOOL +STDCALL +SubtractRect( + LPRECT lprcDst, + CONST RECT *lprcSrc1, + CONST RECT *lprcSrc2); + + +WINBOOL +STDCALL +OffsetRect( + LPRECT lprc, + int dx, + int dy); + + +WINBOOL +STDCALL +IsRectEmpty( + CONST RECT *lprc); + + +WINBOOL +STDCALL +EqualRect( + CONST RECT *lprc1, + CONST RECT *lprc2); + + +WINBOOL +STDCALL +PtInRect( + CONST RECT *lprc, + POINT pt); + + +WORD +STDCALL +GetWindowWord( + HWND hWnd, + int nIndex); + + +WORD +STDCALL +SetWindowWord( + HWND hWnd, + int nIndex, + WORD wNewWord); + + +WORD +STDCALL +GetClassWord( + HWND hWnd, + int nIndex); + + +WORD +STDCALL +SetClassWord( + HWND hWnd, + int nIndex, + WORD wNewWord); + +HWND +STDCALL +GetDesktopWindow( + VOID); + + +HWND +STDCALL +GetParent( + HWND hWnd); + + +HWND +STDCALL +SetParent( + HWND hWndChild, + HWND hWndNewParent); + + +WINBOOL +STDCALL +EnumChildWindows( + HWND hWndParent, + ENUMWINDOWSPROC lpEnumFunc, + LPARAM lParam); + + +WINBOOL +STDCALL +EnumWindows( + ENUMWINDOWSPROC lpEnumFunc, + LPARAM lParam); + + +WINBOOL +STDCALL +EnumThreadWindows( + DWORD dwThreadId, + ENUMWINDOWSPROC lpfn, + LPARAM lParam); + +HWND +STDCALL +GetTopWindow( + HWND hWnd); + + +DWORD +STDCALL +GetWindowThreadProcessId( + HWND hWnd, + LPDWORD lpdwProcessId); + + +HWND +STDCALL +GetLastActivePopup( + HWND hWnd); + + +HWND +STDCALL +GetWindow( + HWND hWnd, + UINT uCmd); + +WINBOOL +STDCALL +UnhookWindowsHook( + int nCode, + HOOKPROC pfnFilterProc); + +WINBOOL +STDCALL +UnhookWindowsHookEx( + HHOOK hhk); + + +LRESULT +STDCALL +CallNextHookEx( + HHOOK hhk, + int nCode, + WPARAM wParam, + LPARAM lParam); + + +WINBOOL +STDCALL +CheckMenuRadioItem(HMENU, UINT, UINT, UINT, UINT); + +HCURSOR +STDCALL +CreateCursor( + HINSTANCE hInst, + int xHotSpot, + int yHotSpot, + int nWidth, + int nHeight, + CONST VOID *pvANDPlane, + CONST VOID *pvXORPlane); + + +WINBOOL +STDCALL +DestroyCursor( + HCURSOR hCursor); + + +WINBOOL +STDCALL +SetSystemCursor( + HCURSOR hcur, + DWORD anID); + + +HICON +STDCALL +CreateIcon( + HINSTANCE hInstance, + int nWidth, + int nHeight, + BYTE cPlanes, + BYTE cBitsPixel, + CONST BYTE *lpbANDbits, + CONST BYTE *lpbXORbits); + + +WINBOOL +STDCALL +DestroyIcon( + HICON hIcon); + + +int +STDCALL +LookupIconIdFromDirectory( + PBYTE presbits, + WINBOOL fIcon); + + +int +STDCALL +LookupIconIdFromDirectoryEx( + PBYTE presbits, + WINBOOL fIcon, + int cxDesired, + int cyDesired, + UINT Flags); + + +HICON +STDCALL +CreateIconFromResource( + PBYTE presbits, + DWORD dwResSize, + WINBOOL fIcon, + DWORD dwVer); + + +HICON +STDCALL +CreateIconFromResourceEx( + PBYTE presbits, + DWORD dwResSize, + WINBOOL fIcon, + DWORD dwVer, + int cxDesired, + int cyDesired, + UINT Flags); + + +HICON +STDCALL +CopyImage( + HANDLE, + UINT, + int, + int, + UINT); + + +HICON +STDCALL +CreateIconIndirect( + PICONINFO piconinfo); + + +HICON +STDCALL +CopyIcon( + HICON hIcon); + + +WINBOOL +STDCALL +GetIconInfo( + HICON hIcon, + PICONINFO piconinfo); + + +WINBOOL +STDCALL +MapDialogRect( + HWND hDlg, + LPRECT lpRect); + +int +STDCALL +SetScrollInfo(HWND, int, LPCSCROLLINFO, WINBOOL); + +WINBOOL +STDCALL +GetScrollInfo(HWND, int, LPSCROLLINFO); + +WINBOOL +STDCALL +TranslateMDISysAccel( + HWND hWndClient, + LPMSG lpMsg); + + +UINT +STDCALL +ArrangeIconicWindows( + HWND hWnd); + +WORD +STDCALL +TileWindows(HWND hwndParent, UINT wHow, CONST RECT * lpRect, UINT cKids, const HWND *lpKids); + +WORD +STDCALL +CascadeWindows(HWND hwndParent, UINT wHow, CONST RECT * lpRect, UINT cKids, const HWND *lpKids); + + +VOID +STDCALL +SetLastErrorEx( + DWORD dwErrCode, + DWORD dwType + ); + + +VOID +STDCALL +SetDebugErrorLevel( + DWORD dwLevel + ); + +WINBOOL +STDCALL +DrawEdge(HDC hdc, LPRECT qrc, UINT edge, UINT grfFlags); + +WINBOOL +STDCALL +DrawFrameControl(HDC, LPRECT, UINT, UINT); + +WINBOOL +STDCALL +DrawCaption(HWND, HDC, CONST RECT *, UINT); + +WINBOOL +STDCALL +DrawAnimatedRects(HWND hwnd, int idAni, CONST RECT * lprcFrom, CONST RECT * lprcTo); + +WINBOOL +STDCALL +TrackPopupMenuEx(HMENU, UINT, int, int, HWND, LPTPMPARAMS); + +HWND +STDCALL +ChildWindowFromPointEx(HWND, POINT, UINT); + +WINBOOL +STDCALL +DrawIconEx(HDC hdc, int xLeft, int yTop, + HICON hIcon, int cxWidth, int cyWidth, + UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); + +WINBOOL +STDCALL +AnimatePalette(HPALETTE, UINT, UINT, CONST PALETTEENTRY *); + +WINBOOL +STDCALL +Arc(HDC, int, int, int, int, int, int, int, int); + +WINBOOL +STDCALL +BitBlt(HDC, int, int, int, int, HDC, int, int, DWORD); + +WINBOOL +STDCALL +CancelDC(HDC); + +WINBOOL +STDCALL +Chord(HDC, int, int, int, int, int, int, int, int); + +HMETAFILE +STDCALL +CloseMetaFile(HDC); + +int +STDCALL +CombineRgn(HRGN, HRGN, HRGN, int); + +HBITMAP +STDCALL +CreateBitmap(int, int, UINT, UINT, CONST VOID *); + +HBITMAP +STDCALL +CreateBitmapIndirect(CONST BITMAP *); + +HBRUSH +STDCALL +CreateBrushIndirect(CONST LOGBRUSH *); + +HBITMAP +STDCALL +CreateCompatibleBitmap(HDC, int, int); + +HBITMAP +STDCALL +CreateDiscardableBitmap(HDC, int, int); + +HDC +STDCALL +CreateCompatibleDC(HDC); + +HBITMAP +STDCALL +CreateDIBitmap(HDC, CONST BITMAPINFOHEADER *, DWORD, CONST VOID *, CONST BITMAPINFO *, UINT); + +HBRUSH +STDCALL +CreateDIBPatternBrush(HGLOBAL, UINT); + +HBRUSH +STDCALL +CreateDIBPatternBrushPt(CONST VOID *, UINT); + +HRGN +STDCALL +CreateEllipticRgn(int, int, int, int); + +HRGN +STDCALL +CreateEllipticRgnIndirect(CONST RECT *); + +HBRUSH +STDCALL +CreateHatchBrush(int, COLORREF); + +HPALETTE +STDCALL +CreatePalette(CONST LOGPALETTE *); + +HPEN +STDCALL +CreatePen(int, int, COLORREF); + +HPEN +STDCALL +CreatePenIndirect(CONST LOGPEN *); + +HRGN +STDCALL +CreatePolyPolygonRgn(CONST POINT *, CONST INT *, int, int); + +HBRUSH +STDCALL +CreatePatternBrush(HBITMAP); + +HRGN +STDCALL +CreateRectRgn(int, int, int, int); + +HRGN +STDCALL +CreateRectRgnIndirect(CONST RECT *); + +HRGN +STDCALL +CreateRoundRectRgn(int, int, int, int, int, int); + +HBRUSH +STDCALL +CreateSolidBrush(COLORREF); + +WINBOOL +STDCALL +DeleteDC(HDC); + +WINBOOL +STDCALL +DeleteMetaFile(HMETAFILE); + +WINBOOL +STDCALL +DeleteObject(HGDIOBJ); + +int +STDCALL +DrawEscape(HDC, int, int, LPCSTR); + +WINBOOL +STDCALL +Ellipse(HDC, int, int, int, int); + +int +STDCALL +EnumObjects(HDC, int, ENUMOBJECTSPROC, LPARAM); + +WINBOOL +STDCALL +EqualRgn(HRGN, HRGN); + +int +STDCALL +Escape(HDC, int, int, LPCSTR, LPVOID); + +int +STDCALL +ExtEscape(HDC, int, int, LPCSTR, int, LPSTR); + +int +STDCALL +ExcludeClipRect(HDC, int, int, int, int); + +HRGN +STDCALL +ExtCreateRegion(CONST XFORM *, DWORD, CONST RGNDATA *); + +WINBOOL +STDCALL +ExtFloodFill(HDC, int, int, COLORREF, UINT); + +WINBOOL +STDCALL +FillRgn(HDC, HRGN, HBRUSH); + +WINBOOL +STDCALL +FloodFill(HDC, int, int, COLORREF); + +WINBOOL +STDCALL +FrameRgn(HDC, HRGN, HBRUSH, int, int); + +int +STDCALL +GetROP2(HDC); + +WINBOOL +STDCALL +GetAspectRatioFilterEx(HDC, LPSIZE); + +COLORREF +STDCALL +GetBkColor(HDC); + +int +STDCALL +GetBkMode(HDC); + +LONG +STDCALL +GetBitmapBits(HBITMAP, LONG, LPVOID); + +WINBOOL +STDCALL +GetBitmapDimensionEx(HBITMAP, LPSIZE); + +UINT +STDCALL +GetBoundsRect(HDC, LPRECT, UINT); + +WINBOOL +STDCALL +GetBrushOrgEx(HDC, LPPOINT); + +int +STDCALL +GetClipBox(HDC, LPRECT); + +int +STDCALL +GetClipRgn(HDC, HRGN); + +int +STDCALL +GetMetaRgn(HDC, HRGN); + +HGDIOBJ +STDCALL +GetCurrentObject(HDC, UINT); + +WINBOOL +STDCALL +GetCurrentPositionEx(HDC, LPPOINT); + +int +STDCALL +GetDeviceCaps(HDC, int); + +int +STDCALL +GetDIBits(HDC, HBITMAP, UINT, UINT, LPVOID, LPBITMAPINFO, UINT); + +DWORD +STDCALL +GetFontData(HDC, DWORD, DWORD, LPVOID, DWORD); + +int +STDCALL +GetGraphicsMode(HDC); + +int +STDCALL +GetMapMode(HDC); + +UINT +STDCALL +GetMetaFileBitsEx(HMETAFILE, UINT, LPVOID); + +COLORREF +STDCALL +GetNearestColor(HDC, COLORREF); + +UINT +STDCALL +GetNearestPaletteIndex(HPALETTE, COLORREF); + +DWORD +STDCALL +GetObjectType(HGDIOBJ h); + +UINT +STDCALL +GetPaletteEntries(HPALETTE, UINT, UINT, LPPALETTEENTRY); + +COLORREF +STDCALL +GetPixel(HDC, int, int); + +int +STDCALL +GetPixelFormat(HDC); + +int +STDCALL +GetPolyFillMode(HDC); + +WINBOOL +STDCALL +GetRasterizerCaps(LPRASTERIZER_STATUS, UINT); + +DWORD +STDCALL +GetRegionData(HRGN, DWORD, LPRGNDATA); + +int +STDCALL +GetRgnBox(HRGN, LPRECT); + +HGDIOBJ +STDCALL +GetStockObject(int); + +int +STDCALL +GetStretchBltMode(HDC); + +UINT +STDCALL +GetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY); + +UINT +STDCALL +GetSystemPaletteUse(HDC); + +int +STDCALL +GetTextCharacterExtra(HDC); + +UINT +STDCALL +GetTextAlign(HDC); + +COLORREF +STDCALL +GetTextColor(HDC); + +int +STDCALL +GetTextCharset(HDC hdc); + +int +STDCALL +GetTextCharsetInfo(HDC hdc, LPFONTSIGNATURE lpSig, DWORD dwFlags); + +WINBOOL +STDCALL +TranslateCharsetInfo( DWORD *lpSrc, LPCHARSETINFO lpCs, DWORD dwFlags); + +DWORD +STDCALL +GetFontLanguageInfo( HDC ); + +WINBOOL +STDCALL +GetViewportExtEx(HDC, LPSIZE); + +WINBOOL +STDCALL +GetViewportOrgEx(HDC, LPPOINT); + +WINBOOL +STDCALL +GetWindowExtEx(HDC, LPSIZE); + +WINBOOL +STDCALL +GetWindowOrgEx(HDC, LPPOINT); + +int +STDCALL +IntersectClipRect(HDC, int, int, int, int); + +WINBOOL +STDCALL +InvertRgn(HDC, HRGN); + +WINBOOL +STDCALL +LineDDA(int, int, int, int, LINEDDAPROC, LPARAM); + +WINBOOL +STDCALL +LineTo(HDC, int, int); + +WINBOOL +STDCALL +MaskBlt(HDC, int, int, int, int, + HDC, int, int, HBITMAP, int, int, DWORD); + +WINBOOL +STDCALL +PlgBlt(HDC, CONST POINT *, HDC, int, int, int, + int, HBITMAP, int, int); + +int +STDCALL +OffsetClipRgn(HDC, int, int); + +int +STDCALL +OffsetRgn(HRGN, int, int); + +WINBOOL +STDCALL +PatBlt(HDC, int, int, int, int, DWORD); + +WINBOOL +STDCALL +Pie(HDC, int, int, int, int, int, int, int, int); + +WINBOOL +STDCALL +PlayMetaFile(HDC, HMETAFILE); + +WINBOOL +STDCALL +PaintRgn(HDC, HRGN); + +WINBOOL +STDCALL +PolyPolygon(HDC, CONST POINT *, CONST INT *, int); + +WINBOOL +STDCALL +PtInRegion(HRGN, int, int); + +WINBOOL +STDCALL +PtVisible(HDC, int, int); + +WINBOOL +STDCALL +RectInRegion(HRGN, CONST RECT *); + +WINBOOL +STDCALL +RectVisible(HDC, CONST RECT *); + +WINBOOL +STDCALL +Rectangle(HDC, int, int, int, int); + +WINBOOL +STDCALL +RestoreDC(HDC, int); + +UINT +STDCALL +RealizePalette(HDC); + +WINBOOL +STDCALL +RoundRect(HDC, int, int, int, int, int, int); + +WINBOOL +STDCALL +ResizePalette(HPALETTE, UINT); + +int +STDCALL +SaveDC(HDC); + +int +STDCALL +SelectClipRgn(HDC, HRGN); + +int +STDCALL +ExtSelectClipRgn(HDC, HRGN, int); + +int +STDCALL +SetMetaRgn(HDC); + +HGDIOBJ +STDCALL +SelectObject(HDC, HGDIOBJ); + +HPALETTE +STDCALL +SelectPalette(HDC, HPALETTE, WINBOOL); + +COLORREF +STDCALL +SetBkColor(HDC, COLORREF); + +int +STDCALL +SetBkMode(HDC, int); + +LONG +STDCALL +SetBitmapBits(HBITMAP, DWORD, CONST VOID *); + +UINT +STDCALL +SetBoundsRect(HDC, CONST RECT *, UINT); + +int +STDCALL +SetDIBits(HDC, HBITMAP, UINT, UINT, CONST VOID *, CONST BITMAPINFO *, UINT); + +int +STDCALL +SetDIBitsToDevice(HDC, int, int, DWORD, DWORD, int, + int, UINT, UINT, CONST VOID *, CONST BITMAPINFO *, UINT); + +DWORD +STDCALL +SetMapperFlags(HDC, DWORD); + +int +STDCALL +SetGraphicsMode(HDC hdc, int iMode); + +int +STDCALL +SetMapMode(HDC, int); + +HMETAFILE +STDCALL +SetMetaFileBitsEx(UINT, CONST BYTE *); + +UINT +STDCALL +SetPaletteEntries(HPALETTE, UINT, UINT, CONST PALETTEENTRY *); + +COLORREF +STDCALL +SetPixel(HDC, int, int, COLORREF); + +WINBOOL +STDCALL +SetPixelV(HDC, int, int, COLORREF); + +int +STDCALL +SetPolyFillMode(HDC, int); + +WINBOOL +STDCALL +StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD); + +WINBOOL +STDCALL +SetRectRgn(HRGN, int, int, int, int); +int +STDCALL +StretchDIBits(HDC, int, int, int, int, int, int, int, int, CONST + VOID *, CONST BITMAPINFO *, UINT, DWORD); + +int +STDCALL +SetROP2(HDC, int); + +int +STDCALL +SetStretchBltMode(HDC, int); + +UINT +STDCALL +SetSystemPaletteUse(HDC, UINT); + +int +STDCALL +SetTextCharacterExtra(HDC, int); + +COLORREF +STDCALL +SetTextColor(HDC, COLORREF); + +UINT +STDCALL +SetTextAlign(HDC, UINT); + +WINBOOL +STDCALL +SetTextJustification(HDC, int, int); + +WINBOOL +STDCALL +UpdateColors(HDC); + +WINBOOL +STDCALL +PlayMetaFileRecord(HDC, LPHANDLETABLE, LPMETARECORD, UINT); + +WINBOOL +STDCALL +EnumMetaFile(HDC, HMETAFILE, ENUMMETAFILEPROC, LPARAM); + +HENHMETAFILE +STDCALL +CloseEnhMetaFile(HDC); + +WINBOOL +STDCALL +DeleteEnhMetaFile(HENHMETAFILE); + +WINBOOL +STDCALL +EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMETAFILEPROC, + LPVOID, CONST RECT *); + +UINT +STDCALL +GetEnhMetaFileHeader(HENHMETAFILE, UINT, LPENHMETAHEADER ); + +UINT +STDCALL +GetEnhMetaFilePaletteEntries(HENHMETAFILE, UINT, LPPALETTEENTRY ); + +UINT +STDCALL +GetWinMetaFileBits(HENHMETAFILE, UINT, LPBYTE, INT, HDC); + +WINBOOL +STDCALL +PlayEnhMetaFile(HDC, HENHMETAFILE, CONST RECT *); + +WINBOOL +STDCALL +PlayEnhMetaFileRecord(HDC, LPHANDLETABLE, CONST ENHMETARECORD *, UINT); + +HENHMETAFILE +STDCALL +SetEnhMetaFileBits(UINT, CONST BYTE *); + +HENHMETAFILE +STDCALL +SetWinMetaFileBits(UINT, CONST BYTE *, HDC, CONST METAFILEPICT *); + +WINBOOL +STDCALL +GdiComment(HDC, UINT, CONST BYTE *); + +WINBOOL +STDCALL +AngleArc(HDC, int, int, DWORD, FLOAT, FLOAT); + +WINBOOL +STDCALL +PolyPolyline(HDC, CONST POINT *, CONST DWORD *, DWORD); + +WINBOOL +STDCALL +GetWorldTransform(HDC, LPXFORM); + +WINBOOL +STDCALL +SetWorldTransform(HDC, CONST XFORM *); + +WINBOOL +STDCALL +ModifyWorldTransform(HDC, CONST XFORM *, DWORD); + +WINBOOL +STDCALL +CombineTransform(LPXFORM, CONST XFORM *, CONST XFORM *); + +HBITMAP +STDCALL +CreateDIBSection(HDC, CONST BITMAPINFO *, UINT, VOID **, HANDLE, DWORD); + +UINT +STDCALL +GetDIBColorTable(HDC, UINT, UINT, RGBQUAD *); + +UINT +STDCALL +SetDIBColorTable(HDC, UINT, UINT, CONST RGBQUAD *); + +WINBOOL +STDCALL +SetColorAdjustment(HDC, CONST COLORADJUSTMENT *); + +WINBOOL +STDCALL +GetColorAdjustment(HDC, LPCOLORADJUSTMENT); + +HPALETTE +STDCALL +CreateHalftonePalette(HDC); + +int +STDCALL +EndDoc(HDC); + +int +STDCALL +StartPage(HDC); + +int +STDCALL +EndPage(HDC); + +int +STDCALL +AbortDoc(HDC); + +int +STDCALL +SetAbortProc(HDC, ABORTPROC); + +WINBOOL +STDCALL +AbortPath(HDC); + +WINBOOL +STDCALL +ArcTo(HDC, int, int, int, int, int, int,int, int); + +WINBOOL +STDCALL +BeginPath(HDC); + +WINBOOL +STDCALL +CloseFigure(HDC); + +WINBOOL +STDCALL +EndPath(HDC); + +WINBOOL +STDCALL +FillPath(HDC); + +WINBOOL +STDCALL +FlattenPath(HDC); + +int +STDCALL +GetPath(HDC, LPPOINT, LPBYTE, int); + +HRGN +STDCALL +PathToRegion(HDC); + +WINBOOL +STDCALL +PolyDraw(HDC, CONST POINT *, CONST BYTE *, int); + +WINBOOL +STDCALL +SelectClipPath(HDC, int); + +int +STDCALL +SetArcDirection(HDC, int); + +WINBOOL +STDCALL +SetMiterLimit(HDC, FLOAT, PFLOAT); + +WINBOOL +STDCALL +StrokeAndFillPath(HDC); + +WINBOOL +STDCALL +StrokePath(HDC); + +WINBOOL +STDCALL +WidenPath(HDC); + +HPEN +STDCALL +ExtCreatePen(DWORD, DWORD, CONST LOGBRUSH *, DWORD, CONST DWORD *); + +WINBOOL +STDCALL +GetMiterLimit(HDC, PFLOAT); + +int +STDCALL +GetArcDirection(HDC); + +WINBOOL +STDCALL +MoveToEx(HDC, int, int, LPPOINT); + +HRGN +STDCALL +CreatePolygonRgn(CONST POINT *, int, int); + +WINBOOL +STDCALL +DPtoLP(HDC, LPPOINT, int); + +WINBOOL +STDCALL +LPtoDP(HDC, LPPOINT, int); + +WINBOOL +STDCALL +Polygon(HDC, CONST POINT *, int); + +WINBOOL +STDCALL +Polyline(HDC, CONST POINT *, int); + +WINBOOL +STDCALL +PolyBezier(HDC, CONST POINT *, DWORD); + +WINBOOL +STDCALL +PolyBezierTo(HDC, CONST POINT *, DWORD); + +WINBOOL +STDCALL +PolylineTo(HDC, CONST POINT *, DWORD); + +WINBOOL +STDCALL +SetViewportExtEx(HDC, int, int, LPSIZE); + +WINBOOL +STDCALL +SetViewportOrgEx(HDC, int, int, LPPOINT); + +WINBOOL +STDCALL +SetWindowExtEx(HDC, int, int, LPSIZE); + +WINBOOL +STDCALL +SetWindowOrgEx(HDC, int, int, LPPOINT); + +WINBOOL +STDCALL +OffsetViewportOrgEx(HDC, int, int, LPPOINT); + +WINBOOL +STDCALL +OffsetWindowOrgEx(HDC, int, int, LPPOINT); + +WINBOOL +STDCALL +ScaleViewportExtEx(HDC, int, int, int, int, LPSIZE); + +WINBOOL +STDCALL +ScaleWindowExtEx(HDC, int, int, int, int, LPSIZE); + +WINBOOL +STDCALL +SetBitmapDimensionEx(HBITMAP, int, int, LPSIZE); + +WINBOOL +STDCALL +SetBrushOrgEx(HDC, int, int, LPPOINT); + +WINBOOL +STDCALL +GetDCOrgEx(HDC,LPPOINT); + +WINBOOL +STDCALL +FixBrushOrgEx(HDC,int,int,LPPOINT); + +WINBOOL +STDCALL +UnrealizeObject(HGDIOBJ); + +WINBOOL +STDCALL +GdiFlush(void); + +DWORD +STDCALL +GdiSetBatchLimit(DWORD); + +DWORD +STDCALL +GdiGetBatchLimit(void); + +int +STDCALL +SetICMMode(HDC, int); + +WINBOOL +STDCALL +CheckColorsInGamut(HDC,LPVOID,LPVOID,DWORD); + +HANDLE +STDCALL +GetColorSpace(HDC); + +WINBOOL +STDCALL +SetColorSpace(HDC,HCOLORSPACE); + +WINBOOL +STDCALL +DeleteColorSpace(HCOLORSPACE); + +WINBOOL +STDCALL +GetDeviceGammaRamp(HDC,LPVOID); + +WINBOOL +STDCALL +SetDeviceGammaRamp(HDC,LPVOID); + +WINBOOL +STDCALL +ColorMatchToTarget(HDC,HDC,DWORD); + +HPROPSHEETPAGE +STDCALL +CreatePropertySheetPageA(LPCPROPSHEETPAGE lppsp); + +WINBOOL +STDCALL +DestroyPropertySheetPage(HPROPSHEETPAGE hPSPage); + +void +STDCALL +InitCommonControls(void); + +#define ImageList_AddIcon(himl, hicon) ImageList_ReplaceIcon(himl, -1, hicon) + +HIMAGELIST +STDCALL +ImageList_Create(int cx, int cy, UINT flags, + int cInitial, int cGrow); + +WINBOOL +STDCALL +ImageList_Destroy(HIMAGELIST himl); + +int +STDCALL +ImageList_GetImageCount(HIMAGELIST himl); + +int +STDCALL +ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, + HBITMAP hbmMask); + +int +STDCALL +ImageList_ReplaceIcon(HIMAGELIST himl, int i, HICON hicon); + +COLORREF +STDCALL +ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk); + +COLORREF +STDCALL +ImageList_GetBkColor(HIMAGELIST himl); + +WINBOOL +STDCALL +ImageList_SetOverlayImage(HIMAGELIST himl, int iImage, + int iOverlay); + +WINBOOL +STDCALL +ImageList_Draw(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, UINT fStyle); + +WINBOOL +STDCALL +ImageList_Replace(HIMAGELIST himl, int i, HBITMAP hbmImage, HBITMAP hbmMask); + +int +STDCALL +ImageList_AddMasked(HIMAGELIST himl, HBITMAP hbmImage, COLORREF crMask); + +WINBOOL +STDCALL +ImageList_DrawEx(HIMAGELIST himl, int i, HDC hdcDst, int x, int y, int dx, int dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle); + +WINBOOL +STDCALL +ImageList_Remove(HIMAGELIST himl, int i); + +HICON +STDCALL +ImageList_GetIcon(HIMAGELIST himl, int i, UINT flags); + +WINBOOL +STDCALL +ImageList_BeginDrag(HIMAGELIST himlTrack, int iTrack, int dxHotspot, int dyHotspot); + +void +STDCALL +ImageList_EndDrag(void); + +WINBOOL +STDCALL +ImageList_DragEnter(HWND hwndLock, int x, int y); + +WINBOOL +STDCALL +ImageList_DragLeave(HWND hwndLock); + +WINBOOL +STDCALL +ImageList_DragMove(int x, int y); + +WINBOOL +STDCALL +ImageList_SetDragCursorImage(HIMAGELIST himlDrag, int iDrag, int dxHotspot, int dyHotspot); + +WINBOOL +STDCALL +ImageList_DragShowNolock(WINBOOL fShow); + +HIMAGELIST +STDCALL +ImageList_GetDragImage(POINT * ppt,POINT * pptHotspot); + +WINBOOL +STDCALL +ImageList_GetIconSize(HIMAGELIST himl, int *cx, int *cy); + +WINBOOL +STDCALL +ImageList_SetIconSize(HIMAGELIST himl, int cx, int cy); + +WINBOOL +STDCALL +ImageList_GetImageInfo(HIMAGELIST himl, int i, IMAGEINFO * pImageInfo); + +HIMAGELIST +STDCALL +ImageList_Merge(HIMAGELIST himl1, int i1, HIMAGELIST himl2, int i2, int dx, int dy); + +HWND +STDCALL +CreateToolbarEx(HWND hwnd, DWORD ws, UINT wID, int nBitmaps, + HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons, + int iNumButtons, int dxButton, int dyButton, + int dxBitmap, int dyBitmap, UINT uStructSize); + +HBITMAP +STDCALL +CreateMappedBitmap(HINSTANCE hInstance, int idBitmap, + UINT wFlags, LPCOLORMAP lpColorMap, + int iNumMaps); + + +void +STDCALL +MenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, HMENU hMainMenu, HINSTANCE hInst, HWND hwndStatus, UINT *lpwIDs); + +WINBOOL +STDCALL +ShowHideMenuCtl(HWND hWnd, UINT uFlags, LPINT lpInfo); + +void +STDCALL +GetEffectiveClientRect(HWND hWnd, LPRECT lprc, LPINT lpInfo); + +WINBOOL +STDCALL +MakeDragList(HWND hLB); + +void +STDCALL +DrawInsert(HWND handParent, HWND hLB, int nItem); + +int +STDCALL +LBItemFromPt(HWND hLB, POINT pt, WINBOOL bAutoScroll); + +HWND +STDCALL +CreateUpDownControl(DWORD dwStyle, int x, int y, int cx, int cy, + HWND hParent, int nID, HINSTANCE hInst, + HWND hBuddy, + int nUpper, int nLower, int nPos); + +DWORD +STDCALL +CommDlgExtendedError(VOID); + +/* Animation controls */ + +#define Animate_Create(hwndP, id, dwStyle, hInstance) CreateWindow(ANIMATE_CLASS, NULL, dwStyle, 0, 0, 0, 0, hwndP, (HMENU)(id), hInstance, NULL) + +#define Animate_Open(hwnd, szName) SendMessage(hwnd, ACM_OPEN, 0, (LPARAM)(LPTSTR)(szName)) + +#define Animate_Play(hwnd, from, to, rep) SendMessage(hwnd, ACM_PLAY, (WPARAM)(UINT)(rep), (LPARAM)MAKELONG(from, to)) + +#define Animate_Stop(hwnd) SendMessage(hwnd, ACM_STOP, 0, 0) + +#define Animate_Close(hwnd) Animate_Open(hwnd, NULL) + +#define Animate_Seek(hwnd, frame) Animate_Play(hwnd, frame, frame, 1) + +/* Property sheet macros */ + +#define PropSheet_AddPage(hPropSheetDlg, hpage) SendMessage(hPropSheetDlg, PSM_ADDPAGE, 0, (LPARAM)(HPROPSHEETPAGE)hpage) + +#define PropSheet_Apply(hPropSheetDlg) SendMessage(hPropSheetDlg, PSM_APPLY, 0, 0) + +#define PropSheet_CancelToClose(hPropSheetDlg) SendMessage(hPropSheetDlg, PSM_CANCELTOCLOSE, 0, 0) + +#define PropSheet_Changed(hPropSheetDlg, hwndPage) SendMessage(hPropSheetDlg, PSM_CHANGED, (WPARAM)(HWND)hwndPage, 0) + +#define PropSheet_GetCurrentPageHwnd(hDlg) SendMessage(hDlg, PSM_GETCURRENTPAGEHWND, 0, 0) + +#define PropSheet_GetTabControl(hPropSheetDlg) SendMessage(hPropSheetDlg, PSM_GETTABCONTROL, 0, 0) + +#define PropSheet_IsDialogMessage(hDlg, pMsg) SendMessage(hDlg, PSM_ISDIALOGMESSAGE, 0, (LPARAM)pMsg) + +#define PropSheet_PressButton(hPropSheetDlg, iButton) SendMessage(hPropSheetDlg, PSM_PRESSBUTTON, (WPARAM)(int)iButton, 0) + +#define PropSheet_QuerySiblings(hPropSheetDlg, param1, param2) SendMessage(hPropSheetDlg, PSM_QUERYSIBLINGS, (WPARAM)param1, (LPARAM)param2) + +#define PropSheet_RebootSystem(hPropSheetDlg) SendMessage(hPropSheetDlg, PSM_REBOOTSYSTEM, 0, 0) + +#define PropSheet_RemovePage(hPropSheetDlg, index, hpage) SendMessage(hPropSheetDlg, PSM_REMOVEPAGE, (WPARAM)(int)index, (LPARAM)(HPROPSHEETPAGE)hpage) + +#define PropSheet_RestartWindows(hPropSheetDlg) SendMessage(hPropSheetDlg, PSM_RESTARTWINDOWS, 0, 0) + +#define PropSheet_SetCurSel(hPropSheetDlg, hpage, index) SendMessage(hPropSheetDlg, PSM_SETCURSEL, (WPARAM)(int)index, (LPARAM)(HPROPSHEETPAGE)hpage) + +#define PropSheet_SetCurSelByID(hPropSheetDlg, id) SendMessage(hPropSheetDlg, PSM_SETCURSELID, 0, (LPARAM)(int)id) + +#define PropSheet_SetFinishText(hPropSheetDlg, lpszText) SendMessage(hPropSheetDlg, PSM_SETFINISHTEXT, 0, (LPARAM)(LPTSTR)lpszText) + +#define PropSheet_SetTitle(hPropSheetDlg, dwStyle, lpszText) SendMessage(hPropSheetDlg, PSM_SETTITLE, (WPARAM)(DWORD)dwStyle, (LPARAM)(LPCTSTR)lpszText) + +#define PropSheet_SetWizButtons(hPropSheetDlg, dwFlags) SendMessage(hPropSheetDlg, PSM_SETWIZBUTTONS, 0, (LPARAM)(DWORD)dwFlags) + +#define PropSheet_UnChanged(hPropSheetDlg, hwndPage) SendMessage(hPropSheetDlg, PSM_UNCHANGED, (WPARAM)(HWND)hwndPage, 0) + +/* Header control */ +#define Header_DeleteItem(hwndHD, index) (BOOL)SendMessage((hwndHD), HDM_DELETEITEM, (WPARAM)(int)(index), 0L) + +#define Header_GetItem(hwndHD, index, phdi) (BOOL)SendMessage((hwndHD), HDM_GETITEM, (WPARAM)(int)(index), (LPARAM)(HD_ITEM FAR*)(phdi)) + +#define Header_GetItemCount(hwndHD) (int)SendMessage((hwndHD), HDM_GETITEMCOUNT, 0, 0L) + +#define Header_InsertItem(hwndHD, index, phdi) (int)SendMessage((hwndHD), HDM_INSERTITEM, (WPARAM)(int)(index), (LPARAM)(const HD_ITEM FAR*)(phdi)) + +#define Header_Layout(hwndHD, playout) (BOOL)SendMessage((hwndHD), HDM_LAYOUT, 0, (LPARAM)(HD_LAYOUT FAR*)(playout)) + +#define Header_SetItem(hwndHD, index, phdi) (BOOL)SendMessage((hwndHD), HDM_SETITEM, (WPARAM)(int)(index), (LPARAM)(const HD_ITEM FAR*)(phdi)) + +/* List View */ +#define ListView_Arrange(hwndLV, code) SendMessage((hwndLV), LVM_ARRANGE, (WPARAM)(UINT)(code), 0) + +#define ListView_CreateDragImage(hwnd, i, lpptUpLeft) SendMessage((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft)) + +#define ListView_DeleteAllItems(hwnd) SendMessage(hwnd, LVM_DELETEALLITEMS, 0, 0) + +#define ListView_DeleteColumn(hwnd, iCol) SendMessage((hwnd), LVM_DELETECOLUMN, (WPARAM)(int)(iCol), 0) + +#define ListView_DeleteItem(hwnd, iItem) SendMessage(hwnd, LVM_DELETEITEM, (WPARAM)(int)iItem, 0) + +#define ListView_EditLabel(hwndLV, i) SendMessage((hwndLV), LVM_EDITLABEL, (WPARAM)(int)i, 0) + +#define ListView_EnsureVisible(hwndLV, i, fPartialOK) SendMessage(hwndLV, LVM_ENSUREVISIBLE, (WPARAM)(int)i, MAKELPARAM((fPartialOK), 0)) + +#define ListView_FindItem(hwnd, iStart, plvfi) SendMessage(hwnd, LVM_FINDITEM, (WPARAM)(int)iStart, (LPARAM)(const LV_FINDINFO *)plvfi) + +#define ListView_GetBkColor(hwnd) SendMessage((HWND)hwnd, LVM_GETBKCOLOR, 0, 0) + +#define ListView_GetCallbackMask(hwnd) SendMessage(hwnd, LVM_GETCALLBACKMASK, 0, 0) + +#define ListView_GetColumn(hwnd, iCol, pcol) SendMessage((hwnd), LVM_GETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(LV_COLUMN *)(pcol)) + +#define ListView_GetColumnWidth(hwnd, iCol) SendMessage((hwnd), LVM_GETCOLUMNWIDTH, (WPARAM)(int)(iCol), 0) + +#define ListView_GetCountPerPage(hwndLV) SendMessage((hwndLV), LVM_GETCOUNTPERPAGE, 0, 0) + +#define ListView_GetEditControl(hwndLV) SendMessage((hwndLV), LVM_GETEDITCONTROL, 0, 0) + +#define ListView_GetImageList(hwnd, iImageList) SendMessage(hwnd, LVM_GETIMAGELIST, (WPARAM)(INT)iImageList, 0) + +#define ListView_GetISearchString(hwndLV, lpsz) SendMessage((hwndLV), LVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz) + +#define ListView_GetItem(hwnd, pitem) SendMessage(hwnd, LVM_GETITEM, 0, (LPARAM)(LV_ITEM *)(pitem)) + +#define ListView_GetItemCount(hwnd) SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0) + +#define ListView_GetItemPosition(hwndLV, i, ppt) SendMessage(hwndLV, LVM_GETITEMPOSITION, (WPARAM)(int)i, (LPARAM)(POINT *)ppt) + +#define ListView_GetItemRect(hwnd, i, prc, code) SendMessage(hwnd, LVM_GETITEMRECT, (WPARAM)(int)i, ((prc) ? (((RECT *)(prc))->left = (code), (LPARAM)(RECT *)(prc)) : (LPARAM)(RECT *)NULL)) + +#define ListView_GetItemSpacing(hwndLV, fSmall) SendMessage((hwndLV), LVM_GETITEMSPACING, fSmall, 0) + +#define ListView_GetItemState(hwndLV, i, mask) SendMessage((hwndLV), LVM_GETITEMSTATE, (WPARAM)i, (LPARAM)mask) + +#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_) { LV_ITEM _gnu_lvi;_gnu_lvi.iSubItem = iSubItem_;_gnu_lvi.cchTextMax = cchTextMax_;_gnu_lvi.pszText = pszText_;SendMessage((hwndLV), LVM_GETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM *)&_gnu_lvi);} + +#define ListView_GetNextItem(hwnd, iStart, flags) SendMessage(hwnd, LVM_GETNEXTITEM, (WPARAM)(int)iStart, (LPARAM)flags) + +#define ListView_GetOrigin(hwndLV, ppt) SendMessage((hwndLV), LVM_GETORIGIN, (WPARAM)0, (LPARAM)(POINT *)(ppt)) + +#define ListView_GetSelectedCount(hwndLV) SendMessage((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0) + +#define ListView_GetStringWidth(hwndLV, psz) SendMessage(hwndLV, LVM_GETSTRINGWIDTH, 0, (LPARAM)(LPCTSTR)psz) + +#define ListView_GetTextBkColor(hwnd) SendMessage((hwnd), LVM_GETTEXTBKCOLOR, 0, 0) + +#define ListView_GetTextColor(hwnd) SendMessage((hwnd), LVM_GETTEXTCOLOR, 0, 0) + +#define ListView_GetTopIndex(hwndLV) SendMessage((hwndLV), LVM_GETTOPINDEX, 0, 0) + +#define ListView_GetViewRect(hwnd, prc) SendMessage((hwnd), LVM_GETVIEWRECT, 0, (LPARAM)(RECT *)(prc)) + +#define ListView_HitTest(hwndLV, pinfo) SendMessage(hwndLV, LVM_HITTEST, 0, (LPARAM)(LV_HITTESTINFO *)pinfo) + +#define ListView_InsertColumn(hwnd, iCol, pcol) SendMessage((hwnd), LVM_INSERTCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN *)(pcol)) + +#define ListView_InsertItem(hwnd, pitem) SendMessage(hwnd, LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM *)pitem) + +#define ListView_RedrawItems(hwndLV, iFirst, iLast) SendMessage((hwndLV), LVM_REDRAWITEMS, (WPARAM)(int)iFirst, (LPARAM)(int)iLast) + +#define ListView_Scroll(hwndLV, dx, dy) SendMessage((hwndLV), LVM_SCROLL, (WPARAM)(int)dx, (LPARAM)(int)dy) + +#define ListView_SetBkColor(hwnd, clrBk) SendMessage(hwnd, LVM_SETBKCOLOR, 0, (LPARAM)(COLORREF)clrBk) + +#define ListView_SetCallbackMask(hwnd, mask) SendMessage(hwnd, LVM_SETCALLBACKMASK, (WPARAM)(UINT)(mask), 0) + +#define ListView_SetColumn(hwnd, iCol, pcol) SendMessage((hwnd), LVM_SETCOLUMN, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMN *)(pcol)) + +#define ListView_SetColumnWidth(hwnd, iCol, cx) SendMessage((hwnd), LVM_SETCOLUMNWIDTH, (WPARAM)(int)(iCol), MAKELPARAM((cx), 0)) + + +#define ListView_SetImageList(hwnd, himl, iImageList) SendMessage(hwnd, LVM_SETIMAGELIST, (WPARAM)(iImageList), (LPARAM)(UINT)(HIMAGELIST)(himl)) + +#define ListView_SetItem(hwnd, pitem) SendMessage(hwnd, LVM_SETITEM, 0, (LPARAM)(const LV_ITEM *)pitem) + +#define ListView_SetItemCount(hwndLV, cItems) SendMessage((hwndLV), LVM_SETITEMCOUNT, (WPARAM)cItems, 0) + +#define ListView_SetItemPosition(hwndLV, i, x, y) SendMessage(hwndLV, LVM_SETITEMPOSITION, (WPARAM)(int)(i), MAKELPARAM((x), (y))) + +#define ListView_SetItemPosition32(hwndLV, i, x, y) { POINT ptNewPos = {x,y}; SendMessage((hwndLV), LVM_SETITEMPOSITION32, (WPARAM)(int)(i), (LPARAM)&ptNewPos); } + +#define ListView_SetItemState(hwndLV, i, data, mask) { LV_ITEM _gnu_lvi; _gnu_lvi.stateMask = mask; _gnu_lvi.state = data; SendMessage((hwndLV), LVM_SETITEMSTATE, (WPARAM)i, (LPARAM)(LV_ITEM *)&_gnu_lvi);} + +#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_) { LV_ITEM _gnu_lvi; _gnu_lvi.iSubItem = iSubItem_; _gnu_lvi.pszText = pszText_; SendMessage((hwndLV), LVM_SETITEMTEXT, (WPARAM)i, (LPARAM)(LV_ITEM *)&_gnu_lvi);} + +#define ListView_SetTextBkColor(hwnd, clrTextBk) SendMessage((hwnd), LVM_SETTEXTBKCOLOR, 0, (LPARAM)(COLORREF)(clrTextBk)) + +#define ListView_SetTextColor(hwnd, clrText) SendMessage((hwnd), LVM_SETTEXTCOLOR, 0, (LPARAM)(COLORREF)(clrText)) + +#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm) SendMessage((hwndLV), LVM_SORTITEMS, (WPARAM)(LPARAM)_lPrm, (LPARAM)(PFNLVCOMPARE)_pfnCompare) + +#define ListView_Update(hwndLV, i) SendMessage((hwndLV), LVM_UPDATE, (WPARAM)i, 0) + +/* Tree View */ +#define TreeView_InsertItem(hwnd, lpis) SendMessage((hwnd), TVM_INSERTITEM, 0, (LPARAM)(LPTV_INSERTSTRUCT)(lpis)) + +#define TreeView_DeleteItem(hwnd, hitem) SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_DeleteAllItems(hwnd) SendMessage((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT) + +#define TreeView_Expand(hwnd, hitem, code) SendMessage((hwnd), TVM_EXPAND, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_GetItemRect(hwnd, hitem, prc, code) SendMessage((hwnd), TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT *)(prc))) + +#define TreeView_GetCount(hwnd) SendMessage((hwnd), TVM_GETCOUNT, 0, 0) + +#define TreeView_GetIndent(hwnd) SendMessage((hwnd), TVM_GETINDENT, 0, 0) + +#define TreeView_SetIndent(hwnd, indent) SendMessage((hwnd), TVM_SETINDENT, (WPARAM)indent, 0) + +#define TreeView_GetImageList(hwnd, iImage) SendMessage((hwnd), TVM_GETIMAGELIST, iImage, 0) + +#define TreeView_SetImageList(hwnd, himl, iImage) SendMessage((hwnd), TVM_SETIMAGELIST, iImage, (LPARAM)(UINT)(HIMAGELIST)(himl)) + +#define TreeView_GetNextItem(hwnd, hitem, code) SendMessage((hwnd), TVM_GETNEXTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_GetChild(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_CHILD) + +#define TreeView_GetNextSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_NEXT) + +#define TreeView_GetPrevSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUS) + +#define TreeView_GetParent(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PARENT) + +#define TreeView_GetFirstVisible(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_FIRSTVISIBLE) + +#define TreeView_GetNextVisible(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_NEXTVISIBLE) + +#define TreeView_GetPrevVisible(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TVGN_PREVIOUSVISIBLE) + +#define TreeView_GetSelection(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_CARET) + +#define TreeView_GetDropHilight(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_DROPHILITE) + +#define TreeView_GetRoot(hwnd) TreeView_GetNextItem(hwnd, NULL, TVGN_ROOT) + +#define TreeView_Select(hwnd, hitem, code) SendMessage((hwnd), TVM_SELECTITEM, (WPARAM)code, (LPARAM)(HTREEITEM)(hitem)) + + +#define TreeView_SelectItem(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_CARET) + +#define TreeView_SelectDropTarget(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_DROPHILITE) + +#define TreeView_SelectSetFirstVisible(hwnd, hitem) TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE) + +#define TreeView_GetItem(hwnd, pitem) SendMessage((hwnd), TVM_GETITEM, 0, (LPARAM)(TV_ITEM *)(pitem)) + +#define TreeView_SetItem(hwnd, pitem) SendMessage((hwnd), TVM_SETITEM, 0, (LPARAM)(const TV_ITEM *)(pitem)) + +#define TreeView_EditLabel(hwnd, hitem) SendMessage((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_GetEditControl(hwnd) SendMessage((hwnd), TVM_GETEDITCONTROL, 0, 0) + +#define TreeView_GetVisibleCount(hwnd) SendMessage((hwnd), TVM_GETVISIBLECOUNT, 0, 0) + +#define TreeView_HitTest(hwnd, lpht) SendMessage((hwnd), TVM_HITTEST, 0, (LPARAM)(LPTV_HITTESTINFO)(lpht)) + +#define TreeView_CreateDragImage(hwnd, hitem) SendMessage((hwnd), TVM_CREATEDRAGIMAGE, 0, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_SortChildren(hwnd, hitem, recurse) SendMessage((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_EnsureVisible(hwnd, hitem) SendMessage((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_SortChildrenCB(hwnd, psort, recurse) SendMessage((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, (LPARAM)(LPTV_SORTCB)(psort)) + +#define TreeView_EndEditLabelNow(hwnd, fCancel) SendMessage((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0) + +#define TreeView_GetISearchString(hwndTV, lpsz) SendMessage((hwndTV), TVM_GETISEARCHSTRING, 0, (LPARAM)(LPTSTR)lpsz) + + +/* Tab control */ +#define TabCtrl_GetImageList(hwnd) SendMessage((hwnd), TCM_GETIMAGELIST, 0, 0) + +#define TabCtrl_SetImageList(hwnd, himl) SendMessage((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl)) + +#define TabCtrl_GetItemCount(hwnd) SendMessage((hwnd), TCM_GETITEMCOUNT, 0, 0) + +#define TabCtrl_GetItem(hwnd, iItem, pitem) SendMessage((hwnd), TCM_GETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM *)(pitem)) + +#define TabCtrl_SetItem(hwnd, iItem, pitem) SendMessage((hwnd), TCM_SETITEM, (WPARAM)(int)iItem, (LPARAM)(TC_ITEM *)(pitem)) + +#define TabCtrl_InsertItem(hwnd, iItem, pitem) SendMessage((hwnd), TCM_INSERTITEM, (WPARAM)(int)iItem, (LPARAM)(const TC_ITEM *)(pitem)) + +#define TabCtrl_DeleteItem(hwnd, i) SendMessage((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0) + +#define TabCtrl_DeleteAllItems(hwnd) SendMessage((hwnd), TCM_DELETEALLITEMS, 0, 0) + +#define TabCtrl_GetItemRect(hwnd, i, prc) SendMessage((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT *)(prc)) + +#define TabCtrl_GetCurSel(hwnd) SendMessage((hwnd), TCM_GETCURSEL, 0, 0) + +#define TabCtrl_SetCurSel(hwnd, i) SendMessage((hwnd), TCM_SETCURSEL, (WPARAM)i, 0) + +#define TabCtrl_HitTest(hwndTC, pinfo) SendMessage((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO *)(pinfo)) + +#define TabCtrl_SetItemExtra(hwndTC, cb) SendMessage((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0) + +#define TabCtrl_AdjustRect(hwnd, bLarger, prc) SendMessage(hwnd, TCM_ADJUSTRECT, (WPARAM)(WINBOOL)bLarger, (LPARAM)(RECT *)prc) + +#define TabCtrl_SetItemSize(hwnd, x, y) SendMessage((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y)) + +#define TabCtrl_RemoveImage(hwnd, i) SendMessage((hwnd), TCM_REMOVEIMAGE, i, 0) + +#define TabCtrl_SetPadding(hwnd, cx, cy) SendMessage((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy)) + +#define TabCtrl_GetRowCount(hwnd) SendMessage((hwnd), TCM_GETROWCOUNT, 0, 0) + +#define TabCtrl_GetToolTips(hwnd) SendMessage((hwnd), TCM_GETTOOLTIPS, 0, 0) + +#define TabCtrl_SetToolTips(hwnd, hwndTT) SendMessage((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0) + +#define TabCtrl_GetCurFocus(hwnd) SendMessage((hwnd), TCM_GETCURFOCUS, 0, 0) + +#define TabCtrl_SetCurFocus(hwnd, i) SendMessage((hwnd),TCM_SETCURFOCUS, i, 0) + +#define CommDlg_OpenSave_GetSpecA(_hdlg, _psz, _cbmax) SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz) + +#define CommDlg_OpenSave_GetSpecW(_hdlg, _psz, _cbmax) SNDMSG(_hdlg, CDM_GETSPEC, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz) + +#ifdef UNICODE +#define CommDlg_OpenSave_GetSpec CommDlg_OpenSave_GetSpecW +#else +#define CommDlg_OpenSave_GetSpec CommDlg_OpenSave_GetSpecA +#endif /* !UNICODE */ + +#define CommDlg_OpenSave_GetFilePathA(_hdlg, _psz, _cbmax) SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz) + +#define CommDlg_OpenSave_GetFilePathW(_hdlg, _psz, _cbmax) SNDMSG(_hdlg, CDM_GETFILEPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz) + +#ifdef UNICODE +#define CommDlg_OpenSave_GetFilePath CommDlg_OpenSave_GetFilePathW +#else +#define CommDlg_OpenSave_GetFilePath CommDlg_OpenSave_GetFilePathA +#endif /* !UNICODE */ + +#define CommDlg_OpenSave_GetFolderPathA(_hdlg, _psz, _cbmax) SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPSTR)_psz) + +#define CommDlg_OpenSave_GetFolderPathW(_hdlg, _psz, _cbmax) SNDMSG(_hdlg, CDM_GETFOLDERPATH, (WPARAM)_cbmax, (LPARAM)(LPWSTR)_psz) + +#ifdef UNICODE +#define CommDlg_OpenSave_GetFolderPath CommDlg_OpenSave_GetFolderPathW +#else +#define CommDlg_OpenSave_GetFolderPath CommDlg_OpenSave_GetFolderPathA +#endif /* !UNICODE */ + +#define CommDlg_OpenSave_GetFolderIDList(_hdlg, _pidl, _cbmax) SNDMSG(_hdlg, CDM_GETFOLDERIDLIST, (WPARAM)_cbmax, (LPARAM)(LPVOID)_pidl) + +#define CommDlg_OpenSave_SetControlText(_hdlg, _id, _text) SNDMSG(_hdlg, CDM_SETCONTROLTEXT, (WPARAM)_id, (LPARAM)(LPSTR)_text) + +#define CommDlg_OpenSave_HideControl(_hdlg, _id) SNDMSG(_hdlg, CDM_HIDECONTROL, (WPARAM)_id, 0) + +#define CommDlg_OpenSave_SetDefExt(_hdlg, _pszext) SNDMSG(_hdlg, CDM_SETDEFEXT, 0, (LPARAM)(LPSTR)_pszext) + +LONG +STDCALL +RegCloseKey ( + HKEY hKey + ); + +LONG +STDCALL +RegSetKeySecurity ( + HKEY hKey, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor + ); + +LONG +STDCALL +RegFlushKey ( + HKEY hKey + ); + +LONG +STDCALL +RegGetKeySecurity ( + HKEY hKey, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + LPDWORD lpcbSecurityDescriptor + ); + +LONG +STDCALL +RegNotifyChangeKeyValue ( + HKEY hKey, + WINBOOL bWatchSubtree, + DWORD dwNotifyFilter, + HANDLE hEvent, + WINBOOL fAsynchronus + ); + +WINBOOL +STDCALL +IsValidCodePage( + UINT CodePage); + + +UINT +STDCALL +GetACP(void); + + +UINT +STDCALL +GetOEMCP(void); + + +WINBOOL +STDCALL +GetCPInfo(UINT, LPCPINFO); + + +WINBOOL +STDCALL +IsDBCSLeadByte( + BYTE TestChar); + + +WINBOOL +STDCALL +IsDBCSLeadByteEx( + UINT CodePage, + BYTE TestChar); + + +int +STDCALL +MultiByteToWideChar( + UINT CodePage, + DWORD dwFlags, + LPCSTR lpMultiByteStr, + int cchMultiByte, + LPWSTR lpWideCharStr, + int cchWideChar); + + +int +STDCALL +WideCharToMultiByte( + UINT CodePage, + DWORD dwFlags, + LPCWSTR lpWideCharStr, + int cchWideChar, + LPSTR lpMultiByteStr, + int cchMultiByte, + LPCSTR lpDefaultChar, + LPBOOL lpUsedDefaultChar); + +WINBOOL +STDCALL +IsValidLocale( + LCID Locale, + DWORD dwFlags); + + +LCID +STDCALL +ConvertDefaultLocale( + LCID Locale); + + +LCID +STDCALL +GetThreadLocale(void); + + +WINBOOL +STDCALL +SetThreadLocale( + LCID Locale + ); + + +LANGID +STDCALL +GetSystemDefaultLangID(void); + + +LANGID +STDCALL +GetUserDefaultLangID(void); + + +LCID +STDCALL +GetSystemDefaultLCID(void); + + +LCID +STDCALL +GetUserDefaultLCID(void); + + +WINBOOL +STDCALL +ReadConsoleOutputAttribute( + HANDLE hConsoleOutput, + LPWORD lpAttribute, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfAttrsRead + ); + + +WINBOOL +STDCALL +WriteConsoleOutputAttribute( + HANDLE hConsoleOutput, + CONST WORD *lpAttribute, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfAttrsWritten + ); + + +WINBOOL +STDCALL +FillConsoleOutputAttribute( + HANDLE hConsoleOutput, + WORD wAttribute, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfAttrsWritten + ); + + +WINBOOL +STDCALL +GetConsoleMode( + HANDLE hConsoleHandle, + LPDWORD lpMode + ); + + +WINBOOL +STDCALL +GetNumberOfConsoleInputEvents( + HANDLE hConsoleInput, + LPDWORD lpNumberOfEvents + ); + + +WINBOOL +STDCALL +GetConsoleScreenBufferInfo( + HANDLE hConsoleOutput, + PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo + ); + + +COORD +STDCALL +GetLargestConsoleWindowSize( + HANDLE hConsoleOutput + ); + + +WINBOOL +STDCALL +GetConsoleCursorInfo( + HANDLE hConsoleOutput, + PCONSOLE_CURSOR_INFO lpConsoleCursorInfo + ); + + +WINBOOL +STDCALL +GetNumberOfConsoleMouseButtons( + LPDWORD lpNumberOfMouseButtons + ); + + +WINBOOL +STDCALL +SetConsoleMode( + HANDLE hConsoleHandle, + DWORD dwMode + ); + + +WINBOOL +STDCALL +SetConsoleActiveScreenBuffer( + HANDLE hConsoleOutput + ); + + +WINBOOL +STDCALL +FlushConsoleInputBuffer( + HANDLE hConsoleInput + ); + + +WINBOOL +STDCALL +SetConsoleScreenBufferSize( + HANDLE hConsoleOutput, + COORD dwSize + ); + + +WINBOOL +STDCALL +SetConsoleCursorPosition( + HANDLE hConsoleOutput, + COORD dwCursorPosition + ); + + +WINBOOL +STDCALL +SetConsoleCursorInfo( + HANDLE hConsoleOutput, + CONST CONSOLE_CURSOR_INFO *lpConsoleCursorInfo + ); + +WINBOOL +STDCALL +SetConsoleWindowInfo( + HANDLE hConsoleOutput, + WINBOOL bAbsolute, + CONST SMALL_RECT *lpConsoleWindow + ); + + +WINBOOL +STDCALL +SetConsoleTextAttribute( + HANDLE hConsoleOutput, + WORD wAttributes + ); + + +WINBOOL +STDCALL +SetConsoleCtrlHandler( + PHANDLER_ROUTINE HandlerRoutine, + WINBOOL Add + ); + + +WINBOOL +STDCALL +GenerateConsoleCtrlEvent( + DWORD dwCtrlEvent, + DWORD dwProcessGroupId + ); + + +WINBOOL +STDCALL +AllocConsole( VOID ); + + +WINBOOL +STDCALL +FreeConsole( VOID ); + + + +HANDLE +STDCALL +CreateConsoleScreenBuffer( + DWORD dwDesiredAccess, + DWORD dwShareMode, + CONST SECURITY_ATTRIBUTES *lpSecurityAttributes, + DWORD dwFlags, + LPVOID lpScreenBufferData + ); + + +UINT +STDCALL +GetConsoleCP( VOID ); + + +WINBOOL +STDCALL +SetConsoleCP( + UINT wCodePageID + ); + + +UINT +STDCALL +GetConsoleOutputCP( VOID ); + + +WINBOOL +STDCALL +SetConsoleOutputCP( + UINT wCodePageID + ); + +DWORD STDCALL +WNetConnectionDialog( + HWND hwnd, + DWORD dwType + ); + +DWORD STDCALL +WNetDisconnectDialog( + HWND hwnd, + DWORD dwType + ); + +DWORD STDCALL +WNetCloseEnum( + HANDLE hEnum + ); + +WINBOOL +STDCALL +CloseServiceHandle( + SC_HANDLE hSCObject + ); + + +WINBOOL +STDCALL +ControlService( + SC_HANDLE hService, + DWORD dwControl, + LPSERVICE_STATUS lpServiceStatus + ); + +WINBOOL +STDCALL +DeleteService( + SC_HANDLE hService + ); + +SC_LOCK +STDCALL +LockServiceDatabase( + SC_HANDLE hSCManager + ); + + +WINBOOL +STDCALL +NotifyBootConfigStatus( + WINBOOL BootAcceptable + ); + +WINBOOL +STDCALL +QueryServiceObjectSecurity( + SC_HANDLE hService, + SECURITY_INFORMATION dwSecurityInformation, + PSECURITY_DESCRIPTOR lpSecurityDescriptor, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded + ); + + +WINBOOL +STDCALL +QueryServiceStatus( + SC_HANDLE hService, + LPSERVICE_STATUS lpServiceStatus + ); + +WINBOOL +STDCALL +SetServiceObjectSecurity( + SC_HANDLE hService, + SECURITY_INFORMATION dwSecurityInformation, + PSECURITY_DESCRIPTOR lpSecurityDescriptor + ); + + +WINBOOL +STDCALL +SetServiceStatus( + SERVICE_STATUS_HANDLE hServiceStatus, + LPSERVICE_STATUS lpServiceStatus + ); + +WINBOOL +STDCALL +UnlockServiceDatabase( + SC_LOCK ScLock + ); + +/* Extensions to OpenGL */ + +int STDCALL +ChoosePixelFormat(HDC, CONST PIXELFORMATDESCRIPTOR *); + +int STDCALL +DescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); + +UINT STDCALL +GetEnhMetaFilePixelFormat(HENHMETAFILE, DWORD, + CONST PIXELFORMATDESCRIPTOR *); + +int STDCALL +GetPixelFormat(HDC); + +WINBOOL STDCALL +SetPixelFormat(HDC, int, CONST PIXELFORMATDESCRIPTOR *); + +WINBOOL STDCALL +SwapBuffers(HDC); + +HGLRC STDCALL +wglCreateContext(HDC); + +HGLRC STDCALL +wglCreateLayerContext(HDC, int); + +WINBOOL STDCALL +wglCopyContext(HGLRC, HGLRC, UINT); + +WINBOOL STDCALL +wglDeleteContext(HGLRC); + +WINBOOL STDCALL +wglDescribeLayerPlane(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR); + +HGLRC STDCALL +wglGetCurrentContext(VOID); + +HDC STDCALL +wglGetCurrentDC(VOID); + +int STDCALL +wglGetLayerPaletteEntries(HDC, int, int, int, CONST COLORREF *); + +PROC STDCALL +wglGetProcAddress(LPCSTR); + +WINBOOL STDCALL +wglMakeCurrent(HDC, HGLRC); + +WINBOOL STDCALL +wglRealizeLayerPalette(HDC, int, WINBOOL); + +int STDCALL +wglSetLayerPaletteEntries(HDC, int, int, int, CONST COLORREF *); + +WINBOOL STDCALL +wglShareLists(HGLRC, HGLRC); + +WINBOOL STDCALL +wglSwapLayerBuffers(HDC, UINT); + +/* + Why are these different between ANSI and UNICODE? + There doesn't seem to be any difference. + */ + +#ifdef UNICODE +#define wglUseFontBitmaps wglUseFontBitmapsW +#define wglUseFontOutlines wglUseFontOutlinesW +#else +#define wglUseFontBitmaps wglUseFontBitmapsA +#define wglUseFontOutlines wglUseFontOutlinesA +#endif /* !UNICODE */ + +/* ------------------------------------- */ +/* From shellapi.h in old Cygnus headers */ + +WINBOOL WINAPI +DragQueryPoint (HDROP, LPPOINT); + +void WINAPI +DragFinish (HDROP); + +void WINAPI +DragAcceptFiles (HWND, WINBOOL); + +HICON WINAPI +DuplicateIcon (HINSTANCE, HICON); + +/* end of stuff from shellapi.h in old Cygnus headers */ +/* -------------------------------------------------- */ +/* From ddeml.h in old Cygnus headers */ + +HCONV WINAPI DdeConnect (DWORD, HSZ, HSZ, CONVCONTEXT *); +WINBOOL WINAPI DdeDisconnect (HCONV); +WINBOOL WINAPI DdeFreeDataHandle (HDDEDATA); +DWORD WINAPI DdeGetData (HDDEDATA, BYTE *, DWORD, DWORD); +UINT WINAPI DdeGetLastError (DWORD); +HDDEDATA WINAPI DdeNameService (DWORD, HSZ, HSZ, UINT); +WINBOOL WINAPI DdePostAdvise (DWORD, HSZ, HSZ); +HCONV WINAPI DdeReconnect (HCONV); +WINBOOL WINAPI DdeUninitialize (DWORD); +int WINAPI DdeCmpStringHandles (HSZ, HSZ); +HDDEDATA WINAPI DdeCreateDataHandle (DWORD, LPBYTE, DWORD, DWORD, HSZ, + UINT, UINT); + +/* end of stuff from ddeml.h in old Cygnus headers */ +/* ----------------------------------------------- */ + +DWORD STDCALL NetUserEnum (LPWSTR, DWORD, DWORD, LPBYTE*, DWORD, LPDWORD, + LPDWORD, LPDWORD); +DWORD STDCALL NetApiBufferFree (LPVOID); +DWORD STDCALL NetUserGetInfo (LPWSTR, LPWSTR, DWORD, LPBYTE); +DWORD STDCALL NetGetDCName (LPWSTR, LPWSTR, LPBYTE*); +DWORD STDCALL NetGroupEnum (LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, + LPDWORD, LPDWORD); +DWORD STDCALL NetLocalGroupEnum (LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, + LPDWORD, LPDWORD); + +void WINAPI +SHAddToRecentDocs (UINT, LPCVOID); + +LPITEMIDLIST WINAPI +SHBrowseForFolder (LPBROWSEINFO); + +void WINAPI +SHChangeNotify (LONG, UINT, LPCVOID, LPCVOID); + +int WINAPI +SHFileOperation (LPSHFILEOPSTRUCT); + +void WINAPI +SHFreeNameMappings (HANDLE); + +/* Define when SHELLFOLDER is defined. +HRESULT WINAPI +SHGetDataFromIDList (LPSHELLFOLDER, LPCITEMIDLIST, int, PVOID, int); + +HRESULT WINAPI +SHGetDesktopFolder (LPSHELLFOLDER); +*/ + +DWORD WINAPI +SHGetFileInfo (LPCTSTR, DWORD, SHFILEINFO FAR *, UINT, UINT); + +/* Define when IUnknown is defined. +HRESULT WINAPI +SHGetInstanceExplorer (IUnknown **); +*/ + +/* Define when MALLOC is defined. +HRESULT WINAPI +SHGetMalloc (LPMALLOC *); +*/ + +WINBOOL WINAPI +SHGetPathFromIDList (LPCITEMIDLIST, LPTSTR); + +HRESULT WINAPI +SHGetSpecialFolderLocation (HWND, int, LPITEMIDLIST *); + +/* Define when REFCLSID is defined. +HRESULT WINAPI +SHLoadInProc (REFCLSID); +*/ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ diff --git a/reactos/include/internal/bitops.h b/reactos/include/internal/bitops.h new file mode 100644 index 00000000000..460c2708da3 --- /dev/null +++ b/reactos/include/internal/bitops.h @@ -0,0 +1,140 @@ +#ifndef _I386_BITOPS_H +#define _I386_BITOPS_H + +/* + * Copyright 1992, Linus Torvalds. + */ +/* + * Reused for the ReactOS kernel by David Welch (1998) + */ + +/* + * These have to be done with inline assembly: that way the bit-setting + * is guaranteed to be atomic. All bit operations return 0 if the bit + * was cleared before the operation and != 0 if it was not. + * + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +#ifdef __SMP__ +#define LOCK_PREFIX "lock ; " +#define SMPVOL volatile +#else +#define LOCK_PREFIX "" +#define SMPVOL +#endif + +/* + * Some hacks to defeat gcc over-optimizations.. + */ +struct __dummy { unsigned long a[100]; }; +#define ADDR (*(struct __dummy *) addr) +#define CONST_ADDR (*(const struct __dummy *) addr) + +extern __inline__ int set_bit(int nr, SMPVOL void * addr) +{ + int oldbit; + + __asm__ __volatile__(LOCK_PREFIX + "btsl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"ir" (nr)); + return oldbit; +} + +extern __inline__ int clear_bit(int nr, SMPVOL void * addr) +{ + int oldbit; + + __asm__ __volatile__(LOCK_PREFIX + "btrl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"ir" (nr)); + return oldbit; +} + +extern __inline__ int change_bit(int nr, SMPVOL void * addr) +{ + int oldbit; + + __asm__ __volatile__(LOCK_PREFIX + "btcl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"ir" (nr)); + return oldbit; +} + +/* + * This routine doesn't need to be atomic. + */ +extern __inline__ int test_bit(int nr, const SMPVOL void * addr) +{ + return ((1UL << (nr & 31)) & (((const unsigned int *) addr)[nr >> 5])) != 0; +} + +/* + * Find-bit routines.. + */ +extern __inline__ int find_first_zero_bit(void * addr, unsigned size) +{ + int res; + + if (!size) + return 0; + __asm__("cld\n\t" + "movl $-1,%%eax\n\t" + "xorl %%edx,%%edx\n\t" + "repe; scasl\n\t" + "je 1f\n\t" + "xorl -4(%%edi),%%eax\n\t" + "subl $4,%%edi\n\t" + "bsfl %%eax,%%edx\n" + "1:\tsubl %%ebx,%%edi\n\t" + "shll $3,%%edi\n\t" + "addl %%edi,%%edx" + :"=d" (res) + :"c" ((size + 31) >> 5), "D" (addr), "b" (addr) + :"ax", "cx", "di"); + return res; +} + +extern __inline__ int find_next_zero_bit (void * addr, int size, int offset) +{ + unsigned long * p = ((unsigned long *) addr) + (offset >> 5); + int set = 0, bit = offset & 31, res; + + if (bit) { + /* + * Look for zero in first byte + */ + __asm__("bsfl %1,%0\n\t" + "jne 1f\n\t" + "movl $32, %0\n" + "1:" + : "=r" (set) + : "r" (~(*p >> bit))); + if (set < (32 - bit)) + return set + offset; + set = 32 - bit; + p++; + } + /* + * No zero yet, search remaining full bytes for a zero + */ + res = find_first_zero_bit (p, size - 32 * (p - (unsigned long *) addr)); + return (offset + set + res); +} + +/* + * ffz = Find First Zero in word. Undefined if no zero exists, + * so code should check against ~0UL first.. + */ +extern __inline__ unsigned long ffz(unsigned long word) +{ + __asm__("bsfl %1,%0" + :"=r" (word) + :"r" (~word)); + return word; +} + +#endif /* _I386_BITOPS_H */ diff --git a/reactos/include/internal/ctype.h b/reactos/include/internal/ctype.h new file mode 100644 index 00000000000..838ef933d16 --- /dev/null +++ b/reactos/include/internal/ctype.h @@ -0,0 +1,34 @@ +#ifndef _LINUX_CTYPE_H +#define _LINUX_CTYPE_H + +#define _U 0x01 /* upper */ +#define _L 0x02 /* lower */ +#define _D 0x04 /* digit */ +#define _C 0x08 /* cntrl */ +#define _P 0x10 /* punct */ +#define _S 0x20 /* white space (space/lf/tab) */ +#define _X 0x40 /* hex digit */ +#define _SP 0x80 /* hard space (0x20) */ + +extern unsigned char _ctype[]; +extern char _ctmp; + +#define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D)) +#define isalpha(c) ((_ctype+1)[c]&(_U|_L)) +#define iscntrl(c) ((_ctype+1)[c]&(_C)) +#define isdigit(c) ((_ctype+1)[c]&(_D)) +#define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D)) +#define islower(c) ((_ctype+1)[c]&(_L)) +#define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP)) +#define ispunct(c) ((_ctype+1)[c]&(_P)) +#define isspace(c) ((_ctype+1)[c]&(_S)) +#define isupper(c) ((_ctype+1)[c]&(_U)) +#define isxdigit(c) ((_ctype+1)[c]&(_D|_X)) + +#define isascii(c) (((unsigned) c)<=0x7f) +#define toascii(c) (((unsigned) c)&0x7f) + +#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp) +#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp) + +#endif diff --git a/reactos/include/internal/debug.h b/reactos/include/internal/debug.h new file mode 100644 index 00000000000..055c54ec2e7 --- /dev/null +++ b/reactos/include/internal/debug.h @@ -0,0 +1,70 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: include/internal/debug.h + * PURPOSE: Useful debugging macros + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + * 28/05/98: Created + */ + +/* + * NOTE: Define NDEBUG before including this header to disable debugging + * macros + */ + +#ifndef __INTERNAL_DEBUG +#define __INTERNAL_DEBUG + + +#ifndef NDEBUG +#define DPRINT(fmt,args...) do { printk("(%s:%d) ",__FILE__,__LINE__); printk(fmt,args); } while(0); +//#define assert(x) if (!(x)) {printk("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); (*((unsigned int *)0))=1; for (;;); } +#define assert(x) if (!(x)) {printk("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); for (;;); } +#define CHECKPOINT printk("%s:%d\n",__FILE__,__LINE__) +#else +#define DPRINT(fmt,args...) +#define assert(x) +#define CHECKPOINT +#endif /* NDEBUG */ + +/* + * FUNCTION: Assert a maximum value for the current irql + * ARGUMENTS: + * x = Maximum irql + */ +#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x)) + +#define HBP_EXECUTE (0) +#define HBP_WRITE (1) +#define HBP_READWRITE (3) + +#define HBP_BYTE (0) +#define HBP_WORD (1) +#define HBP_DWORD (3) + +/* + * FUNCTION: Sets a hardware breakpoint + * ARGUMENTS: + * i = breakpoint to set (0 to 3) + * addr = linear address to break on + * type = Type of access to break on + * len = length of the variable to watch + * NOTES: + * The variable to watch must be aligned to its length (i.e. a dword + * breakpoint must be aligned to a dword boundary) + * + * A fatal exception will be generated on the access to the variable. + * It is (at the moment) only really useful for catching undefined + * pointers if you know the variable effected but not the buggy + * routine. + * + * FIXME: Extend to call out to kernel debugger on breakpoint + * Add support for I/O breakpoints + * REFERENCES: See the i386 programmer manual for more details + */ +void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type, + unsigned int len); + + +#endif /* __INTERNAL_DEBUG */ diff --git a/reactos/include/internal/dma.h b/reactos/include/internal/dma.h new file mode 100644 index 00000000000..07eff2e19bb --- /dev/null +++ b/reactos/include/internal/dma.h @@ -0,0 +1,267 @@ +/* $Id: dma.h,v 1.1 1996/01/23 01:02:19 rosmgr Exp $ + * linux/include/asm/dma.h: Defines for using and allocating dma channels. + * Written by Hennus Bergman, 1992. + * High DMA channel support & info by Hannu Savolainen + * and John Boyd, Nov. 1992. + */ + +#ifndef _ASM_DMA_H +#define _ASM_DMA_H + +#include "io.h" /* need byte IO */ + + +#ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER +#define dma_outb outb_p +#else +#define dma_outb outb +#endif + +#define dma_inb inb + +/* + * NOTES about DMA transfers: + * + * controller 1: channels 0-3, byte operations, ports 00-1F + * controller 2: channels 4-7, word operations, ports C0-DF + * + * - ALL registers are 8 bits only, regardless of transfer size + * - channel 4 is not used - cascades 1 into 2. + * - channels 0-3 are byte - addresses/counts are for physical bytes + * - channels 5-7 are word - addresses/counts are for physical words + * - transfers must not cross physical 64K (0-3) or 128K (5-7) boundaries + * - transfer count loaded to registers is 1 less than actual count + * - controller 2 offsets are all even (2x offsets for controller 1) + * - page registers for 5-7 don't use data bit 0, represent 128K pages + * - page registers for 0-3 use bit 0, represent 64K pages + * + * DMA transfers are limited to the lower 16MB of _physical_ memory. + * Note that addresses loaded into registers must be _physical_ addresses, + * not logical addresses (which may differ if paging is active). + * + * Address mapping for channels 0-3: + * + * A23 ... A16 A15 ... A8 A7 ... A0 (Physical addresses) + * | ... | | ... | | ... | + * | ... | | ... | | ... | + * | ... | | ... | | ... | + * P7 ... P0 A7 ... A0 A7 ... A0 + * | Page | Addr MSB | Addr LSB | (DMA registers) + * + * Address mapping for channels 5-7: + * + * A23 ... A17 A16 A15 ... A9 A8 A7 ... A1 A0 (Physical addresses) + * | ... | \ \ ... \ \ \ ... \ \ + * | ... | \ \ ... \ \ \ ... \ (not used) + * | ... | \ \ ... \ \ \ ... \ + * P7 ... P1 (0) A7 A6 ... A0 A7 A6 ... A0 + * | Page | Addr MSB | Addr LSB | (DMA registers) + * + * Again, channels 5-7 transfer _physical_ words (16 bits), so addresses + * and counts _must_ be word-aligned (the lowest address bit is _ignored_ at + * the hardware level, so odd-byte transfers aren't possible). + * + * Transfer count (_not # bytes_) is limited to 64K, represented as actual + * count - 1 : 64K => 0xFFFF, 1 => 0x0000. Thus, count is always 1 or more, + * and up to 128K bytes may be transferred on channels 5-7 in one operation. + * + */ + +#define MAX_DMA_CHANNELS 8 + +/* The maximum address that we can perform a DMA transfer to on this platform */ +#define MAX_DMA_ADDRESS 0x1000000 + +/* 8237 DMA controllers */ +#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ +#define IO_DMA2_BASE 0xC0 /* 16 bit master DMA, ch 4(=slave input)..7 */ + +/* DMA controller registers */ +#define DMA1_CMD_REG 0x08 /* command register (w) */ +#define DMA1_STAT_REG 0x08 /* status register (r) */ +#define DMA1_REQ_REG 0x09 /* request register (w) */ +#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */ +#define DMA1_MODE_REG 0x0B /* mode register (w) */ +#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */ +#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */ +#define DMA1_RESET_REG 0x0D /* Master Clear (w) */ +#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */ +#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */ + +#define DMA2_CMD_REG 0xD0 /* command register (w) */ +#define DMA2_STAT_REG 0xD0 /* status register (r) */ +#define DMA2_REQ_REG 0xD2 /* request register (w) */ +#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */ +#define DMA2_MODE_REG 0xD6 /* mode register (w) */ +#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */ +#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */ +#define DMA2_RESET_REG 0xDA /* Master Clear (w) */ +#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */ +#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */ + +#define DMA_ADDR_0 0x00 /* DMA address registers */ +#define DMA_ADDR_1 0x02 +#define DMA_ADDR_2 0x04 +#define DMA_ADDR_3 0x06 +#define DMA_ADDR_4 0xC0 +#define DMA_ADDR_5 0xC4 +#define DMA_ADDR_6 0xC8 +#define DMA_ADDR_7 0xCC + +#define DMA_CNT_0 0x01 /* DMA count registers */ +#define DMA_CNT_1 0x03 +#define DMA_CNT_2 0x05 +#define DMA_CNT_3 0x07 +#define DMA_CNT_4 0xC2 +#define DMA_CNT_5 0xC6 +#define DMA_CNT_6 0xCA +#define DMA_CNT_7 0xCE + +#define DMA_PAGE_0 0x87 /* DMA page registers */ +#define DMA_PAGE_1 0x83 +#define DMA_PAGE_2 0x81 +#define DMA_PAGE_3 0x82 +#define DMA_PAGE_5 0x8B +#define DMA_PAGE_6 0x89 +#define DMA_PAGE_7 0x8A + +#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */ +#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ +#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ + +/* enable/disable a specific DMA channel */ +static __inline__ void enable_dma(unsigned int dmanr) +{ + if (dmanr<=3) + dma_outb(DMA1_MASK_REG, dmanr); + else + dma_outb(DMA2_MASK_REG, dmanr & 3); +} + +static __inline__ void disable_dma(unsigned int dmanr) +{ + if (dmanr<=3) + dma_outb(DMA1_MASK_REG, dmanr | 4); + else + dma_outb(DMA2_MASK_REG, (dmanr & 3) | 4); +} + +/* Clear the 'DMA Pointer Flip Flop'. + * Write 0 for LSB/MSB, 1 for MSB/LSB access. + * Use this once to initialize the FF to a known state. + * After that, keep track of it. :-) + * --- In order to do that, the DMA routines below should --- + * --- only be used while interrupts are disabled! --- + */ +static __inline__ void clear_dma_ff(unsigned int dmanr) +{ + if (dmanr<=3) + dma_outb(DMA1_CLEAR_FF_REG, 0); + else + dma_outb(DMA2_CLEAR_FF_REG, 0); +} + +/* set mode (above) for a specific DMA channel */ +static __inline__ void set_dma_mode(unsigned int dmanr, char mode) +{ + if (dmanr<=3) + dma_outb(DMA1_MODE_REG, mode | dmanr); + else + dma_outb(DMA2_MODE_REG, mode | (dmanr&3)); +} + +/* Set only the page register bits of the transfer address. + * This is used for successive transfers when we know the contents of + * the lower 16 bits of the DMA current address register, but a 64k boundary + * may have been crossed. + */ +static __inline__ void set_dma_page(unsigned int dmanr, char pagenr) +{ + switch(dmanr) { + case 0: + dma_outb(DMA_PAGE_0, pagenr); + break; + case 1: + dma_outb(DMA_PAGE_1, pagenr); + break; + case 2: + dma_outb(DMA_PAGE_2, pagenr); + break; + case 3: + dma_outb(DMA_PAGE_3, pagenr); + break; + case 5: + dma_outb(DMA_PAGE_5, pagenr & 0xfe); + break; + case 6: + dma_outb(DMA_PAGE_6, pagenr & 0xfe); + break; + case 7: + dma_outb(DMA_PAGE_7, pagenr & 0xfe); + break; + } +} + + +/* Set transfer address & page bits for specific DMA channel. + * Assumes dma flipflop is clear. + */ +static __inline__ void set_dma_addr(unsigned int dmanr, unsigned int a) +{ + set_dma_page(dmanr, a>>16); + if (dmanr <= 3) { + dma_outb(((dmanr&3)<<1) + IO_DMA1_BASE, a & 0xff); + dma_outb(((dmanr&3)<<1) + IO_DMA1_BASE, (a>>8) & 0xff ); + } else { + dma_outb( ((dmanr&3)<<2) + IO_DMA2_BASE ,(a>>1) & 0xff ); + dma_outb( ((dmanr&3)<<2) + IO_DMA2_BASE,(a>>9) & 0xff ); + } +} + + +/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for + * a specific DMA channel. + * You must ensure the parameters are valid. + * NOTE: from a manual: "the number of transfers is one more + * than the initial word count"! This is taken into account. + * Assumes dma flip-flop is clear. + * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. + */ +static __inline__ void set_dma_count(unsigned int dmanr, unsigned int count) +{ + count--; + if (dmanr <= 3) { + dma_outb( count & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); + dma_outb( (count>>8) & 0xff, ((dmanr&3)<<1) + 1 + IO_DMA1_BASE ); + } else { + dma_outb( (count>>1) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + dma_outb( (count>>9) & 0xff, ((dmanr&3)<<2) + 2 + IO_DMA2_BASE ); + } +} + + +/* Get DMA residue count. After a DMA transfer, this + * should return zero. Reading this while a DMA transfer is + * still in progress will return unpredictable results. + * If called before the channel has been used, it may return 1. + * Otherwise, it returns the number of _bytes_ left to transfer. + * + * Assumes DMA flip-flop is clear. + */ +static __inline__ int get_dma_residue(unsigned int dmanr) +{ + unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE + : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE; + + /* using short to get 16-bit wrap around */ + unsigned short count; + + count = 1 + dma_inb(io_port); + count += dma_inb(io_port) << 8; + + return (dmanr<=3)? count : (count<<1); +} + + + +#endif /* _ASM_DMA_H */ diff --git a/reactos/include/internal/hal/ddk.h b/reactos/include/internal/hal/ddk.h new file mode 100644 index 00000000000..26f9343f839 --- /dev/null +++ b/reactos/include/internal/hal/ddk.h @@ -0,0 +1,146 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: include/internal/hal/ddk.h + * PURPOSE: HAL provided defintions for device drivers + * PROGRAMMER: David Welch (welch@mcmail.com) + * REVISION HISTORY: + * 23/06/98: Taken from linux system.h + */ + + +#ifndef __INCLUDE_INTERNAL_HAL_DDK_H +#define __INCLUDE_INTERNAL_HAL_DDK_H + +enum +{ + DEVICE_DESCRIPTION_VERSION, + DEVICE_DESCRIPTION_VERSION1, +}; + +typedef ULONG DMA_WIDTH; +typedef ULONG DMA_SPEED; +typedef ULONG BUS_DATA_TYPE; + +/* + * PURPOSE: Types for HalGetBusData + */ +enum +{ + Cmos, + EisaConfiguration, + Pos, + PCIConfiguration, + MaximumBusDataType, +}; + +typedef struct _DEVICE_DESCRIPTION +{ + ULONG Version; + BOOLEAN Master; + BOOLEAN ScatterGather; + BOOLEAN DemandMode; + BOOLEAN AutoInitialize; + BOOLEAN Dma32BitAddress; + BOOLEAN IgnoreCount; + BOOLEAN Reserved1; + BOOLEAN Reserved2; + ULONG BusNumber; + ULONG DmaChannel; + INTERFACE_TYPE InterfaceType; + DMA_WIDTH DmaWidth; + DMA_SPEED DmaSpeed; + ULONG MaximumLength; + ULONG DmaPort; +} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION; + +PVOID HalAllocateCommonBuffer(PADAPTER_OBJECT AdapterObject, + ULONG Length, + PPHYSICAL_ADDRESS LogicalAddress, + BOOLEAN CacheEnabled); +NTSTATUS HalAssignSlotResources(PUNICODE_STRING RegistryPath, + PUNICODE_STRING DriverClassName, + PDRIVER_OBJECT DriverObject, + PDEVICE_OBJECT DeviceObject, + INTERFACE_TYPE BusType, + ULONG BusNumber, + ULONG SlotNumber, + PCM_RESOURCE_LIST* AllocatedResources); +VOID HalExamineMBR(PDEVICE_OBJECT DeviceObject, + ULONG SectorSize, + ULONG MBRTypeIdentifier, + PVOID Buffer); +VOID HalFreeCommonBuffer(PADAPTER_OBJECT AdapterObject, + ULONG Length, + PHYSICAL_ADDRESS LogicalAddress, + PVOID VirtualAddress, + BOOLEAN CacheEnabled); +PADAPTER_OBJECT HalGetAdapter(PDEVICE_DESCRIPTION DeviceDescription, + PULONG NumberOfMapRegisters); +ULONG HalGetBusData(BUS_DATA_TYPE BusDataType, + ULONG BusNumber, + ULONG SlotNumber, + PVOID Buffer, + ULONG Length); +ULONG HalGetBusDataByOffset(BUS_DATA_TYPE BusDataType, + ULONG BusNumber, + ULONG SlotNumber, + PVOID Buffer, + ULONG Offset, + ULONG Length); +ULONG HalGetDmaAlignmentRequirement(VOID); +ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType, + ULONG BusNumber, + ULONG BusInterruptLevel, + ULONG BusInterruptVector, + PKIRQL Irql, + PKAFFINITY Affinity); +VOID HalQuerySystemInformation(VOID); +ULONG HalReadDmaCounter(PADAPTER_OBJECT AdapterObject); +ULONG HalSetBusData(BUS_DATA_TYPE BusDataType, + ULONG BusNumber, + ULONG SlotNumber, + PVOID Buffer, + ULONG Length); +ULONG HalSetBusDataByOffset(BUS_DATA_TYPE BusDataType, + ULONG BusNumber, + ULONG SlotNumber, + PVOID Buffer, + ULONG Offset, + ULONG Length); +BOOLEAN HalTranslateBusAddress(INTERFACE_TYPE InterfaceType, + ULONG BusNumber, + PHYSICAL_ADDRESS BusAddress, + PULONG AddressSpace, + PPHYSICAL_ADDRESS TranslatedAddress); + +struct __xchg_dummy { unsigned long a[100]; }; +#define __xg(x) ((struct __xchg_dummy *)(x)) + +extern inline LONG InterlockedDecrement(PLONG Addend) +/* + * FUNCTION: Decrements a variable as an atomic operations + * ARGUMENTS: + * Addend = Value to be decremented + * RETURNS: The decremented value + */ +{ +} + +extern inline LONG InterlockedExchange(PLONG Target, LONG Value) +/* + * FUNCTION: Sets a variable as an atomic operation + * ARGUMENTS: + * Target = Variable to be set + * Value = Caller specified value to set + * RETURNS: The previous value of the target + */ +{ + __asm__("xchgl %0,%1" + :"=r" (Value) + :"m" (*__xg(Target)), "0" (Value) + :"memory"); + return(Value); +} + +#endif /* __INCLUDE_INTERNAL_HAL_DDK_H */ diff --git a/reactos/include/internal/hal/hal.h b/reactos/include/internal/hal/hal.h new file mode 100644 index 00000000000..71042bbba61 --- /dev/null +++ b/reactos/include/internal/hal/hal.h @@ -0,0 +1,71 @@ +/* + * + */ + +#ifndef __INTERNAL_HAL_HAL_H +#define __INTERNAL_HAL_HAL_H + +typedef struct +{ + unsigned short previous_task; + unsigned short reserved1; + unsigned long esp0; + unsigned short ss0; + unsigned short reserved2; + unsigned long esp1; + unsigned short ss1; + unsigned short reserved3; + unsigned long esp2; + unsigned short ss2; + unsigned short reserved4; + unsigned long cr3; + unsigned long eip; + unsigned long eflags; + unsigned long eax; + unsigned long ecx; + unsigned long edx; + unsigned long ebx; + unsigned long esp; + unsigned long ebp; + unsigned long esi; + unsigned long edi; + unsigned short es; + unsigned short reserved5; + unsigned short cs; + unsigned short reserved6; + unsigned short ss; + unsigned short reserved7; + unsigned short ds; + unsigned short reserved8; + unsigned short fs; + unsigned short reserved9; + unsigned short gs; + unsigned short reserved10; + unsigned short ldt; + unsigned short reserved11; + unsigned short trap; + unsigned short iomap_base; + + unsigned short nr; + + unsigned char io_bitmap[1]; +} hal_thread_state; + +/* + * FUNCTION: Probes for a PCI bus + * RETURNS: True if found + */ +BOOL HalPciProbe(void); + +/* + * FUNCTION: Probes for a BIOS32 extension + */ +VOID Hal_bios32_probe(VOID); + +/* + * FUNCTION: Determines if a a bios32 service is present + */ +BOOLEAN Hal_bios32_is_service_present(ULONG service); + + +#endif /* __INTERNAL_HAL_HAL_H */ diff --git a/reactos/include/internal/hal/io.h b/reactos/include/internal/hal/io.h new file mode 100644 index 00000000000..01edc2d6ee0 --- /dev/null +++ b/reactos/include/internal/hal/io.h @@ -0,0 +1,167 @@ +#ifndef _ASM_IO_H +#define _ASM_IO_H + +/* + * This file contains the definitions for the x86 IO instructions + * inb/inw/inl/outb/outw/outl and the "string versions" of the same + * (insb/insw/insl/outsb/outsw/outsl). You can also use "pausing" + * versions of the single-IO instructions (inb_p/inw_p/..). + * + * This file is not meant to be obfuscating: it's just complicated + * to (a) handle it all in a way that makes gcc able to optimize it + * as well as possible and (b) trying to avoid writing the same thing + * over and over again with slight variations and possibly making a + * mistake somewhere. + */ + +/* + * Thanks to James van Artsdalen for a better timing-fix than + * the two short jumps: using outb's to a nonexistent port seems + * to guarantee better timings even on fast machines. + * + * On the other hand, I'd like to be sure of a non-existent port: + * I feel a bit unsafe about using 0x80 (should be safe, though) + * + * Linus + */ + +#ifdef SLOW_IO_BY_JUMPING +#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:") +#else +#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80") +#endif + +#ifdef REALLY_SLOW_IO +#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } +#else +#define SLOW_DOWN_IO __SLOW_DOWN_IO +#endif + +/* + * Talk about misusing macros.. + */ + +#define __OUT1(s,x) \ +extern inline void __out##s(unsigned x value, unsigned short port) { + +#define __OUT2(s,s1,s2) \ +__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" + +#define __OUT(s,s1,x) \ +__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \ +__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \ +__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \ +__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } + +#define __IN1(s) \ +extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; + +#define __IN2(s,s1,s2) \ +__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" + +#define __IN(s,s1,i...) \ +__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \ +__IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \ +__IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \ +__IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } + +#define __INS(s) \ +extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("cld ; rep ; ins" #s \ +: "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +#define __OUTS(s) \ +extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \ +{ __asm__ __volatile__ ("cld ; rep ; outs" #s \ +: "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } + +#define RETURN_TYPE unsigned char +/* __IN(b,"b","0" (0)) */ +__IN(b,"") +#undef RETURN_TYPE +#define RETURN_TYPE unsigned short +/* __IN(w,"w","0" (0)) */ +__IN(w,"") +#undef RETURN_TYPE +#define RETURN_TYPE unsigned int +__IN(l,"") +#undef RETURN_TYPE + +__OUT(b,"b",char) +__OUT(w,"w",short) +__OUT(l,,int) + +__INS(b) +__INS(w) +__INS(l) + +__OUTS(b) +__OUTS(w) +__OUTS(l) + +/* + * Note that due to the way __builtin_constant_p() works, you + * - can't use it inside a inline function (it will never be true) + * - you don't have to worry about side effects within the __builtin.. + */ +#define outb(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outbc((val),(port)) : \ + __outb((val),(port))) + +#define inb(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inbc(port) : \ + __inb(port)) + +#define outb_p(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outbc_p((val),(port)) : \ + __outb_p((val),(port))) + +#define inb_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inbc_p(port) : \ + __inb_p(port)) + +#define outw(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outwc((val),(port)) : \ + __outw((val),(port))) + +#define inw(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inwc(port) : \ + __inw(port)) + +#define outw_p(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outwc_p((val),(port)) : \ + __outw_p((val),(port))) + +#define inw_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inwc_p(port) : \ + __inw_p(port)) + +#define outl(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc((val),(port)) : \ + __outl((val),(port))) + +#define inl(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc(port) : \ + __inl(port)) + +#define outl_p(port,val) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __outlc_p((val),(port)) : \ + __outl_p((val),(port))) + +#define inl_p(port) \ +((__builtin_constant_p((port)) && (port) < 256) ? \ + __inlc_p(port) : \ + __inl_p(port)) + +#endif diff --git a/reactos/include/internal/hal/irq.h b/reactos/include/internal/hal/irq.h new file mode 100644 index 00000000000..db7ef233785 --- /dev/null +++ b/reactos/include/internal/hal/irq.h @@ -0,0 +1,7 @@ +/* + * PURPOSE: The number of device specific level levels + */ +#define NR_DEVICE_SPECIFIC_LEVELS (16) + + + diff --git a/reactos/include/internal/hal/page.h b/reactos/include/internal/hal/page.h new file mode 100644 index 00000000000..2ac6cb2c48d --- /dev/null +++ b/reactos/include/internal/hal/page.h @@ -0,0 +1,76 @@ +/* + * Lowlevel memory managment definitions + */ + +#ifndef __INTERNAL_HAL_PAGE_H +#define __INTERNAL_HAL_PAGE_H + +#include + +#define PAGESIZE (4096) + +/* + * Sets a page entry + * vaddr: The virtual address to set the page entry for + * attributes: The access attributes to give the page + * physaddr: The physical address the page should map to + */ +void set_page(unsigned int vaddr, unsigned int attributes, + unsigned int physaddr); + +#define PAGE_ROUND_UP(x) ( (((ULONG)x)%PAGESIZE) ? ((((ULONG)x)&(~0xfff))+0x1000) : ((ULONG)x) ) +#define PAGE_ROUND_DOWN(x) (((ULONG)x)&(~0xfff)) + +/* + * Page access attributes (or these together) + */ +#define PA_READ (1<<0) +#define PA_WRITE ((1<<0)+(1<<1)) +#define PA_EXECUTE PA_READ + +/* + * Page attributes + */ +#define PA_USER (1<<2) +#define PA_SYSTEM (0) + +#define KERNEL_BASE (0xc0000000) +#define IDMAP_BASE (0xd0000000) + + + +/* + * Return a linear address which can be used to access the physical memory + * starting at x + */ +extern inline unsigned int physical_to_linear(unsigned int x) +{ + return(x+IDMAP_BASE); +} + +#define FLUSH_TLB __asm__("movl %cr3,%eax\n\tmovl %eax,%cr3\n\t") + +extern inline unsigned int* get_page_directory(void) +{ + unsigned int page_dir=0; + __asm__("movl %%cr3,%0\n\t" + : "=r" (page_dir)); +// printk("page_dir %x %x\n",page_dir,physical_to_linear(page_dir)); + return((unsigned int *)physical_to_linear(page_dir)); +} + + +/* + * Amount of memory that can be mapped by a page table + */ +#define PAGE_TABLE_SIZE (4*1024*1024) + +#define PAGE_MASK(x) (x&(~0xfff)) +#define VADDR_TO_PT_OFFSET(x) (((x/1024)%4096)) +#define VADDR_TO_PD_OFFSET(x) ((x)/(4*1024*1024)) + +unsigned int* get_page_entry(unsigned int vaddr); + +BOOL is_page_present(unsigned int vaddr); + +#endif /* __INTERNAL_HAL_PAGE_H */ diff --git a/reactos/include/internal/hal/segment.h b/reactos/include/internal/hal/segment.h new file mode 100644 index 00000000000..32201ddf93f --- /dev/null +++ b/reactos/include/internal/hal/segment.h @@ -0,0 +1,343 @@ +#ifndef _ASM_SEGMENT_H +#define _ASM_SEGMENT_H + +#define ZERO_DS 0x18 +#define KERNEL_CS 0x20 +#define KERNEL_DS 0x28 + +#ifndef __ASSEMBLY__ + +/* + * Uh, these should become the main single-value transfer routines.. + * They automatically use the right size if we just have the right + * pointer type.. + */ +#define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr))) +#define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr)))) + +/* + * This is a silly but good way to make sure that + * the __put_user function is indeed always optimized, + * and that we use the correct sizes.. + */ +extern int bad_user_access_length(void); + +/* + * dummy pointer type structure.. gcc won't try to do something strange + * this way.. + */ +struct __segment_dummy { unsigned long a[100]; }; +#define __sd(x) ((struct __segment_dummy *) (x)) +#define __const_sd(x) ((const struct __segment_dummy *) (x)) + +static inline void __put_user(unsigned long x, void * y, int size) +{ + switch (size) { + case 1: + __asm__ ("movb %b1,%%fs:%0" + :"=m" (*__sd(y)) + :"iq" ((unsigned char) x), "m" (*__sd(y))); + break; + case 2: + __asm__ ("movw %w1,%%fs:%0" + :"=m" (*__sd(y)) + :"ir" ((unsigned short) x), "m" (*__sd(y))); + break; + case 4: + __asm__ ("movl %1,%%fs:%0" + :"=m" (*__sd(y)) + :"ir" (x), "m" (*__sd(y))); + break; + default: + bad_user_access_length(); + } +} + +static inline unsigned long __get_user(const void * y, int size) +{ + unsigned long result; + + switch (size) { + case 1: + __asm__ ("movb %%fs:%1,%b0" + :"=q" (result) + :"m" (*__const_sd(y))); + return (unsigned char) result; + case 2: + __asm__ ("movw %%fs:%1,%w0" + :"=r" (result) + :"m" (*__const_sd(y))); + return (unsigned short) result; + case 4: + __asm__ ("movl %%fs:%1,%0" + :"=r" (result) + :"m" (*__const_sd(y))); + return result; + default: + return bad_user_access_length(); + } +} + +static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n) +{ + __asm__ volatile + (" cld + push %%es + push %%fs + cmpl $3,%0 + pop %%es + jbe 1f + movl %%edi,%%ecx + negl %%ecx + andl $3,%%ecx + subl %%ecx,%0 + rep; movsb + movl %0,%%ecx + shrl $2,%%ecx + rep; movsl + andl $3,%0 + 1: movl %0,%%ecx + rep; movsb + pop %%es" + :"=abd" (n) + :"0" (n),"D" ((long) to),"S" ((long) from) + :"cx","di","si"); +} + +static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n) +{ + switch (n) { + case 0: + return; + case 1: + __put_user(*(const char *) from, (char *) to, 1); + return; + case 2: + __put_user(*(const short *) from, (short *) to, 2); + return; + case 3: + __put_user(*(const short *) from, (short *) to, 2); + __put_user(*(2+(const char *) from), 2+(char *) to, 1); + return; + case 4: + __put_user(*(const int *) from, (int *) to, 4); + return; + case 8: + __put_user(*(const int *) from, (int *) to, 4); + __put_user(*(1+(const int *) from), 1+(int *) to, 4); + return; + case 12: + __put_user(*(const int *) from, (int *) to, 4); + __put_user(*(1+(const int *) from), 1+(int *) to, 4); + __put_user(*(2+(const int *) from), 2+(int *) to, 4); + return; + case 16: + __put_user(*(const int *) from, (int *) to, 4); + __put_user(*(1+(const int *) from), 1+(int *) to, 4); + __put_user(*(2+(const int *) from), 2+(int *) to, 4); + __put_user(*(3+(const int *) from), 3+(int *) to, 4); + return; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "push %%es\n\t" \ + "push %%fs\n\t" \ + "pop %%es\n\t" \ + "rep ; movsl\n\t" \ + x \ + "pop %%es" \ + : /* no outputs */ \ + :"c" (n/4),"D" ((long) to),"S" ((long) from) \ + :"cx","di","si") + + switch (n % 4) { + case 0: + COMMON(""); + return; + case 1: + COMMON("movsb\n\t"); + return; + case 2: + COMMON("movsw\n\t"); + return; + case 3: + COMMON("movsw\n\tmovsb\n\t"); + return; + } +#undef COMMON +} + +static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n) +{ + __asm__ volatile + (" cld + cmpl $3,%0 + jbe 1f + movl %%edi,%%ecx + negl %%ecx + andl $3,%%ecx + subl %%ecx,%0 + fs; rep; movsb + movl %0,%%ecx + shrl $2,%%ecx + fs; rep; movsl + andl $3,%0 + 1: movl %0,%%ecx + fs; rep; movsb" + :"=abd" (n) + :"0" (n),"D" ((long) to),"S" ((long) from) + :"cx","di","si", "memory"); +} + +static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n) +{ + switch (n) { + case 0: + return; + case 1: + *(char *)to = __get_user((const char *) from, 1); + return; + case 2: + *(short *)to = __get_user((const short *) from, 2); + return; + case 3: + *(short *) to = __get_user((const short *) from, 2); + *((char *) to + 2) = __get_user(2+(const char *) from, 1); + return; + case 4: + *(int *) to = __get_user((const int *) from, 4); + return; + case 8: + *(int *) to = __get_user((const int *) from, 4); + *(1+(int *) to) = __get_user(1+(const int *) from, 4); + return; + case 12: + *(int *) to = __get_user((const int *) from, 4); + *(1+(int *) to) = __get_user(1+(const int *) from, 4); + *(2+(int *) to) = __get_user(2+(const int *) from, 4); + return; + case 16: + *(int *) to = __get_user((const int *) from, 4); + *(1+(int *) to) = __get_user(1+(const int *) from, 4); + *(2+(int *) to) = __get_user(2+(const int *) from, 4); + *(3+(int *) to) = __get_user(3+(const int *) from, 4); + return; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "rep ; fs ; movsl\n\t" \ + x \ + : /* no outputs */ \ + :"c" (n/4),"D" ((long) to),"S" ((long) from) \ + :"cx","di","si","memory") + + switch (n % 4) { + case 0: + COMMON(""); + return; + case 1: + COMMON("fs ; movsb"); + return; + case 2: + COMMON("fs ; movsw"); + return; + case 3: + COMMON("fs ; movsw\n\tfs ; movsb"); + return; + } +#undef COMMON +} + +#define memcpy_fromfs(to, from, n) \ +(__builtin_constant_p(n) ? \ + __constant_memcpy_fromfs((to),(from),(n)) : \ + __generic_memcpy_fromfs((to),(from),(n))) + +#define memcpy_tofs(to, from, n) \ +(__builtin_constant_p(n) ? \ + __constant_memcpy_tofs((to),(from),(n)) : \ + __generic_memcpy_tofs((to),(from),(n))) + +/* + * These are deprecated.. + * + * Use "put_user()" and "get_user()" with the proper pointer types instead. + */ + +#define get_fs_byte(addr) __get_user((const unsigned char *)(addr),1) +#define get_fs_word(addr) __get_user((const unsigned short *)(addr),2) +#define get_fs_long(addr) __get_user((const unsigned int *)(addr),4) + +#define put_fs_byte(x,addr) __put_user((x),(unsigned char *)(addr),1) +#define put_fs_word(x,addr) __put_user((x),(unsigned short *)(addr),2) +#define put_fs_long(x,addr) __put_user((x),(unsigned int *)(addr),4) + +#ifdef WE_REALLY_WANT_TO_USE_A_BROKEN_INTERFACE + +static inline unsigned short get_user_word(const short *addr) +{ + return __get_user(addr, 2); +} + +static inline unsigned char get_user_byte(const char * addr) +{ + return __get_user(addr,1); +} + +static inline unsigned long get_user_long(const int *addr) +{ + return __get_user(addr, 4); +} + +static inline void put_user_byte(char val,char *addr) +{ + __put_user(val, addr, 1); +} + +static inline void put_user_word(short val,short * addr) +{ + __put_user(val, addr, 2); +} + +static inline void put_user_long(unsigned long val,int * addr) +{ + __put_user(val, addr, 4); +} + +#endif + +/* + * Someone who knows GNU asm better than I should double check the following. + * It seems to work, but I don't know if I'm doing something subtly wrong. + * --- TYT, 11/24/91 + * [ nothing wrong here, Linus: I just changed the ax to be any reg ] + */ + +static inline unsigned long get_fs(void) +{ + unsigned long _v; + __asm__("mov %%fs,%w0":"=r" (_v):"0" (0)); + return _v; +} + +static inline unsigned long get_ds(void) +{ + unsigned long _v; + __asm__("mov %%ds,%w0":"=r" (_v):"0" (0)); + return _v; +} + +static inline void set_fs(unsigned long val) +{ + __asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val)); +} + +static inline void set_ds(unsigned long val) +{ + __asm__ __volatile__("mov %w0,%%ds": /* no output */ :"r" (val)); +} + + +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_SEGMENT_H */ diff --git a/reactos/include/internal/hal/segment.inc b/reactos/include/internal/hal/segment.inc new file mode 100644 index 00000000000..a39c1e6997a --- /dev/null +++ b/reactos/include/internal/hal/segment.inc @@ -0,0 +1,6 @@ +; +; Useful prototypes and definitions +; + +%define KERNEL_DS 028h +%define KERNEL_CS 020h diff --git a/reactos/include/internal/iomgr.h b/reactos/include/internal/iomgr.h new file mode 100644 index 00000000000..501a19ed2c2 --- /dev/null +++ b/reactos/include/internal/iomgr.h @@ -0,0 +1,29 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: include/internal/iomgr.h + * PURPOSE: Internal io manager declarations + * PROGRAMMER: David Welch (welch@mcmail.com) + * UPDATE HISTORY: + * 28/05/97: Created + */ + +#ifndef __INTERNAL_IOMGR_H +#define __INTERNAL_IOMGR_H + +#include + +/* + * FUNCTION: + */ +NTSTATUS IoBeginIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp); + +/* + * FUNCTION: Called to initalize a loaded driver + * ARGUMENTS: + * entry = pointer to the driver initialization routine + * RETURNS: Success or failure + */ +NTSTATUS InitalizeLoadedDriver(PDRIVER_INITIALIZE entry); + +#endif diff --git a/reactos/include/internal/kernel.h b/reactos/include/internal/kernel.h new file mode 100644 index 00000000000..329a7ab92ab --- /dev/null +++ b/reactos/include/internal/kernel.h @@ -0,0 +1,93 @@ +/* + * Various useful prototypes + */ + +#ifndef __KERNEL_H +#define __KERNEL_H + +#include +#include + +#include +#include + +VOID KiInterruptDispatch(unsigned int irq); +VOID KiDispatchInterrupt(unsigned int irq); +VOID KeTimerInterrupt(VOID); + +/* + * Defines a descriptor as it appears in the processor tables + */ +typedef struct +{ + unsigned int a; + unsigned int b; +} descriptor; + +extern descriptor idt[256]; +extern descriptor gdt[256]; + +/* + * printf style functions + */ +asmlinkage void printk(const char* fmt, ...); +int vsprintf(char *buf, const char *fmt, va_list args); +int sprintf(char* buf, const char* fmt, ...); + +typedef struct +{ + /* + * Magic value (useless really) + */ + unsigned int magic; + + /* + * Cursor position + */ + unsigned int cursorx; + unsigned int cursory; + + /* + * Number of files (including the kernel) loaded + */ + unsigned int nr_files; + + /* + * Range of physical memory being used by the system + */ + unsigned int start_mem; + unsigned int end_mem; + + /* + * List of module lengths (terminated by a 0) + */ + unsigned int module_length[64]; +} boot_param; + + +/* + * Initalization functions (called once by main()) + */ +void MmInitalize(boot_param* bp); +void InitalizeExceptions(void); +void InitalizeIRQ(void); +void InitializeTimer(void); +void InitConsole(boot_param* bp); +void KeInitDpc(void); +void HalInit(boot_param* bp); +void IoInit(void); +void ObjNamespcInit(void); +void PsMgrInit(void); + + +/* + * FUNCTION: Called to execute queued dpcs + */ +void KeDrainDpcQueue(void); + +void KeExpireTimers(void); + +typedef unsigned int (exception_hook)(CONTEXT* c, unsigned int exp); +asmlinkage unsigned int ExHookException(exception_hook fn, UINT exp); + +#endif diff --git a/reactos/include/internal/linkage.h b/reactos/include/internal/linkage.h new file mode 100644 index 00000000000..f4adc6155b3 --- /dev/null +++ b/reactos/include/internal/linkage.h @@ -0,0 +1,5 @@ +#ifdef __cplusplus +#define asmlinkage extern "C" +#else +#define asmlinkage +#endif diff --git a/reactos/include/internal/mm.h b/reactos/include/internal/mm.h new file mode 100644 index 00000000000..15080c760e5 --- /dev/null +++ b/reactos/include/internal/mm.h @@ -0,0 +1,146 @@ +/* + * Higher level memory managment definitions + */ + +#ifndef __MM_H +#define __MM_H + +#define PAGE_SYSTEM (0x80000000) + +#include +#include +#include + +typedef struct _memory_area +/* + * PURPOSE: Describes an area of virtual memory + */ +{ + /* + * Access protection + */ + unsigned int access; + + /* + * Memory region base + */ + unsigned int base; + + /* + * Memory region length + */ + unsigned int length; + + /* + * Memory type (Mapped file, mapped from an executable or private) + */ + unsigned int type; + + /* + * Memory region state (committed, reserved or free) + */ + unsigned int state; + + /* + * Original access protection + */ + unsigned int initial_access; + + /* + * Used to maintain the linked list of memory areas + */ + struct _memory_area* previous; + struct _memory_area* next; + + /* + * True the region is locked + */ + BOOL lock; + + /* + * FUNCTION: Decommits all the pages in the regions + */ + void (*free)(struct _memory_area* marea); + + /* + * FUNCTION: Handles a page fault by loading the required page + * RECEIVES: + * marea = the memory area + * address = the relative address of the page to load + * RETURNS: + * TRUE = the access should be restarted + * FALSE = the access was illegal and an exception should + * be generated + * NOTES: This function is guarrented to be called within the context + * of the thread which required a page to be loaded + */ + BOOL (*load_page)(struct _memory_area* marea, unsigned int address); +} memory_area; + + +/* + * FUNCTION: Gets a page with a restricted max physical address (i.e. + * suitable for dma) + * RETURNS: + * The physical address of the page if it succeeds + * NULL if it fails. + * NOTES: This is very inefficent because the list isn't sorted. On the + * other hand sorting the list would be quite expensive especially if dma + * is only used infrequently. Perhaps a special cache of dma pages should + * be maintained? + */ +unsigned int get_dma_page(unsigned int max_address); + +/* + * FUNCTION: Allocate a page and return its physical address + * RETURNS: The physical address of the page allocated + */ +asmlinkage unsigned int get_free_page(void); + +/* + * FUNCTION: Adds pages to the free list + * ARGUMENTS: + * physical_base = Physical address of the base of the region to + * be freed + * nr = number of continuous pages to free + */ +asmlinkage void free_page(unsigned int physical_base, unsigned int nr); + +/* + * FUNCTION: Returns the physical address mapped by a given virtual address + * ARGUMENTS: + * vaddr = virtual address to query + * RETURNS: The physical address if present in memory + * Zero if paged out or invalid + * NOTE: This doesn't do any synchronization + */ +unsigned int get_page_physical_address(unsigned int vaddr); + +void mark_page_not_writable(unsigned int vaddr); + +void VirtualInit(boot_param* bp); + +/* + * FUNCTION: Returns the first memory area starting in the region or the last + * one before the start of the region + * ARGUMENTS: + * list_head = Head of the list of memory areas to search + * base = base address of the region + * length = length of the region + * RETURNS: A pointer to the area found or + * NULL if the region was before the first region on the list + */ +memory_area* find_first_marea(memory_area* list_head, unsigned int base, + unsigned int length); + +/* + * Head of the list of system memory areas + */ +extern memory_area* system_memory_area_list_head; + +/* + * Head of the list of user memory areas (this should be per process) + */ +extern memory_area* memory_area_list_head; + +#endif diff --git a/reactos/include/internal/module.h b/reactos/include/internal/module.h new file mode 100644 index 00000000000..c311b8ef5ae --- /dev/null +++ b/reactos/include/internal/module.h @@ -0,0 +1,34 @@ + +#ifndef __MODULE_H +#define __MODULE_H + +#include + +typedef struct +/* + * + */ +{ + unsigned int text_base; + unsigned int data_base; + unsigned int bss_base; + SCNHDR* scn_list; + char* str_tab; + SYMENT* sym_list; + unsigned int size; + + /* + * Base address of the module in memory + */ + unsigned int base; + + /* + * Offset of the raw data in memory + */ + unsigned int raw_data_off; +} module; + +int process_boot_module(unsigned int start); + +#endif + diff --git a/reactos/include/internal/objmgr.h b/reactos/include/internal/objmgr.h new file mode 100644 index 00000000000..d8078551081 --- /dev/null +++ b/reactos/include/internal/objmgr.h @@ -0,0 +1,89 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: include/internal/objmgr.h + * PURPOSE: Object manager definitions + * PROGRAMMER: David Welch (welch@mcmail.com) + */ + +#ifndef __INCLUDE_INTERNAL_OBJMGR_H +#define __INCLUDE_INTERNAL_OBJMGR_H + +#include + +typedef struct +{ + CSHORT Type; + CSHORT Size; +} COMMON_BODY_HEADER, *PCOMMON_BODY_HEADER; + +typedef struct _DIRECTORY_OBJECT +{ + CSHORT Type; + CSHORT Size; + + /* + * PURPOSE: Head of the list of our subdirectories + */ + LIST_ENTRY head; +} DIRECTORY_OBJECT, *PDIRECTORY_OBJECT; + + +/* + * Enumeration of object types + */ +enum +{ + OBJTYP_INVALID, + OBJTYP_TYPE, + OBJTYP_DIRECTORY, + OBJTYP_SYMLNK, + OBJTYP_DEVICE, + OBJTYP_THREAD, + OBJTYP_MAX, +}; + +BOOL ObjAddObjectToNameSpace(const char* path, POBJECT_HEADER Object); + +VOID ObRegisterType(CSHORT id, OBJECT_TYPE* type); + +VOID ObInitializeObjectHeader(CSHORT id, LPCSTR name, POBJECT_HEADER obj); + +/* + * FUNCTION: Get the size of an object + * ARGUMENTS: + * Type = Object type + * RETURNS: The size in bytes + */ +ULONG ObSizeOf(CSHORT Type); +HANDLE ObAddHandle(PVOID obj); + +PVOID ObGetObjectByHandle(HANDLE h); +PVOID ObLookupObject(PDIRECTORY_OBJECT root, const char* _string); +PVOID ObGenericCreateObject(PHANDLE Handle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + CSHORT Type); + +/* + * FUNCTION: Creates an entry within a directory + * ARGUMENTS: + * parent = Parent directory + * object = Header of the object to add + */ +VOID ObCreateEntry(PDIRECTORY_OBJECT parent, POBJECT_HEADER object); + +extern inline POBJECT_HEADER BODY_TO_HEADER(PVOID body) +{ + PCOMMON_BODY_HEADER chdr = (PCOMMON_BODY_HEADER)body; + return(CONTAINING_RECORD((&(chdr->Type)),OBJECT_HEADER,Type)); +} + +extern inline PVOID HEADER_TO_BODY(POBJECT_HEADER obj) +{ + return(((void *)obj)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER)); +} + +#define OBJECT_ALLOC_SIZE(type) (ObSizeOf(type)+sizeof(OBJECT_HEADER)-sizeof(COMMON_BODY_HEADER)) + +#endif /* __INCLUDE_INTERNAL_OBJMGR_H */ diff --git a/reactos/include/internal/pool.h b/reactos/include/internal/pool.h new file mode 100644 index 00000000000..8baa905d9bc --- /dev/null +++ b/reactos/include/internal/pool.h @@ -0,0 +1,19 @@ +#ifndef __INTERNAL_POOL_H +#define __INTERNAL_POOL_H + +#include + +#include + +/* + * Maximum size of the kmalloc area (this is totally arbitary) + */ +#define NONPAGED_POOL_SIZE (4*1024*1024) + +/* + * Allocates an arbitary sized block at any alignment + */ +//asmlinkage void* ExAllocatePool(ULONG size); +//asmlinkage void ExFreePool(void* block); + +#endif /* __INTERNAL_POOL_H */ diff --git a/reactos/include/internal/psmgr.h b/reactos/include/internal/psmgr.h new file mode 100644 index 00000000000..d0775b4c25c --- /dev/null +++ b/reactos/include/internal/psmgr.h @@ -0,0 +1,50 @@ +#ifndef __INCLUDE_INTERNAL_PSMGR_H +#define __INCLUDE_INTERNAL_PSMGR_H + +#include + +void PsInitThreadManagment(void); + +/* + * PURPOSE: Thread states + */ +enum +{ + /* + * PURPOSE: Don't touch + */ + THREAD_STATE_INVALID, + + /* + * PURPOSE: Waiting to be dispatched + */ + THREAD_STATE_RUNNABLE, + + /* + * PURPOSE: Currently running + */ + THREAD_STATE_RUNNING, + + /* + * PURPOSE: Doesn't want to run + */ + THREAD_STATE_SLEEPING, + + /* + * Waiting to be freed + */ + THREAD_STATE_TERMINATED, +}; + +NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus); + +/* + * Functions the HAL must provide + */ + +void HalInitFirstTask(PTHREAD_OBJECT thread); +void HalInitTask(PTHREAD_OBJECT thread, PKSTART_ROUTINE fn, + PVOID StartContext); +void HalTaskSwitch(PTHREAD_OBJECT thread); + +#endif diff --git a/reactos/include/internal/stddef.h b/reactos/include/internal/stddef.h new file mode 100644 index 00000000000..116693146ba --- /dev/null +++ b/reactos/include/internal/stddef.h @@ -0,0 +1,10 @@ +/* + * Some useful things + */ + +//#define NULL ((void*)0) +#ifndef NULL +#define NULL (0) +#endif + + diff --git a/reactos/include/internal/string.h b/reactos/include/internal/string.h new file mode 100644 index 00000000000..05702e3a7e4 --- /dev/null +++ b/reactos/include/internal/string.h @@ -0,0 +1,680 @@ +/* + * Adapted from linux for the reactos kernel, march 1998 -- David Welch + */ + +#ifndef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + +#include "types.h" /* for size_t */ + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern char * ___strtok; +extern char * strcpy(char *,const char *); +extern char * strncpy(char *,const char *, __kernel_size_t); +extern char * strcat(char *, const char *); +extern char * strncat(char *, const char *, __kernel_size_t); +extern char * strchr(const char *,int); +extern char * strrchr(const char *,int); +extern char * strpbrk(const char *,const char *); +extern char * strtok(char *,const char *); +extern char * strstr(const char *,const char *); +extern __kernel_size_t strlen(const char *); +extern __kernel_size_t strnlen(const char *,__kernel_size_t); +extern __kernel_size_t strspn(const char *,const char *); +extern int strcmp(const char *,const char *); +extern int strncmp(const char *,const char *,__kernel_size_t); + +extern void * memset(void *,int,__kernel_size_t); +extern void * memcpy(void *,const void *,__kernel_size_t); +extern void * memmove(void *,const void *,__kernel_size_t); +extern void * memscan(void *,int,__kernel_size_t); +extern int memcmp(const void *,const void *,__kernel_size_t); + +/* + * Include machine specific inline routines + */ +#ifndef _I386_STRING_H_ +#define _I386_STRING_H_ + +/* + * On a 486 or Pentium, we are better off not using the + * byte string operations. But on a 386 or a PPro the + * byte string ops are faster than doing it by hand + * (MUCH faster on a Pentium). + * + * Also, the byte strings actually work correctly. Forget + * the i486 routines for now as they may be broken.. + */ +#if FIXED_486_STRING && (CPU == 486 || CPU == 586) +#include +#else + +/* + * This string-include defines all string functions as inline + * functions. Use gcc. It also assumes ds=es=data space, this should be + * normal. Most of the string-functions are rather heavily hand-optimized, + * see especially strtok,strstr,str[c]spn. They should work, but are not + * very easy to understand. Everything is done entirely within the register + * set, making the functions fast and clean. String instructions have been + * used through-out, making for "slightly" unclear code :-) + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#define __HAVE_ARCH_STRCPY +extern inline char * strcpy(char * dest,const char *src) +{ +__asm__ __volatile__( + "cld\n" + "1:\tlodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest):"si","di","ax","memory"); +return dest; +} + +#define __HAVE_ARCH_STRNCPY +extern inline char * strncpy(char * dest,const char *src,size_t count) +{ +__asm__ __volatile__( + "cld\n" + "1:\tdecl %2\n\t" + "js 2f\n\t" + "lodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "rep\n\t" + "stosb\n" + "2:" + : /* no output */ + :"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory"); +return dest; +} + +#define __HAVE_ARCH_STRCAT +extern inline char * strcat(char * dest,const char * src) +{ +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "decl %1\n" + "1:\tlodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx"); +return dest; +} + +#define __HAVE_ARCH_STRNCAT +extern inline char * strncat(char * dest,const char * src,size_t count) +{ +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "decl %1\n\t" + "movl %4,%3\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n" + "2:\txorl %2,%2\n\t" + "stosb" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count) + :"si","di","ax","cx","memory"); +return dest; +} + +#define __HAVE_ARCH_STRCMP +extern inline int strcmp(const char * cs,const char * ct) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tlodsb\n\t" + "scasb\n\t" + "jne 2f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 3f\n" + "2:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "3:" + :"=a" (__res):"S" (cs),"D" (ct):"si","di"); +return __res; +} + +#define __HAVE_ARCH_STRNCMP +extern inline int strncmp(const char * cs,const char * ct,size_t count) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsb\n\t" + "scasb\n\t" + "jne 3f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n" + "2:\txorl %%eax,%%eax\n\t" + "jmp 4f\n" + "3:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%al\n" + "4:" + :"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx"); +return __res; +} + +#define __HAVE_ARCH_STRCHR +extern inline char * strchr(const char * s, int c) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "je 2f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "movl $1,%1\n" + "2:\tmovl %1,%0\n\t" + "decl %0" + :"=a" (__res):"S" (s),"0" (c):"si"); +return __res; +} + +#define __HAVE_ARCH_STRRCHR +extern inline char * strrchr(const char * s, int c) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "jne 2f\n\t" + "leal -1(%%esi),%0\n" + "2:\ttestb %%al,%%al\n\t" + "jne 1b" + :"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si"); +return __res; +} + +#define __HAVE_ARCH_STRSPN +extern inline size_t strspn(const char * cs, const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res-cs; +} + +#define __HAVE_ARCH_STRCSPN +extern inline size_t strcspn(const char * cs, const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res-cs; +} + +#define __HAVE_ARCH_STRPBRK +extern inline char * strpbrk(const char * cs,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 1b\n\t" + "decl %0\n\t" + "jmp 3f\n" + "2:\txorl %0,%0\n" + "3:" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res; +} + +#define __HAVE_ARCH_STRSTR +extern inline char * strstr(const char * cs,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" \ + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ + "movl %%ecx,%%edx\n" + "1:\tmovl %4,%%edi\n\t" + "movl %%esi,%%eax\n\t" + "movl %%edx,%%ecx\n\t" + "repe\n\t" + "cmpsb\n\t" + "je 2f\n\t" /* also works for empty string, see above */ + "xchgl %%eax,%%esi\n\t" + "incl %%esi\n\t" + "cmpb $0,-1(%%eax)\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "2:" + :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct) + :"cx","dx","di","si"); +return __res; +} + +#define __HAVE_ARCH_STRLEN +extern inline size_t strlen(const char * s) +{ +register int __res; +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "notl %0\n\t" + "decl %0" + :"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di"); +return __res; +} + +#define __HAVE_ARCH_STRTOK +extern inline char * strtok(char * s,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "testl %1,%1\n\t" + "jne 1f\n\t" + "testl %0,%0\n\t" + "je 8f\n\t" + "movl %0,%1\n" + "1:\txorl %0,%0\n\t" + "movl $-1,%%ecx\n\t" + "xorl %%eax,%%eax\n\t" + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "je 7f\n\t" /* empty delimiter-string */ + "movl %%ecx,%%edx\n" + "2:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 7f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 2b\n\t" + "decl %1\n\t" + "cmpb $0,(%1)\n\t" + "je 7f\n\t" + "movl %1,%0\n" + "3:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 5f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 3b\n\t" + "decl %1\n\t" + "cmpb $0,(%1)\n\t" + "je 5f\n\t" + "movb $0,(%1)\n\t" + "incl %1\n\t" + "jmp 6f\n" + "5:\txorl %1,%1\n" + "6:\tcmpb $0,(%0)\n\t" + "jne 7f\n\t" + "xorl %0,%0\n" + "7:\ttestl %0,%0\n\t" + "jne 8f\n\t" + "movl %0,%1\n" + "8:" + :"=b" (__res),"=S" (___strtok) + :"0" (___strtok),"1" (s),"g" (ct) + :"ax","cx","dx","di","memory"); +return __res; +} + +extern inline void * __memcpy(void * to, const void * from, size_t n) +{ +__asm__ __volatile__( + "cld\n\t" + "rep ; movsl\n\t" + "testb $2,%b1\n\t" + "je 1f\n\t" + "movsw\n" + "1:\ttestb $1,%b1\n\t" + "je 2f\n\t" + "movsb\n" + "2:" + : /* no output */ + :"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from) + : "cx","di","si","memory"); +return (to); +} + +/* + * This looks horribly ugly, but the compiler can optimize it totally, + * as the count is constant. + */ +extern inline void * __constant_memcpy(void * to, const void * from, size_t n) +{ + switch (n) { + case 0: + return to; + case 1: + *(unsigned char *)to = *(const unsigned char *)from; + return to; + case 2: + *(unsigned short *)to = *(const unsigned short *)from; + return to; + case 3: + *(unsigned short *)to = *(const unsigned short *)from; + *(2+(unsigned char *)to) = *(2+(const unsigned char *)from); + return to; + case 4: + *(unsigned long *)to = *(const unsigned long *)from; + return to; + case 8: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + return to; + case 12: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + return to; + case 16: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + *(3+(unsigned long *)to) = *(3+(const unsigned long *)from); + return to; + case 20: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + *(3+(unsigned long *)to) = *(3+(const unsigned long *)from); + *(4+(unsigned long *)to) = *(4+(const unsigned long *)from); + return to; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "rep ; movsl" \ + x \ + : /* no outputs */ \ + : "c" (n/4),"D" ((long) to),"S" ((long) from) \ + : "cx","di","si","memory"); + + switch (n % 4) { + case 0: COMMON(""); return to; + case 1: COMMON("\n\tmovsb"); return to; + case 2: COMMON("\n\tmovsw"); return to; + case 3: COMMON("\n\tmovsw\n\tmovsb"); return to; + } +#undef COMMON +} + +#define __HAVE_ARCH_MEMCPY +#define memcpy(t, f, n) \ +(__builtin_constant_p(n) ? \ + __constant_memcpy((t),(f),(n)) : \ + __memcpy((t),(f),(n))) + +#define __HAVE_ARCH_MEMMOVE +extern inline void * memmove(void * dest,const void * src, size_t n) +{ +if (dest +#include +//#include + + +typedef unsigned long ATOMID; + +typedef struct { + ATOMID q; /* what a string 'hashes' to */ + long idx; /* index into data table */ + long refcnt; /* how many clients have it */ + long idsize; /* space used by this slot */ +} ATOMENTRY; +typedef ATOMENTRY *LPATOMENTRY; + +typedef struct { + ATOMENTRY *AtomTable; /* pointer to table data */ + wchar_t *AtomData; /* pointer to name data */ + unsigned long TableSize; /* number items in this table */ + unsigned long DataSize; /* space used by string data */ + LPVOID lpDrvData; +} ATOMTABLE; +typedef ATOMTABLE *LPATOMTABLE; + + + + + + + + +#endif /* Atoms__h */ diff --git a/reactos/include/kernel32/heap.h b/reactos/include/kernel32/heap.h new file mode 100644 index 00000000000..9b0ea12deeb --- /dev/null +++ b/reactos/include/kernel32/heap.h @@ -0,0 +1,110 @@ +/* + * kernel/heap.c + * Copyright (C) 1996, Onno Hovers, All rights reserved + * Adapted for the ReactOS system libraries by David Welch (welch@mcmail.com) + * todo: __processheap should be part of peb. + */ + +#ifndef __INCLUDE_KERNEL32_HEAP_H +#define __INCLUDE_KERNEL32_HEAP_H + +/* System wide includes ****************************************************/ +#include + +/* System library's private includes ***************************************/ + +#include + +/* definitions */ +#define HEAP_ADMIN_SIZE 8 +#define HEAP_FRAG_ADMIN_SIZE 8 +#define HEAP_ROUNDVAL (2*(HEAP_ADMIN_SIZE)-1) +#define HEAP_FRAGMENT_THRESHOLD 256 + +#define SIZE_TOTAL(s) ROUNDUP((s)+HEAP_ADMIN_SIZE,8) +#define SIZE_ROUND(s) ROUNDUP((s),8) + +#define HEAP_FRAG_MAGIC 0x10 +#define HEAP_ALLOC_MASK 0xF0000000 +#define HEAP_FREE_MASK 0x80000000 +#define HEAP_SIZE_MASK 0x0FFFFFFF +#define HEAP_FREE_TAG 0x80000000 /* free region */ +#define HEAP_NORMAL_TAG 0x30000000 /* normal allocation */ +#define HEAP_MOVEABLE_TAG 0x50000000 /* moveable handle */ +#define HEAP_SUB_TAG 0x70000000 /* suballocated for fragments */ + +#define HEAP_ISFREE(p) ((((PHEAP_BLOCK)p)->Size) & HEAP_FREE_MASK) +#define HEAP_ISALLOC(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_FREE_MASK)==0) +#define HEAP_ISFRAG(p) ((((PHEAP_FRAGMENT)p)->Magic)==HEAP_FRAG_MAGIC) +#define HEAP_ISNORMAL(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_ALLOC_MASK)\ + ==HEAP_NORMAL_TAG) +#define HEAP_ISSUB(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_ALLOC_MASK)\ + ==HEAP_SUB_TAG) +#define HEAP_ISOLD(p) (((((PHEAP_BLOCK)p)->Size) & HEAP_ALLOC_MASK)\ + ==HEAP_MOVEABLE_TAG) + +#define HEAP_SIZE(p) ((((PHEAP_BLOCK)p)->Size) & HEAP_SIZE_MASK ) +#define HEAP_RSIZE(p) SIZE_ROUND(HEAP_SIZE(p)) +#define HEAP_TSIZE(p) SIZE_TOTAL(HEAP_SIZE(p)) +#define HEAP_PREVSIZE(p) ((((PHEAP_BLOCK)p)->PrevSize) & HEAP_SIZE_MASK ) +#define HEAP_FRAG_SIZE(p) (((PHEAP_FRAGMENT)p)->Size) + +#define HEAP_PREV(p) ((PHEAP_BLOCK)(((LPVOID)(p))-HEAP_PREVSIZE(p))) +#define HEAP_NEXT(p) ((PHEAP_BLOCK)(((LPVOID)(p))+HEAP_TSIZE(p))) + +typedef struct __HEAP_BLOCK +{ + ULONG Size; /* this is relative to Data */ + ULONG PrevSize; /* p - p->PrevSize is the previous block */ +} HEAP_BLOCK, *PHEAP_BLOCK; + +struct __HEAP_SUBALLOC; + +typedef struct __HEAP_FRAGMENT +{ + UCHAR Magic; + UCHAR Number; + ULONG Size; + struct __HEAP_SUBALLOC *Sub; + + /* this is only used in free blocks */ + struct __HEAP_FRAGMENT *FreeNext; + struct __HEAP_FRAGMENT *FreePrev; +} HEAP_FRAGMENT, *PHEAP_FRAGMENT, *LPHEAP_FRAGMENT; + +typedef struct __HEAP_SUBALLOC +{ + ULONG Magic; + ULONG NumberFree; + struct __HEAP_SUBALLOC *Next; + + struct __HEAP_SUBALLOC *Prev; + struct __HEAP_FRAGMENT *FirstFree; + struct __HEAP_BUCKET *Bucket; + ULONG Bitmap; +} HEAP_SUBALLOC, *PHEAP_SUBALLOC, *LPHEAP_SUBALLOC; + +typedef struct __HEAP_BUCKET +{ + struct __HEAP_SUBALLOC *FirstFree; + ULONG Size; + ULONG Number; + ULONG TotalSize; +} HEAP_BUCKET, *PHEAP_BUCKET, *LPHEAP_BUCKET; + +typedef struct __HEAP +{ + ULONG Magic; + LPVOID End; + ULONG Flags; + CRITICAL_SECTION Synchronize; + HEAP_BUCKET Bucket[8]; + struct __HEAP *NextHeap; + LPVOID LastBlock; + /* this has to aligned on an 8 byte boundary */ + HEAP_BLOCK Start __attribute__((aligned (8))); +} HEAP, *PHEAP; + +PHEAP __ProcessHeap; + +#endif /* __INCLUDE_KERNEL32_HEAP_H */ diff --git a/reactos/include/kernel32/process.h b/reactos/include/kernel32/process.h new file mode 100644 index 00000000000..2ffe32c08ad --- /dev/null +++ b/reactos/include/kernel32/process.h @@ -0,0 +1,63 @@ + +#ifndef __PEB_DEFINED +#define __PEB_DEFINED + +#include "heap.h" + +typedef void* HANDLE_TABLE; + +typedef struct _pPebInfo { + LPWSTR lpCommandLine; + DWORD cb; + HANDLE hStdInput; //18 + HANDLE hStdOutput; + HANDLE hStdError; + LPWSTR lpEnvironment; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + DWORD wShowWindow; + LPTSTR lpTitle; + LPTSTR lpDesktop; + LPTSTR reserved; + DWORD cbReserved2; + LPTSTR lpReserved1; +} PEBINFO; + +typedef struct _NT_PEB +{ + + LONG ImageBaseAddress; + void *HeapIndex; + DWORD dwTlsBits[2]; // tls in use bits + WORD NumberOfProcessors; + WORD NtGlobalFlag; + DWORD dwCriticalSectionTimeout; + DWORD dwHeapReserve; + DWORD dwHeapCommit; + DWORD dwHeapDecommitFreeBlockThreshold; + DWORD dwNumberOfHeaps; + DWORD dwMaxiumNumberOfHeaps; + PEBINFO *pPebInfo; + HEAP *pProcessHeap; + HANDLE_TABLE htGDISharedHandleTable; + ATOMTABLE LocalAtomTable; + CRITICAL_SECTION *pCriticalSection; + WORD wMajorVersion; + WORD wMinorVersion; + WORD wBuildNumber; + WORD wPlatformId; + +} NT_PEB; + +NT_PEB *GetPeb() +{ + return NULL; +} + +#endif diff --git a/reactos/include/kernel32/thread.h b/reactos/include/kernel32/thread.h new file mode 100644 index 00000000000..effe447a857 --- /dev/null +++ b/reactos/include/kernel32/thread.h @@ -0,0 +1,56 @@ +/* +This file contains a proposal for Thread Environment Block. +*/ +#ifndef __TEB_DEFINED +#define __TEB_DEFINED + + +typedef struct _NT_TIB { + + struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; + + void *StackBase; + void *StackLimit; + void *SubSystemTib; + union { + void *FiberData; + DWORD Version; + }; + void *ArbitraryUserPointer; + struct _NT_TIB *Self; + +} NT_TIB; + + + + + +typedef struct _NT_TEB +{ + + NT_TIB Tib; + DWORD dwProcessId; + DWORD dwThreadId; + HANDLE hRPC; + NT_PEB *pPeb; + DWORD dwErrCode; + WORD nMutexCount; + LCID Locale; + //HQUEUE MessageQueue + DWORD dwTlsIndex ; + LPVOID TlsData[512]; + + +} NT_TEB; + + +// should be an inline asm macro + +NT_TEB *GetTeb() +{ + return NULL; +} + +#endif + + diff --git a/reactos/include/messages.h b/reactos/include/messages.h new file mode 100644 index 00000000000..138c3b00ac0 --- /dev/null +++ b/reactos/include/messages.h @@ -0,0 +1,1095 @@ +/* + Messages.h + + Windows32 API message definitions + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + + 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 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. +*/ +/* WARNING: This file is automatically generated. */ + +#ifndef _GNU_H_WINDOWS32_MESSAGES +#define _GNU_H_WINDOWS32_MESSAGES + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* Application bar */ + +/* Application bar notifications */ + +/* Animation Control */ +#define ACM_OPENW (1127) +#define ACM_OPENA (1124) +#ifdef UNICODE +#define ACM_OPEN ACM_OPENW +#else +#define ACM_OPEN ACM_OPENA +#endif /* UNICODE */ +#define ACM_PLAY (1125) +#define ACM_STOP (1126) +#define ACN_START (1) +#define ACN_STOP (2) + +/* Buttons */ +#define BM_CLICK (245) +#define BM_GETCHECK (240) +#define BM_GETIMAGE (246) +#define BM_GETSTATE (242) +#define BM_SETCHECK (241) +#define BM_SETIMAGE (247) +#define BM_SETSTATE (243) +#define BM_SETSTYLE (244) +#define BN_CLICKED (0) +#define BN_DBLCLK (5) +#define BN_DISABLE (4) +#define BN_DOUBLECLICKED (5) +#define BN_HILITE (2) +#define BN_KILLFOCUS (7) +#define BN_PAINT (1) +#define BN_PUSHED (2) +#define BN_SETFOCUS (6) +#define BN_UNHILITE (3) +#define BN_UNPUSHED (3) + +/* Combo Box */ +#define CB_ADDSTRING (323) +#define CB_DELETESTRING (324) +#define CB_DIR (325) +#define CB_FINDSTRING (332) +#define CB_FINDSTRINGEXACT (344) +#define CB_GETCOUNT (326) +#define CB_GETCURSEL (327) +#define CB_GETDROPPEDCONTROLRECT (338) +#define CB_GETDROPPEDSTATE (343) +#define CB_GETDROPPEDWIDTH (351) +#define CB_GETEDITSEL (320) +#define CB_GETEXTENDEDUI (342) +#define CB_GETHORIZONTALEXTENT (349) +#define CB_GETITEMDATA (336) +#define CB_GETITEMHEIGHT (340) +#define CB_GETLBTEXT (328) +#define CB_GETLBTEXTLEN (329) +#define CB_GETLOCALE (346) +#define CB_GETTOPINDEX (347) +#define CB_INITSTORAGE (353) +#define CB_INSERTSTRING (330) +#define CB_LIMITTEXT (321) +#define CB_RESETCONTENT (331) +#define CB_SELECTSTRING (333) +#define CB_SETCURSEL (334) +#define CB_SETDROPPEDWIDTH (352) +#define CB_SETEDITSEL (322) +#define CB_SETEXTENDEDUI (341) +#define CB_SETHORIZONTALEXTENT (350) +#define CB_SETITEMDATA (337) +#define CB_SETITEMHEIGHT (339) +#define CB_SETLOCALE (345) +#define CB_SETTOPINDEX (348) +#define CB_SHOWDROPDOWN (335) + +/* Combo Box notifications */ +#define CBN_CLOSEUP (8) +#define CBN_DBLCLK (2) +#define CBN_DROPDOWN (7) +#define CBN_EDITCHANGE (5) +#define CBN_EDITUPDATE (6) +#define CBN_ERRSPACE (-1) +#define CBN_KILLFOCUS (4) +#define CBN_SELCHANGE (1) +#define CBN_SELENDCANCEL (10) +#define CBN_SELENDOK (9) +#define CBN_SETFOCUS (3) + +/* Control Panel */ + +/* Device messages */ + +/* Drag list box */ +#define DL_BEGINDRAG (1157) +#define DL_CANCELDRAG (1160) +#define DL_DRAGGING (1158) +#define DL_DROPPED (1159) + +/* Default push button */ +#define DM_GETDEFID (1024) +#define DM_REPOSITION (1026) +#define DM_SETDEFID (1025) + +/* RTF control */ +#define EM_CANPASTE (1074) +#define EM_CANUNDO (198) +#define EM_CHARFROMPOS (215) +#define EM_DISPLAYBAND (1075) +#define EM_EMPTYUNDOBUFFER (205) +#define EM_EXGETSEL (1076) +#define EM_EXLIMITTEXT (1077) +#define EM_EXLINEFROMCHAR (1078) +#define EM_EXSETSEL (1079) +#define EM_FINDTEXT (1080) +#define EM_FINDTEXTEX (1103) +#define EM_FINDWORDBREAK (1100) +#define EM_FMTLINES (200) +#define EM_FORMATRANGE (1081) +#define EM_GETCHARFORMAT (1082) +#define EM_GETEVENTMASK (1083) +#define EM_GETFIRSTVISIBLELINE (206) +#define EM_GETHANDLE (189) +#define EM_GETLIMITTEXT (213) +#define EM_GETLINE (196) +#define EM_GETLINECOUNT (186) +#define EM_GETMARGINS (212) +#define EM_GETMODIFY (184) +#define EM_GETIMECOLOR (1129) +#define EM_GETIMEOPTIONS (1131) +#define EM_GETOPTIONS (1102) +#define EM_GETOLEINTERFACE (1084) +#define EM_GETPARAFORMAT (1085) +#define EM_GETPASSWORDCHAR (210) +#define EM_GETPUNCTUATION (1125) +#define EM_GETRECT (178) +#define EM_GETSEL (176) +#define EM_GETSELTEXT (1086) +#define EM_GETTEXTRANGE (1099) +#define EM_GETTHUMB (190) +#define EM_GETWORDBREAKPROC (209) +#define EM_GETWORDBREAKPROCEX (1104) +#define EM_GETWORDWRAPMODE (1127) +#define EM_HIDESELECTION (1087) +#define EM_LIMITTEXT (197) +#define EM_LINEFROMCHAR (201) +#define EM_LINEINDEX (187) +#define EM_LINELENGTH (193) +#define EM_LINESCROLL (182) +#define EM_PASTESPECIAL (1088) +#define EM_POSFROMCHAR (214) +#define EM_REPLACESEL (194) +#define EM_REQUESTRESIZE (1089) +#define EM_SCROLL (181) +#define EM_SCROLLCARET (183) +#define EM_SELECTIONTYPE (1090) +#define EM_SETBKGNDCOLOR (1091) +#define EM_SETCHARFORMAT (1092) +#define EM_SETEVENTMASK (1093) +#define EM_SETHANDLE (188) +#define EM_SETIMECOLOR (1128) +#define EM_SETIMEOPTIONS (1130) +#define EM_SETLIMITTEXT (197) +#define EM_SETMARGINS (211) +#define EM_SETMODIFY (185) +#define EM_SETOLECALLBACK (1094) +#define EM_SETOPTIONS (1101) +#define EM_SETPARAFORMAT (1095) +#define EM_SETPASSWORDCHAR (204) +#define EM_SETPUNCTUATION (1124) +#define EM_SETREADONLY (207) +#define EM_SETRECT (179) +#define EM_SETRECTNP (180) +#define EM_SETSEL (177) +#define EM_SETTABSTOPS (203) +#define EM_SETTARGETDEVICE (1096) +#define EM_SETWORDBREAKPROC (208) +#define EM_SETWORDBREAKPROCEX (1105) +#define EM_SETWORDWRAPMODE (1126) +#define EM_STREAMIN (1097) +#define EM_STREAMOUT (1098) +#define EM_UNDO (199) + +/* Edit control */ +#define EN_CHANGE (768) +#define EN_CORRECTTEXT (1797) +#define EN_DROPFILES (1795) +#define EN_ERRSPACE (1280) +#define EN_HSCROLL (1537) +#define EN_IMECHANGE (1799) +#define EN_KILLFOCUS (512) +#define EN_MAXTEXT (1281) +#define EN_MSGFILTER (1792) +#define EN_OLEOPFAILED (1801) +#define EN_PROTECTED (1796) +#define EN_REQUESTRESIZE (1793) +#define EN_SAVECLIPBOARD (1800) +#define EN_SELCHANGE (1794) +#define EN_SETFOCUS (256) +#define EN_STOPNOUNDO (1798) +#define EN_UPDATE (1024) +#define EN_VSCROLL (1538) + +/* File Manager extensions */ + +/* File Manager extensions DLL events */ + +/* Header control */ +#define HDM_DELETEITEM (4610) +#define HDM_GETITEMW (4619) +#define HDM_INSERTITEMW (4618) +#define HDM_SETITEMW (4620) +#define HDM_GETITEMA (4611) +#define HDM_INSERTITEMA (4609) +#define HDM_SETITEMA (4612) +#ifdef UNICODE +#define HDM_GETITEM HDM_GETITEMW +#define HDM_INSERTITEM HDM_INSERTITEMW +#define HDM_SETITEM HDM_SETITEMW +#else +#define HDM_GETITEM HDM_GETITEMA +#define HDM_INSERTITEM HDM_INSERTITEMA +#define HDM_SETITEM HDM_SETITEMA +#endif /* UNICODE */ +#define HDM_GETITEMCOUNT (4608) +#define HDM_HITTEST (4614) +#define HDM_LAYOUT (4613) + +/* Header control notifications */ +#define HDN_BEGINTRACKW (-326) +#define HDN_DIVIDERDBLCLICKW (-325) +#define HDN_ENDTRACKW (-327) +#define HDN_ITEMCHANGEDW (-321) +#define HDN_ITEMCHANGINGW (-320) +#define HDN_ITEMCLICKW (-322) +#define HDN_ITEMDBLCLICKW (-323) +#define HDN_TRACKW (-328) +#define HDN_BEGINTRACKA (-306) +#define HDN_DIVIDERDBLCLICKA (-305) +#define HDN_ENDTRACKA (-307) +#define HDN_ITEMCHANGEDA (-301) +#define HDN_ITEMCHANGINGA (-300) +#define HDN_ITEMCLICKA (-302) +#define HDN_ITEMDBLCLICKA (-303) +#define HDN_TRACKA (-308) +#ifdef UNICODE +#define HDN_BEGINTRACK HDN_BEGINTRACKW +#define HDN_DIVIDERDBLCLICK HDN_DIVIDERDBLCLICKW +#define HDN_ENDTRACK HDN_ENDTRACKW +#define HDN_ITEMCHANGED HDN_ITEMCHANGEDW +#define HDN_ITEMCHANGING HDN_ITEMCHANGINGW +#define HDN_ITEMCLICK HDN_ITEMCLICKW +#define HDN_ITEMDBLCLICK HDN_ITEMDBLCLICKW +#define HDN_TRACK HDN_TRACKW +#else +#define HDN_BEGINTRACK HDN_BEGINTRACKA +#define HDN_DIVIDERDBLCLICK HDN_DIVIDERDBLCLICKA +#define HDN_ENDTRACK HDN_ENDTRACKA +#define HDN_ITEMCHANGED HDN_ITEMCHANGEDA +#define HDN_ITEMCHANGING HDN_ITEMCHANGINGA +#define HDN_ITEMCLICK HDN_ITEMCLICKA +#define HDN_ITEMDBLCLICK HDN_ITEMDBLCLICKA +#define HDN_TRACK HDN_TRACKA +#endif /* UNICODE */ + +/* Hot key control */ +#define HKM_GETHOTKEY (1026) +#define HKM_SETHOTKEY (1025) +#define HKM_SETRULES (1027) + +/* List box */ +#define LB_ADDFILE (406) +#define LB_ADDSTRING (384) +#define LB_DELETESTRING (386) +#define LB_DIR (397) +#define LB_FINDSTRING (399) +#define LB_FINDSTRINGEXACT (418) +#define LB_GETANCHORINDEX (413) +#define LB_GETCARETINDEX (415) +#define LB_GETCOUNT (395) +#define LB_GETCURSEL (392) +#define LB_GETHORIZONTALEXTENT (403) +#define LB_GETITEMDATA (409) +#define LB_GETITEMHEIGHT (417) +#define LB_GETITEMRECT (408) +#define LB_GETLOCALE (422) +#define LB_GETSEL (391) +#define LB_GETSELCOUNT (400) +#define LB_GETSELITEMS (401) +#define LB_GETTEXT (393) +#define LB_GETTEXTLEN (394) +#define LB_GETTOPINDEX (398) +#define LB_INITSTORAGE (424) +#define LB_INSERTSTRING (385) +#define LB_ITEMFROMPOINT (425) +#define LB_RESETCONTENT (388) +#define LB_SELECTSTRING (396) +#define LB_SELITEMRANGE (411) +#define LB_SELITEMRANGEEX (387) +#define LB_SETANCHORINDEX (412) +#define LB_SETCARETINDEX (414) +#define LB_SETCOLUMNWIDTH (405) +#define LB_SETCOUNT (423) +#define LB_SETCURSEL (390) +#define LB_SETHORIZONTALEXTENT (404) +#define LB_SETITEMDATA (410) +#define LB_SETITEMHEIGHT (416) +#define LB_SETLOCALE (421) +#define LB_SETSEL (389) +#define LB_SETTABSTOPS (402) +#define LB_SETTOPINDEX (407) + +/* List box notifications */ +#define LBN_DBLCLK (2) +#define LBN_ERRSPACE (-2) +#define LBN_KILLFOCUS (5) +#define LBN_SELCANCEL (3) +#define LBN_SELCHANGE (1) +#define LBN_SETFOCUS (4) + +/* List view control */ +#define LVM_ARRANGE (4118) +#define LVM_CREATEDRAGIMAGE (4129) +#define LVM_DELETEALLITEMS (4105) +#define LVM_DELETECOLUMN (4124) +#define LVM_DELETEITEM (4104) +#define LVM_ENSUREVISIBLE (4115) +#define LVM_GETBKCOLOR (4096) +#define LVM_GETCALLBACKMASK (4106) +#define LVM_GETCOLUMNWIDTH (4125) +#define LVM_GETCOUNTPERPAGE (4136) +#define LVM_GETEDITCONTROL (4120) +#define LVM_GETIMAGELIST (4098) +#define LVM_EDITLABELW (4214) +#define LVM_FINDITEMW (4179) +#define LVM_GETCOLUMNW (4191) +#define LVM_GETISEARCHSTRINGW (4213) +#define LVM_GETITEMW (4171) +#define LVM_GETITEMTEXTW (4211) +#define LVM_GETSTRINGWIDTHW (4183) +#define LVM_INSERTCOLUMNW (4193) +#define LVM_INSERTITEMW (4173) +#define LVM_SETCOLUMNW (4192) +#define LVM_SETITEMW (4172) +#define LVM_SETITEMTEXTW (4212) +#define LVM_EDITLABELA (4119) +#define LVM_FINDITEMA (4109) +#define LVM_GETCOLUMNA (4121) +#define LVM_GETISEARCHSTRINGA (4148) +#define LVM_GETITEMA (4101) +#define LVM_GETITEMTEXTA (4141) +#define LVM_GETSTRINGWIDTHA (4113) +#define LVM_INSERTCOLUMNA (4123) +#define LVM_INSERTITEMA (4103) +#define LVM_SETCOLUMNA (4122) +#define LVM_SETITEMA (4102) +#define LVM_SETITEMTEXTA (4142) +#ifdef UNICODE +#define LVM_EDITLABEL LVM_EDITLABELW +#define LVM_FINDITEM LVM_FINDITEMW +#define LVM_GETCOLUMN LVM_GETCOLUMNW +#define LVM_GETISEARCHSTRING LVM_GETISEARCHSTRINGW +#define LVM_GETITEM LVM_GETITEMW +#define LVM_GETITEMTEXT LVM_GETITEMTEXTW +#define LVM_GETSTRINGWIDTH LVM_GETSTRINGWIDTHW +#define LVM_INSERTCOLUMN LVM_INSERTCOLUMNW +#define LVM_INSERTITEM LVM_INSERTITEMW +#define LVM_SETCOLUMN LVM_SETCOLUMNW +#define LVM_SETITEM LVM_SETITEMW +#define LVM_SETITEMTEXT LVM_SETITEMTEXTW +#else +#define LVM_EDITLABEL LVM_EDITLABELA +#define LVM_FINDITEM LVM_FINDITEMA +#define LVM_GETCOLUMN LVM_GETCOLUMNA +#define LVM_GETISEARCHSTRING LVM_GETISEARCHSTRINGA +#define LVM_GETITEM LVM_GETITEMA +#define LVM_GETITEMTEXT LVM_GETITEMTEXTA +#define LVM_GETSTRINGWIDTH LVM_GETSTRINGWIDTHA +#define LVM_INSERTCOLUMN LVM_INSERTCOLUMNA +#define LVM_INSERTITEM LVM_INSERTITEMA +#define LVM_SETCOLUMN LVM_SETCOLUMNA +#define LVM_SETITEM LVM_SETITEMA +#define LVM_SETITEMTEXT LVM_SETITEMTEXTA +#endif /* UNICODE */ +#define LVM_GETITEMCOUNT (4100) +#define LVM_GETITEMPOSITION (4112) +#define LVM_GETITEMRECT (4110) +#define LVM_GETITEMSPACING (4147) +#define LVM_GETITEMSTATE (4140) +#define LVM_GETNEXTITEM (4108) +#define LVM_GETORIGIN (4137) +#define LVM_GETSELECTEDCOUNT (4146) +#define LVM_GETTEXTBKCOLOR (4133) +#define LVM_GETTEXTCOLOR (4131) +#define LVM_GETTOPINDEX (4135) +#define LVM_GETVIEWRECT (4130) +#define LVM_HITTEST (4114) +#define LVM_REDRAWITEMS (4117) +#define LVM_SCROLL (4116) +#define LVM_SETBKCOLOR (4097) +#define LVM_SETCALLBACKMASK (4107) +#define LVM_SETCOLUMNWIDTH (4126) +#define LVM_SETIMAGELIST (4099) +#define LVM_SETITEMCOUNT (4143) +#define LVM_SETITEMPOSITION (4111) +#define LVM_SETITEMPOSITION32 (4145) +#define LVM_SETITEMSTATE (4139) +#define LVM_SETTEXTBKCOLOR (4134) +#define LVM_SETTEXTCOLOR (4132) +#define LVM_SORTITEMS (4144) +#define LVM_UPDATE (4138) + +/* List view control notifications */ +#define LVN_BEGINDRAG (-109) +#define LVN_BEGINRDRAG (-111) +#define LVN_COLUMNCLICK (-108) +#define LVN_DELETEALLITEMS (-104) +#define LVN_DELETEITEM (-103) +#define LVN_BEGINLABELEDITW (-175) +#define LVN_ENDLABELEDITW (-176) +#define LVN_GETDISPINFOW (-177) +#define LVN_SETDISPINFOW (-178) +#define LVN_BEGINLABELEDITA (-105) +#define LVN_ENDLABELEDITA (-106) +#define LVN_GETDISPINFOA (-150) +#define LVN_SETDISPINFOA (-151) +#ifdef UNICODE +#define LVN_BEGINLABELEDIT LVN_BEGINLABELEDITW +#define LVN_ENDLABELEDIT LVN_ENDLABELEDITW +#define LVN_GETDISPINFO LVN_GETDISPINFOW +#define LVN_SETDISPINFO LVN_SETDISPINFOW +#else +#define LVN_BEGINLABELEDIT LVN_BEGINLABELEDITA +#define LVN_ENDLABELEDIT LVN_ENDLABELEDITA +#define LVN_GETDISPINFO LVN_GETDISPINFOA +#define LVN_SETDISPINFO LVN_SETDISPINFOA +#endif /* UNICODE */ +#define LVN_INSERTITEM (-102) +#define LVN_ITEMCHANGED (-101) +#define LVN_ITEMCHANGING (-100) +#define LVN_KEYDOWN (-155) + +/* Control notification */ +#define NM_CLICK (-2) +#define NM_DBLCLK (-3) +#define NM_KILLFOCUS (-8) +#define NM_OUTOFMEMORY (-1) +#define NM_RCLICK (-5) +#define NM_RDBLCLK (-6) +#define NM_RETURN (-4) +#define NM_SETFOCUS (-7) + +/* Power status */ + +/* Progress bar control */ +#define PBM_DELTAPOS (1027) +#define PBM_SETPOS (1026) +#define PBM_SETRANGE (1025) +#define PBM_SETSTEP (1028) +#define PBM_STEPIT (1029) + +/* Property sheets */ +#define PSM_ADDPAGE (1127) +#define PSM_APPLY (1134) +#define PSM_CANCELTOCLOSE (1131) +#define PSM_CHANGED (1128) +#define PSM_GETTABCONTROL (1140) +#define PSM_GETCURRENTPAGEHWND (1142) +#define PSM_ISDIALOGMESSAGE (1141) +#define PSM_PRESSBUTTON (1137) +#define PSM_QUERYSIBLINGS (1132) +#define PSM_REBOOTSYSTEM (1130) +#define PSM_REMOVEPAGE (1126) +#define PSM_RESTARTWINDOWS (1129) +#define PSM_SETCURSEL (1125) +#define PSM_SETCURSELID (1138) +#define PSM_SETFINISHTEXTW (1145) +#define PSM_SETTITLEW (1144) +#define PSM_SETFINISHTEXTA (1139) +#define PSM_SETTITLEA (1135) +#ifdef UNICODE +#define PSM_SETFINISHTEXT PSM_SETFINISHTEXTW +#define PSM_SETTITLE PSM_SETTITLEW +#else +#define PSM_SETFINISHTEXT PSM_SETFINISHTEXTA +#define PSM_SETTITLE PSM_SETTITLEA +#endif /* UNICODE */ +#define PSM_SETWIZBUTTONS (1136) +#define PSM_UNCHANGED (1133) + +/* Property sheet notifications */ +#define PSN_APPLY (-202) +#define PSN_HELP (-205) +#define PSN_KILLACTIVE (-201) +#define PSN_QUERYCANCEL (-209) +#define PSN_RESET (-203) +#define PSN_SETACTIVE (-200) +#define PSN_WIZBACK (-206) +#define PSN_WIZFINISH (-208) +#define PSN_WIZNEXT (-207) + +/* Status window */ +#define SB_GETBORDERS (1031) +#define SB_GETPARTS (1030) +#define SB_GETRECT (1034) +#define SB_GETTEXTW (1037) +#define SB_GETTEXTLENGTHW (1036) +#define SB_SETTEXTW (1035) +#define SB_GETTEXTA (1026) +#define SB_GETTEXTLENGTHA (1027) +#define SB_SETTEXTA (1025) +#ifdef UNICODE +#define SB_GETTEXT SB_GETTEXTW +#define SB_GETTEXTLENGTH SB_GETTEXTLENGTHW +#define SB_SETTEXT SB_SETTEXTW +#else +#define SB_GETTEXT SB_GETTEXTA +#define SB_GETTEXTLENGTH SB_GETTEXTLENGTHA +#define SB_SETTEXT SB_SETTEXTA +#endif /* UNICODE */ +#define SB_SETMINHEIGHT (1032) +#define SB_SETPARTS (1028) +#define SB_SIMPLE (1033) + +/* Scroll bar control */ +#define SBM_ENABLE_ARROWS (228) +#define SBM_GETPOS (225) +#define SBM_GETRANGE (227) +#define SBM_GETSCROLLINFO (234) +#define SBM_SETPOS (224) +#define SBM_SETRANGE (226) +#define SBM_SETRANGEREDRAW (230) +#define SBM_SETSCROLLINFO (233) + +/* Static control */ +#define STM_GETICON (369) +#define STM_GETIMAGE (371) +#define STM_SETICON (368) +#define STM_SETIMAGE (370) + +/* Static control notifications */ +#define STN_CLICKED (0) +#define STN_DBLCLK (1) +#define STN_DISABLE (3) +#define STN_ENABLE (2) + +/* Toolbar control */ +#define TB_ADDBITMAP (1043) +#define TB_ADDBUTTONS (1044) +#define TB_AUTOSIZE (1057) +#define TB_BUTTONCOUNT (1048) +#define TB_BUTTONSTRUCTSIZE (1054) +#define TB_CHANGEBITMAP (1067) +#define TB_CHECKBUTTON (1026) +#define TB_COMMANDTOINDEX (1049) +#define TB_CUSTOMIZE (1051) +#define TB_DELETEBUTTON (1046) +#define TB_ENABLEBUTTON (1025) +#define TB_GETBITMAP (1068) +#define TB_GETBITMAPFLAGS (1065) +#define TB_GETBUTTON (1047) +#define TB_ADDSTRINGW (1101) +#define TB_GETBUTTONTEXTW (1099) +#define TB_SAVERESTOREW (1100) +#define TB_ADDSTRINGA (1052) +#define TB_GETBUTTONTEXTA (1069) +#define TB_SAVERESTOREA (1050) +#ifdef UNICODE +#define TB_ADDSTRING TB_ADDSTRINGW +#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTW +#define TB_SAVERESTORE TB_SAVERESTOREW +#else +#define TB_ADDSTRING TB_ADDSTRINGA +#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTA +#define TB_SAVERESTORE TB_SAVERESTOREA +#endif /* UNICODE */ +#define TB_GETITEMRECT (1053) +#define TB_GETROWS (1064) +#define TB_GETSTATE (1042) +#define TB_GETTOOLTIPS (1059) +#define TB_HIDEBUTTON (1028) +#define TB_INDETERMINATE (1029) +#define TB_INSERTBUTTON (1045) +#define TB_ISBUTTONCHECKED (1034) +#define TB_ISBUTTONENABLED (1033) +#define TB_ISBUTTONHIDDEN (1036) +#define TB_ISBUTTONINDETERMINATE (1037) +#define TB_ISBUTTONPRESSED (1035) +#define TB_PRESSBUTTON (1027) +#define TB_SETBITMAPSIZE (1056) +#define TB_SETBUTTONSIZE (1055) +#define TB_SETCMDID (1066) +#define TB_SETPARENT (1061) +#define TB_SETROWS (1063) +#define TB_SETSTATE (1041) +#define TB_SETTOOLTIPS (1060) + +/* Track bar control */ +#define TBM_CLEARSEL (1043) +#define TBM_CLEARTICS (1033) +#define TBM_GETCHANNELRECT (1050) +#define TBM_GETLINESIZE (1048) +#define TBM_GETNUMTICS (1040) +#define TBM_GETPAGESIZE (1046) +#define TBM_GETPOS (1024) +#define TBM_GETPTICS (1038) +#define TBM_GETRANGEMAX (1026) +#define TBM_GETRANGEMIN (1025) +#define TBM_GETSELEND (1042) +#define TBM_GETSELSTART (1041) +#define TBM_GETTHUMBLENGTH (1052) +#define TBM_GETTHUMBRECT (1049) +#define TBM_GETTIC (1027) +#define TBM_GETTICPOS (1039) +#define TBM_SETLINESIZE (1047) +#define TBM_SETPAGESIZE (1045) +#define TBM_SETPOS (1029) +#define TBM_SETRANGE (1030) +#define TBM_SETRANGEMAX (1032) +#define TBM_SETRANGEMIN (1031) +#define TBM_SETSEL (1034) +#define TBM_SETSELEND (1036) +#define TBM_SETSELSTART (1035) +#define TBM_SETTHUMBLENGTH (1051) +#define TBM_SETTIC (1028) +#define TBM_SETTICFREQ (1044) + +/* Tool bar control notifications */ +#define TBN_BEGINADJUST (-703) +#define TBN_BEGINDRAG (-701) +#define TBN_CUSTHELP (-709) +#define TBN_ENDADJUST (-704) +#define TBN_ENDDRAG (-702) +#define TBN_GETBUTTONINFOW (-720) +#define TBN_GETBUTTONINFOA (-700) +#ifdef UNICODE +#define TBN_GETBUTTONINFO TBN_GETBUTTONINFOW +#else +#define TBN_GETBUTTONINFO TBN_GETBUTTONINFOA +#endif /* UNICODE */ +#define TBN_QUERYDELETE (-707) +#define TBN_QUERYINSERT (-706) +#define TBN_RESET (-705) +#define TBN_TOOLBARCHANGE (-708) + +/* Tab control */ +#define TCM_ADJUSTRECT (4904) +#define TCM_DELETEALLITEMS (4873) +#define TCM_DELETEITEM (4872) +#define TCM_GETCURFOCUS (4911) +#define TCM_GETCURSEL (4875) +#define TCM_GETIMAGELIST (4866) +#define TCM_GETITEMW (4924) +#define TCM_INSERTITEMW (4926) +#define TCM_SETITEMW (4925) +#define TCM_GETITEMA (4869) +#define TCM_INSERTITEMA (4871) +#define TCM_SETITEMA (4870) +#ifdef UNICODE +#define TCM_GETITEM TCM_GETITEM +#define TCM_INSERTITEM TCM_INSERTITEMW +#define TCM_SETITEM TCM_SETITEMW +#else +#define TCM_GETITEM TCM_GETITEMA +#define TCM_INSERTITEM TCM_INSERTITEMA +#define TCM_SETITEM TCM_SETITEMA +#endif /* UNICODE */ +#define TCM_GETITEMCOUNT (4868) +#define TCM_GETITEMRECT (4874) +#define TCM_GETROWCOUNT (4908) +#define TCM_GETTOOLTIPS (4909) +#define TCM_HITTEST (4877) +#define TCM_REMOVEIMAGE (4906) +#define TCM_SETCURFOCUS (4912) +#define TCM_SETCURSEL (4876) +#define TCM_SETIMAGELIST (4867) +#define TCM_SETITEMEXTRA (4878) +#define TCM_SETITEMSIZE (4905) +#define TCM_SETPADDING (4907) +#define TCM_SETTOOLTIPS (4910) + +/* Tab control notifications */ +#define TCN_KEYDOWN (-550) +#define TCN_SELCHANGE (-551) +#define TCN_SELCHANGING (-552) + +/* Tool tip control */ +#define TTM_ACTIVATE (1025) +#define TTM_ADDTOOLW (1074) +#define TTM_DELTOOLW (1075) +#define TTM_ENUMTOOLSW (1082) +#define TTM_GETCURRENTTOOLW (1083) +#define TTM_GETTEXTW (1080) +#define TTM_GETTOOLINFOW (1077) +#define TTM_HITTESTW (1079) +#define TTM_NEWTOOLRECTW (1076) +#define TTM_SETTOOLINFOW (1078) +#define TTM_UPDATETIPTEXTW (1081) +#define TTM_ADDTOOLA (1028) +#define TTM_DELTOOLA (1029) +#define TTM_ENUMTOOLSA (1038) +#define TTM_GETCURRENTTOOLA (1039) +#define TTM_GETTEXTA (1035) +#define TTM_GETTOOLINFOA (1032) +#define TTM_HITTESTA (1034) +#define TTM_NEWTOOLRECTA (1030) +#define TTM_SETTOOLINFOA (1033) +#define TTM_UPDATETIPTEXTA (1036) +#ifdef UNICODE +#define TTM_ADDTOOL TTM_ADDTOOLW +#define TTM_DELTOOL TTM_DELTOOLW +#define TTM_ENUMTOOLS TTM_ENUMTOOLSW +#define TTM_GETCURRENTTOOL TTM_GETCURRENTTOOLW +#define TTM_GETTEXT TTM_GETTEXTW +#define TTM_GETTOOLINFO TTM_GETTOOLINFOW +#define TTM_HITTEST TTM_HITTESTW +#define TTM_NEWTOOLRECT TTM_NEWTOOLRECTW +#define TTM_SETTOOLINFO TTM_SETTOOLINFOW +#define TTM_UPDATETIPTEXT TTM_UPDATETIPTEXTW +#else +#define TTM_ADDTOOL TTM_ADDTOOLA +#define TTM_DELTOOL TTM_DELTOOLA +#define TTM_ENUMTOOLS TTM_ENUMTOOLSA +#define TTM_GETCURRENTTOOL TTM_GETCURRENTTOOLA +#define TTM_GETTEXT TTM_GETTEXTA +#define TTM_GETTOOLINFO TTM_GETTOOLINFOA +#define TTM_HITTEST TTM_HITTESTA +#define TTM_NEWTOOLRECT TTM_NEWTOOLRECTA +#define TTM_SETTOOLINFO TTM_SETTOOLINFOA +#define TTM_UPDATETIPTEXT TTM_UPDATETIPTEXTA +#endif /* UNICODE */ +#define TTM_GETTOOLCOUNT (1037) +#define TTM_RELAYEVENT (1031) +#define TTM_SETDELAYTIME (1027) +#define TTM_WINDOWFROMPOINT (1040) + +/* Tool tip control notification */ +#define TTN_NEEDTEXTW (-530) +#define TTN_NEEDTEXTA (-520) +#ifdef UNICODE +#define TTN_NEEDTEXT TTN_NEEDTEXTW +#else +#define TTN_NEEDTEXT TTN_NEEDTEXTA +#endif /* UNICODE */ +#define TTN_POP (-522) +#define TTN_SHOW (-521) + +/* Tree view control */ +#define TVM_CREATEDRAGIMAGE (4370) +#define TVM_DELETEITEM (4353) +#define TVM_ENDEDITLABELNOW (4374) +#define TVM_ENSUREVISIBLE (4372) +#define TVM_EXPAND (4354) +#define TVM_GETCOUNT (4357) +#define TVM_GETEDITCONTROL (4367) +#define TVM_GETIMAGELIST (4360) +#define TVM_GETINDENT (4358) +#define TVM_GETITEMRECT (4356) +#define TVM_GETNEXTITEM (4362) +#define TVM_GETVISIBLECOUNT (4368) +#define TVM_HITTEST (4369) +#define TVM_EDITLABELW (4417) +#define TVM_GETISEARCHSTRINGW (4416) +#define TVM_GETITEMW (4414) +#define TVM_INSERTITEMW (4402) +#define TVM_SETITEMW (4415) +#define TVM_EDITLABELA (4366) +#define TVM_GETISEARCHSTRINGA (4375) +#define TVM_GETITEMA (4364) +#define TVM_INSERTITEMA (4352) +#define TVM_SETITEMA (4365) +#ifdef UNICODE +#define TVM_EDITLABEL TVM_EDITLABELW +#define TVM_GETISEARCHSTRING TVM_GETISEARCHSTRINGW +#define TVM_GETITEM TVM_GETITEMW +#define TVM_INSERTITEM TVM_INSERTITEMW +#define TVM_SETITEM TVM_SETITEMW +#else +#define TVM_EDITLABEL TVM_EDITLABELA +#define TVM_GETISEARCHSTRING TVM_GETISEARCHSTRINGA +#define TVM_GETITEM TVM_GETITEMA +#define TVM_INSERTITEM TVM_INSERTITEMA +#define TVM_SETITEM TVM_SETITEMA +#endif /* UNICODE */ +#define TVM_SELECTITEM (4363) +#define TVM_SETIMAGELIST (4361) +#define TVM_SETINDENT (4359) +#define TVM_SORTCHILDREN (4371) +#define TVM_SORTCHILDRENCB (4373) + +/* Tree view control notification */ +#define TVN_KEYDOWN (-412) +#define TVN_BEGINDRAGW (-456) +#define TVN_BEGINLABELEDITW (-459) +#define TVN_BEGINRDRAGW (-457) +#define TVN_DELETEITEMW (-458) +#define TVN_ENDLABELEDITW (-460) +#define TVN_GETDISPINFOW (-452) +#define TVN_ITEMEXPANDEDW (-455) +#define TVN_ITEMEXPANDINGW (-454) +#define TVN_SELCHANGEDW (-451) +#define TVN_SELCHANGINGW (-450) +#define TVN_SETDISPINFOW (-453) +#define TVN_BEGINDRAGA (-407) +#define TVN_BEGINLABELEDITA (-410) +#define TVN_BEGINRDRAGA (-408) +#define TVN_DELETEITEMA (-409) +#define TVN_ENDLABELEDITA (-411) +#define TVN_GETDISPINFOA (-403) +#define TVN_ITEMEXPANDEDA (-406) +#define TVN_ITEMEXPANDINGA (-405) +#define TVN_SELCHANGEDA (-402) +#define TVN_SELCHANGINGA (-401) +#define TVN_SETDISPINFOA (-404) +#ifdef UNICODE +#define TVN_BEGINDRAG TVN_BEGINDRAGW +#define TVN_BEGINLABELEDIT TVN_BEGINLABELEDITW +#define TVN_BEGINRDRAG TVN_BEGINRDRAGW +#define TVN_DELETEITEM TVN_DELETEITEMW +#define TVN_ENDLABELEDIT TVN_ENDLABELEDITW +#define TVN_GETDISPINFO TVN_GETDISPINFOW +#define TVN_ITEMEXPANDED TVN_ITEMEXPANDEDW +#define TVN_ITEMEXPANDING TVN_ITEMEXPANDINGW +#define TVN_SELCHANGED TVN_SELCHANGEDW +#define TVN_SELCHANGING TVN_SELCHANGINGW +#define TVN_SETDISPINFO TVN_SETDISPINFOW +#else +#define TVN_BEGINDRAG TVN_BEGINDRAGA +#define TVN_BEGINLABELEDIT TVN_BEGINLABELEDITA +#define TVN_BEGINRDRAG TVN_BEGINRDRAGA +#define TVN_DELETEITEM TVN_DELETEITEMA +#define TVN_ENDLABELEDIT TVN_ENDLABELEDITA +#define TVN_GETDISPINFO TVN_GETDISPINFOA +#define TVN_ITEMEXPANDED TVN_ITEMEXPANDEDA +#define TVN_ITEMEXPANDING TVN_ITEMEXPANDINGA +#define TVN_SELCHANGED TVN_SELCHANGEDA +#define TVN_SELCHANGING TVN_SELCHANGINGA +#define TVN_SETDISPINFO TVN_SETDISPINFOA +#endif /* UNICODE */ + +/* Up/down control */ +#define UDM_GETACCEL (1132) +#define UDM_GETBASE (1134) +#define UDM_GETBUDDY (1130) +#define UDM_GETPOS (1128) +#define UDM_GETRANGE (1126) +#define UDM_SETACCEL (1131) +#define UDM_SETBASE (1133) +#define UDM_SETBUDDY (1129) +#define UDM_SETPOS (1127) +#define UDM_SETRANGE (1125) + +/* Up/down control notification */ +#define UDN_DELTAPOS (-722) + +/* Window messages */ + +#define WM_ACTIVATE (6) +#define WM_ACTIVATEAPP (28) +#define WM_ASKCBFORMATNAME (780) +#define WM_CANCELJOURNAL (75) +#define WM_CANCELMODE (31) +#define WM_CAPTURECHANGED (533) +#define WM_CHANGECBCHAIN (781) +#define WM_CHAR (258) +#define WM_CHARTOITEM (47) +#define WM_CHILDACTIVATE (34) +#define WM_CHOOSEFONT_GETLOGFONT (1025) +#define WM_CHOOSEFONT_SETLOGFONT (1125) +#define WM_CHOOSEFONT_SETFLAGS (1126) +#define WM_CLEAR (771) +#define WM_CLOSE (16) +#define WM_COMMAND (273) +#define WM_COMPACTING (65) +#define WM_COMPAREITEM (57) +#define WM_CONTEXTMENU (123) +#define WM_COPY (769) +#define WM_COPYDATA (74) +#define WM_CREATE (1) +#define WM_CTLCOLORBTN (309) +#define WM_CTLCOLORDLG (310) +#define WM_CTLCOLOREDIT (307) +#define WM_CTLCOLORLISTBOX (308) +#define WM_CTLCOLORMSGBOX (306) +#define WM_CTLCOLORSCROLLBAR (311) +#define WM_CTLCOLORSTATIC (312) +#define WM_CUT (768) +#define WM_DEADCHAR (259) +#define WM_DELETEITEM (45) +#define WM_DESTROY (2) +#define WM_DESTROYCLIPBOARD (775) +#define WM_DEVICECHANGE (537) +#define WM_DEVMODECHANGE (27) +#define WM_DISPLAYCHANGE (126) +#define WM_DRAWCLIPBOARD (776) +#define WM_DRAWITEM (43) +#define WM_DROPFILES (563) +#define WM_ENABLE (10) +#define WM_ENDSESSION (22) +#define WM_ENTERIDLE (289) +#define WM_ENTERMENULOOP (529) +#define WM_ENTERSIZEMOVE (561) +#define WM_ERASEBKGND (20) +#define WM_EXITMENULOOP (530) +#define WM_EXITSIZEMOVE (562) +#define WM_FONTCHANGE (29) +#define WM_GETDLGCODE (135) +#define WM_GETFONT (49) +#define WM_GETHOTKEY (51) +#define WM_GETICON (127) +#define WM_GETMINMAXINFO (36) +#define WM_GETTEXT (13) +#define WM_GETTEXTLENGTH (14) +#define WM_HELP (83) +#define WM_HOTKEY (786) +#define WM_HSCROLL (276) +#define WM_HSCROLLCLIPBOARD (782) +#define WM_ICONERASEBKGND (39) +#define WM_IME_CHAR (646) +#define WM_IME_COMPOSITION (271) +#define WM_IME_COMPOSITIONFULL (644) +#define WM_IME_CONTROL (643) +#define WM_IME_ENDCOMPOSITION (270) +#define WM_IME_KEYDOWN (656) +#define WM_IME_KEYUP (657) +#define WM_IME_NOTIFY (642) +#define WM_IME_SELECT (645) +#define WM_IME_SETCONTEXT (641) +#define WM_IME_STARTCOMPOSITION (269) +#define WM_INITDIALOG (272) +#define WM_INITMENU (278) +#define WM_INITMENUPOPUP (279) +#define WM_INPUTLANGCHANGE (81) +#define WM_INPUTLANGCHANGEREQUEST (80) +#define WM_KEYDOWN (256) +#define WM_KEYUP (257) +#define WM_KILLFOCUS (8) +#define WM_LBUTTONDBLCLK (515) +#define WM_LBUTTONDOWN (513) +#define WM_LBUTTONUP (514) +#define WM_MBUTTONDBLCLK (521) +#define WM_MBUTTONDOWN (519) +#define WM_MBUTTONUP (520) +#define WM_MDIACTIVATE (546) +#define WM_MDICASCADE (551) +#define WM_MDICREATE (544) +#define WM_MDIDESTROY (545) +#define WM_MDIGETACTIVE (553) +#define WM_MDIICONARRANGE (552) +#define WM_MDIMAXIMIZE (549) +#define WM_MDINEXT (548) +#define WM_MDIREFRESHMENU (564) +#define WM_MDIRESTORE (547) +#define WM_MDISETMENU (560) +#define WM_MDITILE (550) +#define WM_MEASUREITEM (44) +#define WM_MENUCHAR (288) +#define WM_MENUSELECT (287) +#define WM_MOUSEACTIVATE (33) +#define WM_MOUSEMOVE (512) +#define WM_MOVE (3) +#define WM_MOVING (534) +#define WM_NCACTIVATE (134) +#define WM_NCCALCSIZE (131) +#define WM_NCCREATE (129) +#define WM_NCDESTROY (130) +#define WM_NCHITTEST (132) +#define WM_NCLBUTTONDBLCLK (163) +#define WM_NCLBUTTONDOWN (161) +#define WM_NCLBUTTONUP (162) +#define WM_NCMBUTTONDBLCLK (169) +#define WM_NCMBUTTONDOWN (167) +#define WM_NCMBUTTONUP (168) +#define WM_NCMOUSEMOVE (160) +#define WM_NCPAINT (133) +#define WM_NCRBUTTONDBLCLK (166) +#define WM_NCRBUTTONDOWN (164) +#define WM_NCRBUTTONUP (165) +#define WM_NEXTDLGCTL (40) +#define WM_NOTIFY (78) +#define WM_NOTIFYFORMAT (85) +#define WM_NULL (0) +#define WM_PAINT (15) +#define WM_PAINTCLIPBOARD (777) +#define WM_PAINTICON (38) +#define WM_PALETTECHANGED (785) +#define WM_PALETTEISCHANGING (784) +#define WM_PARENTNOTIFY (528) +#define WM_PASTE (770) +#define WM_PENWINFIRST (896) +#define WM_PENWINLAST (911) +#define WM_POWER (72) +#define WM_POWERBROADCAST (536) +#define WM_PRINT (791) +#define WM_PRINTCLIENT (792) +#define WM_PSD_ENVSTAMPRECT (1029) +#define WM_PSD_FULLPAGERECT (1025) +#define WM_PSD_GREEKTEXTRECT (1028) +#define WM_PSD_MARGINRECT (1027) +#define WM_PSD_MINMARGINRECT (1026) +#define WM_PSD_PAGESETUPDLG (1024) +#define WM_PSD_YAFULLPAGERECT (1030) +#define WM_QUERYDRAGICON (55) +#define WM_QUERYENDSESSION (17) +#define WM_QUERYNEWPALETTE (783) +#define WM_QUERYOPEN (19) +#define WM_QUEUESYNC (35) +#define WM_QUIT (18) +#define WM_RBUTTONDBLCLK (518) +#define WM_RBUTTONDOWN (516) +#define WM_RBUTTONUP (517) +#define WM_RENDERALLFORMATS (774) +#define WM_RENDERFORMAT (773) +#define WM_SETCURSOR (32) +#define WM_SETFOCUS (7) +#define WM_SETFONT (48) +#define WM_SETHOTKEY (50) +#define WM_SETICON (128) +#define WM_SETREDRAW (11) +#define WM_SETTEXT (12) +#define WM_SETTINGCHANGE (26) +#define WM_SHOWWINDOW (24) +#define WM_SIZE (5) +#define WM_SIZECLIPBOARD (779) +#define WM_SIZING (532) +#define WM_SPOOLERSTATUS (42) +#define WM_STYLECHANGED (125) +#define WM_STYLECHANGING (124) +#define WM_SYSCHAR (262) +#define WM_SYSCOLORCHANGE (21) +#define WM_SYSCOMMAND (274) +#define WM_SYSDEADCHAR (263) +#define WM_SYSKEYDOWN (260) +#define WM_SYSKEYUP (261) +#define WM_TCARD (82) +#define WM_TIMECHANGE (30) +#define WM_TIMER (275) +#define WM_UNDO (772) +#define WM_USER (1024) +#define WM_USERCHANGED (84) +#define WM_VKEYTOITEM (46) +#define WM_VSCROLL (277) +#define WM_VSCROLLCLIPBOARD (778) +#define WM_WINDOWPOSCHANGED (71) +#define WM_WINDOWPOSCHANGING (70) +#define WM_WININICHANGE (26) + +/* Window message ranges */ +#define WM_KEYFIRST (256) +#define WM_KEYLAST (264) +#define WM_MOUSEFIRST (512) +#define WM_MOUSELAST (521) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_MESSAGES */ diff --git a/reactos/include/ntdll/pagesize.h b/reactos/include/ntdll/pagesize.h new file mode 100644 index 00000000000..6f1bd7134f6 --- /dev/null +++ b/reactos/include/ntdll/pagesize.h @@ -0,0 +1,7 @@ +/* + * + */ + +#ifdef i386 +#define PAGESIZE (4096) +#endif diff --git a/reactos/include/sockets.h b/reactos/include/sockets.h new file mode 100644 index 00000000000..11a8f51ac84 --- /dev/null +++ b/reactos/include/sockets.h @@ -0,0 +1,965 @@ +/* + Sockets.h + + Windows Sockets specification version 1.1 + + Copyright (C) 1996 Free Software Foundation, Inc. + Thanks to Linux header files for supplying many needed definitions + + Author: Scott Christley + Date: 1996 + + This file is part of the Windows32 API Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/*- + * Portions Copyright (c) 1980, 1983, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _GNU_H_WINDOWS32_SOCKETS +#define _GNU_H_WINDOWS32_SOCKETS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* BSD */ +#ifndef _SYS_TYPES_H +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; +#endif + +/* + Default maximium number of sockets. + Define this before including Sockets.h to increase; this does not + mean that the underlying Windows Sockets implementation has to + support that many! + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 64 +#endif /* !FD_SETSIZE */ + +/* + These macros are critical to the usage of Windows Sockets. + According to the documentation, a SOCKET is no longer represented + by a "small non-negative integer"; so all programs MUST use these + macros for setting, initializing, clearing and checking the + fd_set structures. + */ + +typedef u_int SOCKET; + +/* fd_set may have been defined by the newlib . */ +#ifdef fd_set +#undef fd_set +#endif +typedef struct fd_set { + u_int fd_count; + SOCKET fd_array[FD_SETSIZE]; +} fd_set; + +/* Internal function, not documented except in winsock.h */ +extern int PASCAL __WSAFDIsSet(SOCKET, fd_set*); + +#ifdef FD_CLR +#undef FD_CLR +#endif +#define FD_CLR(fd, set) do { \ + u_int __i; \ + for (__i = 0; __i < ((fd_set*)(set))->fd_count ; __i++) { \ + if (((fd_set*)(set))->fd_array[__i] == fd) { \ + while (__i < ((fd_set*)(set))->fd_count-1) { \ + ((fd_set*)(set))->fd_array[__i] = \ + ((fd_set*)(set))->fd_array[__i+1]; \ + __i++; \ + } \ + ((fd_set*)(set))->fd_count--; \ + break; \ + } \ + } \ +} while(0) + +#ifdef FD_SET +#undef FD_SET +#endif +#define FD_SET(fd, set) do { \ + if (((fd_set*)(set))->fd_count < FD_SETSIZE) \ + ((fd_set*)(set))->fd_array[((fd_set*)(set))->fd_count++]=(fd);\ +} while(0) + +#ifdef FD_ZERO +#undef FD_ZERO +#endif +#define FD_ZERO(set) (((fd_set*)(set))->fd_count=0) + +#ifdef FD_ISSET +#undef FD_ISSET +#endif +#define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set*)(set)) + +/* + time structures + */ +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* microseconds */ +}; +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +/* + Operations on timevals. + + NB: timercmp does not work for >= or <=. + */ +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) \ + || (tvp)->tv_sec cmp (uvp)->tv_sec) +#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) + +/* + ioctl command encoding. + Some of this is different than what Linux has + */ +#define IOCPARM_MASK 0x7f +#define IOC_VOID 0x20000000 +#define IOC_OUT 0x40000000 +#define IOC_IN 0x80000000 +#define IOC_INOUT (IOC_IN | IOC_OUT) + +/* _IO(magic, subcode) */ +#define _IO(c,d) (IOC_VOID | ((c)<<8) | (d)) +/* _IOXX(magic, subcode, arg_t) */ +#define _IOW(c,d,t) (IOC_IN | (((long)sizeof(t) & IOCPARM_MASK)<<16) | \ + ((c)<<8) | (d)) +#define _IOR(c,d,t) (IOC_OUT | (((long)sizeof(t) & IOCPARM_MASK)<<16) | \ + ((c)<<8) | (d)) + +/* + This stuff is hard-coded on Linux + But winsock.h uses the macros defined above + */ +#define FIONREAD _IOR('f', 127, u_long) +#define FIONBIO _IOW('f', 126, u_long) +#define FIOASYNC _IOW('f', 125, u_long) + +#define SIOCSHIWAT _IOW('s', 0, u_long) +#define SIOCGHIWAT _IOR('s', 1, u_long) +#define SIOCSLOWAT _IOW('s', 2, u_long) +#define SIOCGLOWAT _IOR('s', 3, u_long) +#define SIOCATMARK _IOR('s', 7, u_long) + +/* + Structures returned by network data base library, taken from the + BSD file netdb.h. All addresses are supplied in host order, and + returned in network order (suitable for use in system calls). + + Slight modifications for differences between Linux and winsock.h + */ + +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + short h_addrtype; /* host address type */ + short h_length; /* length of address */ + char **h_addr_list; /* list of addresses */ +#define h_addr h_addr_list[0] /* address, for backward compat */ +}; + +/* + * Assumption here is that a network number + * fits in an unsigned long -- someday that won't be true! + */ +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + short n_addrtype; /* net address type */ + u_long n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + short s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + short p_proto; /* protocol # */ +}; + +/* + Standard well-known IP protocols. + For some reason there are differences between Linx and winsock.h + */ +enum { + IPPROTO_IP = 0, + IPPROTO_ICMP = 1, + IPPROTO_GGP = 2, /* huh? */ + IPPROTO_IPIP = 4, + IPPROTO_TCP = 6, /* Transmission Control Protocol */ + IPPROTO_EGP = 8, + IPPROTO_PUP = 12, + IPPROTO_UDP = 17, /* User Datagram Protocol */ + IPPROTO_IDP = 22, + IPPROTO_ND = 77, /* This one was in winsock.h */ + + IPPROTO_RAW = 255, /* raw IP packets */ + IPPROTO_MAX +}; + +/* Standard well-known ports */ +enum { + IPPORT_ECHO = 7, + IPPORT_DISCARD = 9, + IPPORT_SYSTAT = 11, + IPPORT_DAYTIME = 13, + IPPORT_NETSTAT = 15, + IPPORT_FTP = 21, + IPPORT_TELNET = 23, + IPPORT_SMTP = 25, + IPPORT_TIMESERVER = 37, + IPPORT_NAMESERVER = 42, + IPPORT_WHOIS = 43, + IPPORT_MTP = 57, + + IPPORT_TFTP = 69, + IPPORT_RJE = 77, + IPPORT_FINGER = 79, + IPPORT_TTYLINK = 87, + IPPORT_SUPDUP = 95, + + IPPORT_EXECSERVER = 512, + IPPORT_LOGINSERVER = 513, + IPPORT_CMDSERVER = 514, + IPPORT_EFSSERVER = 520, + + /* UDP ports. */ + IPPORT_BIFFUDP = 512, + IPPORT_WHOSERVER = 513, + IPPORT_ROUTESERVER = 520, + + /* Ports less than this value are reservered for privileged processes. */ + IPPORT_RESERVED = 1024, + + /* Ports greater than this value are reserved for + (non-privileged) processes */ + IPPORT_USERRESERVED = 5000 +}; + +/* Link numbers. */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + +/* Linux uses a simple unsigned long int, but winsock.h ... */ +struct in_addr { + union { + struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { u_short s_w1,s_w2; } S_un_w; + u_long S_addr; + } S_un; +#define s_addr S_un.S_addr +#define s_host S_un.S_un_b.s_b2 +#define s_net S_un.S_un_b.s_b1 +#define s_imp S_un.S_un_w.s_w2 +#define s_impno S_un.S_un_b.s_b4 +#define s_lh S_un.S_un_b.s_b3 +}; + +/* + Definitions of bits in internet address integers. + On subnets, host and network parts are found according + to the subnet mask, not these masks. + */ +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define INADDR_ANY (u_long)0x00000000 +#define INADDR_LOOPBACK 0x7f000001 +#define INADDR_BROADCAST (u_long)0xffffffff +#define INADDR_NONE 0xffffffff + +/* + Structure describing an Internet (IP) socket address. + */ +struct sockaddr_in { + short sin_family; + u_short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* + EVERYTHING FROM THIS POINT IS MAINLY SPECIFIC TO Win32 + + Structure which holds the detail for the underlying Window Sockets + implementation. Set when WSAStartup() is called. + */ +#define WSADESCRIPTION_LEN 256 +#define WSASYS_STATUS_LEN 128 + +typedef struct WSAData { + WORD wVersion; + WORD wHighVersion; + char szDescription[WSADESCRIPTION_LEN+1]; + char szSystemStatus[WSASYS_STATUS_LEN+1]; + unsigned short iMaxSockets; + unsigned short iMaxUdpDg; + char *lpVendorInfo; +} WSADATA, *LPWSADATA; + +#define IP_OPTIONS 1 +#define IP_MULTICAST_IF 2 +#define IP_MULTICAST_TTL 3 +#define IP_MULTICAST_LOOP 4 +#define IP_ADD_MEMBERSHIP 5 +#define IP_DROP_MEMBERSHIP 6 + +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +struct ip_mreq { + struct in_addr imr_multiaddr; + struct in_addr imr_interface; +}; + +/* + * Definitions related to sockets: types, address families, options, + * taken from the BSD file sys/socket.h. + */ + +/* + * This is used instead of -1, since the + * SOCKET type is unsigned. + */ +#define INVALID_SOCKET (SOCKET)(~0) +#define SOCKET_ERROR (-1) + +/* Socket types. */ +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 + +/* For setsockoptions(2) */ +#define SO_DEBUG 0x0001 +#define SO_ACCEPTCONN 0x0002 +#define SO_REUSEADDR 0x0004 +#define SO_KEEPALIVE 0x0008 +#define SO_DONTROUTE 0x0010 +#define SO_BROADCAST 0x0020 +#define SO_USELOOPBACK 0x0040 +#define SO_LINGER 0x0080 +#define SO_OOBINLINE 0x0100 + +#define SO_DONTLINGER (u_int)(~SO_LINGER) + +/* + * Additional options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +/* + * Options for connect and disconnect data and options. Used only by + * non-TCP/IP transports such as DECNet, OSI TP4, etc. + */ +#define SO_CONNDATA 0x7000 +#define SO_CONNOPT 0x7001 +#define SO_DISCDATA 0x7002 +#define SO_DISCOPT 0x7003 +#define SO_CONNDATALEN 0x7004 +#define SO_CONNOPTLEN 0x7005 +#define SO_DISCDATALEN 0x7006 +#define SO_DISCOPTLEN 0x7007 + +/* + * Option for opening sockets for synchronous access. + */ +#define SO_OPENTYPE 0x7008 + +#define SO_SYNCHRONOUS_ALERT 0x10 +#define SO_SYNCHRONOUS_NONALERT 0x20 + +/* + * Other NT-specific options. + */ +#define SO_MAXDG 0x7009 +#define SO_MAXPATHDG 0x700A + +/* + * TCP options. + */ +#define TCP_NODELAY 0x0001 +#define TCP_BSDURGENT 0x7000 + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_IPX 6 /* IPX and SPX */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO /* OSI is ISO */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* AppleTalk */ +#define AF_NETBIOS 17 /* NetBios-style addresses */ + +#define AF_MAX 18 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_short sa_family; + char sa_data[14]; +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; + u_short sp_protocol; +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_IPX AF_IPX +#define PF_ISO AF_ISO +#define PF_OSI AF_OSI +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK + +#define PF_MAX AF_MAX + +/* + * Structure used for manipulating linger option. + */ +struct linger { + u_short l_onoff; + u_short l_linger; +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#define MSG_MAXIOVLEN 16 + +#define MSG_PARTIAL 0x8000 /* partial send or recv for message xport */ + +/* + * Define constant based on rfc883, used by gethostbyxxxx() calls. + */ +#define MAXGETHOSTSTRUCT 1024 +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN MAXGETHOSTSTRUCT +#endif + +/* + * Define flags to be used with the WSAAsyncSelect() call. + */ +#define FD_READ 0x01 +#define FD_WRITE 0x02 +#define FD_OOB 0x04 +#define FD_ACCEPT 0x08 +#define FD_CONNECT 0x10 +#define FD_CLOSE 0x20 + +/* + * All Windows Sockets error constants are biased by WSABASEERR from + * the "normal" + */ +#define WSABASEERR 10000 +/* + * Windows Sockets definitions of regular Microsoft C error constants + */ +#define WSAEINTR (WSABASEERR+4) +#define WSAEBADF (WSABASEERR+9) +#define WSAEACCES (WSABASEERR+13) +#define WSAEFAULT (WSABASEERR+14) +#define WSAEINVAL (WSABASEERR+22) +#define WSAEMFILE (WSABASEERR+24) + +/* + * Windows Sockets definitions of regular Berkeley error constants + */ +#define WSAEWOULDBLOCK (WSABASEERR+35) +#define WSAEINPROGRESS (WSABASEERR+36) +#define WSAEALREADY (WSABASEERR+37) +#define WSAENOTSOCK (WSABASEERR+38) +#define WSAEDESTADDRREQ (WSABASEERR+39) +#define WSAEMSGSIZE (WSABASEERR+40) +#define WSAEPROTOTYPE (WSABASEERR+41) +#define WSAENOPROTOOPT (WSABASEERR+42) +#define WSAEPROTONOSUPPORT (WSABASEERR+43) +#define WSAESOCKTNOSUPPORT (WSABASEERR+44) +#define WSAEOPNOTSUPP (WSABASEERR+45) +#define WSAEPFNOSUPPORT (WSABASEERR+46) +#define WSAEAFNOSUPPORT (WSABASEERR+47) +#define WSAEADDRINUSE (WSABASEERR+48) +#define WSAEADDRNOTAVAIL (WSABASEERR+49) +#define WSAENETDOWN (WSABASEERR+50) +#define WSAENETUNREACH (WSABASEERR+51) +#define WSAENETRESET (WSABASEERR+52) +#define WSAECONNABORTED (WSABASEERR+53) +#define WSAECONNRESET (WSABASEERR+54) +#define WSAENOBUFS (WSABASEERR+55) +#define WSAEISCONN (WSABASEERR+56) +#define WSAENOTCONN (WSABASEERR+57) +#define WSAESHUTDOWN (WSABASEERR+58) +#define WSAETOOMANYREFS (WSABASEERR+59) +#define WSAETIMEDOUT (WSABASEERR+60) +#define WSAECONNREFUSED (WSABASEERR+61) +#define WSAELOOP (WSABASEERR+62) +#define WSAENAMETOOLONG (WSABASEERR+63) +#define WSAEHOSTDOWN (WSABASEERR+64) +#define WSAEHOSTUNREACH (WSABASEERR+65) +#define WSAENOTEMPTY (WSABASEERR+66) +#define WSAEPROCLIM (WSABASEERR+67) +#define WSAEUSERS (WSABASEERR+68) +#define WSAEDQUOT (WSABASEERR+69) +#define WSAESTALE (WSABASEERR+70) +#define WSAEREMOTE (WSABASEERR+71) + +#define WSAEDISCON (WSABASEERR+101) + +/* + * Extended Windows Sockets error constant definitions + */ +#define WSASYSNOTREADY (WSABASEERR+91) +#define WSAVERNOTSUPPORTED (WSABASEERR+92) +#define WSANOTINITIALISED (WSABASEERR+93) + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (when using the resolver). Note that these errors are + * retrieved via WSAGetLastError() and must therefore follow + * the rules for avoiding clashes with error numbers from + * specific implementations or language run-time systems. + * For this reason the codes are based at WSABASEERR+1001. + * Note also that [WSA]NO_ADDRESS is defined only for + * compatibility purposes. + */ + +#define h_errno WSAGetLastError() + +/* Authoritative Answer: Host not found */ +#define WSAHOST_NOT_FOUND (WSABASEERR+1001) +#define HOST_NOT_FOUND WSAHOST_NOT_FOUND + +/* Non-Authoritative: Host not found, or SERVERFAIL */ +#define WSATRY_AGAIN (WSABASEERR+1002) +#define TRY_AGAIN WSATRY_AGAIN + +/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define WSANO_RECOVERY (WSABASEERR+1003) +#define NO_RECOVERY WSANO_RECOVERY + +/* Valid name, no data record of requested type */ +#define WSANO_DATA (WSABASEERR+1004) +#define NO_DATA WSANO_DATA + +/* no address, look for MX record */ +#define WSANO_ADDRESS WSANO_DATA +#define NO_ADDRESS WSANO_ADDRESS + +/* + * Windows Sockets errors redefined as regular Berkeley error constants. + * These are commented out in Windows NT to avoid conflicts with errno.h. + * Use the WSA constants instead. + */ +#if 0 +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EINPROGRESS WSAEINPROGRESS +#define EALREADY WSAEALREADY +#define ENOTSOCK WSAENOTSOCK +#define EDESTADDRREQ WSAEDESTADDRREQ +#define EMSGSIZE WSAEMSGSIZE +#define EPROTOTYPE WSAEPROTOTYPE +#define ENOPROTOOPT WSAENOPROTOOPT +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#define EOPNOTSUPP WSAEOPNOTSUPP +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#define EADDRINUSE WSAEADDRINUSE +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#define ENETDOWN WSAENETDOWN +#define ENETUNREACH WSAENETUNREACH +#define ENETRESET WSAENETRESET +#define ECONNABORTED WSAECONNABORTED +#define ECONNRESET WSAECONNRESET +#define ENOBUFS WSAENOBUFS +#define EISCONN WSAEISCONN +#define ENOTCONN WSAENOTCONN +#define ESHUTDOWN WSAESHUTDOWN +#define ETOOMANYREFS WSAETOOMANYREFS +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define ELOOP WSAELOOP +#define ENAMETOOLONG WSAENAMETOOLONG +#define EHOSTDOWN WSAEHOSTDOWN +#define EHOSTUNREACH WSAEHOSTUNREACH +#define ENOTEMPTY WSAENOTEMPTY +#define EPROCLIM WSAEPROCLIM +#define EUSERS WSAEUSERS +#define EDQUOT WSAEDQUOT +#define ESTALE WSAESTALE +#define EREMOTE WSAEREMOTE +#endif + +/* Socket function prototypes */ + +SOCKET PASCAL accept (SOCKET s, struct sockaddr *addr, + int *addrlen); + +int PASCAL bind (SOCKET s, const struct sockaddr *addr, int namelen); + +int PASCAL closesocket (SOCKET s); + +int PASCAL connect (SOCKET s, const struct sockaddr *name, int namelen); + +int PASCAL ioctlsocket (SOCKET s, long cmd, u_long *argp); + +int PASCAL getpeername (SOCKET s, struct sockaddr *name, + int * namelen); + +int PASCAL getsockname (SOCKET s, struct sockaddr *name, + int * namelen); + +int PASCAL getsockopt (SOCKET s, int level, int optname, + char * optval, int *optlen); + +u_long PASCAL htonl (u_long hostlong); + +/* For some reason WSOCK.LIB has htons defined as a 4 byte paramter?! */ +#ifdef _WIN32 +u_short PASCAL htons (u_long hostshort); +#else +u_short PASCAL htons (u_short hostshort); +#endif /* _WIN32 */ + +unsigned long PASCAL inet_addr (const char * cp); + +char * PASCAL inet_ntoa (struct in_addr in); + +int PASCAL listen (SOCKET s, int backlog); + +u_long PASCAL ntohl (u_long netlong); + +/* For some reason WSOCK.LIB has ntohs defined as a 4 byte paramter?! */ +#ifdef _WIN32 +u_short PASCAL ntohs (u_long netshort); +#else +u_short PASCAL ntohs (u_short netshort); +#endif /* _WIN32 */ + +int PASCAL recv (SOCKET s, char * buf, int len, int flags); + +int PASCAL recvfrom (SOCKET s, char * buf, int len, int flags, + struct sockaddr *from, int * fromlen); + +int PASCAL select (int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, const struct timeval *timeout); + +int PASCAL send (SOCKET s, const char * buf, int len, int flags); + +int PASCAL sendto (SOCKET s, const char * buf, int len, int flags, + const struct sockaddr *to, int tolen); + +int PASCAL setsockopt (SOCKET s, int level, int optname, + const char * optval, int optlen); + +int PASCAL shutdown (SOCKET s, int how); + +SOCKET PASCAL socket (int af, int type, int protocol); + +/* Database function prototypes */ + +struct hostent * PASCAL gethostbyaddr(const char * addr, + int len, int type); + +struct hostent * PASCAL gethostbyname(const char * name); + +int PASCAL gethostname (char * name, int namelen); + +struct servent * PASCAL getservbyport(int port, const char * proto); + +struct servent * PASCAL getservbyname(const char * name, + const char * proto); + +struct protoent * PASCAL getprotobynumber(int proto); + +struct protoent * PASCAL getprotobyname(const char * name); + +/* Microsoft Windows Extension function prototypes */ + +/* int PASCAL WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData); */ +int PASCAL WSAStartup(int wVersionRequired, LPWSADATA lpWSAData); + + +int PASCAL WSACleanup(void); + +void PASCAL WSASetLastError(int iError); + +int PASCAL WSAGetLastError(void); + +WINBOOL PASCAL WSAIsBlocking(void); + +int PASCAL WSAUnhookBlockingHook(void); + +FARPROC PASCAL WSASetBlockingHook(FARPROC lpBlockFunc); + +int PASCAL WSACancelBlockingCall(void); + +HANDLE PASCAL WSAAsyncGetServByName(HWND hWnd, u_int wMsg, + const char * name, + const char * proto, + char * buf, int buflen); + +HANDLE PASCAL WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, int port, + const char * proto, char * buf, + int buflen); + +HANDLE PASCAL WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg, + const char * name, char * buf, + int buflen); + +HANDLE PASCAL WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg, + int number, char * buf, + int buflen); + +HANDLE PASCAL WSAAsyncGetHostByName(HWND hWnd, u_int wMsg, + const char * name, char * buf, + int buflen); + +HANDLE PASCAL WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, + const char * addr, int len, int type, + char * buf, int buflen); + +int PASCAL WSACancelAsyncRequest(HANDLE hAsyncTaskHandle); + +int PASCAL WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, + long lEvent); + +int PASCAL WSARecvEx (SOCKET s, char * buf, int len, int *flags); + +/* Microsoft Windows Extended data types */ +typedef struct sockaddr SOCKADDR; +typedef struct sockaddr *PSOCKADDR; +typedef struct sockaddr *LPSOCKADDR; + +typedef struct sockaddr_in SOCKADDR_IN; +typedef struct sockaddr_in *PSOCKADDR_IN; +typedef struct sockaddr_in *LPSOCKADDR_IN; + +typedef struct linger LINGER; +typedef struct linger *PLINGER; +typedef struct linger *LPLINGER; + +typedef struct in_addr IN_ADDR; +typedef struct in_addr *PIN_ADDR; +typedef struct in_addr *LPIN_ADDR; + +typedef struct fd_set FD_SET; +typedef struct fd_set *PFD_SET; +typedef struct fd_set *LPFD_SET; + +typedef struct hostent HOSTENT; +typedef struct hostent *PHOSTENT; +typedef struct hostent *LPHOSTENT; + +typedef struct servent SERVENT; +typedef struct servent *PSERVENT; +typedef struct servent *LPSERVENT; + +typedef struct protoent PROTOENT; +typedef struct protoent *PPROTOENT; +typedef struct protoent *LPPROTOENT; + +typedef struct timeval TIMEVAL; +typedef struct timeval *PTIMEVAL; +typedef struct timeval *LPTIMEVAL; + +/* + * Windows message parameter composition and decomposition + * macros. + * + * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation + * when constructing the response to a WSAAsyncGetXByY() routine. + */ +#define WSAMAKEASYNCREPLY(buflen,error) MAKELONG(buflen,error) +/* + * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation + * when constructing the response to WSAAsyncSelect(). + */ +#define WSAMAKESELECTREPLY(event,error) MAKELONG(event,error) +/* + * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application + * to extract the buffer length from the lParam in the response + * to a WSAGetXByY(). + */ +#define WSAGETASYNCBUFLEN(lParam) LOWORD(lParam) +/* + * WSAGETASYNCERROR is intended for use by the Windows Sockets application + * to extract the error code from the lParam in the response + * to a WSAGetXByY(). + */ +#define WSAGETASYNCERROR(lParam) HIWORD(lParam) +/* + * WSAGETSELECTEVENT is intended for use by the Windows Sockets application + * to extract the event code from the lParam in the response + * to a WSAAsyncSelect(). + */ +#define WSAGETSELECTEVENT(lParam) LOWORD(lParam) +/* + * WSAGETSELECTERROR is intended for use by the Windows Sockets application + * to extract the error code from the lParam in the response + * to a WSAAsyncSelect(). + */ +#define WSAGETSELECTERROR(lParam) HIWORD(lParam) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_SOCKETS */ diff --git a/reactos/include/string.h b/reactos/include/string.h new file mode 100644 index 00000000000..3ed9470c43a --- /dev/null +++ b/reactos/include/string.h @@ -0,0 +1,778 @@ +/* + * Adapted from linux for the reactos kernel, march 1998 -- David Welch + * Removed extern specifier from ___strtok and ___wcstok, june 1998 -- Boudewijn Dekker + * Added stricmp and strnicmp -- Boudewijn Dekker + */ + + + + +#ifndef _LINUX_STRING_H_ +#define _LINUX_STRING_H_ + +#include /* for size_t */ + + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +char * ___strtok; // removed extern specifier 02-06-98, BD + +extern char * strcpy(char *,const char *); +extern char * strncpy(char *,const char *, __kernel_size_t); +extern char * strcat(char *, const char *); +extern char * strncat(char *, const char *, __kernel_size_t); +extern char * strchr(const char *,int); +extern char * strrchr(const char *,int); +extern char * strpbrk(const char *,const char *); +extern char * strtok(char *,const char *); +extern char * strstr(const char *,const char *); +extern __kernel_size_t strlen(const char *); +extern __kernel_size_t strnlen(const char *,__kernel_size_t); +extern __kernel_size_t strspn(const char *,const char *); +extern int strcmp(const char *,const char *); +extern int strncmp(const char *,const char *,__kernel_size_t); +extern int stricmp(const char* cs,const char * ct) +extern int strnicmp(const char* cs,const char * ct, size_t count); + +extern void * memset(void *,int,__kernel_size_t); +extern void * memcpy(void *,const void *,__kernel_size_t); +extern void * memmove(void *,const void *,__kernel_size_t); +extern void * memscan(void *,int,__kernel_size_t); +extern int memcmp(const void *,const void *,__kernel_size_t); + + +/* + * Include machine specific inline routines + */ +#ifndef _I386_STRING_H_ +#define _I386_STRING_H_ + +/* + * On a 486 or Pentium, we are better off not using the + * byte string operations. But on a 386 or a PPro the + * byte string ops are faster than doing it by hand + * (MUCH faster on a Pentium). + * + * Also, the byte strings actually work correctly. Forget + * the i486 routines for now as they may be broken.. + */ +#if FIXED_486_STRING && (CPU == 486 || CPU == 586) + #include +#else + +/* + * This string-include defines all string functions as inline + * functions. Use gcc. It also assumes ds=es=data space, this should be + * normal. Most of the string-functions are rather heavily hand-optimized, + * see especially strtok,strstr,str[c]spn. They should work, but are not + * very easy to understand. Everything is done entirely within the register + * set, making the functions fast and clean. String instructions have been + * used through-out, making for "slightly" unclear code :-) + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#define __HAVE_ARCH_STRCPY +extern inline char * strcpy(char * dest,const char *src) +{ +__asm__ __volatile__( + "cld\n" + "1:\tlodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest):"si","di","ax","memory"); +return dest; +} + +#define __HAVE_ARCH_STRNCPY +extern inline char * strncpy(char * dest,const char *src,size_t count) +{ +__asm__ __volatile__( + "cld\n" + "1:\tdecl %2\n\t" + "js 2f\n\t" + "lodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "rep\n\t" + "stosb\n" + "2:" + : /* no output */ + :"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory"); +return dest; +} + +#define __HAVE_ARCH_STRCAT +extern inline char * strcat(char * dest,const char * src) +{ +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "decl %1\n" + "1:\tlodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx"); +return dest; +} + +#define __HAVE_ARCH_STRNCAT +extern inline char * strncat(char * dest,const char * src,size_t count) +{ +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "decl %1\n\t" + "movl %4,%3\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsb\n\t" + "stosb\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n" + "2:\txorl %2,%2\n\t" + "stosb" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count) + :"si","di","ax","cx","memory"); +return dest; +} + +#define __HAVE_ARCH_STRCMP +extern inline int strcmp(const char * cs,const char * ct) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tlodsb\n\t" + "scasb\n\t" + "jne 2f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 3f\n" + "2:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "3:" + :"=a" (__res):"S" (cs),"D" (ct):"si","di"); +return __res; +} + +#define __HAVE_ARCH_STRNCMP +extern inline int strncmp(const char * cs,const char * ct,size_t count) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsb\n\t" + "scasb\n\t" + "jne 3f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n" + "2:\txorl %%eax,%%eax\n\t" + "jmp 4f\n" + "3:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%al\n" + "4:" + :"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx"); +return __res; +} + +#define __HAVE_ARCH_STRCHR +extern inline char * strchr(const char * s, int c) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "je 2f\n\t" + "testb %%al,%%al\n\t" + "jne 1b\n\t" + "movl $1,%1\n" + "2:\tmovl %1,%0\n\t" + "decl %0" + :"=a" (__res):"S" (s),"0" (c):"si"); +return __res; +} + +#define __HAVE_ARCH_STRRCHR +extern inline char * strrchr(const char * s, int c) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movb %%al,%%ah\n" + "1:\tlodsb\n\t" + "cmpb %%ah,%%al\n\t" + "jne 2f\n\t" + "leal -1(%%esi),%0\n" + "2:\ttestb %%al,%%al\n\t" + "jne 1b" + :"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si"); +return __res; +} + +#define __HAVE_ARCH_STRSPN +extern inline size_t strspn(const char * cs, const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res-cs; +} + +#define __HAVE_ARCH_STRCSPN +extern inline size_t strcspn(const char * cs, const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res-cs; +} + +#define __HAVE_ARCH_STRPBRK +extern inline char * strpbrk(const char * cs,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 1b\n\t" + "decl %0\n\t" + "jmp 3f\n" + "2:\txorl %0,%0\n" + "3:" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"ax","cx","dx","di"); +return __res; +} + +#define __HAVE_ARCH_STRSTR +extern inline char * strstr(const char * cs,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "cld\n\t" \ + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ + "movl %%ecx,%%edx\n" + "1:\tmovl %4,%%edi\n\t" + "movl %%esi,%%eax\n\t" + "movl %%edx,%%ecx\n\t" + "repe\n\t" + "cmpsb\n\t" + "je 2f\n\t" /* also works for empty string, see above */ + "xchgl %%eax,%%esi\n\t" + "incl %%esi\n\t" + "cmpb $0,-1(%%eax)\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "2:" + :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct) + :"cx","dx","di","si"); +return __res; +} + +#define __HAVE_ARCH_STRLEN +extern inline size_t strlen(const char * s) +{ +register int __res; +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasb\n\t" + "notl %0\n\t" + "decl %0" + :"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di"); +return __res; +} + +#define __HAVE_ARCH_STRTOK +extern inline char * strtok(char * s,const char * ct) +{ +register char * __res; +__asm__ __volatile__( + "testl %1,%1\n\t" + "jne 1f\n\t" + "testl %0,%0\n\t" + "je 8f\n\t" + "movl %0,%1\n" + "1:\txorl %0,%0\n\t" + "movl $-1,%%ecx\n\t" + "xorl %%eax,%%eax\n\t" + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasb\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "je 7f\n\t" /* empty delimiter-string */ + "movl %%ecx,%%edx\n" + "2:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 7f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 2b\n\t" + "decl %1\n\t" + "cmpb $0,(%1)\n\t" + "je 7f\n\t" + "movl %1,%0\n" + "3:\tlodsb\n\t" + "testb %%al,%%al\n\t" + "je 5f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "jne 3b\n\t" + "decl %1\n\t" + "cmpb $0,(%1)\n\t" + "je 5f\n\t" + "movb $0,(%1)\n\t" + "incl %1\n\t" + "jmp 6f\n" + "5:\txorl %1,%1\n" + "6:\tcmpb $0,(%0)\n\t" + "jne 7f\n\t" + "xorl %0,%0\n" + "7:\ttestl %0,%0\n\t" + "jne 8f\n\t" + "movl %0,%1\n" + "8:" + :"=b" (__res),"=S" (___strtok) + :"0" (___strtok),"1" (s),"g" (ct) + :"ax","cx","dx","di","memory"); +return __res; +} + + +#define __HAVE_ARCH_STRICMP +extern inline int stricmp(const char* cs,const char * ct) +{ +register int __res; + + +__asm__ __volatile__( + "cld\n" + "1:\tmovb (%%esi), %%eax\n\t" + "movb (%%edi), %%dl \n\t" + "cmpb $0x5A, %%al\n\t" + "ja 2f\t\n" + "cmpb $0x40, %%al\t\n" + "jbe 2f\t\n" + "addb $0x20, %%al\t\n" + "2:\t cmpb $0x5A, %%dl\t\n" + "ja 3f\t\n" + "cmpb $0x40, %%dl\t\n" + "jbe 3f\t\n" + "addb $0x20, %%dl\t\n" + "3:\t inc %%esi\t\n" + "inc %%edi\t\n" + "cmpb %%al, %%dl\t\n" + "jne 4f\n\t" + "cmpb $00, %%al\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 5f\n" + "4:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "5:" + :"=a" (__res):"S" (cs),"D" (ct):"si","di"); + +return __res; +} + + +#define __HAVE_ARCH_STRNICMP +extern inline int strnicmp(const char* cs,const char * ct, size_t count) +{ +register int __res; + + +__asm__ __volatile__( + "cld\n" + "1:\t decl %3\n\t" + "js 6f\n\t" + "movb (%%esi), %%al\n\t" + "movb (%%edi), %%dl \n\t" + "cmpb $0x5A, %%al\n\t" + "ja 2f\t\n" + "cmpb $0x40, %%al\t\n" + "jbe 2f\t\n" + "addb $0x20, %%al\t\n" + "2:\t cmpb $0x5A, %%dl\t\n" + "ja 3f\t\n" + "cmpb $0x40, %%dl\t\n" + "jbe 3f\t\n" + "addb $0x20, %%dl\t\n" + "3:\t inc %%esi\t\n" + "inc %%edi\t\n" + "cmpb %%al, %%dl\t\n" + "jne 4f\n\t" + "cmpb $00, %%al\n\t" + "jne 1b\n\t" + "6:xorl %%eax,%%eax\n\t" + "jmp 5f\n" + "4:\tsbbl %%eax,%%eax\n\t" + "orb $1,%%eax\n" + "5:" + :"=a" (__res):"S" (cs),"D" (ct), "c" (count):"si","di", "cx"); + + +return __res; +} + + + + + + +extern inline void * __memcpy(void * to, const void * from, size_t n) +{ +__asm__ __volatile__( + "cld\n\t" + "rep ; movsl\n\t" + "testb $2,%b1\n\t" + "je 1f\n\t" + "movsw\n" + "1:\ttestb $1,%b1\n\t" + "je 2f\n\t" + "movsb\n" + "2:" + : /* no output */ + :"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from) + : "cx","di","si","memory"); +return (to); +} + +/* + * This looks horribly ugly, but the compiler can optimize it totally, + * as the count is constant. + */ +extern inline void * __constant_memcpy(void * to, const void * from, size_t n) +{ + switch (n) { + case 0: + return to; + case 1: + *(unsigned char *)to = *(const unsigned char *)from; + return to; + case 2: + *(unsigned short *)to = *(const unsigned short *)from; + return to; + case 3: + *(unsigned short *)to = *(const unsigned short *)from; + *(2+(unsigned char *)to) = *(2+(const unsigned char *)from); + return to; + case 4: + *(unsigned long *)to = *(const unsigned long *)from; + return to; + case 8: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + return to; + case 12: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + return to; + case 16: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + *(3+(unsigned long *)to) = *(3+(const unsigned long *)from); + return to; + case 20: + *(unsigned long *)to = *(const unsigned long *)from; + *(1+(unsigned long *)to) = *(1+(const unsigned long *)from); + *(2+(unsigned long *)to) = *(2+(const unsigned long *)from); + *(3+(unsigned long *)to) = *(3+(const unsigned long *)from); + *(4+(unsigned long *)to) = *(4+(const unsigned long *)from); + return to; + } +#define COMMON(x) \ +__asm__("cld\n\t" \ + "rep ; movsl" \ + x \ + : /* no outputs */ \ + : "c" (n/4),"D" ((long) to),"S" ((long) from) \ + : "cx","di","si","memory"); + + switch (n % 4) { + case 0: COMMON(""); return to; + case 1: COMMON("\n\tmovsb"); return to; + case 2: COMMON("\n\tmovsw"); return to; + case 3: COMMON("\n\tmovsw\n\tmovsb"); return to; + } +#undef COMMON +} + +#define __HAVE_ARCH_MEMCPY +#define memcpy(t, f, n) \ +(__builtin_constant_p(n) ? \ + __constant_memcpy((t),(f),(n)) : \ + __memcpy((t),(f),(n))) + +#define __HAVE_ARCH_MEMMOVE +extern inline void * memmove(void * dest,const void * src, size_t n) +{ +if (dest + Date: 1996 + + This file is part of the Windows32 API Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley 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_STRUCTURES +#define _GNU_H_WINDOWS32_STRUCTURES + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct _ABC { + int abcA; + UINT abcB; + int abcC; +} ABC, *LPABC; + +typedef struct _ABCFLOAT { + FLOAT abcfA; + FLOAT abcfB; + FLOAT abcfC; +} ABCFLOAT, *LPABCFLOAT; + +typedef struct tagACCEL { + BYTE fVirt; + WORD key; + WORD cmd; +} ACCEL, *LPACCEL; + +typedef struct _ACE_HEADER { + BYTE AceType; + BYTE AceFlags; + WORD AceSize; +} ACE_HEADER; + +typedef DWORD ACCESS_MASK; +typedef ACCESS_MASK REGSAM; + +typedef struct _ACCESS_ALLOWED_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; +} ACCESS_ALLOWED_ACE; + +typedef struct _ACCESS_DENIED_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; +} ACCESS_DENIED_ACE; + +typedef struct tagACCESSTIMEOUT { + UINT cbSize; + DWORD dwFlags; + DWORD iTimeOutMSec; +} ACCESSTIMEOUT; + +typedef struct _ACL { + BYTE AclRevision; + BYTE Sbz1; + WORD AclSize; + WORD AceCount; + WORD Sbz2; +} ACL, *PACL; + +typedef struct _ACL_REVISION_INFORMATION { + DWORD AclRevision; +} ACL_REVISION_INFORMATION; + +typedef struct _ACL_SIZE_INFORMATION { + DWORD AceCount; + DWORD AclBytesInUse; + DWORD AclBytesFree; +} ACL_SIZE_INFORMATION; + +typedef struct _ACTION_HEADER { + ULONG transport_id; + USHORT action_code; + USHORT reserved; +} ACTION_HEADER; + +typedef struct _ADAPTER_STATUS { + UCHAR adapter_address[6]; + UCHAR rev_major; + UCHAR reserved0; + UCHAR adapter_type; + UCHAR rev_minor; + WORD duration; + WORD frmr_recv; + WORD frmr_xmit; + WORD iframe_recv_err; + WORD xmit_aborts; + DWORD xmit_success; + DWORD recv_success; + WORD iframe_xmit_err; + WORD recv_buff_unavail; + WORD t1_timeouts; + WORD ti_timeouts; + DWORD reserved1; + WORD free_ncbs; + WORD max_cfg_ncbs; + WORD max_ncbs; + WORD xmit_buf_unavail; + WORD max_dgram_size; + WORD pending_sess; + WORD max_cfg_sess; + WORD max_sess; + WORD max_sess_pkt_size; + WORD name_count; +} ADAPTER_STATUS; + +typedef struct _ADDJOB_INFO_1 { + LPTSTR Path; + DWORD JobId; +} ADDJOB_INFO_1; + +typedef struct tagANIMATIONINFO { + UINT cbSize; + int iMinAnimate; +} ANIMATIONINFO, *LPANIMATIONINFO; + +typedef struct _RECT { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT, *LPRECT, *PRECT; + +typedef struct _RECTL { + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECTL; + +typedef struct _AppBarData { + DWORD cbSize; + HWND hWnd; + UINT uCallbackMessage; + UINT uEdge; + RECT rc; + LPARAM lParam; +} APPBARDATA, *PAPPBARDATA; + +typedef struct tagBITMAP +{ + LONG bmType; + LONG bmWidth; + LONG bmHeight; + LONG bmWidthBytes; + WORD bmPlanes; + WORD bmBitsPixel; + LPVOID bmBits; +} BITMAP, *PBITMAP, *NPBITMAP, *LPBITMAP; + +typedef struct tagBITMAPCOREHEADER { + DWORD bcSize; + WORD bcWidth; + WORD bcHeight; + WORD bcPlanes; + WORD bcBitCount; +} BITMAPCOREHEADER; + +typedef struct tagRGBTRIPLE { + BYTE rgbtBlue; + BYTE rgbtGreen; + BYTE rgbtRed; +} RGBTRIPLE; + +typedef struct _BITMAPCOREINFO { + BITMAPCOREHEADER bmciHeader; + RGBTRIPLE bmciColors[1]; +} BITMAPCOREINFO, *PBITMAPCOREINFO, *LPBITMAPCOREINFO; + +typedef struct tagBITMAPFILEHEADER { + WORD bfType; + DWORD bfSize; + WORD bfReserved1; + WORD bfReserved2; + DWORD bfOffBits; +} BITMAPFILEHEADER __attribute__((packed)); + +typedef struct tagBITMAPINFOHEADER { + DWORD biSize; + LONG biWidth; + LONG biHeight; + WORD biPlanes; + WORD biBitCount; + DWORD biCompression; + DWORD biSizeImage; + LONG biXPelsPerMeter; + LONG biYPelsPerMeter; + DWORD biClrUsed; + DWORD biClrImportant; +} BITMAPINFOHEADER, *LPBITMAPINFOHEADER, *PBITMAPINFO; + +typedef struct tagRGBQUAD { + BYTE rgbBlue; + BYTE rgbGreen; + BYTE rgbRed; + BYTE rgbReserved; +} RGBQUAD; + +typedef struct tagBITMAPINFO { + BITMAPINFOHEADER bmiHeader; + RGBQUAD bmiColors[1]; +} BITMAPINFO, *LPBITMAPINFO; + +typedef long FXPT2DOT30, * LPFXPT2DOT30; + +typedef struct tagCIEXYZ +{ + FXPT2DOT30 ciexyzX; + FXPT2DOT30 ciexyzY; + FXPT2DOT30 ciexyzZ; +} CIEXYZ; +typedef CIEXYZ * LPCIEXYZ; + +typedef struct tagCIEXYZTRIPLE +{ + CIEXYZ ciexyzRed; + CIEXYZ ciexyzGreen; + CIEXYZ ciexyzBlue; +} CIEXYZTRIPLE; +typedef CIEXYZTRIPLE * LPCIEXYZTRIPLE; + +typedef struct { + DWORD bV4Size; + LONG bV4Width; + LONG bV4Height; + WORD bV4Planes; + WORD bV4BitCount; + DWORD bV4V4Compression; + DWORD bV4SizeImage; + LONG bV4XPelsPerMeter; + LONG bV4YPelsPerMeter; + DWORD bV4ClrUsed; + DWORD bV4ClrImportant; + DWORD bV4RedMask; + DWORD bV4GreenMask; + DWORD bV4BlueMask; + DWORD bV4AlphaMask; + DWORD bV4CSType; + CIEXYZTRIPLE bV4Endpoints; + DWORD bV4GammaRed; + DWORD bV4GammaGreen; + DWORD bV4GammaBlue; +} BITMAPV4HEADER, *LPBITMAPV4HEADER, *PBITMAPV4HEADER; + +typedef struct _BLOB { + ULONG cbSize; + BYTE *pBlobData; +} BLOB; + +typedef struct _SHITEMID { + USHORT cb; + BYTE abID[1]; +} SHITEMID, * LPSHITEMID; +typedef const SHITEMID * LPCSHITEMID; + +typedef struct _ITEMIDLIST { + SHITEMID mkid; +} ITEMIDLIST, * LPITEMIDLIST; +typedef const ITEMIDLIST * LPCITEMIDLIST; + +typedef struct _browseinfo { + HWND hwndOwner; + LPCITEMIDLIST pidlRoot; + LPSTR pszDisplayName; + LPCSTR lpszTitle; + UINT ulFlags; + BFFCALLBACK lpfn; + LPARAM lParam; + int iImage; +} BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO; + +typedef struct _FILETIME { + DWORD dwLowDateTime; + DWORD dwHighDateTime; +} FILETIME, *LPFILETIME, *PFILETIME; + +typedef struct _BY_HANDLE_FILE_INFORMATION { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD dwVolumeSerialNumber; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD nNumberOfLinks; + DWORD nFileIndexHigh; + DWORD nFileIndexLow; +} BY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION; + +typedef struct _FIXED { + WORD fract; + short value; +} FIXED; + +typedef struct tagPOINT { + LONG x; + LONG y; +} POINT, *LPPOINT, *PPOINT; + +typedef struct tagPOINTFX { + FIXED x; + FIXED y; +} POINTFX; + +typedef struct _POINTL { + LONG x; + LONG y; +} POINTL; + +typedef struct tagPOINTS { + SHORT x; + SHORT y; +} POINTS; + +typedef struct _tagCANDIDATEFORM { + DWORD dwIndex; + DWORD dwStyle; + POINT ptCurrentPos; + RECT rcArea; +} CANDIDATEFORM, *LPCANDIDATEFORM; + +typedef struct _tagCANDIDATELIST { + DWORD dwSize; + DWORD dwStyle; + DWORD dwCount; + DWORD dwSelection; + DWORD dwPageStart; + DWORD dwPageSize; + DWORD dwOffset[1]; +} CANDIDATELIST, *LPCANDIDATELIST; + +typedef struct tagCREATESTRUCT { + LPVOID lpCreateParams; + HINSTANCE hInstance; + HMENU hMenu; + HWND hwndParent; + int cy; + int cx; + int y; + int x; + LONG style; + LPCTSTR lpszName; + LPCTSTR lpszClass; + DWORD dwExStyle; +} CREATESTRUCT, *LPCREATESTRUCT; + +typedef struct tagCBT_CREATEWND { + LPCREATESTRUCT lpcs; + HWND hwndInsertAfter; +} CBT_CREATEWND; + +typedef struct tagCBTACTIVATESTRUCT { + WINBOOL fMouse; + HWND hWndActive; +} CBTACTIVATESTRUCT; + +typedef struct _CHAR_INFO { + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } Char; + WORD Attributes; +} CHAR_INFO, *PCHAR_INFO; + +typedef struct _charformat { + UINT cbSize; + DWORD dwMask; + DWORD dwEffects; + LONG yHeight; + LONG yOffset; + COLORREF crTextColor; + BYTE bCharSet; + BYTE bPitchAndFamily; + TCHAR szFaceName[LF_FACESIZE]; +} CHARFORMAT; + +typedef struct _charrange { + LONG cpMin; + LONG cpMax; +} CHARRANGE; + +typedef struct tagCHARSET { + DWORD aflBlock[3]; + DWORD flLang; +} CHARSET; + +typedef struct tagFONTSIGNATURE { + DWORD fsUsb[4]; + DWORD fsCsb[2]; +} FONTSIGNATURE, *LPFONTSIGNATURE; + +typedef struct { + UINT ciCharset; + UINT ciACP; + FONTSIGNATURE fs; +} CHARSETINFO, *LPCHARSETINFO; + +typedef struct { + DWORD lStructSize; + HWND hwndOwner; + HWND hInstance; + COLORREF rgbResult; + COLORREF* lpCustColors; + DWORD Flags; + LPARAM lCustData; + LPCCHOOKPROC lpfnHook; + LPCTSTR lpTemplateName; +} CHOOSECOLOR, *LPCHOOSECOLOR; + +typedef struct tagLOGFONT { + LONG lfHeight; + LONG lfWidth; + LONG lfEscapement; + LONG lfOrientation; + LONG lfWeight; + BYTE lfItalic; + BYTE lfUnderline; + BYTE lfStrikeOut; + BYTE lfCharSet; + BYTE lfOutPrecision; + BYTE lfClipPrecision; + BYTE lfQuality; + BYTE lfPitchAndFamily; + TCHAR lfFaceName[LF_FACESIZE]; +} LOGFONT, *LPLOGFONT, *PLOGFONT; + +typedef struct { + DWORD lStructSize; + HWND hwndOwner; + HDC hDC; + LPLOGFONT lpLogFont; + INT iPointSize; + DWORD Flags; + DWORD rgbColors; + LPARAM lCustData; + LPCFHOOKPROC lpfnHook; + LPCTSTR lpTemplateName; + HINSTANCE hInstance; + LPTSTR lpszStyle; + WORD nFontType; + WORD ___MISSING_ALIGNMENT__; + INT nSizeMin; + INT nSizeMax; +} CHOOSEFONT, *LPCHOOSEFONT; + +typedef struct _IDA { + UINT cidl; + UINT aoffset[1]; +} CIDA, * LPIDA; + +typedef struct tagCLIENTCREATESTRUCT { + HANDLE hWindowMenu; + UINT idFirstChild; +} CLIENTCREATESTRUCT; + +typedef CLIENTCREATESTRUCT *LPCLIENTCREATESTRUCT; + +typedef struct _CMInvokeCommandInfo { + DWORD cbSize; + DWORD fMask; + HWND hwnd; + LPCSTR lpVerb; + LPCSTR lpParameters; + LPCSTR lpDirectory; + int nShow; + DWORD dwHotKey; + HANDLE hIcon; +} CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO; + +typedef struct tagCOLORADJUSTMENT { + WORD caSize; + WORD caFlags; + WORD caIlluminantIndex; + WORD caRedGamma; + WORD caGreenGamma; + WORD caBlueGamma; + WORD caReferenceBlack; + WORD caReferenceWhite; + SHORT caContrast; + SHORT caBrightness; + SHORT caColorfulness; + SHORT caRedGreenTint; +} COLORADJUSTMENT, *LPCOLORADJUSTMENT; + +typedef struct _COLORMAP { + COLORREF from; + COLORREF to; +} COLORMAP, * LPCOLORMAP; + +typedef struct _DCB { + DWORD DCBlength; + DWORD BaudRate; + DWORD fBinary: 1; + DWORD fParity: 1; + DWORD fOutxCtsFlow:1; + DWORD fOutxDsrFlow:1; + DWORD fDtrControl:2; + DWORD fDsrSensitivity:1; + DWORD fTXContinueOnXoff:1; + DWORD fOutX: 1; + DWORD fInX: 1; + DWORD fErrorChar: 1; + DWORD fNull: 1; + DWORD fRtsControl:2; + DWORD fAbortOnError:1; + DWORD fDummy2:17; + WORD wReserved; + WORD XonLim; + WORD XoffLim; + BYTE ByteSize; + BYTE Parity; + BYTE StopBits; + char XonChar; + char XoffChar; + char ErrorChar; + char EofChar; + char EvtChar; + WORD wReserved1; +} DCB, *LPDCB; + +typedef struct _COMM_CONFIG { + DWORD dwSize; + WORD wVersion; + WORD wReserved; + DCB dcb; + DWORD dwProviderSubType; + DWORD dwProviderOffset; + DWORD dwProviderSize; + WCHAR wcProviderData[1]; +} COMMCONFIG, *LPCOMMCONFIG; + +typedef struct _COMMPROP { + WORD wPacketLength; + WORD wPacketVersion; + DWORD dwServiceMask; + DWORD dwReserved1; + DWORD dwMaxTxQueue; + DWORD dwMaxRxQueue; + DWORD dwMaxBaud; + DWORD dwProvSubType; + DWORD dwProvCapabilities; + DWORD dwSettableParams; + DWORD dwSettableBaud; + WORD wSettableData; + WORD wSettableStopParity; + DWORD dwCurrentTxQueue; + DWORD dwCurrentRxQueue; + DWORD dwProvSpec1; + DWORD dwProvSpec2; + WCHAR wcProvChar[1]; +} COMMPROP, *LPCOMMPROP; + +typedef struct _COMMTIMEOUTS { + DWORD ReadIntervalTimeout; + DWORD ReadTotalTimeoutMultiplier; + DWORD ReadTotalTimeoutConstant; + DWORD WriteTotalTimeoutMultiplier; + DWORD WriteTotalTimeoutConstant; +} COMMTIMEOUTS,*LPCOMMTIMEOUTS; + +typedef struct tagCOMPAREITEMSTRUCT { + UINT CtlType; + UINT CtlID; + HWND hwndItem; + UINT itemID1; + DWORD itemData1; + UINT itemID2; + DWORD itemData2; +} COMPAREITEMSTRUCT; + +typedef struct { + COLORREF crText; + COLORREF crBackground; + DWORD dwEffects; +} COMPCOLOR; + +typedef struct _tagCOMPOSITIONFORM { + DWORD dwStyle; + POINT ptCurrentPos; + RECT rcArea; +} COMPOSITIONFORM, *LPCOMPOSITIONFORM; + +typedef struct _COMSTAT { + DWORD fCtsHold : 1; + DWORD fDsrHold : 1; + DWORD fRlsdHold : 1; + DWORD fXoffHold : 1; + DWORD fXoffSent : 1; + DWORD fEof : 1; + DWORD fTxim : 1; + DWORD fReserved : 25; + DWORD cbInQue; + DWORD cbOutQue; +} COMSTAT, *LPCOMSTAT; + +typedef struct _CONSOLE_CURSOR_INFO { + DWORD dwSize; + WINBOOL bVisible; +} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO; + +typedef struct _COORD { + SHORT X; + SHORT Y; +} COORD; + +typedef struct _SMALL_RECT { + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; +} SMALL_RECT, *PSMALL_RECT; + +typedef struct _CONSOLE_SCREEN_BUFFER_INFO { + COORD dwSize; + COORD dwCursorPosition; + WORD wAttributes; + SMALL_RECT srWindow; + COORD dwMaximumWindowSize; +} CONSOLE_SCREEN_BUFFER_INFO, *PCONSOLE_SCREEN_BUFFER_INFO ; + +#ifdef __i386__ + +typedef struct _FLOATING_SAVE_AREA { + DWORD ControlWord; + DWORD StatusWord; + DWORD TagWord; + DWORD ErrorOffset; + DWORD ErrorSelector; + DWORD DataOffset; + DWORD DataSelector; + BYTE RegisterArea[80]; + DWORD Cr0NpxState; +} FLOATING_SAVE_AREA; + +typedef struct _CONTEXT { + DWORD ContextFlags; + + DWORD Dr0; + DWORD Dr1; + DWORD Dr2; + DWORD Dr3; + DWORD Dr6; + DWORD Dr7; + + FLOATING_SAVE_AREA FloatSave; + + DWORD SegGs; + DWORD SegFs; + DWORD SegEs; + DWORD SegDs; + + DWORD Edi; + DWORD Esi; + DWORD Ebx; + DWORD Edx; + DWORD Ecx; + DWORD Eax; + + DWORD Ebp; + DWORD Eip; + DWORD SegCs; + DWORD EFlags; + DWORD Esp; + DWORD SegSs; +} CONTEXT, *PCONTEXT, *LPCONTEXT; + +#else /* __ppc__ */ + +typedef struct + { + /* Floating point registers returned when CONTEXT_FLOATING_POINT is set */ + double Fpr0; + double Fpr1; + double Fpr2; + double Fpr3; + double Fpr4; + double Fpr5; + double Fpr6; + double Fpr7; + double Fpr8; + double Fpr9; + double Fpr10; + double Fpr11; + double Fpr12; + double Fpr13; + double Fpr14; + double Fpr15; + double Fpr16; + double Fpr17; + double Fpr18; + double Fpr19; + double Fpr20; + double Fpr21; + double Fpr22; + double Fpr23; + double Fpr24; + double Fpr25; + double Fpr26; + double Fpr27; + double Fpr28; + double Fpr29; + double Fpr30; + double Fpr31; + double Fpscr; + + /* Integer registers returned when CONTEXT_INTEGER is set. */ + DWORD Gpr0; + DWORD Gpr1; + DWORD Gpr2; + DWORD Gpr3; + DWORD Gpr4; + DWORD Gpr5; + DWORD Gpr6; + DWORD Gpr7; + DWORD Gpr8; + DWORD Gpr9; + DWORD Gpr10; + DWORD Gpr11; + DWORD Gpr12; + DWORD Gpr13; + DWORD Gpr14; + DWORD Gpr15; + DWORD Gpr16; + DWORD Gpr17; + DWORD Gpr18; + DWORD Gpr19; + DWORD Gpr20; + DWORD Gpr21; + DWORD Gpr22; + DWORD Gpr23; + DWORD Gpr24; + DWORD Gpr25; + DWORD Gpr26; + DWORD Gpr27; + DWORD Gpr28; + DWORD Gpr29; + DWORD Gpr30; + DWORD Gpr31; + + DWORD Cr; /* Condition register */ + DWORD Xer; /* Fixed point exception register */ + + /* The following are set when CONTEXT_CONTROL is set. */ + DWORD Msr; /* Machine status register */ + DWORD Iar; /* Instruction address register */ + DWORD Lr; /* Link register */ + DWORD Ctr; /* Control register */ + + /* Control which context values are returned */ + DWORD ContextFlags; + DWORD Fill[3]; + + /* Registers returned if CONTEXT_DEBUG_REGISTERS is set. */ + DWORD Dr0; /* Breakpoint Register 1 */ + DWORD Dr1; /* Breakpoint Register 2 */ + DWORD Dr2; /* Breakpoint Register 3 */ + DWORD Dr3; /* Breakpoint Register 4 */ + DWORD Dr4; /* Breakpoint Register 5 */ + DWORD Dr5; /* Breakpoint Register 6 */ + DWORD Dr6; /* Debug Status Register */ + DWORD Dr7; /* Debug Control Register */ +} CONTEXT, *PCONTEXT, *LPCONTEXT; +#endif + +typedef struct _LIST_ENTRY { + struct _LIST_ENTRY *Flink; + struct _LIST_ENTRY *Blink; +} LIST_ENTRY, *PLIST_ENTRY; + +typedef struct _CRITICAL_SECTION_DEBUG { + WORD Type; + WORD CreatorBackTraceIndex; + struct _CRITICAL_SECTION *CriticalSection; + LIST_ENTRY ProcessLocksList; + DWORD EntryCount; + DWORD ContentionCount; + DWORD Depth; + PVOID OwnerBackTrace[ 5 ]; +} CRITICAL_SECTION_DEBUG, *PCRITICAL_SECTION_DEBUG; + +typedef struct _CRITICAL_SECTION { + PCRITICAL_SECTION_DEBUG DebugInfo; + LONG LockCount; + LONG RecursionCount; + HANDLE OwningThread; + HANDLE LockSemaphore; + DWORD Reserved; +} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION; + +typedef struct _SECURITY_QUALITY_OF_SERVICE { + DWORD Length; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + /* SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; */ + WINBOOL ContextTrackingMode; + BOOLEAN EffectiveOnly; +} SECURITY_QUALITY_OF_SERVICE; + +typedef struct tagCONVCONTEXT { + UINT cb; + UINT wFlags; + UINT wCountryID; + int iCodePage; + DWORD dwLangID; + DWORD dwSecurity; + SECURITY_QUALITY_OF_SERVICE qos; +} CONVCONTEXT; + +typedef CONVCONTEXT *PCONVCONTEXT; + +typedef struct tagCONVINFO { + DWORD cb; + DWORD hUser; + HCONV hConvPartner; + HSZ hszSvcPartner; + HSZ hszServiceReq; + HSZ hszTopic; + HSZ hszItem; + UINT wFmt; + UINT wType; + UINT wStatus; + UINT wConvst; + UINT wLastError; + HCONVLIST hConvList; + CONVCONTEXT ConvCtxt; + HWND hwnd; + HWND hwndPartner; +} CONVINFO; + +typedef struct tagCOPYDATASTRUCT { + DWORD dwData; + DWORD cbData; + PVOID lpData; +} COPYDATASTRUCT; + +typedef struct _cpinfo { + UINT MaxCharSize; + BYTE DefaultChar[MAX_DEFAULTCHAR]; + BYTE LeadByte[MAX_LEADBYTES]; +} CPINFO, *LPCPINFO; + +typedef struct tagCPLINFO { + int idIcon; + int idName; + int idInfo; + LONG lData; +} CPLINFO; + +typedef struct _CREATE_PROCESS_DEBUG_INFO { + HANDLE hFile; + HANDLE hProcess; + HANDLE hThread; + LPVOID lpBaseOfImage; + DWORD dwDebugInfoFileOffset; + DWORD nDebugInfoSize; + LPVOID lpThreadLocalBase; + LPTHREAD_START_ROUTINE lpStartAddress; + LPVOID lpImageName; + WORD fUnicode; +} CREATE_PROCESS_DEBUG_INFO; + +typedef struct _CREATE_THREAD_DEBUG_INFO { + HANDLE hThread; + LPVOID lpThreadLocalBase; + LPTHREAD_START_ROUTINE lpStartAddress; +} CREATE_THREAD_DEBUG_INFO; + +/* + TODO: sockets +typedef struct _SOCKET_ADDRESS { + LPSOCKADDR lpSockaddr ; + INT iSockaddrLength ; +} SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS; +*/ + +/* +typedef struct _CSADDR_INFO { + SOCKET_ADDRESS LocalAddr; + SOCKET_ADDRESS RemoteAddr; + INT iSocketType; + INT iProtocol; +} CSADDR_INFO; +*/ + +typedef struct _currencyfmt { + UINT NumDigits; + UINT LeadingZero; + UINT Grouping; + LPTSTR lpDecimalSep; + LPTSTR lpThousandSep; + UINT NegativeOrder; + UINT PositiveOrder; + LPTSTR lpCurrencySymbol; +} CURRENCYFMT; + +typedef struct tagCURSORSHAPE { + int xHotSpot; + int yHotSpot; + int cx; + int cy; + int cbWidth; + BYTE Planes; + BYTE BitsPixel; +} CURSORSHAPE, *LPCURSORSHAPE; + +typedef struct tagCWPRETSTRUCT { + LRESULT lResult; + LPARAM lParam; + WPARAM wParam; + DWORD message; + HWND hwnd; +} CWPRETSTRUCT; + +typedef struct tagCWPSTRUCT { + LPARAM lParam; + WPARAM wParam; + UINT message; + HWND hwnd; +} CWPSTRUCT; + +typedef struct _DATATYPES_INFO_1 { + LPTSTR pName; +} DATATYPES_INFO_1; + +typedef struct { + unsigned short bAppReturnCode:8, + reserved:6, + fBusy:1, + fAck:1; +} DDEACK; + +typedef struct { + unsigned short reserved:14, + fDeferUpd:1, + fAckReq:1; + short cfFormat; +} DDEADVISE; + +typedef struct { + unsigned short unused:12, + fResponse:1, + fRelease:1, + reserved:1, + fAckReq:1; + short cfFormat; + BYTE Value[1]; +} DDEDATA; + +typedef struct { + unsigned short unused:13, + fRelease:1, + fDeferUpd:1, + fAckReq:1; + short cfFormat; +} DDELN; + +typedef struct tagDDEML_MSG_HOOK_DATA { + UINT uiLo; + UINT uiHi; + DWORD cbData; + DWORD Data[8]; +} DDEML_MSG_HOOK_DATA; + +typedef struct { + unsigned short unused:13, + fRelease:1, + fReserved:2; + short cfFormat; + BYTE Value[1]; +} DDEPOKE; + +typedef struct { + unsigned short unused:12, + fAck:1, + fRelease:1, + fReserved:1, + fAckReq:1; + short cfFormat; + BYTE rgb[1]; +} DDEUP; + +typedef struct _EXCEPTION_RECORD { + DWORD ExceptionCode; + DWORD ExceptionFlags; + struct _EXCEPTION_RECORD *ExceptionRecord; + PVOID ExceptionAddress; + DWORD NumberParameters; + DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; +} EXCEPTION_RECORD, *PEXCEPTION_RECORD, *LPEXCEPTION_RECORD; + +typedef struct _EXCEPTION_DEBUG_INFO { + EXCEPTION_RECORD ExceptionRecord; + DWORD dwFirstChance; +} EXCEPTION_DEBUG_INFO; + +typedef struct _EXIT_PROCESS_DEBUG_INFO { + DWORD dwExitCode; +} EXIT_PROCESS_DEBUG_INFO; + +typedef struct _EXIT_THREAD_DEBUG_INFO { + DWORD dwExitCode; +} EXIT_THREAD_DEBUG_INFO; + +typedef struct _LOAD_DLL_DEBUG_INFO { + HANDLE hFile; + LPVOID lpBaseOfDll; + DWORD dwDebugInfoFileOffset; + DWORD nDebugInfoSize; + LPVOID lpImageName; + WORD fUnicode; +} LOAD_DLL_DEBUG_INFO; + +typedef struct _UNLOAD_DLL_DEBUG_INFO { + LPVOID lpBaseOfDll; +} UNLOAD_DLL_DEBUG_INFO; + +typedef struct _OUTPUT_DEBUG_STRING_INFO { + LPSTR lpDebugStringData; + WORD fUnicode; + WORD nDebugStringLength; +} OUTPUT_DEBUG_STRING_INFO; + +typedef struct _RIP_INFO { + DWORD dwError; + DWORD dwType; +} RIP_INFO; + +typedef struct _DEBUG_EVENT { + DWORD dwDebugEventCode; + DWORD dwProcessId; + DWORD dwThreadId; + union { + EXCEPTION_DEBUG_INFO Exception; + CREATE_THREAD_DEBUG_INFO CreateThread; + CREATE_PROCESS_DEBUG_INFO CreateProcessInfo; + EXIT_THREAD_DEBUG_INFO ExitThread; + EXIT_PROCESS_DEBUG_INFO ExitProcess; + LOAD_DLL_DEBUG_INFO LoadDll; + UNLOAD_DLL_DEBUG_INFO UnloadDll; + OUTPUT_DEBUG_STRING_INFO DebugString; + RIP_INFO RipInfo; + } u; +} DEBUG_EVENT, *LPDEBUG_EVENT; + +typedef struct tagDEBUGHOOKINFO { + DWORD idThread; + DWORD idThreadInstaller; + LPARAM lParam; + WPARAM wParam; + int code; +} DEBUGHOOKINFO; + +typedef struct tagDELETEITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + HWND hwndItem; + UINT itemData; +} DELETEITEMSTRUCT; + +typedef struct _DEV_BROADCAST_HDR { + ULONG dbch_size; + ULONG dbch_devicetype; + ULONG dbch_reserved; +} DEV_BROADCAST_HDR; +typedef DEV_BROADCAST_HDR *PDEV_BROADCAST_HDR; + +typedef struct _DEV_BROADCAST_OEM { + ULONG dbco_size; + ULONG dbco_devicetype; + ULONG dbco_reserved; + ULONG dbco_identifier; + ULONG dbco_suppfunc; +} DEV_BROADCAST_OEM; +typedef DEV_BROADCAST_OEM *PDEV_BROADCAST_OEM; + +typedef struct _DEV_BROADCAST_PORT { + ULONG dbcp_size; + ULONG dbcp_devicetype; + ULONG dbcp_reserved; + char dbcp_name[1]; +} DEV_BROADCAST_PORT; +typedef DEV_BROADCAST_PORT *PDEV_BROADCAST_PORT; + +struct _DEV_BROADCAST_USERDEFINED { + struct _DEV_BROADCAST_HDR dbud_dbh; + char dbud_szName[1]; + BYTE dbud_rgbUserDefined[1]; +}; + +typedef struct _DEV_BROADCAST_VOLUME { + ULONG dbcv_size; + ULONG dbcv_devicetype; + ULONG dbcv_reserved; + ULONG dbcv_unitmask; + USHORT dbcv_flags; +} DEV_BROADCAST_VOLUME; +typedef DEV_BROADCAST_VOLUME *PDEV_BROADCAST_VOLUME; + +typedef struct _devicemode { + BCHAR dmDeviceName[CCHDEVICENAME]; + WORD dmSpecVersion; + WORD dmDriverVersion; + WORD dmSize; + WORD dmDriverExtra; + DWORD dmFields; + short dmOrientation; + short dmPaperSize; + short dmPaperLength; + short dmPaperWidth; + short dmScale; + short dmCopies; + short dmDefaultSource; + short dmPrintQuality; + short dmColor; + short dmDuplex; + short dmYResolution; + short dmTTOption; + short dmCollate; + BCHAR dmFormName[CCHFORMNAME]; + WORD dmLogPixels; + DWORD dmBitsPerPel; + DWORD dmPelsWidth; + DWORD dmPelsHeight; + DWORD dmDisplayFlags; + DWORD dmDisplayFrequency; + DWORD dmICMMethod; + DWORD dmICMIntent; + DWORD dmMediaType; + DWORD dmDitherType; + DWORD dmICCManufacturer; + DWORD dmICCModel; +} DEVMODE, *LPDEVMODE; + +typedef struct tagDEVNAMES { + WORD wDriverOffset; + WORD wDeviceOffset; + WORD wOutputOffset; + WORD wDefault; +} DEVNAMES, *LPDEVNAMES; + +typedef struct tagDIBSECTION { + BITMAP dsBm; + BITMAPINFOHEADER dsBmih; + DWORD dsBitfields[3]; + HANDLE dshSection; + DWORD dsOffset; +} DIBSECTION; + +typedef struct _LARGE_INTEGER { + DWORD LowPart; + LONG HighPart; +} LARGE_INTEGER, *PLARGE_INTEGER; + +typedef struct _DISK_GEOMETRY { + LARGE_INTEGER Cylinders; + MEDIA_TYPE MediaType; + DWORD TracksPerCylinder; + DWORD SectorsPerTrack; + DWORD BytesPerSector; +} DISK_GEOMETRY ; + +typedef struct _DISK_PERFORMANCE { + LARGE_INTEGER BytesRead; + LARGE_INTEGER BytesWritten; + LARGE_INTEGER ReadTime; + LARGE_INTEGER WriteTime; + DWORD ReadCount; + DWORD WriteCount; + DWORD QueueDepth; +} DISK_PERFORMANCE ; + +typedef struct { + DWORD style; + DWORD dwExtendedStyle; + short x; + short y; + short cx; + short cy; + WORD id; +} DLGITEMTEMPLATE PACKED; + +typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATE; +typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATE; + +typedef struct { + DWORD style; + DWORD dwExtendedStyle; + WORD cdit; + short x; + short y; + short cx; + short cy; +} DLGTEMPLATE PACKED; + +typedef DLGTEMPLATE *LPDLGTEMPLATE; +typedef const DLGTEMPLATE *LPCDLGTEMPLATE; + +typedef struct _DOC_INFO_1 { + LPTSTR pDocName; + LPTSTR pOutputFile; + LPTSTR pDatatype; +} DOC_INFO_1; + +typedef struct _DOC_INFO_2 { + LPTSTR pDocName; + LPTSTR pOutputFile; + LPTSTR pDatatype; + DWORD dwMode; + DWORD JobId; +} DOC_INFO_2; + +typedef struct { + int cbSize; + LPCTSTR lpszDocName; + LPCTSTR lpszOutput; + LPCTSTR lpszDatatype; + DWORD fwType; +} DOCINFO; + +typedef struct { + UINT uNotification; + HWND hWnd; + POINT ptCursor; +} DRAGLISTINFO, *LPDRAGLISTINFO; + +typedef struct tagDRAWITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemAction; + UINT itemState; + HWND hwndItem; + HDC hDC; + RECT rcItem; + DWORD itemData; +} DRAWITEMSTRUCT, *LPDRAWITEMSTRUCT, *PDRAWITEMSTRUCT; + +typedef struct { + UINT cbSize; + int iTabLength; + int iLeftMargin; + int iRightMargin; + UINT uiLengthDrawn; +} DRAWTEXTPARAMS, *LPDRAWTEXTPARAMS; + +typedef struct _PARTITION_INFORMATION { + BYTE PartitionType; + BOOLEAN BootIndicator; + BOOLEAN RecognizedPartition; + BOOLEAN RewritePartition; + LARGE_INTEGER StartingOffset; + LARGE_INTEGER PartitionLength; + LARGE_INTEGER HiddenSectors; +} PARTITION_INFORMATION ; + +typedef struct _DRIVE_LAYOUT_INFORMATION { + DWORD PartitionCount; + DWORD Signature; + PARTITION_INFORMATION PartitionEntry[1]; +} DRIVE_LAYOUT_INFORMATION; + +typedef struct _DRIVER_INFO_1 { + LPTSTR pName; +} DRIVER_INFO_1; + +typedef struct _DRIVER_INFO_2 { + DWORD cVersion; + LPTSTR pName; + LPTSTR pEnvironment; + LPTSTR pDriverPath; + LPTSTR pDataFile; + LPTSTR pConfigFile; +} DRIVER_INFO_2; + +typedef struct _DRIVER_INFO_3 { + DWORD cVersion; + LPTSTR pName; + LPTSTR pEnvironment; + LPTSTR pDriverPath; + LPTSTR pDataFile; + LPTSTR pConfigFile; + LPTSTR pHelpFile; + LPTSTR pDependentFiles; + LPTSTR pMonitorName; + LPTSTR pDefaultDataType; +} DRIVER_INFO_3; + +typedef struct _editstream { + DWORD dwCookie; + DWORD dwError; + EDITSTREAMCALLBACK pfnCallback; +} EDITSTREAM; + +typedef struct tagEMR +{ + DWORD iType; + DWORD nSize; +} EMR, *PEMR; + +typedef struct tagEMRANGLEARC +{ + EMR emr; + POINTL ptlCenter; + DWORD nRadius; + FLOAT eStartAngle; + FLOAT eSweepAngle; +} EMRANGLEARC, *PEMRANGLEARC; + +typedef struct tagEMRARC +{ + EMR emr; + RECTL rclBox; + POINTL ptlStart; + POINTL ptlEnd; +} EMRARC, *PEMRARC, + EMRARCTO, *PEMRARCTO, + EMRCHORD, *PEMRCHORD, + EMRPIE, *PEMRPIE; + +typedef struct _XFORM +{ + FLOAT eM11; + FLOAT eM12; + FLOAT eM21; + FLOAT eM22; + FLOAT eDx; + FLOAT eDy; +} XFORM, *PXFORM, *LPXFORM; + +typedef struct tagEMRBITBLT +{ + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; +} EMRBITBLT, *PEMRBITBLT; + +typedef struct tagLOGBRUSH { + UINT lbStyle; + COLORREF lbColor; + LONG lbHatch; +} LOGBRUSH; + +typedef struct tagEMRCREATEBRUSHINDIRECT +{ + EMR emr; + DWORD ihBrush; + LOGBRUSH lb; +} EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT; + +typedef LONG LCSCSTYPE; +typedef LONG LCSGAMUTMATCH; + +typedef struct tagLOGCOLORSPACE { + DWORD lcsSignature; + DWORD lcsVersion; + DWORD lcsSize; + + LCSCSTYPE lcsCSType; + LCSGAMUTMATCH lcsIntent; + CIEXYZTRIPLE lcsEndpoints; + DWORD lcsGammaRed; + DWORD lcsGammaGreen; + DWORD lcsGammaBlue; + TCHAR lcsFilename[MAX_PATH]; +} LOGCOLORSPACE, *LPLOGCOLORSPACE; + +typedef struct tagEMRCREATECOLORSPACE +{ + EMR emr; + DWORD ihCS; + LOGCOLORSPACE lcs; +} EMRCREATECOLORSPACE, *PEMRCREATECOLORSPACE; + +typedef struct tagEMRCREATEDIBPATTERNBRUSHPT +{ + EMR emr; + DWORD ihBrush; + DWORD iUsage; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; +} EMRCREATEDIBPATTERNBRUSHPT, + PEMRCREATEDIBPATTERNBRUSHPT; + +typedef struct tagEMRCREATEMONOBRUSH +{ + EMR emr; + DWORD ihBrush; + DWORD iUsage; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; +} EMRCREATEMONOBRUSH, *PEMRCREATEMONOBRUSH; + +typedef struct tagPALETTEENTRY { + BYTE peRed; + BYTE peGreen; + BYTE peBlue; + BYTE peFlags; +} PALETTEENTRY, *LPPALETTEENTRY, *PPALETTEENTRY; + +typedef struct tagLOGPALETTE { + WORD palVersion; + WORD palNumEntries; + PALETTEENTRY palPalEntry[1]; +} LOGPALETTE, *LPLOGPALETTE, *PLOGPALETTE; + +typedef struct tagEMRCREATEPALETTE +{ + EMR emr; + DWORD ihPal; + LOGPALETTE lgpl; +} EMRCREATEPALETTE, *PEMRCREATEPALETTE; + +typedef struct tagLOGPEN { + UINT lopnStyle; + POINT lopnWidth; + COLORREF lopnColor; +} LOGPEN; + +typedef struct tagEMRCREATEPEN +{ + EMR emr; + DWORD ihPen; + LOGPEN lopn; +} EMRCREATEPEN, *PEMRCREATEPEN; + +typedef struct tagEMRELLIPSE +{ + EMR emr; + RECTL rclBox; +} EMRELLIPSE, *PEMRELLIPSE, + EMRRECTANGLE, *PEMRRECTANGLE; + +typedef struct tagEMREOF +{ + EMR emr; + DWORD nPalEntries; + DWORD offPalEntries; + DWORD nSizeLast; +} EMREOF, *PEMREOF; + +typedef struct tagEMREXCLUDECLIPRECT +{ + EMR emr; + RECTL rclClip; +} EMREXCLUDECLIPRECT, *PEMREXCLUDECLIPRECT, + EMRINTERSECTCLIPRECT, *PEMRINTERSECTCLIPRECT; + +typedef struct tagPANOSE { + BYTE bFamilyType; + BYTE bSerifStyle; + BYTE bWeight; + BYTE bProportion; + BYTE bContrast; + BYTE bStrokeVariation; + BYTE bArmStyle; + BYTE bLetterform; + BYTE bMidline; + BYTE bXHeight; +} PANOSE; + +typedef struct tagEXTLOGFONT { + LOGFONT elfLogFont; + BCHAR elfFullName[LF_FULLFACESIZE]; + BCHAR elfStyle[LF_FACESIZE]; + DWORD elfVersion; + DWORD elfStyleSize; + DWORD elfMatch; + DWORD elfReserved; + BYTE elfVendorId[ELF_VENDOR_SIZE]; + DWORD elfCulture; + PANOSE elfPanose; +} EXTLOGFONT; + +typedef struct tagEMREXTCREATEFONTINDIRECTW +{ + EMR emr; + DWORD ihFont; + EXTLOGFONT elfw; +} EMREXTCREATEFONTINDIRECTW, + PEMREXTCREATEFONTINDIRECTW; + +typedef struct tagEXTLOGPEN { + UINT elpPenStyle; + UINT elpWidth; + UINT elpBrushStyle; + COLORREF elpColor; + LONG elpHatch; + DWORD elpNumEntries; + DWORD elpStyleEntry[1]; +} EXTLOGPEN; + +typedef struct tagEMREXTCREATEPEN +{ + EMR emr; + DWORD ihPen; + DWORD offBmi; + DWORD cbBmi; + DWORD offBits; + DWORD cbBits; + EXTLOGPEN elp; +} EMREXTCREATEPEN, *PEMREXTCREATEPEN; + +typedef struct tagEMREXTFLOODFILL +{ + EMR emr; + POINTL ptlStart; + COLORREF crColor; + DWORD iMode; +} EMREXTFLOODFILL, *PEMREXTFLOODFILL; + +typedef struct tagEMREXTSELECTCLIPRGN +{ + EMR emr; + DWORD cbRgnData; + DWORD iMode; + BYTE RgnData[1]; +} EMREXTSELECTCLIPRGN, *PEMREXTSELECTCLIPRGN; + +typedef struct tagEMRTEXT +{ + POINTL ptlReference; + DWORD nChars; + DWORD offString; + DWORD fOptions; + RECTL rcl; + DWORD offDx; +} EMRTEXT, *PEMRTEXT; + +typedef struct tagEMREXTTEXTOUTA +{ + EMR emr; + RECTL rclBounds; + DWORD iGraphicsMode; + FLOAT exScale; + FLOAT eyScale; + EMRTEXT emrtext; +} EMREXTTEXTOUTA, *PEMREXTTEXTOUTA, + EMREXTTEXTOUTW, *PEMREXTTEXTOUTW; + +typedef struct tagEMRFILLPATH +{ + EMR emr; + RECTL rclBounds; +} EMRFILLPATH, *PEMRFILLPATH, + EMRSTROKEANDFILLPATH, *PEMRSTROKEANDFILLPATH, + EMRSTROKEPATH, *PEMRSTROKEPATH; + +typedef struct tagEMRFILLRGN +{ + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + DWORD ihBrush; + BYTE RgnData[1]; +} EMRFILLRGN, *PEMRFILLRGN; + +typedef struct tagEMRFORMAT { + DWORD dSignature; + DWORD nVersion; + DWORD cbData; + DWORD offData; +} EMRFORMAT; + +typedef struct tagSIZE { + LONG cx; + LONG cy; +} SIZE, *PSIZE, *LPSIZE, SIZEL, *PSIZEL, *LPSIZEL; + +typedef struct tagEMRFRAMERGN +{ + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + DWORD ihBrush; + SIZEL szlStroke; + BYTE RgnData[1]; +} EMRFRAMERGN, *PEMRFRAMERGN; + +typedef struct tagEMRGDICOMMENT +{ + EMR emr; + DWORD cbData; + BYTE Data[1]; +} EMRGDICOMMENT, *PEMRGDICOMMENT; + +typedef struct tagEMRINVERTRGN +{ + EMR emr; + RECTL rclBounds; + DWORD cbRgnData; + BYTE RgnData[1]; +} EMRINVERTRGN, *PEMRINVERTRGN, + EMRPAINTRGN, *PEMRPAINTRGN; + +typedef struct tagEMRLINETO +{ + EMR emr; + POINTL ptl; +} EMRLINETO, *PEMRLINETO, + EMRMOVETOEX, *PEMRMOVETOEX; + +typedef struct tagEMRMASKBLT +{ + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG xMask; + LONG yMask; + DWORD iUsageMask; + DWORD offBmiMask; + DWORD cbBmiMask; + DWORD offBitsMask; + DWORD cbBitsMask; +} EMRMASKBLT, *PEMRMASKBLT; + +typedef struct tagEMRMODIFYWORLDTRANSFORM +{ + EMR emr; + XFORM xform; + DWORD iMode; +} EMRMODIFYWORLDTRANSFORM, + PEMRMODIFYWORLDTRANSFORM; + +typedef struct tagEMROFFSETCLIPRGN +{ + EMR emr; + POINTL ptlOffset; +} EMROFFSETCLIPRGN, *PEMROFFSETCLIPRGN; + +typedef struct tagEMRPLGBLT +{ + EMR emr; + RECTL rclBounds; + POINTL aptlDest[3]; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG xMask; + LONG yMask; + DWORD iUsageMask; + DWORD offBmiMask; + DWORD cbBmiMask; + DWORD offBitsMask; + DWORD cbBitsMask; +} EMRPLGBLT, *PEMRPLGBLT; + +typedef struct tagEMRPOLYDRAW +{ + EMR emr; + RECTL rclBounds; + DWORD cptl; + POINTL aptl[1]; + BYTE abTypes[1]; +} EMRPOLYDRAW, *PEMRPOLYDRAW; + +typedef struct tagEMRPOLYDRAW16 +{ + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINTS apts[1]; + BYTE abTypes[1]; +} EMRPOLYDRAW16, *PEMRPOLYDRAW16; + +typedef struct tagEMRPOLYLINE +{ + EMR emr; + RECTL rclBounds; + DWORD cptl; + POINTL aptl[1]; +} EMRPOLYLINE, *PEMRPOLYLINE, + EMRPOLYBEZIER, *PEMRPOLYBEZIER, + EMRPOLYGON, *PEMRPOLYGON, + EMRPOLYBEZIERTO, *PEMRPOLYBEZIERTO, + EMRPOLYLINETO, *PEMRPOLYLINETO; + +typedef struct tagEMRPOLYLINE16 +{ + EMR emr; + RECTL rclBounds; + DWORD cpts; + POINTL apts[1]; +} EMRPOLYLINE16, *PEMRPOLYLINE16, + EMRPOLYBEZIER16, *PEMRPOLYBEZIER16, + EMRPOLYGON16, *PEMRPOLYGON16, + EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16, + EMRPOLYLINETO16, *PEMRPOLYLINETO16; + +typedef struct tagEMRPOLYPOLYLINE +{ + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cptl; + DWORD aPolyCounts[1]; + POINTL aptl[1]; +} EMRPOLYPOLYLINE, *PEMRPOLYPOLYLINE, + EMRPOLYPOLYGON, *PEMRPOLYPOLYGON; + +typedef struct tagEMRPOLYPOLYLINE16 +{ + EMR emr; + RECTL rclBounds; + DWORD nPolys; + DWORD cpts; + DWORD aPolyCounts[1]; + POINTS apts[1]; +} EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16, + EMRPOLYPOLYGON16, *PEMRPOLYPOLYGON16; + +typedef struct tagEMRPOLYTEXTOUTA +{ + EMR emr; + RECTL rclBounds; + DWORD iGraphicsMode; + FLOAT exScale; + FLOAT eyScale; + LONG cStrings; + EMRTEXT aemrtext[1]; +} EMRPOLYTEXTOUTA, *PEMRPOLYTEXTOUTA, + EMRPOLYTEXTOUTW, *PEMRPOLYTEXTOUTW; + +typedef struct tagEMRRESIZEPALETTE +{ + EMR emr; + DWORD ihPal; + DWORD cEntries; +} EMRRESIZEPALETTE, *PEMRRESIZEPALETTE; + +typedef struct tagEMRRESTOREDC +{ + EMR emr; + LONG iRelative; +} EMRRESTOREDC, *PEMRRESTOREDC; + +typedef struct tagEMRROUNDRECT +{ + EMR emr; + RECTL rclBox; + SIZEL szlCorner; +} EMRROUNDRECT, *PEMRROUNDRECT; + +typedef struct tagEMRSCALEVIEWPORTEXTEX +{ + EMR emr; + LONG xNum; + LONG xDenom; + LONG yNum; + LONG yDenom; +} EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX, + EMRSCALEWINDOWEXTEX, *PEMRSCALEWINDOWEXTEX; + +typedef struct tagEMRSELECTCOLORSPACE +{ + EMR emr; + DWORD ihCS; +} EMRSELECTCOLORSPACE, *PEMRSELECTCOLORSPACE, + EMRDELETECOLORSPACE, *PEMRDELETECOLORSPACE; +typedef struct tagEMRSELECTOBJECT +{ + EMR emr; + DWORD ihObject; +} EMRSELECTOBJECT, *PEMRSELECTOBJECT, + EMRDELETEOBJECT, *PEMRDELETEOBJECT; + +typedef struct tagEMRSELECTPALETTE +{ + EMR emr; + DWORD ihPal; +} EMRSELECTPALETTE, *PEMRSELECTPALETTE; + +typedef struct tagEMRSETARCDIRECTION +{ + EMR emr; + DWORD iArcDirection; +} EMRSETARCDIRECTION, *PEMRSETARCDIRECTION; + +typedef struct tagEMRSETTEXTCOLOR +{ + EMR emr; + COLORREF crColor; +} EMRSETBKCOLOR, *PEMRSETBKCOLOR, + EMRSETTEXTCOLOR, *PEMRSETTEXTCOLOR; + +typedef struct tagEMRSETCOLORADJUSTMENT +{ + EMR emr; + COLORADJUSTMENT ColorAdjustment; +} EMRSETCOLORADJUSTMENT, *PEMRSETCOLORADJUSTMENT; + +typedef struct tagEMRSETDIBITSTODEVICE +{ + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + DWORD iUsageSrc; + DWORD iStartScan; + DWORD cScans; +} EMRSETDIBITSTODEVICE, *PEMRSETDIBITSTODEVICE; + +typedef struct tagEMRSETMAPPERFLAGS +{ + EMR emr; + DWORD dwFlags; +} EMRSETMAPPERFLAGS, *PEMRSETMAPPERFLAGS; + +typedef struct tagEMRSETMITERLIMIT +{ + EMR emr; + FLOAT eMiterLimit; +} EMRSETMITERLIMIT, *PEMRSETMITERLIMIT; + +typedef struct tagEMRSETPALETTEENTRIES +{ + EMR emr; + DWORD ihPal; + DWORD iStart; + DWORD cEntries; + PALETTEENTRY aPalEntries[1]; +} EMRSETPALETTEENTRIES, *PEMRSETPALETTEENTRIES; + +typedef struct tagEMRSETPIXELV +{ + EMR emr; + POINTL ptlPixel; + COLORREF crColor; +} EMRSETPIXELV, *PEMRSETPIXELV; + +typedef struct tagEMRSETVIEWPORTEXTEX +{ + EMR emr; + SIZEL szlExtent; +} EMRSETVIEWPORTEXTEX, *PEMRSETVIEWPORTEXTEX, + EMRSETWINDOWEXTEX, *PEMRSETWINDOWEXTEX; + +typedef struct tagEMRSETVIEWPORTORGEX +{ + EMR emr; + POINTL ptlOrigin; +} EMRSETVIEWPORTORGEX, *PEMRSETVIEWPORTORGEX, + EMRSETWINDOWORGEX, *PEMRSETWINDOWORGEX, + EMRSETBRUSHORGEX, *PEMRSETBRUSHORGEX; + +typedef struct tagEMRSETWORLDTRANSFORM +{ + EMR emr; + XFORM xform; +} EMRSETWORLDTRANSFORM, *PEMRSETWORLDTRANSFORM; + +typedef struct tagEMRSTRETCHBLT +{ + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG cxDest; + LONG cyDest; + DWORD dwRop; + LONG xSrc; + LONG ySrc; + XFORM xformSrc; + COLORREF crBkColorSrc; + DWORD iUsageSrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + LONG cxSrc; + LONG cySrc; +} EMRSTRETCHBLT, *PEMRSTRETCHBLT; + +typedef struct tagEMRSTRETCHDIBITS +{ + EMR emr; + RECTL rclBounds; + LONG xDest; + LONG yDest; + LONG xSrc; + LONG ySrc; + LONG cxSrc; + LONG cySrc; + DWORD offBmiSrc; + DWORD cbBmiSrc; + DWORD offBitsSrc; + DWORD cbBitsSrc; + DWORD iUsageSrc; + DWORD dwRop; + LONG cxDest; + LONG cyDest; +} EMRSTRETCHDIBITS, *PEMRSTRETCHDIBITS; + +typedef struct tagABORTPATH +{ + EMR emr; +} EMRABORTPATH, *PEMRABORTPATH, + EMRBEGINPATH, *PEMRBEGINPATH, + EMRENDPATH, *PEMRENDPATH, + EMRCLOSEFIGURE, *PEMRCLOSEFIGURE, + EMRFLATTENPATH, *PEMRFLATTENPATH, + EMRWIDENPATH, *PEMRWIDENPATH, + EMRSETMETARGN, *PEMRSETMETARGN, + EMRSAVEDC, *PEMRSAVEDC, + EMRREALIZEPALETTE, *PEMRREALIZEPALETTE; + +typedef struct tagEMRSELECTCLIPPATH +{ + EMR emr; + DWORD iMode; +} EMRSELECTCLIPPATH, *PEMRSELECTCLIPPATH, + EMRSETBKMODE, *PEMRSETBKMODE, + EMRSETMAPMODE, *PEMRSETMAPMODE, + EMRSETPOLYFILLMODE, *PEMRSETPOLYFILLMODE, + EMRSETROP2, *PEMRSETROP2, + EMRSETSTRETCHBLTMODE, *PEMRSETSTRETCHBLTMODE, + EMRSETTEXTALIGN, *PEMRSETTEXTALIGN, + EMRENABLEICM, *PEMRENABLEICM; + +typedef struct tagNMHDR { + HWND hwndFrom; + UINT idFrom; + UINT code; +} NMHDR; + +typedef struct _encorrecttext { + NMHDR nmhdr; + CHARRANGE chrg; + WORD seltyp; +} ENCORRECTTEXT; + +typedef struct _endropfiles { + NMHDR nmhdr; + HANDLE hDrop; + LONG cp; + WINBOOL fProtected; +} ENDROPFILES; + +typedef struct { + NMHDR nmhdr; + LONG cObjectCount; + LONG cch; +} ENSAVECLIPBOARD; + +typedef struct { + NMHDR nmhdr; + LONG iob; + LONG lOper; + HRESULT hr; +} ENOLEOPFAILED; + +typedef struct tagENHMETAHEADER { + DWORD iType; + DWORD nSize; + RECTL rclBounds; + RECTL rclFrame; + DWORD dSignature; + DWORD nVersion; + DWORD nBytes; + DWORD nRecords; + WORD nHandles; + WORD sReserved; + DWORD nDescription; + DWORD offDescription; + DWORD nPalEntries; + SIZEL szlDevice; + SIZEL szlMillimeters; +} ENHMETAHEADER, *LPENHMETAHEADER; + +typedef struct tagENHMETARECORD { + DWORD iType; + DWORD nSize; + DWORD dParm[1]; +} ENHMETARECORD, *PENHMETARECORD, *LPENHMETARECORD; + +typedef struct _enprotected { + NMHDR nmhdr; + UINT msg; + WPARAM wParam; + LPARAM lParam; + CHARRANGE chrg; +} ENPROTECTED; + +typedef struct _SERVICE_STATUS { + DWORD dwServiceType; + DWORD dwCurrentState; + DWORD dwControlsAccepted; + DWORD dwWin32ExitCode; + DWORD dwServiceSpecificExitCode; + DWORD dwCheckPoint; + DWORD dwWaitHint; +} SERVICE_STATUS, *LPSERVICE_STATUS; + +typedef struct _ENUM_SERVICE_STATUS { + LPTSTR lpServiceName; + LPTSTR lpDisplayName; + SERVICE_STATUS ServiceStatus; +} ENUM_SERVICE_STATUS, *LPENUM_SERVICE_STATUS; + +typedef struct tagENUMLOGFONT { + LOGFONT elfLogFont; + BCHAR elfFullName[LF_FULLFACESIZE]; + BCHAR elfStyle[LF_FACESIZE]; +} ENUMLOGFONT; + +typedef struct tagENUMLOGFONTEX { + LOGFONT elfLogFont; + BCHAR elfFullName[LF_FULLFACESIZE]; + BCHAR elfStyle[LF_FACESIZE]; + BCHAR elfScript[LF_FACESIZE]; +} ENUMLOGFONTEX; + +typedef struct _EVENTLOGRECORD { + DWORD Length; + DWORD Reserved; + DWORD RecordNumber; + DWORD TimeGenerated; + DWORD TimeWritten; + DWORD EventID; + WORD EventType; + WORD NumStrings; + WORD EventCategory; + WORD ReservedFlags; + DWORD ClosingRecordNumber; + DWORD StringOffset; + DWORD UserSidLength; + DWORD UserSidOffset; + DWORD DataLength; + DWORD DataOffset; + +/* + Then follow: + + TCHAR SourceName[] + TCHAR Computername[] + SID UserSid + TCHAR Strings[] + BYTE Data[] + CHAR Pad[] + DWORD Length; +*/ + +} EVENTLOGRECORD; + +typedef struct tagEVENTMSG { + UINT message; + UINT paramL; + UINT paramH; + DWORD time; + HWND hwnd; +} EVENTMSG; + +typedef struct _EXCEPTION_POINTERS { + PEXCEPTION_RECORD ExceptionRecord; + PCONTEXT ContextRecord; +} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS; + +typedef struct _EXT_BUTTON { + WORD idCommand; + WORD idsHelp; + WORD fsStyle; +} EXT_BUTTON, *LPEXT_BUTTON; + +typedef struct tagFILTERKEYS { + UINT cbSize; + DWORD dwFlags; + DWORD iWaitMSec; + DWORD iDelayMSec; + DWORD iRepeatMSec; + DWORD iBounceMSec; +} FILTERKEYS; + +typedef struct _FIND_NAME_BUFFER { + UCHAR length; + UCHAR access_control; + UCHAR frame_control; + UCHAR destination_addr[6]; + UCHAR source_addr[6]; + UCHAR routing_info[18]; +} FIND_NAME_BUFFER; + +typedef struct _FIND_NAME_HEADER { + WORD node_count; + UCHAR reserved; + UCHAR unique_group; +} FIND_NAME_HEADER; + +typedef struct { + DWORD lStructSize; + HWND hwndOwner; + HINSTANCE hInstance; + DWORD Flags; + LPTSTR lpstrFindWhat; + LPTSTR lpstrReplaceWith; + WORD wFindWhatLen; + WORD wReplaceWithLen; + LPARAM lCustData; + LPFRHOOKPROC lpfnHook; + LPCTSTR lpTemplateName; +} FINDREPLACE, *LPFINDREPLACE; + +typedef struct _findtext { + CHARRANGE chrg; + LPSTR lpstrText; +} FINDTEXT; + +typedef struct _findtextex { + CHARRANGE chrg; + LPSTR lpstrText; + CHARRANGE chrgText; +} FINDTEXTEX; + +typedef struct _FMS_GETDRIVEINFO { + DWORD dwTotalSpace; + DWORD dwFreeSpace; + TCHAR szPath[260]; + TCHAR szVolume[14]; + TCHAR szShare[128]; +} FMS_GETDRIVEINFO; + +typedef struct _FMS_GETFILESEL { + FILETIME ftTime; + DWORD dwSize; + BYTE bAttr; + TCHAR szName[260]; +} FMS_GETFILESEL; + +typedef struct _FMS_LOAD { + DWORD dwSize; + TCHAR szMenuName[MENU_TEXT_LEN]; + HMENU hMenu; + UINT wMenuDelta; +} FMS_LOAD; + +typedef struct _FMS_TOOLBARLOAD { + DWORD dwSize; + LPEXT_BUTTON lpButtons; + WORD cButtons; + WORD cBitmaps; + WORD idBitmap; + HBITMAP hBitmap; +} FMS_TOOLBARLOAD; + +typedef struct _FOCUS_EVENT_RECORD { + WINBOOL bSetFocus; +} FOCUS_EVENT_RECORD; + +typedef struct _FORM_INFO_1 { + DWORD Flags; + LPTSTR pName; + SIZEL Size; + RECTL ImageableArea; +} FORM_INFO_1; + +typedef struct _FORMAT_PARAMETERS { + MEDIA_TYPE MediaType; + DWORD StartCylinderNumber; + DWORD EndCylinderNumber; + DWORD StartHeadNumber; + DWORD EndHeadNumber; +} FORMAT_PARAMETERS ; + +typedef struct _formatrange { + HDC hdc; + HDC hdcTarget; + RECT rc; + RECT rcPage; + CHARRANGE chrg; +} FORMATRANGE; + +typedef struct tagGCP_RESULTS { + DWORD lStructSize; + LPTSTR lpOutString; + UINT *lpOrder; + INT *lpDx; + INT *lpCaretPos; + LPTSTR lpClass; + UINT *lpGlyphs; + UINT nGlyphs; + UINT nMaxFit; +} GCP_RESULTS, *LPGCP_RESULTS; + +typedef struct _GENERIC_MAPPING { + ACCESS_MASK GenericRead; + ACCESS_MASK GenericWrite; + ACCESS_MASK GenericExecute; + ACCESS_MASK GenericAll; +} GENERIC_MAPPING, *PGENERIC_MAPPING; + +typedef struct _GLYPHMETRICS { + UINT gmBlackBoxX; + UINT gmBlackBoxY; + POINT gmptGlyphOrigin; + short gmCellIncX; + short gmCellIncY; +} GLYPHMETRICS, *LPGLYPHMETRICS; + +typedef struct tagHANDLETABLE { + HGDIOBJ objectHandle[1]; +} HANDLETABLE, *LPHANDLETABLE; + +typedef struct _HD_HITTESTINFO { + POINT pt; + UINT flags; + int iItem; +} HD_HITTESTINFO; + +typedef struct _HD_ITEM { + UINT mask; + int cxy; + LPTSTR pszText; + HBITMAP hbm; + int cchTextMax; + int fmt; + LPARAM lParam; +} HD_ITEM; + +typedef struct _WINDOWPOS { + HWND hwnd; + HWND hwndInsertAfter; + int x; + int y; + int cx; + int cy; + UINT flags; +} WINDOWPOS, *PWINDOWPOS, *LPWINDOWPOS; + +typedef struct _HD_LAYOUT { + RECT * prc; + WINDOWPOS * pwpos; +} HD_LAYOUT; + +typedef struct _HD_NOTIFY { + NMHDR hdr; + int iItem; + int iButton; + HD_ITEM * pitem; +} HD_NOTIFY; + +typedef struct tagHELPINFO { + UINT cbSize; + int iContextType; + int iCtrlId; + HANDLE hItemHandle; + DWORD dwContextId; + POINT MousePos; +} HELPINFO, *LPHELPINFO; + +typedef struct { + int wStructSize; + int x; + int y; + int dx; + int dy; + int wMax; + TCHAR rgchMember[2]; +} HELPWININFO; + +typedef struct tagHIGHCONTRAST { + UINT cbSize; + DWORD dwFlags; + LPTSTR lpszDefaultScheme; +} HIGHCONTRAST, * LPHIGHCONTRAST; + +typedef struct tagHSZPAIR { + HSZ hszSvc; + HSZ hszTopic; +} HSZPAIR; + +typedef struct _ICONINFO { + WINBOOL fIcon; + DWORD xHotspot; + DWORD yHotspot; + HBITMAP hbmMask; + HBITMAP hbmColor; +} ICONINFO, *PICONINFO; + +typedef struct tagICONMETRICS { + UINT cbSize; + int iHorzSpacing; + int iVertSpacing; + int iTitleWrap; + LOGFONT lfFont; +} ICONMETRICS, *LPICONMETRICS; + +typedef struct _IMAGEINFO { + HBITMAP hbmImage; + HBITMAP hbmMask; + int Unused1; + int Unused2; + RECT rcImage; +} IMAGEINFO; + +typedef struct _KEY_EVENT_RECORD { + WINBOOL bKeyDown; + WORD wRepeatCount; + WORD wVirtualKeyCode; + WORD wVirtualScanCode; + + char AsciiChar; + char pad; +#if 0 + union { + WCHAR UnicodeChar; + CHAR AsciiChar; + } uChar; +#endif + DWORD dwControlKeyState; +} KEY_EVENT_RECORD PACKED; + +typedef struct _MOUSE_EVENT_RECORD { + COORD dwMousePosition; + DWORD dwButtonState; + DWORD dwControlKeyState; + DWORD dwEventFlags; +} MOUSE_EVENT_RECORD; + +typedef struct _WINDOW_BUFFER_SIZE_RECORD { + COORD dwSize; +} WINDOW_BUFFER_SIZE_RECORD; + +typedef struct _MENU_EVENT_RECORD { + UINT dwCommandId; +} MENU_EVENT_RECORD, *PMENU_EVENT_RECORD; + +typedef struct _INPUT_RECORD { + WORD EventType; + union { +#ifndef __cplus_plus + /* this will be the wrong size in c++ */ + KEY_EVENT_RECORD KeyEvent; +#endif + MOUSE_EVENT_RECORD MouseEvent; + WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent; + MENU_EVENT_RECORD MenuEvent; + FOCUS_EVENT_RECORD FocusEvent; + } Event; +} INPUT_RECORD, *PINPUT_RECORD; + +typedef struct _SYSTEMTIME { + WORD wYear; + WORD wMonth; + WORD wDayOfWeek; + WORD wDay; + WORD wHour; + WORD wMinute; + WORD wSecond; + WORD wMilliseconds; +} SYSTEMTIME, *LPSYSTEMTIME; + +typedef struct _JOB_INFO_1 { + DWORD JobId; + LPTSTR pPrinterName; + LPTSTR pMachineName; + LPTSTR pUserName; + LPTSTR pDocument; + LPTSTR pDatatype; + LPTSTR pStatus; + DWORD Status; + DWORD Priority; + DWORD Position; + DWORD TotalPages; + DWORD PagesPrinted; + SYSTEMTIME Submitted; +} JOB_INFO_1; + +typedef struct _SID_IDENTIFIER_AUTHORITY { + BYTE Value[6]; +} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY, + *LPSID_IDENTIFIER_AUTHORITY; + +typedef struct _SID { + BYTE Revision; + BYTE SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + DWORD SubAuthority[ANYSIZE_ARRAY]; +} SID, *PSID; + +typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; + +typedef struct _SECURITY_DESCRIPTOR { + BYTE Revision; + BYTE Sbz1; + SECURITY_DESCRIPTOR_CONTROL Control; + PSID Owner; + PSID Group; + PACL Sacl; + PACL Dacl; +} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR; + +typedef struct _JOB_INFO_2 { + DWORD JobId; + LPTSTR pPrinterName; + LPTSTR pMachineName; + LPTSTR pUserName; + LPTSTR pDocument; + LPTSTR pNotifyName; + LPTSTR pDatatype; + LPTSTR pPrintProcessor; + LPTSTR pParameters; + LPTSTR pDriverName; + LPDEVMODE pDevMode; + LPTSTR pStatus; + PSECURITY_DESCRIPTOR pSecurityDescriptor; + DWORD Status; + DWORD Priority; + DWORD Position; + DWORD StartTime; + DWORD UntilTime; + DWORD TotalPages; + DWORD Size; + SYSTEMTIME Submitted; + DWORD Time; + DWORD PagesPrinted ; +} JOB_INFO_2; + +typedef struct tagKERNINGPAIR { + WORD wFirst; + WORD wSecond; + int iKernAmount; +} KERNINGPAIR, *LPKERNINGPAIR; + +typedef struct _LANA_ENUM { + UCHAR length; + UCHAR lana[MAX_LANA]; +} LANA_ENUM; + +typedef struct _LDT_ENTRY { + WORD LimitLow; + WORD BaseLow; + union { + struct { + BYTE BaseMid; + BYTE Flags1; + BYTE Flags2; + BYTE BaseHi; + } Bytes; + struct { + DWORD BaseMid : 8; + DWORD Type : 5; + DWORD Dpl : 2; + DWORD Pres : 1; + DWORD LimitHi : 4; + DWORD Sys : 1; + DWORD Reserved_0 : 1; + DWORD Default_Big : 1; + DWORD Granularity : 1; + DWORD BaseHi : 8; + } Bits; + } HighWord; +} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY; + +typedef struct tagLOCALESIGNATURE { + DWORD lsUsb[4]; + DWORD lsCsbDefault[2]; + DWORD lsCsbSupported[2]; +} LOCALESIGNATURE; + +typedef struct _LOCALGROUP_MEMBERS_INFO_0 { + PSID lgrmi0_sid; +} LOCALGROUP_MEMBERS_INFO_0; + +typedef struct _LOCALGROUP_MEMBERS_INFO_3 { + LPWSTR lgrmi3_domainandname; +} LOCALGROUP_MEMBERS_INFO_3; + +typedef long FXPT16DOT16, * LPFXPT16DOT16; + +typedef LARGE_INTEGER LUID, *PLUID; + +typedef struct _LUID_AND_ATTRIBUTES { + LUID Luid; + DWORD Attributes; +} LUID_AND_ATTRIBUTES; + +typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; +typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; + +typedef struct _LV_COLUMN { + UINT mask; + int fmt; + int cx; + LPTSTR pszText; + int cchTextMax; + int iSubItem; +} LV_COLUMN; + +typedef struct _LV_ITEM { + UINT mask; + int iItem; + int iSubItem; + UINT state; + UINT stateMask; + LPTSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; +} LV_ITEM; + +typedef struct tagLV_DISPINFO { + NMHDR hdr; + LV_ITEM item; +} LV_DISPINFO; + +typedef struct _LV_FINDINFO { + UINT flags; + LPCTSTR psz; + LPARAM lParam; + POINT pt; + UINT vkDirection; +} LV_FINDINFO; + +typedef struct _LV_HITTESTINFO { + POINT pt; + UINT flags; + int iItem; +} LV_HITTESTINFO; + +typedef struct tagLV_KEYDOWN { + NMHDR hdr; + WORD wVKey; + UINT flags; +} LV_KEYDOWN; + +typedef struct _MAT2 { + FIXED eM11; + FIXED eM12; + FIXED eM21; + FIXED eM22; +} MAT2; + +typedef struct tagMDICREATESTRUCT { + LPCTSTR szClass; + LPCTSTR szTitle; + HANDLE hOwner; + int x; + int y; + int cx; + int cy; + DWORD style; + LPARAM lParam; +} MDICREATESTRUCT; + +typedef MDICREATESTRUCT *LPMDICREATESTRUCT; + +typedef struct tagMEASUREITEMSTRUCT { + UINT CtlType; + UINT CtlID; + UINT itemID; + UINT itemWidth; + UINT itemHeight; + DWORD itemData; +} MEASUREITEMSTRUCT, *LPMEASUREITEMSTRUCT; + +typedef struct _MEMORY_BASIC_INFORMATION { + PVOID BaseAddress; + PVOID AllocationBase; + DWORD AllocationProtect; + DWORD RegionSize; + DWORD State; + DWORD Protect; + DWORD Type; +} MEMORY_BASIC_INFORMATION; +typedef MEMORY_BASIC_INFORMATION *PMEMORY_BASIC_INFORMATION; + +typedef struct _MEMORYSTATUS { + DWORD dwLength; + DWORD dwMemoryLoad; + DWORD dwTotalPhys; + DWORD dwAvailPhys; + DWORD dwTotalPageFile; + DWORD dwAvailPageFile; + DWORD dwTotalVirtual; + DWORD dwAvailVirtual; +} MEMORYSTATUS, *LPMEMORYSTATUS; + +typedef struct { + WORD wVersion; + WORD wOffset; + DWORD dwHelpId; +} MENUEX_TEMPLATE_HEADER; + +typedef struct { + DWORD dwType; + DWORD dwState; + UINT uId; + BYTE bResInfo; + WCHAR szText[1]; + DWORD dwHelpId; +} MENUEX_TEMPLATE_ITEM; + +typedef struct tagMENUITEMINFO { + UINT cbSize; + UINT fMask; + UINT fType; + UINT fState; + UINT wID; + HMENU hSubMenu; + HBITMAP hbmpChecked; + HBITMAP hbmpUnchecked; + DWORD dwItemData; + LPTSTR dwTypeData; + UINT cch; +} MENUITEMINFO, *LPMENUITEMINFO; +typedef MENUITEMINFO CONST *LPCMENUITEMINFO; + +typedef struct { + WORD mtOption; + WORD mtID; + WCHAR mtString[1]; +} MENUITEMTEMPLATE; + +typedef struct { + WORD versionNumber; + WORD offset; +} MENUITEMTEMPLATEHEADER; +typedef VOID MENUTEMPLATE, *LPMENUTEMPLATE; + +typedef struct tagMETAFILEPICT { + LONG mm; + LONG xExt; + LONG yExt; + HMETAFILE hMF; +} METAFILEPICT, *PMETAFILEPICT, *LPMETAFILEPICT; + +typedef struct tagMETAHEADER { + WORD mtType; + WORD mtHeaderSize; + WORD mtVersion; + DWORD mtSize; + WORD mtNoObjects; + DWORD mtMaxRecord; + WORD mtNoParameters; +} METAHEADER PACKED; + +typedef struct tagMETARECORD { + DWORD rdSize; + WORD rdFunction; + WORD rdParm[1]; +} METARECORD, *LPMETARECORD; + +typedef struct tagMINIMIZEDMETRICS { + UINT cbSize; + int iWidth; + int iHorzGap; + int iVertGap; + int iArrange; +} MINIMIZEDMETRICS, *LPMINIMIZEDMETRICS; + +typedef struct tagMINMAXINFO { + POINT ptReserved; + POINT ptMaxSize; + POINT ptMaxPosition; + POINT ptMinTrackSize; + POINT ptMaxTrackSize; +} MINMAXINFO; + +typedef struct modemdevcaps_tag { + DWORD dwActualSize; + DWORD dwRequiredSize; + DWORD dwDevSpecificOffset; + DWORD dwDevSpecificSize; + + DWORD dwModemProviderVersion; + DWORD dwModemManufacturerOffset; + DWORD dwModemManufacturerSize; + DWORD dwModemModelOffset; + DWORD dwModemModelSize; + DWORD dwModemVersionOffset; + DWORD dwModemVersionSize; + + DWORD dwDialOptions; + DWORD dwCallSetupFailTimer; + DWORD dwInactivityTimeout; + DWORD dwSpeakerVolume; + DWORD dwSpeakerMode; + DWORD dwModemOptions; + DWORD dwMaxDTERate; + DWORD dwMaxDCERate; + + BYTE abVariablePortion [1]; +} MODEMDEVCAPS, *PMODEMDEVCAPS, *LPMODEMDEVCAPS; + +typedef struct modemsettings_tag { + DWORD dwActualSize; + DWORD dwRequiredSize; + DWORD dwDevSpecificOffset; + DWORD dwDevSpecificSize; + + DWORD dwCallSetupFailTimer; + DWORD dwInactivityTimeout; + DWORD dwSpeakerVolume; + DWORD dwSpeakerMode; + DWORD dwPreferredModemOptions; + + DWORD dwNegotiatedModemOptions; + DWORD dwNegotiatedDCERate; + + BYTE abVariablePortion[1]; +} MODEMSETTINGS, *PMODEMSETTINGS, *LPMODEMSETTINGS; + +typedef struct tagMONCBSTRUCT { + UINT cb; + DWORD dwTime; + HANDLE hTask; + DWORD dwRet; + UINT wType; + UINT wFmt; + HCONV hConv; + HSZ hsz1; + HSZ hsz2; + HDDEDATA hData; + DWORD dwData1; + DWORD dwData2; + CONVCONTEXT cc; + DWORD cbData; + DWORD Data[8]; +} MONCBSTRUCT; + +typedef struct tagMONCONVSTRUCT { + UINT cb; + WINBOOL fConnect; + DWORD dwTime; + HANDLE hTask; + HSZ hszSvc; + HSZ hszTopic; + HCONV hConvClient; + HCONV hConvServer; +} MONCONVSTRUCT; + +typedef struct tagMONERRSTRUCT { + UINT cb; + UINT wLastError; + DWORD dwTime; + HANDLE hTask; +} MONERRSTRUCT; + +typedef struct tagMONHSZSTRUCT { + UINT cb; + WINBOOL fsAction; + DWORD dwTime; + HSZ hsz; + HANDLE hTask; + TCHAR str[1]; +} MONHSZSTRUCT; + +typedef struct _MONITOR_INFO_1 { + LPTSTR pName; +} MONITOR_INFO_1; + +typedef struct _MONITOR_INFO_2 { + LPTSTR pName; + LPTSTR pEnvironment ; + LPTSTR pDLLName ; +} MONITOR_INFO_2; + +typedef struct tagMONLINKSTRUCT { + UINT cb; + DWORD dwTime; + HANDLE hTask; + WINBOOL fEstablished; + WINBOOL fNoData; + HSZ hszSvc; + HSZ hszTopic; + HSZ hszItem; + UINT wFmt; + WINBOOL fServer; + HCONV hConvServer; + HCONV hConvClient; +} MONLINKSTRUCT; + +typedef struct tagMONMSGSTRUCT { + UINT cb; + HWND hwndTo; + DWORD dwTime; + HANDLE hTask; + UINT wMsg; + WPARAM wParam; + LPARAM lParam; + DDEML_MSG_HOOK_DATA dmhd; +} MONMSGSTRUCT; + +typedef struct tagMOUSEHOOKSTRUCT { + POINT pt; + HWND hwnd; + UINT wHitTestCode; + DWORD dwExtraInfo; +} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT; + +typedef struct _MOUSEKEYS { + DWORD cbSize; + DWORD dwFlags; + DWORD iMaxSpeed; + DWORD iTimeToMaxSpeed; + DWORD iCtrlSpeed; + DWORD dwReserved1; + DWORD dwReserved2; +} MOUSEKEYS; + +typedef struct tagMSG { + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + DWORD time; + POINT pt; +} MSG, *LPMSG; + +typedef void CALLBACK (*MSGBOXCALLBACK) (LPHELPINFO lpHelpInfo); + +typedef struct { + UINT cbSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCSTR lpszText; + LPCSTR lpszCaption; + DWORD dwStyle; + LPCSTR lpszIcon; + DWORD dwContextHelpId; + MSGBOXCALLBACK lpfnMsgBoxCallback; + DWORD dwLanguageId; +} MSGBOXPARAMS, *PMSGBOXPARAMS, *LPMSGBOXPARAMS; + +typedef struct _msgfilter { + NMHDR nmhdr; + UINT msg; + WPARAM wParam; + LPARAM lParam; +} MSGFILTER; + +typedef struct tagMULTIKEYHELP { + DWORD mkSize; + TCHAR mkKeylist; + TCHAR szKeyphrase[1]; +} MULTIKEYHELP; + +typedef struct _NAME_BUFFER { + UCHAR name[NCBNAMSZ]; + UCHAR name_num; + UCHAR name_flags; +} NAME_BUFFER; + +typedef struct _NCB { + UCHAR ncb_command; + UCHAR ncb_retcode; + UCHAR ncb_lsn; + UCHAR ncb_num; + PUCHAR ncb_buffer; + WORD ncb_length; + UCHAR ncb_callname[NCBNAMSZ]; + UCHAR ncb_name[NCBNAMSZ]; + UCHAR ncb_rto; + UCHAR ncb_sto; + void (*ncb_post) (struct _NCB *); + UCHAR ncb_lana_num; + UCHAR ncb_cmd_cplt; + UCHAR ncb_reserve[10]; + HANDLE ncb_event; +} NCB; + +typedef struct _NCCALCSIZE_PARAMS { + RECT rgrc[3]; + PWINDOWPOS lppos; +} NCCALCSIZE_PARAMS; + +typedef struct _NDDESHAREINFO { + LONG lRevision; + LPTSTR lpszShareName; + LONG lShareType; + LPTSTR lpszAppTopicList; + LONG fSharedFlag; + LONG fService; + LONG fStartAppFlag; + LONG nCmdShow; + LONG qModifyId[2]; + LONG cNumItems; + LPTSTR lpszItemList; +}NDDESHAREINFO; + +typedef struct _NETRESOURCE { + DWORD dwScope; + DWORD dwType; + DWORD dwDisplayType; + DWORD dwUsage; + LPTSTR lpLocalName; + LPTSTR lpRemoteName; + LPTSTR lpComment; + LPTSTR lpProvider; +} NETRESOURCE, *LPNETRESOURCE; + +typedef struct tagNEWCPLINFO { + DWORD dwSize; + DWORD dwFlags; + DWORD dwHelpContext; + LONG lData; + HICON hIcon; + TCHAR szName[32]; + TCHAR szInfo[64]; + TCHAR szHelpFile[128]; +} NEWCPLINFO; + +typedef struct tagNEWTEXTMETRIC { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BCHAR tmFirstChar; + BCHAR tmLastChar; + BCHAR tmDefaultChar; + BCHAR tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; + DWORD ntmFlags; + UINT ntmSizeEM; + UINT ntmCellHeight; + UINT ntmAvgWidth; +} NEWTEXTMETRIC; + + +typedef struct tagNEWTEXTMETRICEX { + NEWTEXTMETRIC ntmentm; + FONTSIGNATURE ntmeFontSignature; +} NEWTEXTMETRICEX; + +typedef struct tagNM_LISTVIEW { + NMHDR hdr; + int iItem; + int iSubItem; + UINT uNewState; + UINT uOldState; + UINT uChanged; + POINT ptAction; + LPARAM lParam; +} NM_LISTVIEW; + +typedef struct _TREEITEM *HTREEITEM; + +typedef struct _TV_ITEM { + UINT mask; + HTREEITEM hItem; + UINT state; + UINT stateMask; + LPTSTR pszText; + int cchTextMax; + int iImage; + int iSelectedImage; + int cChildren; + LPARAM lParam; +} TV_ITEM, *LPTV_ITEM; + +typedef struct _NM_TREEVIEW { + NMHDR hdr; + UINT action; + TV_ITEM itemOld; + TV_ITEM itemNew; + POINT ptDrag; +} NM_TREEVIEW; +typedef NM_TREEVIEW *LPNM_TREEVIEW; + +typedef struct _NM_UPDOWN { + NMHDR hdr; + int iPos; + int iDelta; +} NM_UPDOWNW; + +typedef struct tagNONCLIENTMETRICS { + UINT cbSize; + int iBorderWidth; + int iScrollWidth; + int iScrollHeight; + int iCaptionWidth; + int iCaptionHeight; + LOGFONT lfCaptionFont; + int iSmCaptionWidth; + int iSmCaptionHeight; + LOGFONT lfSmCaptionFont; + int iMenuWidth; + int iMenuHeight; + LOGFONT lfMenuFont; + LOGFONT lfStatusFont; + LOGFONT lfMessageFont; +} NONCLIENTMETRICS, * LPNONCLIENTMETRICS; + +typedef struct _SERVICE_ADDRESS { + DWORD dwAddressType; + DWORD dwAddressFlags; + DWORD dwAddressLength; + DWORD dwPrincipalLength; + BYTE *lpAddress; + BYTE *lpPrincipal; +} SERVICE_ADDRESS; + +typedef struct _SERVICE_ADDRESSES { + DWORD dwAddressCount; + SERVICE_ADDRESS Addresses[1]; +} SERVICE_ADDRESSES, *LPSERVICE_ADDRESSES; + +typedef struct _GUID +{ + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; +} GUID, *LPGUID; +typedef GUID CLSID, *LPCLSID; + +typedef struct _SERVICE_INFO { + LPGUID lpServiceType; + LPTSTR lpServiceName; + LPTSTR lpComment; + LPTSTR lpLocale; + DWORD dwDisplayHint; + DWORD dwVersion; + DWORD dwTime; + LPTSTR lpMachineName; + LPSERVICE_ADDRESSES lpServiceAddress; + BLOB ServiceSpecificInfo; +} SERVICE_INFO; + +typedef struct _NS_SERVICE_INFO { + DWORD dwNameSpace; + SERVICE_INFO ServiceInfo; +} NS_SERVICE_INFO; + +typedef struct _numberfmt { + UINT NumDigits; + UINT LeadingZero; + UINT Grouping; + LPTSTR lpDecimalSep; + LPTSTR lpThousandSep; + UINT NegativeOrder; +} NUMBERFMT; + +typedef struct _OFSTRUCT { + BYTE cBytes; + BYTE fFixedDisk; + WORD nErrCode; + WORD Reserved1; + WORD Reserved2; + CHAR szPathName[OFS_MAXPATHNAME]; +} OFSTRUCT, *LPOFSTRUCT; + +typedef struct tagOFN { + DWORD lStructSize; + HWND hwndOwner; + HINSTANCE hInstance; + LPCTSTR lpstrFilter; + LPTSTR lpstrCustomFilter; + DWORD nMaxCustFilter; + DWORD nFilterIndex; + LPTSTR lpstrFile; + DWORD nMaxFile; + LPTSTR lpstrFileTitle; + DWORD nMaxFileTitle; + LPCTSTR lpstrInitialDir; + LPCTSTR lpstrTitle; + DWORD Flags; + WORD nFileOffset; + WORD nFileExtension; + LPCTSTR lpstrDefExt; + DWORD lCustData; + LPOFNHOOKPROC lpfnHook; + LPCTSTR lpTemplateName; +} OPENFILENAME, *LPOPENFILENAME; + +typedef struct _OFNOTIFY { + NMHDR hdr; + LPOPENFILENAME lpOFN; + LPTSTR pszFile; +} OFNOTIFY, *LPOFNOTIFY; + +typedef struct _OSVERSIONINFO { + DWORD dwOSVersionInfoSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + DWORD dwBuildNumber; + DWORD dwPlatformId; + TCHAR szCSDVersion[ 128 ]; +} OSVERSIONINFO, *POSVERSIONINFO, *LPOSVERSIONINFO; + +typedef struct tagTEXTMETRIC { + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG tmExternalLeading; + LONG tmAveCharWidth; + LONG tmMaxCharWidth; + LONG tmWeight; + LONG tmOverhang; + LONG tmDigitizedAspectX; + LONG tmDigitizedAspectY; + BCHAR tmFirstChar; + BCHAR tmLastChar; + BCHAR tmDefaultChar; + BCHAR tmBreakChar; + BYTE tmItalic; + BYTE tmUnderlined; + BYTE tmStruckOut; + BYTE tmPitchAndFamily; + BYTE tmCharSet; +} TEXTMETRIC, *LPTEXTMETRIC; + +typedef struct _OUTLINETEXTMETRIC { + UINT otmSize; + TEXTMETRIC otmTextMetrics; + BYTE otmFiller; + PANOSE otmPanoseNumber; + UINT otmfsSelection; + UINT otmfsType; + int otmsCharSlopeRise; + int otmsCharSlopeRun; + int otmItalicAngle; + UINT otmEMSquare; + int otmAscent; + int otmDescent; + UINT otmLineGap; + UINT otmsCapEmHeight; + UINT otmsXHeight; + RECT otmrcFontBox; + int otmMacAscent; + int otmMacDescent; + UINT otmMacLineGap; + UINT otmusMinimumPPEM; + POINT otmptSubscriptSize; + POINT otmptSubscriptOffset; + POINT otmptSuperscriptSize; + POINT otmptSuperscriptOffset; + UINT otmsStrikeoutSize; + int otmsStrikeoutPosition; + int otmsUnderscoreSize; + int otmsUnderscorePosition; + PSTR otmpFamilyName; + PSTR otmpFaceName; + PSTR otmpStyleName; + PSTR otmpFullName; +} OUTLINETEXTMETRIC, *LPOUTLINETEXTMETRIC; + +typedef struct _OVERLAPPED { + DWORD Internal; + DWORD InternalHigh; + DWORD Offset; + DWORD OffsetHigh; + HANDLE hEvent; +} OVERLAPPED, *LPOVERLAPPED; + +typedef struct tagPSD { + DWORD lStructSize; + HWND hwndOwner; + HGLOBAL hDevMode; + HGLOBAL hDevNames; + DWORD Flags; + POINT ptPaperSize; + RECT rtMinMargin; + RECT rtMargin; + HINSTANCE hInstance; + LPARAM lCustData; + LPPAGESETUPHOOK lpfnPageSetupHook; + LPPAGEPAINTHOOK lpfnPagePaintHook; + LPCTSTR lpPageSetupTemplateName; + HGLOBAL hPageSetupTemplate; +} PAGESETUPDLG, *LPPAGESETUPDLG; + +typedef struct tagPAINTSTRUCT { + HDC hdc; + WINBOOL fErase; + RECT rcPaint; + WINBOOL fRestore; + WINBOOL fIncUpdate; + BYTE rgbReserved[32]; +} PAINTSTRUCT, *LPPAINTSTRUCT; + +typedef struct _paraformat { + UINT cbSize; + DWORD dwMask; + WORD wNumbering; + WORD wReserved; + LONG dxStartIndent; + LONG dxRightIndent; + LONG dxOffset; + WORD wAlignment; + SHORT cTabCount; + LONG rgxTabs[MAX_TAB_STOPS]; +} PARAFORMAT; + +typedef struct _PERF_COUNTER_BLOCK { + DWORD ByteLength; +} PERF_COUNTER_BLOCK; + +typedef struct _PERF_COUNTER_DEFINITION { + DWORD ByteLength; + DWORD CounterNameTitleIndex; + LPWSTR CounterNameTitle; + DWORD CounterHelpTitleIndex; + LPWSTR CounterHelpTitle; + DWORD DefaultScale; + DWORD DetailLevel; + DWORD CounterType; + DWORD CounterSize; + DWORD CounterOffset; +} PERF_COUNTER_DEFINITION; + +typedef struct _PERF_DATA_BLOCK { + WCHAR Signature[4]; + DWORD LittleEndian; + DWORD Version; + DWORD Revision; + DWORD TotalByteLength; + DWORD HeaderLength; + DWORD NumObjectTypes; + DWORD DefaultObject; + SYSTEMTIME SystemTime; + LARGE_INTEGER PerfTime; + LARGE_INTEGER PerfFreq; + LARGE_INTEGER PerfTime100nSec; + DWORD SystemNameLength; + DWORD SystemNameOffset; +} PERF_DATA_BLOCK; + +typedef struct _PERF_INSTANCE_DEFINITION { + DWORD ByteLength; + DWORD ParentObjectTitleIndex; + DWORD ParentObjectInstance; + DWORD UniqueID; + DWORD NameOffset; + DWORD NameLength; +} PERF_INSTANCE_DEFINITION; + +typedef struct _PERF_OBJECT_TYPE { + DWORD TotalByteLength; + DWORD DefinitionLength; + DWORD HeaderLength; + DWORD ObjectNameTitleIndex; + LPWSTR ObjectNameTitle; + DWORD ObjectHelpTitleIndex; + LPWSTR ObjectHelpTitle; + DWORD DetailLevel; + DWORD NumCounters; + DWORD DefaultCounter; + DWORD NumInstances; + DWORD CodePage; + LARGE_INTEGER PerfTime; + LARGE_INTEGER PerfFreq; +} PERF_OBJECT_TYPE; + +typedef struct _POLYTEXT { + int x; + int y; + UINT n; + LPCTSTR lpstr; + UINT uiFlags; + RECT rcl; + int *pdx; +} POLYTEXT; + +typedef struct _PORT_INFO_1 { + LPTSTR pName; +} PORT_INFO_1; + +typedef struct _PORT_INFO_2 { + LPSTR pPortName; + LPSTR pMonitorName; + LPSTR pDescription; + DWORD fPortType; + DWORD Reserved; +} PORT_INFO_2; + +typedef struct _PREVENT_MEDIA_REMOVAL { + BOOLEAN PreventMediaRemoval; +} PREVENT_MEDIA_REMOVAL ; + +typedef struct tagPD { + DWORD lStructSize; + HWND hwndOwner; + HANDLE hDevMode; + HANDLE hDevNames; + HDC hDC; + DWORD Flags; + WORD nFromPage; + WORD nToPage; + WORD nMinPage; + WORD nMaxPage; + WORD nCopies; + HINSTANCE hInstance; + DWORD lCustData; + LPPRINTHOOKPROC lpfnPrintHook; + LPSETUPHOOKPROC lpfnSetupHook; + LPCTSTR lpPrintTemplateName; + LPCTSTR lpSetupTemplateName; + HANDLE hPrintTemplate; + HANDLE hSetupTemplate; +} PRINTDLG PACKED, *LPPRINTDLG PACKED; + +typedef struct _PRINTER_DEFAULTS { + LPTSTR pDatatype; + LPDEVMODE pDevMode; + ACCESS_MASK DesiredAccess; +} PRINTER_DEFAULTS; + +typedef struct _PRINTER_INFO_1 { + DWORD Flags; + LPTSTR pDescription; + LPTSTR pName; + LPTSTR pComment; +} PRINTER_INFO_1, *PPRINTER_INFO_1, *LPPRINTER_INFO_1; + +typedef struct _PRINTER_INFO_2 { + LPTSTR pServerName; + LPTSTR pPrinterName; + LPTSTR pShareName; + LPTSTR pPortName; + LPTSTR pDriverName; + LPTSTR pComment; + LPTSTR pLocation; + LPDEVMODE pDevMode; + LPTSTR pSepFile; + LPTSTR pPrintProcessor; + LPTSTR pDatatype; + LPTSTR pParameters; + PSECURITY_DESCRIPTOR pSecurityDescriptor; + DWORD Attributes; + DWORD Priority; + DWORD DefaultPriority; + DWORD StartTime; + DWORD UntilTime; + DWORD Status; + DWORD cJobs; + DWORD AveragePPM; +} PRINTER_INFO_2; + +typedef struct _PRINTER_INFO_3 { + PSECURITY_DESCRIPTOR pSecurityDescriptor; +} PRINTER_INFO_3; + +typedef struct _PRINTER_INFO_4 { + LPTSTR pPrinterName; + LPTSTR pServerName; + DWORD Attributes; +} PRINTER_INFO_4; + +typedef struct _PRINTER_INFO_5 { + LPTSTR pPrinterName; + LPTSTR pPortName; + DWORD Attributes; + DWORD DeviceNotSelectedTimeout; + DWORD TransmissionRetryTimeout; +} PRINTER_INFO_5; + +typedef struct _PRINTER_NOTIFY_INFO_DATA { + WORD Type; + WORD Field; + DWORD Reserved; + DWORD Id; + union { + DWORD adwData[2]; + struct { + DWORD cbBuf; + LPVOID pBuf; + } Data; + } NotifyData; +} PRINTER_NOTIFY_INFO_DATA; + +typedef struct _PRINTER_NOTIFY_INFO { + DWORD Version; + DWORD Flags; + DWORD Count; + PRINTER_NOTIFY_INFO_DATA aData[1]; +} PRINTER_NOTIFY_INFO; + +typedef struct _PRINTER_NOTIFY_OPTIONS_TYPE { + WORD Type; + WORD Reserved0; + DWORD Reserved1; + DWORD Reserved2; + DWORD Count; + PWORD pFields; +} PRINTER_NOTIFY_OPTIONS_TYPE, *PPRINTER_NOTIFY_OPTIONS_TYPE; + +typedef struct _PRINTER_NOTIFY_OPTIONS { + DWORD Version; + DWORD Flags; + DWORD Count; + PPRINTER_NOTIFY_OPTIONS_TYPE pTypes; +} PRINTER_NOTIFY_OPTIONS; + +typedef struct _PRINTPROCESSOR_INFO_1 { + LPTSTR pName; +} PRINTPROCESSOR_INFO_1; + +typedef struct _PRIVILEGE_SET { + DWORD PrivilegeCount; + DWORD Control; + LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; +} PRIVILEGE_SET, *PPRIVILEGE_SET, *LPPRIVILEGE_SET; + +typedef struct _PROCESS_HEAP_ENTRY { + PVOID lpData; + DWORD cbData; + BYTE cbOverhead; + BYTE iRegionIndex; + WORD wFlags; + DWORD dwCommittedSize; + DWORD dwUnCommittedSize; + LPVOID lpFirstBlock; + LPVOID lpLastBlock; + HANDLE hMem; +} PROCESS_HEAPENTRY, *LPPROCESS_HEAP_ENTRY; + +typedef struct _PROCESS_INFORMATION { + HANDLE hProcess; + HANDLE hThread; + DWORD dwProcessId; + DWORD dwThreadId; +} PROCESS_INFORMATION, *LPPROCESS_INFORMATION; + +typedef UINT CALLBACK (*LPFNPSPCALLBACK) (HWND, UINT, LPVOID); + +typedef struct _PROPSHEETPAGE { + DWORD dwSize; + DWORD dwFlags; + HINSTANCE hInstance; + union { + LPCTSTR pszTemplate; + LPCDLGTEMPLATE pResource; + } u1; + union { + HICON hIcon; + LPCTSTR pszIcon; + } u2; + LPCTSTR pszTitle; + DLGPROC pfnDlgProc; + LPARAM lParam; + LPFNPSPCALLBACK pfnCallback; + UINT * pcRefParent; +} PROPSHEETPAGE, *LPPROPSHEETPAGE; +typedef const PROPSHEETPAGE *LPCPROPSHEETPAGE; + +typedef struct _PSP *HPROPSHEETPAGE; +typedef struct _PROPSHEETHEADER { + DWORD dwSize; + DWORD dwFlags; + HWND hwndParent; + HINSTANCE hInstance; + union { + HICON hIcon; + LPCTSTR pszIcon; + } u1; + LPCTSTR pszCaption; + UINT nPages; + union { + UINT nStartPage; + LPCTSTR pStartPage; + } u2; + union { + LPCPROPSHEETPAGE ppsp; + HPROPSHEETPAGE *phpage; + } u3; + PFNPROPSHEETCALLBACK pfnCallback; +} PROPSHEETHEADER, *LPPROPSHEETHEADER; +typedef const PROPSHEETHEADER *LPCPROPSHEETHEADER; + +/* PropertySheet callbacks */ +typedef WINBOOL CALLBACK (*LPFNADDPROPSHEETPAGE) (HPROPSHEETPAGE, LPARAM); +typedef WINBOOL CALLBACK (*LPFNADDPROPSHEETPAGES) (LPVOID, + LPFNADDPROPSHEETPAGE, + LPARAM); + +typedef struct _PROTOCOL_INFO { + DWORD dwServiceFlags; + INT iAddressFamily; + INT iMaxSockAddr; + INT iMinSockAddr; + INT iSocketType; + INT iProtocol; + DWORD dwMessageSize; + LPTSTR lpProtocol; +} PROTOCOL_INFO; + +typedef struct _PROVIDOR_INFO_1 { + LPTSTR pName; + LPTSTR pEnvironment ; + LPTSTR pDLLName ; +} PROVIDOR_INFO_1; + +typedef struct _PSHNOTIFY { + NMHDR hdr; + LPARAM lParam; +} PSHNOTIFY, *LPPSHNOTIFY; + +typedef struct _punctuation { + UINT iSize; + LPSTR szPunctuation; +} PUNCTUATION; + +typedef struct _QUERY_SERVICE_CONFIG { + DWORD dwServiceType; + DWORD dwStartType; + DWORD dwErrorControl; + LPTSTR lpBinaryPathName; + LPTSTR lpLoadOrderGroup; + DWORD dwTagId; + LPTSTR lpDependencies; + LPTSTR lpServiceStartName; + LPTSTR lpDisplayName; +} QUERY_SERVICE_CONFIG, *LPQUERY_SERVICE_CONFIG; + +typedef struct _QUERY_SERVICE_LOCK_STATUS { + DWORD fIsLocked; + LPTSTR lpLockOwner; + DWORD dwLockDuration; +} QUERY_SERVICE_LOCK_STATUS, *LPQUERY_SERVICE_LOCK_STATUS ; + +typedef struct _RASAMB { + DWORD dwSize; + DWORD dwError; + TCHAR szNetBiosError[ NETBIOS_NAME_LEN + 1 ]; + BYTE bLana; +} RASAMB; + +typedef struct _RASCONN { + DWORD dwSize; + HRASCONN hrasconn; + TCHAR szEntryName[RAS_MaxEntryName + 1]; + + CHAR szDeviceType[ RAS_MaxDeviceType + 1 ]; + CHAR szDeviceName[ RAS_MaxDeviceName + 1 ]; +} RASCONN ; + +typedef struct _RASCONNSTATUS { + DWORD dwSize; + RASCONNSTATE rasconnstate; + DWORD dwError; + TCHAR szDeviceType[RAS_MaxDeviceType + 1]; + TCHAR szDeviceName[RAS_MaxDeviceName + 1]; +} RASCONNSTATUS; + +typedef struct _RASDIALEXTENSIONS { + DWORD dwSize; + DWORD dwfOptions; + HWND hwndParent; + DWORD reserved; +} RASDIALEXTENSIONS; + +typedef struct _RASDIALPARAMS { + DWORD dwSize; + TCHAR szEntryName[RAS_MaxEntryName + 1]; + TCHAR szPhoneNumber[RAS_MaxPhoneNumber + 1]; + TCHAR szCallbackNumber[RAS_MaxCallbackNumber + 1]; + TCHAR szUserName[UNLEN + 1]; + TCHAR szPassword[PWLEN + 1]; + TCHAR szDomain[DNLEN + 1] ; +} RASDIALPARAMS; + +typedef struct _RASENTRYNAME { + DWORD dwSize; + TCHAR szEntryName[RAS_MaxEntryName + 1]; +}RASENTRYNAME; + +typedef struct _RASPPPIP { + DWORD dwSize; + DWORD dwError; + TCHAR szIpAddress[ RAS_MaxIpAddress + 1 ]; +} RASPPPIP; + +typedef struct _RASPPPIPX { + DWORD dwSize; + DWORD dwError; + TCHAR szIpxAddress[ RAS_MaxIpxAddress + 1 ]; +} RASPPPIPX; + +typedef struct _RASPPPNBF { + DWORD dwSize; + DWORD dwError; + DWORD dwNetBiosError; + TCHAR szNetBiosError[ NETBIOS_NAME_LEN + 1 ]; + TCHAR szWorkstationName[ NETBIOS_NAME_LEN + 1 ]; + BYTE bLana; +} RASPPPNBF; + +typedef struct _RASTERIZER_STATUS { + short nSize; + short wFlags; + short nLanguageID; +} RASTERIZER_STATUS, *LPRASTERIZER_STATUS; + +typedef struct _REASSIGN_BLOCKS { + WORD Reserved; + WORD Count; + DWORD BlockNumber[1]; +} REASSIGN_BLOCKS ; + +typedef struct _REMOTE_NAME_INFO { + LPTSTR lpUniversalName; + LPTSTR lpConnectionName; + LPTSTR lpRemainingPath; +} REMOTE_NAME_INFO; + +/* + TODO: OLE +typedef struct _reobject { + DWORD cbStruct; + LONG cp; + CLSID clsid; + LPOLEOBJECT poleobj; + LPSTORAGE pstg; + LPOLECLIENTSITE polesite; + SIZEL sizel; + DWORD dvaspect; + DWORD dwFlags; + DWORD dwUser; +} REOBJECT; +*/ + +typedef struct _repastespecial { + DWORD dwAspect; + DWORD dwParam; +} REPASTESPECIAL; + +typedef struct _reqresize { + NMHDR nmhdr; + RECT rc; +} REQRESIZE; + +typedef struct _RGNDATAHEADER { + DWORD dwSize; + DWORD iType; + DWORD nCount; + DWORD nRgnSize; + RECT rcBound; +} RGNDATAHEADER; + +typedef struct _RGNDATA { + RGNDATAHEADER rdh; + char Buffer[1]; +} RGNDATA, *LPRGNDATA; + +typedef struct tagSCROLLINFO { + UINT cbSize; + UINT fMask; + int nMin; + int nMax; + UINT nPage; + int nPos; + int nTrackPos; +} SCROLLINFO, *LPSCROLLINFO; +typedef SCROLLINFO const *LPCSCROLLINFO; + +typedef struct _SECURITY_ATTRIBUTES { + DWORD nLength; + LPVOID lpSecurityDescriptor; + WINBOOL bInheritHandle; +} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; + +typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION; + +typedef struct _selchange { + NMHDR nmhdr; + CHARRANGE chrg; + WORD seltyp; +} SELCHANGE; + +typedef struct tagSERIALKEYS { + DWORD cbSize; + DWORD dwFlags; + LPSTR lpszActivePort; + LPSTR lpszPort; + DWORD iBaudRate; + DWORD iPortState; +} SERIALKEYS, * LPSERIALKEYS; + +typedef struct _SERVICE_TABLE_ENTRY { + LPTSTR lpServiceName; + LPSERVICE_MAIN_FUNCTION lpServiceProc; +} SERVICE_TABLE_ENTRY, *LPSERVICE_TABLE_ENTRY; + +typedef struct _SERVICE_TYPE_VALUE_ABS { + DWORD dwNameSpace; + DWORD dwValueType; + DWORD dwValueSize; + LPTSTR lpValueName; + PVOID lpValue; +} SERVICE_TYPE_VALUE_ABS; + +typedef struct _SERVICE_TYPE_INFO_ABS { + LPTSTR lpTypeName; + DWORD dwValueCount; + SERVICE_TYPE_VALUE_ABS Values[1]; +} SERVICE_TYPE_INFO_ABS; + +typedef struct _SESSION_BUFFER { + UCHAR lsn; + UCHAR state; + UCHAR local_name[NCBNAMSZ]; + UCHAR remote_name[NCBNAMSZ]; + UCHAR rcvs_outstanding; + UCHAR sends_outstanding; +} SESSION_BUFFER; + +typedef struct _SESSION_HEADER { + UCHAR sess_name; + UCHAR num_sess; + UCHAR rcv_dg_outstanding; + UCHAR rcv_any_outstanding; +} SESSION_HEADER; + +typedef struct _SET_PARTITION_INFORMATION { + BYTE PartitionType; +} SET_PARTITION_INFORMATION ; + +typedef enum tagSHCONTF { + SHCONTF_FOLDERS = 32, + SHCONTF_NONFOLDERS = 64, + SHCONTF_INCLUDEHIDDEN = 128, +} SHCONTF; + +typedef struct _SHFILEINFO { + HICON hIcon; + int iIcon; + DWORD dwAttributes; + char szDisplayName[MAX_PATH]; + char szTypeName[80]; +} SHFILEINFO; + +typedef WORD FILEOP_FLAGS; +typedef struct _SHFILEOPSTRUCT { + HWND hwnd; + UINT wFunc; + LPCSTR pFrom; + LPCSTR pTo; + FILEOP_FLAGS fFlags; + WINBOOL fAnyOperationsAborted; + LPVOID hNameMappings; + LPCSTR lpszProgressTitle; +} SHFILEOPSTRUCT, *LPSHFILEOPSTRUCT; + +typedef enum tagSHGDN { + SHGDN_NORMAL = 0, + SHGDN_INFOLDER = 1, + SHGDN_FORPARSING = 0x8000, +} SHGNO; + +typedef struct _SHNAMEMAPPING { + LPSTR pszOldPath; + LPSTR pszNewPath; + int cchOldPath; + int cchNewPath; +} SHNAMEMAPPING, *LPSHNAMEMAPPING; + +typedef struct _SID_AND_ATTRIBUTES { + PSID Sid; + DWORD Attributes; +} SID_AND_ATTRIBUTES ; + +typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; +typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; + +typedef struct _SINGLE_LIST_ENTRY { + struct _SINGLE_LIST_ENTRY *Next; +} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; + +typedef struct tagSOUNDSENTRY { + UINT cbSize; + DWORD dwFlags; + DWORD iFSTextEffect; + DWORD iFSTextEffectMSec; + DWORD iFSTextEffectColorBits; + DWORD iFSGrafEffect; + DWORD iFSGrafEffectMSec; + DWORD iFSGrafEffectColor; + DWORD iWindowsEffect; + DWORD iWindowsEffectMSec; + LPTSTR lpszWindowsEffectDLL; + DWORD iWindowsEffectOrdinal; +} SOUNDSENTRY, *LPSOUNDSENTRY; + +typedef struct _STARTUPINFO { + DWORD cb; + LPTSTR lpReserved; + LPTSTR lpDesktop; + LPTSTR lpTitle; + DWORD dwX; + DWORD dwY; + DWORD dwXSize; + DWORD dwYSize; + DWORD dwXCountChars; + DWORD dwYCountChars; + DWORD dwFillAttribute; + DWORD dwFlags; + WORD wShowWindow; + WORD cbReserved2; + LPBYTE lpReserved2; + HANDLE hStdInput; + HANDLE hStdOutput; + HANDLE hStdError; +} STARTUPINFO, *LPSTARTUPINFO; + +typedef struct tagSTICKYKEYS { + DWORD cbSize; + DWORD dwFlags; +} STICKYKEYS, *LPSTICKYKEYS; + +typedef struct _STRRET { + UINT uType; + union + { + LPWSTR pOleStr; + UINT uOffset; + char cStr[MAX_PATH]; + } DUMMYUNIONNAME; +} STRRET, *LPSTRRET; + +typedef struct _tagSTYLEBUF { + DWORD dwStyle; + CHAR szDescription[32]; +} STYLEBUF, *LPSTYLEBUF; + +typedef struct tagSTYLESTRUCT { + DWORD styleOld; + DWORD styleNew; +} STYLESTRUCT, * LPSTYLESTRUCT; + +typedef struct _SYSTEM_AUDIT_ACE { + ACE_HEADER Header; + ACCESS_MASK Mask; + DWORD SidStart; +} SYSTEM_AUDIT_ACE; + +typedef struct _SYSTEM_INFO +{ + union + { + DWORD dwOemId; + struct + { + WORD wProcessorArchitecture; + WORD wReserved; + } + s; + } + u; + DWORD dwPageSize; + LPVOID lpMinimumApplicationAddress; + LPVOID lpMaximumApplicationAddress; + DWORD dwActiveProcessorMask; + DWORD dwNumberOfProcessors; + DWORD dwProcessorType; + DWORD dwAllocationGranularity; + WORD wProcessorLevel; + WORD wProcessorRevision; +} SYSTEM_INFO, *LPSYSTEM_INFO; + +typedef struct _SYSTEM_POWER_STATUS { + BYTE ACLineStatus; + BYTE BatteryFlag; + BYTE BatteryLifePercent; + BYTE Reserved1; + DWORD BatteryLifeTime; + DWORD BatteryFullLifeTime; +} SYSTEM_POWER_STATUS; +typedef struct SYSTEM_POWER_STATUS *LPSYSTEM_POWER_STATUS; + +typedef struct _TAPE_ERASE { + ULONG Type; +} TAPE_ERASE; + +typedef struct _TAPE_GET_DRIVE_PARAMETERS { + BOOLEAN ECC; + BOOLEAN Compression; + BOOLEAN DataPadding; + BOOLEAN ReportSetmarks; + ULONG DefaultBlockSize; + ULONG MaximumBlockSize; + ULONG MinimumBlockSize; + ULONG MaximumPartitionCount; + ULONG FeaturesLow; + ULONG FeaturesHigh; + ULONG EOTWarningZoneSize; +} TAPE_GET_DRIVE_PARAMETERS; + +typedef struct _TAPE_GET_MEDIA_PARAMETERS { + LARGE_INTEGER Capacity; + LARGE_INTEGER Remaining; + DWORD BlockSize; + DWORD PartitionCount; + BOOLEAN WriteProtected; +} TAPE_GET_MEDIA_PARAMETERS; + +typedef struct _TAPE_GET_POSITION { + ULONG Type; + ULONG Partition; + ULONG OffsetLow; + ULONG OffsetHigh; +} TAPE_GET_POSITION; + +typedef struct _TAPE_PREPARE { + ULONG Operation; +} TAPE_PREPARE; + +typedef struct _TAPE_SET_DRIVE_PARAMETERS { + BOOLEAN ECC; + BOOLEAN Compression; + BOOLEAN DataPadding; + BOOLEAN ReportSetmarks; + ULONG EOTWarningZoneSize; +} TAPE_SET_DRIVE_PARAMETERS; + +typedef struct _TAPE_SET_MEDIA_PARAMETERS { + ULONG BlockSize; +} TAPE_SET_MEDIA_PARAMETERS; + +typedef struct _TAPE_SET_POSITION { + ULONG Method; + ULONG Partition; + ULONG OffsetLow; + ULONG OffsetHigh; +} TAPE_SET_POSITION; + +typedef struct _TAPE_WRITE_MARKS { + ULONG Type; + ULONG Count; +} TAPE_WRITE_MARKS; + +typedef struct { + HINSTANCE hInst; + UINT nID; +} TBADDBITMAP, *LPTBADDBITMAP; + +typedef struct _TBBUTTON { + int iBitmap; + int idCommand; + BYTE fsState; + BYTE fsStyle; + DWORD dwData; + int iString; +} TBBUTTON, * PTBBUTTON, * LPTBBUTTON; +typedef const TBBUTTON * LPCTBBUTTON; + +typedef struct { + NMHDR hdr; + int iItem; + TBBUTTON tbButton; + int cchText; + LPTSTR pszText; +} TBNOTIFY, *LPTBNOTIFY; + +typedef struct { + HKEY hkr; + LPCTSTR pszSubKey; + LPCTSTR pszValueName; +} TBSAVEPARAMS; + +typedef struct _TC_HITTESTINFO { + POINT pt; + UINT flags; +} TC_HITTESTINFO; + +typedef struct _TC_ITEM { + UINT mask; + UINT lpReserved1; + UINT lpReserved2; + LPTSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; +} TC_ITEM; + +typedef struct _TC_ITEMHEADER { + UINT mask; + UINT lpReserved1; + UINT lpReserved2; + LPTSTR pszText; + int cchTextMax; + int iImage; +} TC_ITEMHEADER; + +typedef struct _TC_KEYDOWN { + NMHDR hdr; + WORD wVKey; + UINT flags; +} TC_KEYDOWN; + +typedef struct _textrange { + CHARRANGE chrg; + LPSTR lpstrText; +} TEXTRANGE; + +typedef struct _TIME_ZONE_INFORMATION { + LONG Bias; + WCHAR StandardName[ 32 ]; + SYSTEMTIME StandardDate; + LONG StandardBias; + WCHAR DaylightName[ 32 ]; + SYSTEMTIME DaylightDate; + LONG DaylightBias; +} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION; + +typedef struct tagTOGGLEKEYS { + DWORD cbSize; + DWORD dwFlags; +} TOGGLEKEYS; + +typedef struct _TOKEN_SOURCE { + CHAR SourceName[8]; + LUID SourceIdentifier; +} TOKEN_SOURCE; + +typedef struct _TOKEN_CONTROL { + LUID TokenId; + LUID AuthenticationId; + LUID ModifiedId; + TOKEN_SOURCE TokenSource; +} TOKEN_CONTROL ; + +typedef struct _TOKEN_DEFAULT_DACL { + PACL DefaultDacl; +} TOKEN_DEFAULT_DACL; + +typedef struct _TOKEN_GROUPS { + DWORD GroupCount; + SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; +} TOKEN_GROUPS, *PTOKEN_GROUPS, *LPTOKEN_GROUPS; + +typedef struct _TOKEN_OWNER { + PSID Owner; +} TOKEN_OWNER; + +typedef struct _TOKEN_PRIMARY_GROUP { + PSID PrimaryGroup; +} TOKEN_PRIMARY_GROUP; + +typedef struct _TOKEN_PRIVILEGES { + DWORD PrivilegeCount; + LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; +} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES, *LPTOKEN_PRIVILEGES; + +typedef struct _TOKEN_STATISTICS { + LUID TokenId; + LUID AuthenticationId; + LARGE_INTEGER ExpirationTime; + TOKEN_TYPE TokenType; + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; + DWORD DynamicCharged; + DWORD DynamicAvailable; + DWORD GroupCount; + DWORD PrivilegeCount; + LUID ModifiedId; +} TOKEN_STATISTICS; + +typedef struct _TOKEN_USER { + SID_AND_ATTRIBUTES User; +} TOKEN_USER; + +typedef struct { + UINT cbSize; + UINT uFlags; + HWND hwnd; + UINT uId; + RECT rect; + HINSTANCE hinst; + LPTSTR lpszText; +} TOOLINFO, *PTOOLINFO, *LPTOOLINFO; + +typedef struct { + NMHDR hdr; + LPTSTR lpszText; + char szText[80]; + HINSTANCE hinst; + UINT uFlags; +} TOOLTIPTEXT, *LPTOOLTIPTEXT; + +typedef struct tagTPMPARAMS { + UINT cbSize; + RECT rcExclude; +} TPMPARAMS, *LPTPMPARAMS; + +typedef struct _TRANSMIT_FILE_BUFFERS { + PVOID Head; + DWORD HeadLength; + PVOID Tail; + DWORD TailLength; +} TRANSMIT_FILE_BUFFERS; + +typedef struct _TT_HITTESTINFO { + HWND hwnd; + POINT pt; + TOOLINFO ti; +} TTHITTESTINFO, * LPHITTESTINFO; + +typedef struct tagTTPOLYCURVE { + WORD wType; + WORD cpfx; + POINTFX apfx[1]; +} TTPOLYCURVE, * LPTTPOLYCURVE; + +typedef struct _TTPOLYGONHEADER { + DWORD cb; + DWORD dwType; + POINTFX pfxStart; +} TTPOLYGONHEADER, * LPTTPOLYGONHEADER; + +typedef struct _TV_DISPINFO { + NMHDR hdr; + TV_ITEM item; +} TV_DISPINFO; + +typedef struct _TVHITTESTINFO { + POINT pt; + UINT flags; + HTREEITEM hItem; +} TV_HITTESTINFO, *LPTV_HITTESTINFO; + +typedef struct _TV_INSERTSTRUCT { + HTREEITEM hParent; + HTREEITEM hInsertAfter; + TV_ITEM item; +} TV_INSERTSTRUCT, *LPTV_INSERTSTRUCT; + +typedef struct _TV_KEYDOWN { + NMHDR hdr; + WORD wVKey; + UINT flags; +} TV_KEYDOWN; + +typedef struct _TV_SORTCB { + HTREEITEM hParent; + PFNTVCOMPARE lpfnCompare; + LPARAM lParam; +} TV_SORTCB, *LPTV_SORTCB; + +typedef struct { + UINT nSec; + UINT nInc; +} UDACCEL; + +typedef struct _ULARGE_INTEGER { + DWORD LowPart; + DWORD HighPart; +} ULARGE_INTEGER, *PULARGE_INTEGER; + +typedef struct _UNIVERSAL_NAME_INFO { + LPTSTR lpUniversalName; +} UNIVERSAL_NAME_INFO; + +typedef struct tagUSEROBJECTFLAGS { + WINBOOL fInherit; + WINBOOL fReserved; + DWORD dwFlags; +} USEROBJECTFLAGS; + +typedef struct value_ent { + LPTSTR ve_valuename; + DWORD ve_valuelen; + DWORD ve_valueptr; + DWORD ve_type; +} VALENT, *PVALENT; + +typedef struct _VERIFY_INFORMATION { + LARGE_INTEGER StartingOffset; + DWORD Length; +} VERIFY_INFORMATION ; + +typedef struct _VS_FIXEDFILEINFO { + DWORD dwSignature; + DWORD dwStrucVersion; + DWORD dwFileVersionMS; + DWORD dwFileVersionLS; + DWORD dwProductVersionMS; + DWORD dwProductVersionLS; + DWORD dwFileFlagsMask; + DWORD dwFileFlags; + DWORD dwFileOS; + DWORD dwFileType; + DWORD dwFileSubtype; + DWORD dwFileDateMS; + DWORD dwFileDateLS; +} VS_FIXEDFILEINFO; + +typedef struct _WIN32_FIND_DATA { + DWORD dwFileAttributes; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; + DWORD nFileSizeHigh; + DWORD nFileSizeLow; + DWORD dwReserved0; + DWORD dwReserved1; + TCHAR cFileName[ MAX_PATH ]; + TCHAR cAlternateFileName[ 14 ]; +} WIN32_FIND_DATA, *LPWIN32_FIND_DATA, *PWIN32_FIND_DATA; + +typedef struct _WIN32_STREAM_ID { + DWORD dwStreamId; + DWORD dwStreamAttributes; + LARGE_INTEGER Size; + DWORD dwStreamNameSize; + WCHAR *cStreamName ; +} WIN32_STREAM_ID; + +typedef struct _WINDOWPLACEMENT { + UINT length; + UINT flags; + UINT showCmd; + POINT ptMinPosition; + POINT ptMaxPosition; + RECT rcNormalPosition; +} WINDOWPLACEMENT; + +typedef struct _WNDCLASS { + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HANDLE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCTSTR lpszMenuName; + LPCTSTR lpszClassName; +} WNDCLASS, *LPWNDCLASS; + +typedef struct _WNDCLASSEX { + UINT cbSize; + UINT style; + WNDPROC lpfnWndProc; + int cbClsExtra; + int cbWndExtra; + HANDLE hInstance; + HICON hIcon; + HCURSOR hCursor; + HBRUSH hbrBackground; + LPCTSTR lpszMenuName; + LPCTSTR lpszClassName; + HICON hIconSm; +} WNDCLASSEX, *LPWNDCLASSEX; + +typedef struct _CONNECTDLGSTRUCT { + DWORD cbStructure; + HWND hwndOwner; + LPNETRESOURCE lpConnRes; + DWORD dwFlags; + DWORD dwDevNum; +} CONNECTDLGSTRUCT, *LPCONNECTDLGSTRUCT; + +typedef struct _DISCDLGSTRUCT { + DWORD cbStructure; + HWND hwndOwner; + LPTSTR lpLocalName; + LPTSTR lpRemoteName; + DWORD dwFlags; +} DISCDLGSTRUCT, *LPDISCDLGSTRUCT; + +typedef struct _NETINFOSTRUCT{ + DWORD cbStructure; + DWORD dwProviderVersion; + DWORD dwStatus; + DWORD dwCharacteristics; + DWORD dwHandle; + WORD wNetType; + DWORD dwPrinters; + DWORD dwDrives; +} NETINFOSTRUCT, *LPNETINFOSTRUCT; + +typedef struct _NETCONNECTINFOSTRUCT{ + DWORD cbStructure; + DWORD dwFlags; + DWORD dwSpeed; + DWORD dwDelay; + DWORD dwOptDataSize; +} NETCONNECTINFOSTRUCT, *LPNETCONNECTINFOSTRUCT; + +typedef int CALLBACK (*ENUMMETAFILEPROC) (HDC, HANDLETABLE, + METARECORD, int, LPARAM); +typedef int CALLBACK (*ENHMETAFILEPROC) (HDC, HANDLETABLE, + ENHMETARECORD, int, LPARAM); + +typedef int CALLBACK (*ENUMFONTSPROC) (LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM); +typedef int CALLBACK (*FONTENUMPROC) (ENUMLOGFONT *, NEWTEXTMETRIC *, + int, LPARAM); +typedef int CALLBACK (*FONTENUMEXPROC) (ENUMLOGFONTEX *, NEWTEXTMETRICEX *, + int, LPARAM); + +typedef VOID CALLBACK (*LPOVERLAPPED_COMPLETION_ROUTINE) (DWORD, DWORD, + LPOVERLAPPED); + +/* + Structures for the extensions to OpenGL + */ +typedef struct _POINTFLOAT +{ + FLOAT x; + FLOAT y; +} POINTFLOAT, *PPOINTFLOAT; + +typedef struct _GLYPHMETRICSFLOAT +{ + FLOAT gmfBlackBoxX; + FLOAT gmfBlackBoxY; + POINTFLOAT gmfptGlyphOrigin; + FLOAT gmfCellIncX; + FLOAT gmfCellIncY; +} GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; + +typedef struct tagLAYERPLANEDESCRIPTOR +{ + WORD nSize; + WORD nVersion; + DWORD dwFlags; + BYTE iPixelType; + BYTE cColorBits; + BYTE cRedBits; + BYTE cRedShift; + BYTE cGreenBits; + BYTE cGreenShift; + BYTE cBlueBits; + BYTE cBlueShift; + BYTE cAlphaBits; + BYTE cAlphaShift; + BYTE cAccumBits; + BYTE cAccumRedBits; + BYTE cAccumGreenBits; + BYTE cAccumBlueBits; + BYTE cAccumAlphaBits; + BYTE cDepthBits; + BYTE cStencilBits; + BYTE cAuxBuffers; + BYTE iLayerPlane; + BYTE bReserved; + COLORREF crTransparent; +} LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; + +typedef struct tagPIXELFORMATDESCRIPTOR +{ + WORD nSize; + WORD nVersion; + DWORD dwFlags; + BYTE iPixelType; + BYTE cColorBits; + BYTE cRedBits; + BYTE cRedShift; + BYTE cGreenBits; + BYTE cGreenShift; + BYTE cBlueBits; + BYTE cBlueShift; + BYTE cAlphaBits; + BYTE cAlphaShift; + BYTE cAccumBits; + BYTE cAccumRedBits; + BYTE cAccumGreenBits; + BYTE cAccumBlueBits; + BYTE cAccumAlphaBits; + BYTE cDepthBits; + BYTE cStencilBits; + BYTE cAuxBuffers; + BYTE iLayerType; + BYTE bReserved; + DWORD dwLayerMask; + DWORD dwVisibleMask; + DWORD dwDamageMask; +} PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; + +typedef struct +{ + LPWSTR usri2_name; + LPWSTR usri2_password; + DWORD usri2_password_age; + DWORD usri2_priv; + LPWSTR usri2_home_dir; + LPWSTR usri2_comment; + DWORD usri2_flags; + LPWSTR usri2_script_path; + DWORD usri2_auth_flags; + LPWSTR usri2_full_name; + LPWSTR usri2_usr_comment; + LPWSTR usri2_parms; + LPWSTR usri2_workstations; + DWORD usri2_last_logon; + DWORD usri2_last_logoff; + DWORD usri2_acct_expires; + DWORD usri2_max_storage; + DWORD usri2_units_per_week; + PBYTE usri2_logon_hours; + DWORD usri2_bad_pw_count; + DWORD usri2_num_logons; + LPWSTR usri2_logon_server; + DWORD usri2_country_code; + DWORD usri2_code_page; +} USER_INFO_2, *PUSER_INFO_2, *LPUSER_INFO_2; + +typedef struct +{ + LPWSTR usri0_name; +} USER_INFO_0, *PUSER_INFO_0, *LPUSER_INFO_0; + +typedef struct +{ + LPWSTR usri3_name; + LPWSTR usri3_password; + DWORD usri3_password_age; + DWORD usri3_priv; + LPWSTR usri3_home_dir; + LPWSTR usri3_comment; + DWORD usri3_flags; + LPWSTR usri3_script_path; + DWORD usri3_auth_flags; + LPWSTR usri3_full_name; + LPWSTR usri3_usr_comment; + LPWSTR usri3_parms; + LPWSTR usri3_workstations; + DWORD usri3_last_logon; + DWORD usri3_last_logoff; + DWORD usri3_acct_expires; + DWORD usri3_max_storage; + DWORD usri3_units_per_week; + PBYTE usri3_logon_hours; + DWORD usri3_bad_pw_count; + DWORD usri3_num_logons; + LPWSTR usri3_logon_server; + DWORD usri3_country_code; + DWORD usri3_code_page; + DWORD usri3_user_id; + DWORD usri3_primary_group_id; + LPWSTR usri3_profile; + LPWSTR usri3_home_dir_drive; + DWORD usri3_password_expired; +} USER_INFO_3, *PUSER_INFO_3, *LPUSER_INFO_3; + +typedef struct +{ + LPWSTR grpi2_name; + LPWSTR grpi2_comment; + DWORD grpi2_group_id; + DWORD grpi2_attributes; +} GROUP_INFO_2, *PGROUP_INFO_2; + +typedef struct +{ + LPWSTR lgrpi0_name; +} LOCALGROUP_INFO_0, *PLOCALGROUP_INFO_0, *LPLOCALGROUP_INFO_0; + +/* PE executable header. */ + +typedef struct +{ + WORD e_magic; /* Magic number, 0x5a4d */ + WORD e_cblp; /* Bytes on last page of file, 0x90 */ + WORD e_cp; /* Pages in file, 0x3 */ + WORD e_crlc; /* Relocations, 0x0 */ + WORD e_cparhdr; /* Size of header in paragraphs, 0x4 */ + WORD e_minalloc; /* Minimum extra paragraphs needed, 0x0 */ + WORD e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */ + WORD e_ss; /* Initial (relative) SS value, 0x0 */ + WORD e_sp; /* Initial SP value, 0xb8 */ + WORD e_csum; /* Checksum, 0x0 */ + WORD e_ip; /* Initial IP value, 0x0 */ + WORD e_cs; /* Initial (relative) CS value, 0x0 */ + WORD e_lfarlc; /* File address of relocation table, 0x40 */ + WORD e_ovno; /* Overlay number, 0x0 */ + WORD e_res[4]; /* Reserved words, all 0x0 */ + WORD e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */ + WORD e_oeminfo; /* OEM information; e_oemid specific, 0x0 */ + WORD e_res2[10]; /* Reserved words, all 0x0 */ + LONG e_lfanew; /* File address of new exe header, 0x80 */ + /* We leave out the next two fields, since they aren't in the + Windows header file. */ + /* DWORD dos_message[16]; * text which always follows dos header */ + /* DWORD nt_signature; * required NT signature, 0x4550 */ +} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_STRUCTURES */ + diff --git a/reactos/include/types.h b/reactos/include/types.h new file mode 100644 index 00000000000..84e7da776df --- /dev/null +++ b/reactos/include/types.h @@ -0,0 +1,61 @@ +/* + * Added wide character type wchar_t, june 1998 -- Boudewijn Dekker + */ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + +#ifndef NULL +# define NULL ((void *) 0) +#endif + + +#ifndef _I386_TYPES_H +#define _I386_TYPES_H + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +/* + * These aren't exported outside the kernel to avoid name space clashes + */ +#ifdef __KERNEL__ + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef signed long long s64; +typedef unsigned long long u64; + +#endif /* __KERNEL__ */ + +#endif + + +typedef unsigned int size_t; +typedef size_t __kernel_size_t; +typedef unsigned short wchar_t; + + +#endif /* _LINUX_TYPES_H */ diff --git a/reactos/include/unicode.h b/reactos/include/unicode.h new file mode 100644 index 00000000000..01a07ac4ee1 --- /dev/null +++ b/reactos/include/unicode.h @@ -0,0 +1,3000 @@ +/* + UnicodeFunctions.h + + Declarations for all the Windows32 API Unicode Functions + + Copyright (C) 1996 Free Software Foundation, Inc. + + Author: Scott Christley + Date: 1996 + + This file is part of the Windows32 API Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley 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_UNICODEFUNCTIONS +#define _GNU_H_WINDOWS32_UNICODEFUNCTIONS + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +WINBOOL +STDCALL +GetBinaryTypeW( + LPCWSTR lpApplicationName, + LPDWORD lpBinaryType + ); + +DWORD +STDCALL +GetShortPathNameW( + LPCWSTR lpszLongPath, + LPWSTR lpszShortPath, + DWORD cchBuffer + ); + +LPWSTR +STDCALL +GetEnvironmentStringsW( + VOID + ); + +WINBOOL +STDCALL +FreeEnvironmentStringsW( + LPWSTR + ); + +DWORD +STDCALL +FormatMessageW( + DWORD dwFlags, + LPCVOID lpSource, + DWORD dwMessageId, + DWORD dwLanguageId, + LPWSTR lpBuffer, + DWORD nSize, + va_list *Arguments + ); + +HANDLE +STDCALL +CreateMailslotW( + LPCWSTR lpName, + DWORD nMaxMessageSize, + DWORD lReadTimeout, + LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + +int +STDCALL +lstrcmpW( + LPCWSTR lpString1, + LPCWSTR lpString2 + ); + +int +STDCALL +lstrcmpiW( + LPCWSTR lpString1, + LPCWSTR lpString2 + ); + +LPWSTR +STDCALL +lstrcpynW( + LPWSTR lpString1, + LPCWSTR lpString2, + int iMaxLength + ); + +LPWSTR +STDCALL +lstrcpyW( + LPWSTR lpString1, + LPCWSTR lpString2 + ); + +LPWSTR +STDCALL +lstrcatW( + LPWSTR lpString1, + LPCWSTR lpString2 + ); + +int +STDCALL +lstrlenW( + LPCWSTR lpString + ); + +HANDLE +STDCALL +CreateMutexW( + LPSECURITY_ATTRIBUTES lpMutexAttributes, + WINBOOL bInitialOwner, + LPCWSTR lpName + ); + +HANDLE +STDCALL +OpenMutexW( + DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + LPCWSTR lpName + ); + +HANDLE +STDCALL +CreateEventW( + LPSECURITY_ATTRIBUTES lpEventAttributes, + WINBOOL bManualReset, + WINBOOL bInitialState, + LPCWSTR lpName + ); + +HANDLE +STDCALL +OpenEventW( + DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + LPCWSTR lpName + ); + +HANDLE +STDCALL +CreateSemaphoreW( + LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, + LONG lInitialCount, + LONG lMaximumCount, + LPCWSTR lpName + ); + +HANDLE +STDCALL +OpenSemaphoreW( + DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + LPCWSTR lpName + ); + +HANDLE +STDCALL +CreateFileMappingW( + HANDLE hFile, + LPSECURITY_ATTRIBUTES lpFileMappingAttributes, + DWORD flProtect, + DWORD dwMaximumSizeHigh, + DWORD dwMaximumSizeLow, + LPCWSTR lpName + ); + +HANDLE +STDCALL +OpenFileMappingW( + DWORD dwDesiredAccess, + WINBOOL bInheritHandle, + LPCWSTR lpName + ); + +DWORD +STDCALL +GetLogicalDriveStringsW( + DWORD nBufferLength, + LPWSTR lpBuffer + ); + +HINSTANCE +STDCALL +LoadLibraryW( + LPCWSTR lpLibFileName + ); + +HINSTANCE +STDCALL +LoadLibraryExW( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags + ); + +DWORD +STDCALL +GetModuleFileNameW( + HINSTANCE hModule, + LPWSTR lpFilename, + DWORD nSize + ); + +HMODULE +STDCALL +GetModuleHandleW( + LPCWSTR lpModuleName + ); + +VOID +STDCALL +FatalAppExitW( + UINT uAction, + LPCWSTR lpMessageText + ); + +LPWSTR +STDCALL +GetCommandLineW( + VOID + ); + +DWORD +STDCALL +GetEnvironmentVariableW( + LPCWSTR lpName, + LPWSTR lpBuffer, + DWORD nSize + ); + +WINBOOL +STDCALL +SetEnvironmentVariableW( + LPCWSTR lpName, + LPCWSTR lpValue + ); + +DWORD +STDCALL +ExpandEnvironmentStringsW( + LPCWSTR lpSrc, + LPWSTR lpDst, + DWORD nSize + ); + +VOID +STDCALL +OutputDebugStringW( + LPCWSTR lpOutputString + ); + +HRSRC +STDCALL +FindResourceW( + HINSTANCE hModule, + LPCWSTR lpName, + LPCWSTR lpType + ); + +HRSRC +STDCALL +FindResourceExW( + HINSTANCE hModule, + LPCWSTR lpType, + LPCWSTR lpName, + WORD wLanguage + ); + +WINBOOL +STDCALL +EnumResourceTypesW( + HINSTANCE hModule, + ENUMRESTYPEPROC lpEnumFunc, + LONG lParam + ); + +WINBOOL +STDCALL +EnumResourceNamesW( + HINSTANCE hModule, + LPCWSTR lpType, + ENUMRESNAMEPROC lpEnumFunc, + LONG lParam + ); + +WINBOOL +STDCALL +EnumResourceLanguagesW( + HINSTANCE hModule, + LPCWSTR lpType, + LPCWSTR lpName, + ENUMRESLANGPROC lpEnumFunc, + LONG lParam + ); + +HANDLE +STDCALL +BeginUpdateResourceW( + LPCWSTR pFileName, + WINBOOL bDeleteExistingResources + ); + +WINBOOL +STDCALL +UpdateResourceW( + HANDLE hUpdate, + LPCWSTR lpType, + LPCWSTR lpName, + WORD wLanguage, + LPVOID lpData, + DWORD cbData + ); + +WINBOOL +STDCALL +EndUpdateResourceW( + HANDLE hUpdate, + WINBOOL fDiscard + ); + +ATOM +STDCALL +GlobalAddAtomW( + LPCWSTR lpString + ); + +ATOM +STDCALL +GlobalFindAtomW( + LPCWSTR lpString + ); + +UINT +STDCALL +GlobalGetAtomNameW( + ATOM nAtom, + LPWSTR lpBuffer, + int nSize + ); + +ATOM +STDCALL +AddAtomW( + LPCWSTR lpString + ); + +ATOM +STDCALL +FindAtomW( + LPCWSTR lpString + ); + +UINT +STDCALL +GetAtomNameW( + ATOM nAtom, + LPWSTR lpBuffer, + int nSize + ); + +UINT +STDCALL +GetProfileIntW( + LPCWSTR lpAppName, + LPCWSTR lpKeyName, + INT nDefault + ); + +DWORD +STDCALL +GetProfileStringW( + LPCWSTR lpAppName, + LPCWSTR lpKeyName, + LPCWSTR lpDefault, + LPWSTR lpReturnedString, + DWORD nSize + ); + +WINBOOL +STDCALL +WriteProfileStringW( + LPCWSTR lpAppName, + LPCWSTR lpKeyName, + LPCWSTR lpString + ); + +DWORD +STDCALL +GetProfileSectionW( + LPCWSTR lpAppName, + LPWSTR lpReturnedString, + DWORD nSize + ); + +WINBOOL +STDCALL +WriteProfileSectionW( + LPCWSTR lpAppName, + LPCWSTR lpString + ); + +UINT +STDCALL +GetPrivateProfileIntW( + LPCWSTR lpAppName, + LPCWSTR lpKeyName, + INT nDefault, + LPCWSTR lpFileName + ); + +DWORD +STDCALL +GetPrivateProfileStringW( + LPCWSTR lpAppName, + LPCWSTR lpKeyName, + LPCWSTR lpDefault, + LPWSTR lpReturnedString, + DWORD nSize, + LPCWSTR lpFileName + ); + +WINBOOL +STDCALL +WritePrivateProfileStringW( + LPCWSTR lpAppName, + LPCWSTR lpKeyName, + LPCWSTR lpString, + LPCWSTR lpFileName + ); + +DWORD +STDCALL +GetPrivateProfileSectionW( + LPCWSTR lpAppName, + LPWSTR lpReturnedString, + DWORD nSize, + LPCWSTR lpFileName + ); + +WINBOOL +STDCALL +WritePrivateProfileSectionW( + LPCWSTR lpAppName, + LPCWSTR lpString, + LPCWSTR lpFileName + ); + +UINT +STDCALL +GetDriveTypeW( + LPCWSTR lpRootPathName + ); + +UINT +STDCALL +GetSystemDirectoryW( + LPWSTR lpBuffer, + UINT uSize + ); + +DWORD +STDCALL +GetTempPathW( + DWORD nBufferLength, + LPWSTR lpBuffer + ); + +UINT +STDCALL +GetTempFileNameW( + LPCWSTR lpPathName, + LPCWSTR lpPrefixString, + UINT uUnique, + LPWSTR lpTempFileName + ); + +UINT +STDCALL +GetWindowsDirectoryW( + LPWSTR lpBuffer, + UINT uSize + ); + +WINBOOL +STDCALL +SetCurrentDirectoryW( + LPCWSTR lpPathName + ); + +DWORD +STDCALL +GetCurrentDirectoryW( + DWORD nBufferLength, + LPWSTR lpBuffer + ); + +WINBOOL +STDCALL +GetDiskFreeSpaceW( + LPCWSTR lpRootPathName, + LPDWORD lpSectorsPerCluster, + LPDWORD lpBytesPerSector, + LPDWORD lpNumberOfFreeClusters, + LPDWORD lpTotalNumberOfClusters + ); + +WINBOOL +STDCALL +CreateDirectoryW( + LPCWSTR lpPathName, + LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + +WINBOOL +STDCALL +CreateDirectoryExW( + LPCWSTR lpTemplateDirectory, + LPCWSTR lpNewDirectory, + LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + +WINBOOL +STDCALL +RemoveDirectoryW( + LPCWSTR lpPathName + ); + +DWORD +STDCALL +GetFullPathNameW( + LPCWSTR lpFileName, + DWORD nBufferLength, + LPWSTR lpBuffer, + LPWSTR *lpFilePart + ); + +WINBOOL +STDCALL +DefineDosDeviceW( + DWORD dwFlags, + LPCWSTR lpDeviceName, + LPCWSTR lpTargetPath + ); + +DWORD +STDCALL +QueryDosDeviceW( + LPCWSTR lpDeviceName, + LPWSTR lpTargetPath, + DWORD ucchMax + ); + +HANDLE +STDCALL +CreateFileW( + LPCWSTR lpFileName, + DWORD dwDesiredAccess, + DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile + ); + +WINBOOL +STDCALL +SetFileAttributesW( + LPCWSTR lpFileName, + DWORD dwFileAttributes + ); + +DWORD +STDCALL +GetFileAttributesW( + LPCWSTR lpFileName + ); + +DWORD +STDCALL +GetCompressedFileSizeW( + LPCWSTR lpFileName, + LPDWORD lpFileSizeHigh + ); + +WINBOOL +STDCALL +DeleteFileW( + LPCWSTR lpFileName + ); + +DWORD +STDCALL +SearchPathW( + LPCWSTR lpPath, + LPCWSTR lpFileName, + LPCWSTR lpExtension, + DWORD nBufferLength, + LPWSTR lpBuffer, + LPWSTR *lpFilePart + ); + +WINBOOL +STDCALL +CopyFileW( + LPCWSTR lpExistingFileName, + LPCWSTR lpNewFileName, + WINBOOL bFailIfExists + ); + +WINBOOL +STDCALL +MoveFileW( + LPCWSTR lpExistingFileName, + LPCWSTR lpNewFileName + ); + +WINBOOL +STDCALL +MoveFileExW( + LPCWSTR lpExistingFileName, + LPCWSTR lpNewFileName, + DWORD dwFlags + ); + +HANDLE +STDCALL +CreateNamedPipeW( + LPCWSTR lpName, + DWORD dwOpenMode, + DWORD dwPipeMode, + DWORD nMaxInstances, + DWORD nOutBufferSize, + DWORD nInBufferSize, + DWORD nDefaultTimeOut, + LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + +WINBOOL +STDCALL +GetNamedPipeHandleStateW( + HANDLE hNamedPipe, + LPDWORD lpState, + LPDWORD lpCurInstances, + LPDWORD lpMaxCollectionCount, + LPDWORD lpCollectDataTimeout, + LPWSTR lpUserName, + DWORD nMaxUserNameSize + ); + +WINBOOL +STDCALL +CallNamedPipeW( + LPCWSTR lpNamedPipeName, + LPVOID lpInBuffer, + DWORD nInBufferSize, + LPVOID lpOutBuffer, + DWORD nOutBufferSize, + LPDWORD lpBytesRead, + DWORD nTimeOut + ); + +WINBOOL +STDCALL +WaitNamedPipeW( + LPCWSTR lpNamedPipeName, + DWORD nTimeOut + ); + +WINBOOL +STDCALL +SetVolumeLabelW( + LPCWSTR lpRootPathName, + LPCWSTR lpVolumeName + ); + +WINBOOL +STDCALL +GetVolumeInformationW( + LPCWSTR lpRootPathName, + LPWSTR lpVolumeNameBuffer, + DWORD nVolumeNameSize, + LPDWORD lpVolumeSerialNumber, + LPDWORD lpMaximumComponentLength, + LPDWORD lpFileSystemFlags, + LPWSTR lpFileSystemNameBuffer, + DWORD nFileSystemNameSize + ); + +WINBOOL +STDCALL +ClearEventLogW ( + HANDLE hEventLog, + LPCWSTR lpBackupFileName + ); + +WINBOOL +STDCALL +BackupEventLogW ( + HANDLE hEventLog, + LPCWSTR lpBackupFileName + ); + +HANDLE +STDCALL +OpenEventLogW ( + LPCWSTR lpUNCServerName, + LPCWSTR lpSourceName + ); + +HANDLE +STDCALL +RegisterEventSourceW ( + LPCWSTR lpUNCServerName, + LPCWSTR lpSourceName + ); + +HANDLE +STDCALL +OpenBackupEventLogW ( + LPCWSTR lpUNCServerName, + LPCWSTR lpFileName + ); + +WINBOOL +STDCALL +ReadEventLogW ( + HANDLE hEventLog, + DWORD dwReadFlags, + DWORD dwRecordOffset, + LPVOID lpBuffer, + DWORD nNumberOfBytesToRead, + DWORD *pnBytesRead, + DWORD *pnMinNumberOfBytesNeeded + ); + +WINBOOL +STDCALL +ReportEventW ( + HANDLE hEventLog, + WORD wType, + WORD wCategory, + DWORD dwEventID, + PSID lpUserSid, + WORD wNumStrings, + DWORD dwDataSize, + LPCWSTR *lpStrings, + LPVOID lpRawData + ); + +WINBOOL +STDCALL +AccessCheckAndAuditAlarmW ( + LPCWSTR SubsystemName, + LPVOID HandleId, + LPWSTR ObjectTypeName, + LPWSTR ObjectName, + PSECURITY_DESCRIPTOR SecurityDescriptor, + DWORD DesiredAccess, + PGENERIC_MAPPING GenericMapping, + WINBOOL ObjectCreation, + LPDWORD GrantedAccess, + LPBOOL AccessStatus, + LPBOOL pfGenerateOnClose + ); + +WINBOOL +STDCALL +ObjectOpenAuditAlarmW ( + LPCWSTR SubsystemName, + LPVOID HandleId, + LPWSTR ObjectTypeName, + LPWSTR ObjectName, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + HANDLE ClientToken, + DWORD DesiredAccess, + DWORD GrantedAccess, + PPRIVILEGE_SET Privileges, + WINBOOL ObjectCreation, + WINBOOL AccessGranted, + LPBOOL GenerateOnClose + ); + +WINBOOL +STDCALL +ObjectPrivilegeAuditAlarmW ( + LPCWSTR SubsystemName, + LPVOID HandleId, + HANDLE ClientToken, + DWORD DesiredAccess, + PPRIVILEGE_SET Privileges, + WINBOOL AccessGranted + ); + +WINBOOL +STDCALL +ObjectCloseAuditAlarmW ( + LPCWSTR SubsystemName, + LPVOID HandleId, + WINBOOL GenerateOnClose + ); + +WINBOOL +STDCALL +PrivilegedServiceAuditAlarmW ( + LPCWSTR SubsystemName, + LPCWSTR ServiceName, + HANDLE ClientToken, + PPRIVILEGE_SET Privileges, + WINBOOL AccessGranted + ); + +WINBOOL +STDCALL +SetFileSecurityW ( + LPCWSTR lpFileName, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor + ); + +WINBOOL +STDCALL +GetFileSecurityW ( + LPCWSTR lpFileName, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded + ); + +HANDLE +STDCALL +FindFirstChangeNotificationW( + LPCWSTR lpPathName, + WINBOOL bWatchSubtree, + DWORD dwNotifyFilter + ); + +WINBOOL +STDCALL +IsBadStringPtrW( + LPCWSTR lpsz, + UINT ucchMax + ); + +WINBOOL +STDCALL +LookupAccountSidW( + LPCWSTR lpSystemName, + PSID Sid, + LPWSTR Name, + LPDWORD cbName, + LPWSTR ReferencedDomainName, + LPDWORD cbReferencedDomainName, + PSID_NAME_USE peUse + ); + +WINBOOL +STDCALL +LookupAccountNameW( + LPCWSTR lpSystemName, + LPCWSTR lpAccountName, + PSID Sid, + LPDWORD cbSid, + LPWSTR ReferencedDomainName, + LPDWORD cbReferencedDomainName, + PSID_NAME_USE peUse + ); + +WINBOOL +STDCALL +LookupPrivilegeValueW( + LPCWSTR lpSystemName, + LPCWSTR lpName, + PLUID lpLuid + ); + +WINBOOL +STDCALL +LookupPrivilegeNameW( + LPCWSTR lpSystemName, + PLUID lpLuid, + LPWSTR lpName, + LPDWORD cbName + ); + +WINBOOL +STDCALL +LookupPrivilegeDisplayNameW( + LPCWSTR lpSystemName, + LPCWSTR lpName, + LPWSTR lpDisplayName, + LPDWORD cbDisplayName, + LPDWORD lpLanguageId + ); + +WINBOOL +STDCALL +BuildCommDCBW( + LPCWSTR lpDef, + LPDCB lpDCB + ); + +WINBOOL +STDCALL +BuildCommDCBAndTimeoutsW( + LPCWSTR lpDef, + LPDCB lpDCB, + LPCOMMTIMEOUTS lpCommTimeouts + ); + +WINBOOL +STDCALL +CommConfigDialogW( + LPCWSTR lpszName, + HWND hWnd, + LPCOMMCONFIG lpCC + ); + +WINBOOL +STDCALL +GetDefaultCommConfigW( + LPCWSTR lpszName, + LPCOMMCONFIG lpCC, + LPDWORD lpdwSize + ); + +WINBOOL +STDCALL +SetDefaultCommConfigW( + LPCWSTR lpszName, + LPCOMMCONFIG lpCC, + DWORD dwSize + ); + +WINBOOL +STDCALL +GetComputerNameW ( + LPWSTR lpBuffer, + LPDWORD nSize + ); + +WINBOOL +STDCALL +SetComputerNameW ( + LPCWSTR lpComputerName + ); + +WINBOOL +STDCALL +GetUserNameW ( + LPWSTR lpBuffer, + LPDWORD nSize + ); + +int +STDCALL +wvsprintfW( + LPWSTR, + LPCWSTR, + va_list arglist); + +int +CDECL +wsprintfW(LPWSTR, LPCWSTR, ...); + +HKL +STDCALL +LoadKeyboardLayoutW( + LPCWSTR pwszKLID, + UINT Flags); + +WINBOOL +STDCALL +GetKeyboardLayoutNameW( + LPWSTR pwszKLID); + +HDESK +STDCALL +CreateDesktopW( + LPWSTR lpszDesktop, + LPWSTR lpszDevice, + LPDEVMODE pDevmode, + DWORD dwFlags, + DWORD dwDesiredAccess, + LPSECURITY_ATTRIBUTES lpsa); + +HDESK +STDCALL +OpenDesktopW( + LPWSTR lpszDesktop, + DWORD dwFlags, + WINBOOL fInherit, + DWORD dwDesiredAccess); + +WINBOOL +STDCALL +EnumDesktopsW( + HWINSTA hwinsta, + DESKTOPENUMPROC lpEnumFunc, + LPARAM lParam); + +HWINSTA +STDCALL +CreateWindowStationW( + LPWSTR lpwinsta, + DWORD dwReserved, + DWORD dwDesiredAccess, + LPSECURITY_ATTRIBUTES lpsa); + +HWINSTA +STDCALL +OpenWindowStationW( + LPWSTR lpszWinSta, + WINBOOL fInherit, + DWORD dwDesiredAccess); + +WINBOOL +STDCALL +EnumWindowStationsW( + ENUMWINDOWSTATIONPROC lpEnumFunc, + LPARAM lParam); + +WINBOOL +STDCALL +GetUserObjectInformationW( + HANDLE hObj, + int nIndex, + PVOID pvInfo, + DWORD nLength, + LPDWORD lpnLengthNeeded); + +WINBOOL +STDCALL +SetUserObjectInformationW( + HANDLE hObj, + int nIndex, + PVOID pvInfo, + DWORD nLength); + +UINT +STDCALL +RegisterWindowMessageW( + LPCWSTR lpString); + +WINBOOL +STDCALL +GetMessageW( + LPMSG lpMsg, + HWND hWnd , + UINT wMsgFilterMin, + UINT wMsgFilterMax); + +LONG +STDCALL +DispatchMessageW( + CONST MSG *lpMsg); + +WINBOOL +STDCALL +PeekMessageW( + LPMSG lpMsg, + HWND hWnd , + UINT wMsgFilterMin, + UINT wMsgFilterMax, + UINT wRemoveMsg); + +LRESULT +STDCALL +SendMessageW( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +LRESULT +STDCALL +SendMessageTimeoutW( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + UINT fuFlags, + UINT uTimeout, + LPDWORD lpdwResult); + +WINBOOL +STDCALL +SendNotifyMessageW( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +WINBOOL +STDCALL +SendMessageCallbackW( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + SENDASYNCPROC lpResultCallBack, + DWORD dwData); + +WINBOOL +STDCALL +PostMessageW( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +WINBOOL +STDCALL +PostThreadMessageW( + DWORD idThread, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +LRESULT +STDCALL +DefWindowProcW( + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +LRESULT +STDCALL +CallWindowProcW( + WNDPROC lpPrevWndFunc, + HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +ATOM +STDCALL +RegisterClassW( + CONST WNDCLASS *lpWndClass); + +WINBOOL +STDCALL +UnregisterClassW( + LPCWSTR lpClassName, + HINSTANCE hInstance); + +WINBOOL +STDCALL +GetClassInfoW( + HINSTANCE hInstance , + LPCWSTR lpClassName, + LPWNDCLASS lpWndClass); + +ATOM +STDCALL +RegisterClassExW(CONST WNDCLASSEX *); + +WINBOOL +STDCALL +GetClassInfoExW(HINSTANCE, LPCWSTR, LPWNDCLASSEX); + +HWND +STDCALL +CreateWindowExW( + DWORD dwExStyle, + LPCWSTR lpClassName, + LPCWSTR lpWindowName, + DWORD dwStyle, + int X, + int Y, + int nWidth, + int nHeight, + HWND hWndParent , + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam); + +HWND +STDCALL +CreateDialogParamW( + HINSTANCE hInstance, + LPCWSTR lpTemplateName, + HWND hWndParent , + DLGPROC lpDialogFunc, + LPARAM dwInitParam); + +HWND +STDCALL +CreateDialogIndirectParamW( + HINSTANCE hInstance, + LPCDLGTEMPLATE lpTemplate, + HWND hWndParent, + DLGPROC lpDialogFunc, + LPARAM dwInitParam); + +int +STDCALL +DialogBoxParamW( + HINSTANCE hInstance, + LPCWSTR lpTemplateName, + HWND hWndParent , + DLGPROC lpDialogFunc, + LPARAM dwInitParam); + +int +STDCALL +DialogBoxIndirectParamW( + HINSTANCE hInstance, + LPCDLGTEMPLATE hDialogTemplate, + HWND hWndParent , + DLGPROC lpDialogFunc, + LPARAM dwInitParam); + +WINBOOL +STDCALL +SetDlgItemTextW( + HWND hDlg, + int nIDDlgItem, + LPCWSTR lpString); + +UINT +STDCALL +GetDlgItemTextW( + HWND hDlg, + int nIDDlgItem, + LPWSTR lpString, + int nMaxCount); + +LONG +STDCALL +SendDlgItemMessageW( + HWND hDlg, + int nIDDlgItem, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +LRESULT +STDCALL +DefDlgProcW( + HWND hDlg, + UINT Msg, + WPARAM wParam, + LPARAM lParam); + +WINBOOL +STDCALL +CallMsgFilterW( + LPMSG lpMsg, + int nCode); + +UINT +STDCALL +RegisterClipboardFormatW( + LPCWSTR lpszFormat); + +int +STDCALL +GetClipboardFormatNameW( + UINT format, + LPWSTR lpszFormatName, + int cchMaxCount); + +WINBOOL +STDCALL +CharToOemW( + LPCWSTR lpszSrc, + LPSTR lpszDst); + +WINBOOL +STDCALL +OemToCharW( + LPCSTR lpszSrc, + LPWSTR lpszDst); + +WINBOOL +STDCALL +CharToOemBuffW( + LPCWSTR lpszSrc, + LPSTR lpszDst, + DWORD cchDstLength); + +WINBOOL +STDCALL +OemToCharBuffW( + LPCSTR lpszSrc, + LPWSTR lpszDst, + DWORD cchDstLength); + +LPWSTR +STDCALL +CharUpperW( + LPWSTR lpsz); + +DWORD +STDCALL +CharUpperBuffW( + LPWSTR lpsz, + DWORD cchLength); + +LPWSTR +STDCALL +CharLowerW( + LPWSTR lpsz); + +DWORD +STDCALL +CharLowerBuffW( + LPWSTR lpsz, + DWORD cchLength); + +LPWSTR +STDCALL +CharNextW( + LPCWSTR lpsz); + +LPWSTR +STDCALL +CharPrevW( + LPCWSTR lpszStart, + LPCWSTR lpszCurrent); + +WINBOOL +STDCALL +IsCharAlphaW( + WCHAR ch); + +WINBOOL +STDCALL +IsCharAlphaNumericW( + WCHAR ch); + +WINBOOL +STDCALL +IsCharUpperW( + WCHAR ch); + +WINBOOL +STDCALL +IsCharLowerW( + WCHAR ch); + +int +STDCALL +GetKeyNameTextW( + LONG lParam, + LPWSTR lpString, + int nSize + ); + +SHORT +STDCALL +VkKeyScanW( + WCHAR ch); + +SHORT +STDCALL VkKeyScanExW( + WCHAR ch, + HKL dwhkl); + +UINT +STDCALL +MapVirtualKeyW( + UINT uCode, + UINT uMapType); + +UINT +STDCALL +MapVirtualKeyExW( + UINT uCode, + UINT uMapType, + HKL dwhkl); + +HACCEL +STDCALL +LoadAcceleratorsW( + HINSTANCE hInstance, + LPCWSTR lpTableName); + +HACCEL +STDCALL +CreateAcceleratorTableW( + LPACCEL, int); + +int +STDCALL +CopyAcceleratorTableW( + HACCEL hAccelSrc, + LPACCEL lpAccelDst, + int cAccelEntries); + +int +STDCALL +TranslateAcceleratorW( + HWND hWnd, + HACCEL hAccTable, + LPMSG lpMsg); + +HMENU +STDCALL +LoadMenuW( + HINSTANCE hInstance, + LPCWSTR lpMenuName); + +HMENU +STDCALL +LoadMenuIndirectW( + CONST MENUTEMPLATE *lpMenuTemplate); + +WINBOOL +STDCALL +ChangeMenuW( + HMENU hMenu, + UINT cmd, + LPCWSTR lpszNewItem, + UINT cmdInsert, + UINT flags); + +int +STDCALL +GetMenuStringW( + HMENU hMenu, + UINT uIDItem, + LPWSTR lpString, + int nMaxCount, + UINT uFlag); + +WINBOOL +STDCALL +InsertMenuW( + HMENU hMenu, + UINT uPosition, + UINT uFlags, + UINT uIDNewItem, + LPCWSTR lpNewItem + ); + +WINBOOL +STDCALL +AppendMenuW( + HMENU hMenu, + UINT uFlags, + UINT uIDNewItem, + LPCWSTR lpNewItem + ); + +WINBOOL +STDCALL +ModifyMenuW( + HMENU hMnu, + UINT uPosition, + UINT uFlags, + UINT uIDNewItem, + LPCWSTR lpNewItem + ); + +WINBOOL +STDCALL +InsertMenuItemW( + HMENU, + UINT, + WINBOOL, + LPCMENUITEMINFO + ); + +WINBOOL +STDCALL +GetMenuItemInfoW( + HMENU, + UINT, + WINBOOL, + LPMENUITEMINFO + ); + +WINBOOL +STDCALL +SetMenuItemInfoW( + HMENU, + UINT, + WINBOOL, + LPCMENUITEMINFO + ); + +int +STDCALL +DrawTextW( + HDC hDC, + LPCWSTR lpString, + int nCount, + LPRECT lpRect, + UINT uFormat); + +int +STDCALL +DrawTextExW(HDC, LPWSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); + +WINBOOL +STDCALL +GrayStringW( + HDC hDC, + HBRUSH hBrush, + GRAYSTRINGPROC lpOutputFunc, + LPARAM lpData, + int nCount, + int X, + int Y, + int nWidth, + int nHeight); + +WINBOOL STDCALL DrawStateW(HDC, HBRUSH, DRAWSTATEPROC, LPARAM, WPARAM, int, int, int, int, UINT); + +LONG +STDCALL +TabbedTextOutW( + HDC hDC, + int X, + int Y, + LPCWSTR lpString, + int nCount, + int nTabPositions, + LPINT lpnTabStopPositions, + int nTabOrigin); + +DWORD +STDCALL +GetTabbedTextExtentW( + HDC hDC, + LPCWSTR lpString, + int nCount, + int nTabPositions, + LPINT lpnTabStopPositions); + +WINBOOL +STDCALL +SetPropW( + HWND hWnd, + LPCWSTR lpString, + HANDLE hData); + +HANDLE +STDCALL +GetPropW( + HWND hWnd, + LPCWSTR lpString); + +HANDLE +STDCALL +RemovePropW( + HWND hWnd, + LPCWSTR lpString); + +int +STDCALL +EnumPropsExW( + HWND hWnd, + PROPENUMPROCEX lpEnumFunc, + LPARAM lParam); + +int +STDCALL +EnumPropsW( + HWND hWnd, + PROPENUMPROC lpEnumFunc); + +WINBOOL +STDCALL +SetWindowTextW( + HWND hWnd, + LPCWSTR lpString); + +int +STDCALL +GetWindowTextW( + HWND hWnd, + LPWSTR lpString, + int nMaxCount); + +int +STDCALL +GetWindowTextLengthW( + HWND hWnd); + +int +STDCALL +MessageBoxW( + HWND hWnd , + LPCWSTR lpText, + LPCWSTR lpCaption, + UINT uType); + +int +STDCALL +MessageBoxExW( + HWND hWnd , + LPCWSTR lpText, + LPCWSTR lpCaption, + UINT uType, + WORD wLanguageId); + +int +STDCALL +MessageBoxIndirectW(LPMSGBOXPARAMS); + +LONG +STDCALL +GetWindowLongW( + HWND hWnd, + int nIndex); + +LONG +STDCALL +SetWindowLongW( + HWND hWnd, + int nIndex, + LONG dwNewLong); + +DWORD +STDCALL +GetClassLongW( + HWND hWnd, + int nIndex); + +DWORD +STDCALL +SetClassLongW( + HWND hWnd, + int nIndex, + LONG dwNewLong); + +HWND +STDCALL +FindWindowW( + LPCWSTR lpClassName , + LPCWSTR lpWindowName); + +HWND +STDCALL +FindWindowExW(HWND, HWND, LPCWSTR, LPCWSTR); + +int +STDCALL +GetClassNameW( + HWND hWnd, + LPWSTR lpClassName, + int nMaxCount); + +HHOOK +STDCALL +SetWindowsHookExW( + int idHook, + HOOKPROC lpfn, + HINSTANCE hmod, + DWORD dwThreadId); + +HBITMAP +STDCALL +LoadBitmapW( + HINSTANCE hInstance, + LPCWSTR lpBitmapName); + +HCURSOR +STDCALL +LoadCursorW( + HINSTANCE hInstance, + LPCWSTR lpCursorName); + +HCURSOR +STDCALL +LoadCursorFromFileW( + LPCWSTR lpFileName); + +HICON +STDCALL +LoadIconW( + HINSTANCE hInstance, + LPCWSTR lpIconName); + +HANDLE +STDCALL +LoadImageW( + HINSTANCE, + LPCWSTR, + UINT, + int, + int, + UINT); + +int +STDCALL +LoadStringW( + HINSTANCE hInstance, + UINT uID, + LPWSTR lpBuffer, + int nBufferMax); + +WINBOOL +STDCALL +IsDialogMessageW( + HWND hDlg, + LPMSG lpMsg); + +int +STDCALL +DlgDirListW( + HWND hDlg, + LPWSTR lpPathSpec, + int nIDListBox, + int nIDStaticPath, + UINT uFileType); + +WINBOOL +STDCALL +DlgDirSelectExW( + HWND hDlg, + LPWSTR lpString, + int nCount, + int nIDListBox); + +int +STDCALL +DlgDirListComboBoxW( + HWND hDlg, + LPWSTR lpPathSpec, + int nIDComboBox, + int nIDStaticPath, + UINT uFiletype); + +WINBOOL +STDCALL +DlgDirSelectComboBoxExW( + HWND hDlg, + LPWSTR lpString, + int nCount, + int nIDComboBox); + +LRESULT +STDCALL +DefFrameProcW( + HWND hWnd, + HWND hWndMDIClient , + UINT uMsg, + WPARAM wParam, + LPARAM lParam); + +LRESULT +STDCALL +DefMDIChildProcW( + HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam); + +HWND +STDCALL +CreateMDIWindowW( + LPWSTR lpClassName, + LPWSTR lpWindowName, + DWORD dwStyle, + int X, + int Y, + int nWidth, + int nHeight, + HWND hWndParent, + HINSTANCE hInstance, + LPARAM lParam + ); + +WINBOOL +STDCALL +WinHelpW( + HWND hWndMain, + LPCWSTR lpszHelp, + UINT uCommand, + DWORD dwData + ); + +LONG +STDCALL +ChangeDisplaySettingsW( + LPDEVMODE lpDevMode, + DWORD dwFlags); + +WINBOOL +STDCALL +EnumDisplaySettingsW( + LPCWSTR lpszDeviceName, + DWORD iModeNum, + LPDEVMODE lpDevMode); + +WINBOOL +STDCALL +SystemParametersInfoW( + UINT uiAction, + UINT uiParam, + PVOID pvParam, + UINT fWinIni); + +int +STDCALL +AddFontResourceW(LPCWSTR); + +HMETAFILE +STDCALL +CopyMetaFileW(HMETAFILE, LPCWSTR); + +HFONT +STDCALL +CreateFontIndirectW(CONST LOGFONT *); + +HFONT +STDCALL +CreateFontW(int, int, int, int, int, DWORD, + DWORD, DWORD, DWORD, DWORD, DWORD, + DWORD, DWORD, LPCWSTR); + +HDC +STDCALL +CreateICW(LPCWSTR, LPCWSTR , LPCWSTR , CONST DEVMODE *); + +HDC +STDCALL +CreateMetaFileW(LPCWSTR); + +WINBOOL +STDCALL +CreateScalableFontResourceW(DWORD, LPCWSTR, LPCWSTR, LPCWSTR); + +int +STDCALL +DeviceCapabilitiesW(LPCWSTR, LPCWSTR, WORD, + LPWSTR, CONST DEVMODE *); + +int +STDCALL +EnumFontFamiliesExW(HDC, LPLOGFONT, FONTENUMEXPROC, LPARAM, DWORD); + +int +STDCALL +EnumFontFamiliesW(HDC, LPCWSTR, FONTENUMPROC, LPARAM); + +int +STDCALL +EnumFontsW(HDC, LPCWSTR, ENUMFONTSPROC, LPARAM); + +WINBOOL +STDCALL +GetCharWidthW(HDC, UINT, UINT, LPINT); + +WINBOOL +STDCALL +GetCharWidth32W(HDC, UINT, UINT, LPINT); + +WINBOOL +STDCALL +GetCharWidthFloatW(HDC, UINT, UINT, PFLOAT); + +WINBOOL +STDCALL +GetCharABCWidthsW(HDC, UINT, UINT, LPABC); + +WINBOOL +STDCALL +GetCharABCWidthsFloatW(HDC, UINT, UINT, LPABCFLOAT); + +DWORD +STDCALL +GetGlyphOutlineW(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2 *); + +HMETAFILE +STDCALL +GetMetaFileW(LPCWSTR); + +UINT +STDCALL +GetOutlineTextMetricsW(HDC, UINT, LPOUTLINETEXTMETRIC); + +WINBOOL +STDCALL GetTextExtentPointW( + HDC, + LPCWSTR, + int, + LPSIZE + ); + +WINBOOL +STDCALL +GetTextExtentPoint32W( + HDC, + LPCWSTR, + int, + LPSIZE + ); + +WINBOOL +STDCALL +GetTextExtentExPointW( + HDC, + LPCWSTR, + int, + int, + LPINT, + LPINT, + LPSIZE + ); + +DWORD +STDCALL +GetCharacterPlacementW(HDC, LPCWSTR, int, int, LPGCP_RESULTS, DWORD); + +HDC +STDCALL +ResetDCW(HDC, CONST DEVMODE *); + +WINBOOL +STDCALL +RemoveFontResourceW(LPCWSTR); + +HENHMETAFILE +STDCALL +CopyEnhMetaFileW(HENHMETAFILE, LPCWSTR); + +HDC +STDCALL +CreateEnhMetaFileW(HDC, LPCWSTR, CONST RECT *, LPCWSTR); + +HENHMETAFILE +STDCALL +GetEnhMetaFileW(LPCWSTR); + +UINT +STDCALL +GetEnhMetaFileDescriptionW(HENHMETAFILE, UINT, LPWSTR ); + +WINBOOL +STDCALL +GetTextMetricsW(HDC, LPTEXTMETRIC); + +int +STDCALL +StartDocW(HDC, CONST DOCINFO *); + +int +STDCALL +GetObjectW(HGDIOBJ, int, LPVOID); + +WINBOOL +STDCALL +TextOutW(HDC, int, int, LPCWSTR, int); + +WINBOOL +STDCALL +ExtTextOutW(HDC, int, int, UINT, CONST RECT *,LPCWSTR, UINT, CONST INT *); + +WINBOOL +STDCALL +PolyTextOutW(HDC, CONST POLYTEXT *, int); + +int +STDCALL +GetTextFaceW(HDC, int, LPWSTR); + +DWORD +STDCALL +GetKerningPairsW(HDC, DWORD, LPKERNINGPAIR); + +WINBOOL +STDCALL +GetLogColorSpaceW(HCOLORSPACE,LPLOGCOLORSPACE,DWORD); + +HCOLORSPACE +STDCALL +CreateColorSpaceW(LPLOGCOLORSPACE); + +WINBOOL +STDCALL +GetICMProfileW(HDC,DWORD,LPWSTR); + +WINBOOL +STDCALL +SetICMProfileW(HDC,LPWSTR); + +WINBOOL +STDCALL +UpdateICMRegKeyW(DWORD, DWORD, LPWSTR, UINT); + +int +STDCALL +EnumICMProfilesW(HDC,ICMENUMPROC,LPARAM); + +HPROPSHEETPAGE +STDCALL +CreatePropertySheetPageW(LPCPROPSHEETPAGE lppsp); + +int +STDCALL +PropertySheetW(LPCPROPSHEETHEADER lppsph); + +HIMAGELIST +STDCALL +ImageList_LoadImageW(HINSTANCE hi, +LPCWSTR lpbmp, +int cx, +int cGrow, +COLORREF crMask, +UINT uType, +UINT uFlags); + +HWND +STDCALL +CreateStatusWindowW(LONG style, LPCWSTR lpszText, HWND hwndParent, UINT wID); + +void +STDCALL +DrawStatusTextW(HDC hDC, LPRECT lprc, LPCWSTR pszText, UINT uFlags); + +WINBOOL +STDCALL +GetOpenFileNameW(LPOPENFILENAME); + +WINBOOL +STDCALL +GetSaveFileNameW(LPOPENFILENAME); + +short +STDCALL +GetFileTitleW(LPCWSTR, LPWSTR, WORD); + +WINBOOL +STDCALL +ChooseColorW(LPCHOOSECOLOR); + +HWND +STDCALL +ReplaceTextW(LPFINDREPLACE); + +WINBOOL +STDCALL +ChooseFontW(LPCHOOSEFONT); + +HWND +STDCALL +FindTextW(LPFINDREPLACE); + +WINBOOL +STDCALL +PrintDlgW(LPPRINTDLG); + +WINBOOL +STDCALL +PageSetupDlgW(LPPAGESETUPDLG); + +WINBOOL +STDCALL +CreateProcessW( + LPCWSTR lpApplicationName, + LPWSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + WINBOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCWSTR lpCurrentDirectory, + LPSTARTUPINFO lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation + ); + +VOID +STDCALL +GetStartupInfoW( + LPSTARTUPINFO lpStartupInfo + ); + +HANDLE +STDCALL +FindFirstFileW( + LPCWSTR lpFileName, + LPWIN32_FIND_DATA lpFindFileData + ); + +WINBOOL +STDCALL +FindNextFileW( + HANDLE hFindFile, + LPWIN32_FIND_DATA lpFindFileData + ); + +WINBOOL +STDCALL +GetVersionExW( + LPOSVERSIONINFO lpVersionInformation + ); + +#define CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y,\ +nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\ +CreateWindowExW(0L, lpClassName, lpWindowName, dwStyle, x, y,\ +nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam) + +#define CreateDialogW(hInstance, lpName, hWndParent, lpDialogFunc) \ +CreateDialogParamW(hInstance, lpName, hWndParent, lpDialogFunc, 0L) + +#define CreateDialogIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \ +CreateDialogIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L) + +#define DialogBoxW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \ +DialogBoxParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L) + +#define DialogBoxIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \ +DialogBoxIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L) + +HDC +STDCALL +CreateDCW(LPCWSTR, LPCWSTR , LPCWSTR , CONST DEVMODE *); + +HFONT +STDCALL +CreateFontA(int, int, int, int, int, DWORD, + DWORD, DWORD, DWORD, DWORD, DWORD, + DWORD, DWORD, LPCSTR); + +DWORD +STDCALL +VerInstallFileW( + DWORD uFlags, + LPWSTR szSrcFileName, + LPWSTR szDestFileName, + LPWSTR szSrcDir, + LPWSTR szDestDir, + LPWSTR szCurDir, + LPWSTR szTmpFile, + PUINT lpuTmpFileLen + ); + +DWORD +STDCALL +GetFileVersionInfoSizeW( + LPWSTR lptstrFilename, + LPDWORD lpdwHandle + ); + +WINBOOL +STDCALL +GetFileVersionInfoW( + LPWSTR lptstrFilename, + DWORD dwHandle, + DWORD dwLen, + LPVOID lpData + ); + +DWORD +STDCALL +VerLanguageNameW( + DWORD wLang, + LPWSTR szLang, + DWORD nSize + ); + +WINBOOL +STDCALL +VerQueryValueW( + const LPVOID pBlock, + LPWSTR lpSubBlock, + LPVOID * lplpBuffer, + PUINT puLen + ); + +DWORD +STDCALL +VerFindFileW( + DWORD uFlags, + LPWSTR szFileName, + LPWSTR szWinDir, + LPWSTR szAppDir, + LPWSTR szCurDir, + PUINT lpuCurDirLen, + LPWSTR szDestDir, + PUINT lpuDestDirLen + ); + +LONG +STDCALL +RegSetValueExW ( + HKEY hKey, + LPCWSTR lpValueName, + DWORD Reserved, + DWORD dwType, + CONST BYTE* lpData, + DWORD cbData + ); + +LONG +STDCALL +RegUnLoadKeyW ( + HKEY hKey, + LPCWSTR lpSubKey + ); + +WINBOOL +STDCALL +InitiateSystemShutdownW( + LPWSTR lpMachineName, + LPWSTR lpMessage, + DWORD dwTimeout, + WINBOOL bForceAppsClosed, + WINBOOL bRebootAfterShutdown + ); + +WINBOOL +STDCALL +AbortSystemShutdownW( + LPWSTR lpMachineName + ); + +LONG +STDCALL +RegRestoreKeyW ( + HKEY hKey, + LPCWSTR lpFile, + DWORD dwFlags + ); + +LONG +STDCALL +RegSaveKeyW ( + HKEY hKey, + LPCWSTR lpFile, + LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + +LONG +STDCALL +RegSetValueW ( + HKEY hKey, + LPCWSTR lpSubKey, + DWORD dwType, + LPCWSTR lpData, + DWORD cbData + ); + +LONG +STDCALL +RegQueryValueW ( + HKEY hKey, + LPCWSTR lpSubKey, + LPWSTR lpValue, + PLONG lpcbValue + ); + +LONG +STDCALL +RegQueryMultipleValuesW ( + HKEY hKey, + PVALENT val_list, + DWORD num_vals, + LPWSTR lpValueBuf, + LPDWORD ldwTotsize + ); + +LONG +STDCALL +RegQueryValueExW ( + HKEY hKey, + LPCWSTR lpValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData + ); + +LONG +STDCALL +RegReplaceKeyW ( + HKEY hKey, + LPCWSTR lpSubKey, + LPCWSTR lpNewFile, + LPCWSTR lpOldFile + ); + +LONG +STDCALL +RegConnectRegistryW ( + LPWSTR lpMachineName, + HKEY hKey, + PHKEY phkResult + ); + +LONG +STDCALL +RegCreateKeyW ( + HKEY hKey, + LPCWSTR lpSubKey, + PHKEY phkResult + ); + +LONG +STDCALL +RegCreateKeyExW ( + HKEY hKey, + LPCWSTR lpSubKey, + DWORD Reserved, + LPWSTR lpClass, + DWORD dwOptions, + REGSAM samDesired, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + PHKEY phkResult, + LPDWORD lpdwDisposition + ); + +LONG +STDCALL +RegDeleteKeyW ( + HKEY hKey, + LPCWSTR lpSubKey + ); + +LONG +STDCALL +RegDeleteValueW ( + HKEY hKey, + LPCWSTR lpValueName + ); + +LONG +STDCALL +RegEnumKeyW ( + HKEY hKey, + DWORD dwIndex, + LPWSTR lpName, + DWORD cbName + ); + +LONG +STDCALL +RegEnumKeyExW ( + HKEY hKey, + DWORD dwIndex, + LPWSTR lpName, + LPDWORD lpcbName, + LPDWORD lpReserved, + LPWSTR lpClass, + LPDWORD lpcbClass, + PFILETIME lpftLastWriteTime + ); + +LONG +STDCALL +RegEnumValueW ( + HKEY hKey, + DWORD dwIndex, + LPWSTR lpValueName, + LPDWORD lpcbValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData + ); + +LONG +STDCALL +RegLoadKeyW ( + HKEY hKey, + LPCWSTR lpSubKey, + LPCWSTR lpFile + ); + +LONG +STDCALL +RegOpenKeyW ( + HKEY hKey, + LPCWSTR lpSubKey, + PHKEY phkResult + ); + +LONG +STDCALL +RegOpenKeyExW ( + HKEY hKey, + LPCWSTR lpSubKey, + DWORD ulOptions, + REGSAM samDesired, + PHKEY phkResult + ); + +LONG +STDCALL +RegQueryInfoKeyW ( + HKEY hKey, + LPWSTR lpClass, + LPDWORD lpcbClass, + LPDWORD lpReserved, + LPDWORD lpcSubKeys, + LPDWORD lpcbMaxSubKeyLen, + LPDWORD lpcbMaxClassLen, + LPDWORD lpcValues, + LPDWORD lpcbMaxValueNameLen, + LPDWORD lpcbMaxValueLen, + LPDWORD lpcbSecurityDescriptor, + PFILETIME lpftLastWriteTime + ); + +int +STDCALL +CompareStringW( + LCID Locale, + DWORD dwCmpFlags, + LPCWSTR lpString1, + int cchCount1, + LPCWSTR lpString2, + int cchCount2); + +int +STDCALL +LCMapStringW( + LCID Locale, + DWORD dwMapFlags, + LPCWSTR lpSrcStr, + int cchSrc, + LPWSTR lpDestStr, + int cchDest); + + +int +STDCALL +GetLocaleInfoW( + LCID Locale, + LCTYPE LCType, + LPWSTR lpLCData, + int cchData); + +WINBOOL +STDCALL +SetLocaleInfoW( + LCID Locale, + LCTYPE LCType, + LPCWSTR lpLCData); + +int +STDCALL +GetTimeFormatW( + LCID Locale, + DWORD dwFlags, + CONST SYSTEMTIME *lpTime, + LPCWSTR lpFormat, + LPWSTR lpTimeStr, + int cchTime); + +int +STDCALL +GetDateFormatW( + LCID Locale, + DWORD dwFlags, + CONST SYSTEMTIME *lpDate, + LPCWSTR lpFormat, + LPWSTR lpDateStr, + int cchDate); + +int +STDCALL +GetNumberFormatW( + LCID Locale, + DWORD dwFlags, + LPCWSTR lpValue, + CONST NUMBERFMT *lpFormat, + LPWSTR lpNumberStr, + int cchNumber); + +int +STDCALL +GetCurrencyFormatW( + LCID Locale, + DWORD dwFlags, + LPCWSTR lpValue, + CONST CURRENCYFMT *lpFormat, + LPWSTR lpCurrencyStr, + int cchCurrency); + +WINBOOL +STDCALL +EnumCalendarInfoW( + CALINFO_ENUMPROC lpCalInfoEnumProc, + LCID Locale, + CALID Calendar, + CALTYPE CalType); + +WINBOOL +STDCALL +EnumTimeFormatsW( + TIMEFMT_ENUMPROC lpTimeFmtEnumProc, + LCID Locale, + DWORD dwFlags); + +WINBOOL +STDCALL +EnumDateFormatsW( + DATEFMT_ENUMPROC lpDateFmtEnumProc, + LCID Locale, + DWORD dwFlags); + +WINBOOL +STDCALL +GetStringTypeExW( + LCID Locale, + DWORD dwInfoType, + LPCWSTR lpSrcStr, + int cchSrc, + LPWORD lpCharType); + +WINBOOL +STDCALL +GetStringTypeW( + DWORD dwInfoType, + LPCWSTR lpSrcStr, + int cchSrc, + LPWORD lpCharType); + +int +STDCALL +FoldStringW( + DWORD dwMapFlags, + LPCWSTR lpSrcStr, + int cchSrc, + LPWSTR lpDestStr, + int cchDest); + +WINBOOL +STDCALL +EnumSystemLocalesW( + LOCALE_ENUMPROC lpLocaleEnumProc, + DWORD dwFlags); + +WINBOOL +STDCALL +EnumSystemCodePagesW( + CODEPAGE_ENUMPROC lpCodePageEnumProc, + DWORD dwFlags); + +WINBOOL +STDCALL +PeekConsoleInputW( + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead + ); + +WINBOOL +STDCALL +ReadConsoleInputW( + HANDLE hConsoleInput, + PINPUT_RECORD lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsRead + ); + +WINBOOL +STDCALL +WriteConsoleInputW( + HANDLE hConsoleInput, + CONST INPUT_RECORD *lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten + ); + +WINBOOL +STDCALL +ReadConsoleOutputW( + HANDLE hConsoleOutput, + PCHAR_INFO lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpReadRegion + ); + +WINBOOL +STDCALL +WriteConsoleOutputW( + HANDLE hConsoleOutput, + CONST CHAR_INFO *lpBuffer, + COORD dwBufferSize, + COORD dwBufferCoord, + PSMALL_RECT lpWriteRegion + ); + +WINBOOL +STDCALL +ReadConsoleOutputCharacterW( + HANDLE hConsoleOutput, + LPWSTR lpCharacter, + DWORD nLength, + COORD dwReadCoord, + LPDWORD lpNumberOfCharsRead + ); + +WINBOOL +STDCALL +WriteConsoleOutputCharacterW( + HANDLE hConsoleOutput, + LPCWSTR lpCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten + ); + +WINBOOL +STDCALL +FillConsoleOutputCharacterW( + HANDLE hConsoleOutput, + WCHAR cCharacter, + DWORD nLength, + COORD dwWriteCoord, + LPDWORD lpNumberOfCharsWritten + ); + +WINBOOL +STDCALL +ScrollConsoleScreenBufferW( + HANDLE hConsoleOutput, + CONST SMALL_RECT *lpScrollRectangle, + CONST SMALL_RECT *lpClipRectangle, + COORD dwDestinationOrigin, + CONST CHAR_INFO *lpFill + ); + +DWORD +STDCALL +GetConsoleTitleW( + LPWSTR lpConsoleTitle, + DWORD nSize + ); + +WINBOOL +STDCALL +SetConsoleTitleW( + LPCWSTR lpConsoleTitle + ); + +WINBOOL +STDCALL +ReadConsoleW( + HANDLE hConsoleInput, + LPVOID lpBuffer, + DWORD nNumberOfCharsToRead, + LPDWORD lpNumberOfCharsRead, + LPVOID lpReserved + ); + +WINBOOL +STDCALL +WriteConsoleW( + HANDLE hConsoleOutput, + CONST VOID *lpBuffer, + DWORD nNumberOfCharsToWrite, + LPDWORD lpNumberOfCharsWritten, + LPVOID lpReserved + ); + +DWORD STDCALL +WNetAddConnectionW( + LPCWSTR lpRemoteName, + LPCWSTR lpPassword, + LPCWSTR lpLocalName + ); + +DWORD STDCALL +WNetAddConnection2W( + LPNETRESOURCE lpNetResource, + LPCWSTR lpPassword, + LPCWSTR lpUserName, + DWORD dwFlags + ); + +DWORD STDCALL +WNetAddConnection3W( + HWND hwndOwner, + LPNETRESOURCE lpNetResource, + LPCWSTR lpPassword, + LPCWSTR lpUserName, + DWORD dwFlags + ); + +DWORD STDCALL +WNetCancelConnectionW( + LPCWSTR lpName, + WINBOOL fForce + ); + +DWORD STDCALL +WNetCancelConnection2W( + LPCWSTR lpName, + DWORD dwFlags, + WINBOOL fForce + ); + +DWORD STDCALL +WNetGetConnectionW( + LPCWSTR lpLocalName, + LPWSTR lpRemoteName, + LPDWORD lpnLength + ); + +DWORD STDCALL +WNetUseConnectionW( + HWND hwndOwner, + LPNETRESOURCE lpNetResource, + LPCWSTR lpUserID, + LPCWSTR lpPassword, + DWORD dwFlags, + LPWSTR lpAccessName, + LPDWORD lpBufferSize, + LPDWORD lpResult + ); + +DWORD STDCALL +WNetSetConnectionW( + LPCWSTR lpName, + DWORD dwProperties, + LPVOID pvValues + ); + +DWORD STDCALL +WNetConnectionDialog1W( + LPCONNECTDLGSTRUCT lpConnDlgStruct + ); + +DWORD STDCALL +WNetDisconnectDialog1W( + LPDISCDLGSTRUCT lpConnDlgStruct + ); + +DWORD STDCALL +WNetOpenEnumW( + DWORD dwScope, + DWORD dwType, + DWORD dwUsage, + LPNETRESOURCE lpNetResource, + LPHANDLE lphEnum + ); + +DWORD STDCALL +WNetEnumResourceW( + HANDLE hEnum, + LPDWORD lpcCount, + LPVOID lpBuffer, + LPDWORD lpBufferSize + ); + +DWORD STDCALL +WNetGetUniversalNameW( + LPCWSTR lpLocalPath, + DWORD dwInfoLevel, + LPVOID lpBuffer, + LPDWORD lpBufferSize + ); + +DWORD STDCALL +WNetGetUserW( + LPCWSTR lpName, + LPWSTR lpUserName, + LPDWORD lpnLength + ); + +DWORD STDCALL +WNetGetProviderNameW( + DWORD dwNetType, + LPWSTR lpProviderName, + LPDWORD lpBufferSize + ); + +DWORD STDCALL +WNetGetNetworkInformationW( + LPCWSTR lpProvider, + LPNETINFOSTRUCT lpNetInfoStruct + ); + +DWORD STDCALL +WNetGetLastErrorW( + LPDWORD lpError, + LPWSTR lpErrorBuf, + DWORD nErrorBufSize, + LPWSTR lpNameBuf, + DWORD nNameBufSize + ); + +DWORD STDCALL +MultinetGetConnectionPerformanceW( + LPNETRESOURCE lpNetResource, + LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct + ); + +WINBOOL +STDCALL +ChangeServiceConfigW( + SC_HANDLE hService, + DWORD dwServiceType, + DWORD dwStartType, + DWORD dwErrorControl, + LPCWSTR lpBinaryPathName, + LPCWSTR lpLoadOrderGroup, + LPDWORD lpdwTagId, + LPCWSTR lpDependencies, + LPCWSTR lpServiceStartName, + LPCWSTR lpPassword, + LPCWSTR lpDisplayName + ); + +SC_HANDLE +STDCALL +CreateServiceW( + SC_HANDLE hSCManager, + LPCWSTR lpServiceName, + LPCWSTR lpDisplayName, + DWORD dwDesiredAccess, + DWORD dwServiceType, + DWORD dwStartType, + DWORD dwErrorControl, + LPCWSTR lpBinaryPathName, + LPCWSTR lpLoadOrderGroup, + LPDWORD lpdwTagId, + LPCWSTR lpDependencies, + LPCWSTR lpServiceStartName, + LPCWSTR lpPassword + ); + +WINBOOL +STDCALL +EnumDependentServicesW( + SC_HANDLE hService, + DWORD dwServiceState, + LPENUM_SERVICE_STATUS lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned + ); + +WINBOOL +STDCALL +EnumServicesStatusW( + SC_HANDLE hSCManager, + DWORD dwServiceType, + DWORD dwServiceState, + LPENUM_SERVICE_STATUS lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned, + LPDWORD lpResumeHandle + ); + +WINBOOL +STDCALL +GetServiceKeyNameW( + SC_HANDLE hSCManager, + LPCWSTR lpDisplayName, + LPWSTR lpServiceName, + LPDWORD lpcchBuffer + ); + +WINBOOL +STDCALL +GetServiceDisplayNameW( + SC_HANDLE hSCManager, + LPCWSTR lpServiceName, + LPWSTR lpDisplayName, + LPDWORD lpcchBuffer + ); + +SC_HANDLE +STDCALL +OpenSCManagerW( + LPCWSTR lpMachineName, + LPCWSTR lpDatabaseName, + DWORD dwDesiredAccess + ); + +SC_HANDLE +STDCALL +OpenServiceW( + SC_HANDLE hSCManager, + LPCWSTR lpServiceName, + DWORD dwDesiredAccess + ); + +WINBOOL +STDCALL +QueryServiceConfigW( + SC_HANDLE hService, + LPQUERY_SERVICE_CONFIG lpServiceConfig, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded + ); + +WINBOOL +STDCALL +QueryServiceLockStatusW( + SC_HANDLE hSCManager, + LPQUERY_SERVICE_LOCK_STATUS lpLockStatus, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded + ); + +SERVICE_STATUS_HANDLE +STDCALL +RegisterServiceCtrlHandlerW( + LPCWSTR lpServiceName, + LPHANDLER_FUNCTION lpHandlerProc + ); + +WINBOOL +STDCALL +StartServiceCtrlDispatcherW( + LPSERVICE_TABLE_ENTRY lpServiceStartTable + ); + +WINBOOL +STDCALL +StartServiceW( + SC_HANDLE hService, + DWORD dwNumServiceArgs, + LPCWSTR *lpServiceArgVectors + ); + +/* Extensions to OpenGL */ + +WINBOOL STDCALL +wglUseFontBitmapsW(HDC, DWORD, DWORD, DWORD); + +WINBOOL STDCALL +wglUseFontOutlinesW(HDC, DWORD, DWORD, DWORD, FLOAT, + FLOAT, int, LPGLYPHMETRICSFLOAT); + +/* ------------------------------------- */ +/* From shellapi.h in old Cygnus headers */ + +unsigned int WINAPI +DragQueryFileW(HDROP, unsigned int, LPCWSTR, unsigned int); + +HICON WINAPI +ExtractAssociatedIconW (HINSTANCE, LPCWSTR, WORD *); + +HICON WINAPI +ExtractIconW (HINSTANCE, const LPCWSTR, unsigned int); + +HINSTANCE WINAPI +FindExecutableW (const LPCWSTR, const LPCWSTR, LPCWSTR); + +int WINAPI +ShellAboutW (HWND, const LPCWSTR, const LPCWSTR, HICON); + +HINSTANCE WINAPI +ShellExecuteW (HWND, const LPCWSTR, const LPCWSTR, LPCWSTR, const LPCWSTR, int); + +/* end of stuff from shellapi.h in old Cygnus headers */ +/* -------------------------------------------------- */ +/* From ddeml.h in old Cygnus headers */ + +HSZ WINAPI +DdeCreateStringHandleW (DWORD, LPCWSTR, int); + +UINT WINAPI +DdeInitializeW (DWORD *, CALLB, DWORD, DWORD); + +DWORD WINAPI +DdeQueryStringW (DWORD, HSZ, LPCWSTR, DWORD, int); + +/* end of stuff from ddeml.h in old Cygnus headers */ +/* ----------------------------------------------- */ + +WINBOOL STDCALL LogonUserW (LPWSTR, LPWSTR, LPWSTR, DWORD, DWORD, HANDLE *); +WINBOOL STDCALL CreateProcessAsUserW (HANDLE, LPCWSTR, LPWSTR, + SECURITY_ATTRIBUTES*, SECURITY_ATTRIBUTES*, WINBOOL, + DWORD, LPVOID, LPCWSTR, STARTUPINFO*, + PROCESS_INFORMATION*); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _GNU_H_WINDOWS32_UNICODEFUNCTIONS */ diff --git a/reactos/include/windows.h b/reactos/include/windows.h new file mode 100644 index 00000000000..207315e7752 --- /dev/null +++ b/reactos/include/windows.h @@ -0,0 +1,86 @@ +/* + windows.h + + Include this file if you wish to use the Windows32 API Library + + Copyright (C) 1996 Free Software Foundation + + Author: Scott Christley + Date: 1996 + + This file is part of the Windows32 API Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + If you are interested in a warranty or support for this source code, + contact Scott Christley for more information. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef _GNU_H_WINDOWS_H +#define _GNU_H_WINDOWS_H + +#ifndef RC_INVOKED +#include +#include +#endif + +/* Base definitions */ +#include + +/* WIN32 messages */ +#include + +/* WIN32 definitions */ +#include + +#ifndef RC_INVOKED + +/* WIN32 structures */ +#include + +/* WIN32 functions */ +#include + +#endif /* ! defined (RC_INVOKED) */ + +/* WIN32 error codes */ +#include + +#ifndef RC_INVOKED + +/* Windows sockets specification version 1.1 */ +#ifdef Win32_Winsock +#include +#endif + +/* There is a conflict with BOOL between Objective-C and Win32, + so the Windows32 API Library defines and uses WINBOOL. + However, if we are not using Objective-C then define the normal + windows BOOL so Win32 programs compile normally. If you are + using Objective-C then you must use WINBOOL for Win32 operations. +*/ +#ifndef __OBJC__ +typedef WINBOOL BOOL; +#endif /* !__OBJC__ */ + +/* How do we get the VM page size on NT? */ +#ifndef vm_page_size +#define vm_page_size 4096 +#endif + +#endif /* ! defined (RC_INVOKED) */ + +#endif /* _GNU_H_WINDOWS_H */ diff --git a/reactos/include/wstring.h b/reactos/include/wstring.h new file mode 100644 index 00000000000..deb3df8a974 --- /dev/null +++ b/reactos/include/wstring.h @@ -0,0 +1,535 @@ +/* + * Adapted from linux for the reactos kernel, march 1998 -- David Welch + * Added wide character string functions, june 1998 -- Boudewijn Dekker + * Removed extern specifier from ___wcstok, june 1998 -- Boudewijn Dekker + * Added wcsicmp and wcsnicmp -- Boudewijn Dekker + */ + +#ifndef _LINUX_WSTRING_H_ +#define _LINUX_WSTRING_H_ + +#include /* for size_t */ + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +wchar_t * ___wcstok; +extern wchar_t * wcscpy(wchar_t *,const wchar_t *); +extern wchar_t * wcsncpy(wchar_t *,const wchar_t *, __kernel_size_t); +extern wchar_t * wcscat(wchar_t *, const wchar_t *); +extern wchar_t * wcsncat(wchar_t *, const wchar_t *, __kernel_size_t); +extern int wcscmp(const wchar_t *,const wchar_t *); +extern int wcsncmp(const wchar_t *,const wchar_t *,__kernel_size_t); +extern wchar_t * wcschr(const wchar_t *,int); +extern wchar_t * wcsrchr(const wchar_t *,int); +extern wchar_t * wcspbrk(const wchar_t *,const wchar_t *); +extern wchar_t * wcstok(wchar_t *,const wchar_t *); +extern wchar_t * wcsstr(const wchar_t *,const wchar_t *); +extern size_t wcsnlen(const wchar_t * s, size_t count); +extern int wcsicmp(const wchar_t* cs,const wchar_t * ct); +extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count); + + +/* + * Include machine specific inline routines + */ +#ifndef _I386_STRING_H_ +#define _I386_STRING_H_ + +/* + * On a 486 or Pentium, we are better off not using the + * byte string operations. But on a 386 or a PPro the + * byte string ops are faster than doing it by hand + * (MUCH faster on a Pentium). + * + * Also, the byte strings actually work correctly. Forget + * the i486 routines for now as they may be broken.. + */ + +#if FIXED_486_STRING && (CPU == 486 || CPU == 586) + #include +#else + +/* + * This string-include defines all string functions as inline + * functions. Use gcc. It also assumes ds=es=data space, this should be + * normal. Most of the string-functions are rather heavily hand-optimized, + * see especially wcstok,wcsstr,wcs[c]spn. They should work, but are not + * very easy to understand. Everything is done entirely within the register + * set, making the functions fast and clean. String instructions have been + * used through-out, making for "slightly" unclear code :-) + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + + + +#define __HAVE_ARCH_WCSCPY +inline wchar_t * wcscpy(wchar_t * dest,const wchar_t *src) +{ +__asm__ __volatile__( + "cld\n" + "1:\tlodsw\n\t" + "stosw\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest):"esi","edi","eax","memory"); +return dest; +} + +#define __HAVE_ARCH_WCSNCPY +inline wchar_t * wcsncpy(wchar_t * dest,const wchar_t *src,size_t count) +{ +__asm__ __volatile__( + "cld\n" + "1:\tdecl %2\n\t" + "js 2f\n\t" + "lodsw\n\t" + "stosw\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b\n\t" + "rep\n\t" + "stosw\n" + "2:" + : /* no output */ + :"S" (src),"D" (dest),"c" (count):"esi","edi","eax","ecx","memory"); +return dest; +} + +#define __HAVE_ARCH_WCSCAT +inline wchar_t * wcscat(wchar_t * dest,const wchar_t * src) +{ +__asm__ __volatile__( + "cld\n\t" + "repnz\n\t" + "scasw\n\t" + "decl %1\n" + "decl %1\n\t" + "1:\tlodsw\n\t" + "stosw\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"esi","edi","eax","ecx"); +return dest; +} + +#define __HAVE_ARCH_WCSNCAT +inline wchar_t * wcsncat(wchar_t * dest,const wchar_t * src,size_t count) +{ +__asm__ __volatile__( + "cld\n\t" + "repnz\n\t" + "scasw\n\t" + "decl %1\n\t" + "movl %4,%3\n" + "decl %1\n\t" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsw\n\t" + "stosw\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b\n" + "2:\txorl %2,%2\n\t" + "stosw" + : /* no output */ + :"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count) + :"esi","edi","eax","ecx","memory"); +return dest; +} + +#define __HAVE_ARCH_WCSCMP +inline int wcscmp(const wchar_t* cs,const wchar_t * ct) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tlodsw\n\t" + "scasw\n\t" + "jne 2f\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 3f\n" + "2:\tsbbl %%eax,%%eax\n\t" + "orw $1,%%eax\n" + "3:" + :"=a" (__res):"S" (cs),"D" (ct):"esi","edi"); +return __res; +} + +#define __HAVE_ARCH_WCSNCMP +inline int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count) +{ +register int __res; +__asm__ __volatile__( + "cld\n" + "1:\tdecl %3\n\t" + "js 2f\n\t" + "lodsw\n\t" + "scasw\n\t" + "jne 3f\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b\n" + "2:\txorl %%eax,%%eax\n\t" + "jmp 4f\n" + "3:\tsbbl %%eax,%%eax\n\t" + "orw $1,%%eax\n" + "4:" + :"=a" (__res):"S" (cs),"D" (ct),"c" (count):"esi","edi","ecx"); +return __res; +} + +#define __HAVE_ARCH_WCSCHR +inline wchar_t * wcschr(const wchar_t * s, int c) +{ +register wchar_t * __res; +__asm__ __volatile__( + "cld\n\t" + "movw %%eax,%%edx\n" + "1:\tlodsw\n\t" + "cmpw %%edx,%%eax\n\t" + "je 2f\n\t" + "testw %%eax,%%eax\n\t" + "jne 1b\n\t" + "movl $1,%1\n" + "2:\tmovl %1,%0\n\t" + "decl %0\n\t" + "decl %0\n\t" + :"=a" (__res):"S" (s),"0" (c):"esi"); +return __res; +} + +#define __HAVE_ARCH_WCSRCHR +inline wchar_t * wcsrchr(const wchar_t * s, int c) +{ +register wchar_t * __res; +__asm__ __volatile__( + "cld\n\t" + "movw %%eax,%%edx\n" + "1:\tlodsw\n\t" + "cmpw %%edx,%%eax\n\t" + "jne 2f\n\t" + "leal -2(%%esi),%0\n" + "2:\ttestw %%eax,%%eax\n\t" + "jne 1b" + :"=d" (__res):"0" (0),"S" (s),"a" (c):"eax","esi"); +return __res; +} + +#define __HAVE_ARCH_WCSSPN +inline size_t wcsspn(const wchar_t * cs, const wchar_t * ct) +{ +register wchar_t * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasw\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsw\n\t" + "testw %%eax,%%eax\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasb\n\t" + "je 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"eax","ecx","edx","edi"); +return __res-cs; +} + +#define __HAVE_ARCH_WCSCSPN +inline size_t wcscspn(const wchar_t * cs, const wchar_t * ct) +{ +register wchar_t * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasw\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsw\n\t" + "testw %%eax,%%eax\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasw\n\t" + "jne 1b\n" + "2:\tdecl %0" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"eax","ecx","edx","edi"); +return __res-cs; +} + +#define __HAVE_ARCH_STRPBRK +inline wchar_t * wcspbrk(const wchar_t * cs,const wchar_t * ct) +{ +register wchar_t * __res; +__asm__ __volatile__( + "cld\n\t" + "movl %4,%%edi\n\t" + "repne\n\t" + "scasw\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "movl %%ecx,%%edx\n" + "1:\tlodsw\n\t" + "testw %%eax,%%eax\n\t" + "je 2f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasw\n\t" + "jne 1b\n\t" + "decl %0\n\t" + "jmp 3f\n" + "2:\txorl %0,%0\n" + "3:" + :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct) + :"eax","ecx","edx","edi"); +return __res; +} + +#define __HAVE_ARCH_WCSSTR +inline wchar_t * wcsstr(const wchar_t * cs,const wchar_t * ct) +{ +register wchar_t * __res; +__asm__ __volatile__( + "cld\n\t" \ + "movl %4,%%edi\n\t" + "repne\n\t" + "scasw\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */ + "movl %%ecx,%%edx\n" + "1:\tmovl %4,%%edi\n\t" + "movl %%esi,%%eax\n\t" + "movl %%edx,%%ecx\n\t" + "repe\n\t" + "cmpsw\n\t" + "je 2f\n\t" /* also works for empty string, see above */ + "xchgl %%eax,%%esi\n\t" + "incl %%esi\n\t" + "cmpw $0,-1(%%eax)\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "2:" + :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct) + :"ecx","edx","edi","esi"); +return __res; +} + + +#define __HAVE_ARCH_WCSLEN +inline size_t wcslen(const wchar_t * s) +{ +register int __res; +__asm__ __volatile__( + "cld\n\t" + "repne\n\t" + "scasw\n\t" + "notl %0\n\t" + "decl %0" + :"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"edi"); +return __res; +} + + + +#define __HAVE_ARCH_WCSTOK + + +inline wchar_t * wcstok(wchar_t * s,const wchar_t * ct) +{ + +register wchar_t * __res; +__asm__ __volatile__( + "testl %1,%1\n\t" + "jne 1f\n\t" + "testl %0,%0\n\t" + "je 8f\n\t" + "movl %0,%1\n" + "1:\txorl %0,%0\n\t" + "movl $-1,%%ecx\n\t" + "xorl %%eax,%%eax\n\t" + "cld\n\t" + "movl %4,%%edi\n\t" + "repnz\n\t" + "scasw\n\t" + "notl %%ecx\n\t" + "decl %%ecx\n\t" + "decl %%ecx\n\t" + "je 7f\n\t" /* empty delimiter-string */ + "movl %%ecx,%%edx\n" + "2:\tlodsw\n\t" + "testw %%eax,%%eax\n\t" + "je 7f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasw\n\t" + "je 2b\n\t" + "decl %1\n\t" + "decl %1\n\t" + "cmpw $0,(%1)\n\t" + "je 7f\n\t" + "movl %1,%0\n" + "3:\tlodsw\n\t" + "testw %%eax,%%eax\n\t" + "je 5f\n\t" + "movl %4,%%edi\n\t" + "movl %%edx,%%ecx\n\t" + "repne\n\t" + "scasw\n\t" + "jne 3b\n\t" + "decl %1\n\t" + "decl %1\n\t" + "decl %1\n\t" + "decl %1\n\t" + "cmpw $0,(%1)\n\t" + "je 5f\n\t" + "movw $0,(%1)\n\t" + "incl %1\n\t" + "incl %1\n\t" + "jmp 6f\n" + "5:\txorl %1,%1\n" + "6:\tcmpw $0,(%0)\n\t" + "jne 7f\n\t" + "xorl %0,%0\n" + "7:\ttestl %0,%0\n\t" + "jne 8f\n\t" + "movl %0,%1\n" + "8:" + :"=b" (__res),"=S" (___wcstok) + :"0" (___wcstok),"1" (s),"g" (ct) + :"eax","ecx","edx","edi","memory"); + +return __res; +} + + +#define __HAVE_ARCH_WCSNNLEN +inline size_t wcsnlen(const wchar_t * s, size_t count) +{ +register int __res; +__asm__ __volatile__( + "movl %1,%0\n\t" + "jmp 2f\n" + "1:\tcmpw $0,(%0)\n\t" + "je 3f\n\t" + "incl %0\n" + "2:\tdecl %2\n\t" + "cmpl $-1,%2\n\t" + "jne 1b\n" + "3:\tsubl %1,%0" + :"=a" (__res) + :"c" (s),"d" (count) + :"edx"); +return __res; +} + + + +#define __HAVE_ARCH_WCSICMP +inline int wcsicmp(const wchar_t* cs,const wchar_t * ct) +{ +register int __res; + + +__asm__ __volatile__( + "cld\n" + "1:\tmovw (%%esi), %%eax\n\t" + "movw (%%edi), %%edx \n\t" + "cmpw $0x5A, %%eax\n\t" + "ja 2f\t\n" + "cmpw $0x40, %%eax\t\n" + "jbe 2f\t\n" + "addw $0x20, %%eax\t\n" + "2:\t cmpw $0x5A, %%edx\t\n" + "ja 3f\t\n" + "cmpw $0x40, %%edx\t\n" + "jbe 3f\t\n" + "addw $0x20, %%edx\t\n" + "3:\t inc %%esi\t\n" + "inc %%esi\t\n" + "inc %%edi\t\n" + "inc %%edi\t\n" + "cmpw %%eax, %%edx\t\n" + "jne 4f\n\t" + "cmpw $00, %%eax\n\t" + "jne 1b\n\t" + "xorl %%eax,%%eax\n\t" + "jmp 5f\n" + "4:\tsbbl %%eax,%%eax\n\t" + "orw $1,%%eax\n" + "5:" + :"=a" (__res):"S" (cs),"D" (ct):"esi","edi"); + +return __res; +} + + +#define __HAVE_ARCH_WCSNICMP +inline int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count) +{ +register int __res; + + +__asm__ __volatile__( + "cld\n" + "1:\t decl %3\n\t" + "js 6f\n\t" + "movw (%%esi), %%eax\n\t" + "movw (%%edi), %%edx \n\t" + "cmpw $0x5A, %%eax\n\t" + "ja 2f\t\n" + "cmpw $0x40, %%eax\t\n" + "jbe 2f\t\n" + "addw $0x20, %%eax\t\n" + "2:\t cmpw $0x5A, %%edx\t\n" + "ja 3f\t\n" + "cmpw $0x40, %%edx\t\n" + "jbe 3f\t\n" + "addw $0x20, %%edx\t\n" + "3:\t inc %%esi\t\n" + "inc %%esi\t\n" + "inc %%edi\t\n" + "inc %%edi\t\n" + "cmpw %%eax, %%edx\t\n" + "jne 4f\n\t" + "cmpw $00, %%eax\n\t" + "jne 1b\n\t" + "6:xorl %%eax,%%eax\n\t" + "jmp 5f\n" + "4:\tsbbl %%eax,%%eax\n\t" + "orw $1,%%eax\n" + "5:" + :"=a" (__res):"S" (cs),"D" (ct), "c" (count):"esi","edi", "ecx"); + + +return __res; +} + +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c new file mode 100644 index 00000000000..9ba6d5b5c7e --- /dev/null +++ b/reactos/lib/kernel32/file/file.c @@ -0,0 +1,58 @@ + +/* + * Win32 File Api functions + * Author: Boudewijn Dekker + * to do: many more to add .. + */ + + +#include + +// AnsiOrOemtoUnicode +// pupose: internal procedure used in file api + +NTSTATUS AnsiOrOemtoUnicode(PUNICODE_STRING DestinationString,PANSI_STRING SourceString, BOOLEAN AllocateDestinationString); + + +BOOLEAN bIsFileApiAnsi; // set the file api to ansi or oem + + +NTSTATUS AnsiOrOemtoUnicode(PUNICODE_STRING DestinationString,PANSI_STRING SourceString, BOOLEAN AllocateDestinationString) +{ + if ( bIsFileApiAnsi ) { + return __AnsiStringToUnicodeString(DestinationString, SourceString, AllocateDestinationString); + else + return __OemStringToUnicodeString(DestinationString, SourceString, AllocateDestinationString); + +} + + +WINBASEAPI +VOID +WINAPI +SetFileApisToOEM(VOID) +{ + bIsFileApiAnsi = FALSE; + return; +} + + + +WINBASEAPI +VOID +WINAPI +SetFileApisToANSI(VOID) +{ + bIsFileApiAnsi = TRUE; + return; +} + + +WINBASEAPI +BOOLEAN +WINAPI +AreFileApisANSI(VOID) +{ + return bIsFileApiAnsi; + +} diff --git a/reactos/lib/kernel32/file/lfile.c b/reactos/lib/kernel32/file/lfile.c new file mode 100644 index 00000000000..9f611423207 --- /dev/null +++ b/reactos/lib/kernel32/file/lfile.c @@ -0,0 +1,138 @@ +/* +* created: Boudewijn Dekker +* org. source: WINE +* date: june 1998 +* todo: check the _lopen for correctness +*/ + +#include +#include +#include + + + + +long _hread( + HFILE hFile, + LPVOID lpBuffer, + long lBytes + ) +{ + DWORD NumberOfBytesRead; + if ( ReadFile((HANDLE)hFile,(LPCVOID)lpBuffer,(DWORD)lBytes,&NumberOfBytesRead, NULL) == FALSE ) + return -1; + else + return NumberOfBytesRead; + +} + +long +_lread(HFILE fd,LPVOID buffer,long count) +{ + return _hread(fd,buffer, count); +} + + +long _hwrite( + HFILE hFile, + LPCSTR lpBuffer, + long lBytes + ) +{ + + DWORD NumberOfBytesWritten; + if ( lBytes == 0 ) { + if ( SetEndOfFile((HANDLE) hFile ) == FALSE ) + return -1; + else + return 0; + } + if ( WriteFile((HANDLE)hFile,(LPCVOID)lpBuffer,(DWORD)lBytes, &NumberOfBytesWritten,NULL) == FALSE ) + return -1; + else + return NumberOfBytesWritten; + +} + + +long _lwrite( + HFILE hFile, + LPCSTR lpBuffer, + long lBytes + ) +{ + return _hwrite(hFile,lpBuffer,lBytes); +} + +#define OF_OPENMASK (OF_READ|OF_READWRITE|OF_WRITE|OF_CREATE) +#define OF_FILEMASK (OF_DELETE|OF_PARSE) +#define OF_MASK (OF_OPENMASK|OF_FILEMASK) + +HFILE _open( LPCSTR lpPathName, int iReadWrite ) +{ + + + + HFILE fd; + int nFunction; + + + + + /* Don't assume a 1:1 relationship between OF_* modes and O_* modes */ + /* Here we translate the read/write permission bits (which had better */ + /* be the low 2 bits. If not, we're in trouble. Other bits are */ + /* passed through unchanged */ + + nFunction = wFunction & 3; + + switch (wFunction & 3) { + case OF_READ: + nFunction |= O_RDONLY; + break; + case OF_READWRITE: + nFunction |= O_RDWR; + break; + case OF_WRITE: + nFunction |= O_WRONLY; + break; + default: + //ERRSTR((LF_ERROR, "_lopen: bad file open mode %x\n", wFunction)); + return HFILE_ERROR; + } + SetLastError(0); + fd = CreateFileA( filename,nFunction,OPEN_EXISTING, + NULL,OPEN_EXISTING,NULL,NULL); + if (fd == INVALID_HANDLE_VALUE ) + return HFILE_ERROR; + return fd; +} + +int _creat(const char *filename, int pmode) +{ + SetLastError(0); + return CreateFileA( filename,GENERIC_READ & GENERIC_WRITE,FILE_SHARE_WRITE, + NULL,CREATE_ALWAYS,pmode & 0x00003FB7,NULL); +} + + +int _lclose( + HFILE hFile + ) +{ + if ( CloseHandle((HANDLE)hFile) ) + return 0; + else + rerturn -1; +} + +LONG _llseek( + HFILE hFile, + LONG lOffset, + int iOrigin + ) +{ + return SetFilePointer((HANDLE) hFile, lOffset, NULL,(DWORD)iOrigin ); +} + + diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile new file mode 100644 index 00000000000..669f5d1c0db --- /dev/null +++ b/reactos/lib/kernel32/makefile @@ -0,0 +1,10 @@ +all: dummy + +OBJECTS = file/file.o file/lfile.o mem/virtual.o mem/local.o mem/global.o + +kernel32_lib: $(OBJECTS) + $(LD) --oformat=coff-go32 -Ttext b0000000 $(LDFLAGS) $(OBJECTS) -o kernel32.dll + +dummy: + +include ../../rules.mak diff --git a/reactos/lib/kernel32/mem/global.cc b/reactos/lib/kernel32/mem/global.cc new file mode 100644 index 00000000000..e75316c9ae3 --- /dev/null +++ b/reactos/lib/kernel32/mem/global.cc @@ -0,0 +1,320 @@ +/* + * Win32 Global/Local heap functions (GlobalXXX, LocalXXX). + * These functions included in Win32 for compatibility with 16 bit Windows + * Especially the moveable blocks and handles are oldish. + * But the ability to directly allocate memory with GPTR and LPTR is widely + * used. + */ + +#include + +#define MAGIC_GLOBAL_USED 0x5342BEEF +#define GLOBAL_LOCK_MAX 0xFF + +typedef struct __GLOBAL_LOCAL_HANDLE +{ + ULONG Magic; + LPVOID Pointer; + BYTE Flags; + BYTE LockCount; +} GLOBAL_HANDLE, LOCAL_HANDLE, *PGLOBAL_HANDLE, *PLOCAL_HANDLE; + +/********************************************************************* +* GlobalAlloc -- KERNEL32 * +*********************************************************************/ +HGLOBAL WINAPI GlobalAlloc(UINT flags, DWORD size) +{ + PGLOBAL_HANDLE phandle; + LPVOID palloc; + + aprintf("GlobalAlloc( 0x%X, 0x%lX )\n", flags, size ); + + if((flags & GMEM_MOVEABLE)==0) /* POINTER */ + { + palloc=HeapAlloc(__ProcessHeap, 0, size); + return (HGLOBAL) palloc; + } + else /* HANDLE */ + { + HeapLock(__ProcessHeap); + + + phandle=__HeapAllocFragment(__ProcessHeap, 0, sizeof(GLOBAL_HANDLE)); + if(size) + { + palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE)); + *(PHANDLE)palloc=(HANDLE) &(phandle->Pointer); + phandle->Pointer=palloc+sizeof(HANDLE); + } + else + phandle->Pointer=NULL; + phandle->Magic=MAGIC_GLOBAL_USED; + phandle->Flags=flags>>8; + phandle->LockCount=0; + HeapUnlock(__ProcessHeap); + + return (HGLOBAL) &(phandle->Pointer); + } +} + +/********************************************************************* +* GlobalLock -- KERNEL32 * +*********************************************************************/ +LPVOID WINAPI GlobalLock(HGLOBAL hmem) +{ + PGLOBAL_HANDLE phandle; + LPVOID palloc; + + aprintf("GlobalLock( 0x%lX )\n", (ULONG) hmem ); + + if(((ULONG)hmem%8)==0) + return (LPVOID) hmem; + + HeapLock(__ProcessHeap); + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + if(phandle->Magic==MAGIC_GLOBAL_USED) + { + if(phandle->LockCountLockCount++; + palloc=phandle->Pointer; + } + else + { + dprintf("GlobalLock: invalid handle\n"); + palloc=(LPVOID) hmem; + } + HeapUnlock(__ProcessHeap); + return palloc; +} + +/********************************************************************* +* GlobalUnlock -- KERNEL32 * +*********************************************************************/ +BOOL WINAPI GlobalUnlock(HGLOBAL hmem) +{ + PGLOBAL_HANDLE phandle; + BOOL locked; + + aprintf("GlobalUnlock( 0x%lX )\n", (ULONG) hmem ); + + if(((ULONG)hmem%8)==0) + return FALSE; + + HeapLock(__ProcessHeap); + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + if(phandle->Magic==MAGIC_GLOBAL_USED) + { + if((phandle->LockCountLockCount>0)) + phandle->LockCount--; + + locked=(phandle->LockCount==0) ? TRUE : FALSE; + } + else + { + dprintf("GlobalUnlock: invalid handle\n"); + locked=FALSE; + } + HeapUnlock(__ProcessHeap); + return locked; +} + +/********************************************************************* +* GlobalHandle -- KERNEL32 * +*********************************************************************/ +HGLOBAL WINAPI GlobalHandle(LPCVOID pmem) +{ + aprintf("GlobalHandle( 0x%lX )\n", (ULONG) pmem ); + + if(((ULONG)pmem%8)==0) /* FIXED */ + return (HGLOBAL) pmem; + else /* MOVEABLE */ + return (HGLOBAL) *(LPVOID *)(pmem-sizeof(HANDLE)); +} + +/********************************************************************* +* GlobalReAlloc -- KERNEL32 * +*********************************************************************/ +HGLOBAL WINAPI GlobalReAlloc(HGLOBAL hmem, DWORD size, UINT flags) +{ + LPVOID palloc; + HGLOBAL hnew; + PGLOBAL_HANDLE phandle; + + aprintf("GlobalReAlloc( 0x%lX, 0x%lX, 0x%X )\n", (ULONG) hmem, size, flags ); + + hnew=NULL; + HeapLock(__ProcessHeap); + if(flags & GMEM_MODIFY) /* modify flags */ + { + if( (((ULONG)hmem%8)==0) && (flags & GMEM_MOVEABLE)) + { + /* make a fixed block moveable + * actually only NT is able to do this. And it's soo simple + */ + size=HeapSize(__ProcessHeap, 0, (LPVOID) hmem); + hnew=GlobalAlloc( flags, size); + palloc=GlobalLock(hnew); + memcpy(palloc, (LPVOID) hmem, size); + GlobalUnlock(hnew); + GlobalFree(hmem); + } + else if((((ULONG)hmem%8) != 0)&&(flags & GMEM_DISCARDABLE)) + { + /* change the flags to make our block "discardable" */ + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + phandle->Flags = phandle->Flags | (GMEM_DISCARDABLE >> 8); + hnew=hmem; + } + else + { + SetLastError(ERROR_INVALID_PARAMETER); + hnew=NULL; + } + } + else + { + if(((ULONG)hmem%8)!=0) + { + /* reallocate fixed memory */ + hnew=(HANDLE)HeapReAlloc(__ProcessHeap, 0, (LPVOID) hmem, size); + } + else + { + /* reallocate a moveable block */ + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + if(phandle->LockCount!=0) + SetLastError(ERROR_INVALID_HANDLE); + else if(size!=0) + { + hnew=hmem; + if(phandle->Pointer) + { + palloc=HeapReAlloc(__ProcessHeap, 0, + phandle->Pointer-sizeof(HANDLE), + size+sizeof(HANDLE) ); + phandle->Pointer=palloc+sizeof(HANDLE); + } + else + { + palloc=HeapAlloc(__ProcessHeap, 0, size+sizeof(HANDLE)); + *(PHANDLE)palloc=hmem; + phandle->Pointer=palloc+sizeof(HANDLE); + } + } + else + { + if(phandle->Pointer) + { + HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE)); + phandle->Pointer=NULL; + } + } + } + } + HeapUnlock(__ProcessHeap); + return hnew; +} + +/********************************************************************* +* GlobalFree -- KERNEL32 * +*********************************************************************/ +HGLOBAL WINAPI GlobalFree(HGLOBAL hmem) +{ + PGLOBAL_HANDLE phandle; + + aprintf("GlobalFree( 0x%lX )\n", (ULONG) hmem ); + + if(((ULONG)hmem%4)==0) /* POINTER */ + { + HeapFree(__ProcessHeap, 0, (LPVOID) hmem); + } + else /* HANDLE */ + { + HeapLock(__ProcessHeap); + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + if(phandle->Magic==MAGIC_GLOBAL_USED) + { + HeapLock(__ProcessHeap); + if(phandle->LockCount!=0) + SetLastError(ERROR_INVALID_HANDLE); + if(phandle->Pointer) + HeapFree(__ProcessHeap, 0, phandle->Pointer-sizeof(HANDLE)); + __HeapFreeFragment(__ProcessHeap, 0, phandle); + } + HeapUnlock(__ProcessHeap); + } + return hmem; +} + +/********************************************************************* +* GlobalSize -- KERNEL32 * +*********************************************************************/ +DWORD WINAPI GlobalSize(HGLOBAL hmem) +{ + DWORD retval; + PGLOBAL_HANDLE phandle; + + aprintf("GlobalSize( 0x%lX )\n", (ULONG) hmem ); + + if(((ULONG)hmem%8)==0) + { + retval=HeapSize(__ProcessHeap, 0, hmem); + } + else + { + HeapLock(__ProcessHeap); + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + if(phandle->Magic==MAGIC_GLOBAL_USED) + { + retval=HeapSize(__ProcessHeap, 0, (phandle->Pointer)-sizeof(HANDLE))-4; + } + else + { + dprintf("GlobalSize: invalid handle\n"); + retval=0; + } + HeapUnlock(__ProcessHeap); + } + return retval; +} + +/********************************************************************* +* GlobalWire -- KERNEL32 * +*********************************************************************/ +LPVOID WINAPI GlobalWire(HGLOBAL hmem) +{ + return GlobalLock( hmem ); +} + +/********************************************************************* +* GlobalUnWire -- KERNEL32 * +*********************************************************************/ +BOOL WINAPI GlobalUnWire(HGLOBAL hmem) +{ + return GlobalUnlock( hmem); +} + +/********************************************************************* +* GlobalFix -- KERNEL32 * +*********************************************************************/ +VOID WINAPI GlobalFix(HGLOBAL hmem) +{ + GlobalLock( hmem ); +} + +/********************************************************************* +* GlobalUnfix -- KERNEL32 * +*********************************************************************/ +VOID WINAPI GlobalUnfix(HGLOBAL hmem) +{ + GlobalUnlock( hmem); +} + +/********************************************************************* +* GlobalFlags -- KERNEL32 * +*********************************************************************/ +UINT WINAPI GlobalFlags(HGLOBAL hmem) +{ + return LocalFlags( (HLOCAL) hmem); +} + diff --git a/reactos/lib/kernel32/mem/heap.c b/reactos/lib/kernel32/mem/heap.c new file mode 100644 index 00000000000..bb0b8537dc6 --- /dev/null +++ b/reactos/lib/kernel32/mem/heap.c @@ -0,0 +1,1007 @@ +/* + * kernel/heap.c + * Copyright (C) 1996, Onno Hovers, All rights reserved + * + * This software 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 software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this software; see the file COPYING.LIB. If + * not, write to the Free Software Foundation, Inc., 675 Mass Ave, + * Cambridge, MA 02139, USA. + * + * Win32 heap functions (HeapXXX). + * + */ + +/* + * Adapted for the ReactOS system libraries by David Welch (welch@mcmail.com) + * Put the type definitions of the heap in a seperate header. Boudewijn Dekker + */ + +#include + +static HEAP_BUCKET __HeapDefaultBuckets[]= +{ + { NULL, 16, 18, 504 }, + { NULL, 24, 30, 1016 }, + { NULL, 32, 24, 1016 }, + { NULL, 48, 17, 1016 }, + { NULL, 64, 27, 2040 }, + { NULL, 96, 19, 2040 }, + { NULL, 128, 29, 4088 }, + { NULL, 256, 15, 4088 }, +}; + + +static BOOL __HeapCommit(PHEAP pheap, LPVOID start, LPVOID end); +static BOOL __HeapDecommit(PHEAP pheap, LPVOID start, LPVOID end); +static LPVOID __HeapAlloc(PHEAP pheap, ULONG flags, ULONG size, ULONG tag); +static VOID __HeapFreeRest(PHEAP pheap, PHEAP_BLOCK pfree, ULONG allocsize, + ULONG newsize); +static LPVOID __HeapReAlloc(PHEAP pheap, ULONG flags, LPVOID pold, ULONG size); +static BOOL __HeapFree(PHEAP pheap, ULONG flags, LPVOID pmem); +static PHEAP_SUBALLOC __HeapAllocSub(PHEAP pheap, PHEAP_BUCKET pbucket); +static LPVOID __HeapAllocFragment(PHEAP pheap, ULONG flags, ULONG size); +static LPVOID __HeapReAllocFragment(PHEAP pheap, ULONG flags, + LPVOID pold, ULONG size); +static BOOL __HeapFreeFragment(PHEAP pheap, ULONG flags, LPVOID ptr); +static PHEAP __HeapPrepare(LPVOID base, ULONG minsize, ULONG maxsize, + ULONG flags); + + + +/********************************************************************* +* __HeapCommit * +* * +* commits a range of memory in the heap * +*********************************************************************/ +static BOOL __HeapCommit(PHEAP pheap, LPVOID start, LPVOID end) +{ + dprintf("__HeapCommit( 0x%lX, 0x%lX, 0x%lX)\n", + (ULONG) pheap, (ULONG) start, (ULONG) end); +#ifdef NOT + __VirtualDump(); +#endif + if(end >= pheap->LastBlock) + pheap->LastBlock=end; + return __VirtualCommit(start, end-start, PAGE_READWRITE); +} + +/********************************************************************* +* __HeapDecommit * +* * +* decommits a range of memory in the heap * +*********************************************************************/ +static BOOL __HeapDecommit(PHEAP pheap, LPVOID start, LPVOID end) +{ + dprintf("__HeapDecommit( 0x%lX, 0x%lX, 0x%lX)\n", + (ULONG) pheap, (ULONG) start, (ULONG) end); +#ifdef NOT + __VirtualDump(); +#endif + if((end >= pheap->LastBlock)&&(start<= pheap->LastBlock)) + pheap->LastBlock=start; + return __VirtualDecommit(start, end-start ); +} + +/********************************************************************* +* __HeapAlloc * +* * +* allocates a range of memory from the heap * +*********************************************************************/ +static LPVOID __HeapAlloc(PHEAP pheap, ULONG flags, ULONG size, ULONG tag) +{ + PHEAP_BLOCK pfree; + PHEAP_BLOCK palloc; + PHEAP_BLOCK pnext; + LPVOID commitstart; + LPVOID commitend; + ULONG freesize; + ULONG allocsize; + + pfree=&(pheap->Start); + allocsize=SIZE_ROUND(size); + freesize=HEAP_SIZE(pfree); + /* look for a free region of memory: simple First Fit */ + while( HEAP_ISALLOC(pfree) || ( freesize=pheap->End) + return __ErrorReturnNull(ERROR_OUTOFMEMORY); + freesize=HEAP_SIZE(pfree); + } + palloc=pfree; + + if(freesize>allocsize) + { + /* commit necessary memory */ + commitstart=(LPVOID) ROUNDDOWN((ULONG) palloc+HEAP_ADMIN_SIZE,PAGESIZE); + commitend =(LPVOID) ROUNDUP ((ULONG) palloc+ + allocsize+2*HEAP_ADMIN_SIZE, PAGESIZE); + if(commitstartSize =(freesize-allocsize-HEAP_ADMIN_SIZE) | HEAP_FREE_TAG; + pfree->PrevSize=(LPVOID)pfree-(LPVOID)palloc; + + pnext=HEAP_NEXT(pfree); + if((LPVOID) pnext < pheap->End ) + pnext->PrevSize=freesize-allocsize; + } + else + { + /* commit necessary memory */ + commitstart=(LPVOID) ROUNDDOWN((ULONG) palloc+HEAP_ADMIN_SIZE, PAGESIZE); + commitend =(LPVOID) ROUNDUP((ULONG) palloc+HEAP_ADMIN_SIZE +allocsize, + PAGESIZE); + if(commitstartSize= size | tag; + if((flags | pheap->Flags)& HEAP_ZERO_MEMORY) + memset((LPVOID)palloc+HEAP_ADMIN_SIZE, 0, allocsize); + return (LPVOID)palloc+HEAP_ADMIN_SIZE; +} + +/********************************************************************* +* __HeapFreeRest * +* * +* used by realloc to free a part of the heap * +*********************************************************************/ +static VOID __HeapFreeRest(PHEAP pheap, PHEAP_BLOCK pfree, + ULONG allocsize, ULONG newsize) +{ + PHEAP_BLOCK pnext; + + if(allocsize==newsize) + { + pfree->PrevSize=allocsize+HEAP_ADMIN_SIZE; + return; + } + + pfree->Size = (allocsize-newsize-HEAP_ADMIN_SIZE) | HEAP_FREE_TAG; + pfree->PrevSize = newsize+HEAP_ADMIN_SIZE; + + pnext=HEAP_NEXT(pfree); + /* if there is a free region of memory after us, join it */ + if(((LPVOID) pnext< pheap->End)&& HEAP_ISFREE(pnext)) + { + pfree->Size = (HEAP_SIZE(pfree)+HEAP_SIZE(pnext) + HEAP_ADMIN_SIZE) | + HEAP_FREE_TAG; + + pnext->Size=0; + pnext->PrevSize=0; + } + + pnext=HEAP_NEXT(pfree); + if((LPVOID) pnext< pheap->End) + pnext->PrevSize=(LPVOID)pnext-(LPVOID)pfree; +} + +/********************************************************************* +* __HeapReAlloc * +* * +* reallocates a range of memory from the heap * +*********************************************************************/ + +static LPVOID __HeapReAlloc(PHEAP pheap, ULONG flags, LPVOID pold, DWORD size) +{ + PHEAP_BLOCK prealloc=(PHEAP_BLOCK)((LPVOID)pold-HEAP_ADMIN_SIZE); + PHEAP_BLOCK pnext; + LPVOID pmem; + LPVOID commitstart; + LPVOID commitend; + ULONG allocsize; + ULONG newsize; + ULONG oldsize; + + /* check that this is a valid allocated block */ + if(!HEAP_ISALLOC(prealloc)) + return __ErrorReturnNull(ERROR_INVALID_PARAMETER); + + allocsize = HEAP_RSIZE(prealloc); + newsize = SIZE_ROUND(size); + /* + * cases: size=0 free memory + * [ sizeprevious size try to merge + * else realloc + */ + if(size==0) + { + dprintf("__HeapReAlloc: freeing memory\n"); + __HeapFree(pheap, flags, pold); + return NULL; + } +#ifdef NOT + else if(size < HEAP_FRAGMENT_THRESHOLD) + { + /* alloc a new fragment */ + pmem=__HeapAllocFragment(pheap, flags, size); + if(pmem) + memcpy(pmem, pold, size); + return pmem; + } +#endif + else if(newsize < allocsize ) + { + dprintf("__HeapReAlloc: shrinking memory\n"); + /* free remaining region of memory */ + prealloc->Size=size | HEAP_NORMAL_TAG; + pnext=HEAP_NEXT(prealloc); + __HeapFreeRest(pheap, pnext, allocsize, newsize); + + /* decommit unnecessary memory */ + commitstart=(LPVOID) ROUNDUP((ULONG) pnext+HEAP_ADMIN_SIZE ,PAGESIZE); + commitend =(LPVOID) ROUNDDOWN((ULONG) pnext+HEAP_ADMIN_SIZE+ + HEAP_SIZE(pnext), PAGESIZE); + if(commitstartSize= size | HEAP_NORMAL_TAG; + return pold; + } + else if(newsize > allocsize) + { + /* try to merge */ + pnext=HEAP_NEXT(prealloc); + + if(((LPVOID) pnext< pheap->End)&& HEAP_ISFREE(pnext) && + (HEAP_SIZE(pnext) + HEAP_ADMIN_SIZE >=newsize-allocsize)) + { + dprintf("__HeapReAlloc: joining memory\n"); + oldsize=HEAP_SIZE(prealloc); + prealloc->Size=size | HEAP_NORMAL_TAG; + + /* commit new memory if necessary */ + commitstart=(LPVOID) ROUNDDOWN((ULONG) pnext+HEAP_ADMIN_SIZE, + PAGESIZE); + commitend =(LPVOID) ROUNDUP((ULONG) pnext+newsize-allocsize+ + HEAP_ADMIN_SIZE, PAGESIZE); + if(commitstartFlags)&HEAP_ZERO_MEMORY) + memset(pold+oldsize, 0, size-oldsize); + return pold; + } + else + { + if((flags&HEAP_REALLOC_IN_PLACE_ONLY)==0) + { + dprintf("__HeapReAlloc: allocating new memory\n"); + /* alloc a new piece of memory */ + oldsize=HEAP_SIZE(prealloc); + pmem=__HeapAlloc(pheap, flags, size, HEAP_NORMAL_TAG); + if(pmem) + memcpy(pmem, pold, oldsize); + if((flags|pheap->Flags)&HEAP_ZERO_MEMORY) + memset(pmem + oldsize, 0, size-oldsize); + __HeapFree(pheap, flags, pold); + return pmem; + } + else + return __ErrorReturnNull(ERROR_OUTOFMEMORY); + } + } + return NULL; +} + +/********************************************************************* +* __HeapFree * +* * +* frees a range of memory from the heap * +*********************************************************************/ + +static BOOL __HeapFree(PHEAP pheap, ULONG flags, LPVOID ptr) +{ + PHEAP_BLOCK pfree=(PHEAP_BLOCK)((LPVOID)ptr-HEAP_ADMIN_SIZE); + PHEAP_BLOCK pprev; + PHEAP_BLOCK pnext; + LPVOID decommitstart; + LPVOID decommitend; + + /* check that this is a valid allocated block */ + if(!HEAP_ISALLOC(pfree)) + return FALSE; + + pfree->Size = HEAP_RSIZE(pfree) | HEAP_FREE_TAG; + + /* if there is a free region of memory before us, join it */ + pprev=HEAP_PREV(pfree); + pnext=HEAP_NEXT(pfree); + if((pprev!=pfree) && HEAP_ISFREE(pprev)) + { + pprev->Size = (HEAP_SIZE(pprev)+HEAP_SIZE(pfree) + HEAP_ADMIN_SIZE) | + HEAP_FREE_TAG; + if((LPVOID) pnextEnd) + pnext->PrevSize=(LPVOID)pnext-(LPVOID)pprev; + + pfree->Size=0; + pfree->PrevSize=0; + pfree=pprev; + } + /* if there is a free region of memory after us, join it */ + if(((LPVOID) pnext< pheap->End)&& HEAP_ISFREE(pnext)) + { + pfree->Size = (HEAP_SIZE(pfree)+HEAP_SIZE(pnext) + HEAP_ADMIN_SIZE) | + HEAP_FREE_TAG; + + pnext->Size=0; + pnext->PrevSize=0; + + pnext=HEAP_NEXT(pfree); + if((LPVOID) pnext< pheap->End) + pnext->PrevSize=(LPVOID)pnext-(LPVOID)pfree; + } + + /* decommit unnecessary memory */ + decommitstart=(LPVOID) ROUNDUP((ULONG) pfree+HEAP_ADMIN_SIZE ,PAGESIZE); + decommitend =(LPVOID) ROUNDDOWN((ULONG) pfree+HEAP_ADMIN_SIZE+ + HEAP_SIZE(pfree), PAGESIZE); + if(decommitstartTotalSize, + HEAP_SUB_TAG); + if(!psub) + return __ErrorReturnNull(ERROR_OUTOFMEMORY); + + /* initialize suballoc */ + palloc=(PHEAP_FRAGMENT) ((LPVOID)psub + sizeof(HEAP_SUBALLOC)); + psub->FirstFree=palloc; + psub->NumberFree=pbucket->Number; + psub->Bitmap=0; + psub->Next=pbucket->FirstFree; + psub->Prev=NULL; + psub->Bucket=pbucket; + pbucket->FirstFree=psub; + + /* initialize free fragments */ + add=pbucket->Size+HEAP_FRAG_ADMIN_SIZE; + pprev=NULL; + for(i=0;iNumber;i++) + { + pnext=(PHEAP_FRAGMENT)((LPVOID)palloc+add); + palloc->Magic=HEAP_FRAG_MAGIC; + palloc->Number=i; + palloc->Size=pbucket->Size; + palloc->Sub=psub; + palloc->FreeNext=pnext; + palloc->FreePrev=pprev; + pprev=palloc; + palloc=pnext; + } + pprev->FreeNext=NULL; + return psub; +} + +/********************************************************************* +* __HeapAllocFragment * +* * +* allocates a small fragment of memory from the heap * +*********************************************************************/ +static LPVOID __HeapAllocFragment(PHEAP pheap, ULONG flags, ULONG size ) +{ + PHEAP_BUCKET pbucket; + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT palloc; + INT nalloc; + + /* get bucket size */ + pbucket=pheap->Bucket; + while(size>pbucket->Size) + { + pbucket++; + } + /* get suballoc */ + psub = pbucket->FirstFree; + if(!psub) + psub = __HeapAllocSub(pheap, pbucket); + if(!psub) + return NULL; + + /* do our bookkeeping */ + palloc = psub->FirstFree; + psub->FirstFree = palloc->FreeNext; + nalloc = palloc->Number; + psub->NumberFree--; + psub->Bitmap|=(1<NumberFree) + pbucket->FirstFree=psub->Next; + + /* initialize allocated block */ + palloc->Magic=HEAP_FRAG_MAGIC; + palloc->Size=size; + + if((flags|pheap->Flags)&HEAP_ZERO_MEMORY) + memset((LPVOID)palloc+HEAP_FRAG_ADMIN_SIZE, 0, pbucket->Size); + return (LPVOID) palloc+HEAP_FRAG_ADMIN_SIZE; +} + +/********************************************************************* +* __HeapReAllocFragment * +* * +* reallocates a small fragment of memory * +*********************************************************************/ +static LPVOID __HeapReAllocFragment(PHEAP pheap, ULONG flags, + LPVOID pold, ULONG size ) +{ + PHEAP_BUCKET pbucket; + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT) + ((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE); + LPVOID pmem; + + /* sanity checks */ + if(pfrag->Magic!=HEAP_FRAG_MAGIC) + return __ErrorReturnNull(ERROR_INVALID_PARAMETER); + + /* get bucket size */ + psub=pfrag->Sub; + pbucket=psub->Bucket; + if(size<=pbucket->Size) + { + pfrag->Size=size; + return pold; + } + else + { + if((flags&HEAP_REALLOC_IN_PLACE_ONLY)==0) + { + /* alloc a new piece of memory */ + if(size>HEAP_FRAGMENT_THRESHOLD) + pmem=__HeapAlloc(pheap, flags, size, HEAP_NORMAL_TAG); + else + pmem=__HeapAllocFragment(pheap, flags, size); + + if(pmem) + memcpy(pmem, pold, size); + if((flags|pheap->Flags)&HEAP_ZERO_MEMORY) + memset(pmem+pfrag->Size, 0, size-pfrag->Size); + + __HeapFreeFragment(pheap, flags, pold); + return pmem; + } + } + return NULL; +} + +/********************************************************************* +* __HeapFreeFragment * +* * +* frees a small fragment of memory * +*********************************************************************/ +static BOOL __HeapFreeFragment(PHEAP pheap, ULONG flags, LPVOID pfree ) +{ + PHEAP_BUCKET pbucket; + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT) + ((LPVOID)pfree-HEAP_FRAG_ADMIN_SIZE); + INT nalloc; + + /* sanity checks */ + if(pfrag->Magic!=HEAP_FRAG_MAGIC) + return __ErrorReturnFalse(ERROR_INVALID_PARAMETER); + + /* get bucket size */ + psub=pfrag->Sub; + pbucket=psub->Bucket; + + nalloc=pfrag->Number; + if((psub->Bitmap&(1<NumberFree++; + if(psub->NumberFree==pbucket->Number) + { + /* free suballoc */ + if(psub==pbucket->FirstFree) + pbucket->FirstFree=psub->Next; + if(psub->Prev) + psub->Prev->Next=psub->Next; + if(psub->Next) + psub->Next->Prev=psub->Prev; + if(!__HeapFree(pheap, flags, psub)) + return FALSE; + } + else + { + /* free fragment */ + psub->Bitmap&= ~(1<FirstFree) + { + pfrag->FreeNext = psub->FirstFree; + pfrag->FreePrev = NULL; + psub->FirstFree->FreePrev = pfrag; + psub->FirstFree = pfrag; + } + else + { + psub->FirstFree=pfrag; + pfrag->FreePrev=NULL; + pfrag->FreeNext=NULL; + } + } + return TRUE; +} + +/********************************************************************* +* __HeapPrepare * +* * +* Fills in all the data structures of a heap * +*********************************************************************/ +PHEAP __HeapPrepare(LPVOID base, ULONG minsize, ULONG maxsize, ULONG flags) +{ + PHEAP pheap=(PHEAP) base; + + pheap->Magic=MAGIC_HEAP; + pheap->End= ((LPVOID)pheap)+minsize; + pheap->Flags=flags; + pheap->LastBlock=(LPVOID)pheap + PAGESIZE; + memcpy(pheap->Bucket,__HeapDefaultBuckets,sizeof(__HeapDefaultBuckets)); + if(__ProcessHeap) + { + pheap->NextHeap=__ProcessHeap->NextHeap; + __ProcessHeap->NextHeap=pheap; + } + else + { + pheap->NextHeap=0; + __ProcessHeap=pheap; + } + InitializeCriticalSection(&(pheap->Synchronize)); + pheap->Start.Size= (minsize-sizeof(HEAP))|HEAP_FREE_TAG; + pheap->Start.PrevSize =0; + + return pheap; +} + +/********************************************************************* +* __HeapInit * +* * +* Called by __VirtualInit to initialize the default process heap * +*********************************************************************/ + +VOID WINAPI __HeapInit(LPVOID base, ULONG minsize, ULONG maxsize) +{ + mmap(base, PAGESIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, + __DevZero, 0); + + __HeapPrepare(base, minsize, maxsize, 0); +} + + +/********************************************************************* +* HeapCreate -- KERNEL32 * +*********************************************************************/ + +HANDLE WINAPI HeapCreate(ULONG flags, ULONG minsize, ULONG maxsize) +{ + PHEAP pheap; + + aprintf("HeapCreate( 0x%lX, 0x%lX, 0x%lX )\n", flags, minsize, maxsize); + + pheap = __VirtualReserve(NULL, minsize, PAGE_READWRITE | MEM_TOP_DOWN); + __VirtualCommit(pheap, PAGESIZE, PAGE_READWRITE); + __VirtualDump(); + return (HANDLE) __HeapPrepare(pheap, minsize, maxsize, flags); +} + +/********************************************************************* +* HeapDestroy -- KERNEL32 * +*********************************************************************/ +BOOL WINAPI HeapDestroy(HANDLE hheap) +{ + PHEAP pheap=(PHEAP) hheap; + + aprintf("HeapDestroy( 0x%lX )\n", (ULONG) hheap ); + + if(pheap->Magic!=MAGIC_HEAP) + return __ErrorReturnFalse(ERROR_INVALID_PARAMETER); + + DeleteCriticalSection(&(pheap->Synchronize)); + __VirtualRelease(pheap); + + return TRUE; +} + +/********************************************************************* +* HeapAlloc -- KERNEL32 * +*********************************************************************/ +LPVOID WINAPI HeapAlloc(HANDLE hheap, ULONG flags, ULONG size) +{ + PHEAP pheap=hheap; + LPVOID retval; + + aprintf("HeapAlloc( 0x%lX, 0x%lX, 0x%lX )\n", + (ULONG) hheap, flags, (ULONG) size ); +#ifdef NOT + HeapValidate(hheap, 0, 0); +#endif + if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + EnterCriticalSection(&(pheap->Synchronize)); + + if(size>HEAP_FRAGMENT_THRESHOLD) + retval=__HeapAlloc(pheap, flags, size, HEAP_NORMAL_TAG); + else + retval=__HeapAllocFragment(pheap, flags, size); + + if( (flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + LeaveCriticalSection(&(pheap->Synchronize)); + + aprintf("HeapAlloc returns 0x%lX\n", (ULONG) retval); + return retval; + +} + +/********************************************************************* +* HeapReAlloc -- KERNEL32 * +*********************************************************************/ +LPVOID WINAPI HeapReAlloc(HANDLE hheap, ULONG flags, LPVOID ptr, ULONG size) +{ + PHEAP pheap=hheap; + PHEAP_BLOCK pfree=((PHEAP_BLOCK)ptr-1); + LPVOID retval; + + aprintf("HeapReAlloc( 0x%lX, 0x%lX, 0x%lX, 0x%lX )\n", + (ULONG) hheap, flags, (ULONG) ptr, size ); +#ifdef NOT + HeapValidate(hheap, 0, 0); +#endif + if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + EnterCriticalSection(&(pheap->Synchronize)); + + if(HEAP_ISNORMAL(pfree)) + retval=__HeapReAlloc(pheap, flags, ptr, size); + else if(HEAP_ISFRAG(pfree)) + retval=__HeapReAllocFragment(pheap, flags, ptr, size); + else + retval=__ErrorReturnNull(ERROR_INVALID_PARAMETER); + + if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) + LeaveCriticalSection(&(pheap->Synchronize)); + + return retval; +} + +/********************************************************************* +* HeapFree -- KERNEL32 * +*********************************************************************/ +BOOL WINAPI HeapFree(HANDLE hheap, ULONG flags, LPVOID ptr) +{ + PHEAP pheap=hheap; + PHEAP_BLOCK pfree=(PHEAP_BLOCK)((LPVOID)ptr-HEAP_ADMIN_SIZE); + BOOL retval; + + aprintf("HeapFree( 0x%lX, 0x%lX, 0x%lX )\n", + (ULONG) hheap, flags, (ULONG) ptr ); +#ifdef NOT + HeapValidate(hheap, 0, 0); +#endif + if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + EnterCriticalSection(&(pheap->Synchronize)); + + if(HEAP_ISNORMAL(pfree)) + retval=__HeapFree(pheap, flags, ptr); + else if(HEAP_ISFRAG(pfree)) + retval=__HeapFreeFragment(pheap, flags, ptr); + else + retval=__ErrorReturnFalse(ERROR_INVALID_PARAMETER); + + if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) + LeaveCriticalSection(&(pheap->Synchronize)); + + return retval; +} + +/********************************************************************* +* GetProcessHeap -- KERNEL32 * +*********************************************************************/ +HANDLE WINAPI GetProcessHeap(VOID) +{ + aprintf("GetProcessHeap()\n"); + return (HANDLE) __ProcessHeap; +} + +/******************************************************************** +* GetProcessHeaps -- KERNEL32 * +* * +* NOTE in Win95 this function is not implemented and just returns * +* ERROR_CALL_NOT_IMPLEMENTED * +********************************************************************/ +DWORD WINAPI GetProcessHeaps(DWORD maxheaps, PHANDLE phandles ) +{ + DWORD retval; + PHEAP pheap; + + aprintf("GetProcessHeaps( %u, 0x%lX )\n", maxheaps, (ULONG) phandles ); + + pheap=__ProcessHeap; + retval=0; + while((pheap)&&(maxheaps)) + { + *phandles=pheap; + phandles++; + maxheaps--; + retval++; + pheap=pheap->NextHeap; + } + while(pheap) + { + retval++; + pheap=pheap->NextHeap; + } + + + return retval; +} + +/********************************************************************* +* HeapLock -- KERNEL32 * +*********************************************************************/ + +BOOL WINAPI HeapLock(HANDLE hheap) +{ + PHEAP pheap=hheap; + + aprintf("HeapLock( 0x%lX )\n", (ULONG) hheap ); + + EnterCriticalSection(&(pheap->Synchronize)); + return TRUE; +} + +/********************************************************************* +* HeapUnlock -- KERNEL32 * +*********************************************************************/ + +BOOL WINAPI HeapUnlock(HANDLE hheap) +{ + PHEAP pheap=hheap; + + aprintf("HeapUnlock( 0x%lX )\n", (ULONG) hheap ); + + LeaveCriticalSection(&(pheap->Synchronize)); + return TRUE; +} + +/********************************************************************* +* HeapCompact -- KERNEL32 * +* * +* NT uses this function to compact moveable blocks and other things * +* Here it does not compact, but it finds the largest free region * +*********************************************************************/ + +UINT HeapCompact(HANDLE hheap, DWORD flags) +{ + PHEAP pheap=hheap; + PHEAP_BLOCK pfree; + ULONG freesize; + ULONG largestfree; + + if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + EnterCriticalSection(&(pheap->Synchronize)); + + pfree=&(pheap->Start); + /* look for the largest free region of memory */ + largestfree=0; + do + { + freesize=HEAP_SIZE(pfree); + if(HEAP_ISFREE(pfree) && freesize>largestfree) + largestfree=freesize; + + pfree=HEAP_NEXT(pfree); + } + while( (LPVOID)pfree < pheap->End ); + + if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) + LeaveCriticalSection(&(pheap->Synchronize)); + + return largestfree; +} + +/********************************************************************* +* HeapSize -- KERNEL32 * +*********************************************************************/ +DWORD WINAPI HeapSize(HANDLE hheap, DWORD flags, LPCVOID pmem) +{ + PHEAP pheap=(PHEAP) hheap; + PHEAP_BLOCK palloc=((PHEAP_BLOCK)pmem-1); + DWORD retval=0; + + aprintf("HeapSize( 0x%lX, 0x%lX, 0x%lX )\n", + (ULONG) hheap, flags, (ULONG) pmem ); + + if(pheap->Magic!=MAGIC_HEAP) + { SetLastError(ERROR_INVALID_PARAMETER); return 0; } + + if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + EnterCriticalSection(&(pheap->Synchronize)); + + if((pmem> (LPVOID)pheap)&&(pmem < pheap->End)) + { + if(HEAP_ISALLOC(palloc)) + retval=HEAP_SIZE(palloc); /* normal allocation */ + else if(HEAP_ISFRAG(palloc)) + retval=HEAP_FRAG_SIZE(palloc); /* fragment */ + else + { SetLastError(ERROR_INVALID_PARAMETER); retval = -1; } + } + + if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) + LeaveCriticalSection(&(pheap->Synchronize)); + + return retval; +} + +/********************************************************************* +* HeapValidate -- KERNEL32 * +* * +* NOTE: only implemented in NT * +*********************************************************************/ +BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem) +{ + PHEAP pheap=(PHEAP)hheap; + PHEAP_BLOCK pcheck; + PHEAP_BLOCK pprev; + PHEAP_BLOCK pnext; + PHEAP_SUBALLOC psub; + PHEAP_FRAGMENT pfrag; + PHEAP_FRAGMENT pnextfrag; + PHEAP_FRAGMENT pprevfrag; + PHEAP_BUCKET pbucket; + INT i; + INT number; + INT add; + + if(( flags | pheap->Flags) & HEAP_NO_SERIALIZE ) + EnterCriticalSection(&(pheap->Synchronize)); + + if(pmem==NULL) + { + pcheck=&(pheap->Start); + pprev=NULL; + /* verify all blocks */ + do + { + pnext=HEAP_NEXT(pcheck); + if((pprev)&&(HEAP_PREV(pcheck)!=pprev)) + { + dprintf("HeapValidate: linked list invalid, region 0x%lX," + " previous region 0x%lX, list says 0x%lX\n", + (ULONG)pcheck, (ULONG)pprev, (ULONG) HEAP_PREV(pcheck)); + return FALSE; + } + if(HEAP_ISSUB(pcheck)) + { + + /* check fragments */ + psub=(PHEAP_SUBALLOC) ((PHEAP_BLOCK)pcheck+1); + pbucket=psub->Bucket; + pfrag=(PHEAP_FRAGMENT) ((LPVOID)psub + sizeof(HEAP_SUBALLOC)); + + if(psub->NumberFree>pbucket->Number) + return FALSE; + + add=pbucket->Size+HEAP_FRAG_ADMIN_SIZE; + pprevfrag=NULL; + number=0; + for(i=0;iNumber;i++) + { + pnextfrag=(PHEAP_FRAGMENT)((LPVOID)pfrag+add); + if(pfrag->Magic!=HEAP_FRAG_MAGIC) + { + dprintf("HeapValidate: fragment %d magic invalid, region 0x%lX," + " previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev); + return FALSE; + } + if(pfrag->Number!=i) + { + dprintf("HeapValidate: fragment %d number invalid, region 0x%lX," + " previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev); + return FALSE; + } + if((psub->Bitmap&(1<Sub!=psub) + { + dprintf("HeapValidate: fragment %d suballoc invalid, region 0x%lX," + " previous region 0x%lX\n", i, (ULONG)pcheck, (ULONG)pprev); + return FALSE; + } + pprevfrag=pfrag; + pfrag=pnextfrag; + } + if(number!=psub->NumberFree) + { + dprintf("HeapValidate: invalid number of free fragments, region 0x%lX," + " previous region 0x%lX\n", (ULONG)pcheck, (ULONG)pprev); + return FALSE; + } + dprintf("HeapValidate: [0x%08lX-0x%08lX] suballocated," + " bucket size=%d, bitmap=0x%08lX\n", + (ULONG) pcheck, (ULONG) pnext, pbucket->Size, psub->Bitmap); + } + else if(HEAP_ISFREE(pcheck)) + { + if(HEAP_RSIZE(pcheck)!=HEAP_SIZE(pcheck)) + { + dprintf("HeapValidate: invalid size of free region 0x%lX," + " previous region 0x%lX\n", + (ULONG) pcheck, (ULONG) pprev); + return FALSE; + } + dprintf("HeapValidate: [0x%08lX-0x%08lX] free\n", + (ULONG) pcheck, (ULONG) pnext ); + } + else if(HEAP_ISNORMAL(pcheck)) + { + dprintf("HeapValidate: [0x%08lX-0x%08lX] allocated\n", + (ULONG) pcheck, (ULONG) pnext ); + } + else + { + dprintf("HeapValidate: invalid tag %x, region 0x%lX," + " previous region 0x%lX\n", pcheck->Size>>28, + (ULONG)pcheck, (ULONG)pprev); + return FALSE; + } + pprev=pcheck; + pcheck=HEAP_NEXT(pcheck); + } + while( (LPVOID)pcheck < pheap->End ); + } + + if( (flags| pheap->Flags) & HEAP_NO_SERIALIZE ) + LeaveCriticalSection(&(pheap->Synchronize)); + + return TRUE; +} + diff --git a/reactos/lib/kernel32/mem/local.c b/reactos/lib/kernel32/mem/local.c new file mode 100644 index 00000000000..0604a9c6234 --- /dev/null +++ b/reactos/lib/kernel32/mem/local.c @@ -0,0 +1,123 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * Copyright (C) 1996, Onno Hovers, All rights reserved + * PROJECT: ReactOS system libraries + * FILE: lib/kernel32/mem/local.cc + * PURPOSE: Manages the local heap + * PROGRAMER: Onno Hovers (original wfc version) + * David Welch (adapted for ReactOS) + * UPDATE HISTORY: + * 9/4/98: Adapted from the wfc project + */ + + +/* NOTES + * + * The local heap is the same as the global heap for win32 and both are only + * required for legacy apps + * + */ + +/* INCLUDES ****************************************************************/ + +#include +#include + +/* FUNCTIONS ***************************************************************/ + +/********************************************************************* +* LocalFlags -- KERNEL32 * +*********************************************************************/ +UINT WINAPI LocalFlags(HLOCAL hmem) +{ + DWORD retval; + PGLOBAL_HANDLE phandle; + + if(((ULONG)hmem%8)==0) + { + retval=0; + } + else + { + HeapLock(__ProcessHeap); + phandle=(PGLOBAL_HANDLE)(((LPVOID) hmem)-4); + if(phandle->Magic==MAGIC_GLOBAL_USED) + { + retval=phandle->LockCount + (phandle->Flags<<8); + if(phandle->Pointer==0) + retval|= LMEM_DISCARDED; + } + else + { + dprintf("GlobalSize: invalid handle\n"); + retval=0; + } + HeapUnlock(__ProcessHeap); + } + return retval; +} + + +/********************************************************************* +* LocalAlloc -- KERNEL32 * +*********************************************************************/ +HLOCAL WINAPI LocalAlloc(UINT flags, UINT size) +{ + return (HLOCAL) GlobalAlloc( flags, size ); +} + +/********************************************************************* +* LocalLock -- KERNEL32 * +*********************************************************************/ +LPVOID WINAPI LocalLock(HLOCAL hmem) +{ + return GlobalLock( (HGLOBAL) hmem ); +} + +/********************************************************************* +* LocalUnlock -- KERNEL32 * +*********************************************************************/ +BOOL WINAPI LocalUnlock(HLOCAL hmem) +{ + return GlobalUnlock( (HGLOBAL) hmem); +} + +/********************************************************************* +* LocalHandle -- KERNEL32 * +*********************************************************************/ +HLOCAL WINAPI LocalHandle(LPCVOID pmem) +{ + return (HLOCAL) GlobalHandle(pmem); +} + +/********************************************************************* +* LocalReAlloc -- KERNEL32 * +*********************************************************************/ +HLOCAL WINAPI LocalReAlloc(HLOCAL hmem, UINT size, UINT flags) +{ + return (HLOCAL) GlobalReAlloc( (HGLOBAL) hmem, size, flags); +} + +/********************************************************************* +* LocalFree -- KERNEL32 * +*********************************************************************/ +HLOCAL WINAPI LocalFree(HLOCAL hmem) +{ + return (HLOCAL) GlobalFree( (HGLOBAL) hmem ); +} + +/********************************************************************* +* LocalSize -- KERNEL32 * +*********************************************************************/ +UINT WINAPI LocalSize(HLOCAL hmem) +{ + return GlobalSize( (HGLOBAL) hmem ); +} + +/********************************************************************* +* LocalShrink -- KERNEL32 * +*********************************************************************/ +UINT WINAPI LocalShrink(HLOCAL hmem, UINT newsize) +{ + return (__ProcessHeap->End - (LPVOID) __ProcessHeap); +} diff --git a/reactos/lib/kernel32/mem/utils.cc b/reactos/lib/kernel32/mem/utils.cc new file mode 100644 index 00000000000..db969b42de5 --- /dev/null +++ b/reactos/lib/kernel32/mem/utils.cc @@ -0,0 +1,23 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS user mode libraries + * FILE: kernel32/mem/utils.cc + * PURPOSE: Various simple memory initalizations functions + */ + +#include + +VOID ZeroMemory(PVOID Destination, DWORD Length) +{ + #ifdef __i386__ + + #endif /* __i386__ */ +} + +VOID CopyMemory(PVOID Destination, CONST VOID* Source, DWORD Length) +{ + #ifdef __i386__ + #endif /* __i386__ */ +} + + diff --git a/reactos/lib/kernel32/mem/virtual.c b/reactos/lib/kernel32/mem/virtual.c new file mode 100644 index 00000000000..96532bce7ca --- /dev/null +++ b/reactos/lib/kernel32/mem/virtual.c @@ -0,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: lib/kernel32/mem/virtual.c + * PURPOSE: Passing the Virtualxxx functions onto the kernel + * PROGRAMMER: David Welch (welch@mcmail.com) + */ + +/* INCLUDES ******************************************************************/ + +#include + +/* FUNCTIONS *****************************************************************/ + +WINBOOL STDCALL VirtualFree(LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType) +{ + return(VirtualFreeEx(GetCurrentProcess(),lpAddress,dwSize,dwFreeType)); +} + diff --git a/reactos/lib/kernel32/misc/atom.c b/reactos/lib/kernel32/misc/atom.c new file mode 100644 index 00000000000..c8d9d163bdc --- /dev/null +++ b/reactos/lib/kernel32/misc/atom.c @@ -0,0 +1,527 @@ + + +#include +#include +#include +#include + + +/* + title: atom.c + author: Boudewijn Dekker + hsitory:copied from twin wine source + modified: -- add wide char support + -- removed ex functions + -- use a per process local atom table + todo : + check initatomtable + check if not calling down to ntdll conflicts with anything + check anis2unicode procedure +*/ + + +/* system global and local atom tables */ + +static ATOMTABLE GlobalAtomTable; + +/* internal functions */ +ATOM GLDeleteAtom(ATOMTABLE *at, ATOM nAtom); +ATOM AWGLAddAtom( ATOMTABLE *at, const wchar_t *lpString); +ATOM AWGLFindAtom(ATOMTABLE *at, const wchar_t *lpString); +UINT AWGLGetAtomName(ATOMTABLE *at,ATOM atom, wchar_t *lpString, int nSize); + +static ATOMENTRY *GetAtomPointer(ATOMTABLE *,int); +static ATOMID AtomHashString(const wchar_t *,int *); + +#define ATOMBASE 0xcc00 + + + +ATOM +STDCALL +GlobalDeleteAtom( + ATOM nAtom + ) +{ + return GLDeleteAtom(&GlobalAtomTable, nAtom); +} + + +BOOL +STDCALL +InitAtomTable( + DWORD nSize + ) +{ +// nSize should be a prime number + + if ( nSize < 4 || nSize >= 512 ) { + nSize = 37; + } + /* + if ( GetTeb()->pPeb->LocalAtomTable == NULL ) { + GetTeb()->pPeb->LocalAtomTable = (ATOMTABLE *)malloc(nSize*sizeof(ATOMTABLE)); + } + + GetTeb()->pPeb->LocalAtomTable->TableSize = nSize; + */ + return TRUE; +} + + +ATOM +STDCALL +DeleteAtom( + ATOM nAtom + ) +{ + return GLDeleteAtom(&GetTeb()->pPeb->LocalAtomTable, nAtom); + +} + + + + +ATOM +STDCALL +GlobalAddAtomA( + const char *lpString + ) +{ + + UINT BufLen = strlen(lpString); + wchar_t *lpBuffer = (wchar_t *)malloc(BufLen*sizeof(wchar_t)); + ATOM atom; + ansi2unicode(lpBuffer, lpString,BufLen); + atom = AWGLAddAtom(&GlobalAtomTable,lpBuffer ); + free(lpBuffer); + return atom; +} + + + + + +ATOM +STDCALL +GlobalAddAtomW( + const wchar_t *lpString + ) +{ + return AWGLAddAtom(&GlobalAtomTable, lpString); +} + + +ATOM +STDCALL +GlobalFindAtomA( + const char *lpString + ) +{ + ATOM a; + UINT BufLen = strlen(lpString); + wchar_t *lpBuffer = (wchar_t *)malloc(BufLen*sizeof(wchar_t)); + ansi2unicode(lpBuffer, lpString,BufLen); + a = AWGLFindAtom(&GlobalAtomTable, lpBuffer); + free(lpBuffer); + return a; +} + + +ATOM +STDCALL +GlobalFindAtomW( + const wchar_t *lpString + ) +{ + return AWGLFindAtom(&GlobalAtomTable, lpString); +} + + + +UINT +STDCALL +GlobalGetAtomNameA( + ATOM nAtom, + char *lpBuffer, + int nSize + ) +{ + + wchar_t *lpUnicode = (wchar_t *)malloc(nSize *sizeof(wchar_t)); + UINT x = AWGLGetAtomName(&GlobalAtomTable,nAtom, lpUnicode,nSize); + unicode2ansi(lpBuffer,lpUnicode,nSize); + free(lpUnicode); + return x; +} + + +UINT +STDCALL +GlobalGetAtomNameW( + ATOM nAtom, + wchar_t * lpBuffer, + int nSize + ) +{ + return AWGLGetAtomName(&GlobalAtomTable, nAtom, lpBuffer, nSize); +} + + +ATOM +STDCALL +AddAtomA( + const char *lpString + ) +{ + UINT BufLen = strlen(lpString); + wchar_t *lpBuffer = (wchar_t*)malloc(BufLen*2); + ATOM a; + ansi2unicode(lpBuffer, lpString,BufLen); + a = AWGLAddAtom(&GetTeb()->pPeb->LocalAtomTable, lpBuffer); + free(lpBuffer); + return a; + +} + + +ATOM +STDCALL +AddAtomW( + const wchar_t * lpString + ) +{ + return AWGLAddAtom(&GetTeb()->pPeb->LocalAtomTable, lpString); +} + + + + +ATOM +STDCALL +FindAtomA( + const char *lpString + ) +{ + UINT BufLen = strlen(lpString); + wchar_t *lpBuffer = (wchar_t *)malloc(BufLen*2); + ATOM a; + ansi2unicode(lpBuffer, lpString,BufLen); + a = AWGLFindAtom(&GetTeb()->pPeb->LocalAtomTable, lpBuffer); + free(lpBuffer); + return a; +} + + +ATOM +STDCALL +FindAtomW( + const wchar_t * lpString + ) +{ + return AWGLFindAtom(&GetTeb()->pPeb->LocalAtomTable, lpString); +} + + + +UINT +STDCALL +GetAtomNameA( + ATOM nAtom, + char *lpBuffer, + int nSize + ) +{ + LPWSTR lpUnicode = (wchar_t *)malloc(nSize *2); + UINT x = AWGLGetAtomName(&GlobalAtomTable, nAtom,lpUnicode,nSize); + unicode2ansi(lpBuffer,lpUnicode,nSize); + free(lpUnicode); + return x; +} + + +UINT +STDCALL +GetAtomNameW( + ATOM nAtom, + wchar_t * lpBuffer, + int nSize + ) +{ + return AWGLGetAtomName(&GetTeb()->pPeb->LocalAtomTable,nAtom,lpBuffer, nSize); +} + +ATOM +GLDeleteAtom( + ATOMTABLE *at, ATOM nAtom + ) +{ + + ATOMENTRY *lp; + + /* a free slot has q == 0 && refcnt == 0 */ + if((lp = GetAtomPointer(at,nAtom - ATOMBASE))) { + if(lp->idsize) + lp->refcnt--; + + if(lp->refcnt == 0) { + free(at->AtomTable); + at->AtomTable = NULL; + free(at->AtomData); + at->AtomData = NULL; + return lp->q = 0; + } + } + return nAtom; + + + +} + + +ATOM +AWGLAddAtom( + ATOMTABLE *at, const wchar_t *lpString + ) +{ + ATOM atom; + ATOMID q; + LPATOMENTRY lp,lpfree; + int index,freeindex; + int atomlen; + int newlen; + + + + /* if we already have it, bump refcnt */ + if((atom = AWGLFindAtom(at, lpString ))) { + lp = GetAtomPointer(at,atom - ATOMBASE); + if(lp->idsize) lp->refcnt++; + return atom; + } + + /* add to a free slot */ + q = AtomHashString(lpString,&atomlen); + + lpfree = 0; + freeindex = 0; + + for(index = 0;(lp = GetAtomPointer(at,index));index++) { + if(lp->q == 0 && lp->refcnt == 0) { + if(lp->idsize > atomlen) { + if ((lpfree == 0) || + (lpfree->idsize > lp->idsize)) { + lpfree = lp; + freeindex = index; + } + } + } + } + /* intatoms do not take space in data, but do get new entries */ + /* an INTATOM will have length of 0 */ + if(lpfree && atomlen) { + lpfree->q = q; + lpfree->refcnt = 1; + wcsncpy(&at->AtomData[lpfree->idx],lpString,atomlen); + return freeindex + ATOMBASE; + } + + /* no space was available, or we have an INTATOM */ + /* so expand or create the table */ + if(at->AtomTable == 0) { + at->AtomTable = (ATOMENTRY *) malloc(sizeof(ATOMENTRY)); + at->TableSize = 1; + lp = at->AtomTable; + index = 0; + } else { + at->TableSize++; + at->AtomTable = (ATOMENTRY *) realloc( + (LPVOID) at->AtomTable, + at->TableSize * sizeof(ATOMENTRY)); + lp = &at->AtomTable[at->TableSize - 1]; + } + + /* set in the entry */ + lp->refcnt = 1; + lp->q = q; + lp->idsize = atomlen; + lp->idx = 0; + + /* add an entry if not intatom... */ + if(atomlen) { + newlen = at->DataSize + atomlen; + + if(at->AtomData == 0) { + at->AtomData = (wchar_t *) malloc(newlen*2); + lp->idx = 0; + } else { + + at->AtomData = (wchar_t *) realloc(at->AtomData,newlen*2); + lp->idx = at->DataSize; + } + + wcscpy(&at->AtomData[lp->idx],lpString); + at->DataSize = newlen; + } + + return index + ATOMBASE; +} + + + + + + + + + + +ATOM +AWGLFindAtom( + ATOMTABLE *at, const wchar_t *lpString + ) +{ + + ATOMID q; + LPATOMENTRY lp; + int index; + int atomlen; + + + + + /* convert string to 'q', and get length */ + q = AtomHashString(lpString,&atomlen); + + /* find the q value, note: this could be INTATOM */ + /* if q matches, then do case insensitive compare*/ + for(index = 0;(lp = GetAtomPointer(at,index));index++) { + if(lp->q == q) { + if(HIWORD(lpString) == 0) + return ATOMBASE + index; + if(wcsicmp(&at->AtomData[lp->idx],lpString) == 0) + return ATOMBASE + index; + } + } + return 0; +} + + +UINT +AWGLGetAtomName(ATOMTABLE *at, ATOM atom, wchar_t *lpString,int len) +{ + + ATOMENTRY *lp; + wchar_t *atomstr; + int atomlen; + + + + /* return the atom name, or create the INTATOM */ + if((lp = GetAtomPointer(at,atom - ATOMBASE))) { + if(lp->idsize) { + atomlen = wcslen(atomstr = &at->AtomData[lp->idx]); + if (atomlen < len) + wcscpy(lpString,atomstr); + else { + wcsncpy(lpString,atomstr,len-1); + lpString[len-1] = '\0'; + } + return (UINT)wcslen(lpString); + } else { + //wsprintf((wchar *)lpString,"#%d",lp->q); + return (UINT)wcslen(lpString); + } + } + return 0; +} + + +/********************************************************/ +/* convert alphanumeric string to a 'q' value. */ +/* 'q' values do not need to be unique, they just limit */ +/* the search we need to make to find a string */ +/********************************************************/ + +static ATOMID +AtomHashString(const wchar_t * lp,int *lplen) +{ + ATOMID q; + wchar_t *p,ch; + int len; + + /* if we have an intatom... */ + if(HIWORD(lp) == 0) { + if(lplen) *lplen = 0; + return (ATOMID)lp; + } + + /* convert the string to an internal representation */ + for(p=(wchar_t *)lp,q=0,len=0;(p++,ch=*p++);len++) + q = (q<<1) + iswlower(ch)?towupper(ch):ch; + + /* 0 is reserved for empty slots */ + if(q == 0) + q++; + + /* avoid strlen later */ + /* check out with unicode */ + if(lplen) { + *lplen = ++len; + } + return q; +} + +/********************************************************/ +/* convert an atom index into a pointer into an */ +/* atom table. This validates the pointer is in */ +/* range, and that the data is accessible */ +/********************************************************/ + +static ATOMENTRY * +GetAtomPointer(ATOMTABLE *at,int index) +{ + ATOMENTRY *lp; + + /* if no table, then no pointers */ + if(at->AtomTable == 0) + return 0; + + /* bad index */ + if((index < 0) || (index >= at->TableSize)) + return 0; + + /* we have a pointer */ + lp = &at->AtomTable[index]; + + + /* is the index past stored data, validity check */ + /* LATER: is the size of the entry within the available space */ + if(lp->idx > at->DataSize) + return 0; + + return lp; +} + +int ansi2unicode( wchar_t *uni, char *ansi, int s) +{ + register int i; + + for(i=0;i<=s;i++) + uni[i] = (wchar_t)ansi[i]; + return; +} + +int unicode2ansi( char *ansi, wchar_t *uni, int s) +{ + register int i; + + for(i=0;i<=s;i++) + ansi[i] = (char)uni[i]; + return; +} + + + + + diff --git a/reactos/lib/kernel32/process/proc.c b/reactos/lib/kernel32/process/proc.c new file mode 100644 index 00000000000..5bc2a68f497 --- /dev/null +++ b/reactos/lib/kernel32/process/proc.c @@ -0,0 +1,137 @@ +#include +/* + * Win32 Process Api functions + * Author: Boudewijn Dekker + * to do: many more to add .. + * open matters: ProcessInformation should be per process + and part of larger structure. + */ + + + + +#define NT_CURRENT_PROCESS 0xFFFFFFFF +#define NT_CURRENT_THREAD 0xFFFFFFFE + + +WINBASEAPI +HANDLE +WINAPI +GetCurrentProcess() +{ + return NT_CURRENT_PROCESS; +} + +WINBASEAPI +DWORD +WINAPI +GetCurrentProcessId() +{ + return GetTeb()->dwProcessId; +} + + +WINBASEAPI +HANDLE +WINAPI +GetCurrentThread() +{ + return NT_CURRENT_PROCESS; +} + +WINBASEAPI +DWORD +WINAPI +GetCurrentThreadId() +{ + + return GetTeb()->dwThreadId; +} + +UINT WinExec ( LPCSTR lpCmdLine, UINT uCmdShow ) +{ + STARTUPINFO StartUpInfo; + StartupInfo.wShowWindow = uCmdShow ; + PROCESS_INFORMATION ProcessInformation; + StartupInfo.cb = sizeof(STARTUPINFO); + StartupInfo.dwFlags = 0; + + HINSTANCE hInst = CreateProcess(NULL,lpCmdLine,NULL,NULL,FALSE,NULL,NULL,NULL,&StartupInfo, &ProcessInformation); + if ( hInst == NULL ) { + dosErr = GetLastError(); + if ( dosErr == 0x000000C1 ) + return 0; // out of resources + else + return dosErr; + } + if ( lpfuncGlobalRegisterWaitForInputIdle != NULL ) + lpfuncGlobalRegisterWaitForInputIdle(0x00007530,ProcessInformation->hProcess); + NtClose(ProcessInformation->hProcess); + NtClose(ProcessInformation->hThread); + return; + +} + + + +VOID RegisterWaitForInputIdle(lpfuncRegisterWaitForInputIdle) +{ + lpfuncGlobalRegisterWaitForInputIdle = lpfuncRegisterWaitForInputIdle; //77F450C8 +} + + +#define STARTF_IO 0x00000700 + +VOID +STDCALL +GetStartupInfoW( + LPSTARTUPINFO lpStartupInfo + ) +{ + NT_PEB *pPeb = GetTeb()->pPeb; + + if (lpStartupInfo == NULL ) { + SetLastError(-1); + return; + } + + + lpStartupInfo->cb = pPeb->pPebInfo->cb; + lpStartupInfo->lpReserved = pPeb->pPebInfo->lpReserved1; + lpStartupInfo->lpDesktop = pPeb->pPebInfo->lpDesktop; + lpStartupInfo->lpTitle = pPeb->pPebInfo->lpTitle; + lpStartupInfo->dwX = pPeb->pPebInfo->dwX; + lpStartupInfo->dwY = pPeb->pPebInfo->dwY; + lpStartupInfo->dwXSize = pPeb->pPebInfo->dwXSize; + lpStartupInfo->dwYSize = pPeb->pPebInfo->dwYSize; + lpStartupInfo->dwXCountChars = pPeb->pPebInfo->dwXCountChars; + lpStartupInfo->dwYCountChars = pPeb->pPebInfo->dwYCountChars; + lpStartupInfo->dwFillAttribute = pPeb->pPebInfo->dwFillAttribute; + lpStartupInfo->dwFlags = pPeb->pPebInfo->dwFlags; + lpStartupInfo->wShowWindow = pPeb->pPebInfo->wShowWindow; + lpStartupInfo->cbReserved2 = pPeb->pPebInfo->cbReserved; + lpStartupInfo->lpReserved2 = pPeb->pPebInfo->lpReserved2; + if ( lpStartupInfo.dwFlags == STARTF_IO ) { + lpStartupInfo->hStdInput = pPeb->pPebInfo->hStdInput; + lpStartupInfo->hStdOutput = pPeb->pPebInfo->hStdOutput; + lpStartupInfo->hStdError = pPeb->pPebInfo->hStdError; + } + + +} + + +BOOL FlushInstructionCache( + + + HANDLE hProcess, + LPCVOID lpBaseAddress, + DWORD dwSize + ) +{ + errCode = NtFlushInstructionCache(hProcess,lpBaseAddress,dwSize); + if ( errCode < 0 ) { + CompatibleError(errCode); + return FALSE; + } +} diff --git a/reactos/lib/kernel32/string/lstring.cc b/reactos/lib/kernel32/string/lstring.cc new file mode 100644 index 00000000000..025fccc8b34 --- /dev/null +++ b/reactos/lib/kernel32/string/lstring.cc @@ -0,0 +1,123 @@ +#include +#include +#include + +int +STDCALL +lstrcmpA( + LPCSTR lpString1, + LPCSTR lpString2 + ) +{ + return strcmp(lpString1,lpString2); +} + +int +STDCALL +lstrcmpiA( + LPCSTR lpString1, + LPCSTR lpString2 + ) +{ + return stricmp(lpString1,lpString2); +} +LPSTR +STDCALL +lstrcpynA( + LPSTR lpString1, + LPCSTR lpString2, + int iMaxLength + ) +{ + return strncpy(lpString1,lpString2,iMaxLength); +} + +LPSTR +STDCALL +lstrcpyA( + LPSTR lpString1, + LPCSTR lpString2 + ) +{ + return strcpy(lpString1,lpString2); +} + +LPSTR +STDCALL +lstrcatA( + LPSTR lpString1, + LPCSTR lpString2 + ) +{ + return strcat(lpString1,lpString2); +} + +int +STDCALL +lstrlenA( + LPCSTR lpString + ) +{ + return strlen(lpString); +} + +int +STDCALL +lstrcmpW( + LPCWSTR lpString1, + LPCWSTR lpString2 + ) +{ + return wcscmp(lpString1,lpString2); +} + +int +STDCALL +lstrcmpiW( + LPCWSTR lpString1, + LPCWSTR lpString2 + ) +{ + return wcsicmp(lpString1,lpString2); + +} + +LPWSTR +STDCALL +lstrcpynW( + LPWSTR lpString1, + LPCWSTR lpString2, + int iMaxLength + ) +{ + return wcsncpy(lpString1,lpString2,iMaxLength); +} + +LPWSTR +STDCALL +lstrcpyW( + LPWSTR lpString1, + LPCWSTR lpString2 + ) +{ + return wcscpy(lpString1,lpString2); +} + +LPWSTR +STDCALL +lstrcatW( + LPWSTR lpString1, + LPCWSTR lpString2 + ) +{ + return wcscat(lpString1,lpString2); +} + +int +STDCALL +lstrlenW( + LPCWSTR lpString + ) +{ + return wcslen(lpString); +} \ No newline at end of file diff --git a/reactos/lib/kernel32/thread/thread.c b/reactos/lib/kernel32/thread/thread.c new file mode 100644 index 00000000000..81c7cf7045e --- /dev/null +++ b/reactos/lib/kernel32/thread/thread.c @@ -0,0 +1,83 @@ + +/* +author: Boudewijn Dekker +original source : wine +todo: improve debug info +*/ + +#include + + +WINBASEAPI +BOOL +WINAPI +SwitchToThread( + VOID + ) +{ + return NtYieldExecution(); +} + +/* (WIN32) Thread Local Storage ******************************************** */ + +DWORD WINAPI +TlsAlloc(VOID) +{ + DWORD dwTlsIndex = GetTeb()->dwTlsIndex; + void **TlsData = GetTeb()->TlsData; + + APISTR((LF_API, "TlsAlloc: (API)\n")); + if (dwTlsIndex < sizeof(TlsData) / sizeof(TlsData[0])) + { + TlsData[dwTlsIndex] = NULL; + return (dwTlsIndex++); + } + return (0xFFFFFFFFUL); +} + +BOOL WINAPI +TlsFree(DWORD dwTlsIndex) +{ + APISTR((LF_APISTUB, "TlsFree(DWORD=%ld)\n", dwTlsIndex)); + return (TRUE); +} + +LPVOID WINAPI +TlsGetValue(DWORD dwTlsIndex) +{ + + DWORD dwTlsIndex = GetTeb()->dwTlsIndex; + void **TlsData = GetTeb()->TlsData; + + APISTR((LF_API, "TlsGetValue: (API) dwTlsIndex %ld\n", dwTlsIndex)); + if (dwTlsIndex < sizeof(TlsData) / sizeof(TlsData[0])) + { + LOGSTR((LF_LOG, "TlsGetValue: (LOG) [%ld] = %p\n", + dwTlsIndex, TlsData[dwTlsIndex])); + SetLastError(NO_ERROR); + return (TlsData[dwTlsIndex]); + } + SetLastErrorEx(1, 0); + return (NULL); +} + +BOOL WINAPI +TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) +{ + + DWORD dwTlsIndex = GetTeb()->dwTlsIndex; + void **TlsData = GetTeb()->TlsData; + + APISTR((LF_API, "TlsSetValue: (API) dwTlsIndex %ld lpTlsValue %p\n", + dwTlsIndex, lpTlsValue)); + if (dwTlsIndex < sizeof(TlsData) / sizeof(TlsData[0])) + { + LOGSTR((LF_LOG, "TlsSetValue: (LOG) [%ld] = %p\n", + dwTlsIndex, lpTlsValue)); + TlsData[dwTlsIndex] = lpTlsValue; + return (TRUE); + } + return (FALSE); +} + +/*************************************************************/ \ No newline at end of file diff --git a/reactos/lib/makefile b/reactos/lib/makefile new file mode 100644 index 00000000000..25d86e8cedc --- /dev/null +++ b/reactos/lib/makefile @@ -0,0 +1,12 @@ +LIBRARIES = ntdll kernel32 + +all: $(LIBRARIES) + +ntdll: dummy + make -C ntdll + +kernel32: dummy + make -C kernel32 + +dummy: + diff --git a/reactos/lib/ntdll/genntdll b/reactos/lib/ntdll/genntdll new file mode 100644 index 0000000000000000000000000000000000000000..8c554490ceab166b473c31b06fb84affdce8cb30 GIT binary patch literal 9418 zcma)C4{%(?d0%6>$ije)9b$+J2ev^t^6CCc=R4&1pJcn1ZGq*4ObpMbyLY;?Pj}~c z?`%`*MvP)&jVi`WXbYK6Y9`YO$qa;O}!X@B2--+ue=+r53e``P}%fklfJDHCo`ixs)Ur`y^Sh~K4w$qA)CO7%`bQFEq?N!V%4pj!4Kf9~qeCeY^Q+}rz6Si7 zFSfOleum^35X+_f21GT;Ymkx7fG1JTGP=v9k?wMSW4TmmoDA2i;iyt8kbVb<;dT&h z+z9#zhyiBRtsqnXc3{?-VJV1pqm7$D!EiGemW%56VHwaZKGy=PThK=z^$`1Hm4|Qh zr7gg6*;b~kQ18!EHxl4CQ2seBzYQ&mfL}go_zu+r{wJRNUf|6j_AT4HLM>Cf5VvE@ z5h=>|gJuKz2f^=xd=wRB{SJYi3&=;nH^IMvnDP?n4ERpOv{wVY7|=ffz7zJ&A*TKx zfX+isJLI1PnfirLze(_`p`Y^PXA!>%{Q-~vGsG##*)Hb)3TPJXy8-bE{Cx{?yVoD= zzi)eTMADzHUBmwf{9K@a6?`g3UrH)#$EWvg-Mf3cvUU#c-?nwo+CMOGpnupJ-nwnD z-%?hoQgW45K%@#ar&MtZ%ChXr@sd-ms6wt>t=psH;(I!vnMrGJ*dksd@lZ-mosVGKv!!5EIci!mm}AY*ju5MxY)Va9OCM;OCn4l%}L zI?Nc8B+nQVpvV}LsLYs?2%-5Ic-;4unolN>I=?=J|4g4>&sr1-FVD;)tY>YClwH0g zJZn|tG`)OLc-F4SDRuc3;aSUKi2OO>S=(YK`Ln{a)%j3ec_C>nW<(lwpMR5!H z!@{#Q#a-lwglDUYL*%yz&(;+mAs-Q*tt=iU9|Dh9!lx(SnVgw;cXsmc7X281mnJT@ zMgQaA!Gn`OA3E^R`7_YDK)tudr*^Ds|MD8xxb@W~bljol^Dr~Id`l&3ob6L(M#rJ~Qp!r>4JsKMkGdLh{!5m0wMN^FHz@=)i?8*qi9%f92jX`OB%r z^Oq)GYn#ZZ#?`4u=O*8K^tH)fdikMG{;Ub$pL}l_j22g;22=gZhMF&+^oiHoi)&26 zSubI;N%*Xnu)`!&bi!0Wnzc=E+vLU57aR95rO3{jKCRG_p=O&%mx*-cl|^SS--NOQ z?fZ=k|L{Mo&9WmM#)6~En!Gsq{mDO`19SSv?$W8#M1KQQ(=2ClnygM7Pp!T6b6h@( zkFmOyquSEc zX|Yj!)};4)ir+E`39Wefdnk+Dz`>dROOEXHU-3W2r+6O9%?oqlE!UAxyti!PRQqCg zRr5z^x;V(?zed)xv{!svmju6@TK;hJ=VGNDo!37%acWLA?k@ftt)J4?b!K|)SHf?oiH%8pt9&A9AZ9{^UTf z)^Jf^*;XfhLx`NdRCfm_i>zfPHhU0?pT_U+mq0Irz6<&x=xxw1Kp%i^!SC^1pfG4N zXdj5n6N!5y?pL^f;@ZZ2NE3TO?z1{4+S<9NdhW@#cJ8aVm*oD3i@({gagWLU4}af_ zAnu2_KjVI?4R(p=V268wb`bY+j2DJ!^#OjjXgd!IJ*9t(4CaFRpqGLBr*RK+(Kq-= z06!DJUkl(j1DH$cICzGk0Ime^*#Leifd4jt|0RHb5x_U1L&n8A_U8e-KY))0@N@t_ zFZj6Reo64{f-eZxJJmM?^Jf?1B3SRLX9Vkyh4%!1Omu!Nc#Ys2F=*rJcLlE$e3#(6 z1>Y;UTku-Jn+40yn%X0{Q_>$1{D9!R;0=Nu!5)`yEX}4C0L-^7QhDr__+Z7N&wFU@U55#FrEI< z0A8)=aXS4D#gW(ePMNnFuTgA`#&@Z+KE7MM=;M3T8$MpEF8O$!`k9aKQ&)U^zgmJ; zYMY(vP9JYjNgsb)?e%e&dd$Zg)o~w()#rWO9l#OAH9*_f_>1V1aemogA%0o#O2s|Q zHw3Rz+@@R*{1L@H1@m4+eYx#6*tDJLrY$qTrViI)*5P&7S*POa;^*7ib$zrCXq=F5 zeT|c{KL1ekQ)&kK{{(za^~(6Z?cvt=>baxyZjx_kjr#)l6Y@Ku)3=C6XuMs8P;ZTQ zsEm&X)K(wwRQr7Vd+M-{_oyd)yjQ+6wVi$HX+QlT)Z5rUAm5H!XIOpDPyeKP%g3Km zGuPlNXfM|U>?Y>l7o1kJz_Wrg>MAg8UPL}jCuz$JViMEyh+jX0?``h~KAcnCV->f% zn2&Wkb~fi$>vGJYcN}Uomy6-EZ>+{2`>?`CXWEVSInm6Yeaed$8$n{*?3lF4`y z`E}!U_eCROA{tBSF7z{cVi|!*CYD6TLb;mdprFg6nFRVw<*SX6vW+C^?-Y}yaelgV zZj=M0IJ9N^q^@{0*;h}&3CihcSEMT*%aq2lqrmYPnU=CClAYb7%QSZUGT3*$87bVz z7FL42#OARU$E&40>bt2gx(TNV)U&i9i!DpwK*YlFM(!xtIJvxioEX|WaWGM>`-0I@ z-WQZARbm{h?6k(JdD|CMaDXSaB!9I~@Uz!+_9(N|Tqj@BGT|{oI1ceG)=R%H7NvG> zX-pWYTq9726C5$$eBERcgD2qW6bW-Yi-VUsxLBlb1G`}-&S2b>$Rp$$J}dg*qCJ$R zj8L;CXFTScW=_pYUBUGvDC{vgHQTGK-TTq`(#^xMD0~53kd8&PFBD34IUh}@=nWY4 zLrM~2NJylZkdf?TS?8$jq=#d%zIrrfRd7s{j>Y>n#A4ctRUc^-(y;_ml6@!ZEOB7> zV1L^4u|vwjXu{=s658c_g<-F?NRAFdpahVJX-^j!`)x^0#I-d0UFP2PXVhTgrBVYWC<%^%7A>Zl)SS`jl$gqb` z{am^x@o`w=jObw@uuJ=h91Lqzsh!)mr$e1P_Z@s76btu;V`1#Re#{z1==Hh5@hsvM|c>W^dbxOg0Xi9 zywT(N&T>@tdgYFIdTcLGm{&tDa2+W&Xqx9Nw8x@&O3wR1*2e^cYe+D9JOB(qFIcY8 zx5qChv@xbK#%855$J6}nhCT=ngFqnSwEhU@qY3Quqlr*>+wfkOg$d+&qB}W zAj!wi0JDB3Q13+)V0@K%_$~FPAlfqF9Grw_S|%79=a679WnaRvjXB#QZ)9HuHrXlv z>4)gi7lY;Ajt}v#Bh3V3k1@yAgjaCnLm%V`(gqOQL7$;72knK{D)lvE1hN1Gw=nRI znJN0_TF+O_>ykMyHLpwH{L{SddCoJ@d_mDfL%?}ps;$0B(6r@+g_72-v>RnH?ff#n?qa|!E^PFs52`pg96TptY2 z@}2^3`kVHj1;5-o2fki?{v7gF{cct-fj5EmIS(dy@6AgZo^?G72j(f(8{p0O@gDjT z_~5%>3^l4&I~xJNV$e`G11v`bf{_z5cHe2j2zoFh6*2&g(U! z&wKWj;D6%z_r1{l7@XAQ>m2I5FE_M6x{)espeLE}* zTe^~KH0xD!WW*?PzJCh)DPV&I2ko1TCYo8}f{b`rz&Z!?4N?lxNi| z%@YI;i_9|uy@w6FS +#include + +/* FUNCTIONS ****************************************************************/ + +int process(FILE* in, FILE* out) +{ + char line[255]; + char* s; + char* name; + char* value; + + fprintf(out,"/*\n"); + fprintf(out," * Machine generated, don't edit\n"); + fprintf(out," */\n\n"); + fprintf(out,"#include \n\n"); + + while (!feof(in) && fgets(line,255,in)!=NULL) + { + fgets(line,255,in); + if ((s=strchr(line,'\n'))!=NULL) + { + *s=0; + } + s=&line[0]; + if ((*s)!='#') + { + name = strtok(s," \t"); + value = strtok(NULL," \t"); + printf("name %s value %s\n",name,value); + + fprintf(out,"NTSTATUS %s(UCHAR first_arg)\n",name); + fprintf(out,"{\n"); + fprintf(out,"\tMAKE_NTAPI_CALL(%s,first_arg);\n",value); + fprintf(out,"}\n"); + } + } +} + +void usage(void) +{ + printf("Usage: genntdll infile.cll outfile.c\n"); +} + +int main(int argc, char* argv[]) +{ + FILE* in; + FILE* out; + int ret; + + if (argc!=3) + { + usage(); + return(1); + } + + in = fopen(argv[1],"rb"); + if (in==NULL) + { + perror("Failed to open input file"); + return(1); + } + + out = fopen(argv[2],"wb"); + if (out==NULL) + { + perror("Failed to open output file"); + return(1); + } + + ret = process(in,out); + + fclose(in); + fclose(out); + + return(ret); +} diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile new file mode 100644 index 00000000000..af3e0e0d593 --- /dev/null +++ b/reactos/lib/ntdll/makefile @@ -0,0 +1,7 @@ +all: genntdll$(EXE_POSTFIX) + +genntdll$(EXE_POSTFIX): genntdll.c + $(NATIVE_CC) -g genntdll.c -o genntdll$(EXE_POSTFIX) +dummy: + +include ../../rules.mak diff --git a/reactos/lib/ntdll/ntdll.c b/reactos/lib/ntdll/ntdll.c new file mode 100644 index 00000000000..9604295d1ef --- /dev/null +++ b/reactos/lib/ntdll/ntdll.c @@ -0,0 +1,10 @@ +/* + * Machine generated, don't edit + */ + +#include + +NTSTATUS NtAlertThread(UCHAR first_arg) +{ + MAKE_NTAPI_CALL(4,first_arg); +} diff --git a/reactos/lib/ntdll/ntdll.cll b/reactos/lib/ntdll/ntdll.cll new file mode 100644 index 00000000000..1f2c3f4792c --- /dev/null +++ b/reactos/lib/ntdll/ntdll.cll @@ -0,0 +1,4 @@ +# +# This defines the kernel entry points used by ntdll +# +NtAlertThread 4 diff --git a/reactos/lib/ntdll/ntdll.s b/reactos/lib/ntdll/ntdll.s new file mode 100644 index 00000000000..0e1e74caa99 --- /dev/null +++ b/reactos/lib/ntdll/ntdll.s @@ -0,0 +1,22 @@ + .file "ntdll.c" + .version "01.01" +gcc2_compiled.: +.text + .align 16 +.globl NtAlertThread + .type NtAlertThread,@function +NtAlertThread: + subl $4,%esp + movb 8(%esp),%al + movb %al,3(%esp) + leal 3(%esp),%edx + movl $4,%eax +#APP + int $0x2e + +#NO_APP + addl $4,%esp + ret +.Lfe1: + .size NtAlertThread,.Lfe1-NtAlertThread + .ident "GCC: (GNU) 2.7.2.3" diff --git a/reactos/loaders/boot/boot.asm b/reactos/loaders/boot/boot.asm new file mode 100644 index 00000000000..aa82a3f3073 --- /dev/null +++ b/reactos/loaders/boot/boot.asm @@ -0,0 +1,291 @@ +; +; File: +; boot.asm +; Description: +; DOS-C boot +; +; Copyright (c) 1997; +; Svante Frey +; All Rights Reserved +; +; This file is part of DOS-C. +; +; DOS-C 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, or (at your option) any later version. +; +; DOS-C 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 DOS-C; see the file COPYING. If not, +; write to the Free Software Foundation, 675 Mass Ave, +; Cambridge, MA 02139, USA. +; +; $Logfile: C:/dos-c/src/boot/boot.asv $ +; +; $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/loaders/boot/Attic/boot.asm,v 1.1 1996/01/23 01:02:19 rosmgr Exp $ +; +; $Log: boot.asm,v $ +; Revision 1.1 1996/01/23 01:02:19 rosmgr +; Initial revision +; +; +; Rev 1.5 10 Jan 1997 4:58:06 patv +; Corrected copyright +; +; Rev 1.4 10 Jan 1997 4:52:50 patv +; Re-written to support C drive and eliminate restrictions on IPL.SYS +; +; Rev 1.3 29 Aug 1996 13:06:50 patv +; Bug fixes for v0.91b +; +; Rev 1.2 01 Sep 1995 17:56:44 patv +; First GPL release. +; +; Rev 1.1 30 Jul 1995 20:37:38 patv +; Initialized stack before use. +; +; Rev 1.0 02 Jul 1995 10:57:52 patv +; Initial revision. +; + +section .text + + org 0 +Entry: jmp real_start + +; bp is initialized to 7c00h +%define oem [bp+3] +%define bytesPerSector [bp+0bh] +%define sectPerCluster [bp+0dh] +%define resSectors [bp+0eh] +%define nFats [bp+10h] +%define nRootDir [bp+11h] +%define nSectors [bp+13h] +%define MID [bp+15h] +%define sectPerFat [bp+16h] +%define sectPerTrack [bp+18h] +%define nHeads [bp+1ah] +%define nHidden [bp+1ch] +%define nHidden_hi [bp+1eh] +%define nSectorHuge [bp+20h] +%define drive [bp+24h] +%define extBoot [bp+26h] +%define volid [bp+27h] +%define vollabel [bp+2bh] +%define filesys 36h + +LOADSEG equ 2000h + +FATBUF equ 4000h ; offset of temporary buffer for FAT + ; chain +RETRYCOUNT equ 5 ; number of retries on disk errors + +; Some extra variables that are created on the stack frame + +%define fat_start [bp-4] ; first FAT sector +%define fat_start_hi [bp-2] +%define root_dir_start [bp-8] ; first root directory sector +%define root_dir_start_hi [bp-6] +%define data_start [bp-12] ; first data sector +%define data_start_hi [bp-10] + +; +; Include macros for filesystem access +; +%include "boot.inc" + +; +; +; + TIMES 3eh-($-$$) DB 0 + +%define tempbuf [bp+3eh] +load_seg dw LOADSEG + +real_start: cli + cld + mov ax, cs + mov ss, ax ; initialize stack + mov bp, 7c00h + lea sp, [bp-20h] + sti + + mov es, ax + mov ds, ax + mov drive, dl ; BIOS passes drive number in DL + + GETDRIVEPARMS + + FINDFILE ; locate file in root directory + jc boot_error ; fail if not found + + GETFATCHAIN ; read FAT chain + LOADFILE ; load file (jumps to boot_sucess if successful) + +boot_error: mov cx, ERRMSGLEN + mov si, errmsg+7c00h + +next_char: lodsb ; print error message + mov ah, 0eh + xor bh, bh + int 10h + loop next_char + + xor ah, ah + int 16h ; wait for keystroke + int 19h ; invoke bootstrap loader + +boot_success: mov dl, drive + + db 0eah ; far jump to LOADSEG:0000 + dw 0 + dw LOADSEG + + +; readDisk: Reads a number of sectors into memory. +; +; Call with: DX:AX = 32-bit DOS sector number +; DI = number of sectors to read +; ES:BX = destination buffer +; ES must be 64k aligned (1000h, 2000h etc). +; +; Returns: CF set on error +; ES:BX points one byte after the last byte read. + +readDisk: + push si +read_next: push dx + push ax + + ; + ; translate sector number to BIOS parameters + ; + + ; + ; abs = sector offset in track + ; + head * sectPerTrack offset in cylinder + ; + track * sectPerTrack * nHeads offset in platter + ; + ; t1 = abs / sectPerTrack (ax has t1) + ; sector = abs mod sectPerTrack (cx has sector) + ; + div word sectPerTrack + mov cx, dx + + ; + ; t1 = head + track * nHeads + ; + ; track = t1 / nHeads (ax has track) + ; head = t1 mod nHeads (dl has head) + ; + xor dx, dx + div word nHeads + + ; the following manipulations are necessary in order to + ; properly place parameters into registers. + ; ch = cylinder number low 8 bits + ; cl = 7-6: cylinder high two bits + ; 5-0: sector + mov dh, dl ; save head into dh for bios + ror ah, 1 ; move track high bits into + ror ah, 1 ; bits 7-6 (assumes top = 0) + xchg al, ah ; swap for later + mov dl, byte sectPerTrack + sub dl, cl + inc cl ; sector offset from 1 + or cx, ax ; merge cylinder into sector + mov al, dl ; al has # of sectors left + + ; Calculate how many sectors can be transfered in this read + ; due to dma boundary conditions. + push dx + + mov si, di ; temp register save + ; this computes remaining bytes because of modulo 65536 + ; nature of dma boundary condition + mov ax, bx ; get offset pointer + neg ax ; and convert to bytes + jz ax_min_1 ; started at seg:0, skip ahead + + xor dx, dx ; convert to sectors + div word bytesPerSector + + cmp ax, di ; check remainder vs. asked + jb ax_min_1 ; less, skip ahead + mov si, ax ; transfer only what we can + +ax_min_1: pop dx + + ; Check that request sectors do not exceed track boundary + mov si, sectPerTrack + inc si + mov ax, cx ; get the sector/cyl byte + and ax, 03fh ; and mask out sector + sub si, ax ; si has how many we can read + mov ax, di + cmp si, di ; see if asked <= available + jge ax_min_2 + mov ax, si ; get what can be xfered + +ax_min_2: mov si, RETRYCOUNT + mov ah, 2 + mov dl, drive + +retry: push ax + int 13h + pop ax + jnc read_ok + push ax + xor ax, ax ; reset the drive + int 13h + pop ax + dec si + jnz retry + stc + pop ax + pop dx + pop si + ret + +read_next_jmp: jmp short read_next +read_ok: xor ah, ah + mov si, ax ; AX = SI = number of sectors read + mul word bytesPerSector ; AX = number of bytes read + add bx, ax ; add number of bytes read to BX + jnc no_incr_es ; if overflow... + + mov ax, es + add ah, 10h ; ...add 1000h to ES + mov es, ax + +no_incr_es: pop ax + pop dx ; DX:AX = last sector number + + add ax, si + adc dx, 0 ; DX:AX = next sector to read + sub di, si ; if there is anything left to read, + jg read_next_jmp ; continue + + clc + pop si + ret + +errmsg db "Boot error" +ERRMSGLEN equ $ - errmsg + + +;filename db "OSLDR BIN" +filename db "KERNEL BIN" + + TIMES 510-($-$$) DB 0 +sign dw 0aa55h + + + + + diff --git a/reactos/loaders/boot/boot.bin b/reactos/loaders/boot/boot.bin new file mode 100644 index 0000000000000000000000000000000000000000..2e885f2cf4abc05c0d6296132afd1cbf6c464075 GIT binary patch literal 512 zcmaE9%RmWG`1PmfMBjzI3^l!J4}SL@=)2JorqW#|(_JUWT*lXUoq?gV>`!Oizb-cc zgD2n9#2AkWUhgdX(OLJaJC1uJ>*d$oZi0rFzJKm?6J$IFQU0Z~?pwFpkM6Kv-F1S7 zxBJ}eUhHHjk~93jlbd1R$J+4E%i`6#U8R1Ma5o-TU{GtYWhj06v#2TnsL=3scb!!|uq!tzB7kRq|`MLTiC^&igF))O#0s!!s)9wHO literal 0 HcmV?d00001 diff --git a/reactos/loaders/boot/boot.inc b/reactos/loaders/boot/boot.inc new file mode 100644 index 00000000000..0e195bf49d3 --- /dev/null +++ b/reactos/loaders/boot/boot.inc @@ -0,0 +1,196 @@ +; To save space, functions that are just called once are +; implemented as macros instead. Four bytes are saved by +; avoiding the call / ret instructions. + + +; FINDFILE: Searches for the file in the root directory. +; +; Returns: +; +; If file not found: CF set +; +; If file found: CF clear +; AX = first cluster of file + + +%macro FINDFILE 0 + ; First, read the whole root directory + ; into the temporary buffer. + + mov ax, word root_dir_start + mov dx, word root_dir_start_hi + mov di, nRootDir + xor bx, bx + mov es, tempbuf + call readDisk + jc ffDone + + xor di, di + +next_entry: mov cx, 11 + mov si, filename+7c00h + push di + repe cmpsb + pop di + mov ax, [es:di+1ah] ; get cluster number from directory entry + clc + je ffDone + + add di, 20h ; go to next directory entry + cmp byte [es:di], 0 ; if the first byte of the name is 0, + jnz next_entry ; there is no more files in the directory + + stc +ffDone: +%endmacro + +; GETDRIVEPARMS: Calculate start of some disk areas. + +%macro GETDRIVEPARMS 0 + mov si, word nHidden + mov di, word nHidden_hi + add si, word resSectors + adc di, 0 ; DI:SI = first FAT sector + + mov word fat_start, si + mov word fat_start_hi, di + + mov al, nFats + xor ah, ah + mul word sectPerFat ; DX:AX = total number of FAT sectors + + add si, ax + adc di, dx ; DI:SI = first root directory sector + mov word root_dir_start, si + mov word root_dir_start_hi, di + + ; Calculate how many sectors the root directory occupies. + mov bx, bytesPerSector + mov cl, 5 ; divide BX by 32 + shr bx, cl ; BX = directory entries per sector + + mov ax, nRootDir + xor dx, dx + div bx + + mov nRootDir, ax ; AX = sectors per root directory + + add si, ax + adc di, 0 ; DI:SI = first data sector + + mov data_start, si + mov data_start_hi, di +%endmacro + +; GETFATCHAIN: +; +; Reads the FAT chain and stores it in a temporary buffer in the first +; 64 kb. The FAT chain is stored an array of 16-bit cluster numbers, +; ending with 0. +; +; The file must fit in conventional memory, so it can't be larger than +; 640 kb. The sector size must be at least 512 bytes, so the FAT chain +; can't be larger than around 3 kb. +; +; Call with: AX = first cluster in chain +; +; Returns: CF clear on success, set on error + +%macro GETFATCHAIN 0 + push ax ; store first cluster number + + ; Load the complete FAT into memory. The FAT can't be larger + ; than 128 kb, so it should fit in the temporary buffer. + + mov es, tempbuf + xor bx, bx + mov di, sectPerFat + mov ax, word fat_start + mov dx, word fat_start_hi + call readDisk + pop ax ; restore first cluster number + jc boot_error + + ; Set ES:DI to the temporary storage for the FAT chain. + push ds + push es + pop ds + pop es + mov di, FATBUF + +next_clust: stosw ; store cluster number + mov si, ax ; SI = cluster number + cmp byte extBoot, 29h + jne fat_12 + cmp byte [bp+filesys+4], '6' ; check for FAT-16 system + je fat_16 + + ; This is a FAT-12 disk. + +fat_12: add si, si ; multiply cluster number by 3... + add si, ax + shr si, 1 ; ...and divide by 2 + lodsw + + ; If the cluster number was even, the cluster value is now in + ; bits 0-11 of AX. If the cluster number was odd, the cluster + ; value is in bits 4-15, and must be shifted right 4 bits. If + ; the number was odd, CF was set in the last shift instruction. + + jnc fat_even + mov cl, 4 + shr ax, cl ; shift the cluster number + +fat_even: and ah, 0fh ; mask off the highest 4 bits + cmp ax, 0fffh ; check for EOF + jmp short next_test + + ; This is a FAT-16 disk. The maximal size of a 16-bit FAT + ; is 128 kb, so it may not fit within a single 64 kb segment. + +fat_16: mov dx, tempbuf + add si, si ; multiply cluster number by two + jnc first_half ; if overflow... + add dh, 10h ; ...add 64 kb to segment value + +first_half: mov ds, dx ; DS:SI = pointer to next cluster + lodsw ; AX = next cluster + + cmp ax, 0fff8h ; >= FFF8 = 16-bit EOF +next_test: jb next_clust ; continue if not EOF + +finished: ; Mark end of FAT chain with 0, so we have a single + ; EOF marker for both FAT-12 and FAT-16 systems. + + xor ax, ax + stosw +fatError: +%endmacro + + +; loadFile: Loads the file into memory, one cluster at a time. + +%macro LOADFILE 0 + mov es, tempbuf ; set ES:BX to load address + xor bx, bx + + mov si, FATBUF ; set DS:SI to the FAT chain + push cs + pop ds + +next_cluster: lodsw ; AX = next cluster to read + or ax, ax ; if EOF... + je boot_success ; ...boot was successful + + dec ax ; cluster numbers start with 2 + dec ax + + mov di, word sectPerCluster + and di, 0ffh ; DI = sectors per cluster + mul di + add ax, data_start + adc dx, data_start_hi ; DX:AX = first sector to read + call readDisk + jnc next_cluster + +%endmacro diff --git a/reactos/loaders/boot/boot.lst b/reactos/loaders/boot/boot.lst new file mode 100644 index 00000000000..33a6bb547ec --- /dev/null +++ b/reactos/loaders/boot/boot.lst @@ -0,0 +1,640 @@ + 1 ; + 2 ; File: + 3 ; boot.asm + 4 ; Description: + 5 ; DOS-C boot + 6 ; + 7 ; Copyright (c) 1997; + 8 ; Svante Frey + 9 ; All Rights Reserved + 10 ; + 11 ; This file is part of DOS-C. + 12 ; + 13 ; DOS-C is free software; you can redistribute it and/or + 14 ; modify it under the terms of the GNU General Public License + 15 ; as published by the Free Software Foundation; either version + 16 ; 2, or (at your option) any later version. + 17 ; + 18 ; DOS-C is distributed in the hope that it will be useful, but + 19 ; WITHOUT ANY WARRANTY; without even the implied warranty of + 20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + 21 ; the GNU General Public License for more details. + 22 ; + 23 ; You should have received a copy of the GNU General Public + 24 ; License along with DOS-C; see the file COPYING. If not, + 25 ; write to the Free Software Foundation, 675 Mass Ave, + 26 ; Cambridge, MA 02139, USA. + 27 ; + 28 ; $Logfile: C:/dos-c/src/boot/boot.asv $ + 29 ; + 30 ; $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/loaders/boot/Attic/boot.lst,v 1.1 1996/01/23 01:02:19 rosmgr Exp $ + 31 ; + 32 ; $Log: boot.lst,v $ + 32 ; Revision 1.1 1996/01/23 01:02:19 rosmgr + 32 ; Initial revision + 32 ; + 33 ; + 34 ; Rev 1.5 10 Jan 1997 4:58:06 patv + 35 ; Corrected copyright + 36 ; + 37 ; Rev 1.4 10 Jan 1997 4:52:50 patv + 38 ; Re-written to support C drive and eliminate restrictions on IPL.SYS + 39 ; + 40 ; Rev 1.3 29 Aug 1996 13:06:50 patv + 41 ; Bug fixes for v0.91b + 42 ; + 43 ; Rev 1.2 01 Sep 1995 17:56:44 patv + 44 ; First GPL release. + 45 ; + 46 ; Rev 1.1 30 Jul 1995 20:37:38 patv + 47 ; Initialized stack before use. + 48 ; + 49 ; Rev 1.0 02 Jul 1995 10:57:52 patv + 50 ; Initial revision. + 51 ; + 52 + 53 section .text + 54 + 55 org 0 + 56 00000000 E93D00 Entry: jmp real_start + 57 + 58 ; bp is initialized to 7c00h + 59 %define oem [bp+3] + 60 %define bytesPerSector [bp+0bh] + 61 %define sectPerCluster [bp+0dh] + 62 %define resSectors [bp+0eh] + 63 %define nFats [bp+10h] + 64 %define nRootDir [bp+11h] + 65 %define nSectors [bp+13h] + 66 %define MID [bp+15h] + 67 %define sectPerFat [bp+16h] + 68 %define sectPerTrack [bp+18h] + 69 %define nHeads [bp+1ah] + 70 %define nHidden [bp+1ch] + 71 %define nHidden_hi [bp+1eh] + 72 %define nSectorHuge [bp+20h] + 73 %define drive [bp+24h] + 74 %define extBoot [bp+26h] + 75 %define volid [bp+27h] + 76 %define vollabel [bp+2bh] + 77 %define filesys 36h + 78 + 79 LOADSEG equ 2000h + 80 + 81 FATBUF equ 4000h ; offset of temporary buffer for FAT + 82 ; chain + 83 RETRYCOUNT equ 5 ; number of retries on disk errors + 84 + 85 ; Some extra variables that are created on the stack frame + 86 + 87 %define fat_start [bp-4] ; first FAT sector + 88 %define fat_start_hi [bp-2] + 89 %define root_dir_start [bp-8] ; first root directory sector + 90 %define root_dir_start_hi [bp-6] + 91 %define data_start [bp-12] ; first data sector + 92 %define data_start_hi [bp-10] + 93 + 94 ; + 95 ; Include macros for filesystem access + 96 ; + 97 %include "boot.inc" + 98 <1> ; To save space, functions that are just called once are + 99 <1> ; implemented as macros instead. Four bytes are saved by + 100 <1> ; avoiding the call / ret instructions. + 101 <1> + 102 <1> + 103 <1> ; FINDFILE: Searches for the file in the root directory. + 104 <1> ; + 105 <1> ; Returns: + 106 <1> ; + 107 <1> ; If file not found: CF set + 108 <1> ; + 109 <1> ; If file found: CF clear + 110 <1> ; AX = first cluster of file + 111 <1> + 112 <1> + 113 <1> %macro FINDFILE 0 + 114 <1> ; First, read the whole root directory + 115 <1> ; into the temporary buffer. + 116 <1> + 117 <1> mov ax, word root_dir_start + 118 <1> mov dx, word root_dir_start_hi + 119 <1> mov di, nRootDir + 120 <1> xor bx, bx + 121 <1> mov es, tempbuf + 122 <1> call readDisk + 123 <1> jc ffDone + 124 <1> + 125 <1> xor di, di + 126 <1> + 127 <1> next_entry: mov cx, 11 + 128 <1> mov si, filename+7c00h + 129 <1> push di + 130 <1> repe cmpsb + 131 <1> pop di + 132 <1> mov ax, [es:di+1ah] ; get cluster number from directory entry + 133 <1> clc + 134 <1> je ffDone + 135 <1> + 136 <1> add di, 20h ; go to next directory entry + 137 <1> cmp byte [es:di], 0 ; if the first byte of the name is 0, + 138 <1> jnz next_entry ; there is no more files in the directory + 139 <1> + 140 <1> stc + 141 <1> ffDone: + 142 <1> %endmacro + 143 <1> + 144 <1> ; GETDRIVEPARMS: Calculate start of some disk areas. + 145 <1> + 146 <1> %macro GETDRIVEPARMS 0 + 147 <1> mov si, word nHidden + 148 <1> mov di, word nHidden_hi + 149 <1> add si, word resSectors + 150 <1> adc di, 0 ; DI:SI = first FAT sector + 151 <1> + 152 <1> mov word fat_start, si + 153 <1> mov word fat_start_hi, di + 154 <1> + 155 <1> mov al, nFats + 156 <1> xor ah, ah + 157 <1> mul word sectPerFat ; DX:AX = total number of FAT sectors + 158 <1> + 159 <1> add si, ax + 160 <1> adc di, dx ; DI:SI = first root directory sector + 161 <1> mov word root_dir_start, si + 162 <1> mov word root_dir_start_hi, di + 163 <1> + 164 <1> ; Calculate how many sectors the root directory occupies. + 165 <1> mov bx, bytesPerSector + 166 <1> mov cl, 5 ; divide BX by 32 + 167 <1> shr bx, cl ; BX = directory entries per sector + 168 <1> + 169 <1> mov ax, nRootDir + 170 <1> xor dx, dx + 171 <1> div bx + 172 <1> + 173 <1> mov nRootDir, ax ; AX = sectors per root directory + 174 <1> + 175 <1> add si, ax + 176 <1> adc di, 0 ; DI:SI = first data sector + 177 <1> + 178 <1> mov data_start, si + 179 <1> mov data_start_hi, di + 180 <1> %endmacro + 181 <1> + 182 <1> ; GETFATCHAIN: + 183 <1> ; + 184 <1> ; Reads the FAT chain and stores it in a temporary buffer in the first + 185 <1> ; 64 kb. The FAT chain is stored an array of 16-bit cluster numbers, + 186 <1> ; ending with 0. + 187 <1> ; + 188 <1> ; The file must fit in conventional memory, so it can't be larger than + 189 <1> ; 640 kb. The sector size must be at least 512 bytes, so the FAT chain + 190 <1> ; can't be larger than around 3 kb. + 191 <1> ; + 192 <1> ; Call with: AX = first cluster in chain + 193 <1> ; + 194 <1> ; Returns: CF clear on success, set on error + 195 <1> + 196 <1> %macro GETFATCHAIN 0 + 197 <1> push ax ; store first cluster number + 198 <1> + 199 <1> ; Load the complete FAT into memory. The FAT can't be larger + 200 <1> ; than 128 kb, so it should fit in the temporary buffer. + 201 <1> + 202 <1> mov es, tempbuf + 203 <1> xor bx, bx + 204 <1> mov di, sectPerFat + 205 <1> mov ax, word fat_start + 206 <1> mov dx, word fat_start_hi + 207 <1> call readDisk + 208 <1> pop ax ; restore first cluster number + 209 <1> jc boot_error + 210 <1> + 211 <1> ; Set ES:DI to the temporary storage for the FAT chain. + 212 <1> push ds + 213 <1> push es + 214 <1> pop ds + 215 <1> pop es + 216 <1> mov di, FATBUF + 217 <1> + 218 <1> next_clust: stosw ; store cluster number + 219 <1> mov si, ax ; SI = cluster number + 220 <1> cmp byte extBoot, 29h + 221 <1> jne fat_12 + 222 <1> cmp byte [bp+filesys+4], '6' ; check for FAT-16 system + 223 <1> je fat_16 + 224 <1> + 225 <1> ; This is a FAT-12 disk. + 226 <1> + 227 <1> fat_12: add si, si ; multiply cluster number by 3... + 228 <1> add si, ax + 229 <1> shr si, 1 ; ...and divide by 2 + 230 <1> lodsw + 231 <1> + 232 <1> ; If the cluster number was even, the cluster value is now in + 233 <1> ; bits 0-11 of AX. If the cluster number was odd, the cluster + 234 <1> ; value is in bits 4-15, and must be shifted right 4 bits. If + 235 <1> ; the number was odd, CF was set in the last shift instruction. + 236 <1> + 237 <1> jnc fat_even + 238 <1> mov cl, 4 + 239 <1> shr ax, cl ; shift the cluster number + 240 <1> + 241 <1> fat_even: and ah, 0fh ; mask off the highest 4 bits + 242 <1> cmp ax, 0fffh ; check for EOF + 243 <1> jmp short next_test + 244 <1> + 245 <1> ; This is a FAT-16 disk. The maximal size of a 16-bit FAT + 246 <1> ; is 128 kb, so it may not fit within a single 64 kb segment. + 247 <1> + 248 <1> fat_16: mov dx, tempbuf + 249 <1> add si, si ; multiply cluster number by two + 250 <1> jnc first_half ; if overflow... + 251 <1> add dh, 10h ; ...add 64 kb to segment value + 252 <1> + 253 <1> first_half: mov ds, dx ; DS:SI = pointer to next cluster + 254 <1> lodsw ; AX = next cluster + 255 <1> + 256 <1> cmp ax, 0fff8h ; >= FFF8 = 16-bit EOF + 257 <1> next_test: jb next_clust ; continue if not EOF + 258 <1> + 259 <1> finished: ; Mark end of FAT chain with 0, so we have a single + 260 <1> ; EOF marker for both FAT-12 and FAT-16 systems. + 261 <1> + 262 <1> xor ax, ax + 263 <1> stosw + 264 <1> fatError: + 265 <1> %endmacro + 266 <1> + 267 <1> + 268 <1> ; loadFile: Loads the file into memory, one cluster at a time. + 269 <1> + 270 <1> %macro LOADFILE 0 + 271 <1> mov es, tempbuf ; set ES:BX to load address + 272 <1> xor bx, bx + 273 <1> + 274 <1> mov si, FATBUF ; set DS:SI to the FAT chain + 275 <1> push cs + 276 <1> pop ds + 277 <1> + 278 <1> next_cluster: lodsw ; AX = next cluster to read + 279 <1> or ax, ax ; if EOF... + 280 <1> je boot_success ; ...boot was successful + 281 <1> + 282 <1> dec ax ; cluster numbers start with 2 + 283 <1> dec ax + 284 <1> + 285 <1> mov di, word sectPerCluster + 286 <1> and di, 0ffh ; DI = sectors per cluster + 287 <1> mul di + 288 <1> add ax, data_start + 289 <1> adc dx, data_start_hi ; DX:AX = first sector to read + 290 <1> call readDisk + 291 <1> jnc next_cluster + 292 <1> + 293 <1> %endmacro + 294 + 295 ; + 296 ; + 297 ; + 298 00000003 00 TIMES 3eh-($-$$) DB 0 + 299 + 300 %define tempbuf [bp+3eh] + 301 0000003E 0020 load_seg dw LOADSEG + 302 + 303 00000040 FA real_start: cli + 304 00000041 FC cld + 305 00000042 8CC8 mov ax, cs + 306 00000044 8ED0 mov ss, ax ; initialize stack + 307 00000046 BD007C mov bp, 7c00h + 308 00000049 8D66E0 lea sp, [bp-20h] + 309 0000004C FB sti + 310 + 311 0000004D 8EC0 mov es, ax + 312 0000004F 8ED8 mov ds, ax + 313 00000051 885624 mov drive, dl ; BIOS passes drive number in DL + 314 + 315 GETDRIVEPARMS + 316 00000054 8B761C <1> mov si, word nHidden + 317 00000057 8B7E1E <1> mov di, word nHidden_hi + 318 0000005A 03760E <1> add si, word resSectors + 319 0000005D 81D70000 <1> adc di, 0 + 320 <1> + 321 00000061 8976FC <1> mov word fat_start, si + 322 00000064 897EFE <1> mov word fat_start_hi, di + 323 <1> + 324 00000067 8A4610 <1> mov al, nFats + 325 0000006A 30E4 <1> xor ah, ah + 326 0000006C F76616 <1> mul word sectPerFat + 327 <1> + 328 0000006F 01C6 <1> add si, ax + 329 00000071 11D7 <1> adc di, dx + 330 00000073 8976F8 <1> mov word root_dir_start, si + 331 00000076 897EFA <1> mov word root_dir_start_hi, di + 332 <1> + 333 <1> + 334 00000079 8B5E0B <1> mov bx, bytesPerSector + 335 0000007C B105 <1> mov cl, 5 + 336 0000007E D3EB <1> shr bx, cl + 337 <1> + 338 00000080 8B4611 <1> mov ax, nRootDir + 339 00000083 31D2 <1> xor dx, dx + 340 00000085 F7F3 <1> div bx + 341 <1> + 342 00000087 894611 <1> mov nRootDir, ax + 343 <1> + 344 0000008A 01C6 <1> add si, ax + 345 0000008C 81D70000 <1> adc di, 0 + 346 <1> + 347 00000090 8976F4 <1> mov data_start, si + 348 00000093 897EF6 <1> mov data_start_hi, di + 349 + 350 FINDFILE ; locate file in root directory + 351 <1> + 352 <1> + 353 <1> + 354 00000096 8B46F8 <1> mov ax, word root_dir_start + 355 00000099 8B56FA <1> mov dx, word root_dir_start_hi + 356 0000009C 8B7E11 <1> mov di, nRootDir + 357 0000009F 31DB <1> xor bx, bx + 358 000000A1 8E463E <1> mov es, tempbuf + 359 000000A4 E8B900 <1> call readDisk + 360 000000A7 721E <1> jc ffDone + 361 <1> + 362 000000A9 31FF <1> xor di, di + 363 <1> + 364 000000AB B90B00 <1> next_entry: mov cx, 11 + 365 000000AE BE[F17D] <1> mov si, filename+7c00h + 366 000000B1 57 <1> push di + 367 000000B2 F3A6 <1> repe cmpsb + 368 000000B4 5F <1> pop di + 369 000000B5 268B451A <1> mov ax, [es:di+1ah] + 370 000000B9 F8 <1> clc + 371 000000BA 740B <1> je ffDone + 372 <1> + 373 000000BC 81C72000 <1> add di, 20h + 374 000000C0 26803D00 <1> cmp byte [es:di], 0 + 375 000000C4 75E5 <1> jnz next_entry + 376 <1> + 377 000000C6 F9 <1> stc + 378 <1> ffDone: + 379 000000C7 727A jc boot_error ; fail if not found + 380 + 381 GETFATCHAIN ; read FAT chain + 382 000000C9 50 <1> push ax + 383 <1> + 384 <1> + 385 <1> + 386 <1> + 387 000000CA 8E463E <1> mov es, tempbuf + 388 000000CD 31DB <1> xor bx, bx + 389 000000CF 8B7E16 <1> mov di, sectPerFat + 390 000000D2 8B46FC <1> mov ax, word fat_start + 391 000000D5 8B56FE <1> mov dx, word fat_start_hi + 392 000000D8 E88500 <1> call readDisk + 393 000000DB 58 <1> pop ax + 394 000000DC 7265 <1> jc boot_error + 395 <1> + 396 <1> + 397 000000DE 1E <1> push ds + 398 000000DF 06 <1> push es + 399 000000E0 1F <1> pop ds + 400 000000E1 07 <1> pop es + 401 000000E2 BF0040 <1> mov di, FATBUF + 402 <1> + 403 000000E5 AB <1> next_clust: stosw + 404 000000E6 89C6 <1> mov si, ax + 405 000000E8 807E2629 <1> cmp byte extBoot, 29h + 406 000000EC 7506 <1> jne fat_12 + 407 000000EE 807E3A36 <1> cmp byte [bp+filesys+4], '6' + 408 000000F2 7415 <1> je fat_16 + 409 <1> + 410 <1> + 411 <1> + 412 000000F4 01F6 <1> fat_12: add si, si + 413 000000F6 01C6 <1> add si, ax + 414 000000F8 D1EE <1> shr si, 1 + 415 000000FA AD <1> lodsw + 416 <1> + 417 <1> + 418 <1> + 419 <1> + 420 <1> + 421 <1> + 422 000000FB 7304 <1> jnc fat_even + 423 000000FD B104 <1> mov cl, 4 + 424 000000FF D3E8 <1> shr ax, cl + 425 <1> + 426 00000101 80E40F <1> fat_even: and ah, 0fh + 427 00000104 3DFF0F <1> cmp ax, 0fffh + 428 00000107 EB10 <1> jmp short next_test + 429 <1> + 430 <1> + 431 <1> + 432 <1> + 433 00000109 8B563E <1> fat_16: mov dx, tempbuf + 434 0000010C 01F6 <1> add si, si + 435 0000010E 7303 <1> jnc first_half + 436 00000110 80C610 <1> add dh, 10h + 437 <1> + 438 00000113 8EDA <1> first_half: mov ds, dx + 439 00000115 AD <1> lodsw + 440 <1> + 441 00000116 3DF8FF <1> cmp ax, 0fff8h + 442 00000119 72CA <1> next_test: jb next_clust + 443 <1> + 444 <1> finished: + 445 <1> + 446 <1> + 447 0000011B 31C0 <1> xor ax, ax + 448 0000011D AB <1> stosw + 449 <1> fatError: + 450 LOADFILE ; load file (jumps to boot_sucess if successful) + 451 0000011E 8E463E <1> mov es, tempbuf + 452 00000121 31DB <1> xor bx, bx + 453 <1> + 454 00000123 BE0040 <1> mov si, FATBUF + 455 00000126 0E <1> push cs + 456 00000127 1F <1> pop ds + 457 <1> + 458 00000128 AD <1> next_cluster: lodsw + 459 00000129 09C0 <1> or ax, ax + 460 0000012B 742B <1> je boot_success + 461 <1> + 462 0000012D 48 <1> dec ax + 463 0000012E 48 <1> dec ax + 464 <1> + 465 0000012F 8B7E0D <1> mov di, word sectPerCluster + 466 00000132 81E7FF00 <1> and di, 0ffh + 467 00000136 F7E7 <1> mul di + 468 00000138 0346F4 <1> add ax, data_start + 469 0000013B 1356F6 <1> adc dx, data_start_hi + 470 0000013E E81F00 <1> call readDisk + 471 00000141 73E5 <1> jnc next_cluster + 472 <1> + 473 + 474 00000143 B90A00 boot_error: mov cx, ERRMSGLEN + 475 00000146 BE[E77D] mov si, errmsg+7c00h + 476 + 477 00000149 AC next_char: lodsb ; print error message + 478 0000014A B40E mov ah, 0eh + 479 0000014C 30FF xor bh, bh + 480 0000014E CD10 int 10h + 481 00000150 E2F7 loop next_char + 482 + 483 00000152 30E4 xor ah, ah + 484 00000154 CD16 int 16h ; wait for keystroke + 485 00000156 CD19 int 19h ; invoke bootstrap loader + 486 + 487 00000158 8A5624 boot_success: mov dl, drive + 488 + 489 0000015B EA db 0eah ; far jump to LOADSEG:0000 + 490 0000015C 0000 dw 0 + 491 0000015E 0020 dw LOADSEG + 492 + 493 + 494 ; readDisk: Reads a number of sectors into memory. + 495 ; + 496 ; Call with: DX:AX = 32-bit DOS sector number + 497 ; DI = number of sectors to read + 498 ; ES:BX = destination buffer + 499 ; ES must be 64k aligned (1000h, 2000h etc). + 500 ; + 501 ; Returns: CF set on error + 502 ; ES:BX points one byte after the last byte read. + 503 + 504 readDisk: + 505 00000160 56 push si + 506 00000161 52 read_next: push dx + 507 00000162 50 push ax + 508 + 509 ; + 510 ; translate sector number to BIOS parameters + 511 ; + 512 + 513 ; + 514 ; abs = sector offset in track + 515 ; + head * sectPerTrack offset in cylinder + 516 ; + track * sectPerTrack * nHeads offset in platter + 517 ; + 518 ; t1 = abs / sectPerTrack (ax has t1) + 519 ; sector = abs mod sectPerTrack (cx has sector) + 520 ; + 521 00000163 F77618 div word sectPerTrack + 522 00000166 89D1 mov cx, dx + 523 + 524 ; + 525 ; t1 = head + track * nHeads + 526 ; + 527 ; track = t1 / nHeads (ax has track) + 528 ; head = t1 mod nHeads (dl has head) + 529 ; + 530 00000168 31D2 xor dx, dx + 531 0000016A F7761A div word nHeads + 532 + 533 ; the following manipulations are necessary in order to + 534 ; properly place parameters into registers. + 535 ; ch = cylinder number low 8 bits + 536 ; cl = 7-6: cylinder high two bits + 537 ; 5-0: sector + 538 0000016D 88D6 mov dh, dl ; save head into dh for bios + 539 0000016F D0CC ror ah, 1 ; move track high bits into + 540 00000171 D0CC ror ah, 1 ; bits 7-6 (assumes top = 0) + 541 00000173 86C4 xchg al, ah ; swap for later + 542 00000175 8A5618 mov dl, byte sectPerTrack + 543 00000178 28CA sub dl, cl + 544 0000017A FEC1 inc cl ; sector offset from 1 + 545 0000017C 09C1 or cx, ax ; merge cylinder into sector + 546 0000017E 88D0 mov al, dl ; al has # of sectors left + 547 + 548 ; Calculate how many sectors can be transfered in this read + 549 ; due to dma boundary conditions. + 550 00000180 52 push dx + 551 + 552 00000181 89FE mov si, di ; temp register save + 553 ; this computes remaining bytes because of modulo 65536 + 554 ; nature of dma boundary condition + 555 00000183 89D8 mov ax, bx ; get offset pointer + 556 00000185 F7D8 neg ax ; and convert to bytes + 557 00000187 740B jz ax_min_1 ; started at seg:0, skip ahead + 558 + 559 00000189 31D2 xor dx, dx ; convert to sectors + 560 0000018B F7760B div word bytesPerSector + 561 + 562 0000018E 39F8 cmp ax, di ; check remainder vs. asked + 563 00000190 7202 jb ax_min_1 ; less, skip ahead + 564 00000192 89C6 mov si, ax ; transfer only what we can + 565 + 566 00000194 5A ax_min_1: pop dx + 567 + 568 ; Check that request sectors do not exceed track boundary + 569 00000195 8B7618 mov si, sectPerTrack + 570 00000198 46 inc si + 571 00000199 89C8 mov ax, cx ; get the sector/cyl byte + 572 0000019B 253F00 and ax, 03fh ; and mask out sector + 573 0000019E 29C6 sub si, ax ; si has how many we can read + 574 000001A0 89F8 mov ax, di + 575 000001A2 39FE cmp si, di ; see if asked <= available + 576 000001A4 7D02 jge ax_min_2 + 577 000001A6 89F0 mov ax, si ; get what can be xfered + 578 + 579 000001A8 BE0500 ax_min_2: mov si, RETRYCOUNT + 580 000001AB B402 mov ah, 2 + 581 000001AD 8A5624 mov dl, drive + 582 + 583 000001B0 50 retry: push ax + 584 000001B1 CD13 int 13h + 585 000001B3 58 pop ax + 586 000001B4 7310 jnc read_ok + 587 000001B6 50 push ax + 588 000001B7 31C0 xor ax, ax ; reset the drive + 589 000001B9 CD13 int 13h + 590 000001BB 58 pop ax + 591 000001BC 4E dec si + 592 000001BD 75F1 jnz retry + 593 000001BF F9 stc + 594 000001C0 58 pop ax + 595 000001C1 5A pop dx + 596 000001C2 5E pop si + 597 000001C3 C3 ret + 598 + 599 000001C4 EB9B read_next_jmp: jmp short read_next + 600 000001C6 30E4 read_ok: xor ah, ah + 601 000001C8 89C6 mov si, ax ; AX = SI = number of sectors read + 602 000001CA F7660B mul word bytesPerSector ; AX = number of bytes read + 603 000001CD 01C3 add bx, ax ; add number of bytes read to BX + 604 000001CF 7307 jnc no_incr_es ; if overflow... + 605 + 606 000001D1 8CC0 mov ax, es + 607 000001D3 80C410 add ah, 10h ; ...add 1000h to ES + 608 000001D6 8EC0 mov es, ax + 609 + 610 000001D8 58 no_incr_es: pop ax + 611 000001D9 5A pop dx ; DX:AX = last sector number + 612 + 613 000001DA 01F0 add ax, si + 614 000001DC 81D20000 adc dx, 0 ; DX:AX = next sector to read + 615 000001E0 29F7 sub di, si ; if there is anything left to read, + 616 000001E2 7FE0 jg read_next_jmp ; continue + 617 + 618 000001E4 F8 clc + 619 000001E5 5E pop si + 620 000001E6 C3 ret + 621 + 622 000001E7 426F6F74206572726F- errmsg db "Boot error" + 623 000001F0 72 + 624 ERRMSGLEN equ $ - errmsg + 625 + 626 + 627 ;filename db "OSLDR BIN" + 628 000001F1 4B45524E454C202042- filename db "KERNEL BIN" + 629 000001FA 494E + 630 + 631 000001FC 00 TIMES 510-($-$$) DB 0 + 632 000001FE 55AA sign dw 0aa55h + 633 + 634 + 635 + 636 + 637 diff --git a/reactos/loaders/boot/boot.mak b/reactos/loaders/boot/boot.mak new file mode 100644 index 00000000000..74f17bbe34f --- /dev/null +++ b/reactos/loaders/boot/boot.mak @@ -0,0 +1,56 @@ +# +# makefile for DOS-C boot +# +# $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/loaders/boot/Attic/boot.mak,v 1.1 1996/01/23 01:02:19 rosmgr Exp $ +# +# $Log: boot.mak,v $ +# Revision 1.1 1996/01/23 01:02:19 rosmgr +# Initial revision +# +# +# Rev 1.3 10 Jan 1997 4:51:54 patv +#Changed to use FreeDOS exe2bin and support new boot code +# +# Rev 1.2 17 Dec 1996 12:52:32 patv +#Converted to FreeDOS exe2bin. +#. +#d +# +# Rev 1.1 29 Aug 1996 13:06:50 patv +#Bug fixes for v0.91b +# +# Rev 1.0 02 Jul 1995 9:11:26 patv +#Initial revision. +# + +# +# Uncomment the following for a debug version +# +#AFLAGS = /zi /DDEBUG +#LFLAGS = /v + +PRODUCT = boot.bin + +all: $(PRODUCT) + +production: all + copy boot.bin ..\..\dist\boot.bin + del *.bin + del *.map + +boot.bin: boot.asm + tasm $(AFLAGS) boot,, + tlink $(LFLAGS) boot + ..\utils\exe2bin boot boot.bin + del boot.obj + del boot.exe + +clean: + del *.lst + del *.map + del *.bin + del *.bak + del *.las + del *.obj + del *.exe + \ No newline at end of file diff --git a/reactos/loaders/boot/boot.map b/reactos/loaders/boot/boot.map new file mode 100644 index 00000000000..9023b6b248c --- /dev/null +++ b/reactos/loaders/boot/boot.map @@ -0,0 +1,8 @@ + + Start Stop Length Name Class + + 00000H 001FFH 00200H TEXT TEXT + +Program entry point at 0000:0000 +Warning: No stack + diff --git a/reactos/loaders/boot/bootbk.asm b/reactos/loaders/boot/bootbk.asm new file mode 100644 index 00000000000..db9e8be810d --- /dev/null +++ b/reactos/loaders/boot/bootbk.asm @@ -0,0 +1,294 @@ +; +; File: +; boot.asm +; Description: +; DOS-C boot +; +; Copyright (c) 1997; +; Svante Frey +; All Rights Reserved +; +; This file is part of DOS-C. +; +; DOS-C 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, or (at your option) any later version. +; +; DOS-C 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 DOS-C; see the file COPYING. If not, +; write to the Free Software Foundation, 675 Mass Ave, +; Cambridge, MA 02139, USA. +; +; $Logfile: C:/dos-c/src/boot/boot.asv $ +; +; $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/loaders/boot/Attic/bootbk.asm,v 1.1 1996/01/23 01:02:19 rosmgr Exp $ +; +; $Log: bootbk.asm,v $ +; Revision 1.1 1996/01/23 01:02:19 rosmgr +; Initial revision +; +; +; Rev 1.5 10 Jan 1997 4:58:06 patv +; Corrected copyright +; +; Rev 1.4 10 Jan 1997 4:52:50 patv +; Re-written to support C drive and eliminate restrictions on IPL.SYS +; +; Rev 1.3 29 Aug 1996 13:06:50 patv +; Bug fixes for v0.91b +; +; Rev 1.2 01 Sep 1995 17:56:44 patv +; First GPL release. +; +; Rev 1.1 30 Jul 1995 20:37:38 patv +; Initialized stack before use. +; +; Rev 1.0 02 Jul 1995 10:57:52 patv +; Initial revision. +; + +.text + +BASE equ 0 + + + org BASE +Entry: jmp real_start + +; bp is initialized to 7c00h +oem equ [bp+3] +bytesPerSector equ [bp+0bh] +sectPerCluster equ [bp+0dh] +resSectors equ [bp+0eh] +nFats equ [bp+10h] +nRootDir equ [bp+11h] +nSectors equ [bp+13h] +MID equ [bp+15h] +sectPerFat equ [bp+16h] +sectPerTrack equ [bp+18h] +nHeads equ [bp+1ah] +nHidden equ [bp+1ch] +nSectorHuge equ [bp+20h] +drive equ [bp+24h] +extBoot equ [bp+26h] +volid equ [bp+27h] +vollabel equ [bp+2bh] +filesys equ [bp+36h] + +LOADSEG equ 2000h + +FATBUF equ 4000h ; offset of temporary buffer for FAT + ; chain +RETRYCOUNT equ 5 ; number of retries on disk errors + +; Some extra variables that are created on the stack frame + +fat_start equ [bp-4] ; first FAT sector +root_dir_start equ [bp-8] ; first root directory sector +data_start equ [bp-12] ; first data sector + + +; +; Include macros for filesystem access +; +include boot.inc + +; +; +; + org BASE+3eh + +tempbuf equ [bp+3eh] +load_seg dw LOADSEG + +real_start: cli + cld + mov ax, cs + mov ss, ax ; initialize stack + mov bp, 7c00h + lea sp, [bp-20h] + sti + + mov es, ax + mov ds, ax + mov drive, dl ; BIOS passes drive number in DL + + GETDRIVEPARMS + + FINDFILE ; locate file in root directory + jc boot_error ; fail if not found + + GETFATCHAIN ; read FAT chain + LOADFILE ; load file (jumps to boot_sucess if successful) + +boot_error: mov cx, ERRMSGLEN + mov si, offset errmsg+7c00h + +next_char: lodsb ; print error message + mov ah, 0eh + xor bh, bh + int 10h + loop next_char + + xor ah, ah + int 16h ; wait for keystroke + int 19h ; invoke bootstrap loader + +boot_success: mov dl, drive + + db 0eah ; far jump to LOADSEG:0000 + dw 0 + dw LOADSEG + + +; readDisk: Reads a number of sectors into memory. +; +; Call with: DX:AX = 32-bit DOS sector number +; DI = number of sectors to read +; ES:BX = destination buffer +; ES must be 64k aligned (1000h, 2000h etc). +; +; Returns: CF set on error +; ES:BX points one byte after the last byte read. + +readDisk proc + push si +read_next: push dx + push ax + + ; + ; translate sector number to BIOS parameters + ; + + ; + ; abs = sector offset in track + ; + head * sectPerTrack offset in cylinder + ; + track * sectPerTrack * nHeads offset in platter + ; + ; t1 = abs / sectPerTrack (ax has t1) + ; sector = abs mod sectPerTrack (cx has sector) + ; + div word ptr sectPerTrack + mov cx, dx + + ; + ; t1 = head + track * nHeads + ; + ; track = t1 / nHeads (ax has track) + ; head = t1 mod nHeads (dl has head) + ; + xor dx, dx + div word ptr nHeads + + ; the following manipulations are necessary in order to + ; properly place parameters into registers. + ; ch = cylinder number low 8 bits + ; cl = 7-6: cylinder high two bits + ; 5-0: sector + mov dh, dl ; save head into dh for bios + ror ah, 1 ; move track high bits into + ror ah, 1 ; bits 7-6 (assumes top = 0) + xchg al, ah ; swap for later + mov dl, byte ptr sectPerTrack + sub dl, cl + inc cl ; sector offset from 1 + or cx, ax ; merge cylinder into sector + mov al, dl ; al has # of sectors left + + ; Calculate how many sectors can be transfered in this read + ; due to dma boundary conditions. + push dx + + mov si, di ; temp register save + ; this computes remaining bytes because of modulo 65536 + ; nature of dma boundary condition + mov ax, bx ; get offset pointer + neg ax ; and convert to bytes + jz ax_min_1 ; started at seg:0, skip ahead + + xor dx, dx ; convert to sectors + div word ptr bytesPerSector + + cmp ax, di ; check remainder vs. asked + jb ax_min_1 ; less, skip ahead + mov si, ax ; transfer only what we can + +ax_min_1: pop dx + + ; Check that request sectors do not exceed track boundary + mov si, sectPerTrack + inc si + mov ax, cx ; get the sector/cyl byte + and ax, 03fh ; and mask out sector + sub si, ax ; si has how many we can read + mov ax, di + cmp si, di ; see if asked <= available + jge ax_min_2 + mov ax, si ; get what can be xfered + +ax_min_2: mov si, RETRYCOUNT + mov ah, 2 + mov dl, drive + +retry: push ax + int 13h + pop ax + jnc read_ok + push ax + xor ax, ax ; reset the drive + int 13h + pop ax + dec si + jnz retry + stc + pop ax + pop dx + pop si + ret + +read_next_jmp: jmp short read_next +read_ok: xor ah, ah + mov si, ax ; AX = SI = number of sectors read + mul word ptr bytesPerSector ; AX = number of bytes read + add bx, ax ; add number of bytes read to BX + jnc no_incr_es ; if overflow... + + mov ax, es + add ah, 10h ; ...add 1000h to ES + mov es, ax + +no_incr_es: pop ax + pop dx ; DX:AX = last sector number + + add ax, si + adc dx, 0 ; DX:AX = next sector to read + sub di, si ; if there is anything left to read, + jg read_next_jmp ; continue + + clc + pop si + ret +readDisk endp + +errmsg db "Boot error" +ERRMSGLEN equ $ - errmsg + + +;filename db "OSLDR BIN" +filename db "KERNEL BIN" + + org BASE+01feh +sign dw 0aa55h + +TEXT ENDS + end + + + + diff --git a/reactos/loaders/boot/osldr.asm b/reactos/loaders/boot/osldr.asm new file mode 100644 index 00000000000..f43af30a431 --- /dev/null +++ b/reactos/loaders/boot/osldr.asm @@ -0,0 +1,340 @@ +; +; Loads the kernel and any required modules +; + +org 0 + +; +; Segment where we are loaded +; +LOADSEG equ 02000h + +; +; Segment used for temporay storage +; +WORKSEG equ 01000h + + +KERNELBASE equ 05000h + +; +; Offsets of work areas +; +FAT_CHAIN equ 0h + +DIR_BUFFER equ 4000h +END_DIR_BUFFER equ 0ffe0h + +FAT_SEG equ 03000h + + +; +; These are all on the stack +; +%define oem [bp+3] +%define bytesPerSector [bp+0bh] +%define sectPerCluster [bp+0dh] +%define resSectors [bp+0eh] +%define nFats [bp+10h] +%define nRootDir [bp+11h] +%define nSectors [bp+13h] +%define MID [bp+15h] +%define sectPerFat [bp+16h] +%define sectPerTrack [bp+18h] +%define nHeads [bp+1ah] +%define nHidden [bp+1ch] +%define nHidden_hi [bp+1eh] +%define nSectorHuge [bp+20h] +%define drive [bp+24h] +%define extBoot [bp+26h] +%define volid [bp+27h] +%define vollabel [bp+2bh] +%define filesys 36h + +RETRYCOUNT equ 5 + +%define fat_start [bp-4] ; first FAT sector +%define fat_start_hi [bp-2] +%define root_dir_start [bp-8] ; first root directory sector +%define root_dir_start_hi [bp-6] +%define data_start [bp-12] ; first data sector +%define data_start_hi [bp-10] + + +entry: + mov drive,dl + + mov ax,LOADSEG + mov ds,ax + + + ; + ; Print out a message + ; + mov di,loadmsg + call printmsg + + + ; + ; Check here for shift pressed and if so display boot menu + ; + + ; + ; Load the entire fat + ; +; mov ax,fat_start +; mov dx,fat_start_hi +; mov di,sectPerFat +; mov ax,FAT_SEG +; mov es,ax +; mov bx,0 +; call readDisk + + + ; + ; Load root directory + ; + mov ax,WORKSEG + mov es,ax + + mov dx,root_dir_start_hi + mov ax,root_dir_start + mov bx,DIR_BUFFER + mov di,nRootDir + shr di,4 + mov di,1 + call readDisk + jc disk_error + + ; + ; Look for a directory called boot + ; + mov di,DIR_BUFFER + cld + mov cx,4 +l1: + mov si,boot_dir_name +; cmp byte [di],0 +; je boot_error + repe cmpsb + je found_it + or di,31 + inc di + cmp di,END_DIR_BUFFER + jge boot_error + jmp l1 + + +boot_error: + mov di,errormsg + call printmsg +l3: + jmp l3 + +disk_error: + mov di,errormsg1 + call printmsg + jmp l3 + + + +found_it: + mov di,msg1 + call printmsg + + ; + ; Load the boot directory found above + ; + sub di,4 + call readFile + +l2: + jmp l2 + +; +; readFile +; +%define file_length [di+01ch] +%define start_cluster [di+01ah] +readFile: + cmp byte extBoot, 29h + jne fat_12 + cmp byte [bp+filesys+4], '6' ; check for FAT-16 system + je fat_16 + +fat_12: + mov di,msg2 + call printmsg +l4: + jmp l4 + +fat_16: + mov di,msg3 + call printmsg + jmp l4 + + + +; readDisk: Reads a number of sectors into memory. +; +; Call with: DX:AX = 32-bit DOS sector number +; DI = number of sectors to read +; ES:BX = destination buffer +; ES must be 64k aligned (1000h, 2000h etc). +; +; Returns: CF set on error +; ES:BX points one byte after the last byte read. + +readDisk: + push bp + push si +read_next: push dx + push ax + + ; + ; translate sector number to BIOS parameters + ; + + ; + ; abs = sector offset in track + ; + head * sectPerTrack offset in cylinder + ; + track * sectPerTrack * nHeads offset in platter + ; + ; t1 = abs / sectPerTrack (ax has t1) + ; sector = abs mod sectPerTrack (cx has sector) + ; + div word sectPerTrack + mov cx, dx + + ; + ; t1 = head + track * nHeads + ; + ; track = t1 / nHeads (ax has track) + ; head = t1 mod nHeads (dl has head) + ; + xor dx, dx + div word nHeads + + ; the following manipulations are necessary in order to + ; properly place parameters into registers. + ; ch = cylinder number low 8 bits + ; cl = 7-6: cylinder high two bits + ; 5-0: sector + mov dh, dl ; save head into dh for bios + ror ah, 1 ; move track high bits into + ror ah, 1 ; bits 7-6 (assumes top = 0) + xchg al, ah ; swap for later + mov dl, byte sectPerTrack + sub dl, cl + inc cl ; sector offset from 1 + or cx, ax ; merge cylinder into sector + mov al, dl ; al has # of sectors left + + ; Calculate how many sectors can be transfered in this read + ; due to dma boundary conditions. + push dx + + mov si, di ; temp register save + ; this computes remaining bytes because of modulo 65536 + ; nature of dma boundary condition + mov ax, bx ; get offset pointer + neg ax ; and convert to bytes + jz ax_min_1 ; started at seg:0, skip ahead + + xor dx, dx ; convert to sectors + div word bytesPerSector + + cmp ax, di ; check remainder vs. asked + jb ax_min_1 ; less, skip ahead + mov si, ax ; transfer only what we can + +ax_min_1: pop dx + + ; Check that request sectors do not exceed track boundary + mov si, sectPerTrack + inc si + mov ax, cx ; get the sector/cyl byte + and ax, 03fh ; and mask out sector + sub si, ax ; si has how many we can read + mov ax, di + cmp si, di ; see if asked <= available + jge ax_min_2 + mov ax, si ; get what can be xfered + +ax_min_2: mov si, RETRYCOUNT + mov ah, 2 + mov dl, drive + +retry: push ax + int 13h + pop ax + jnc read_ok + push ax + xor ax, ax ; reset the drive + int 13h + pop ax + dec si + jnz retry + stc + pop ax + pop dx + pop si + pop bp + ret + +read_next_jmp: jmp short read_next +read_ok: xor ah, ah + mov si, ax ; AX = SI = number of sectors read + mul word bytesPerSector ; AX = number of bytes read + add bx, ax ; add number of bytes read to BX + jnc no_incr_es ; if overflow... + + mov ax, es + add ah, 10h ; ...add 1000h to ES + mov es, ax + +no_incr_es: pop ax + pop dx ; DX:AX = last sector number + + add ax, si + adc dx, 0 ; DX:AX = next sector to read + sub di, si ; if there is anything left to read, + jg read_next_jmp ; continue + + clc + pop si + pop bp + ret + +; +; Print string (DI = start) +; +printmsg: + push ax + push bx + push di + mov ah,0eh + mov bh,0 + mov bl,07h +.l1 + mov al,[di] + cmp al,0 + je .l2 + inc di + int 10h + jmp .l1 +.l2 + pop di + pop bx + pop ax + ret + + + +loadmsg db "Starting ReactOS...",0xd,0xa,0 +boot_dir_name db 'BOOT' +errormsg db "Files missing on boot disk",0 +errormsg1 db "Disk read error",0 +msg1 db "Found boot directory",0xd,0xa,0 +msg2 db 'FAT12',0 +msg3 db 'FAT16',0 diff --git a/reactos/loaders/boot/osldr.bin b/reactos/loaders/boot/osldr.bin new file mode 100644 index 0000000000000000000000000000000000000000..facab893828fc7558b1d2a0738c5bb9c10789d86 GIT binary patch literal 401 zcmeAOQ`y0w(060MCgTex#vKd-eFwV3es#P3*v;V3T_oXRlh8Qz?;z*FjtfDZ|2l7czfr;sQowEbqll^VSX6hJgj?qcReJ`_W1T-N|J5>e ze%Qy#u!X5BOeNr~a73|SfZ+ik?N|EoXGBz7?BUn544!lz`<}+lc(|Co=Rm^|pl2hZ z7(X;#VqnnxUjN_+P)$H^_!hqH44c`zSZx?e*xb(w0G$^f9dS6gB(bO@GcR2sC^a#; z#6MV1Pmh<2!O7o0#4R%?wOAoHv$z-}ou8+Wl%HRskdj%P&ENtg6pB(4QxsB*it>vX d-11BFQeg5$smUezMU_BP+#Ev;jliTC0{}mvvJL9Dop|>~d&0n5YqrQ42(4xDZ3QK=gnlb&v~~T0C)RO*pJ2 z4e?}5j5NJ?(KM#YhlZ~vaB+jigAE!WrK!6@08tZDr0Z;3VlVs!^rijHn|br*z4^VF zY}!%%ZnJa`-vSMs$l_!cr?NPm#TgSv;wX;Cac*5ee@rSTcmF!<7zSxzCrxqK7{LYh z-%wF7uPm6?n2xn<#t%N1&0FSkNrP;`0-m^0XuhnzPXRVft z@~>>FOn6L{JC(F{2D&eiuUGWBz$>)sKa5r-tuGiDq65O0nSP(2fHqa0(RghY^j(8) zX;>Rs)D;0Gt;(KMc#V%n_rC5D0XjSR12uX5sb3j+uzc)v5j z8{(W+7EYQQp>U(;u>%85HB7rn!6}M0$zw~vL7VmfyfnwTwKC+aHB20wEx-liPNO`@>tBuhk~2`A;8nTq9@EbmF>FWW56)?JGg@#B{of2Tt*%&m zM`x6OSm{fH*Q&~``cI?#Mpw*yICEU{cm_O@d(hL@-zyE=z3u7o_6_ty+dz+-EElD$ z(_t_=I(pdBQMc;=^h>&*^Mk))#M3EZr<9&!(b~Yar(di@**K_n6yMBa_#`8_fZ@|@ z-(!H|uK_3?tsbJh+)`O z;D_KWHN_peJUqpY+yuXqHY=I7;wUmuWT41Ej)C<1oZQVz(#(%3JXy-gM@zZ&A{H4a JGH@gr_y@r+cJ=@O literal 0 HcmV?d00001 diff --git a/reactos/loaders/dos/makefile b/reactos/loaders/dos/makefile new file mode 100644 index 00000000000..01bd51ca46e --- /dev/null +++ b/reactos/loaders/dos/makefile @@ -0,0 +1,8 @@ +# +# +# + +all: loadros.com + +loadros.com: loadros.asm + nasm -fbin loadros.asm -o loadros.com diff --git a/reactos/makefile.dos b/reactos/makefile.dos new file mode 100644 index 00000000000..c6b7de0f70a --- /dev/null +++ b/reactos/makefile.dos @@ -0,0 +1,62 @@ +# +# Global makefile +# + +# +# Select your host +# +#HOST = djgpp-linux +#HOST = mingw32-linux +HOST = djgpp-msdos +#HOST = mingw32-windows + +include rules.mak + +# +# Required to run the system +# +COMPONENTS = kernel lib + +# +# Select the loader(s) you want to build +# +LOADERS = dos + +# +# Select the modules you want +# +MODULES = parallel keyboard + +all: $(COMPONENTS) $(LOADERS) $(MODULES) + +# +# Device driver rules +# + +parallel: dummy + make -C modules/parallel + +keyboard: dummy + make -C modules/keyboard + +mouse: dummy + make -C modules/mouse + +# +# Kernel loaders +# + +dos: dummy + make -C loaders/dos + +# +# Required system components +# + +kernel: dummy + make -C kernel + +lib: dummy + make -C lib + +dummy: diff --git a/reactos/makefile_rex b/reactos/makefile_rex new file mode 100644 index 00000000000..cf1378c4f40 --- /dev/null +++ b/reactos/makefile_rex @@ -0,0 +1,62 @@ +# +# Global makefile +# + +# +# Select your host +# +HOST = djgpp-linux +#HOST = mingw32-linux +#HOST = djgpp-msdos +#HOST = mingw32-windows + +include rules.mak + +# +# Required to run the system +# +COMPONENTS = kernel lib + +# +# Select the loader(s) you want to build +# +LOADERS = dos + +# +# Select the modules you want +# +MODULES = parallel keyboard + +all: $(COMPONENTS) $(LOADERS) $(MODULES) + +# +# Device driver rules +# + +parallel: dummy + make -C modules/parallel + +keyboard: dummy + make -C modules/keyboard + +mouse: dummy + make -C modules/mouse + +# +# Kernel loaders +# + +dos: dummy + make -C loaders/dos + +# +# Required system components +# + +kernel: dummy + make -C kernel + +lib: dummy + make -C lib + +dummy: diff --git a/reactos/readme_rex b/reactos/readme_rex new file mode 100644 index 00000000000..bb5f23434cb --- /dev/null +++ b/reactos/readme_rex @@ -0,0 +1,20 @@ +DIRECTORIES + +system : compiled versions of the various system components and + libraries +mkernel : microkernel source +mkernel/hal : hardware abstraction layer source +mkernel/mm : memory managment subsystem source +mkernel/iomgr : IO manager subsystem source +include : win32 headers +include/internal : kernel private header files +include/ntdll : system library private header files +include/kernel32 : system library private header files +include/user32 : user interface private header files +include/gdi32 : graphics interface private header files +include/ddk : header files for modules +lib/ntdll : NT dll source +lib/kernel32 : kernel32 source +doc : documentation +loaders/dos : DOS based loader +loaders/boot : boot loader diff --git a/reactos/rules.mak b/reactos/rules.mak new file mode 100644 index 00000000000..5164443bb1b --- /dev/null +++ b/reactos/rules.mak @@ -0,0 +1,64 @@ +# +# Important +# +.EXPORT_ALL_VARIABLES: + + +# +# Choose various options +# +ifeq ($(HOST),djgpp-linux) +NASM_FORMAT = coff +PREFIX = dos- +KERNEL_BFD_TARGET = coff-i386 +EXE_POSTFIX = +CP = cp +endif + +ifeq ($(HOST),mingw32-linux) +NASM_FORMAT = win32 +PREFIX = i386-mingw32 +KERNEL_BFD_TARGET = pe-i386 +EXE_POSTFIX +CP = cp +endif + +ifeq ($(HOST),djgpp-msdos) +NASM_FORMAT = coff +PREFIX = +KERNEL_BFD_TARGET = coff-go32 +EXE_POSTFIX = .exe +CP = copy +endif + +ifeq ($(HOST),mingw32-windows) +NASM_FORMAT = win32 +PREFIX = +KERNEL_BFD_TARGET = pe-i386 +EXE_POSTFIX = .exe +CP = copy +endif + +# +# Create variables for all the compiler tools +# +CC = $(PREFIX)gcc +NATIVE_CC = gcc +CFLAGS = -O2 -I../../include -I../include -fno-builtin -DCHECKED_BUILD $(DEFINES) -Wall -Wstrict-prototypes +CXXFLAGS = $(CFLAGS) +NASM = nasm +NFLAGS = -i../include/ -f$(NASM_FORMAT) +LD = $(PREFIX)ld +NM = $(PREFIX)nm +OBJCOPY = $(PREFIX)objcopy +STRIP = $(PREFIX)strip +AS = $(PREFIX)gcc -c -x assembler-with-cpp +CPP = $(PREFIX)cpp + +%.o: %.cc + $(CC) $(CFLAGS) -c $< -o $@ +%.o: %.asm + $(NASM) $(NFLAGS) $< -o $@ + + +RULES_MAK_INCLUDED = 1 -- 2.17.1