Implemented ZwOpenProcess corrected
authorDavid Welch <welch@cwcom.net>
Wed, 9 Jun 1999 15:50:16 +0000 (15:50 +0000)
committerDavid Welch <welch@cwcom.net>
Wed, 9 Jun 1999 15:50:16 +0000 (15:50 +0000)
Implemented killing other threads (possible memory leaks)
Made a start on a proper implementation of APCs (based on NT Insider article)

svn path=/trunk/; revision=551

22 files changed:
reactos/ChangeLog
reactos/NEWS
reactos/apps/utils/shell/shell.c
reactos/boot.bat [deleted file]
reactos/copying.dj [deleted file]
reactos/copying_rex [deleted file]
reactos/include/ddk/defines.h
reactos/include/ddk/status.h
reactos/lib/kernel32/process/create.c
reactos/lib/kernel32/process/proc.c
reactos/lib/ntdll/ldr/utils.c
reactos/makefile_rex
reactos/ntoskrnl/exports.lst [deleted file]
reactos/ntoskrnl/hal/x86/exp.c
reactos/ntoskrnl/io/irp.c
reactos/ntoskrnl/ke/apc.c
reactos/ntoskrnl/ke/critical.c
reactos/ntoskrnl/ldr/loader.c
reactos/ntoskrnl/makefile_rex
reactos/ntoskrnl/ps/kill.c
reactos/ntoskrnl/ps/process.c
reactos/readme_rex [deleted file]

index 2bc4d45..6e94371 100644 (file)
@@ -1,3 +1,9 @@
+9/6/99:        Implemented ZwOpenProcess
+               Partially implemented killing other threads (possible memory
+                                                            leaks)
+              Made a start on a proper implemention of APCs (based on 
+              article in NT insider)
+
 8/12/98:       Corrected bug in shell (Read two keypresses and assumed they
                where the key going up and down respectively)
               Corrected race in dpc handling
index e62eb2a..deadae1 100644 (file)
@@ -1,4 +1,5 @@
-0.0.14:
+0.0.14:      Converted to PE format
+             All system libraries are now dlls
              
 
 0.0.13:      Mostly bugfixes (I think)
index 64df30b..e8bcfd7 100644 (file)
@@ -205,6 +205,7 @@ ExecuteKill(char * lpPid)
        DWORD   dwProcessId;
 
        dwProcessId = (DWORD) atol(lpPid);
+   debug_printf("dwProcessId %d\n",dwProcessId);
        hProcess = OpenProcess(
                        PROCESS_TERMINATE,
                        FALSE,
diff --git a/reactos/boot.bat b/reactos/boot.bat
deleted file mode 100644 (file)
index 3119fbc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-loadros kimage.bin ide.o vfatfsd.o keyboard.o
diff --git a/reactos/copying.dj b/reactos/copying.dj
deleted file mode 100644 (file)
index e32af57..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-This is the file "copying.dj".  It does NOT apply to any sources or
-
-binaries copyrighted by UCB Berkeley, the Free Software Foundation, or
-
-any other agency besides DJ Delorie and others who have agreed to
-
-allow their sources to be distributed under these terms.
-
-
-
-   Copyright Information for sources and executables that are marked
-
-   Copyright (C) DJ Delorie
-
-                 7 Kim Lane
-
-                 Rochester NH  03867-2954
-
-
-
-This document is Copyright (C) DJ Delorie and may be distributed
-
-verbatim, but changing it is not allowed.
-
-
-
-Source code copyright DJ Delorie is distributed under the terms of the
-
-GNU General Public Licence, with the following exceptions:
-
-
-
-* Sources used to build crt0.o, gcrt0.o, libc.a, libdbg.a, and
-
-  libemu.a are distributed under the terms of the GNU Library General
-
-  Public License, rather than the GNU GPL.
-
-
-
-* Any existing copyright or authorship information in any given source
-
-  file must remain intact.  If you modify a source file, a notice to that
-
-  effect must be added to the authorship information in the source file. 
-
-
-
-* Runtime binaries, as provided by DJ in DJGPP, may be distributed
-
-  without sources ONLY if the recipient is given sufficient information
-
-  to obtain a copy of djgpp themselves.  This primarily applies to
-
-  go32-v2.exe, emu387.dxe, and stubedit.exe.
-
-
-
-* Runtime objects and libraries, as provided by DJ in DJGPP, when
-
-  linked into an application, may be distributed without sources ONLY
-
-  if the recipient is given sufficient information to obtain a copy of
-
-  djgpp themselves.  This primarily applies to crt0.o and libc.a.
-
-
-
------
-
-
-
-Changes to source code copyright BSD or FSF by DJ Delorie fall under
-
-the terms of the original copyright.
-
-
-
-A copy of the files "COPYING" and "COPYING.LIB" are included with this
-
-document.  If you did not receive a copy of these files, you may
-
-obtain one from whence this document was obtained, or by writing:
-
-
-
-      Free Software Foundation
-
-      675 Mass Ave
-
-      Cambridge, MA  02139
-
-      USA
-
diff --git a/reactos/copying_rex b/reactos/copying_rex
deleted file mode 100644 (file)
index dc63aac..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-
-                   GNU GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                          675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                           Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-\f
-                   GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-\f
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-\f
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-\f
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                           NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                    END OF TERMS AND CONDITIONS
-\f
-       Appendix: How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) 19yy name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
index f4f4b0f..5235256 100644 (file)
@@ -207,15 +207,9 @@ enum
    IRP_MN_POWER_SEQUENCE,
 };
 
-/*
- * PURPOSE: Used all over
- */
-enum
-{
-   KernelMode,
-   UserMode,
-};
-   
+#define KernelMode (0)
+#define UserMode   (1)
+
 /*
  * PURPOSE: Arguments to MmProbeAndLockPages
  */
index ce97f10..9dee9a7 100644 (file)
  * FIXME: These may not be the actual values used by NT
  */
 
-#define STATUS_SUCCESS                 (0x0)
-#define STATUS_MORE_ENTRIES            (0x105)
-#define STATUS_NOTIFY_ENUM_DIR         (0x10C)
-#define STATUS_OBJECT_EXISTS           (0x40000000)
-#define STATUS_THREAD_WAS_SUSPENDED    (0x40000001)
-#define STATUS_WORKING_SET_LIMIT_RANGE (0x40000002)
-
-#define STATUS_UNSUCCESSFUL            (0xC0000001)
-#define STATUS_NOT_IMPLEMENTED         (0xC0000002)
-#define STATUS_INVALID_INFO_CLASS      (0xC0000003)
-#define STATUS_INFO_LENGTH_MISMATCH    (0xC0000004)
-#define STATUS_ACCESS_VIOLATION        (0xC0000005)
-#define STATUS_IN_PAGE_ERROR           (0xC0000006)
-#define STATUS_PAGEFILE_QUOTA          (0xC0000007)
-#define STATUS_INVALID_HANDLE          (0xC0000008)
-#define STATUS_BAD_INITIAL_STACK       (0xC0000009)
-#define STATUS_BAD_INITIAL_PC          (0xC000000A)
-#define STATUS_INVALID_CID             (0xC000000B)
-#define STATUS_TIMER_NOT_CANCELED      (0xC000000C)
-#define STATUS_INVALID_PARAMETER       (0xC000000D)
-#define STATUS_NO_SUCH_DEVICE          (0xC000000E)
-#define STATUS_NO_SUCH_FILE            (0xC000000F)
-
-#define STATUS_GUARD_PAGE_VIOLATION    (0x80000001)
-#define STATUS_DATATYPE_MISALIGNMENT   (0x80000002)
-#define STATUS_BREAKPOINT              (0x80000003)
-#define STATUS_SINGLE_STEP             (0x80000004)
-#define STATUS_BUFFER_OVERFLOW         (0x80000005)
-#define STATUS_NO_MORE_FILES           (0x80000006)
-#define STATUS_WAKE_SYSTEM_DEBUGGER    (0x80000007)
-
-
+#define STATUS_SUCCESS                         (0x0)
+#define STATUS_MORE_ENTRIES                    (0x105)
+#define STATUS_NOTIFY_ENUM_DIR                 (0x10C)
+#define STATUS_OBJECT_EXISTS                   (0x40000000)
+#define STATUS_THREAD_WAS_SUSPENDED            (0x40000001)
+#define STATUS_WORKING_SET_LIMIT_RANGE         (0x40000002)
+
+#define STATUS_UNSUCCESSFUL                    (0xC0000001)
+#define STATUS_NOT_IMPLEMENTED                 (0xC0000002)
+#define STATUS_INVALID_INFO_CLASS              (0xC0000003)
+#define STATUS_INFO_LENGTH_MISMATCH            (0xC0000004)
+#define STATUS_ACCESS_VIOLATION                (0xC0000005)
+#define STATUS_IN_PAGE_ERROR                   (0xC0000006)
+#define STATUS_PAGEFILE_QUOTA                  (0xC0000007)
+#define STATUS_INVALID_HANDLE                  (0xC0000008)
+#define STATUS_BAD_INITIAL_STACK               (0xC0000009)
+#define STATUS_BAD_INITIAL_PC                  (0xC000000A)
+#define STATUS_INVALID_CID                     (0xC000000B)
+#define STATUS_TIMER_NOT_CANCELED              (0xC000000C)
+#define STATUS_INVALID_PARAMETER               (0xC000000D)
+#define STATUS_NO_SUCH_DEVICE                  (0xC000000E)
+#define STATUS_NO_SUCH_FILE                    (0xC000000F)
+
+#define STATUS_GUARD_PAGE_VIOLATION            (0x80000001)
+#define STATUS_DATATYPE_MISALIGNMENT           (0x80000002)
+#define STATUS_BREAKPOINT                      (0x80000003)
+#define STATUS_SINGLE_STEP                     (0x80000004)
+#define STATUS_BUFFER_OVERFLOW                 (0x80000005)
+#define STATUS_NO_MORE_FILES                   (0x80000006)
+#define STATUS_WAKE_SYSTEM_DEBUGGER            (0x80000007)
+
+#define STATUS_IMAGE_NOT_AT_BASE               (0x40000003)
+#define STATUS_RXACT_STATE_CREATED             (0x40000004)
+#define STATUS_SEGMENT_NOTIFICATION            (0x40000005)
+#define STATUS_LOCAL_USER_SESSION_KEY          (0x40000006)
+#define STATUS_BAD_CURRENT_DIRECTORY           (0x40000007)
+#define STATUS_SERIAL_MORE_WRITES              (0x40000008)
+#define STATUS_REGISTRY_RECOVERED              (0x40000009)
+#define STATUS_FT_READ_RECOVERING_FROM_BACKUP  (0x4000000A)
+#define STATUS_FT_WRITE_RECOVERY               (0x4000000B)
+#define STATUS_SERIAL_COUNTER_TIMEOUT          (0x4000000C)
+#define STATUS_NULL_LM_PASSWORD                (0x4000000D)
+#define STATUS_IMAGE_MACHINE_TYPE_MISMATCH     (0x4000000E)
+#define STATUS_RECEIVE_PARTIAL                 (0x4000000F)
+#define STATUS_RECEIVE_EXPEDITED               (0x40000010)
+#define STATUS_RECEIVE_PARTIAL_EXPEDITED       (0x40000011)
+#define STATUS_EVENT_DONE                      (0x40000012)
+#define STATUS_EVENT_PENDING                   (0x40000013)
+#define STATUS_CHECKING_FILE_SYSTEM            (0x40000014)
+#define STATUS_FATAL_APP_EXIT                  (0x40000015)
+#define STATUS_PREDEFINED_HANDLE               (0x40000016)
+#define STATUS_WAS_UNLOCKED                    (0x40000017)
+#define STATUS_SERVICE_NOTIFICATION            (0x40000018)
+#define STATUS_WAS_LOCKED                      (0x40000019)
+#define STATUS_LOG_HARD_ERROR                  (0x4000001A)
+#define STATUS_ALREADY_WIN32                   (0x4000001B)
+#define STATUS_WX86_UNSIMULATE                 (0x4000001C)
+#define STATUS_WX86_CONTINUE                   (0x4000001D)
+#define STATUS_WX86_SINGLE_STEP                (0x4000001E)
+#define STATUS_WX86_BREAKPOINT                 (0x4000001F)
+#define STATUS_WX86_EXCEPTION_CONTINUE         (0x40000020)
+#define STATUS_WX86_EXCEPTION_LASTCHANCE       (0x40000021)
+#define STATUS_WX86_EXCEPTION_CHAIN            (0x40000022)
+#define STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE (0x40000023)
+#define STATUS_NO_YIELD_PERFORMED              (0x40000024)
+#define STATUS_TIMER_RESUME_IGNORED            (0x40000025)
+#define STATUS_ARBITRATION_UNHANDLED           (0x40000026)
+#define STATUS_CARDBUS_NOT_SUPPORTED           (0x40000027)
+#define STATUS_WX86_CREATEWX86TIB              (0x40000028)
+
+#define STATUS_HANDLES_CLOSED                  (0x8000000A)
+#define STATUS_NO_INHERITANCE                  (0x8000000B)
+#define STATUS_GUID_SUBSTITUTION_MADE          (0x8000000C)
+#define STATUS_PARTIAL_COPY                    (0x8000000D)
+#define STATUS_DEVICE_PAPER_EMPTY              (0x8000000E)
+#define STATUS_DEVICE_POWERED_OFF              (0x8000000F)
+#define STATUS_DEVICE_OFF_LINE                 (0x80000010)
+#define STATUS_DEVICE_BUSY                     (0x80000011)
+#define STATUS_NO_MORE_EAS                     (0x80000012)
+#define STATUS_INVALID_EA_NAME                 (0x80000013)
+#define STATUS_EA_LIST_INCONSISTENT            (0x80000014)
+#define STATUS_INVALID_EA_FLAG                 (0x80000015)
+#define STATUS_VERIFY_REQUIRED                 (0x80000016)
+#define STATUS_EXTRANEOUS_INFORMATION          (0x80000017)
+#define STATUS_RXACT_COMMIT_NECESSARY          (0x80000018)
+
+#define STATUS_NO_MORE_ENTRIES                 (0x8000001A)
+#define STATUS_FILEMARK_DETECTED               (0x8000001B)
+#define STATUS_MEDIA_CHANGED                   (0x8000001C)
+#define STATUS_BUS_RESET                       (0x8000001D)
+#define STATUS_END_OF_MEDIA                    (0x8000001E)
+#define STATUS_BEGINNING_OF_MEDIA              (0x8000001F)
+#define STATUS_MEDIA_CHECK                     (0x80000020)
+#define STATUS_SETMARK_DETECTED                (0x80000021)
+#define STATUS_NO_DATA_DETECTED                (0x80000022)
+#define STATUS_REDIRECTOR_HAS_OPEN_HANDLES     (0x80000023)
+#define STATUS_SERVER_HAS_OPEN_HANDLES         (0x80000024)
+#define STATUS_ALREADY_DISCONNECTED            (0x80000025)
+#define STATUS_LONGJUMP                        (0x80000026)
+
+#define STATUS_INVALID_DEVICE_REQUEST          (0xc0000010)
+#define STATUS_END_OF_FILE                     (0xc0000011)
+#define STATUS_WRONG_VOLUME                    (0xc0000012)
+#define STATUS_NO_MEDIA_IN_DEVICE              (0xc0000013)
+#define STATUS_UNRECOGNIZED_MEDIA              (0xc0000014)
+#define STATUS_NONEXISTENT_SECTOR              (0xc0000015)
+#define STATUS_MORE_PROCESSING_REQUIRED        (0xc0000016)
+#define STATUS_NO_MEMORY                       (0xc0000017)
+#define STATUS_CONFLICTING_ADDRESSES           (0xc0000018)
+#define STATUS_NOT_MAPPED_VIEW                 (0xc0000019)
+#define STATUS_UNABLE_TO_FREE_VM               (0xc000001A)
+#define STATUS_UNABLE_TO_DELETE_SECTION        (0xc000001B)
+#define STATUS_INVALID_SYSTEM_SERVICE          (0xc000001C)
+#define STATUS_ILLEGAL_INSTRUCTION             (0xc000001D)
+#define STATUS_INVALID_LOCK_SEQUENCE           (0xc000001E)
+#define STATUS_INVALID_VIEW_SIZE               (0xc000001F)
+
+#define STATUS_INVALID_FILE_FOR_SECTION        (0xc0000020)
+#define STATUS_ALREADY_COMMITTED               (0xc0000021)
+#define STATUS_ACCESS_DENIED                   (0xc0000022)
+#define STATUS_BUFFER_TOO_SMALL                (0xc0000023)
+#define STATUS_OBJECT_TYPE_MISMATCH            (0xc0000024)
+#define STATUS_NONCONTINUABLE_EXCEPTION        (0xc0000025)
+#define STATUS_INVALID_DISPOSITION             (0xc0000026)
+#define STATUS_UNWIND                          (0xc0000027)
+#define STATUS_BAD_STACK                       (0xc0000028)
+#define STATUS_INVALID_UNWIND_TARGET           (0xc0000029)
+#define STATUS_NOT_LOCKED                      (0xc000002A)
+#define STATUS_PARITY_ERROR                    (0xc000002B)
+#define STATUS_UNABLE_TO_DECOMMIT_VM           (0xc000002C)
+#define STATUS_NOT_COMMITTED                   (0xc000002D)
+#define STATUS_INVALID_PORT_ATTRIBUTES         (0xc000002E)
+#define STATUS_PORT_MESSAGE_TOO_LONG           (0xc000002F)
+#define STATUS_INVALID_PARAMETER_MIX           (0xc0000030)
+#define STATUS_INVALID_QUOTA_LOWER             (0xc0000031)
+#define STATUS_DISK_CORRUPT_ERROR              (0xc0000032)
+#define STATUS_OBJECT_NAME_INVALID             (0xc0000033)
+#define STATUS_OBJECT_NAME_NOT_FOUND           (0xc0000034)
+#define STATUS_OBJECT_NAME_COLLISION           (0xc0000035)
+
+#define STATUS_PORT_DISCONNECTED               (0xc0000037)
+#define STATUS_DEVICE_ALREADY_ATTACHED         (0xc0000038)
+#define STATUS_OBJECT_PATH_INVALID             (0xc0000039)
+#define STATUS_OBJECT_PATH_NOT_FOUND           (0xc000003A)
+#define STATUS_PATH_SYNTAX_BAD                 (0xc000003B)
+#define STATUS_DATA_OVERRUN                    (0xc000003C)
+#define STATUS_DATA_LATE_ERROR                 (0xc000003D)
+#define STATUS_DATA_ERROR                      (0xc000003E)
+#define STATUS_CRC_ERROR                       (0xc000003F)
+#define STATUS_SECTION_TOO_BIG                 (0xc0000040)
+#define STATUS_PORT_CONNECTION_REFUSED         (0xc0000041)
+#define STATUS_INVALID_PORT_HANDLE             (0xc0000042)
+#define STATUS_SHARING_VIOLATION               (0xc0000043)
+#define STATUS_QUOTA_EXCEEDED                  (0xc0000044)
+#define STATUS_INVALID_PAGE_PROTECTION         (0xc0000045)
+#define STATUS_MUTANT_NOT_OWNED                (0xc0000046)
+#define STATUS_SEMAPHORE_LIMIT_EXCEEDED        (0xc0000047)
+#define STATUS_PORT_ALREADY_SET                (0xc0000048)
 
 enum
 {
- STATUS_IMAGE_NOT_AT_BASE = (0x40000003),
- STATUS_RXACT_STATE_CREATED,
- STATUS_SEGMENT_NOTIFICATION,
- STATUS_LOCAL_USER_SESSION_KEY,
- STATUS_BAD_CURRENT_DIRECTORY,
- STATUS_SERIAL_MORE_WRITES,
- STATUS_REGISTRY_RECOVERED,
- STATUS_FT_READ_RECOVERY_FROM_BACKUP,
- STATUS_FT_WRITE_RECOVERY,
- STATUS_SERIAL_COUNTER_TIMEOUT,
- STATUS_NULL_LM_PASSWORD,
- STATUS_IMAGE_MACHINE_TYPE_MISMATCH,
- STATUS_RECEIVE_PARTIAL,
- STATUS_RECEIVE_EXPEDITED,
- STATUS_RECEIVE_PARTIAL_EXPEDITED,
- STATUS_EVENT_DONE,
- STATUS_EVENT_PENDING,
- STATUS_CHECKING_FILE_SYSTEM,
- STATUS_FATAL_APP_EXIT,
- STATUS_PREDEFINED_HANDLE,
- STATUS_WAS_UNLOCKED,
- STATUS_SERVICE_NOTIFICATION,
- STATUS_WAS_LOCKED,
- STATUS_LOG_HARD_ERROR,
- STATUS_ALREADY_WIN32,
- STATUS_WX86_UNSIMULATE,
- STATUS_WX86_CONTINUE,
- STATUS_WX86_SINGLE_STEP,
- STATUS_WX86_BREAKPOINT,
- STATUS_WX86_EXCEPTION_CONTINUE,
- STATUS_WX86_EXCEPTION_LASTCHANCE,
- STATUS_WX86_EXCEPTION_CHAIN,
- STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE,
- STATUS_NO_YIELD_PERFORMED,
- STATUS_TIMER_RESUME_IGNORED,
- STATUS_ARBITRATION_UNHANDLED,
- STATUS_CARDBUS_NOT_SUPPORTED,
- STATUS_WX86_CREATEWX86TIB,
-
-
- STATUS_HANDLES_CLOSED=0x8000000A,
- STATUS_NO_INHERITANCE,
- STATUS_GUID_SUBSTITUTION_MADE,
- STATUS_PARTIAL_COPY,
- STATUS_DEVICE_PAPER_EMPTY,
- STATUS_DEVICE_POWERED_OFF,
- STATUS_DEVICE_OFF_LINE,
- STATUS_DEVICE_BUSY,
- STATUS_NO_MORE_EAS,
- STATUS_INVALID_EA_NAME,
- STATUS_EA_LIST_INCONSISTENT,
- STATUS_INVALID_EA_FLAG,
- STATUS_VERIFY_REQUIRED,
- STATUS_EXTRANEOUS_INFORMATION,
- STATUS_RXACT_COMMIT_NECESSARY,
-
- STATUS_NO_MORE_ENTRIES=0x8000001A,
- STATUS_FILEMARK_DETECTED,
- STATUS_MEDIA_CHANGED,
- STATUS_BUS_RESET,
- STATUS_END_OF_MEDIA,
- STATUS_BEGINNING_OF_MEDIA,
- STATUS_MEDIA_CHECK,
- STATUS_SETMARK_DETECTED,
- STATUS_NO_DATA_DETECTED,
- STATUS_REDIRECTOR_HAS_OPEN_HANDLES,
- STATUS_SERVER_HAS_OPEN_HANDLES,
- STATUS_ALREADY_DISCONNECTED,
- STATUS_LONGJUMP,
-
-
-// c0000010
- STATUS_INVALID_DEVICE_REQUEST,
- STATUS_END_OF_FILE,
- STATUS_WRONG_VOLUME,
- STATUS_NO_MEDIA_IN_DEVICE,
- STATUS_UNRECOGNIZED_MEDIA,
- STATUS_NONEXISTENT_SECTOR,
- STATUS_MORE_PROCESSING_REQUIRED,
- STATUS_NO_MEMORY,
- STATUS_CONFLICTING_ADDRESSES,
- STATUS_NOT_MAPPED_VIEW,
- STATUS_UNABLE_TO_FREE_VM,
- STATUS_UNABLE_TO_DELETE_SECTION,
- STATUS_INVALID_SYSTEM_SERVICE,
- STATUS_ILLEGAL_INSTRUCTION,
- STATUS_INVALID_LOCK_SEQUENCE,
- STATUS_INVALID_VIEW_SIZE,
-
-// c0000020
- STATUS_INVALID_FILE_FOR_SECTION,
- STATUS_ALREADY_COMMITTED,
- STATUS_ACCESS_DENIED,
- STATUS_BUFFER_TOO_SMALL,
- STATUS_OBJECT_TYPE_MISMATCH,
- STATUS_NONCONTINUABLE_EXCEPTION,
- STATUS_INVALID_DISPOSITION,
- STATUS_UNWIND,
- STATUS_BAD_STACK,
- STATUS_INVALID_UNWIND_TARGET,
- STATUS_NOT_LOCKED,
- STATUS_PARITY_ERROR,
- STATUS_UNABLE_TO_DECOMMIT_VM,
- STATUS_NOT_COMMITTED,
- STATUS_INVALID_PORT_ATTRIBUTES,
- STATUS_PORT_MESSAGE_TOO_LONG,
- STATUS_INVALID_PARAMETER_MIX,
- STATUS_INVALID_QUOTA_LOWER,
- STATUS_DISK_CORRUPT_ERROR,
- STATUS_OBJECT_NAME_INVALID,
- STATUS_OBJECT_NAME_NOT_FOUND,
- STATUS_OBJECT_NAME_COLLISION,
-
- STATUS_PORT_DISCONNECTED=0xC0000037L,
- STATUS_DEVICE_ALREADY_ATTACHED,
- STATUS_OBJECT_PATH_INVALID,
- STATUS_OBJECT_PATH_NOT_FOUND,
- STATUS_OBJECT_PATH_SYNTAX_BAD,
- STATUS_DATA_OVERRUN,
- STATUS_DATA_LATE_ERROR,
- STATUS_DATA_ERROR,
- STATUS_CRC_ERROR,
- STATUS_SECTION_TOO_BIG,
- STATUS_PORT_CONNECTION_REFUSED,
- STATUS_INVALID_PORT_HANDLE,
- STATUS_SHARING_VIOLATION,
- STATUS_QUOTA_EXCEEDED,
- STATUS_INVALID_PAGE_PROTECTION,
- STATUS_MUTANT_NOT_OWNED,
- STATUS_SEMAPHORE_LIMIT_EXCEEDED,
- STATUS_PORT_ALREADY_SET,
  STATUS_SECTION_NOT_IMAGE,
  STATUS_SUSPEND_COUNT_EXCEEDED,
  STATUS_THREAD_IS_TERMINATING,
@@ -478,56 +472,56 @@ enum
  STATUS_SHARED_IRQ_BUSY,
  STATUS_FT_ORPHANING,
  STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT,
+     };
+
+#define STATUS_PARTITION_FAILURE                     (0xC0000172)
+#define STATUS_INVALID_BLOCK_LENGTH                  (0xC0000173)
+#define STATUS_DEVICE_NOT_PARTITIONED                (0xC0000174)
+#define STATUS_UNABLE_TO_LOCK_MEDIA                  (0xC0000175)
+#define STATUS_UNABLE_TO_UNLOAD_MEDIA                (0xC0000176)
+#define STATUS_EOM_OVERFLOW                          (0xC0000177)
+#define STATUS_NO_MEDIA                              (0xC0000178)
+
+#define STATUS_NO_SUCH_MEMBER                        (0xC000017A)
+#define STATUS_INVALID_MEMBER                        (0xC000017B)
+#define STATUS_KEY_DELETED                           (0xC000017C)
+#define STATUS_NO_LOG_SPACE                          (0xC000017D)
+#define STATUS_TOO_MANY_SIDS                         (0xC000017E)
+#define STATUS_LM_CROSS_ENCRYPTION_REQUIRED          (0xC000017F)
+#define STATUS_KEY_HAS_CHILDREN                      (0xC0000180)
+#define STATUS_CHILD_MUST_BE_VOLATILE                (0xC0000181)
+#define STATUS_DEVICE_CONFIGURATION_ERROR            (0xC0000182)
+#define STATUS_DRIVER_INTERNAL_ERROR                 (0xC0000183)
+#define STATUS_INVALID_DEVICE_STATE                  (0xC0000184)
+#define STATUS_IO_DEVICE_ERROR                       (0xC0000185)
+#define STATUS_DEVICE_PROTOCOL_ERROR                 (0xC0000186)
+#define STATUS_BACKUP_CONTROLLER                     (0xC0000187)
+#define STATUS_LOG_FILE_FULL                         (0xC0000188)
+#define STATUS_TOO_LATE                              (0xC0000189)
+#define STATUS_NO_TRUST_LSA_SECRET                   (0xC000018A)
+#define STATUS_NO_TRUST_SAM_ACCOUNT                  (0xC000018B)
+#define STATUS_TRUSTED_DOMAIN_FAILURE                (0xC000018C)
+#define STATUS_TRUSTED_RELATIONSHIP_FAILURE          (0xC000018D)
+#define STATUS_EVENTLOG_FILE_CORRUPT                 (0xC000018E)
+#define STATUS_EVENTLOG_CANT_START                   (0xC000018F)
+#define STATUS_TRUST_FAILURE                         (0xC0000190)
+#define STATUS_MUTANT_LIMIT_EXCEEDED                 (0xC0000191)
+#define STATUS_NETLOGON_NOT_STARTED                  (0xC0000192)
+#define STATUS_ACCOUNT_EXPIRED                       (0xC0000193)
+#define STATUS_POSSIBLE_DEADLOCK                     (0xC0000194)
+#define STATUS_NETWORK_CREDENTIAL_CONFLICT           (0xC0000195)
+#define STATUS_REMOTE_SESSION_LIMIT                  (0xC0000196)
+#define STATUS_EVENTLOG_FILE_CHANGED                 (0xC0000197)
+#define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT     (0xC0000198)
+#define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT     (0xC0000199)
+#define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT          (0xC000019A)
+#define STATUS_DOMAIN_TRUST_INCONSISTENT             (0xC000019B)
+#define STATUS_FS_DRIVER_REQUIRED                    (0xC000019C)
+
+#define STATUS_RESOURCE_LANG_NOT_FOUND               (0xC0000204)
 
-
-
- STATUS_PARTITION_FAILURE=0xC0000172,
- STATUS_INVALID_BLOCK_LENGTH,
- STATUS_DEVICE_NOT_PARTITIONED,
- STATUS_UNABLE_TO_LOCK_MEDIA,
- STATUS_UNABLE_TO_UNLOAD_MEDIA,
- STATUS_EOM_OVERFLOW,
- STATUS_NO_MEDIA,
-
- STATUS_NO_SUCH_MEMBER=0xC000017A,
- STATUS_INVALID_MEMBER,
- STATUS_KEY_DELETED,
- STATUS_NO_LOG_SPACE,
- STATUS_TOO_MANY_SIDS,
- STATUS_LM_CROSS_ENCRYPTION_REQUIRED,
- STATUS_KEY_HAS_CHILDREN,
- STATUS_CHILD_MUST_BE_VOLATILE,
- STATUS_DEVICE_CONFIGURATION_ERROR,
- STATUS_DRIVER_INTERNAL_ERROR,
- STATUS_INVALID_DEVICE_STATE,
- STATUS_IO_DEVICE_ERROR,
- STATUS_DEVICE_PROTOCOL_ERROR,
- STATUS_BACKUP_CONTROLLER,
- STATUS_LOG_FILE_FULL,
- STATUS_TOO_LATE,
- STATUS_NO_TRUST_LSA_SECRET,
- STATUS_NO_TRUST_SAM_ACCOUNT,
- STATUS_TRUSTED_DOMAIN_FAILURE,
- STATUS_TRUSTED_RELATIONSHIP_FAILURE,
- STATUS_EVENTLOG_FILE_CORRUPT,
- STATUS_EVENTLOG_CANT_START,
- STATUS_TRUST_FAILURE,
- STATUS_MUTANT_LIMIT_EXCEEDED,
- STATUS_NETLOGON_NOT_STARTED,
- STATUS_ACCOUNT_EXPIRED,
- STATUS_POSSIBLE_DEADLOCK,
- STATUS_NETWORK_CREDENTIAL_CONFLICT,
- STATUS_REMOTE_SESSION_LIMIT,
- STATUS_EVENTLOG_FILE_CHANGED,
- STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT,
- STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT,
- STATUS_NOLOGON_SERVER_TRUST_ACCOUNT,
- STATUS_DOMAIN_TRUST_INCONSISTENT,
- STATUS_FS_DRIVER_REQUIRED,
-
- STATUS_RESOURCE_LANG_NOT_FOUND=0xC0000204,
-
-
+enum
+{
  RPC_NT_INVALID_STRING_BINDING=0xC0020001,
  RPC_NT_WRONG_KIND_OF_BINDING,
  RPC_NT_INVALID_BINDING,
index f8cb6b1..f523bf3 100644 (file)
@@ -424,6 +424,8 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName,
    IMAGE_DOS_HEADER DosHeader;
    HANDLE NTDllSection;
    ULONG InitialViewSize;
+   PROCESS_BASIC_INFORMATION ProcessBasicInfo;
+   ULONG retlen;
    
    DPRINT("CreateProcessW(lpApplicationName '%w', lpCommandLine '%w')\n",
           lpApplicationName,lpCommandLine);
@@ -449,6 +451,14 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName,
                            NULL,
                            NULL,
                            NULL);
+   ZwQueryInformationProcess(hProcess,
+                            ProcessBasicInformation,
+                            &ProcessBasicInfo,
+                            sizeof(ProcessBasicInfo),
+                            &retlen);
+   DPRINT("ProcessBasicInfo.UniqueProcessId %d\n",
+         ProcessBasicInfo.UniqueProcessId);
+   lpProcessInformation->dwProcessId = ProcessBasicInfo.UniqueProcessId;
    
    /*
     * Map NT DLL into the process
index 385401e..d4eb520 100644 (file)
@@ -158,12 +158,15 @@ HANDLE STDCALL OpenProcess(DWORD dwDesiredAccess,
    CLIENT_ID ClientId ;
    
    ClientId.UniqueProcess = (HANDLE)dwProcessId;
+   ClientId.UniqueThread = INVALID_HANDLE_VALUE;
+   
    ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
    ObjectAttributes.RootDirectory = (HANDLE)NULL;
    ObjectAttributes.SecurityDescriptor = NULL;
    ObjectAttributes.SecurityQualityOfService = NULL;
+   ObjectAttributes.ObjectName = NULL;
    
-   if ( bInheritHandle == TRUE )
+   if (bInheritHandle == TRUE)
      ObjectAttributes.Attributes = OBJ_INHERIT;
    else
      ObjectAttributes.Attributes = 0;
index e88860a..8d652f6 100644 (file)
@@ -177,7 +177,7 @@ static NTSTATUS LdrFindDll(PDLL* Dll, PCHAR Name)
        current = current->Next;
      } while (current != &LdrDllListHead);
    
-   DPRINT("Failed to find dll %s\n",Name);
+   dprintf("Failed to find dll %s\n",Name);
    
    return(LdrLoadDll(Dll, Name));
 }
index c8ce959..154e6f6 100644 (file)
@@ -16,7 +16,7 @@ include rules.mak
 #
 COMPONENTS = iface_native ntoskrnl
 DLLS = ntdll kernel32 crtdll fmifs
-#DLLS = crtdll mingw32
+#DLLS = advapi32
 SUBSYS = win32k
 
 #
diff --git a/reactos/ntoskrnl/exports.lst b/reactos/ntoskrnl/exports.lst
deleted file mode 100644 (file)
index 09d00e0..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-#
-# This lists all the symbols exported from the kernel to services
-#
-# NOTE: Give an export the name you normally call the function with
-# This doesn't support overloading or class members
-# Also the function should be defined with asmlinkage
-#
-#
-#
-DbgPrint
-ExAcquireFastMutex
-ExAcquireFastMutexUnsafe
-ExAcquireResourceExclusive
-ExAcquireResourceExclusiveLite
-ExAcquireResourceSharedLite
-ExAcquireSharedStarveExclusive
-ExAcquireSharedWaitForExclusive
-ExAllocateFromNPagedLookasideList
-ExAllocateFromPagedLookasideList
-ExAllocateFromZone
-ExAllocatePool
-#ExAllocatePoolWithQuota
-#ExAllocatePoolWithQuotaTag
-ExAllocatePoolWithTag
-ExConvertExclusiveToSharedLite
-ExDeleteNPagedLookasideList
-ExDeletePagedLookasideList
-ExDeleteResource
-ExDeleteResourceLite
-ExExtendZone
-ExFreePool
-ExFreeToNPagedLookasideList
-ExFreeToPagedLookasideList
-ExFreeToZone
-ExGetCurrentResourceThread
-ExGetExclusiveWaiterCount
-ExGetSharedWaiterCount
-ExHookException
-ExInitializeFastMutex
-ExInitializeNPagedLookasideList
-ExInitializePagedLookasideList
-ExInitializeResource
-ExInitializeResourceLite
-ExInitializeSListHead
-ExInitializeWorkItem
-ExInitializeZone
-ExInterlockedAddLargeInteger
-ExInterlockedAddUlong
-ExInterlockedAllocateFromZone
-ExInterlockedDecrementLong
-ExInterlockedExchangeUlong
-ExInterlockedExtendZone
-ExInterlockedFreeToZone
-ExInterlockedIncrementLong
-ExInterlockedInsertHeadList
-ExInterlockedInsertTailList
-ExInterlockedPopEntryList
-ExInterlockedPopEntrySList
-ExInterlockedPushEntryList
-ExInterlockedPushEntrySList
-ExInterlockedRemoveHeadList
-ExIsFullZone
-ExIsObjectInFirstZoneSegment
-ExIsResourceAcquiredExclusiveLite
-ExIsResourceAcquiredSharedLite
-ExLocalTimeToSystemTime
-ExQueryDepthSListHead
-ExQueueWorkItem
-ExRaiseStatus
-ExReinitializeResourceLite
-ExReleaseFastMutex
-ExReleaseFastMutexUnsafe
-ExReleaseResource
-ExReleaseResourceForThread
-ExReleaseResourceForThreadLite
-ExSystemTimeToLocalTime
-ExTryToAcquireFastMutex
-ExTryToAcquireResourceExclusiveLite
-InterlockedCompareExchange
-InterlockedExchange
-InterlockedExchangeAdd
-InterlockedIncrement
-#HalAllocateCommonBuffer
-HalAssignSlotResources
-HalExamineMBR
-#HalFreeCommonBuffer
-#HalGetAdapter
-HalGetBusData
-HalGetBusDataByOffset
-HalGetDmaAlignmentRequirement
-HalGetInterruptVector
-HalMakeBeep
-HalQuerySystemInformation
-HalReadDmaCounter
-HalSetBusData
-HalSetBusDataByOffset
-HalTranslateBusAddress
-IoAcquireCancelSpinLock
-IoAllocateAdapterChannel
-IoAllocateController
-IoAllocateErrorLogEntry
-IoAllocateIrp
-IoAllocateMdl
-IoAssignArcName
-IoAssignResources
-IoAttachDevice
-IoAttachDeviceByPointer
-IoAttachDeviceToDeviceStack
-IoBuildAsynchronousFsdRequest
-IoBuildDeviceIoControlRequest
-IoBuildPartialMdl
-IoBuildSynchronousFsdRequest
-IoCallDriver
-IoCancelIrp
-IoCheckShareAccess
-IoCompleteRequest
-IoConnectInterrupt
-IoCreateController
-IoCreateDevice
-IoCreateNotificationEvent
-IoCreateStreamFileObject
-IoCreateSymbolicLink
-IoCreateSynchronizationEvent
-IoCreateUnprotectedSymbolicLink
-IoDeassignArcName
-IoDeleteController
-IoDeleteDevice
-IoDeleteSymbolicLink
-IoDetachDevice
-IoDisconnectInterrupt
-IoFlushAdapterBuffers
-IoFreeAdapterChannel
-IoFreeController
-IoFreeIrp
-IoFreeMapRegisters
-IoFreeMdl
-IoGetConfigurationInformation
-IoGetCurrentIrpStackLocation
-IoGetCurrentProcess
-IoGetDeviceObjectPointer
-IoGetDeviceToVerify
-IoGetFileObjectGenericMapping
-IoGetFunctionCodeFromCtlCode
-IoGetInitialStack
-IoGetNextIrpStackLocation
-IoGetRelatedDeviceObject
-IoInitializeDpcRequest
-IoInitializeIrp
-IoInitializeTimer
-IoIsErrorUserInduced
-IoIsTotalDeviceFailure
-IoMakeAssociatedIrp
-IoMapTransfer
-IoMarkIrpPending
-IoQueryDeviceDescription
-IoRaiseHardError
-IoRaiseInformationalHardError
-IoReadPartitionTable
-IoRegisterDriverReinitialization
-IoRegisterFileSystem
-IoRegisterShutdownNotification
-IoReleaseCancelSpinLock
-IoRemoveShareAccess
-IoReportResourceUsage
-IoRequestDpc
-IoSetCancelRoutine
-IoSetCompletionRoutine
-IoSetHardErrorOrVerifyDevice
-IoSetNextIrpStackLocation
-IoSetPartitionInformation
-IoSetShareAccess
-IoSizeOfIrp
-IoStartNextPacket
-IoStartNextPacketByKey
-IoStartPacket
-IoStartTimer
-IoStopTimer
-IoUnregisterShutdownNotification
-IoUpdateShareAccess
-IoWriteErrorLogEntry
-IoWritePartitionTable
-KeAcquireSpinLock
-KeAcquireSpinLockAtDpcLevel
-KeBugCheck
-KeBugCheckEx
-KeCancelTimer
-KeClearEvent
-KeDelayExecutionThread
-KeDeregisterBugCheckCallback
-KeEnterCriticalRegion
-KeFlushIoBuffers
-KeGetCurrentIrql
-KeGetCurrentProcessorNumber
-KeGetDcacheFillSize
-KeInitializeCallbackRecord
-KeInitializeDeviceQueue
-KeInitializeDpc
-KeInitializeEvent
-KeInitializeMutex
-KeInitializeSemaphore
-KeInitializeSpinLock
-KeInitializeTimer
-KeInitializeTimerEx
-KeInsertByKeyDeviceQueue
-KeInsertDeviceQueue
-KeInsertQueueDpc
-KeLeaveCriticalRegion
-KeLowerIrql
-KeQueryPerformanceCounter
-KeQuerySystemTime
-KeQueryTickCount
-KeQueryTimeIncrement
-KeRaiseIrql
-KeReadStateEvent
-KeReadStateMutex
-KeReadStateSemaphore
-KeReadStateTimer
-KeRegisterBugCheckCallback
-KeReleaseMutex
-KeReleaseSemaphore
-KeReleaseSpinLock
-KeReleaseSpinLockFromDpcLevel
-KeRemoveByKeyDeviceQueue
-KeRemoveDeviceQueue
-KeRemoveQueueDpc
-KeResetEvent
-KeSetBasePriorityThread
-KeSetEvent
-KeSetPriorityThread
-KeSetTimer
-KeSetTimerEx
-KeStallExecutionProcessor
-KeSynchronizeExecution
-KeWaitForMultipleObjects
-KeWaitForMutexObject
-KeWaitForSingleObject
-MmAllocateContiguousMemory
-MmAllocateNonCachedMemory
-MmBuildMdlForNonPagedPool
-MmCreateMdl
-MmFreeContiguousMemory
-MmFreeNonCachedMemory
-MmGetMdlByteCount
-MmGetMdlByteOffset
-MmGetMdlVirtualAddress
-MmGetPhysicalAddress
-MmGetSystemAddressForMdl
-MmInitializeMdl
-MmIsAddressValid
-MmIsNonPagedSystemAddressValid
-MmIsThisAnNtAsSystem
-MmLockPagableCodeSection
-MmLockPagableDataSection
-MmLockPagableSectionByHandle
-MmMapIoSpace
-MmMapLockedPages
-MmPageEntireDriver
-MmResetDriverPaging
-MmPrepareMdlForReuse
-MmProbeAndLockPages
-MmQuerySystemSize
-MmSizeOfMdl
-MmUnlockPages
-MmUnlockPagableImageSection
-MmUnmapIoSpace
-MmUnmapLockedPages
-NtCreateToken
-ObDereferenceObject
-ObReferenceObjectByHandle
-ObReferenceObjectByPointer
-PsCreateSystemThread
-PsGetCurrentProcess
-PsGetCurrentThread
-PsTerminateSystemThread
-InitializeListHead
-InitializeObjectAttributes
-InsertHeadList
-InsertTailList
-PopEntryList
-PushEntryList
-RemoveEntryList
-RemoveHeadList
-RemoveTailList
-RtlAnsiStringToUnicodeSize
-RtlAnsiStringToUnicodeString
-RtlAppendUnicodeStringToString
-RtlAppendUnicodeToString
-RtlCharToInteger
-RtlCheckRegistryKey
-RtlCompareMemory
-RtlCompareString
-RtlCompareUnicodeString
-RtlConvertLongToLargeInteger
-RtlConvertUlongToLargeInteger
-RtlCopyBytes
-RtlCopyMemory
-RtlCopyString
-RtlCopyUnicodeString
-RtlCreateRegistryKey
-RtlCreateSecurityDescriptor
-RtlDeleteRegistryValue
-RtlEnlargedIntegerMultiply
-RtlEnlargedUnsignedDivide
-RtlEnlargedUnsignedMultiply
-RtlEqualString
-RtlEqualUnicodeString
-RtlExtendedIntegerMultiply
-RtlExtendedLargeIntegerDivide
-RtlExtendedMagicDivide
-RtlFillMemory
-RtlFreeAnsiString
-RtlFreeUnicodeString
-RtlInitAnsiString
-RtlInitString
-RtlInitUnicodeString
-#RtlIntegerToUnicodeString
-RtlLargeIntegerAdd
-RtlLargeIntegerAnd
-RtlLargeIntegerArithmeticShift
-RtlLargeIntegerDivide
-RtlLargeIntegerEqualTo
-RtlLargeIntegerEqualToZero
-RtlLargeIntegerGreaterThan
-RtlLargeIntegerGreaterThanOrEqualTo
-RtlLargeIntegerGreaterThanOrEqualToZero
-RtlLargeIntegerGreaterThanZero
-RtlLargeIntegerLessThan
-RtlLargeIntegerLessThanOrEqualTo
-RtlLargeIntegerLessThanZero
-RtlLargeIntegerNegate
-RtlLargeIntegerNotEqualTo
-RtlLargeIntegerShiftLeft
-RtlLargeIntegerShiftRight
-RtlLargeIntegerSubtract
-RtlLengthSecurityDescriptor
-RtlMoveMemory
-RtlQueryRegistryValues
-RtlRetrieveUlong
-RtlRetrieveUshort
-RtlSetDaclSecurityDescriptor
-RtlStoreUlong
-RtlStoreUshort
-RtlTimeFieldsToTime
-RtlTimeToTimeFields
-RtlUnicodeStringToAnsiString
-RtlUnicodeStringToInteger
-RtlUpcaseUnicodeString
-RtlUpperString
-RtlValidSecurityDescriptor
-RtlWriteRegistryValue
-RtlZeroMemory
-SeAccessCheck
-SeAssignSecurity
-SeDeassignSecurity
-SeSinglePrivilegeCheck
-ZwClose
-ZwCreateDirectoryObject
-ZwCreateFile
-ZwCreateKey
-ZwCreateToken
-ZwDeleteKey
-ZwEnumerateKey
-ZwEnumerateValueKey
-ZwFlushKey
-ZwMakeTemporaryObject
-ZwMapViewOfSection
-ZwOpenFile
-ZwOpenKey
-ZwOpenSection
-ZwQueryInformationFile
-ZwQueryKey
-ZwQueryValueKey
-ZwReadFile
-ZwSetInformationFile
-ZwSetInformationThread
-ZwSetValueKey
-ZwUnmapViewOfSection
-ZwWriteFile
-isdigit
-islower
-isprint
-isspace
-isupper
-isxdigit
-memchr
-memcpy
-memmove
-memset
-sprintf
-tolower
-toupper
-towlower
-towupper
-vsprintf
-wcslen
-wcschr
-wcscpy
-wcsncat
-wcsncpy
-#wtolower
-tolower
-toupper
-memcpy
-strtok
-CcInitializeFileCache
-CcRequestCachePage
-CcReleaseCachePage
-CcReleaseFileCache
index 467b8bf..b289325 100644 (file)
@@ -256,22 +256,10 @@ asmlinkage void exception_handler(unsigned int edi,
       printk("Frames:\n");
       for (i = 0; i < 32; i++)
         {
-          if (stack[i] > ((unsigned int) &stext) &&
-              stack[i] < ((unsigned int) &etext))
+          if (stack[i] > ((unsigned int) &stext))
             {
-              for (sym = -1, j = 0; symbol_table[j].name; j++)
-                {
-                  if (stack[i] >= symbol_table[j].value &&
-                      (sym == -1 ||
-                       symbol_table[j].value > symbol_table[sym].value))
-                    {
-                      sym = j;
-                    }
-                }
-              DbgPrint("  %.8x  (%s+%d)\n", 
-                       stack[i], 
-                       symbol_table[sym].name,
-                       stack[i] - symbol_table[sym].value);
+              DbgPrint("  %.8x\n", 
+                       stack[i]);
             }
         }
      }
index dae4646..c7e5eb9 100644 (file)
@@ -299,12 +299,12 @@ VOID IoCompleteRequest(PIRP Irp, CCHAR PriorityBoost)
                        NULL,
                        (PKNORMAL_ROUTINE)
                        Irp->Overlay.AsynchronousParameters.UserApcRoutine,
-                       0,
+                       KernelMode,
                        (PVOID)Irp);
        KeInsertQueueApc(&Irp->Tail.Apc,
                         Irp->Overlay.AsynchronousParameters.UserApcContext,
                         NULL,
-                        0);
+                        KernelMode);
      }
    else
      {
index 1ea5434..462911d 100644 (file)
@@ -37,8 +37,8 @@ BOOLEAN KiTestAlert(PKTHREAD Thread,
    PKAPC Apc;
    PULONG Esp = (PULONG)UserContext->Esp;
    
-   current_entry = Thread->ApcState.ApcListHead[0].Flink;
-   while (current_entry != &Thread->ApcState.ApcListHead[0])
+   current_entry = Thread->ApcState.ApcListHead[1].Flink;
+   while (current_entry != &Thread->ApcState.ApcListHead[1])
      {
        Apc = CONTAINING_RECORD(current_entry, KAPC, ApcListEntry);
        
@@ -51,6 +51,7 @@ BOOLEAN KiTestAlert(PKTHREAD Thread,
        
        current_entry = current_entry->Flink;
      }
+   UserContext->Esp = (ULONG)Esp;
    return(TRUE);
 }
 
@@ -61,11 +62,17 @@ VOID KeApcProlog2(PKAPC Apc)
  */
 {
    DPRINT("KeApcProlog2(Apc %x)\n",Apc);
+   KeEnterCriticalRegion();
+   Apc->Thread->ApcState.KernelApcInProgress++;
+   Apc->Thread->ApcState.KernelApcPending--;
+   RemoveEntryList(&Apc->ApcListEntry);
    Apc->KernelRoutine(Apc,
                      &Apc->NormalRoutine,
                      &Apc->NormalContext,
                      &Apc->SystemArgument2,
                      &Apc->SystemArgument2);
+   Apc->Thread->ApcState.KernelApcInProgress++;
+   KeLeaveCriticalRegion();
    PsSuspendThread(CONTAINING_RECORD(Apc->Thread,ETHREAD,Tcb));
 }
 
@@ -81,12 +88,6 @@ VOID KeDeliverKernelApc(PKAPC Apc)
    DPRINT("KeDeliverKernelApc(Apc %x)\n", Apc);
    
    TargetThread = Apc->Thread;
-
-   if (TargetThread->KernelApcDisable <= 0)
-     {
-       DbgPrint("Queueing apc for thread %x\n", TargetThread);
-       return;
-     }
    
    if (TargetThread == KeGetCurrentThread())
      { 
@@ -130,10 +131,17 @@ VOID KeDeliverKernelApc(PKAPC Apc)
    PsResumeThread(CONTAINING_RECORD(TargetThread,ETHREAD,Tcb));   
 }
 
-void KeInsertQueueApc(PKAPC Apc, 
+VOID KeInsertQueueApc(PKAPC Apc, 
                      PVOID SystemArgument1,
                      PVOID SystemArgument2, 
                      UCHAR Mode)
+/*
+ * FUNCTION: Queues an APC for execution
+ * ARGUMENTS:
+ *         Apc = APC to be queued
+ *         SystemArgument[1-2] = TBD
+ *         Mode = TBD
+ */
 {
    KIRQL oldlvl;
    PKTHREAD TargetThread;
@@ -151,16 +159,31 @@ void KeInsertQueueApc(PKAPC Apc,
      }
    
    TargetThread = Apc->Thread;
-   InsertTailList(&TargetThread->ApcState.ApcListHead[0], &Apc->ApcListEntry);
+   if (Apc->ApcMode == KernelMode)
+     {
+       InsertTailList(&TargetThread->ApcState.ApcListHead[0], 
+                      &Apc->ApcListEntry);
+       TargetThread->ApcState.KernelApcPending++;
+     }
+   else
+     {
+       InsertTailList(&TargetThread->ApcState.ApcListHead[1],
+                      &Apc->ApcListEntry);
+       TargetThread->ApcState.UserApcPending++;
+     }
    Apc->Inserted = TRUE;
    
    DPRINT("TargetThread->KernelApcDisable %d\n", 
          TargetThread->KernelApcDisable);
    DPRINT("Apc->KernelRoutine %x\n", Apc->KernelRoutine);
-   if (Apc->KernelRoutine != NULL)
+   if (Apc->ApcMode == KernelMode && TargetThread->KernelApcDisable >= 1)
      {
        KeDeliverKernelApc(Apc);
      }
+   else
+     {
+       DPRINT("Queuing APC for later delivery\n");
+     }
    KeLowerIrql(oldlvl);
 }
 
@@ -172,6 +195,19 @@ VOID KeInitializeApc(PKAPC Apc,
                     PKNORMAL_ROUTINE NormalRoutine,
                     UCHAR Mode,
                     PVOID Context)
+/*
+ * FUNCTION: Initialize an APC object
+ * ARGUMENTS:
+ *       Apc = Pointer to the APC object to initialized
+ *       Thread = Thread the APC is to be delivered to
+ *       StateIndex = TBD
+ *       KernelRoutine = Routine to be called for a kernel-mode APC
+ *       RundownRoutine = Routine to be called if the thread has exited with
+ *                        the APC being executed
+ *       NormalRoutine = Routine to be called for a user-mode APC
+ *       Mode = APC mode
+ *       Context = Parameter to be passed to the APC routine
+ */
 {
    DPRINT("KeInitializeApc(Apc %x, Thread %x, StateIndex %d, "
          "KernelRoutine %x, RundownRoutine %x, NormalRoutine %x, Mode %d, "
@@ -210,7 +246,43 @@ NTSTATUS STDCALL ZwQueueApcThread(HANDLE ThreadHandle,
                                  PVOID SystemArgument1,
                                  PVOID SystemArgument2)
 {
-   UNIMPLEMENTED;
+   PKAPC Apc;
+   PETHREAD Thread;
+   NTSTATUS Status;
+   
+   Status = ObReferenceObjectByHandle(ThreadHandle,
+                                     THREAD_ALL_ACCESS, /* FIXME */
+                                     PsThreadType,
+                                     UserMode,
+                                     (PVOID*)&Thread,
+                                     NULL);
+   if (!NT_SUCCESS(Status))
+     {
+       return(Status);
+     }
+   
+   Apc = ExAllocatePool(NonPagedPool, sizeof(KAPC));
+   if (Apc == NULL)
+     {
+       ObDereferenceObject(Thread);
+       return(STATUS_NO_MEMORY);
+     }
+   
+   KeInitializeApc(Apc,
+                  &Thread->Tcb,
+                  0,
+                  NULL,
+                  NULL,
+                  ApcRoutine,
+                  UserMode,
+                  NormalContext);
+   KeInsertQueueApc(Apc,
+                   SystemArgument1,
+                   SystemArgument2,
+                   UserMode);
+   
+   ObDereferenceObject(Thread);
+   return(STATUS_SUCCESS);
 }
 
 NTSTATUS STDCALL NtTestAlert(VOID)
index 4db4307..301240e 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <ddk/ntddk.h>
 
-//#define NDEBUG
+#define NDEBUG
 #include <internal/debug.h>
 
 /* FUNCTIONS *****************************************************************/
index 573cfb9..b471a7f 100644 (file)
@@ -699,6 +699,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase)
                 }
               else
                 {
+#if 0
                   /*  Get address for symbol  */
                   *SymbolNameBuf = '_';
                   strcpy(SymbolNameBuf + 1, pName);
@@ -707,6 +708,9 @@ LdrPEProcessModule(PVOID ModuleLoadBase)
                     {
                      DbgPrint("Unresolved kernel symbol: %s\n", pName);
                     }
+#else
+                  DbgPrint("Unresolved kernel symbol: %s\n", pName);
+#endif
                 }
               ImportAddressList++;
               FunctionNameList++;
@@ -874,380 +878,7 @@ LdrPEGetEnclosingSectionHeader(DWORD  RVA,
   return 0;
 }
 
-/*  -------------------------------------------  COFF Module support */
-
-PMODULE_OBJECT 
-LdrCOFFProcessModule(PVOID ModuleLoadBase)
-{
-  BOOLEAN FoundEntry;
-  char SymbolName[255];
-  int i;
-  ULONG EntryOffset;
-  FILHDR *FileHeader;
-  AOUTHDR *AOUTHeader;
-  module *Module;
-  PVOID  EntryRoutine;
-  HANDLE  ModuleHandle;
-  PMODULE_OBJECT  ModuleObject;
-  OBJECT_ATTRIBUTES  ObjectAttributes;
-  UNICODE_STRING  ModuleName;
-  WCHAR  NameBuffer[60];
-
-  /*  Get header pointers  */
-  FileHeader = ModuleLoadBase;
-  AOUTHeader = ModuleLoadBase + FILHSZ;
-  CHECKPOINT;
-
-  /*  Check COFF magic value  */
-  if (I386BADMAG(*FileHeader))
-    {
-      DbgPrint("Module has bad magic value (%x)\n", 
-               FileHeader->f_magic);
-      return 0;
-    }
-  CHECKPOINT;
-   
-  /*  Allocate and initialize a module definition structure  */
-  Module = (module *) ExAllocatePool(NonPagedPool, sizeof(module));
-  if (Module == NULL)
-    {
-      return 0;
-    }
-  Module->sym_list = (SYMENT *)(ModuleLoadBase + FileHeader->f_symptr);
-  Module->str_tab = (char *)(ModuleLoadBase + FileHeader->f_symptr +
-    FileHeader->f_nsyms * SYMESZ);
-  Module->scn_list = (SCNHDR *)(ModuleLoadBase + FILHSZ + 
-    FileHeader->f_opthdr);
-  Module->size = 0;
-  Module->raw_data_off = (ULONG) ModuleLoadBase;
-  Module->nsyms = FileHeader->f_nsyms;
-  CHECKPOINT;
-
-  /*  Determine the length of the module  */
-  for (i = 0; i < FileHeader->f_nscns; i++)
-    {
-      DPRINT("Section name: %.8s\n", Module->scn_list[i].s_name);
-      DPRINT("size %x vaddr %x size %x\n",
-             Module->size,
-             Module->scn_list[i].s_vaddr,
-             Module->scn_list[i].s_size);
-      if (Module->scn_list[i].s_flags & STYP_TEXT)
-        {
-          Module->text_base = Module->scn_list[i].s_vaddr;
-        }
-      if (Module->scn_list[i].s_flags & STYP_DATA)
-        {
-          Module->data_base = Module->scn_list[i].s_vaddr;
-        }
-      if (Module->scn_list[i].s_flags & STYP_BSS)
-        {
-          Module->bss_base = Module->scn_list[i].s_vaddr;
-        }
-      if (Module->size <
-          (Module->scn_list[i].s_vaddr + Module->scn_list[i].s_size))
-        {
-          Module->size = Module->size + Module->scn_list[i].s_vaddr +
-            Module->scn_list[i].s_size;
-        }
-    }
-  CHECKPOINT;
-
-  /*  Allocate a section for the module  */
-  Module->base = (unsigned int) MmAllocateSection(Module->size);
-  if (Module->base == 0)
-    {
-      DbgPrint("Failed to alloc section for module\n");
-      ExFreePool(Module);
-      return 0;
-    }
-  CHECKPOINT;
-
-  /*  Adjust section vaddrs for allocated area  */
-  Module->data_base = Module->data_base + Module->base;
-  Module->text_base = Module->text_base + Module->base;
-  Module->bss_base = Module->bss_base + Module->base;
-   
-  /*  Relocate module and fixup imports  */
-  for (i = 0; i < FileHeader->f_nscns; i++)
-    {
-      if (Module->scn_list[i].s_flags & STYP_TEXT ||
-          Module->scn_list[i].s_flags & STYP_DATA)
-        {
-          memcpy((PVOID)(Module->base + Module->scn_list[i].s_vaddr),
-                 (PVOID)(ModuleLoadBase + Module->scn_list[i].s_scnptr),
-                 Module->scn_list[i].s_size);
-          if (!LdrCOFFDoRelocations(Module, i))
-            {
-              DbgPrint("Relocation failed for section %s\n",
-                     Module->scn_list[i].s_name);
-
-              /* FIXME: unallocate all sections here  */
-
-              ExFreePool(Module);
-
-              return 0;
-            }
-        }
-      if (Module->scn_list[i].s_flags & STYP_BSS)
-        {
-          memset((PVOID)(Module->base + Module->scn_list[i].s_vaddr),
-                 0,
-                 Module->scn_list[i].s_size);
-        }
-    }
-   
-  DPRINT("Module base: %x\n", Module->base);
-   
-  /*  Find the entry point  */
-  EntryOffset = 0L;
-  FoundEntry = FALSE;
-  for (i = 0; i < FileHeader->f_nsyms; i++)
-    {
-      LdrCOFFGetSymbolName(Module, i, SymbolName);
-      if (!strcmp(SymbolName, "_DriverEntry"))
-        {
-          EntryOffset = Module->sym_list[i].e_value;
-          FoundEntry = TRUE;
-          DPRINT("Found entry at %x\n", EntryOffset);
-        }
-    }
-  if (!FoundEntry)
-    {
-      DbgPrint("No module entry point defined\n");
-      ExFreePool(Module);
-
-      /* FIXME: unallocate all sections here  */
-
-      return 0;
-    }
-   
-  /*  Get the address of the module initalization routine  */
-  EntryRoutine = (PVOID)(Module->base + EntryOffset);
-
-  /*  Create ModuleName string  */
-  wcscpy(NameBuffer, MODULE_ROOT_NAME);
-  /* FIXME: someone who is interested needs to fix this.  */
-  wcscat(NameBuffer, L"BOGUS.o");
-  ModuleName.Length = ModuleName.MaximumLength = wcslen(NameBuffer);
-  ModuleName.Buffer = NameBuffer;
-  DPRINT("Module name is: %w", NameBuffer);
-  
-  /*  Initialize ObjectAttributes for ModuleObject  */
-  InitializeObjectAttributes(&ObjectAttributes, 
-                             &ModuleName, 
-                             0, 
-                             NULL, 
-                             NULL);
-
-  /*  Create module object  */
-  ModuleHandle = 0;
-  ModuleObject = ObCreateObject(&ModuleHandle,
-                                OBJECT_TYPE_ALL_ACCESS,
-                                &ObjectAttributes,
-                                ObModuleType);
-
-  /*  Initialize ModuleObject data  */
-  ModuleObject->Base = (PVOID) Module->base;
-  ModuleObject->Flags = MODULE_FLAG_COFF;
-  ModuleObject->EntryPoint = (PVOID) (Module->base + EntryOffset);
-  DPRINT("entrypoint at %x\n", ModuleObject->EntryPoint);
-  /* FIXME: the COFF headers need to be copied into the module 
-     space, and the ModuleObject needs to be set to point to them  */
-
-  /*  Cleanup  */
-  ExFreePool(Module);
-
-  return  ModuleObject;
-}
-
-/*   LdrCOFFDoRelocations
- * FUNCTION: Do the relocations for a module section
- * ARGUMENTS:
- *          Module = Pointer to the module 
- *          SectionIndex = Index of the section to be relocated
- * RETURNS: Success or failure
- */
-
-static BOOLEAN 
-LdrCOFFDoRelocations(module *Module, unsigned int SectionIndex)
-{
-  SCNHDR *Section = &Module->scn_list[SectionIndex];
-  RELOC *Relocation = (RELOC *)(Module->raw_data_off + Section->s_relptr);
-  int j;
-   
-  DPRINT("SectionIndex %d Name %.8s Relocs %d\n",
-         SectionIndex,
-         Module->scn_list[SectionIndex].s_name,
-         Section->s_nreloc);
-
-  for (j = 0; j < Section->s_nreloc; j++)
-    {
-      DPRINT("vaddr %x symndex %x", 
-             Relocation->r_vaddr, 
-             Relocation->r_symndx);
-
-      switch (Relocation->r_type)
-        {
-          case RELOC_ADDR32:
-            if (!LdrCOFFDoAddr32Reloc(Module, Section, Relocation))
-              {
-                return FALSE;
-              }
-            break;
-            
-          case RELOC_REL32:
-            if (!LdrCOFFDoReloc32Reloc(Module, Section, Relocation))
-              {
-                return FALSE;
-              }
-            break;
-
-          default:
-            DbgPrint("%.8s: Unknown relocation type %x at %d in module\n",
-                   Module->scn_list[SectionIndex].s_name,
-                   Relocation->r_type,
-                   j);
-            return FALSE;
-        }
-      Relocation++;
-    }
-   DPRINT("%.8s: relocations done\n", Module->scn_list[SectionIndex].s_name);
-   
-   return TRUE;
-}                   
-
-/*
- * FUNCTION: Performs a addr32 relocation on a loaded module
- * ARGUMENTS:
- *         mod = module to perform the relocation on
- *         scn = Section to perform the relocation in
- *         reloc = Pointer to a data structure describing the relocation
- * RETURNS: Success or failure
- * NOTE: This fixes up a relocation needed when changing the base address of a
- * module
- */
-
-static BOOLEAN
-LdrCOFFDoAddr32Reloc(module *Module, SCNHDR *Section, RELOC *Relocation)
-{
-  unsigned int Value;
-  unsigned int *Location;
-   
-  Value = LdrCOFFGetSymbolValue(Module, Relocation->r_symndx);
-  Location = (unsigned int *)(Module->base + Relocation->r_vaddr);
-  DPRINT("ADDR32 loc %x value %x *loc %x\n", Location, Value, *Location);
-  *Location = (*Location) + Module->base;
-   
-  return TRUE;
-}
-
-/*
- * FUNCTION: Performs a reloc32 relocation on a loaded module
- * ARGUMENTS:
- *         mod = module to perform the relocation on
- *         scn = Section to perform the relocation in
- *         reloc = Pointer to a data structure describing the relocation
- * RETURNS: Success or failure
- * NOTE: This fixes up an undefined reference to a kernel function in a module
- */
-
-static BOOLEAN
-LdrCOFFDoReloc32Reloc(module *Module, SCNHDR *Section, RELOC *Relocation)
-{
-  char Name[255];
-  unsigned int Value;
-  unsigned int *Location;
-   
-  memset(Name, 0, 255);
-  LdrCOFFGetSymbolName(Module, Relocation->r_symndx, Name);
-  Value = (unsigned int) LdrGetKernelSymbolAddr(Name);
-  if (Value == 0L)
-    {
-      Value = LdrCOFFGetSymbolValueByName(Module, Name, Relocation->r_symndx);
-      if (Value == 0L)
-        {
-          DbgPrint("Undefined symbol %s in module\n", Name);
-          return FALSE;
-        }
-      Location = (unsigned int *)(Module->base + Relocation->r_vaddr);
-//        (*Location) = (*Location) + Value + Module->base - Section->s_vaddr;
-      (*Location) = (*Location);
-      DPRINT("Module->base %x Section->s_vaddr %x\n", 
-             Module->base, 
-             Section->s_vaddr);
-    }
-  else
-    {
-      DPRINT("REL32 value %x name %s\n", Value, Name);
-      Location = (unsigned int *)(Module->base + Relocation->r_vaddr);
-      DPRINT("old %x ", *Location);
-      DPRINT("Module->base %x Section->s_vaddr %x\n",
-             Module->base,
-             Section->s_vaddr);
-      (*Location) = (*Location) + Value - Module->base + Section->s_vaddr;
-      DPRINT("new %x\n", *Location);
-    }
-
-  return TRUE;
-}
-
-/*
- * FUNCTION: Get the name of a symbol from a loaded module by ordinal
- * ARGUMENTS:
- *      mod = module
- *      i = index of symbol
- *      name (OUT) = pointer to a string where the symbol name will be
- *                   stored
- */
-
-static void 
-LdrCOFFGetSymbolName(module *Module, unsigned int Idx, char *Name)
-{
-  if (Module->sym_list[Idx].e.e_name[0] != 0)
-    {
-      strncpy(Name, Module->sym_list[Idx].e.e_name, 8);
-      Name[8] = '\0';
-    }
-  else
-    {
-      strcpy(Name, &Module->str_tab[Module->sym_list[Idx].e.e.e_offset]);
-    }
-}
-
-/*
- * FUNCTION: Get the value of a module defined symbol
- * ARGUMENTS:
- *      mod = module
- *      i = index of symbol
- * RETURNS: The value of the symbol
- * NOTE: This fixes up references to known sections
- */
-
-static unsigned int 
-LdrCOFFGetSymbolValue(module *Module, unsigned int Idx)
-{
-  char Name[255];
-
-  LdrCOFFGetSymbolName(Module, Idx, Name);
-  DPRINT("name %s ", Name);
-   
-  /*  Check if the symbol is a section we have relocated  */
-  if (strcmp(Name, ".text") == 0)
-    {
-      return Module->text_base;
-    }
-  if (strcmp(Name, ".data") == 0)
-    {
-      return Module->data_base;
-    }
-  if (strcmp(Name, ".bss") == 0)
-    {
-      return Module->bss_base;
-    }
-
-  return Module->sym_list[Idx].e_value;
-}
-
+#if 0
 /*
  * FUNCTION: Get the address of a kernel symbol
  * ARGUMENTS:
@@ -1287,27 +918,4 @@ LdrGetKernelSymbolAddr(char *Name)
    return 0L;
 }
 
-static unsigned int 
-LdrCOFFGetSymbolValueByName(module *Module, 
-                            char *SymbolName,
-                            unsigned int Idx)
-{
-  unsigned int i;
-  char Name[255];
-   
-  DPRINT("LdrCOFFGetSymbolValueByName(sname %s, idx %x)\n", SymbolName, Idx);
-   
-  for (i = 0; i < Module->nsyms; i++)
-    {
-      LdrCOFFGetSymbolName(Module, i, Name);
-      DPRINT("Scanning %s Value %x\n", Name, Module->sym_list[i].e_value);
-      if (strcmp(Name, SymbolName) == 0)
-        {
-          DPRINT("Returning %x\n", Module->sym_list[i].e_value);
-          return Module->sym_list[i].e_value;
-        }
-    }
-
-  return 0L;
-}
-
+#endif
index 1040528..40693d5 100644 (file)
@@ -15,7 +15,7 @@ RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/strtok.o \
               rtl/wstring.o rtl/memcpy.o rtl/memmove.o rtl/memset.o \
               rtl/memchr.o
 
-KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o ke/exports.o \
+KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o \
              ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \
             ke/sem.o ke/critical.o ke/event.o ke/apc.o ke/bug.o \
             ke/mutex.o ke/kernel.o ke/ldt.o ke/apchelp.o \
@@ -122,17 +122,6 @@ CLEAN_FILES = objects/*.o cc/*.o cm/*.o dbg/*.o ex/*.o hal/x86/*.o io/*.o  \
               temp.exp ntoskrnl.exe ntoskrnl.sym
 endif
 
-utils/export/export$(EXE_POSTFIX): utils/export/export.c
-       $(NATIVE_CC) -g utils/export/export.c -o utils/export/export$(EXE_POSTFIX)
-
-ke/exports.o: exports.lst utils/export/export$(EXE_POSTFIX)
-ifeq ($(HOST),mingw32-windows)
-       .\\utils\\export\\export$(EXE_POSTFIX) < exports.lst > ke\\exports.c
-else
-       utils/export/export$(EXE_POSTFIX) < exports.lst > ke/exports.c
-endif
-       $(CC) $(CFLAGS) -c ke/exports.c -o ke/exports.o
-
 ntoskrnl.exe: $(OBJECTS) ntoskrnl.def
        $(LD) -r $(OBJECTS) -o ntoskrnl.o
        $(DLLTOOL) --dllname ntoskrnl.exe --def ntoskrnl.def \
index 730ed57..312e953 100644 (file)
@@ -25,12 +25,6 @@ extern ULONG PiNrThreads;
 
 /* FUNCTIONS *****************************************************************/
 
-VOID PiDeleteProcess(PVOID ObjectBody)
-{
-   DPRINT("PiDeleteProcess(ObjectBody %x)\n",ObjectBody);
-   (VOID)MmReleaseMmInfo((PEPROCESS)ObjectBody);
-}
-
 VOID PsTerminateCurrentThread(NTSTATUS ExitStatus)
 /*
  * FUNCTION: Terminates the current thread
@@ -59,7 +53,14 @@ VOID PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus)
  * FUNCTION: Terminate a thread when calling from that thread's context
  */
 {
-   UNIMPLEMENTED;
+   KIRQL oldlvl;
+   
+   PiNrThreads--;
+   KeRaiseIrql(DISPATCH_LEVEL, &oldlvl);
+   Thread->Tcb.State = THREAD_STATE_TERMINATED;
+   ObDereferenceObject(Thread->ThreadsProcess);
+   Thread->ThreadsProcess = NULL;
+   KeLowerIrql(oldlvl);
 }
 
 
index 103108e..0be1864 100644 (file)
@@ -19,7 +19,7 @@
 #include <internal/string.h>
 #include <internal/id.h>
 
-#define NDEBUG
+//#define NDEBUG
 #include <internal/debug.h>
 
 /* GLOBALS ******************************************************************/
@@ -79,8 +79,6 @@ VOID PsInitProcessManagment(VOID)
                                ID_PROCESS_OBJECT,
                                sizeof(EPROCESS),
                                FALSE);
-   DPRINT("SystemProcess->Pcb.Type %x\n",
-         SystemProcess->Pcb.Type);
    KProcess = &SystemProcess->Pcb;  
    
    InitializeListHead(&(KProcess->MemoryAreaList));
@@ -100,6 +98,17 @@ VOID PsInitProcessManagment(VOID)
                  &SystemProcessHandle);
 }
 
+VOID PiDeleteProcess(PVOID ObjectBody)
+{
+   KIRQL oldIrql;
+   
+   DPRINT("PiDeleteProcess(ObjectBody %x)\n",ObjectBody);
+   KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
+   RemoveEntryList(&((PEPROCESS)ObjectBody)->Pcb.ProcessListEntry);
+   KeReleaseSpinLock(&PsProcessListLock, oldIrql);
+   (VOID)MmReleaseMmInfo((PEPROCESS)ObjectBody);
+}
+
 PKPROCESS KeGetCurrentProcess(VOID)
 /*
  * FUNCTION: Returns a pointer to the current process
@@ -251,10 +260,17 @@ NTSTATUS STDCALL ZwOpenProcess (OUT PHANDLE ProcessHandle,
                                IN POBJECT_ATTRIBUTES ObjectAttributes,
                                IN PCLIENT_ID ClientId)
 {
+   DPRINT("ZwOpenProcess(ProcessHandle %x, DesiredAccess %x, "
+         "ObjectAttributes %x, ClientId %x { UniP %d, UniT %d })\n",
+         ProcessHandle, DesiredAccess, ObjectAttributes, ClientId,
+         ClientId->UniqueProcess, ClientId->UniqueThread);
+         
+   
    /*
-    * Not of the exact semantics 
+    * Not sure of the exact semantics 
     */
-   if (ObjectAttributes != NULL)
+   if (ObjectAttributes != NULL && ObjectAttributes->ObjectName != NULL &&
+       ObjectAttributes->ObjectName->Buffer != NULL)
      {
        NTSTATUS Status;
        PEPROCESS Process;
@@ -307,12 +323,14 @@ NTSTATUS STDCALL ZwOpenProcess (OUT PHANDLE ProcessHandle,
                                          FALSE,
                                          ProcessHandle);
                  ObDereferenceObject(current);
-                 
+                 DPRINT("*ProcessHandle %x\n", ProcessHandle);
+                 DPRINT("ZwOpenProcess() = %x\n", Status);
                  return(Status);                         
               }
             current_entry = current_entry->Flink;
          }
        KeReleaseSpinLock(&PsProcessListLock, oldIrql);
+       DPRINT("ZwOpenProcess() = STATUS_UNSUCCESSFUL\n");
        return(STATUS_UNSUCCESSFUL);
      }
    return(STATUS_UNSUCCESSFUL);
diff --git a/reactos/readme_rex b/reactos/readme_rex
deleted file mode 100644 (file)
index 9accce1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-DIRECTORIES
-
-system           : compiled versions of the various system components and
-                   libraries
-ntoskrnl          : microkernel source
-ntoskrnl/hal      : hardware abstraction layer source
-ntoskrnl/mm       : memory managment subsystem source
-ntoskrnl/io      : IO manager subsystem source
-include          : win32 headers
-include/internal : kernel private header files
-include/ntdll    : system library private header files
-include/kernel32 : system library private header files
-include/user32   : user interface private header files
-include/gdi32    : graphics interface private header files
-include/ddk      : header files for modules
-lib/ntdll        : NT dll source
-lib/kernel32     : kernel32 source
-doc              : documentation
-loaders/dos      : DOS based loader
-loaders/boot     : boot loader
-services         : various services (device drivers, filesystems etc)