bootstrap
authorshort <>
Thu, 31 Oct 2002 17:37:52 +0000 (17:37 +0000)
committershort <>
Thu, 31 Oct 2002 17:37:52 +0000 (17:37 +0000)
118 files changed:
.vimrc [new file with mode: 0644]
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
INSTALL [new file with mode: 0644]
Makefile-head.am [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
autogen.pl [new file with mode: 0755]
captive.spec.in [new file with mode: 0644]
configure.in [new file with mode: 0644]
doc/FAQ [new file with mode: 0644]
doc/Makefile.am [new file with mode: 0644]
doc/apiref/Makefile.am [new file with mode: 0644]
doc/apiref/captive.sgml [new file with mode: 0644]
include_test.c [new file with mode: 0644]
po/cs.po [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/client/Makefile.am [new file with mode: 0644]
src/client/cmdline/Makefile.am [new file with mode: 0644]
src/client/cmdline/main.c [new file with mode: 0644]
src/libcaptive/Makefile-libcaptive.am [new file with mode: 0644]
src/libcaptive/Makefile.am [new file with mode: 0644]
src/libcaptive/client/Makefile.am [new file with mode: 0644]
src/libcaptive/client/init.c [new file with mode: 0644]
src/libcaptive/halcaptive/Makefile.am [new file with mode: 0644]
src/libcaptive/halcaptive/intrlck.c [new file with mode: 0644]
src/libcaptive/halcaptive/irql.c [new file with mode: 0644]
src/libcaptive/halcaptive/spinlock.c [new file with mode: 0644]
src/libcaptive/include/Makefile.am [new file with mode: 0644]
src/libcaptive/include/captive/Makefile.am [new file with mode: 0644]
src/libcaptive/include/captive/client.h [new file with mode: 0644]
src/libcaptive/include/captive/ldr.h [new file with mode: 0644]
src/libcaptive/include/captive/macros.h [new file with mode: 0644]
src/libcaptive/include/captive/mm.h [new file with mode: 0644]
src/libcaptive/include/captive/ps_reactos.h [new file with mode: 0644]
src/libcaptive/include/captive/rtl-file.h [new file with mode: 0644]
src/libcaptive/include/captive/unicode.h [new file with mode: 0644]
src/libcaptive/include/captive/unicode_reactos.h [new file with mode: 0644]
src/libcaptive/include/reactos/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/base.h [new file with mode: 0644]
src/libcaptive/include/reactos/compat.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/cmtypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/defines.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/exfuncs.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/extypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/i386/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/i386/tss.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/iofuncs.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/iotypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/kefuncs.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/ketypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/mmtypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/ntddk.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/obtypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/pnptypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/potypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/pstypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/rtl.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/rtltypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/types.h [new file with mode: 0644]
src/libcaptive/include/reactos/ddk/zwtypes.h [new file with mode: 0644]
src/libcaptive/include/reactos/defines.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/internal/debug.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/i386/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/internal/i386/ps.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/kd.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/ldr.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/mm.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/ntoskrnl.h [new file with mode: 0644]
src/libcaptive/include/reactos/internal/ps.h [new file with mode: 0644]
src/libcaptive/include/reactos/napi/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/napi/teb.h [new file with mode: 0644]
src/libcaptive/include/reactos/napi/types.h [new file with mode: 0644]
src/libcaptive/include/reactos/ntos/Makefile.am [new file with mode: 0644]
src/libcaptive/include/reactos/ntos/security.h [new file with mode: 0644]
src/libcaptive/include/reactos/ntos/time.h [new file with mode: 0644]
src/libcaptive/include/reactos/ntos/types.h [new file with mode: 0644]
src/libcaptive/include/reactos/structs.h [new file with mode: 0644]
src/libcaptive/include/reactos/unicode.h [new file with mode: 0644]
src/libcaptive/kd/Makefile.am [new file with mode: 0644]
src/libcaptive/kd/kdebug.c [new file with mode: 0644]
src/libcaptive/ke/Makefile.am [new file with mode: 0644]
src/libcaptive/ke/bug.c [new file with mode: 0644]
src/libcaptive/ke/captivesym.pl [new file with mode: 0755]
src/libcaptive/ke/event.c [new file with mode: 0644]
src/libcaptive/ke/exports.captivesym [new file with mode: 0644]
src/libcaptive/ke/kthread.c [new file with mode: 0644]
src/libcaptive/ke/spinlock.c [new file with mode: 0644]
src/libcaptive/ldr/Makefile.am [new file with mode: 0644]
src/libcaptive/ldr/loader.c [new file with mode: 0644]
src/libcaptive/mm/Makefile.am [new file with mode: 0644]
src/libcaptive/mm/page.c [new file with mode: 0644]
src/libcaptive/mm/pool.c [new file with mode: 0644]
src/libcaptive/mm/section.c [new file with mode: 0644]
src/libcaptive/ps/Makefile.am [new file with mode: 0644]
src/libcaptive/ps/ps_reactos.c [new file with mode: 0644]
src/libcaptive/reactos/Makefile-reactos.am [new file with mode: 0644]
src/libcaptive/reactos/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/include/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/include/roscfg.h [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/dbg/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/ex/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/io/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/ke/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/ldr/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/ob/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/ps/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/rtl/Makefile.am [new file with mode: 0644]
src/libcaptive/reactos/ntoskrnl/se/Makefile.am [new file with mode: 0644]
src/libcaptive/rtl/Makefile.am [new file with mode: 0644]
src/libcaptive/rtl/file.c [new file with mode: 0644]
src/libcaptive/rtl/unicode.c [new file with mode: 0644]
src/libcaptive/rtl/unicode_reactos.c [new file with mode: 0644]

diff --git a/.vimrc b/.vimrc
new file mode 100644 (file)
index 0000000..a847f58
--- /dev/null
+++ b/.vimrc
@@ -0,0 +1,2 @@
+set ts=2
+set sw=2
diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..d9c88f4
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,12 @@
+Author of "captive" - libcaptive and libcaptive clients:
+Jan Kratochvil <project-captive@jankratochvil.net>
+               http://www.jankratochvil.net/
+
+captive is based on ReactOS - ReactOS authors are listed in reactos/CREDITS
+file if not specified by ReactOS otherwise.
+
+GPL patches for GPL-ed ReactOS compatibility with the GPL-ed project "captive"
+have authorship of Jan Kratochvil. Some of those patches were alrady integrated
+into ReactOS CVS repository ":pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS", the
+others remain maintained in my "priv/reactos" repository branch "captive"
+against branchpoint "bp_captive".
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..5b6e7c6
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..a4b3414
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,229 @@
+Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Makefile-head.am b/Makefile-head.am
new file mode 100644 (file)
index 0000000..8945bf3
--- /dev/null
@@ -0,0 +1,130 @@
+# $Id$
+# automake source include to the begin of all Makefile.am's
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# defined WANT_GTK_DOC if you plan to include macros/Makefile-gtk-doc.am
+
+
+# Set all needed variables to their empty values to prevent "variable `...' not defined"
+# Any further settings should be done exclusively by += operator
+EXTRA_DIST=
+BUILT_SOURCES=
+CLEANFILES=
+MAINTAINERCLEANFILES=
+# default DEFAULT_INCLUDES=' -I. -I$(srcdir)'.(dirnames of 'CONFIG_HEADER') ,
+# we neeed such $(DEFAULT_INCLUDES) but we need to prefer our $(INCLUDES)
+# thus we postpone them later by moving them to $(AM_CPPFLAGS).
+# It prevent us the inclusion of own wrappers
+# when we want direct include during (test) compilations
+# in $(top_srcdir)/src/libcaptive/include/reactos/
+# as -I. is always as one of the first '-I's in $(INCLUDES).
+# It will be utilized in $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am .
+# It would be also possible to use some #include_next's but it is pretty
+# hassle to guess the right ordering in such case.
+# FIXME: $(addprefix ) and $(dir /) are GNU make dependent!
+AM_CPPFLAGS=-I. -I$(srcdir) $(addprefix -I,$(dir $(CONFIG_HEADER)))
+# 'DEFAULT_INCLUDES=' will drop its contents.
+# 'DEFAULT_INCLUDES:=' will cause: automake-X.Y/am/compile.am: DEFAULT_INCLUDES was set with `:=' and is now set with `='
+# %DEFAULT_INCLUDES% is permitted only in automake system files.
+# No possibility to keep its state therefore we generate
+# (I hope) the same contents in 'AM_CPPFLAGS=...' line above
+DEFAULT_INCLUDES=
+INCLUDES=
+lib_LTLIBRARIES=
+pkginclude_HEADERS=
+sbin_PROGRAMS=
+noinst_HEADERS=
+# Prevent: noinst_DATA was already defined in condition TRUE, which implies condition MAINTAINER_MODE_TRUE
+# You should only unconditionally do: noinst_DATA+=...
+noinst_DATA=$(noinst_DATA__include_test_all_stamp)
+
+# Custom variables
+captive_library=$(top_builddir)/src/libcaptive/libcaptive.la
+localedir=$(datadir)/locale
+
+# Standard settings
+INCLUDES+=-DLOCALEDIR=\"$(localedir)\"
+INCLUDES+=-I$(top_srcdir)/src/libcaptive/include
+INCLUDES+=-I$(top_srcdir)/intl
+
+
+# This target is used during ./autogen.pl POTFILES.in generation
+distfiles: $(DISTFILES)
+       @if test -n "$(DISTFILES_PRINT)";then \
+               echo -n ":DISTFILES:"; \
+               for distfile in . $(DISTFILES);do \
+                       if test -n 1 \
+                                       -a "$$distfile" '!=' . \
+                                       -a "$$distfile" '!=' Makefile.am \
+                                       -a "$$distfile" '!=' Makefile.in \
+                                       ;then \
+                               if echo " $(BUILT_SOURCES) "|grep -q " $$distfile ";then :;else \
+                                       echo -n " $(subdir)/$$distfile"; \
+                                       fi; \
+                               fi; \
+                       done; \
+               echo; \
+               fi;
+       @for subdir in . $(SUBDIRS);do \
+               if test "$$subdir" = . -o "$$subdir" = intl -o "$$subdir" = po -o "$$subdir" = m4;then :;else \
+                       (cd "$$subdir" && $(MAKE) $(AM_MAKEFLAGS) distfiles) || exit 1; \
+                       fi; \
+               done
+
+# check for macros/Makefile-gtk-doc.am inclusion
+# FIXME: GNU make dependent!
+# use <space><keyword> to bypass automake but apply to GNU make
+ ifdef WANT_GTK_DOC
+dist-hook-local:
+ else
+dist-hook:
+ endif
+       for i in _built_sources_pad $(BUILT_SOURCES);do \
+               $(RM) $(distdir)/$$i; \
+       done
+
+
+# Test compilability of all local separate include files
+CLEANFILES+=.include_test.o .include_test_all.stamp
+if MAINTAINER_MODE
+noinst_DATA__include_test_all_stamp=.include_test_all.stamp
+else
+noinst_DATA__include_test_all_stamp=
+endif
+
+# FIXME: Use separate .stamp file for each of $(noinst_HEADERS)
+# we would need some pattern substituion which means GNU make dependency
+.include_test_all.stamp: $(HEADERS) $(top_srcdir)/include_test.c
+       @set -e;for header in . $(HEADERS);do \
+               if test "$$header" '!=' .;then \
+                       $(COMPILE) -include "$$header" -o .include_test.o -c $(top_srcdir)/include_test.c; \
+                       fi; \
+               done
+       @rm -f include_test.o
+       @touch $@
+
+
+# Unfortunately we need to use this never-invocated target
+# to get $(COMPILE) variable definition.
+MAINTAINERCLEANFILES+=.include_test_false.c
+BUILT_SOURCES+=.include_test_false.c
+if IS_FALSE
+noinst_PROGRAMS=.include_test_false
+endif
+.include_test_false.c:
+       @touch $@
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..3819d90
--- /dev/null
@@ -0,0 +1,47 @@
+# $Id$
+# automake source for the toplevel Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+AUTOMAKE_OPTIONS=gnu
+ACLOCAL_AMFLAGS=-I m4
+SUBDIRS=intl m4 macros src doc po
+## to automatically rebuild aclocal.m4 if any of the macros in
+## `macros/' change
+@MAINT@include macros/macros.dep
+@MAINT@macros/macros.dep: macros/Makefile.am
+@MAINT@        cd macros && $(MAKE) macros.dep
+
+EXTRA_DIST+= \
+               INSTALL \
+               ABOUT-NLS \
+               config.rpath \
+               mkinstalldirs \
+               captive.spec.in \
+               Makefile-head.am \
+               include_test.c \
+               autogen.pl \
+               .vimrc \
+               ChangeLog
+
+MAINTAINERCLEANFILES+= \
+               ChangeLog
+
+# FIXME: replace by cvs2cl.pl !
+ChangeLog:
+       rcs2log >$@
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..adde8d4
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,5 @@
+NEWS for captive-0.1
+--------------------
+
+* Project build framework done
+* W32 binary module loading success
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..0918684
--- /dev/null
+++ b/README
@@ -0,0 +1,30 @@
+Operation Captive, codename "captive"
+-------------------------------------
+
+Provides opensource interface to W32 filesystems. Some proprietary filesystem
+datastructures can be realiably accessed by this project.
+
+
+Bleeding Edge
+-------------
+
+cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs login
+               Just hit ENTER (empty password)
+cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs -z3 checkout -d captive priv/captive
+cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs -z3 checkout -d captive/reactos -r captive -kk priv/reactos
+cd captive
+./autogen.pl
+make
+./src/client/cmdline/captivecmdline path/to/some/driver.sys
+
+
+Installation
+------------
+
+See the file 'INSTALL'.
+
+
+Copyright
+---------
+
+See the file 'COPYING' and 'AUTHORS'.
diff --git a/autogen.pl b/autogen.pl
new file mode 100755 (executable)
index 0000000..bc4ee79
--- /dev/null
@@ -0,0 +1,44 @@
+#! /usr/bin/perl
+# 
+# $Id$
+# Run to generate the initial Makefiles etc. after CVS checkout.
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+use vars qw($VERSION);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+use strict;
+use warnings;
+
+use lib "./macros/";
+use AutoGen;
+
+
+AutoGen->run(
+               "name"=>"captive",
+               "COPYRIGHT_HOLDER"=>'Jan Kratochvil <project-captive@jankratochvil.net>',
+               "ARGV"=>\@ARGV,
+               "gtk-doc-dir"=>"./doc/apiref/",
+               "clean"=>[qw(
+                               .include_test_false.c
+                               .include_test_all.stamp
+                               ./doc/*-pod.*
+                               ./doc/apiref/captive.types
+                               ./src/client/cmdline/captivecmdline
+                               ./src/libcaptive/ke/exports.c
+                               ./src/libcaptive/reactos/*/*.c
+                               )],
+               );
diff --git a/captive.spec.in b/captive.spec.in
new file mode 100644 (file)
index 0000000..c8e2adc
--- /dev/null
@@ -0,0 +1,86 @@
+# $Id$
+# rpm package description file for building
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Summary: Microsoft Windows platform filesystem access.
+Name: @PACKAGE@
+%define release 0
+Version: @VERSION@
+Release: %{release}
+Group: Applications/System
+Source: http://short.vellum.cz/sw/@PACKAGE@-@VERSION@.tar.gz
+Copyright: GPL
+BuildRoot: /var/tmp/@PACKAGE@-@VERSION@-%{release}-root
+
+%description
+Microsoft Windows platform filesystem access.
+TODO
+
+%package devel
+Summary: Microsoft Windows platform filesystem access development support.
+Group: Development/System
+Requires: surprise = %{PACKAGE_VERSION}
+
+%description devel
+Development package containing libraries for static linking together with
+header files needed for any linking.
+
+Microsoft Windows platform filesystem access.
+TODO
+
+%prep
+%setup
+
+%build
+# Never disable debug for captive, see FAQ
+#      "How to check valid input arguments? Invalid processing state assumptions?"
+%configure \
+               --enable-shared --enable-static
+make
+
+%install
+make DESTDIR=$RPM_BUILD_ROOT install-strip
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%files
+%defattr(-,root,root)
+%doc INSTALL
+/sbin/@PACKAGE@cmdline
+/usr/bin/@PACKAGE@server
+/usr/share/@PACKAGE@
+/usr/share/locale/*/LC_MESSAGES/@PACKAGE@.mo
+#for version-info use: /lib/*.so.*
+###for --disable-shared/(--enable-static-link disable):
+/usr/lib/*-*.so
+
+%files devel
+%defattr(-,root,root)
+%doc ChangeLog
+/usr/include/@PACKAGE@
+/usr/share/aclocal/*
+/usr/lib/*.a
+/usr/lib/*.la
+###for --disable-shared/(--enable-static-link disable):
+/usr/lib/*[a-z].so
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..46f2756
--- /dev/null
@@ -0,0 +1,152 @@
+# $Id$
+# Source file to generate "./configure" to prepare package for compilation
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+AC_INIT(src/libcaptive/Makefile-libcaptive.am)
+AM_INIT_AUTOMAKE(captive,0.1cvs)
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+#AM_ACLOCAL_INCLUDE(macros)
+dnl Prevent "AC_TRY_COMPILE was called before AC_ISC_POSIX":
+AC_ISC_POSIX
+AC_PROG_CC
+AM_ENABLE_STATIC
+AM_DISABLE_SHARED
+AM_PROG_LIBTOOL
+
+dnl gettext localization.
+dnl FIXME: should we use AM_GLIB_GNU_GETTEXT of glib-gettext.m4 ?
+ALL_LINGUAS="cs"
+AM_GNU_GETTEXT
+
+AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([Captive requires glib-2.0 library.])])
+
+GTK_DOC_CHECK
+
+dnl discard -g -O2 settings
+CFLAGS=
+
+dnl Define MAINTAINER_MODE in config.h.
+if test "$USE_MAINTAINER_MODE" = "yes";then
+       AC_DEFINE(MAINTAINER_MODE,,[Turn even some software behaviour according to MAINTAINER_MODE.])
+       CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wsign-compare"  ## FIXME: fix all sources: -Wsign-compare
+       fi
+dnl Some Makefiles use additional tests etc.
+AM_CONDITIONAL(MAINTAINER_MODE,[test "$USE_MAINTAINER_MODE" = "yes"])
+
+dnl Permit 'if IS_FALSE' for Makefile.am-s; symbol 'FALSE' forbidden by automake
+AM_CONDITIONAL(IS_FALSE,false)
+
+AC_ARG_ENABLE(debug,[  --enable-debug=[no/yes] turn on debugging messages [default=yes]],,enable_debug=yes)
+
+if test "$enable_debug" != "no";then
+       CFLAGS="$CFLAGS -ggdb3"
+       fi
+
+dnl Separate 'acconfig.h' is no longer recommended by autoconf
+AH_TOP([
+#ifndef _CAPTIVE_CONFIG_H
+#define _CAPTIVE_CONFIG_H 1
+])
+AH_BOTTOM([
+#endif /* !_CAPTIVE_CONFIG_H */
+])
+
+dnl ENABLE_NLS_HOOK name to guarantee inclusion AFTER '#undef ENABLE_NLS'
+AH_VERBATIM([ENABLE_NLS_HOOK],[
+#ifdef ENABLE_NLS
+/* <libintl.h> is taken from "$(top_srcdir)/intl" if system doesn't provide intl */
+#      include <libintl.h>
+#ifdef LIBCAPTIVE
+#      define _(String) dgettext (PACKAGE,String)
+#else
+#      define _(String) gettext (String)
+#endif /* LIBSURPRISE */
+#      ifdef gettext_noop
+#              define N_(String) gettext_noop (String)
+#      else
+#              define N_(String) (String)
+#      endif
+#else /* !ENABLE_NLS */
+/* Stubs that do something close enough.  */
+#      define textdomain(String) (String)
+#      define gettext(String) (String)
+#      define dgettext(Domain,Message) (Message)
+#      define dcgettext(Domain,Message,Type) (Message)
+#      define bindtextdomain(Domain,Directory) (Domain)
+#      define _(String) (String)
+#      define N_(String) (String)
+#endif /* !ENABLE_NLS */
+])
+
+dnl Force glib for the whole package
+CFLAGS="$CFLAGS $GLIB_CFLAGS"
+AC_SUBST(CFLAGS)
+LIBS="$LIBS $GLIB_LIBS"
+AC_SUBST(LIBS)
+
+dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
+AC_OUTPUT([
+captive.spec
+Makefile
+./macros/Makefile
+./po/Makefile.in
+./intl/Makefile
+./m4/Makefile
+./src/Makefile
+./src/libcaptive/Makefile
+./src/libcaptive/include/Makefile
+./src/libcaptive/include/captive/Makefile
+./src/libcaptive/include/reactos/Makefile
+./src/libcaptive/include/reactos/ddk/Makefile
+./src/libcaptive/include/reactos/ddk/i386/Makefile
+./src/libcaptive/include/reactos/internal/Makefile
+./src/libcaptive/include/reactos/internal/i386/Makefile
+./src/libcaptive/include/reactos/napi/Makefile
+./src/libcaptive/include/reactos/ntos/Makefile
+./src/libcaptive/reactos/Makefile
+./src/libcaptive/reactos/include/Makefile
+./src/libcaptive/reactos/ntoskrnl/Makefile
+./src/libcaptive/reactos/ntoskrnl/dbg/Makefile
+./src/libcaptive/reactos/ntoskrnl/ex/Makefile
+./src/libcaptive/reactos/ntoskrnl/io/Makefile
+./src/libcaptive/reactos/ntoskrnl/ke/Makefile
+./src/libcaptive/reactos/ntoskrnl/ldr/Makefile
+./src/libcaptive/reactos/ntoskrnl/ob/Makefile
+./src/libcaptive/reactos/ntoskrnl/ps/Makefile
+./src/libcaptive/reactos/ntoskrnl/rtl/Makefile
+./src/libcaptive/reactos/ntoskrnl/se/Makefile
+./src/libcaptive/halcaptive/Makefile
+./src/libcaptive/kd/Makefile
+./src/libcaptive/ke/Makefile
+./src/libcaptive/ldr/Makefile
+./src/libcaptive/mm/Makefile
+./src/libcaptive/ps/Makefile
+./src/libcaptive/rtl/Makefile
+./src/libcaptive/client/Makefile
+./src/client/Makefile
+./src/client/cmdline/Makefile
+./doc/Makefile
+./doc/apiref/Makefile
+])
+
+dnl FIXME: Why is "po/POTFILES" being substituted?
+make -C src distfiles DISTFILES_PRINT=1 \
+               |sed -n 's/^:DISTFILES: *\(.*\)$/\1/p'|tr ' ' '\n'|grep . >po/POTFILES.in
+cat po/POTFILES.in >po/POTFILES
+
+echo done.
diff --git a/doc/FAQ b/doc/FAQ
new file mode 100644 (file)
index 0000000..67f1302
--- /dev/null
+++ b/doc/FAQ
@@ -0,0 +1,182 @@
+Q: Latest CVS?
+A: Access to the latest CVS development tree:
+       cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs login
+                       Just hit ENTER (empty password)
+       cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs -z3 checkout -d captive priv/captive
+       cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs -z3 checkout -d captive/reactos -r captive -kk priv/reactos
+
+   The final mapping of directories to CVS repository after the step above:
+       captive         -> priv/captive
+       captive/macros  -> macros
+       captive/reactos -> priv/reactos
+
+   Current diff of captive changes against reactos (it may have backlog):
+       cvs -d :pserver:pserver@cvs.jankratochvil.net:/cvs -z3 rdiff -u -R -r bp_captive -r captive priv/reactos
+
+   Official reactos website:
+       http://www.reactos.com/
+
+   Access to the original reactos source tree (mirrored to my "priv/reactos"):
+       cvs -d :pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS login
+                       Type the password "cvsanon" (without quotes)
+       cvs -d :pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS -z3 checkout reactos
+
+   You may also like ViewCVS web access to the repository:
+       http://cvs.jankratochvil.net/viewcvs/priv/captive/
+       http://cvs.jankratochvil.net/viewcvs/priv/reactos/?only_with_tag=captive
+       http://cvs.jankratochvil.net/viewcvs/macros/
+
+   Finally you can compile the package from the "captive" directory:
+       ./autogen.pl
+       make
+
+   The package gets preconfigured with --enable-maintainer-mode option
+   automatically by './autogen.pl'. You can later just update the "captive"
+   subdirectory if it is your currentdir:
+       cvs update
+       ./autogen.pl
+       make
+
+   Although './autogen.pl' should not be needed do not bugreport if it wan't
+   rerun as some dependencies may not be respected by the package.
+
+Q: Why it is based on static structures, no multithreading possibility?
+A: reactos has also static design therefore there would be no possibility
+   to use the whole libcaptive in multithreaded way.
+   Another question is whether to support multithreading in the scope of one
+   reactos machine - this would be possible but it is not yet implemented
+   in libcaptive. All such points should be marked by "TODO:thread"
+
+Q: Prefer during libcaptive coding the GNU stylee or reactos (=W32) coding style?
+A: Hard decision as captive connects these two worls together.
+   It was decided to prefer coding in GNU style in the Gnome specific way.
+
+   Full function replaces apparently must use the same calling conventions.
+   Coding of the full-replace should be done in GNU style if coded from scratch
+   although it is permitted to leave the original function code if only minor
+   modifications were performed (decide whether it is not better to patch
+   reactos source files instead to keep the code unified).
+   Any other code besides function replace should use GNU style calling conventions.
+
+   All the normal (GNU) world uses 32-bit wchar_t but reactos (=W32) uses
+   16-bit (unsigned short) wchar_t. This would need GCC -fshort-wchar option.
+   It has effect on L"literal-string" or L'c' character-constants.
+   Unfortunately they expect libc-named functions such as wcsrchr(3) to also
+   follow this broken 16-bit way. FIXME: reactos-compat-includes
+
+Q: How is the libcaptive project trustworthy?
+A: We have to run foreign native closed-source W32 code which is certainly NOT
+   trust trustworthy in any way. We could close it to some separate address
+   space and give it some safe gateways to invoce our code for the public world
+   (read "UNIX processes") interaction. It would be too much complicated
+   without any gain thus we choose to open our libcaptive-using process to any
+   attacks by W32 but the whole libcaptive process MUST be closed by a sandbox.
+   Of course all the communication with libcaptive must be taken with care by
+   taint-aware code.
+
+Q: How to check valid input arguments? Invalid processing state assumptions?
+A: libcaptive uses uses various Gnome macros out of <glib/gmessages.h>.
+   The common final still should run safely when all theses checks are disabled
+   as the bug-free code should never invoce them. This is the same for
+   libcaptive with a little excuse for foreign native closed-source W32 code
+   beign run which can <a href="FIXME:How is the libcaptive project trustworthy?"
+   >never be trusted</a>. As we glued all the libcaptive code
+   together with the W32 code we no longer can protect all the borders to the
+   enemy land inside the one tainted process. Therefore even fully trusted
+   libcaptive code can never safely run with <glib/gmessages.h> checks
+   disabled. YMMV if your trust W32 code. Be aware that W32 code has to also
+   handle correctly all the corrupted disk data structure to comply with such
+   trusted relationship. I really dunno if it complies but I don't care as
+   I don't trust anyway.
+
+Q: Is it safe to captive_cleanup() the process and captive_init() it again?
+A: It should be possible to fully cleanup the state of libcaptive even after
+   <a href="FIXME:How to check valid input arguments? Invalid processing state assumptions?"
+   ><glib/gmessages.h> failures</a>. It is currently not implemented and it
+   may get dropped at all in the future as libcaptive process MUST be sandboxed
+   anyway. You are recommended (currently required) to terminate the sandboxed
+   process and initialize the new one instead of captive_cleanup().
+
+Q: I am missing symbol although it is already implemented by reactos.
+A: First look at $(top_srcdir)/src/libcaptive/ke/exports.captivesym
+   where it may be enough to add such symbol to the list of exported symbols.
+   If it is not compiled at all find such symbol definition in reactos.
+   If such file or directory isn't listed in captive reactos compilation part
+   you may need to add it to $(top_srcdir)/src/libcaptive/reactos/ according
+   to the template files around - you will really only add the file to
+   Makefile.am, no real file gets copied there (just symlinked automatically).
+
+   Usuaully you will also like to edit the appended file and simplify it by lines
+       #ifndef LIBCAPTIVE
+   and
+       #endif /* LIBCAPTIVE */
+   as too much (useless for you now) code would have dependencies on other
+   missing code and you would get into never ending race of solving missing ones.
+   If the feature being implemented is some feature not needed or not suitable
+   for the emulation by libcaptive you should implement the emulation
+   below $(top_srcdir)/src/libcaptive/ directly. The filename should conform
+   to the reactos directory tree standard if applicable.
+
+   Always rather implement emply emulation function than patching the referring
+   code to prevent code development conflicts with the mainstream reactos.
+
+Q: Why not Wine instead of ReactOS?
+A: Although <a href="http://www.winehq.com/">Wine</a> has better development
+   activity than <a href="http://www.reactos.com/">ReactOS</a> the decision
+   is strictly technical. We need to run W32 file system driver which always
+   lives in kernel-land in W32 system design.
+       guest-OS host-OS       implements  core library correspondence
+       Wine     GNU/Linux     user        ntdll
+       ReactOS  i386 hardware kernel+user ntoskrnl
+   (ReactOS is going to reuse Wine for its 'user' part.)
+   FIXME: href in the table title:
+       host-OS: http://www.vmware.com/support/reference/common/glossary/#hostos
+       guest-OS: http://www.vmware.com/support/reference/common/glossary/#guestos
+   While ReactOS is nice to provide us the wanted kernel emulation we also
+   need to run the guest-OS in GNU/Linux. Initially I wanted to extend Wine
+   to the kernel emulation effort but fortunately
+   <a href="mailto:Steven_Ed4153@yahoo.com">Steven Edwards<a> pointed me to
+   the ReactOS project which better suits the needs of captive.
+
+   The host-OS problem unfortunately hits us on ReactOS but this isn't
+   much hard task. W32 is designed to be hardware-independent using its <code>hal.dll</code>.
+   Unfortunately ReactOS doesn't follow this design and thus we have to patch
+   and replace various parts of hardware-dependent code even inside <code>ntoskrnl.exe</code>.
+
+   Some functions are provided both by <code>ntdll.dll</code> and
+   <code>ntoskrnl.exe</code> in W32. Suggested by
+   <a href="mailto:chorns@users.sourceforge.net">Casper Hornstrup</a> this has
+   to be differentiated as <code>ntdll.dll</code> lives in the userland
+   (low addressspace) and <code>ntoskrnl.exe</code> in the kernelland
+   (high addressspace). Unfortunately these two guys are very far each other
+   and they would have serious problems to correctly hear themselves as the
+   addresspace differentiates at 0x80000000. For completeness it may also
+   differentiate at 0xC0000000 address instead depending on whether /3GB was
+   specified during startup. BTW reactos always uses 0xC0000000 point (macro
+   <code>KERNEL_BASE</code>) although this address doesn't apply in any way on
+   reactos running in host-OS GNU/Linux when compiled for libcaptive.
+
+Q: What is Ordinal in the W32 library symbols import/export scope?
+A: Each exported symbol has its Ordinal specified - this number specifies the offset
+   in the library symbol table. During the symbol import from a different module
+   it can specify either the full symbol name or just this number - Ordinal.
+   I dunno why it was ever created as the symbol name string size is very tiny.
+   Fortunately the current versions of W32 binaries no longer utilize this Ordinal
+   feature thus captive doesn't provide them in its export.
+
+Q: Why I don't see debug info for imported binary W32 modules? Do you use W32 symbol files?
+Q: W32 symbol files have different debugging info structure. We would have to
+   convert it and I am not aware Wine or ReactOS already done this task.
+   Not yet implemented and I currently do not plan to do it.
+
+Q: Any competiting projects?
+A: Depending on your demands you may be interested in one of:
+   <a href="http://www.powerquest.com/partitionmagic/">PowerQuest PartitionMagic</a>:
+       proprietary; $70
+   <a href="http://www.acronis.com/products/osselector/">Acronis OS Selector</a>:
+       proprietary; $45
+
+
+Eric Kohl, reactos developer:
+       ..." and ReactOS cannot run on Linux!"
+       "ReactOS won't run on Linux because of direct hardware access!"
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..1df2b4c
--- /dev/null
@@ -0,0 +1,43 @@
+# $Id$
+# automake source for the topdoclevel Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+SUBDIRS=apiref
+
+noinst_DATA+=FAQ
+
+
+POD2HTML=pod2html
+POD2TEXT=pod2text
+
+noinst_DATA+=captivesym-pod.html
+
+MAINTAINERCLEANFILES+=*-pod.*
+
+if MAINTAINER_MODE
+captivesym-pod.html: $(top_srcdir)/src/libcaptive/ke/captivesym.pl
+       $(POD2HTML) $< >$@
+captivesym-pod.txt : $(top_srcdir)/src/libcaptive/ke/captivesym.pl
+       $(POD2TEXT) $< >$@
+
+else
+.PHONY: captivesym-pod.html
+captivesym-pod.html:
+
+endif
diff --git a/doc/apiref/Makefile.am b/doc/apiref/Makefile.am
new file mode 100644 (file)
index 0000000..86afe0c
--- /dev/null
@@ -0,0 +1,85 @@
+# $Id$
+# automake source for the gtk-doc generated API documentation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# captive: declare for Makefile-head.am we plan to include macros/Makefile-gtk-doc.am
+WANT_GTK_DOC=1
+include $(top_srcdir)/Makefile-head.am
+
+
+BUILT_SOURCES+=$(PACKAGE).types
+$(PACKAGE).types:
+       echo >$@
+
+# captive: configuration for $(top_srcdir)/macros/Makefile-gtk-doc.am
+
+# The name of the module, e.g. 'glib'.
+DOC_MODULE=$(PACKAGE)
+
+# The top-level SGML file. Change it if you want.
+DOC_MAIN_SGML_FILE=$(DOC_MODULE).sgml
+
+# The directory containing the source code. Relative to $(srcdir).
+# gtk-doc will search all .c & .h files beneath here for inline comments
+# documenting functions and macros.
+DOC_SOURCE_DIR=$(top_srcdir)/src
+
+# Extra options to pass to gtkdoc-scanobj or gtkdoc-scangobj.
+SCANOBJ_OPTIONS=
+
+# Extra options to supply to gtkdoc-scan.
+SCAN_OPTIONS=
+
+# Extra options to supply to gtkdoc-mkdb.
+MKDB_OPTIONS=
+
+# Extra options to supply to gtkdoc-fixref.
+FIXXREF_OPTIONS=
+
+# Used for dependencies.
+HFILE_GLOB=
+CFILE_GLOB=
+
+# Header files to ignore when scanning.
+# captive: Ignore $(top_srcdir)/src/libcaptive/include/reactos/
+# captive: Ignore $(top_srcdir)/src/libcaptive/reactos/
+IGNORE_HFILES=reactos
+
+# Images to copy into HTML directory.
+HTML_IMAGES =
+
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
+content_files =
+
+# Other files to distribute.
+extra_files =
+
+# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib
+# contains GtkObjects/GObjects and you want to document signals and properties.
+GTKDOC_CFLAGS =
+GTKDOC_LIBS =
+
+GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
+GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
+
+# If you need to override some of the declarations, place them in the
+# $(DOC_MODULE)-overrides.txt file and uncomment the second line here.
+DOC_OVERRIDES =
+#DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt
+
+
+include $(top_srcdir)/macros/Makefile-gtk-doc.am
diff --git a/doc/apiref/captive.sgml b/doc/apiref/captive.sgml
new file mode 100644 (file)
index 0000000..d5ec280
--- /dev/null
@@ -0,0 +1,15 @@
+<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
+<!ENTITY % captive-doc-top SYSTEM "sgml/captive-doc.top">
+<!ENTITY captive-doc-bottom SYSTEM "sgml/captive-doc.bottom">
+%captive-doc-top;
+]>
+<book id="index">
+  <bookinfo>
+    <title>Operation Captive Reference Manual</title>
+  </bookinfo>
+
+  <chapter>
+    <title>Operation Captive</title>
+    &captive-doc-bottom;
+  </chapter>
+</book>
diff --git a/include_test.c b/include_test.c
new file mode 100644 (file)
index 0000000..ea59063
--- /dev/null
@@ -0,0 +1,23 @@
+/* $Id$
+ * Dummy etst C source test during .include_test_all.stamp target of Makefile-head.am
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+int main(void)
+{
+       return 0;
+}
diff --git a/po/cs.po b/po/cs.po
new file mode 100644 (file)
index 0000000..5e86087
--- /dev/null
+++ b/po/cs.po
@@ -0,0 +1,30 @@
+# $Id$
+# "cs" (Czech) language file
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+msgid ""
+msgstr ""
+"Project-Id-Version: captive 0.1\n"
+"POT-Creation-Date: 2002-10-31 11:22+0100\n"
+"PO-Revision-Date: 2002-09-19 22:00+0200\n"
+"Last-Translator: Jan Kratochvil <project-captive@jankratochvil.net>>\n"
+"Language-Team: Czech <cs@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/client/cmdline/main.c:15
+msgid "captive_init FAIL"
+msgstr "captive_init SELHAL"
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..40ce399
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for the topsrclevel Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+SUBDIRS=libcaptive client
+
+#EXTRA_DIST+= \
+#      Makefile.cflags
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
new file mode 100644 (file)
index 0000000..ae78f52
--- /dev/null
@@ -0,0 +1,21 @@
+# $Id$
+# automake source listing subdirs of all client sources
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+SUBDIRS=cmdline
diff --git a/src/client/cmdline/Makefile.am b/src/client/cmdline/Makefile.am
new file mode 100644 (file)
index 0000000..1fb6095
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for development tests by command-line libcaptive client
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+
+captivecmdline_SOURCES= \
+               main.c
+captivecmdline_LDADD=$(captive_library) $(INTLLIBS)
+sbin_PROGRAMS+=captivecmdline
diff --git a/src/client/cmdline/main.c b/src/client/cmdline/main.c
new file mode 100644 (file)
index 0000000..66bfd31
--- /dev/null
@@ -0,0 +1,18 @@
+/* FIXME: test source only! Don't pass into CVS! */
+
+#include "config.h"
+
+#include <glib/gmessages.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <captive/client.h>    /* for captive_init() */
+
+
+int main(int argc,char **argv)
+{
+       if (!captive_init(argv[1]))
+               g_error(_("captive_init FAIL"));
+
+       return EXIT_SUCCESS;
+}
diff --git a/src/libcaptive/Makefile-libcaptive.am b/src/libcaptive/Makefile-libcaptive.am
new file mode 100644 (file)
index 0000000..7230646
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source include for compilations inside libcaptive
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+INCLUDES+=-DLIBCAPTIVE
+
+# Please see the comment above $(INCLUDES) in $(top_srcdir)/Makefile-head.am .
+# Keep $(top_srcdir)/src/libcaptive/reactos/include as first to permit include files override.
+INCLUDES+=-I$(top_srcdir)/src/libcaptive/reactos/include
+INCLUDES+=-I$(top_srcdir)/reactos/include -I$(top_srcdir)/reactos/ntoskrnl/include
diff --git a/src/libcaptive/Makefile.am b/src/libcaptive/Makefile.am
new file mode 100644 (file)
index 0000000..250de88
--- /dev/null
@@ -0,0 +1,39 @@
+# $Id$
+# automake source for the toplibcaptivesrclevel Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+SUBDIRS=include reactos halcaptive kd ke ldr mm ps rtl client
+
+EXTRA_DIST+= \
+               Makefile-libcaptive.am
+
+lib_LTLIBRARIES+=libcaptive.la
+libcaptive_la_LIBADD= \
+               reactos/libreactos.la \
+               halcaptive/libhalcaptive.la \
+               kd/libkd.la \
+               ke/libke.la \
+               ldr/libldr.la \
+               mm/libmm.la \
+               ps/libps.la \
+               rtl/librtl.la \
+               client/libclient.la
+libcaptive_la_LDFLAGS=-release $(VERSION)
+libcaptive_la_SOURCES=
diff --git a/src/libcaptive/client/Makefile.am b/src/libcaptive/client/Makefile.am
new file mode 100644 (file)
index 0000000..5808019
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for the client interface of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libclient.la
+libclient_la_SOURCES= \
+               init.c
diff --git a/src/libcaptive/client/init.c b/src/libcaptive/client/init.c
new file mode 100644 (file)
index 0000000..cc874fb
--- /dev/null
@@ -0,0 +1,147 @@
+/* $Id$
+ * Init and cleanup code of libcaptive to be called by client application
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/client.h"    /* self */
+#include "captive/ldr.h"
+#include "captive/unicode.h"
+#include "captive/file.h"
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include "reactos/internal/ldr.h"
+#include "reactos/napi/types.h"
+#include "reactos/internal/kd.h"       /* for KDB_LOADDRIVER_HOOK */
+#include <fcntl.h>
+#include <sys/mman.h>  /* for PROT_READ, MAP_SHARED */
+#include "reactos/ddk/kefuncs.h"       /* for KeInitializeSpinLock() */
+#include "reactos/internal/ntoskrnl.h" /* for RtlpInitNlsTables() and IoInit() */
+#include "reactos/internal/ps.h"       /* for PsInitProcessManagment() and PsInitThreadManagment() */
+
+
+/* Are we initialized? */
+static gboolean active;
+
+/* Module of fs module itself loaded by captive_init(fs_path) */
+static PMODULE_OBJECT ModuleObject;
+
+/* Driver in fs module loaded by captive_init(fs_path) */
+static DRIVER_OBJECT DriverObject_static;
+
+/**
+ * captive_init:
+ * @fs_path: #utf8 pathname to %.sys filesystem module file
+ *
+ * Initializes %libcaptive and loads the specified filesystem.
+ *
+ * Returns: %TRUE if successfuly loaded.
+ */
+gboolean captive_init(const gchar *fs_path)
+{
+NTSTATUS err;
+
+#ifdef MAINTAINER_MODE
+       g_log_set_always_fatal(~(0
+                       |G_LOG_LEVEL_MESSAGE
+                       |G_LOG_LEVEL_INFO
+                       |G_LOG_LEVEL_DEBUG
+                       ));
+#endif
+
+       g_return_val_if_fail(fs_path!=NULL,FALSE);
+       g_return_val_if_fail(active==FALSE,FALSE);
+
+       /* Part of reactos/ntoskrnl/ke/main.c/KiSystemStartup() begins. */
+       /* ExpInitializeExecutive(); */
+               /* Part of reactos/ntoskrnl/ke/main.c/ExpInitializeExecutive() begins
+                * here as the rest of the function does a lot of hardware initializations.
+                */
+               /* LdrInit1(); */
+                       /* Part of reactos/ntoskrnl/ldr/loader.c/LdrInit1() begins. */
+                       InitializeListHead(&ModuleTextListHead);
+                       /* Part of reactos/ntoskrnl/ldr/loader.c/LdrInit1() ends. */
+               /*...*/
+               /* create default nls tables */
+               RtlpInitNlsTables();
+               /*...*/
+               ObInit();
+               /*...*/
+               /* PiInitProcessManager(); */
+                       /* Part of reactos/ntoskrnl/ps/psmgr.c/PiInitProcessManager() begins. */
+                       PsInitProcessManagment();
+                       PsInitThreadManagment();
+                       /* Part of reactos/ntoskrnl/ps/psmgr.c/PiInitProcessManager() ends. */
+               /*...*/
+               IoInit();
+               /*...*/
+               /* LdrInitModuleManagement(); */
+                       /* Part of reactos/ntoskrnl/ldr/loader.c/LdrInitModuleManagement() begins
+                        * here as the rest "Create module object for {NTOSKRNL,HAL}"
+                        * is dependent on {NTOSKRNL,HAL} PE image headers not provided by libcaptive.
+                        */
+                       /* Initialize the module list and spinlock */
+                       InitializeListHead(&ModuleListHead);
+                       KeInitializeSpinLock(&ModuleListLock);
+                       /* Part of reactos/ntoskrnl/ldr/loader.c/LdrInitModuleManagement ends. */
+               /* Part of reactos/ntoskrnl/ke/main.c/ExpInitializeExecutive() ends. */
+       /* Part of reactos/ntoskrnl/ke/main.c/KiSystemStartup() ends. */
+
+
+
+       /* Simulate our PE headers and export the symbols of {NTOSKRNL,HAL} */
+       captive_kernel_exports();
+
+       err=captive_LdrpLoadAndCallImage(
+                       &ModuleObject,  /* ModuleObjectp */
+                       captive_utf8_to_UnicodeString_alloca(fs_path),  /* ModuleName */
+                       &DriverObject_static,   /* DriverEntry_DriverObject */
+                       captive_utf8_to_UnicodeString_alloca("\\FIXME\\FIXME"));        /* DriverEntry_RegistryPath */
+       g_return_val_if_fail(NT_SUCCESS(err),FALSE);
+       
+       active=TRUE;
+       return TRUE;
+}
+
+
+/**
+ * captive_cleanup:
+ *
+ * Closes #libcaptive. Frees any used system resources. You are forbidden
+ * to touch any #libcaptive data or funtions before a new captive_init()
+ * is done. Forbidden to call it before successful captive_init() is done.
+ *
+ * Currently this function IS NOT IMPLEMENTED.
+ *
+ * Returns: %TRUE if the successful resource cleanup was done during the call.
+ */
+gboolean captive_cleanup(void)
+{
+NTSTATUS err;
+
+       g_return_val_if_fail(active==TRUE,FALSE);
+
+       err=LdrUnloadModule(ModuleObject);
+       g_assert(NT_SUCCESS(err));
+
+       /* captive_cleanup() NOT IMPLEMENTED */
+       g_return_val_if_reached(FALSE);
+
+       active=FALSE;
+       return TRUE;
+}
diff --git a/src/libcaptive/halcaptive/Makefile.am b/src/libcaptive/halcaptive/Makefile.am
new file mode 100644 (file)
index 0000000..4337e1f
--- /dev/null
@@ -0,0 +1,26 @@
+# $Id$
+# automake source for the reactos's HAL emulation of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libhalcaptive.la
+libhalcaptive_la_SOURCES= \
+               irql.c \
+               intrlck.c \
+               spinlock.c
diff --git a/src/libcaptive/halcaptive/intrlck.c b/src/libcaptive/halcaptive/intrlck.c
new file mode 100644 (file)
index 0000000..fadbbb8
--- /dev/null
@@ -0,0 +1,62 @@
+/* $Id$
+ * reactos inter lock increments emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/ddk/exfuncs.h"       /* self */
+
+
+/**
+ * InterlockedIncrement:
+ * @Addend: #LONG variable to be +1ed.
+ *
+ * Adds 1 to a #LONG variable and returns.
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function is just a simple increment now.
+ *
+ * Returns: a negative number if the @result < %0,
+ * zero if the @result == %0
+ * a positive number if the @result > %0.
+ * The returned number need not be equal to the result!!!!
+ */
+LONG /* FASTCALL */ InterlockedIncrement(PLONG Addend)
+{
+       /* TODO:thread; really? */
+       return ++*Addend;
+}
+
+
+/**
+ * InterlockedDecrement:
+ * @Addend: #LONG variable to be -1ed.
+ *
+ * Subtracts 1 from a #LONG variable and returns.
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function is just a simple decrement now.
+ *
+ * Returns: a negative number if the @result < %0,
+ * zero if the @result == %0
+ * a positive number if the @result > %0.
+ * The returned number need not be equal to the result!!!!
+ */
+LONG /* FASTCALL */ InterlockedDecrement(PLONG Subend)
+{
+       /* TODO:thread; really? */
+       return --*Subend;
+}
diff --git a/src/libcaptive/halcaptive/irql.c b/src/libcaptive/halcaptive/irql.c
new file mode 100644 (file)
index 0000000..d1955cd
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$
+ * reactos IRQ handling emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/ddk/kefuncs.h"       /* self */
+
+
+/**
+ * KeGetCurrentIrql:
+ *
+ * Queries the current processor IRQ level.
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function is just a constant now.
+ *
+ * Returns: Current CPU IRQ level. libcaptive always returns %PASSIVE_LEVEL.
+ */
+KIRQL STDCALL KeGetCurrentIrql(VOID)
+{
+       /* TODO:thread */
+       /* reactos/hal/halx86/irql.c/CurrentIrql is initialized to HIGH_LEVEL */
+       return PASSIVE_LEVEL;
+}
diff --git a/src/libcaptive/halcaptive/spinlock.c b/src/libcaptive/halcaptive/spinlock.c
new file mode 100644 (file)
index 0000000..5f50aff
--- /dev/null
@@ -0,0 +1,81 @@
+/* $Id$
+ * reactos spinlock emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/ddk/kefuncs.h"       /* self */
+
+
+/**
+ * KeAcquireSpinLock:
+ * @SpinLock: Spinlock to acquire
+ * @OldIrql: Returns the previous irql
+ *
+ * Acquires a spinlock. Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now. #GMutex would be needed otherwise.
+ */
+VOID STDCALL KeAcquireSpinLock(PKSPIN_LOCK SpinLock,PKIRQL OldIrql)
+{
+       /* TODO:thread */
+       /* reactos/hal/halx86/irql.c/CurrentIrql is initialized to HIGH_LEVEL */
+       *OldIrql=PASSIVE_LEVEL;
+}
+
+
+/**
+ * KeAcquireSpinLockAtDpcLevel:
+ * @SpinLock: Spinlock to acquire
+ *
+ * Acquires a spinlock if the caller already runs on >= %DISPATCH_LEVEL.
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now. #GMutex would be needed otherwise.
+ */
+VOID STDCALL KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock)
+{
+       /* TODO:thread */
+}
+
+
+/**
+ * KeReleaseSpinLock:
+ * @SpinLock: Spinlock to release
+ * @NewIrql: Irql level before acquiring the spinlock
+ *
+ * Releases a spinlock. Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now. #GMutex would be needed otherwise.
+ */
+VOID STDCALL KeReleaseSpinLock(PKSPIN_LOCK SpinLock,KIRQL NewIrql)
+{
+       /* TODO:thread */
+}
+
+
+/**
+ * KeReleaseSpinLockFromDpcLevel:
+ * @SpinLock: Spinlock to release
+ *
+ * Releases a spinlock if the caller already run on >= %DISPATCH_LEVEL
+ * during its acquire by KeAcquireSpinLockAtDpcLevel().
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now. #GMutex would be needed otherwise.
+ */
+VOID STDCALL KeReleaseSpinLockFromDpcLevel(PKSPIN_LOCK SpinLock)
+{
+       /* TODO:thread */
+}
diff --git a/src/libcaptive/include/Makefile.am b/src/libcaptive/include/Makefile.am
new file mode 100644 (file)
index 0000000..dab7495
--- /dev/null
@@ -0,0 +1,23 @@
+# $Id$
+# automake source for include directory containing "captive" subdir
+# to permit clean #include "captive/FIXMEsomeincludefile.h" in .c files
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+SUBDIRS=reactos captive
diff --git a/src/libcaptive/include/captive/Makefile.am b/src/libcaptive/include/captive/Makefile.am
new file mode 100644 (file)
index 0000000..5e09560
--- /dev/null
@@ -0,0 +1,30 @@
+# $Id$
+# automake source for include/captive directory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+pkginclude_HEADERS+= \
+               client.h \
+               file.h \
+               ldr.h \
+               macros.h \
+               mm.h \
+               ps_reactos.h \
+               unicode.h \
+               unicode_reactos.h
diff --git a/src/libcaptive/include/captive/client.h b/src/libcaptive/include/captive/client.h
new file mode 100644 (file)
index 0000000..f892036
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id$
+ * Include file with client-application access to libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_H
+#define _CAPTIVE_CLIENT_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib/gtypes.h>
+
+
+G_BEGIN_DECLS
+
+gboolean captive_init(const gchar *fs_path);
+gboolean captive_cleanup(void);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_CLIENT_H */
diff --git a/src/libcaptive/include/captive/ldr.h b/src/libcaptive/include/captive/ldr.h
new file mode 100644 (file)
index 0000000..4405aba
--- /dev/null
@@ -0,0 +1,68 @@
+/* $Id$
+ * Include file for reactos ldr/ (loader) emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_LDR_H
+#define _CAPTIVE_LDR_H 1
+
+
+#include "captive/ldr.h"       /* self */
+#include <glib/gmacros.h>
+#include "reactos/internal/ldr.h"
+#include <glib/gtypes.h>
+
+
+G_BEGIN_DECLS
+
+/**
+ * captive_kernel_exports:
+ *
+ * Export all libcaptive symbols to reactos. It is done by *.def files used
+ * by dlltool(1) of Mingw32 compiler suite. We use native host OS compiler and
+ * we also have just a limited set of functions over reactos itself.
+ * We use our captive_ModuleList_add_builtin() to simulate PE headers exporting
+ * our symbols; this export simulation is invocated from this function.
+ *
+ * This function is generated automatically from #exports.captivesym file
+ * by #captivesym.pl script.
+ *
+ * Multiple calls of this function are forbidden.
+ *
+ * Returns: %TRUE if the export was successful.
+ */
+gboolean captive_kernel_exports(void);
+
+
+NTSTATUS captive_LdrpLoadAndCallImage(PMODULE_OBJECT *ModuleObjectp,PUNICODE_STRING ModuleName,
+    PDRIVER_OBJECT DriverEntry_DriverObject,PUNICODE_STRING DriverEntry_RegistryPath);
+gboolean captive_ModuleList_add_builtin(const gchar *FullName_utf8,...);
+/* LdrLoadModule() declared in reactos includes */
+
+/* reactos/ntoskrnl/ldr/loader.c file-scope global declaration: */
+/* Newlines prevent their inclusion by gtk-doc. */
+extern
+               LIST_ENTRY ModuleListHead;
+extern
+               KSPIN_LOCK ModuleListLock;
+extern
+               LIST_ENTRY ModuleTextListHead;
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_LDR_H */
diff --git a/src/libcaptive/include/captive/macros.h b/src/libcaptive/include/captive/macros.h
new file mode 100644 (file)
index 0000000..58d0971
--- /dev/null
@@ -0,0 +1,132 @@
+/* $Id$
+ * Include file with general macros and typedefs used through Captive project
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_MACROS_H
+#define _CAPTIVE_MACROS_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib/gmem.h>
+#include <stdarg.h>
+
+
+G_BEGIN_DECLS
+
+/**
+ * CAPTIVE_FAKEUSE:
+ *
+ * Prevent 'might be used uninitialized' warning.
+ * Macro will fakes the use of the variable as sometimes GCC can't code flow
+ * analyse #C correctly.
+ *
+ * <informalexample>
+ * <programlisting>
+ * g_some_type some_variable CAPTIVE_FAKEUSE;
+ * </programlisting>
+ * </informalexample>
+ */
+#define CAPTIVE_FAKEUSE =0
+
+
+/**
+ * captive_newn:
+ * @objp: Variable with the pointer to the objects wished to be allocated.
+ * Original value is discarded.
+ * @n: Numbers of objects to be allocated. Value %0 is permitted (g_free() effect).
+ *
+ * Macto to allocate @n objects of type *@objp and to assign the resulting pointer to @objp.
+ * Allocated memory may contain garbage.
+ *
+ * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp))*n.
+ */
+#define captive_newn(objp,n) ((objp)=g_new(typeof(*(objp)),(n)))
+
+
+/**
+ * captive_new0n:
+ * @objp: Variable with the pointer to the objects wished to be allocated and precleared.
+ * Original value is discarded.
+ * @n: Numbers of objects to be allocated. Value %0 is permitted (g_free() effect).
+ *
+ * Macro to allocate @n objects of type *@objp and to assign the resulting pointer to @objp.
+ * Allocated memory is precleared.
+ * 
+ * @Returns: Initialized @objp value as the cleared memory of size #sizeof(typeof(*objp))*n.
+ */
+#define captive_new0n(objp,n) ((objp)=g_new0(typeof(*(objp)),(n)))
+
+
+/**
+ * captive_renewn:
+ * @objp: Variable with the pointer to the objects wished to be reallocated. 
+ * Value %NULL is permitted (g_malloc() effect).
+ * @n: Numbers of objects to be allocated. Value %0 is permitted (g_free() effect).
+ *
+ * Macro to reallocate the original memory stored in @objp
+ * to the size @n objects of type *@objp and to assign the resulting pointer to @objp.
+ * New allocated space may contain garbage. Both @objp and @n can be nonexclusively
+ * passed as zero.
+ * 
+ * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp))*n.
+ */
+#define captive_renewn(objp,n) ((objp)=g_renew(typeof(*(objp)),(objp),(n)))
+
+
+/**
+ * captive_new:
+ * @objp: Variable with the pointer to the object wished to be allocated.
+ * Original value is discarded.
+ *
+ * Macto to allocate one object of type *@objp and to assign the resulting pointer to @objp.
+ * Allocated memory may contain garbage. Equivalent to captive_newn(objp,1) call.
+ *
+ * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp)).
+ */
+#define captive_new(objp) (captive_newn((objp),1))
+
+
+/**
+ * captive_new0:
+ * @objp: Variable with the pointer to the object wished to be allocated and precleared.
+ * Original value is discarded.
+ *
+ * Macro to allocate one object of type *@objp and to assign the resulting pointer to @objp.
+ * Allocated memory is precleared. Equivalent to captive_new0n(objp,1) call.
+ * 
+ * @Returns: Initialized @objp value as the cleared memory of size #sizeof(typeof(*objp)).
+ */
+#define captive_new0(objp) (captive_new0n((objp),1))
+
+
+/**
+ * captive_va_arg:
+ * @objp: Variable to be filled from the next argument of @ap.
+ * @ap: Initialized #va_list type.
+ *
+ * Automatically determines the size of @objp.
+ * Equivalent to objp=va_arg(ap,typeof(objp)) call.
+ *
+ * @Returns: Initialized @objp value.
+ */
+#define captive_va_arg(objp,ap) ((objp)=va_arg((ap),typeof(objp)))
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_MACROS_H */
diff --git a/src/libcaptive/include/captive/mm.h b/src/libcaptive/include/captive/mm.h
new file mode 100644 (file)
index 0000000..b075a57
--- /dev/null
@@ -0,0 +1,38 @@
+/* $Id$
+ * Include file for reactos memory management emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_MM_H
+#define _CAPTIVE_MM_H 1
+
+
+#include <glib/gtypes.h>
+#include "reactos/ntos/types.h"        /* for ULONG */
+
+
+G_BEGIN_DECLS
+
+gint captive_flProtect_to_mmap_prot(ULONG flProtect) G_GNUC_CONST;
+gboolean captive_mmap_map_new(gconstpointer addr,size_t len,int mmap_prot);
+gint captive_mmap_map_get(gconstpointer addr);
+gboolean captive_mmap_map_set(gconstpointer addr,int mmap_prot);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_MM_H */
diff --git a/src/libcaptive/include/captive/ps_reactos.h b/src/libcaptive/include/captive/ps_reactos.h
new file mode 100644 (file)
index 0000000..d733465
--- /dev/null
@@ -0,0 +1,57 @@
+/* $Id$
+ * Include file for processor support used also for reactos files for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_PS_REACTOS_H
+#define _CAPTIVE_PS_REACTOS_H 1
+
+
+#include <glib/gmacros.h>
+/* captive/?*_reactos.h include files have forbidden any reactos/?* inclusions
+ * as they are being included by reactos/compat.h.
+ */
+
+
+G_BEGIN_DECLS
+
+struct _KTHREAD;
+
+/**
+ * captive_KPCR:
+ *
+ * #PCR (Processor Control Region) structure type.
+ * Returned by captive_KeGetCurrentKPCR().
+ *
+ * This structure IS NOT binary compatible with reactos!
+ */
+typedef struct {
+       struct
+                       /* newline to pass gtkdoc-scan */
+                       _KTHREAD *CurrentThread;
+       } captive_KPCR;
+
+/* NEVER put anything after 'typedef struct' closing '}' as it confuses gtkdoc-scan. */
+typedef captive_KPCR *captive_PKPCR;
+
+
+captive_PKPCR captive_KeGetCurrentKPCR(void);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_PS_REACTOS_H */
diff --git a/src/libcaptive/include/captive/rtl-file.h b/src/libcaptive/include/captive/rtl-file.h
new file mode 100644 (file)
index 0000000..d091f30
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id$
+ * Include file for file handling utilities of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_FILE_H
+#define _CAPTIVE_FILE_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib/gtypes.h>
+
+
+G_BEGIN_DECLS
+
+gpointer captive_file_mmap(size_t *lenp,const gchar *path,int open_flags,int mmap_prot,int mmap_flags);
+void captive_file_munmap(gpointer base);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_FILE_H */
diff --git a/src/libcaptive/include/captive/unicode.h b/src/libcaptive/include/captive/unicode.h
new file mode 100644 (file)
index 0000000..52df30d
--- /dev/null
@@ -0,0 +1,91 @@
+/* $Id$
+ * Include file for unicode add-ons to reactos ntoskrnl/rtl/unicode.c for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_UNICODE_H
+#define _CAPTIVE_UNICODE_H 1
+
+
+#include <glib/gmacros.h>
+#include <glib/gtypes.h>
+#include <glib/galloca.h>
+#include "reactos/napi/types.h"  /* for PUNICODE_STRING etc. */
+#include "reactos/ddk/rtltypes.h"      /* for ANSI_STRING */
+#include <stddef.h>    /* for size_t and wchar_t */
+#include <glib/gunicode.h>     /* for gunichar */
+
+
+G_BEGIN_DECLS
+
+/**
+ * captive_UnicodeString_to_utf8_alloca:
+ * @string_UnicodeString: #PUNICODE_STRING type of string to convert.
+ *
+ * alloca(3)-based conversion from #PUNICODE_STRING to plain #utf8 string.
+ *
+ * @Returns: #const #gchar * alloca(3)ed converted string @string_UnicodeString.
+ */
+#define captive_UnicodeString_to_utf8_alloca(string_UnicodeString) \
+               ({ /* GCC dependent */ \
+                       /* detect required memory size, g_alloca() cannot safely fail (really?) */ \
+                       gchar *mem=g_alloca(_captive_UnicodeString_to_utf8_alloca_internal_sizeof(string_UnicodeString)); \
+                       /* convert+copy the string to the prepared memory */ \
+                       _captive_UnicodeString_to_utf8_alloca_internal_fill(mem,string_UnicodeString); \
+                       (const gchar *)mem; \
+                       })
+size_t _captive_UnicodeString_to_utf8_alloca_internal_sizeof(const UNICODE_STRING *string_UnicodeString);
+void _captive_UnicodeString_to_utf8_alloca_internal_fill(gchar *mem,const UNICODE_STRING *string_UnicodeString);
+
+
+/**
+ * captive_utf8_to_UnicodeString_alloca:
+ * @string_utf8: #const #gchar * string in #utf8 to convert.
+ *
+ * alloca(3)-based conversion from plain #utf8 string to #PUNICODE_STRING.
+ *
+ * @Returns: #PUNICODE_STRING alloca(3)ed converted string @string_utf8.
+ */
+#define captive_utf8_to_UnicodeString_alloca(string_utf8) \
+               ({ /* GCC dependent */ \
+                       /* detect required memory size, g_alloca() cannot safely fail (really?) */ \
+                       UNICODE_STRING *mem=g_alloca(_captive_utf8_to_UnicodeString_alloca_internal_sizeof(string_utf8)); \
+                       /* convert+copy the string to the prepared memory */ \
+                       _captive_utf8_to_UnicodeString_alloca_internal_fill(mem,string_utf8); \
+                       (PUNICODE_STRING)mem; \
+                       })
+size_t _captive_utf8_to_UnicodeString_alloca_internal_sizeof(const gchar *string_utf8);
+void _captive_utf8_to_UnicodeString_alloca_internal_fill(UNICODE_STRING *mem,const gchar *string_utf8);
+
+
+gboolean captive_validate_ucs4(const gunichar *string_ucs4);
+gboolean captive_validate_ucs2(const captive_ucs2 *string_ucs2);
+gboolean captive_validate_utf8(const gchar *string_utf8);
+glong captive_ucs2_strlen(const captive_ucs2 *string_ucs2) G_GNUC_PURE;
+gboolean captive_validate_UnicodeString(const UNICODE_STRING *string_UnicodeString);
+gboolean captive_validate_AnsiString(const ANSI_STRING *string_AnsiString);
+gchar *captive_UnicodeString_to_utf8_malloc(const UNICODE_STRING *string_UnicodeString);
+PUNICODE_STRING captive_utf8_to_UnicodeString_malloc(const gchar *string_utf8);
+/* We can be G_GNUC_CONST as we really just map the pointer values.
+ * Initially we create the result content from the input content but it should not harm.
+ */
+const gunichar2 *captive_ucs4_to_utf16_const(const gunichar *string_ucs4) G_GNUC_CONST;
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_UNICODE_H */
diff --git a/src/libcaptive/include/captive/unicode_reactos.h b/src/libcaptive/include/captive/unicode_reactos.h
new file mode 100644 (file)
index 0000000..833f71e
--- /dev/null
@@ -0,0 +1,75 @@
+/* $Id$
+ * Include file for unicode support used also for reactos files for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_UNICODE_REACTOS_H
+#define _CAPTIVE_UNICODE_REACTOS_H 1
+
+
+#include <glib/gtypes.h>       /* for guint16 */
+#include <glib/gunicode.h>     /* for gunichar */
+/* captive/?*_reactos.h include files have forbidden any reactos/?* inclusions
+ * as they are being included by reactos/compat.h.
+ */
+
+
+G_BEGIN_DECLS
+
+/**
+ * captive_ucs2:
+ *
+ * This type is separated from Gnome #gunichar2 as #captive_ucs2 MUST be used for UCS-2
+ * encoded strings in the opposite of #gunichar2 beging used for UTF-16 encoded strings.
+ */
+typedef guint16 captive_ucs2;
+
+
+/* We can be G_GNUC_CONST as we really just map the pointer values.
+ * Initially we create the result content from the input content but it should not harm.
+ */
+const captive_ucs2 *captive_ucs4_to_ucs2_const(const gunichar *string_ucs4) G_GNUC_CONST;
+
+
+/**
+ * captive_wchar32_to_ucs2_const:
+ * @string_wchar32: #const #wchar_t * type of 32-bit #wchar_t persistent string to convert.
+ * This string MUST remain readable with the same content forever.
+ * This string MUST be convertible to UCS-2 string.
+ *
+ * Constant string conversion from 32-bit #wchar_t to 16-bit #wchar_t.
+ * You may not modify the result in any way.
+ * 
+ * It is guaranteed to get two different string addresses for two different
+ * input addresses even if the input strings content is the same.
+ * Otherwise we would behave as #GCC option %-fmerge-constants which
+ * results in %C non-conforming behaviour.
+ *
+ * This function is a pure pass to captive_ucs4_to_ucs2_const()
+ * to implement proper type checking of the passed @string_wchar32.
+ *
+ * Returns: #const #captive_ucs2 * converted string @string_ucs4.
+ */
+static inline const captive_ucs2 *captive_wchar32_to_ucs2_const(const wchar_t *string_wchar32)
+{
+       return captive_ucs4_to_ucs2_const((const gunichar *)string_wchar32);
+}
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_UNICODE_REACTOS_H */
diff --git a/src/libcaptive/include/reactos/Makefile.am b/src/libcaptive/include/reactos/Makefile.am
new file mode 100644 (file)
index 0000000..d30f763
--- /dev/null
@@ -0,0 +1,35 @@
+# $Id$
+# automake source for reactos-include wrappers directory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# This include/reactos/ exists to provide glue for including reactos
+# include files. They are hard to include directly from the .c source file
+# as they have unresolved include file dependencies (hard!) and also some
+# compatibility cludges as for -fshort-wchar are needed.
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+SUBDIRS=ddk internal napi ntos
+
+noinst_HEADERS+= \
+               compat.h \
+               \
+               base.h \
+               defines.h \
+               structs.h \
+               unicode.h
diff --git a/src/libcaptive/include/reactos/base.h b/src/libcaptive/include/reactos/base.h
new file mode 100644 (file)
index 0000000..6755af4
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos base.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_BASE_H
+#define _CAPTIVE_REACTOS_BASE_H 1
+
+
+#include <stddef.h> /* for wchar_t */
+/* #include "..." prefers current directory even if not specified by cpp -I.
+ * In the base $(top_srcdir)/src/libcaptive/include/reactos/ directory
+ * we must use #include <...> to prevent including ourselves.
+ */
+#include <base.h>
+
+
+#endif /* _CAPTIVE_REACTOS_BASE_H */
+
+#  if   _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_BASE_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/compat.h b/src/libcaptive/include/reactos/compat.h
new file mode 100644 (file)
index 0000000..3b474b2
--- /dev/null
@@ -0,0 +1,164 @@
+/* $Id$
+ * Include file for GNU world compatibility with reactos include files for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+/* NEVER protect this include file with #ifndef/#define/#endif
+ * wrapper as we need to be included multiple times
+ * Despite this we still #define the symbol to be able to check it
+ */
+#ifdef _CAPTIVE_REACTOS_COMPAT_H
+#undef _CAPTIVE_REACTOS_COMPAT_H
+#define _CAPTIVE_REACTOS_COMPAT_H 2
+#else
+#define _CAPTIVE_REACTOS_COMPAT_H 1
+#endif
+
+/* NEVER use #include in this file before all the #define-s are done
+ * as we pretend any nested #include "reactos/compat.h" automatically as 'succeeded'.
+ * NEVER use any #include inside !REACTOS_COMPAT condition branches.
+ * We never nest as the include is protected by #ifdef from reactos/?*.h includes.
+ */
+#ifdef _CAPTIVE_REACTOS_COMPAT_H_INSIDE
+#error "$(top_srcdir)/src/libcaptive/include/reactos/compat.h MUST NOT NEST!"
+#endif
+#define _CAPTIVE_REACTOS_COMPAT_H_INSIDE 1
+
+
+/* reactos uses __declspec(dllimport) and __declspec(dllexport)
+ * which gets expanded to __attribute__($2) by -D in their Makefile GCC commandline.
+ */
+#ifdef REACTOS_COMPAT
+#define __declspec(type)
+#else
+#undef __declspec
+#endif
+
+/* It gets defined to __attribute__((fastcall)) by "ddk/ntddk.h". */
+#ifdef REACTOS_COMPAT
+#define FASTCALL
+#else
+#undef FASTCALL
+#endif
+
+#ifdef REACTOS_COMPAT
+#define wcscpy captive_reactos_wcscpy
+#else
+#undef wcscpy
+#endif
+
+#ifdef REACTOS_COMPAT
+#define wcscat captive_reactos_wcscat
+#else
+#undef wcscat
+#endif
+
+#ifdef REACTOS_COMPAT
+#define wcschr captive_reactos_wcschr
+#else
+#undef wcschr
+#endif
+
+#ifdef REACTOS_COMPAT
+#define wcsrchr captive_reactos_wcsrchr
+#else
+#undef wcsrchr
+#endif
+
+#ifdef REACTOS_COMPAT
+#define wcslen captive_reactos_wcslen
+#else
+#undef wcslen
+#endif
+
+#ifdef REACTOS_COMPAT
+#define _wcsicmp captive_reactos__wcsicmp
+#else
+#undef _wcsicmp
+#endif
+
+/* int iswdigit(wint_t wc); should be safe */
+/* int iswlower(wint_t wc); should be safe */
+/* int iswxdigit(wint_t wc); should be safe */
+
+/* Place BEFORE "internal/debug.h" include as there is
+ *     internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2()
+ */
+#ifdef REACTOS_COMPAT
+#include <stddef.h>    /* for wchar_t; Prevent <stddef.h> declaration while REACTOS_COMPAT is active */
+/* You MUST include "captive/unicode_reactos.h" before wchar_t redefinition! */
+#include "captive/unicode_reactos.h"   /* for captive_ucs4_to_ucs2_const() for crtdll/string.h/REACTOS_UCS2() and captive_ucs2 */
+#define wchar_t captive_ucs2
+#define REACTOS_UCS2(string_wchar32) (captive_wchar32_to_ucs2_const((string_wchar32)))
+#else
+#undef wchar_t
+#undef REACTOS_UCS2
+#endif
+
+/* for internal/debug.h */
+#ifdef REACTOS_COMPAT
+#define DBG 1
+#else
+#undef DBG
+#endif
+
+
+/* -------------------------------- #include-s permitted now, #define-s forbidden
+ * See above #define _CAPTIVE_REACTOS_COMPAT_H_INSIDE in this file.
+ */
+
+
+/* Place AFTER REACTOS_UCS2 definition as there is
+ *     internal/debug.h->internal/ntoskrnl.h->ddk/ntddk.h->REACTOS_UCS2()
+ * Some sources (reactos/ntoskrnl/ldr/loader.c) define NDEBUG themselves!
+ * We have to pre-define all the non-NDEBUG (=debug) macros for such source files.
+ */
+#ifdef REACTOS_COMPAT
+#ifdef __NTOSKRNL__    /* Don't pollute the namespace outside ntoskrnl. */
+#include "reactos/internal/debug.h"
+#endif
+#endif
+
+#ifdef REACTOS_COMPAT
+/* All invalid reactos definitions go to captive_reactos_* as trash */
+#define _KPCR            captive_reactos__KPCR
+#define KPCR             captive_reactos_KPCR
+#define PKPCR            captive_reactos_PKPCR
+#define KeGetCurrentKPCR captive_reactos_KeGetCurrentKPCR
+#include "reactos/internal/i386/ps.h"
+#undef _KPCR
+#undef KPCR
+#undef PKPCR
+#undef KeGetCurrentKPCR
+/* Usable libcaptive definition for reactos go to captive_*.
+ * Note we don't leave any defintion under its original symbol name
+ * just to make the whole mess a bit more sane.
+ */
+#include "captive/ps_reactos.h"
+#define _KPCR            captive__KPCR
+#define KPCR             captive_KPCR
+#define PKPCR            captive_PKPCR
+#define KeGetCurrentKPCR captive_KeGetCurrentKPCR
+#else
+#undef _KPCR
+#undef KPCR
+#undef PKPCR
+#undef KeGetCurrentKPCR
+#endif
+
+
+#undef _CAPTIVE_REACTOS_COMPAT_H_INSIDE
diff --git a/src/libcaptive/include/reactos/ddk/Makefile.am b/src/libcaptive/include/reactos/ddk/Makefile.am
new file mode 100644 (file)
index 0000000..43c5d91
--- /dev/null
@@ -0,0 +1,42 @@
+# $Id$
+# automake source for reactos-include wrappers ddk/ subdirectory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+SUBDIRS=i386
+
+noinst_HEADERS+= \
+               cmtypes.h \
+               defines.h \
+               exfuncs.h \
+               extypes.h \
+               iofuncs.h \
+               iotypes.h \
+               kefuncs.h \
+               ketypes.h \
+               mmtypes.h \
+               ntddk.h \
+               obtypes.h \
+               potypes.h \
+               pnptypes.h \
+               pstypes.h \
+               rtl.h \
+               rtltypes.h \
+               types.h \
+               zwtypes.h
diff --git a/src/libcaptive/include/reactos/ddk/cmtypes.h b/src/libcaptive/include/reactos/ddk/cmtypes.h
new file mode 100644 (file)
index 0000000..b76c29e
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/cmtypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_CMTYPES_H
+#define _CAPTIVE_REACTOS_DDK_CMTYPES_H 1
+
+
+#include "ddk/cmtypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_CMTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_CMTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/defines.h b/src/libcaptive/include/reactos/ddk/defines.h
new file mode 100644 (file)
index 0000000..311db09
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/defines.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_DEFINES_H
+#define _CAPTIVE_REACTOS_DDK_DEFINES_H 1
+
+
+#include "ddk/defines.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_DEFINES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_DEFINES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/exfuncs.h b/src/libcaptive/include/reactos/ddk/exfuncs.h
new file mode 100644 (file)
index 0000000..8fe34b9
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/exfuncs.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_EXFUNCS_H
+#define _CAPTIVE_REACTOS_DDK_EXFUNCS_H 1
+
+
+#include "reactos/ddk/ntddk.h" /* for FASTCALL */
+#include "ddk/exfuncs.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_EXFUNCS_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_EXFUNCS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/extypes.h b/src/libcaptive/include/reactos/ddk/extypes.h
new file mode 100644 (file)
index 0000000..18f9e76
--- /dev/null
@@ -0,0 +1,48 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/extypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_EXTYPES_H
+#define _CAPTIVE_REACTOS_DDK_EXTYPES_H 1
+
+
+#include "reactos/ddk/defines.h"       /* for IMPORTED */
+#include "reactos/ddk/obtypes.h"       /* for POBJECT_TYPE */
+#include "ddk/extypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_EXTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_EXTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/i386/Makefile.am b/src/libcaptive/include/reactos/ddk/i386/Makefile.am
new file mode 100644 (file)
index 0000000..4463c4f
--- /dev/null
@@ -0,0 +1,23 @@
+# $Id$
+# automake source for reactos-include wrappers ddk/i386/ subdirectory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_HEADERS+= \
+               tss.h
diff --git a/src/libcaptive/include/reactos/ddk/i386/tss.h b/src/libcaptive/include/reactos/ddk/i386/tss.h
new file mode 100644 (file)
index 0000000..dac62cb
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/i386/tss.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_I386_TSS_H
+#define _CAPTIVE_REACTOS_DDK_I386_TSS_H 1
+
+
+#include "ddk/i386/tss.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_I386_TSS_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_I386_TSS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/iofuncs.h b/src/libcaptive/include/reactos/ddk/iofuncs.h
new file mode 100644 (file)
index 0000000..e4f7f1a
--- /dev/null
@@ -0,0 +1,54 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/iofuncs.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_IOFUNCS_H
+#define _CAPTIVE_REACTOS_DDK_IOFUNCS_H 1
+
+
+#include "reactos/base.h"      /* for STDCALL */
+#include "reactos/ddk/types.h" /* for PKIRQL */
+#include "reactos/napi/types.h"        /* for NTSTATUS */
+#include "reactos/ddk/iotypes.h"       /* for PADAPTER_OBJECT */
+#include "reactos/ddk/rtltypes.h"      /* for PCONTROLLER_OBJECT */
+#include "reactos/ddk/zwtypes.h"       /* for PFILE_FULL_EA_INFORMATION */
+#include "reactos/ddk/extypes.h"       /* for WORK_QUEUE_TYPE */
+#include "reactos/ddk/ntddk.h" /* for FASTCALL */
+#include "ddk/iofuncs.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_IOFUNCS_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_IOFUNCS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/iotypes.h b/src/libcaptive/include/reactos/ddk/iotypes.h
new file mode 100644 (file)
index 0000000..dcc47a2
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/iotypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_IOTYPES_H
+#define _CAPTIVE_REACTOS_DDK_IOTYPES_H 1
+
+
+#include "reactos/ddk/defines.h"       /* for IMPORTED */
+#include "reactos/ddk/obtypes.h"       /* for POBJECT_TYPE */
+#include "reactos/ddk/cmtypes.h"       /* for PKEY_VALUE_FULL_INFORMATION */
+#include "reactos/ddk/pnptypes.h"      /* for DEVICE_RELATION_TYPE */
+#include "reactos/ddk/mmtypes.h"       /* for PMDL */
+#include "ddk/iotypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_IOTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_IOTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/kefuncs.h b/src/libcaptive/include/reactos/ddk/kefuncs.h
new file mode 100644 (file)
index 0000000..283664a
--- /dev/null
@@ -0,0 +1,49 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/kefuncs.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_KEFUNCS_H
+#define _CAPTIVE_REACTOS_DDK_KEFUNCS_H 1
+
+
+#include "reactos/base.h"      /* for STDCALL */
+#include "reactos/ddk/ketypes.h"       /* for PKSPIN_LOCK */
+#include "reactos/ddk/ntddk.h" /* for FASTCALL */
+#include "ddk/kefuncs.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_KEFUNCS_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_KEFUNCS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/ketypes.h b/src/libcaptive/include/reactos/ddk/ketypes.h
new file mode 100644 (file)
index 0000000..ee812a9
--- /dev/null
@@ -0,0 +1,49 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/ketypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_KETYPES_H
+#define _CAPTIVE_REACTOS_DDK_KETYPES_H 1
+
+
+#include "reactos/ddk/defines.h"       /* for IMPORTED */
+#include "reactos/napi/types.h"        /* for CSHORT */
+#include "reactos/ddk/types.h" /* for KPROCESSOR_MODE */
+#include "ddk/ketypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_KETYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_KETYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/mmtypes.h b/src/libcaptive/include/reactos/ddk/mmtypes.h
new file mode 100644 (file)
index 0000000..af4cc43
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/mmtypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_MMTYPES_H
+#define _CAPTIVE_REACTOS_DDK_MMTYPES_H 1
+
+
+#include "ddk/mmtypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_MMTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_MMTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/ntddk.h b/src/libcaptive/include/reactos/ddk/ntddk.h
new file mode 100644 (file)
index 0000000..f4d7521
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/ntddk.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_NTDDK_H
+#define _CAPTIVE_REACTOS_DDK_NTDDK_H 1
+
+
+#include "ddk/ntddk.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_NTDDK_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_NTDDK_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/obtypes.h b/src/libcaptive/include/reactos/ddk/obtypes.h
new file mode 100644 (file)
index 0000000..f5fcd87
--- /dev/null
@@ -0,0 +1,49 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/obtypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_OBTYPES_H
+#define _CAPTIVE_REACTOS_DDK_OBTYPES_H 1
+
+
+#include "reactos/ntos/security.h"     /* for ACCESS_MASK */
+#include "reactos/napi/types.h"        /* for UNICODE_STRING etc. */
+#include "reactos/ddk/ketypes.h"       /* for PEPROCESS */
+#include "ddk/obtypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_OBTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_OBTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/pnptypes.h b/src/libcaptive/include/reactos/ddk/pnptypes.h
new file mode 100644 (file)
index 0000000..ae23770
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/pnptypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_PNPTYPES_H
+#define _CAPTIVE_REACTOS_DDK_PNPTYPES_H 1
+
+
+#include "reactos/ddk/potypes.h"       /* for DEVICE_POWER_STATE */
+#include "ddk/pnptypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_PNPTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_PNPTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/potypes.h b/src/libcaptive/include/reactos/ddk/potypes.h
new file mode 100644 (file)
index 0000000..2b0e3b6
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/potypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_POTYPES_H
+#define _CAPTIVE_REACTOS_DDK_POTYPES_H 1
+
+
+#include "ddk/potypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_POTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_POTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/pstypes.h b/src/libcaptive/include/reactos/ddk/pstypes.h
new file mode 100644 (file)
index 0000000..bdfcf9e
--- /dev/null
@@ -0,0 +1,48 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/pstypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_PSTYPES_H
+#define _CAPTIVE_REACTOS_DDK_PSTYPES_H 1
+
+
+#include "reactos/ddk/defines.h"       /* for IMPORTED */
+#include "reactos/ddk/obtypes.h"       /* for POBJECT_TYPE */
+#include "ddk/pstypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_PSTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_PSTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/rtl.h b/src/libcaptive/include/reactos/ddk/rtl.h
new file mode 100644 (file)
index 0000000..f27cb2d
--- /dev/null
@@ -0,0 +1,50 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/rtl.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_RTL_H
+#define _CAPTIVE_REACTOS_DDK_RTL_H 1
+
+
+#include "reactos/ntos/types.h"        /* for WORD etc. */
+#include "reactos/ddk/extypes.h"       /* for PSLIST_HEADER */
+#include "reactos/ddk/rtltypes.h"      /* for PRTL_ATOM_TABLE */
+#include "reactos/ntos/time.h" /* for PTIME_ZONE_INFORMATION */
+#include "ddk/rtl.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_RTL_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_RTL_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/rtltypes.h b/src/libcaptive/include/reactos/ddk/rtltypes.h
new file mode 100644 (file)
index 0000000..8cc6d8b
--- /dev/null
@@ -0,0 +1,48 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/rtltypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_RTLTYPES_H
+#define _CAPTIVE_REACTOS_DDK_RTLTYPES_H 1
+
+
+#include "reactos/ntos/types.h"        /* for ULONG  */
+#include "reactos/ddk/ketypes.h"       /* for KDEVICE_QUEUE */
+#include "ddk/rtltypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_RTLTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_RTLTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/types.h b/src/libcaptive/include/reactos/ddk/types.h
new file mode 100644 (file)
index 0000000..18d9289
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/types.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_TYPES_H
+#define _CAPTIVE_REACTOS_DDK_TYPES_H 1
+
+
+#include "ddk/types.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_TYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_TYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ddk/zwtypes.h b/src/libcaptive/include/reactos/ddk/zwtypes.h
new file mode 100644 (file)
index 0000000..56ccfbc
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ddk/zwtypes.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DDK_ZWTYPES_H
+#define _CAPTIVE_REACTOS_DDK_ZWTYPES_H 1
+
+
+#include "reactos/napi/teb.h"  /* for CLIENT_ID */
+#include "ddk/zwtypes.h"
+
+
+#endif /* _CAPTIVE_REACTOS_DDK_ZWTYPES_H */
+
+#  if   _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DDK_ZWTYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/defines.h b/src/libcaptive/include/reactos/defines.h
new file mode 100644 (file)
index 0000000..f759560
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos defines.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_DEFINES_H
+#define _CAPTIVE_REACTOS_DEFINES_H 1
+
+
+#include "reactos/defines.h"   /* for LF_FACESIZE */
+/* #include "..." prefers current directory even if not specified by cpp -I.
+ * In the base $(top_srcdir)/src/libcaptive/include/reactos/ directory
+ * we must use #include <...> to prevent including ourselves.
+ */
+#include <defines.h>
+
+
+#endif /* _CAPTIVE_REACTOS_DEFINES_H */
+
+#  if   _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_DEFINES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/Makefile.am b/src/libcaptive/include/reactos/internal/Makefile.am
new file mode 100644 (file)
index 0000000..a3c7f11
--- /dev/null
@@ -0,0 +1,30 @@
+# $Id$
+# automake source for reactos-include wrappers internal/ subdirectory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+SUBDIRS=i386
+
+noinst_HEADERS+= \
+               debug.h \
+               kd.h  \
+               ldr.h \
+               mm.h \
+               ps.h \
+               ntoskrnl.h
diff --git a/src/libcaptive/include/reactos/internal/debug.h b/src/libcaptive/include/reactos/internal/debug.h
new file mode 100644 (file)
index 0000000..ca83a11
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/debug.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_DEBUG_H
+#define _CAPTIVE_REACTOS_INTERNAL_DEBUG_H 1
+
+
+#include "reactos/ddk/kefuncs.h"       /* for KeBugCheck() */
+#include "internal/debug.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_DEBUG_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_DEBUG_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/i386/Makefile.am b/src/libcaptive/include/reactos/internal/i386/Makefile.am
new file mode 100644 (file)
index 0000000..f96d840
--- /dev/null
@@ -0,0 +1,23 @@
+# $Id$
+# automake source for reactos-include wrappers internal/i386/ subdirectory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_HEADERS+= \
+               ps.h
diff --git a/src/libcaptive/include/reactos/internal/i386/ps.h b/src/libcaptive/include/reactos/internal/i386/ps.h
new file mode 100644 (file)
index 0000000..837fdd4
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/i386/ps.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_I386_PS_H
+#define _CAPTIVE_REACTOS_INTERNAL_I386_PS_H 1
+
+
+#include "reactos/ntos/types.h"        /* for PVOID etc. */
+#include "reactos/ddk/types.h" /* for KIRQL */
+#include "reactos/ddk/i386/tss.h"      /* for KTSS */
+#include "reactos/napi/types.h"        /* for NTSTATUS */
+#include "reactos/ddk/pstypes.h"       /* for PKSTART_ROUTINE */
+#include "internal/i386/ps.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_I386_PS_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_I386_PS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/kd.h b/src/libcaptive/include/reactos/internal/kd.h
new file mode 100644 (file)
index 0000000..458a1a9
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/kd.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_KD_H
+#define _CAPTIVE_REACTOS_INTERNAL_KD_H 1
+
+
+#include "internal/kd.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_KD_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_KD_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/ldr.h b/src/libcaptive/include/reactos/internal/ldr.h
new file mode 100644 (file)
index 0000000..c590573
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/ldr.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_LDR_H
+#define _CAPTIVE_REACTOS_INTERNAL_LDR_H 1
+
+
+#include "reactos/ntos/types.h"        /* for WORD etc. */
+#include "internal/ldr.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_LDR_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_LDR_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/mm.h b/src/libcaptive/include/reactos/internal/mm.h
new file mode 100644 (file)
index 0000000..c86dc98
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/mm.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_MM_H
+#define _CAPTIVE_REACTOS_INTERNAL_MM_H 1
+
+
+#include "internal/mm.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_MM_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_MM_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/ntoskrnl.h b/src/libcaptive/include/reactos/internal/ntoskrnl.h
new file mode 100644 (file)
index 0000000..d49a65e
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/ntoskrnl.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H
+#define _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H 1
+
+
+#include "internal/ntoskrnl.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_NTOSKRNL_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/internal/ps.h b/src/libcaptive/include/reactos/internal/ps.h
new file mode 100644 (file)
index 0000000..989db10
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos internal/ps.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_INTERNAL_PS_H
+#define _CAPTIVE_REACTOS_INTERNAL_PS_H 1
+
+
+#include "reactos/ntos/types.h"        /* for PVOID etc. */
+#include "reactos/ddk/types.h" /* for KIRQL */
+#include "reactos/ddk/i386/tss.h"      /* for KTSS */
+#include "reactos/napi/types.h"        /* for NTSTATUS */
+#include "reactos/ddk/pstypes.h"       /* for PKSTART_ROUTINE */
+#include "internal/ps.h"
+
+
+#endif /* _CAPTIVE_REACTOS_INTERNAL_PS_H */
+
+#  if   _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_INTERNAL_PS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/napi/Makefile.am b/src/libcaptive/include/reactos/napi/Makefile.am
new file mode 100644 (file)
index 0000000..f84567b
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for reactos-include wrappers napi/ subdirectory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_HEADERS+= \
+               teb.h \
+               types.h
diff --git a/src/libcaptive/include/reactos/napi/teb.h b/src/libcaptive/include/reactos/napi/teb.h
new file mode 100644 (file)
index 0000000..7355c46
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos napi/teb.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_NAPI_TEB_H
+#define _CAPTIVE_REACTOS_NAPI_TEB_H 1
+
+
+#include "napi/teb.h"
+
+
+#endif /* _CAPTIVE_REACTOS_NAPI_TEB_H */
+
+#  if   _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NAPI_TEB_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/napi/types.h b/src/libcaptive/include/reactos/napi/types.h
new file mode 100644 (file)
index 0000000..9ac228a
--- /dev/null
@@ -0,0 +1,47 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos napi/types.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_NAPI_TYPES_H
+#define _CAPTIVE_REACTOS_NAPI_TYPES_H 1
+
+
+#include "reactos/base.h"      /* for LONG */
+#include "napi/types.h"
+
+
+#endif /* _CAPTIVE_REACTOS_NAPI_TYPES_H */
+
+#  if   _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NAPI_TYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ntos/Makefile.am b/src/libcaptive/include/reactos/ntos/Makefile.am
new file mode 100644 (file)
index 0000000..1881e8f
--- /dev/null
@@ -0,0 +1,25 @@
+# $Id$
+# automake source for reactos-include wrappers ntos/ subdirectory Makefile
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_HEADERS+= \
+               security.h \
+               time.h \
+               types.h
diff --git a/src/libcaptive/include/reactos/ntos/security.h b/src/libcaptive/include/reactos/ntos/security.h
new file mode 100644 (file)
index 0000000..5c16db1
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ntos/security.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_NTOS_SECURITY_H
+#define _CAPTIVE_REACTOS_NTOS_SECURITY_H 1
+
+
+#include "ntos/security.h"
+
+
+#endif /* _CAPTIVE_REACTOS_NTOS_SECURITY_H */
+
+#  if   _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NTOS_SECURITY_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ntos/time.h b/src/libcaptive/include/reactos/ntos/time.h
new file mode 100644 (file)
index 0000000..be51269
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ntos/time.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_NTOS_TIME_H
+#define _CAPTIVE_REACTOS_NTOS_TIME_H 1
+
+
+#include "ntos/time.h"
+
+
+#endif /* _CAPTIVE_REACTOS_NTOS_TIME_H */
+
+#  if   _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NTOS_TIME_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/ntos/types.h b/src/libcaptive/include/reactos/ntos/types.h
new file mode 100644 (file)
index 0000000..5b9d3b4
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos ntos/types.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_NTOS_TYPES_H
+#define _CAPTIVE_REACTOS_NTOS_TYPES_H 1
+
+
+#include "ntos/types.h"
+
+
+#endif /* _CAPTIVE_REACTOS_NTOS_TYPES_H */
+
+#  if   _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_NTOS_TYPES_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/structs.h b/src/libcaptive/include/reactos/structs.h
new file mode 100644 (file)
index 0000000..c1f3bbd
--- /dev/null
@@ -0,0 +1,51 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos structs.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_STRUCTS_H
+#define _CAPTIVE_REACTOS_STRUCTS_H 1
+
+
+#include "reactos/defines.h"   /* for LF_FACESIZE */
+/* #include "..." prefers current directory even if not specified by cpp -I.
+ * In the base $(top_srcdir)/src/libcaptive/include/reactos/ directory
+ * we must use #include <...> to prevent including ourselves.
+ */
+#include <structs.h>
+
+
+#endif /* _CAPTIVE_REACTOS_STRUCTS_H */
+
+#  if   _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_STRUCTS_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/include/reactos/unicode.h b/src/libcaptive/include/reactos/unicode.h
new file mode 100644 (file)
index 0000000..bef0c0e
--- /dev/null
@@ -0,0 +1,52 @@
+/* $Id$
+ * GNU world compatibility wrapper for reactos unicode.h for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef REACTOS_COMPAT
+#define REACTOS_COMPAT 1
+#define _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT 1
+#include "reactos/compat.h"
+#else
+#ifdef  _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT
+#undef  _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT 2
+#endif
+#endif
+
+#ifndef _CAPTIVE_REACTOS_UNICODE_H
+#define _CAPTIVE_REACTOS_UNICODE_H 1
+
+
+#include <stdarg.h>    /* for va_list */
+#include "reactos/structs.h"   /* for LPDCB */
+/* #include "..." prefers current directory even if not specified by cpp -I.
+ * In the base $(top_srcdir)/src/libcaptive/include/reactos/ directory
+ * we must use #include <...> to prevent including ourselves.
+ */
+#include <unicode.h>
+
+
+#endif /* _CAPTIVE_REACTOS_UNICODE_H */
+
+#  if   _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT == 1
+#undef REACTOS_COMPAT
+#include "reactos/compat.h"
+#elif   _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT == 2
+#undef  _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT
+#define _CAPTIVE_REACTOS_UNICODE_H_REACTOS_COMPAT 1
+#endif
diff --git a/src/libcaptive/kd/Makefile.am b/src/libcaptive/kd/Makefile.am
new file mode 100644 (file)
index 0000000..1aec85f
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for the reactos's kd/ emulation of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libkd.la
+libkd_la_SOURCES= \
+               kdebug.c
diff --git a/src/libcaptive/kd/kdebug.c b/src/libcaptive/kd/kdebug.c
new file mode 100644 (file)
index 0000000..074d9b5
--- /dev/null
@@ -0,0 +1,108 @@
+/* $Id$
+ * reactos spinlock emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/internal/kd.h"       /* self */
+#include "captive/unicode.h"   /* for captive_validate_AnsiString() */
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include <glib/galloca.h>
+#include <glib/gstring.h>
+#include <glib/gmem.h>
+
+
+/**
+ * KdDebuggerEnabled:
+ *
+ * #BOOLEAN variable defined to %FALSE by libcaptive.
+ * Currently just enables some debug output in
+ * reactos/ntoskrnl/ldr/loader.c
+ */
+BOOLEAN /* __declspec(dllexport) */ KdDebuggerEnabled=FALSE;
+
+/**
+ * KdDebugState:
+ *
+ * Defined to %KD_DEBUG_DISABLED by default in reactos.
+ * Currently just enables some debug output in
+ * reactos/ntoskrnl/ldr/loader.c
+ */
+ULONG KdDebugState=KD_DEBUG_GDB;
+
+
+/* storage for the trailing string part without newline */
+static GString *KdpPrintString_buffer;
+
+/**
+ * KdpPrintString:
+ * @String: String text to print. Buffer is flushed only when newline seen.
+ *
+ * Prints the specified text string to the console. libcaptive
+ * accepts any newline characters as valid and autonewlines the text
+ * if needed.
+ */
+ULONG KdpPrintString(PANSI_STRING String)
+{
+gchar *out_base,*out;
+const CHAR *in;
+
+       g_return_val_if_fail(captive_validate_AnsiString(String),0);
+
+       out_base=g_alloca(((size_t)String->Length)+1);
+       out=out_base;
+       for (in=String->Buffer;*in;in++) {
+               if (*in=='\r' && in[1]=='\n')
+                       in++;
+               if (*in=='\r' || *in=='\n')
+                       *out++='\n';
+               else
+                       *out++=*in;
+               }
+       *out='\0';
+       
+       /* Print all completed lines */
+       if ((out=strrchr(out_base,'\n'))) {
+gchar *previous;
+
+               *out='\0';      /* cut off the rest of string */
+
+               if (!KdpPrintString_buffer)
+                       previous=NULL;
+               else {
+                       previous=g_string_free(KdpPrintString_buffer,
+                                       FALSE);  /* free_segment */
+                       KdpPrintString_buffer=NULL;
+                       }
+               g_message("KdpPrintString: %s%s",       /* newline is appended by g_message() */
+                               (!previous ? "" : previous),
+                               out_base);
+               if (previous)
+                       g_free(previous);
+
+               out_base=out+1; /* leave the rest of string (if any) */
+               }
+
+       /* store/append the remaining rest of string w/o newline */
+       if (*out_base)
+               KdpPrintString_buffer=(!KdpPrintString_buffer ? g_string_new(out_base)
+                               : g_string_append(KdpPrintString_buffer,out_base));
+
+       return (ULONG)String->Length;
+}
diff --git a/src/libcaptive/ke/Makefile.am b/src/libcaptive/ke/Makefile.am
new file mode 100644 (file)
index 0000000..127fe9b
--- /dev/null
@@ -0,0 +1,41 @@
+# $Id$
+# automake source for the reactos's ke/ emulation of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libke.la
+libke_la_SOURCES= \
+               bug.c \
+               event.c \
+               kthread.c \
+               spinlock.c
+
+EXTRA_DIST+= \
+               $(noinst_SCRIPTS) \
+               exports.captivesym
+
+# Generate exports.c automatically from exports.captivesym by captivesym.pl
+noinst_SCRIPTS=captivesym.pl
+
+BUILT_SOURCES+=exports.c
+CLEANFILES+=exports.c
+libke_la_SOURCES+=exports.c
+
+exports.c: exports.captivesym captivesym.pl
+       perl captivesym.pl $< >$@
diff --git a/src/libcaptive/ke/bug.c b/src/libcaptive/ke/bug.c
new file mode 100644 (file)
index 0000000..1612704
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$
+ * reactos internal errors handling by the emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/ddk/kefuncs.h"       /* self */
+#include <glib/gmessages.h>
+
+
+/**
+ * KeBugCheck:
+ * @BugCheckCode: Error code to report.
+ *
+ * Report fatal kernel bug. This call never returns.
+ */
+VOID STDCALL KeBugCheck(ULONG BugCheckCode)
+{
+       /* FIXME: Search for BugCheckCode's message text
+        *  by in RT_MESSAGETABLE as done by reactos/ntoskrnl/ke/bug.c/KeBugCheckEx()
+        */
+       g_error("KeBugCheck: 0x%08lX",BugCheckCode);
+       g_assert_not_reached();
+}
diff --git a/src/libcaptive/ke/captivesym.pl b/src/libcaptive/ke/captivesym.pl
new file mode 100755 (executable)
index 0000000..68c8b26
--- /dev/null
@@ -0,0 +1,162 @@
+#! /usr/bin/perl
+# 
+# $Id$
+# Generate source files based on .captivesym symbol file
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+use vars qw($VERSION);
+$VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
+use strict;
+use warnings;
+
+
+# read source
+my %module;    # $module{'module'}{'symbol'}='value'
+my %symbol;    # $symbol{'symbol'}='value'
+my %include;   # $include{'"include_filename"'}=['value1','value2']
+while (<>) {
+       chomp;
+       next if /^\s*$/;        # empty
+       next if /^\s*#.*/;      # comment
+       my($module,$symbol,$include,$value)=(/^\s*(\S+)\s+(\S+)(?:\s+(["<][\S^"<>]+[">]))?(?:\s+([\S^"<>]+))?\s*$/);
+       die "Invalid line" if !defined $symbol;
+       $value=$symbol if !defined $value;
+       $value=undef() if $value eq "undef";
+       push @{$include{$include}},$value if defined $value;
+       die "Symbol already exists: $symbol" if exists $symbol{$symbol};
+       $module{$module}{$symbol}=$value;
+       $symbol{$symbol}=$value;
+       }
+
+# file header
+print <<"HERE";
+/* File generated automatically by captivesym.pl from @ARGV */
+/* DO NOT EDIT! */
+
+#include "config.h"
+
+#include "captive/ldr.h"       /* self */
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include <glib/gmacros.h>
+
+
+HERE
+
+# required include files
+print map({
+               my $include=$_;
+               ("#include $include\t/* for ",
+               join(",",map("$_()",sort @{$include{$include}})),
+               " */\n");
+               } sort keys(%include)),
+               "\n\n";
+
+# undefined symbol stubs
+my $symbols_undef=0;
+for my $symbol (sort grep({ !defined $symbol{$_} } keys(%symbol))) {
+       print <<"HERE";
+static void captive_sym_undef_$symbol(void)
+{
+       g_error("%s: Function '$symbol' NOT IMPLEMENTED",G_STRLOC);
+}
+HERE
+       $symbols_undef++;
+       }
+
+# export function captive_kernel_exports()
+print <<"HERE";
+
+gboolean captive_kernel_exports(void)
+{
+gboolean errbool;
+
+HERE
+while (my($module,$moduleref)=each(%module)) {
+       print <<"HERE";
+       errbool=captive_ModuleList_add_builtin("$module",
+HERE
+       while (my($symbol,$value)=each(%$moduleref)) {
+               print "\t\t\t\"$symbol\",&",
+                               (defined $value ? $value : "captive_sym_undef_$symbol"),
+                               ",\n";
+               }
+       print <<"HERE";
+                       NULL);
+       g_return_val_if_fail(errbool,FALSE);
+
+HERE
+       }
+print <<"HERE";
+       return TRUE;
+}
+HERE
+
+# exit
+print STDERR "$0: Processed ".scalar(keys(%module))." modules, ".scalar(keys(%symbol))." symbols",
+               " (".int(100*(1-$symbols_undef/scalar(keys(%symbol)))).'%'." implemented)\n";
+print STDERR "$0: warning: $symbols_undef symbols are NOT IMPLEMENTED yet!\n" if $symbols_undef;
+exit 0;
+
+
+__END__
+
+=head1 NAME
+
+captivesym.pl - Generate source files based on .captivesym symbol file
+
+=head1 SYNOPSIS
+
+./captivesym.pl exports.captivesym E<gt>exports.c
+
+=head1 DESCRIPTION
+
+Source lines consist of lines with whitespace-separated
+(B<module>,B<symbol>,[B<include>],[B<value>]) items.
+
+=over
+
+=item include
+
+Optional B<include> field must be quoted in "/" or E<lt>/E<gt> quoting.
+
+=item value
+
+Optional B<value> field defaults to B<symbol> value.
+B<value> can be defined as "C<undef>" - such reference is passed to stub
+function displaying C<g_error()> message.
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+
+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; exactly version 2 of June 1991 is required
+
+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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+=cut
diff --git a/src/libcaptive/ke/event.c b/src/libcaptive/ke/event.c
new file mode 100644 (file)
index 0000000..44f040c
--- /dev/null
@@ -0,0 +1,37 @@
+/* $Id$
+ * reactos events emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/ddk/kefuncs.h"       /* self */
+
+
+/**
+ * KeInitializeEvent:
+ * @Event: Event to initialize.
+ * @Type: %NotificationEvent or %SynchronizationEvent.
+ * @State: Initial state.
+ *
+ * Initalizes a kernel event. Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now.
+ */
+VOID STDCALL KeInitializeEvent(PKEVENT Event,EVENT_TYPE Type,BOOLEAN State)
+{
+       /* TODO:thread */
+}
diff --git a/src/libcaptive/ke/exports.captivesym b/src/libcaptive/ke/exports.captivesym
new file mode 100644 (file)
index 0000000..ce3565e
--- /dev/null
@@ -0,0 +1,151 @@
+# $Id$
+# List symbols exported by libcaptive to reactos; see doc of captivesym.pl
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+ntoskrnl.exe   ObfDereferenceObject    undef
+ntoskrnl.exe   CcPurgeCacheSection     undef
+ntoskrnl.exe   RtlTimeFieldsToTime     undef
+ntoskrnl.exe   CcSetFileSizes  undef
+ntoskrnl.exe   CcInitializeCacheMap    undef
+ntoskrnl.exe   IoCreateStreamFileObject        undef
+ntoskrnl.exe   _allmul undef
+ntoskrnl.exe   CcUninitializeCacheMap  undef
+ntoskrnl.exe   CcMdlReadComplete       undef
+ntoskrnl.exe   MmFlushImageSection     undef
+ntoskrnl.exe   KeBugCheckEx    undef
+ntoskrnl.exe   FsRtlIsNtstatusExpected undef
+ntoskrnl.exe   IofCompleteRequest      undef
+ntoskrnl.exe   IoSetTopLevelIrp        undef
+ntoskrnl.exe   IoGetStackLimits        undef
+ntoskrnl.exe   IoGetTopLevelIrp        undef
+ntoskrnl.exe   FsRtlFastCheckLockForRead       undef
+ntoskrnl.exe   IoGetCurrentProcess     undef
+ntoskrnl.exe   IoRaiseHardError        undef
+ntoskrnl.exe   IoSetDeviceToVerify     undef
+ntoskrnl.exe   IoGetDeviceToVerify     undef
+ntoskrnl.exe   KeLeaveCriticalRegion   undef
+ntoskrnl.exe   IoIsOperationSynchronous        undef
+ntoskrnl.exe   KeEnterCriticalRegion   undef
+ntoskrnl.exe   IoDeleteDevice  undef
+ntoskrnl.exe   IoUnregisterFileSystem  undef
+ntoskrnl.exe   ExDeleteResourceLite    undef
+ntoskrnl.exe   IoFreeWorkItem  undef
+ntoskrnl.exe   MmQuerySystemSize       undef
+ntoskrnl.exe   IoAllocateWorkItem      undef
+ntoskrnl.exe   KeInitializeEvent       undef
+ntoskrnl.exe   ExInitializeResourceLite        undef
+ntoskrnl.exe   FsRtlCopyRead   undef
+ntoskrnl.exe   ObfReferenceObject      undef
+ntoskrnl.exe   IoRegisterFileSystem    undef
+ntoskrnl.exe   IoRegisterShutdownNotification  "reactos/ddk/iofuncs.h"
+ntoskrnl.exe   IoCreateDevice  "reactos/ddk/iofuncs.h"
+ntoskrnl.exe   RtlInitUnicodeString    "reactos/ddk/rtl.h"
+ntoskrnl.exe   FsRtlNotifyVolumeEvent  undef
+ntoskrnl.exe   IoRemoveShareAccess     undef
+ntoskrnl.exe   IoReleaseVpbSpinLock    undef
+ntoskrnl.exe   IoAcquireVpbSpinLock    undef
+ntoskrnl.exe   FsRtlNotifyCleanup      undef
+ntoskrnl.exe   FsRtlOplockIsFastIoPossible     undef
+ntoskrnl.exe   FsRtlFastUnlockAll      undef
+ntoskrnl.exe   IoGetRequestorProcess   undef
+ntoskrnl.exe   FsRtlCheckOplock        undef
+ntoskrnl.exe   ExAcquireResourceExclusiveLite  undef
+ntoskrnl.exe   IoQueueWorkItem undef
+ntoskrnl.exe   FsRtlDoesNameContainWildCards   undef
+ntoskrnl.exe   memmove undef
+ntoskrnl.exe   IoUpdateShareAccess     undef
+ntoskrnl.exe   IoSetShareAccess        undef
+ntoskrnl.exe   IoCheckShareAccess      undef
+ntoskrnl.exe   FsRtlCurrentBatchOplock undef
+ntoskrnl.exe   _abnormal_termination   undef
+ntoskrnl.exe   IofCallDriver   undef
+ntoskrnl.exe   FsRtlNormalizeNtstatus  undef
+ntoskrnl.exe   KeWaitForSingleObject   undef
+ntoskrnl.exe   IoBuildSynchronousFsdRequest    undef
+ntoskrnl.exe   KeGetCurrentThread      undef
+ntoskrnl.exe   MmProbeAndLockPages     undef
+ntoskrnl.exe   IoAllocateMdl   undef
+ntoskrnl.exe   IoBuildDeviceIoControlRequest   undef
+ntoskrnl.exe   MmBuildMdlForNonPagedPool       undef
+ntoskrnl.exe   _alldiv undef
+ntoskrnl.exe   IoFreeIrp       undef
+ntoskrnl.exe   KeClearEvent    undef
+ntoskrnl.exe   KeSetEvent      undef
+ntoskrnl.exe   ExReleaseResourceForThreadLite  undef
+ntoskrnl.exe   IoBuildPartialMdl       undef
+ntoskrnl.exe   IoMakeAssociatedIrp     undef
+ntoskrnl.exe   MmMapLockedPagesSpecifyCache    undef
+ntoskrnl.exe   FsRtlNotifyFullChangeDirectory  undef
+ntoskrnl.exe   RtlUpcaseUnicodeString  undef
+ntoskrnl.exe   RtlOemToUnicodeN        undef
+ntoskrnl.exe   CcMapData       undef
+ntoskrnl.exe   ExAcquireResourceSharedLite     undef
+ntoskrnl.exe   CcWaitForCurrentLazyWriterActivity      undef
+ntoskrnl.exe   FsRtlOplockFsctrl       undef
+ntoskrnl.exe   ObReferenceObjectByHandle       undef
+ntoskrnl.exe   IoFileObjectType        undef
+ntoskrnl.exe   SeSinglePrivilegeCheck  undef
+ntoskrnl.exe   KeInitializeSpinLock    undef
+ntoskrnl.exe   RtlOemStringToCountedUnicodeString      undef
+ntoskrnl.exe   FsRtlProcessFileLock    undef
+ntoskrnl.exe   FsRtlPrivateLock        undef
+ntoskrnl.exe   FsRtlFastUnlockSingle   undef
+ntoskrnl.exe   FsRtlFastUnlockAllByKey undef
+ntoskrnl.exe   FsRtlIsFatDbcsLegal     undef
+ntoskrnl.exe   RtlUnicodeStringToCountedOemString      undef
+ntoskrnl.exe   RtlFreeOemString        undef
+ntoskrnl.exe   NlsOemLeadByteInfo      undef
+ntoskrnl.exe   NlsMbOemCodePageTag     undef
+ntoskrnl.exe   RtlUnicodeStringToOemString     undef
+ntoskrnl.exe   RtlGenerate8dot3Name    undef
+ntoskrnl.exe   FsRtlIsNameInExpression undef
+ntoskrnl.exe   RtlCompareMemory        undef
+ntoskrnl.exe   RtlDelete       undef
+ntoskrnl.exe   RtlSplay        undef
+ntoskrnl.exe   CcMdlRead       undef
+ntoskrnl.exe   CcCopyRead      undef
+ntoskrnl.exe   CcSetReadAheadGranularity       undef
+ntoskrnl.exe   FsRtlCheckLockForReadAccess     undef
+ntoskrnl.exe   ExAcquireSharedStarveExclusive  undef
+ntoskrnl.exe   FsRtlNotifyUninitializeSync     undef
+ntoskrnl.exe   RtlInsertElementGenericTable    undef
+ntoskrnl.exe   FsRtlAllocateFileLock   undef
+ntoskrnl.exe   RtlLookupElementGenericTable    undef
+ntoskrnl.exe   RtlEnumerateGenericTableWithoutSplaying undef
+ntoskrnl.exe   RtlInitializeGenericTable       undef
+ntoskrnl.exe   FsRtlNotifyInitializeSync       undef
+ntoskrnl.exe   FsRtlUninitializeOplock undef
+ntoskrnl.exe   FsRtlFreeFileLock       undef
+ntoskrnl.exe   FsRtlTeardownPerStreamContexts  undef
+ntoskrnl.exe   RtlDeleteElementGenericTable    undef
+ntoskrnl.exe   IoSetHardErrorOrVerifyDevice    undef
+ntoskrnl.exe   IoVerifyVolume  undef
+ntoskrnl.exe   _allshr undef
+ntoskrnl.exe   ExQueueWorkItem undef
+ntoskrnl.exe   _except_handler3        undef
+ntoskrnl.exe   ExRaiseStatus   undef
+ntoskrnl.exe   ExReleaseResourceLite   undef
+ntoskrnl.exe   CcUnpinData     undef
+ntoskrnl.exe   ExAllocatePoolWithTag   undef
+ntoskrnl.exe   IoFreeMdl       undef
+ntoskrnl.exe   ExFreePoolWithTag       undef
+
+hal.dll        KfReleaseSpinLock       undef
+hal.dll        KeGetCurrentIrql        undef
+hal.dll        ExAcquireFastMutex      undef
+hal.dll        ExReleaseFastMutex      undef
+hal.dll        KfAcquireSpinLock       undef
diff --git a/src/libcaptive/ke/kthread.c b/src/libcaptive/ke/kthread.c
new file mode 100644 (file)
index 0000000..0c881ad
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$
+ * reactos kernel-part of threading emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/internal/ps.h"       /* self */
+#include <glib/gmessages.h>
+
+
+/**
+ * KeInitializeThread:
+ * @Process: Initialized #PKPROCESS.
+ * @Thread: Thread structure to be initialized.
+ * @First: @Thread is the first single system thread .
+ *
+ * Initalizes a thread. Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now. We hope it won't hurt.
+ */
+VOID KeInitializeThread(PKPROCESS Process,PKTHREAD Thread,BOOLEAN First)
+{
+       /* TODO:thread */
+       g_return_if_fail(First==TRUE);
+}
diff --git a/src/libcaptive/ke/spinlock.c b/src/libcaptive/ke/spinlock.c
new file mode 100644 (file)
index 0000000..aa403fd
--- /dev/null
@@ -0,0 +1,35 @@
+/* $Id$
+ * reactos spinlock emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "reactos/ddk/kefuncs.h"       /* self */
+
+
+/**
+ * KeInitializeSpinLock:
+ * @SpinLock: Caller supplied storage for the spinlock.
+ *
+ * Initalizes a spinlock. Currently libcaptive doesn't use multithreading
+ * and thus this function is a NOP now. #GMutex would be needed otherwise.
+ */
+VOID STDCALL KeInitializeSpinLock(PKSPIN_LOCK SpinLock)
+{
+       /* TODO:thread */
+}
diff --git a/src/libcaptive/ldr/Makefile.am b/src/libcaptive/ldr/Makefile.am
new file mode 100644 (file)
index 0000000..36d77f8
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for the reactos's loader emulation of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libldr.la
+libldr_la_SOURCES= \
+               loader.c
diff --git a/src/libcaptive/ldr/loader.c b/src/libcaptive/ldr/loader.c
new file mode 100644 (file)
index 0000000..6819d18
--- /dev/null
@@ -0,0 +1,260 @@
+/* $Id$
+ * reactos ldr/ (loader) emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/ldr.h"       /* self */
+#include "reactos/internal/ldr.h"      /* self */
+#include "captive/unicode.h"
+#include "captive/file.h"
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include <glib/gmem.h>
+#include "reactos/napi/types.h"
+#include "reactos/internal/kd.h"       /* for KDB_LOADDRIVER_HOOK */
+#include <fcntl.h>
+#include <sys/mman.h>  /* for PROT_READ, MAP_SHARED */
+#include "captive/macros.h"
+#include <stdarg.h>
+#include "reactos/ddk/rtl.h"   /* for InsertTailList() */
+#include "reactos/internal/debug.h"    /* for assert() */
+#include <glib/gutils.h>       /* for g_path_get_basename() */
+
+
+/* reactos/ntoskrnl/ldr/loader.c file-scope global declaration: */
+NTSTATUS LdrProcessModule(PVOID ModuleLoadBase,PUNICODE_STRING ModuleName,PMODULE_OBJECT *ModuleObject);
+
+
+/**
+ * LdrLoadModule:
+ * @Filename: Filename of module to load based on host OS disk.
+ * Loading of already loaded module is forbidden.
+ * @ModuleObject: Returns initialized module object.
+ *
+ * Load and initialize module to reactos using host OS functions.
+ *
+ * Returns: STATUS_SUCCESS if the module was loaded successfuly during the call.
+ */
+NTSTATUS LdrLoadModule(PUNICODE_STRING Filename,PMODULE_OBJECT *ModuleObjectp)
+{
+PVOID ModuleLoadBase;
+PMODULE_OBJECT Module;
+NTSTATUS err;
+
+       *ModuleObjectp=NULL;
+
+       /* Open the Module */
+       ModuleLoadBase=captive_file_mmap(
+                       NULL,   /* lenp */
+                       captive_UnicodeString_to_utf8_alloca(Filename), /* path */
+                       O_RDONLY,       /* open_flags */
+                       PROT_READ,      /* mmap_prot */
+                       MAP_SHARED);    /* mmap_flags */
+       /* FIXME: convert errno instead of STATUS_INSUFFICIENT_RESOURCES */
+       g_return_val_if_fail(ModuleLoadBase!=NULL,STATUS_INSUFFICIENT_RESOURCES);
+
+       /* examine/relocate the module */
+       err=LdrProcessModule(ModuleLoadBase,Filename,&Module);
+       if (!NT_SUCCESS(err)) {
+               g_error("LdrLoadModule(): LdrProcessModule()=0x%08lX",err);
+               goto err_captive_file_munmap;
+               }
+
+       /* we were successful */
+       captive_file_munmap(ModuleLoadBase);
+       *ModuleObjectp=Module;
+
+       /* Hook for KDB on loading a driver. */
+       KDB_LOADDRIVER_HOOK(Filename,Module);
+
+       return STATUS_SUCCESS;
+
+       /* Error recoveries */
+err_captive_file_munmap:
+       captive_file_munmap(ModuleLoadBase);
+
+       g_return_val_if_reached(err);
+}
+
+
+/**
+ * captive_LdrpLoadAndCallImage:
+ * @ModuleObjectp: Returns PMODULE_OBJECT successfuly loaded.
+ * @ModuleName: Filename of module to load based on host OS disk.
+ * Loading of already loaded module is forbidden despite original
+ * LdrpLoadAndCallImage().
+ * @DriverEntry_DriverObject: argument #DriverObject of #PDRIVER_INITIALIZE call.
+ * @DriverEntry_RegistryPath: argument #RegistryPath of #PDRIVER_INITIALIZE call.
+ *
+ * Corresponds to reactos LdrpLoadAndCallImage() but it also provides arguments
+ * to pass to #PDRIVER_INITIALIZE call of module driver initialization.
+ *
+ * Returns: STATUS_SUCCESS if the driver module was loaded and initialized
+ * successfuly during this call. Ignore returned @ModuleObjectp if function failed.
+ */
+NTSTATUS captive_LdrpLoadAndCallImage(PMODULE_OBJECT *ModuleObjectp,PUNICODE_STRING ModuleName,
+               PDRIVER_OBJECT DriverEntry_DriverObject,PUNICODE_STRING DriverEntry_RegistryPath)
+{
+PDRIVER_INITIALIZE DriverEntry;
+PMODULE_OBJECT ModuleObject_tmp;
+NTSTATUS err;
+
+       /* check for duplicity */
+       g_return_val_if_fail(LdrGetModuleObject(ModuleName)==NULL,STATUS_IMAGE_ALREADY_LOADED);
+
+       /* provide our temporary storage if the caller doesn't want to know ModuleObject address */
+       if (!ModuleObjectp)
+               ModuleObjectp=&ModuleObject_tmp;
+
+       /* load the module */
+       err=LdrLoadModule(ModuleName,ModuleObjectp);
+       g_return_val_if_fail(NT_SUCCESS(err),err);
+
+       /* initialize the module */
+       DriverEntry=(PDRIVER_INITIALIZE)(*ModuleObjectp)->EntryPoint;
+       err=(*DriverEntry)(DriverEntry_DriverObject,DriverEntry_RegistryPath);
+       if (!NT_SUCCESS(err))
+               goto err_LdrUnloadModule;
+
+       /* assumed STATUS_SUCCESS */
+       return err;
+
+err_LdrUnloadModule:
+       /* errors ignored */
+       LdrUnloadModule(*ModuleObjectp);
+       *ModuleObjectp=NULL;
+/* err: */
+       g_return_val_if_reached(err);
+}
+
+
+/**
+ * captive_ModuleList_add_builtin:
+ * @FullName_utf8: String to fill in #PMODULE_OBJECT->FullName.
+ * @...: (const gchar *sym_name,void *sym_val) symbol list terminated by %NULL.
+ *
+ * Adds simulated built-in module to #ModuleListHead module list.
+ * It can be used for the functionality of reactos/ntoskrnl/ldr/loader.c/LdrInitModuleManagement().
+ * libcaptive does not support Ordinals - we just pretend liner (%0-based)
+ * Ordinal numbers of the functions in given @... stdargs order.
+ *
+ * Returns: %TRUE if the module was successfuly added.
+ */
+gboolean captive_ModuleList_add_builtin(const gchar *FullName_utf8,...)
+{
+MODULE_OBJECT *ModuleObject;
+BOOLEAN errbool;
+va_list ap;
+const gchar *sym_name;
+const void *sym_val;
+gchar *basename_utf8;
+IMAGE_DOS_HEADER *DosHeader;
+IMAGE_NT_HEADERS *NTHeaders;
+IMAGE_EXPORT_DIRECTORY *ExportDir;
+guint symi,symN;       /* index,number of passed stdarg sym_name/sym_val pairs */
+ptrdiff_t *NameList;   /* filled by sym_name; MODULEOBJECT_BASE_OFFSET()ed */
+WORD *OrdinalList;     /* linear list - libcaptive doesn't support Ordinals */
+ptrdiff_t *FunctionList;       /* filled by sym_val; MODULEOBJECT_BASE_OFFSET()ed */
+
+       g_return_val_if_fail(FullName_utf8!=NULL,FALSE);
+
+       captive_new0(ModuleObject);
+       /* A lot of offsets in the structures are relative to ModuleObject->Base */
+#define MODULEOBJECT_BASE_OFFSET(addr) ((ptrdiff_t)((char *)addr-(char *)ModuleObject->Base))
+
+       ModuleObject->Flags = MODULE_FLAG_PE;
+
+       /* fill ModuleObject->FullName
+        * ModuleObject->FullName should be probably "\\SYSTEM32\\..." style but
+        * we put there '/'-based UNIX filenames in libcaptive.
+        */
+       errbool=RtlCreateUnicodeString(&ModuleObject->FullName,captive_utf8_to_UnicodeString_alloca(FullName_utf8)->Buffer);
+       if (!errbool) {
+               g_error("captive_ModuleList_add_builtin: RtlCreateUnicodeString()==FALSE");
+               goto err_g_free_ModuleObject;
+               }
+
+       /* fill ModuleObject->BaseName
+        * reactos/ntoskrnl/ldr/loader.c/LdrpBuildModuleBaseName() does this one
+        * but it is 'static' for that file and also it is stricly backslash based.
+        * ModuleObject->FullName should be probably "\\SYSTEM32\\..." style but
+        * we put there '/'-based UNIX filenames in libcaptive.
+        */
+       basename_utf8=g_path_get_basename(FullName_utf8);
+       errbool=RtlCreateUnicodeString(&ModuleObject->BaseName,captive_utf8_to_UnicodeString_alloca(basename_utf8)->Buffer);
+       g_free(basename_utf8);
+       if (!errbool) {
+               g_error("captive_ModuleList_add_builtin: RtlCreateUnicodeString()==FALSE");
+               goto err_g_free_ModuleObject;
+               }
+
+       /* We must satisfy reactos/ntoskrnl/ldr/rtl.c/RtlImageDirectoryEntryToData(,,IMAGE_DIRECTORY_ENTRY_EXPORT)
+        * prepare module headers
+        */
+       captive_new0(DosHeader);
+       ModuleObject->Base=DosHeader;   /* link DosHeader to ModuleObject */
+       DosHeader->e_magic=IMAGE_DOS_MAGIC;
+       captive_new0(NTHeaders);
+       DosHeader->e_lfanew=MODULEOBJECT_BASE_OFFSET(NTHeaders);        /* link NTHeaders to DosHeader */
+       NTHeaders->Signature=IMAGE_PE_MAGIC;
+       NTHeaders->OptionalHeader.NumberOfRvaAndSizes=IMAGE_DIRECTORY_ENTRY_EXPORT+1;
+       NTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size
+                       =sizeof(*ExportDir);    /* in bytes; just prevent LdrPEFixupForward() invocation */
+       captive_new0(ExportDir);
+       NTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress
+                       =MODULEOBJECT_BASE_OFFSET(ExportDir);   /* link ExportDir to NTHeaders */
+       ExportDir->Base=0;      /* base Ordinal number; Ordinals are not supported by libcaptive */
+
+       /* count the number of symbols */
+       va_start(ap,FullName_utf8);
+       for (symN=0;captive_va_arg(sym_name,ap);symN++)
+               captive_va_arg(sym_val,ap);
+       va_end(ap);
+       ExportDir->NumberOfNames=symN;
+       ExportDir->NumberOfFunctions=symN;
+
+       /* allocate and link the symbol tables */
+       captive_newn(NameList,symN);
+       ExportDir->AddressOfNames=(PDWORD *)MODULEOBJECT_BASE_OFFSET(NameList); /* link NameList to ExportDir */
+       captive_newn(OrdinalList,symN);
+       ExportDir->AddressOfNameOrdinals=(PWORD *)MODULEOBJECT_BASE_OFFSET(OrdinalList);        /* link OrdinalList to ExportDir */
+       captive_newn(FunctionList,symN);
+       ExportDir->AddressOfFunctions=(PDWORD *)MODULEOBJECT_BASE_OFFSET(FunctionList); /* link FunctionList to ExportDir */
+
+       /* fill in symbol tables */
+       va_start(ap,FullName_utf8);
+       for (symi=0;symi<symN;symi++) {
+               captive_va_arg(sym_name,ap);
+               captive_va_arg(sym_val ,ap);
+               NameList[symi]=MODULEOBJECT_BASE_OFFSET(sym_name);
+               OrdinalList[symi]=symi; /* Ordinals are not supported by libcaptive */
+               FunctionList[symi]=MODULEOBJECT_BASE_OFFSET(sym_val);
+               }
+       va_end(ap);
+
+       /* successful module info build */
+       InsertTailList(&ModuleListHead,&ModuleObject->ListEntry);
+#undef MODULEOBJECT_BASE_OFFSET        /* no longer valid */
+       return TRUE;
+
+err_g_free_ModuleObject:
+       g_free(ModuleObject);
+/* err */
+       g_return_val_if_reached(FALSE);
+}
diff --git a/src/libcaptive/mm/Makefile.am b/src/libcaptive/mm/Makefile.am
new file mode 100644 (file)
index 0000000..dfac218
--- /dev/null
@@ -0,0 +1,26 @@
+# $Id$
+# automake source for the reactos's mm/ emulation of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libmm.la
+libmm_la_SOURCES= \
+               page.c \
+               pool.c \
+               section.c
diff --git a/src/libcaptive/mm/page.c b/src/libcaptive/mm/page.c
new file mode 100644 (file)
index 0000000..984b4a0
--- /dev/null
@@ -0,0 +1,218 @@
+/* $Id$
+ * reactos spinlock emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/mm.h"        /* self */
+#include "reactos/internal/mm.h"       /* self */
+#include "reactos/ntos/types.h"        /* for PVOID etc. */
+#include <glib/gmessages.h>
+#include <limits.h> /* for PAGE_size */
+#include <sys/mman.h>  /* for PROT_NONE etc. */
+#include <glib/ghash.h>
+
+
+/**
+ * captive_flProtect_to_mmap_prot:
+ * @flProtect: reactos compatible constant such as %PAGE_READWRITE.
+ *
+ * Map reactos flProtect to mprotect(2)-compatible "prot" argument.
+ *
+ * Returns: mmap(2) compatible @prot argument.
+ */
+gint captive_flProtect_to_mmap_prot(ULONG flProtect)
+{
+       flProtect&=~PAGE_NOCACHE;       /* too low level for libcaptive */
+       flProtect&=~PAGE_SYSTEM;        /* too low level for libcaptive */
+       /* FIXME: what does mean PAGE_WRITETHROUGH ? */
+       switch (flProtect) {
+               case PAGE_GUARD:             return PROT_NONE;
+               case PAGE_NOACCESS:          return PROT_NONE;
+               case PAGE_READONLY:          return PROT_READ;
+               case PAGE_READWRITE:         return PROT_READ|PROT_WRITE;
+               case PAGE_WRITECOPY:         g_return_val_if_reached(PROT_NONE);        /* FIXME: no multithreading supported */
+               case PAGE_EXECUTE_READ:      return PROT_EXEC|PROT_READ;
+               case PAGE_EXECUTE_READWRITE: return PROT_EXEC|PROT_READ|PROT_WRITE;
+               case PAGE_EXECUTE_WRITECOPY: g_return_val_if_reached(PROT_NONE);        /* FIXME: no multithreading supported */
+               }
+       g_return_val_if_reached(PROT_NONE);     /* =unsupported flags */
+}
+
+
+static GHashTable *captive_mmap_map_hash;
+
+static void captive_mmap_map_hash_init(void)
+{
+       if (captive_mmap_map_hash)
+               return;
+       captive_mmap_map_hash=g_hash_table_new(g_direct_hash,g_direct_equal);
+}
+
+/**
+ * captive_mmap_map_new:
+ * @addr: %PAGE_SIZE aligned address of memory block.
+ * %NULL value is forbidden.
+ * @len: %PAGE_SIZE aligned  length of memory block.
+ * Value %0 is permitted. Value %-1 is forbidden.
+ * @mmap_prot: Protections for the memory block as specified by @prot of mprotect(2).
+ *
+ * Initialize the protection map for the specified memory block.
+ * Any existing protections in the specified block are forbidden.
+ *
+ * This function does not do any mprotect(2) style, it just stores
+ * the settings for the later %OR operations by MmSetPageProtect().
+ * Caller is responsibel to set the same protections as the given @mmap_prot.
+ *
+ * Returns: %TRUE if the protection storage was successful.
+ */
+gboolean captive_mmap_map_new(gconstpointer addr,size_t len,int mmap_prot)
+{
+       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: addr=%p,len=%lu,mmap_prot=0x%X",G_STRLOC,addr,(gulong)len,mmap_prot);
+       g_return_val_if_fail(addr!=NULL,FALSE);
+       g_return_val_if_fail((GPOINTER_TO_UINT(addr)&(PAGE_SIZE-1))==0,FALSE);
+       g_return_val_if_fail((len&(PAGE_SIZE-1))==0,FALSE);
+       g_return_val_if_fail(mmap_prot!=-1,FALSE);
+
+       captive_mmap_map_hash_init();
+
+       while (len) {
+               g_return_val_if_fail(FALSE==g_hash_table_lookup_extended(captive_mmap_map_hash,
+                                               addr,   /* lookup_key */
+                                               NULL,   /* orig_key */
+                                               NULL),  /* value */
+                               FALSE);
+               g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: addr=%p,PAGE_SIZE=0x%X",G_STRLOC,addr,(guint)(PAGE_SIZE));
+               g_hash_table_insert(captive_mmap_map_hash,
+                               (gpointer)addr, /* key */
+                               GINT_TO_POINTER(mmap_prot));    /* value */
+
+               addr=(gconstpointer)(((const char *)addr)+PAGE_SIZE);
+               len-=PAGE_SIZE;
+               }
+
+       return TRUE;
+}
+
+
+/**
+ * captive_mmap_map_get:
+ * @addr: %PAGE_SIZE aligned address of memory block.
+ * %NULL value is forbidden.
+ *
+ * Query the protection settings at @addr address.
+ * The given @addr block of %PAGE_SIZE must be already initialized
+ * by captive_mmap_map_new().
+ *
+ * Returns: Protections of the page as specified by @prot of mprotect(2)
+ * if successful. Value %-1 if failed.
+ */
+gint captive_mmap_map_get(gconstpointer addr)
+{
+gpointer r_gpointer;
+gint r;
+
+       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: addr=%p",G_STRLOC,addr);
+       g_return_val_if_fail(addr!=NULL,-1);
+       g_return_val_if_fail((GPOINTER_TO_UINT(addr)&(PAGE_SIZE-1))==0,-1);
+
+       captive_mmap_map_hash_init();
+
+       g_return_val_if_fail(TRUE==g_hash_table_lookup_extended(captive_mmap_map_hash,
+                                       addr,   /* lookup_key */
+                                       NULL,   /* orig_key */
+                                       &r_gpointer),   /* value */
+                       -1);
+       r=GPOINTER_TO_INT(r_gpointer);
+
+       g_assert(r!=-1);
+       return r;
+}
+
+
+/**
+ * captive_mmap_map_set:
+ * @addr: %PAGE_SIZE aligned address of memory block.
+ * %NULL value is forbidden.
+ * @mmap_prot: Protections for the memory block as specified by @prot of mprotect(2).
+ *
+ * Set the protection settings at @addr address.
+ * The given @addr block of %PAGE_SIZE must be already initialized
+ * by captive_mmap_map_new().
+ *
+ * Returns: %TRUE if the protections were successfuly set.
+ */
+gboolean captive_mmap_map_set(gconstpointer addr,int mmap_prot)
+{
+       g_log(G_LOG_DOMAIN,G_LOG_LEVEL_DEBUG,"%s: addr=%p,mmap_prot=0x%X",G_STRLOC,addr,mmap_prot);
+       g_return_val_if_fail(addr!=NULL,FALSE);
+       g_return_val_if_fail((GPOINTER_TO_UINT(addr)&(PAGE_SIZE-1))==0,FALSE);
+       g_return_val_if_fail(mmap_prot!=-1,FALSE);
+
+       captive_mmap_map_hash_init();
+
+       g_return_val_if_fail(TRUE==g_hash_table_lookup_extended(captive_mmap_map_hash,
+                                       addr,   /* lookup_key */
+                                       NULL,   /* orig_key */
+                                       NULL),  /* value */
+                       FALSE);
+
+       g_hash_table_replace(captive_mmap_map_hash,
+                       (gpointer)addr, /* key */
+                       GINT_TO_POINTER(mmap_prot));    /* value */
+
+       return TRUE;
+}
+
+/**
+ * MmSetPageProtect:
+ * @Process: Attached during the execution if not %NULL. Ignored by #libcaptive.
+ * @Address: One page to modify the protecton bits of.
+ * @flProtect: Required protection flags to logically %OR to the previos ones.
+ *
+ * FIXME: Undocumented by reactos. %ORes the protection of one page located at @Address
+ * with protection flags @flProtect. Implemented by mprotect(2) by #libcaptive.
+ */
+VOID MmSetPageProtect(PEPROCESS Process,PVOID Address,ULONG flProtect)
+{
+gint mmap_prot;
+int err;
+
+       g_return_if_fail(Address!=NULL);
+
+       captive_mmap_map_hash_init();
+
+       /* 'Address' is not required to be PAGE_SIZE-aligned:
+        * reactos MmSetPageProtect() calls MmGetPageEntry(Address) with no such requirement.
+        * glib NOTE: YOU MAY NOT STORE POINTERS IN INTEGERS.
+        */
+       Address=(VOID *)(((char *)Address)-(GPOINTER_TO_UINT(Address)&(PAGE_SIZE-1)));
+       /* This may be also invalid input 'Address' */
+       g_assert(Address!=NULL);
+
+       /* Prepare and updated ORed 'mmap_prot' in captive_mmap_map storage */
+       mmap_prot=captive_flProtect_to_mmap_prot(flProtect);
+       mmap_prot|=captive_mmap_map_get(Address);
+       captive_mmap_map_set(Address,mmap_prot);
+
+       /* protect one page; reactos call cannot return error codes */
+       err=mprotect(Address,PAGE_SIZE,mmap_prot);
+       g_return_if_fail(err==0);
+
+       /* success */
+}
diff --git a/src/libcaptive/mm/pool.c b/src/libcaptive/mm/pool.c
new file mode 100644 (file)
index 0000000..53d7b7a
--- /dev/null
@@ -0,0 +1,83 @@
+/* $Id$
+ * reactos memory pools emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/mm.h"        /* self */
+#include "reactos/internal/mm.h"       /* self */
+#include "reactos/ntos/types.h"        /* for PVOID etc. */
+#include <glib/gmessages.h>
+#include <glib/gmem.h>
+
+
+/**
+ * ExAllocatePoolWithTag:
+ * @PoolType: Type of memory to allocate. Safely ignored by libcaptive as it is
+ * too low level for it.
+ * @NumberOfBytes: Size of the requested allocation. Value 0 permitted (returns %NULL).
+ * @Tag: 4-bytes of block identification for debugging purposes.
+ * Ignored by libcaptive.
+ *
+ * Allocates the specified memory block. libcaptive passes the allocation to
+ * g_malloc(). @Tag is no longer trackable for the allocated memory block.
+ * @Tag is ignored by libcaptive.
+ *
+ * Returns: Memory block base if successfuly allocated. %NULL otherwise.
+ * The allocated memory block is not cleared.
+ */
+PVOID STDCALL ExAllocatePoolWithTag(ULONG PoolType,ULONG NumberOfBytes,ULONG Tag)
+{
+       if (!NumberOfBytes)
+               return NULL;
+
+       return g_malloc(NumberOfBytes);
+}
+
+/**
+ * ExAllocatePool:
+ * @PoolType: Type of memory to allocate. Safely ignored by libcaptive as it is
+ * too low level for it.
+ * @NumberOfBytes: Size of the requested allocation. Value 0 permitted (returns %NULL).
+ *
+ * Allocates the specified memory block. Calls ExAllocatePoolWithTag() with
+ * undeterministic @Tag value.
+ *
+ * Returns: Memory block base if successfuly allocated. %NULL otherwise.
+ * The allocated memory block is not cleared.
+ */
+PVOID STDCALL ExAllocatePool(POOL_TYPE PoolType,ULONG NumberOfBytes)
+{
+       return ExAllocatePoolWithTag(PoolType,NumberOfBytes,
+                       0);     /* Tag; reactos uses TAG_NONE ('None') but it is not documented for W32 */
+}
+
+/**
+ * ExFreePool:
+ * @Block: Base address of the memory block. %NULL value is forbidden.
+ *
+ * Deallocate the given memory block. Block must be already successfuly
+ * allocated by a previous ExAllocatePool() or ExAllocatePoolWithTag() call.
+ * You can no longer assume anything about this base address / memory block.
+ */
+VOID STDCALL ExFreePool(IN PVOID Block)
+{
+       g_return_if_fail(Block!=NULL);
+
+       g_free(Block);
+}
diff --git a/src/libcaptive/mm/section.c b/src/libcaptive/mm/section.c
new file mode 100644 (file)
index 0000000..8b260a5
--- /dev/null
@@ -0,0 +1,60 @@
+/* $Id$
+ * reactos memory areas emulation of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/mm.h"        /* self, for captive_flProtect_to_mmap_prot() */
+#include "reactos/internal/mm.h"       /* self */
+#include "reactos/ntos/types.h"        /* for PVOID etc. */
+#include <glib/gmessages.h>
+#include <sys/mman.h>  /* for PROT_NONE etc. */
+
+
+/**
+ * MmAllocateSection:
+ * @Length: Length (in bytes) of the area to allocate. Does not have to be page
+ * aligned. Value 0 is forbidden.
+ *
+ * Allocates @Length area with %PAGE_READWRITE flags.
+ *
+ * Returns: Allocated address space if the allocation was successful.
+ */
+PVOID STDCALL MmAllocateSection(IN ULONG Length)
+{
+int mmap_prot=captive_flProtect_to_mmap_prot(PAGE_READWRITE);
+PVOID r;
+
+       g_return_val_if_fail(Length>0,NULL);
+
+       Length=(Length|(PAGE_SIZE-1))+1;        /* round up to PAGE_SIZE */
+
+       r=mmap(
+                       NULL,   /* start */
+                       Length, /* length */
+                       mmap_prot,
+                       MAP_PRIVATE|MAP_ANONYMOUS,      /* flags */
+                       -1,     /* fd; ignored due to MAP_ANONYMOUS */
+                       0);     /* offset; ignored due to MAP_ANONYMOUS */
+       g_return_val_if_fail(r!=NULL,NULL);
+
+       captive_mmap_map_new(r,Length,mmap_prot);
+
+       /* assumed r!=NULL */
+       return r;
+}
diff --git a/src/libcaptive/ps/Makefile.am b/src/libcaptive/ps/Makefile.am
new file mode 100644 (file)
index 0000000..4fa1e9b
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for the reactos's ps/ emulation of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=libps.la
+libps_la_SOURCES= \
+               ps_reactos.c
diff --git a/src/libcaptive/ps/ps_reactos.c b/src/libcaptive/ps/ps_reactos.c
new file mode 100644 (file)
index 0000000..6233853
--- /dev/null
@@ -0,0 +1,45 @@
+/* $Id$
+ * reactos processor emulation for support of ntoskrnl of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/ps_reactos.h"        /* self */
+
+
+static captive_KPCR captive_KeGetCurrentKPCR_KPCR_static;
+
+/**
+ * captive_KeGetCurrentKPCR:
+ *
+ * Returns the #PCR (Processor Control Region) structure for the
+ * current CPU.
+ * Currently libcaptive doesn't use multithreading
+ * and thus this function returns a constant pointer to one static structure.
+ *
+ * Returns: #captive_PKPCR type pointer to valid #captive_KPCR.
+ * This structure IS NOT binary compatible with reactos - you SHOULD NOT
+ * export this symbol for binary W32 modules. Anyone using this function
+ * is very low-level based and you would probably find many other
+ * compatibility problems afterwards - replace of such function is recommended.
+ */
+captive_PKPCR captive_KeGetCurrentKPCR(void)
+{
+       /* TODO:thread */
+       return &captive_KeGetCurrentKPCR_KPCR_static;
+}
diff --git a/src/libcaptive/reactos/Makefile-reactos.am b/src/libcaptive/reactos/Makefile-reactos.am
new file mode 100644 (file)
index 0000000..98a05fe
--- /dev/null
@@ -0,0 +1,32 @@
+# $Id$
+# automake source include for the autocopying of ReactOS part of libcaptive
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# assume such include for $(top_srcdir)/reactos/ as it is forbidden to do an include twice
+#include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+# Turn on GNU world compatibility with frenzy reactos
+# See the compat.h below for the details
+# We will also permit direct including of reactos files
+# (=without $(top_srcdir)/src/libcaptive/include/reactos/ wrappers) by this
+# This preinclude is tested in include/roscfg.h which will fortunately gets
+# included by some reactos include file
+INCLUDES+=-DREACTOS_COMPAT -include $(top_srcdir)/src/libcaptive/include/reactos/compat.h
+
+%.c: $(top_srcdir)/reactos/$(subst src/libcaptive/reactos/,,$(subdir))/%.c
+       @$(RM) $@
+       $(LN_S) $< $@
diff --git a/src/libcaptive/reactos/Makefile.am b/src/libcaptive/reactos/Makefile.am
new file mode 100644 (file)
index 0000000..88dd8bd
--- /dev/null
@@ -0,0 +1,36 @@
+# $Id$
+# automake source for the topsrclevel of ReactOS part of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+# Take care to not to have -I. before -I$(top_srcdir)/reactos/...
+# to not to loop itself during inclusing of original include files
+# we are overriding here; it should be taken care about it in $(top_srcdir)/Makefile-head.am
+# and $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am .
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+
+SUBDIRS=include ntoskrnl
+
+EXTRA_DIST+= \
+               Makefile-reactos.am
+
+noinst_LTLIBRARIES=libreactos.la
+libreactos_la_LIBADD= \
+               ntoskrnl/libntoskrnl.la
+libreactos_la_SOURCES=
diff --git a/src/libcaptive/reactos/include/Makefile.am b/src/libcaptive/reactos/include/Makefile.am
new file mode 100644 (file)
index 0000000..c9b8d8a
--- /dev/null
@@ -0,0 +1,24 @@
+# $Id$
+# automake source for the include dir ReactOS part of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+
+noinst_HEADERS+= \
+               roscfg.h
diff --git a/src/libcaptive/reactos/include/roscfg.h b/src/libcaptive/reactos/include/roscfg.h
new file mode 100644 (file)
index 0000000..f04bbb3
--- /dev/null
@@ -0,0 +1,39 @@
+/* $Id$
+ * Include file simulating original ReactOS configuration file for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+/* captive project never includes this file directly - it may get included
+ * only from some .h/.c file of reactos sources.
+ * These sources have mandatory $(top_srcdir)/src/libcaptive/include/reactos/
+ * wrappers protection (either by direct gcc "-include" option from Makefile-reactos.am
+ * or by mandatory "reactos/..." wrappers inclusion from regular source files.
+ */
+#ifndef _CAPTIVE_REACTOS_COMPAT_H
+#error "$(top_srcdir)/src/libcaptive/include/reactos/compat.h pre-include NOT PRESENT!"
+#endif
+
+#ifndef REACTOS_COMPAT
+#error "REACTOS_COMPAT of $(top_srcdir)/src/libcaptive/include/reactos/compat.h NOT ACTIVE!"
+#endif
+
+
+#ifndef _CAPTIVE_REACTOS_ROSCFG_H
+#define _CAPTIVE_REACTOS_ROSCFG_H 1
+
+
+#endif /* _CAPTIVE_REACTOS_ROSCFG_H */
diff --git a/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am b/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
new file mode 100644 (file)
index 0000000..c1a1e8f
--- /dev/null
@@ -0,0 +1,19 @@
+# $Id$
+# automake source include for compilation of "ntoskrnl" ReactOS part of libcaptive
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+INCLUDES+=-D__NTOSKRNL__
diff --git a/src/libcaptive/reactos/ntoskrnl/Makefile.am b/src/libcaptive/reactos/ntoskrnl/Makefile.am
new file mode 100644 (file)
index 0000000..33fa5ed
--- /dev/null
@@ -0,0 +1,40 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+SUBDIRS=dbg ex io ke ldr ob ps rtl se
+
+EXTRA_DIST+= \
+               Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libntoskrnl.la
+libntoskrnl_la_LIBADD= \
+               dbg/libdbg.la \
+               ex/libex.la \
+               io/libio.la \
+               ke/libke.la \
+               ldr/libldr.la \
+               ob/libob.la \
+               ps/libps.la \
+               rtl/librtl.la \
+               se/libse.la
+libntoskrnl_la_SOURCES=
diff --git a/src/libcaptive/reactos/ntoskrnl/dbg/Makefile.am b/src/libcaptive/reactos/ntoskrnl/dbg/Makefile.am
new file mode 100644 (file)
index 0000000..2ac00b4
--- /dev/null
@@ -0,0 +1,27 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" debug support ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libdbg.la
+libdbg_la_SOURCES= \
+               print.c
+BUILT_SOURCES+=$(libdbg_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/ex/Makefile.am b/src/libcaptive/reactos/ntoskrnl/ex/Makefile.am
new file mode 100644 (file)
index 0000000..a4ef56c
--- /dev/null
@@ -0,0 +1,27 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" ex/ ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libex.la
+libex_la_SOURCES= \
+               list.c
+BUILT_SOURCES+=$(libex_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/io/Makefile.am b/src/libcaptive/reactos/ntoskrnl/io/Makefile.am
new file mode 100644 (file)
index 0000000..a97d6bf
--- /dev/null
@@ -0,0 +1,30 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" I/O ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libio.la
+libio_la_SOURCES= \
+               device.c \
+               iomgr.c \
+               shutdown.c \
+               vpb.c
+BUILT_SOURCES+=$(libio_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/ke/Makefile.am b/src/libcaptive/reactos/ntoskrnl/ke/Makefile.am
new file mode 100644 (file)
index 0000000..c031cb1
--- /dev/null
@@ -0,0 +1,27 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" kernel (ke/) ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libke.la
+libke_la_SOURCES= \
+               kqueue.c
+BUILT_SOURCES+=$(libke_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/ldr/Makefile.am b/src/libcaptive/reactos/ntoskrnl/ldr/Makefile.am
new file mode 100644 (file)
index 0000000..1d11628
--- /dev/null
@@ -0,0 +1,28 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" loaders ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libldr.la
+libldr_la_SOURCES= \
+               loader.c \
+               rtl.c
+BUILT_SOURCES+=$(libldr_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/ob/Makefile.am b/src/libcaptive/reactos/ntoskrnl/ob/Makefile.am
new file mode 100644 (file)
index 0000000..c5e70bd
--- /dev/null
@@ -0,0 +1,29 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" object (ob/) ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libob.la
+libob_la_SOURCES= \
+               handle.c \
+               namespc.c \
+               object.c
+BUILT_SOURCES+=$(libob_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/ps/Makefile.am b/src/libcaptive/reactos/ntoskrnl/ps/Makefile.am
new file mode 100644 (file)
index 0000000..78a6f89
--- /dev/null
@@ -0,0 +1,29 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" process (ps/) ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libps.la
+libps_la_SOURCES= \
+               create.c \
+               process.c \
+               thread.c
+BUILT_SOURCES+=$(libps_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/rtl/Makefile.am b/src/libcaptive/reactos/ntoskrnl/rtl/Makefile.am
new file mode 100644 (file)
index 0000000..efa5a11
--- /dev/null
@@ -0,0 +1,31 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" runtimelib ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=librtl.la
+librtl_la_SOURCES= \
+               mem.c \
+               nls.c \
+               sprintf.c \
+               wstring.c \
+               unicode.c
+BUILT_SOURCES+=$(librtl_la_SOURCES)
diff --git a/src/libcaptive/reactos/ntoskrnl/se/Makefile.am b/src/libcaptive/reactos/ntoskrnl/se/Makefile.am
new file mode 100644 (file)
index 0000000..c84b0e5
--- /dev/null
@@ -0,0 +1,27 @@
+# $Id$
+# automake source for the "ntoskrnl.exe" security (se/) ReactOS implementation Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+include $(top_srcdir)/src/libcaptive/reactos/Makefile-reactos.am
+include $(top_srcdir)/src/libcaptive/reactos/ntoskrnl/Makefile-ntoskrnl.am
+
+noinst_LTLIBRARIES=libse.la
+libse_la_SOURCES= \
+               access.c
+BUILT_SOURCES+=$(libse_la_SOURCES)
diff --git a/src/libcaptive/rtl/Makefile.am b/src/libcaptive/rtl/Makefile.am
new file mode 100644 (file)
index 0000000..b2e30d6
--- /dev/null
@@ -0,0 +1,26 @@
+# $Id$
+# automake source for the run-time-library of libcaptive Makefile 
+# Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+# 
+# 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; exactly version 2 of June 1991 is required
+# 
+# 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+include $(top_srcdir)/Makefile-head.am
+include $(top_srcdir)/src/libcaptive/Makefile-libcaptive.am
+
+noinst_LTLIBRARIES=librtl.la
+librtl_la_SOURCES= \
+               file.c \
+               unicode.c \
+               unicode_reactos.c
diff --git a/src/libcaptive/rtl/file.c b/src/libcaptive/rtl/file.c
new file mode 100644 (file)
index 0000000..e7aec5a
--- /dev/null
@@ -0,0 +1,147 @@
+/* $Id$
+ * File handling utilities of libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/file.h"      /* self */
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include <glib/ghash.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+
+/* map: address -> GSIZE_TO_POINTER(length) */
+static GHashTable *captive_file_mmap_hash;
+
+/* initialize 'captive_file_mmap_hash' */
+static void captive_file_mmap_hash_init(void)
+{
+       if (captive_file_mmap_hash)
+               return;
+       captive_file_mmap_hash=g_hash_table_new(g_direct_hash,g_direct_equal);
+}
+
+/**
+ * captive_file_mmap:
+ * @lenp: returns the file length if successful. %NULL pointer permitted.
+ * @path: File pathname to open(2).
+ * @open_flags: open(2) parameter #flags such as %O_RDONLY.
+ * @mmap_prot: mmap(2) parameter #prot such as %PROT_READ.
+ * @mmap_flags: mmap(2) parameter #flags such as %MAP_SHARED.
+ *
+ * mmap(2) the whole file into memory.
+ *
+ * Returns: address base with mmap(2)ed file (and @lenp filled) or #NULL if error.
+ */
+gpointer captive_file_mmap(size_t *lenp,const gchar *path,int open_flags,int mmap_prot,int mmap_flags)
+{
+gpointer r;
+int fd;
+size_t len;
+off_t lenoff;
+
+       captive_file_mmap_hash_init();
+
+       /* FIXME: use g_filename_from_utf8() on 'path' */
+       fd=open(path,open_flags);
+       if (fd==-1) {
+               g_error("captive_file_mmap(\"%s\"): open: %m",path);
+               goto err;
+               }
+
+       lenoff=lseek(fd,0,SEEK_END);
+       if (lenoff==(off_t)-1) {
+               g_assert_not_reached();
+               goto err_close;
+               }
+       len=(size_t)lenoff;
+       if (lenp)
+               *lenp=len;
+
+       r=mmap(
+                       0,      /* start */
+                       len,    /* len */
+                       mmap_prot,
+                       mmap_flags,
+                       fd,
+                       0       /* offset */
+                       );
+       if (r==NULL) {
+               g_assert_not_reached();
+               goto err_close;
+               }
+
+       if (close(fd)) {
+               g_assert_not_reached();
+               goto err_munmap;
+               }
+
+       /* should make no difference with g_hash_table_replace()
+        * as we are using (g_direct_hash,g_direct_equal)
+        */
+       g_hash_table_insert(captive_file_mmap_hash,
+                       r,GSIZE_TO_POINTER(len));       /* key,value */
+
+       return r;
+
+err_munmap:
+       /* errors ignored */
+       munmap(r,len);
+err_close:
+       /* errors ignored */
+       close(fd);
+err:
+       g_return_val_if_reached(NULL);
+}
+
+/**
+ * captive_file_munmap:
+ * @base: file base address returned by captive_file_mmap(). %NULL pointer forbidden.
+ *
+ * munmap(2) the whole file and destroy all its resources.
+ */
+void captive_file_munmap(gpointer base)
+{
+gpointer len_ptr;      /* GSIZE_TO_POINTER(off_t len) */
+gboolean found;
+
+       g_return_if_fail(base!=NULL);
+
+       captive_file_mmap_hash_init();
+
+       /* report if 'base' not found */
+       found=g_hash_table_lookup_extended(captive_file_mmap_hash,
+                       base,   /* lookup_key */
+                       NULL,   /* orig_key */
+                       &len_ptr);      /* value */
+       g_return_if_fail(found==TRUE);
+
+       /* remove 'base' from our database */
+       found=g_hash_table_remove(captive_file_mmap_hash,
+                       base);  /* key */
+       g_return_if_fail(found==TRUE);  /* just a warning would be also possible */
+
+       /* munmap() has no return value */
+       munmap(base,GPOINTER_TO_SIZE(len_ptr));
+}
diff --git a/src/libcaptive/rtl/unicode.c b/src/libcaptive/rtl/unicode.c
new file mode 100644 (file)
index 0000000..ede4f1f
--- /dev/null
@@ -0,0 +1,515 @@
+/* $Id$
+ * Unicode add-ons to reactos ntoskrnl/rtl/unicode.c for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/unicode.h"   /* self */
+#include "captive/unicode_reactos.h"   /* for captive_ucs2 */
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+#include <glib/gunicode.h>
+#include <glib/gmem.h>
+#include "reactos/napi/types.h"  /* for PUNICODE_STRING etc. */
+#include "reactos/unicode.h"
+#include "captive/macros.h"
+#include <glib/gstrfuncs.h>
+#include <wchar.h>     /* for wcslen() */
+#include <glib/ghash.h>
+#include <string.h>
+
+
+/* CONFIG: */
+/* Use simplified g_malloc() functions as wrappers around g_alloca() ones.
+ */
+#define FUNCMALLOC_FROM_ALLOCA 1
+
+
+/* compiler sanity */
+static gboolean captive_validate_unicode_types(void)
+{
+       g_return_val_if_fail(4==sizeof(gunichar),FALSE);
+       g_return_val_if_fail(2==sizeof(WCHAR),FALSE);
+       g_return_val_if_fail(1==sizeof(CHAR),FALSE);
+
+       return TRUE;
+}
+
+
+/**
+ * captive_validate_ucs4:
+ * @string_ucs4: #const #gunichar * type string to validate.
+ * Invalid string input is forbidden.
+ *
+ * Checks the validity of all 32-bit unicharacters of 0-terminated string.
+ * It is required to have characters complying to g_unichar_validate().
+ *
+ * Returns: %TRUE if the string is valid.
+ */ 
+gboolean captive_validate_ucs4(const gunichar *string_ucs4)
+{
+const gunichar *cs_ucs4;
+
+       g_return_val_if_fail(captive_validate_unicode_types(),FALSE);
+       g_return_val_if_fail(string_ucs4!=NULL,FALSE);
+
+       for (cs_ucs4=string_ucs4;*cs_ucs4;cs_ucs4++)
+               g_return_val_if_fail(g_unichar_validate(*cs_ucs4),FALSE);
+
+       return TRUE;
+}
+
+
+/**
+ * captive_validate_ucs2:
+ * @string_ucs2: #const #captive_ucs2 * type string to validate.
+ * Invalid string input is forbidden.
+ * UTF-16 encoded strings are forbidden.
+ *
+ * Checks the validity of all 16-bit unicharacters of 0-terminated string.
+ * It is required to have characters complying to g_unichar_validate().
+ *
+ * Returns: %TRUE if the string is valid.
+ */ 
+gboolean captive_validate_ucs2(const captive_ucs2 *string_ucs2)
+{
+const captive_ucs2 *cs_ucs2;
+
+       g_return_val_if_fail(captive_validate_unicode_types(),FALSE);
+       g_return_val_if_fail(string_ucs2!=NULL,FALSE);
+
+       /* g_unichar_validate() will reject surrogates (G_UNICODE_SURROGATE) */
+       for (cs_ucs2=string_ucs2;*cs_ucs2;cs_ucs2++)
+               g_return_val_if_fail(g_unichar_validate(*cs_ucs2),FALSE);
+
+       return TRUE;
+}
+
+
+/**
+ * captive_validate_utf8:
+ * @string_utf8: #const #gchar * utf8 type string to validate.
+ * Invalid string input is forbidden.
+ *
+ * Checks the validity of all utf8 of 0-terminated string.
+ * It is required to have characters complying to g_utf8_validate().
+ *
+ * Returns: %TRUE if the string is valid.
+ */ 
+gboolean captive_validate_utf8(const gchar *string_utf8)
+{
+       g_return_val_if_fail(captive_validate_unicode_types(),FALSE);
+       g_return_val_if_fail(string_utf8!=NULL,FALSE);
+
+       g_return_val_if_fail(g_utf8_validate(
+                                       string_utf8,    /* str */
+                                       -1,     /* max_len; -1 means '\0'-terminated */
+                                       NULL),  /* end */
+                       FALSE);
+
+       return TRUE;
+}
+
+
+/**
+ * captive_ucs2_strlen:
+ * @string_ucs2: String of type #const #gunichar2 * in pure UCS-2
+ * Invalid string input is forbidden. UTF-16 encoded pairs are forbidden.
+ *
+ * Counts the number of characters (=2bytes) in @strings_ucs2.
+ *
+ * Returns: @string_ucs2 length in UCS-2 characters.
+ */
+glong captive_ucs2_strlen(const captive_ucs2 *string_ucs2)
+{
+glong r;
+
+       g_return_val_if_fail(captive_validate_ucs2(string_ucs2),0);
+
+       for (r=0;*string_ucs2;string_ucs2++)
+               r++;
+
+       return r;
+}
+
+
+/**
+ * captive_validate_UnicodeString:
+ * @string_UnicodeString: #PUNICODE_STRING type string to validate.
+ * Invalid string input is forbidden.
+ *
+ * Checks the internal consistency of the given @string_UnicodeString.
+ * It is required to have characters complying to g_unichar_validate().
+ *
+ * Returns: %TRUE if the string is valid.
+ */
+gboolean captive_validate_UnicodeString(const UNICODE_STRING *string_UnicodeString)
+{
+       g_return_val_if_fail(captive_validate_unicode_types(),FALSE);
+       g_return_val_if_fail(sizeof(WCHAR)==sizeof(*string_UnicodeString->Buffer),FALSE);
+       g_return_val_if_fail(string_UnicodeString!=NULL,FALSE);
+       g_return_val_if_fail(string_UnicodeString->Length%sizeof(*string_UnicodeString->Buffer)==0,FALSE);
+       g_return_val_if_fail(string_UnicodeString->MaximumLength
+                       >=string_UnicodeString->Length+sizeof(*string_UnicodeString->Buffer),FALSE);
+       g_return_val_if_fail(string_UnicodeString->Length==sizeof(*string_UnicodeString->Buffer)*
+                       captive_ucs2_strlen(string_UnicodeString->Buffer)
+                       ,FALSE);
+
+       g_return_val_if_fail(captive_validate_ucs2(string_UnicodeString->Buffer),FALSE);
+
+       return TRUE;
+}
+
+
+/**
+ * captive_validate_AnsiString:
+ * @string_AnsiString: #PANSI_STRING type string to validate.
+ * Invalid string input is forbidden.
+ *
+ * Checks the internal consistency of the given @string_AnsiString.
+ *
+ * Returns: %TRUE if the string is valid.
+ */
+gboolean captive_validate_AnsiString(const ANSI_STRING *string_AnsiString)
+{
+       g_return_val_if_fail(captive_validate_unicode_types(),FALSE);
+       g_return_val_if_fail(sizeof(CHAR)==sizeof(*string_AnsiString->Buffer),FALSE);
+       g_return_val_if_fail(string_AnsiString!=NULL,FALSE);
+       g_return_val_if_fail(string_AnsiString->MaximumLength>=string_AnsiString->Length+1,FALSE);
+       g_return_val_if_fail(string_AnsiString->Length==strlen(string_AnsiString->Buffer),FALSE);
+
+       return TRUE;
+}
+
+
+/* detect required memory size for g_alloca() */
+size_t _captive_UnicodeString_to_utf8_alloca_internal_sizeof(const UNICODE_STRING *string_UnicodeString)
+{
+glong length;
+size_t r;
+const WCHAR *cwcharp;
+
+       g_return_val_if_fail(captive_validate_UnicodeString(string_UnicodeString),1);
+
+       /* measure 'string_UnicodeString->Buffer' length in UTF-8 to 'r' */
+       cwcharp=string_UnicodeString->Buffer;
+       r=0;
+       for (length=string_UnicodeString->Length/sizeof(*string_UnicodeString->Buffer);length;length--) {
+gint utf8len;
+
+               utf8len=g_unichar_to_utf8(
+                               *cwcharp++,     /* c */
+                               NULL);  /* outbuf=NULL => just the length will be computed */
+               g_assert(utf8len>=0);
+               r+=utf8len;
+               }
+       g_assert(*cwcharp==0);
+       r++;    /* '\0'-termination */
+
+       /* utf8 byte-size */
+       return r;
+}
+
+/* transfer 'string_UnicodeString' to memory in 'mem' as utf8 w/o any further allocations */
+void _captive_UnicodeString_to_utf8_alloca_internal_fill(gchar *mem,const UNICODE_STRING *string_UnicodeString)
+{
+const WCHAR *cwcharp;
+#ifndef G_DISABLE_ASSERT
+gchar *mem_orig=mem;
+#endif /* G_DISABLE_ASSERT */
+
+       g_return_if_fail(mem!=NULL);
+       if (!captive_validate_UnicodeString(string_UnicodeString)) {
+               *mem='\0';
+               g_return_if_reached();
+               }
+
+       /* We can't use any glib string conversions as UNICODE_STRING uses ucs2! */
+       /* We can't use any glib string conversions as we need to write the string
+        * to our supplied memory storage but glib always g_malloc()s it
+        */
+       /* copy 'string_UnicodeString->Buffer' to 'mem' */
+       for (cwcharp=string_UnicodeString->Buffer;*cwcharp;cwcharp++) {
+gint utf8len;
+
+               utf8len=g_unichar_to_utf8(
+                               (gunichar)*cwcharp,     /* c */
+                               mem);   /* outbuf */
+               g_assert(utf8len>=0);
+               mem+=utf8len;
+               }
+       *mem='\0';
+
+       g_assert((size_t)((mem+1)-mem_orig) == _captive_UnicodeString_to_utf8_alloca_internal_sizeof(string_UnicodeString));
+       g_assert(captive_validate_utf8(mem_orig));
+}
+
+
+/**
+ * captive_UnicodeString_to_utf8_malloc:
+ * @string_UnicodeString: #PUNICODE_STRING type of string to convert.
+ *
+ * g_malloc()-based conversion from #PUNICODE_STRING to plain #utf8 string.
+ * You must free the result with g_free() function.
+ *
+ * Returns: #const #gchar * g_malloc()ed converted string @string_UnicodeString.
+ */
+gchar *captive_UnicodeString_to_utf8_malloc(const UNICODE_STRING *string_UnicodeString)
+{
+gchar *r;
+#ifndef FUNCMALLOC_FROM_ALLOCA
+glong utf16_read,utf8_written;
+GError *err;
+#endif /* !FUNCMALLOC_FROM_ALLOCA */
+
+       g_return_val_if_fail(captive_validate_UnicodeString(string_UnicodeString),g_strdup(""));
+
+#ifdef FUNCMALLOC_FROM_ALLOCA
+
+       r=g_malloc(_captive_UnicodeString_to_utf8_alloca_internal_sizeof(string_UnicodeString));
+       _captive_UnicodeString_to_utf8_alloca_internal_fill(r,string_UnicodeString);
+
+#else
+
+       err=NULL;       /* not precleared by g_utf8_to_utf16()! */
+       r=g_utf16_to_utf8(
+                       (const gunichar2 *)string_UnicodeString->Buffer,        /* str */
+                       -1,     /* len=>'\0'-terminated */
+                       &utf16_read,    /* items_read; counted in unichar2 (NOT UTF-16 characters or bytes!) */
+                       &utf8_written,  /* items_written; counted in bytes (NOT UTF-8 characters!) */
+                       &err);
+       if (err) {
+               g_warning("%s: utf16_read=%ld,utf8_written=%ld: %s",G_STRLOC,
+                               (long)utf16_read,(long)utf8_written,err->message);
+               g_error_free(err);
+               g_assert(r==NULL);
+               g_return_val_if_reached(g_strdup(""));
+               }
+       g_assert(r!=NULL);
+
+       g_assert(utf16_read==(glong)(string_UnicodeString->length/sizeof(*string_UnicodeString->Buffer)));
+       g_assert(utf6_written==strlen(r));
+
+#endif /* !FUNCMALLOC_FROM_ALLOCA */
+
+       g_assert(captive_validate_utf8(r));
+
+       return r;
+}
+
+
+/* detect required memory size for g_alloca() */
+size_t _captive_utf8_to_UnicodeString_alloca_internal_sizeof(const gchar *string_utf8)
+{
+       g_return_val_if_fail(captive_validate_utf8(string_utf8),1);
+
+       /* find the value for PUNICODE_STRING->MaximumLength */
+       return 0
+                       +sizeof(UNICODE_STRING)
+                       +sizeof(WCHAR)*(g_utf8_strlen(string_utf8,
+                                       -1      /* max; -1 means '\0'-terminated */
+                                       )+1);   /* '\0'-termination */
+}
+
+static void terminate_static_UnicodeString(UNICODE_STRING *string_UnicodeString,glong length)
+{
+       /* 'string_UnicodeString' is not yet valid in this point! */
+       g_return_if_fail(string_UnicodeString!=NULL);
+       g_return_if_fail(length>=0);
+
+       string_UnicodeString->Length=length*sizeof(WCHAR);
+       string_UnicodeString->MaximumLength=(length+1)*sizeof(WCHAR);
+       string_UnicodeString->Buffer[length]=0;
+
+       g_assert(captive_validate_UnicodeString(string_UnicodeString));
+}
+
+/* transfer 'string_UnicodeString' to memory in 'mem' w/o any further allocations */
+void _captive_utf8_to_UnicodeString_alloca_internal_fill(UNICODE_STRING *mem,const gchar *string_utf8)
+{
+gunichar2 *utf16;
+captive_ucs2 *ucs2;
+glong utf8_read,utf16_written;
+GError *err;
+
+       g_return_if_fail(mem!=NULL);
+       mem->Buffer=(PWSTR)(((char *)mem)+sizeof(*mem));        /* for terminate_static_UnicodeString() below */
+       if (!captive_validate_utf8(string_utf8)) {
+               terminate_static_UnicodeString(mem,0);
+               g_return_if_reached();
+               }
+
+       err=NULL;       /* not precleared by g_utf8_to_utf16()! */
+       utf16=g_utf8_to_utf16(
+                       string_utf8,    /* str */
+                       -1,     /* len=>'\0'-terminated */
+                       &utf8_read,     /* items_read; counted in bytes (NOT chars!) */
+                       &utf16_written, /* items_written; counted in UTF-16 characters (NOT unichar2 or bytes!) */
+                       &err);
+       if (err) {
+               g_warning("%s: utf8_read=%ld,utf16_written=%ld: %s",G_STRLOC,
+                               (long)utf8_read,(long)utf16_written,err->message);
+               g_error_free(err);
+               g_assert(utf16==NULL);
+               terminate_static_UnicodeString(mem,0);
+               g_return_if_reached();
+               }
+       g_assert(utf16!=NULL);
+
+       /* Check for UCS-2 compliance (reject if surrogates inside) */
+       g_assert(captive_validate_ucs2((const captive_ucs2 *)utf16));
+       /* valid UCS-2 */
+       ucs2=(captive_ucs2 *)utf16;
+
+       g_assert(utf8_read==(glong)strlen(string_utf8));
+       g_assert(utf16_written==captive_ucs2_strlen(ucs2));
+
+       /* check of validity of _captive_utf8_to_UnicodeString_alloca_internal_sizeof() result */
+       g_assert((gchar *)(mem->Buffer+(utf16_written+1))       /* +1 => '\0'-termination */
+                       == ((gchar *)mem)+_captive_utf8_to_UnicodeString_alloca_internal_sizeof(string_utf8));
+
+       memcpy(mem->Buffer,ucs2,sizeof(WCHAR)*(utf16_written+1));
+       g_free(ucs2);
+       terminate_static_UnicodeString(mem,utf16_written);
+
+       g_assert(captive_validate_UnicodeString(mem));
+}
+
+
+/**
+ * captive_utf8_to_UnicodeString_malloc:
+ * @string_utf8: #const #gchar * string in #utf8 to convert.
+ *
+ * g_malloc()-based conversion from plain #utf8 string to #PUNICODE_STRING.
+ * You must free the result with g_free() function.
+ *
+ * Returns: #PUNICODE_STRING g_malloc()ed converted string @string_utf8.
+ */
+PUNICODE_STRING captive_utf8_to_UnicodeString_malloc(const gchar *string_utf8)
+{
+UNICODE_STRING *r;
+#ifndef FUNCMALLOC_FROM_ALLOCA
+gunichar *ucs4;
+glong utf8_read,ucs4_written;
+GError *err;
+#endif /* !FUNCMALLOC_FROM_ALLOCA */
+
+       g_return_val_if_fail(captive_validate_utf8(string_utf8),captive_utf8_to_UnicodeString_malloc(""));
+
+#ifdef FUNCMALLOC_FROM_ALLOCA
+
+       r=g_malloc(_captive_utf8_to_UnicodeString_alloca_internal_sizeof(string_utf8));
+       _captive_utf8_to_UnicodeString_alloca_internal_fill(r,string_utf8);
+
+#else
+
+#error "FIXME: NOT IMPLEMENTED"
+
+#endif /* !FUNCMALLOC_FROM_ALLOCA */
+
+       g_assert(captive_validate_UnicodeString(r));
+
+       return r;
+}
+
+
+/* map: (const gunichar *) -> (const gunichar2 *); UCS-4 -> UTF-16 */
+static GHashTable *captive_ucs4_to_utf16_hash;
+
+static void captive_ucs4_to_utf16_hash_init(void)
+{
+       if (captive_ucs4_to_utf16_hash)
+               return;
+       captive_ucs4_to_utf16_hash=g_hash_table_new_full(
+                       g_direct_hash,  /* hash_func */
+                       g_direct_equal, /* key_equal_func */
+                       (GDestroyNotify)NULL,   /* key_destroy_func; we require persistent strings as input */
+                       (GDestroyNotify)g_free);        /* value_destroy_func; result of g_ucs4_to_utf16() */
+}
+
+/**
+ * captive_ucs4_to_utf16_const:
+ * @string_ucs4: #const #gunichar * type of persistent string to convert.
+ * This string MUST remain readable with the same content forever.
+ *
+ * Constant string conversion from 32-bit #wchar_t to 16-bit (possible pairs of) UTF-16.
+ * You may not modify the result in any way.
+ * 
+ * It is guaranteed to get two different string addresses for two different
+ * input addresses even if the input strings content is the same.
+ * Otherwise we would behave as #GCC option %-fmerge-constants which
+ * results in %C non-conforming behaviour.
+ *
+ * FIXME: UTF-16 encoding IS NOT IMPLEMENTED.
+ *
+ * See also captive_ucs4_to_ucs2_const().
+ *
+ * Returns: #const #gunichar2 * converted string @string_ucs4.
+ */
+const gunichar2 *captive_ucs4_to_utf16_const(const gunichar *string_ucs4)
+{
+glong ucs4_read,utf16_written;
+GError *err;
+const gunichar2 *r_lookup;
+gunichar2 *r;
+
+       g_return_val_if_fail(captive_validate_ucs4(string_ucs4),captive_ucs4_to_utf16_const((const gunichar *)L""));
+
+       captive_ucs4_to_utf16_hash_init();
+
+       /* found already existing item in the table */
+       if ((r_lookup=g_hash_table_lookup(captive_ucs4_to_utf16_hash,
+                       string_ucs4)    /* key */
+                       )) {
+               return r_lookup;
+               }
+
+       /* Prepare 'r' as UTF-16 */
+       err=NULL;       /* not precleared by g_ucs4_to_utf16()! */
+       r=g_ucs4_to_utf16(
+                       (const gunichar *)string_ucs4,  /* str */
+                       -1,     /* len; -1 means '\0'-termination */
+                       &ucs4_read,     /* items_read; counted in chars (==unichars; NOT bytes!) */
+                       &utf16_written, /* items_written; counted in gunichar2 (NOT chars or bytes!) */
+                       &err);
+       if (err) {
+               g_warning("%s: ucs4_read=%ld,utf16_written=%ld: %s",G_STRLOC,
+                               (long)ucs4_read,(long)utf16_written,err->message);
+               g_error_free(err);
+               g_assert(r==NULL);
+               g_return_val_if_reached(captive_ucs4_to_utf16_const((const gunichar *)L""));
+               }
+       g_assert(r!=NULL);
+       g_assert(ucs4_read==(glong)wcslen((const wchar_t *)string_ucs4));
+       /* FIXME: We don't have captive_utf16_strlen() */
+       g_assert(utf16_written==(glong)captive_ucs2_strlen((const gunichar2 *)r));
+       /* (ucs4_read==utf16_written) check would discard any double-pair UTF-16 encodings
+        * but this function is designed as UTF-16 compliant.
+        */
+
+       /* store new item to the table */
+       g_hash_table_insert(captive_ucs4_to_utf16_hash,
+                       (gpointer)string_ucs4,  /* key; de-const */
+                       r);     /* value */
+
+#if 0  /* We don't have captive_validate_utf16() */
+       g_assert(captive_validate_utf16(r));
+#endif
+
+       return r;
+}
diff --git a/src/libcaptive/rtl/unicode_reactos.c b/src/libcaptive/rtl/unicode_reactos.c
new file mode 100644 (file)
index 0000000..bfef593
--- /dev/null
@@ -0,0 +1,56 @@
+/* $Id$
+ * Unicode support used also for reactos files for libcaptive
+ * Copyright (C) 2002 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * 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; exactly version 2 of June 1991 is required
+ * 
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "captive/unicode_reactos.h"   /* self */
+#include "captive/unicode.h"
+#include <glib/gtypes.h>
+#include <glib/gmessages.h>
+
+
+/**
+ * captive_ucs4_to_ucs2_const:
+ * @string_ucs4: #const #gunichar * type of persistent string to convert.
+ * This string MUST remain readable with the same content forever.
+ * This string MUST be convertible to UCS-2 string.
+ *
+ * Constant string conversion from 32-bit #wchar_t to 16-bit #wchar_t.
+ * You may not modify the result in any way.
+ * 
+ * It is guaranteed to get two different string addresses for two different
+ * input addresses even if the input strings content is the same.
+ * Otherwise we would behave as #GCC option %-fmerge-constants which
+ * results in %C non-conforming behaviour.
+ *
+ * Returns: #const #captive_ucs2 * converted string @string_ucs4.
+ */
+const captive_ucs2 *captive_ucs4_to_ucs2_const(const gunichar *string_ucs4)
+{
+const captive_ucs2 *r;
+
+       g_return_val_if_fail(captive_validate_ucs4(string_ucs4),captive_ucs4_to_ucs2_const((const gunichar *)L""));
+
+       r=(const captive_ucs2 *)captive_ucs4_to_utf16_const(string_ucs4);
+
+       /* Here we can bail out on non-UCS-2 compliant UTF-16 string */
+       g_return_val_if_fail(captive_validate_ucs2(r),captive_ucs4_to_ucs2_const((const gunichar *)L""));
+
+       return r;
+}