Commit graph

113 commits

Author SHA1 Message Date
Alex Ionescu b9375052c5 - Fix the CmpObjectDelete bugcheck by hacking away some code reponsible for it. The bugcheck is probably the result of the current ref-count bug.
- Remove some more code in IoCreateFile/IopCreateFile to help with deprecating it later.

svn path=/trunk/; revision=22291
2006-06-09 08:49:03 +00:00
Alex Ionescu dc1e926987 - Add the OPEN_PACKET structure to internal headers. Used for the I/O Parse Routine.
- Gut down IopCreateFile to the strict minimum so that only the critical parts remain.
- NT Compatiblity fix in ObFindObject: stop parsing if remaining path is null, this means that the parse routine is done parsing and that -this- is the final object.

svn path=/trunk/; revision=22290
2006-06-09 07:28:26 +00:00
Alex Ionescu d7c17c883d - Add Object Header Quota structure/define
- Give Files/Devices a parse routine and currently stubplement it for debugging purposes and trying to figure out a way to kill the IopCreateFile hack.
- Implement ObpChargeQuotaForObject. Using a memory breakpoint in WinDBG I've finally found where the OB_FLAG_CREATE_INFO flag gets masked out. Also attempted a very naive quota charging implementation, but it's a guess and probably wrong (but at least it does...something.)

svn path=/trunk/; revision=22287
2006-06-08 20:58:21 +00:00
Alex Ionescu 50224a4d55 - Fix bug in IoCreateFile which my (correct) ObReferenceObjectByHandle bugfix patch uncovered. Bootcd/installation works again.
svn path=/trunk/; revision=22243
2006-06-06 02:07:55 +00:00
Alex Ionescu a12050c789 - Object Manager Improvements (3 of 3):
* Implement Per-Processor Lookaside List based allocation and de-allocation of the Object Create Information (object attributes capture) and of the object name. I counted over 4000 allocations for only 30 seconds of runtime, so this change greatly reduces pool fragmentation and increases speed. (Implementation is similar to the IRP lookaside list implementation, but inlined for speed).
  * Fix some cases where we weren't freeing captured information properly. This patch should also decrease memory leaks/usage.
  * Comment/formatting fixes.

svn path=/trunk/; revision=22100
2006-05-29 03:32:43 +00:00
Alex Ionescu 340a5ed71a - Get rid of the intriguing idea that exported/public APIs should have prototypes with inversed parameters (fix ObOpenObjectByName and all its callers).
- Isolate ObFindObject into CmFindObject for the registry routines. Because of their well-known abuse of Ob, it's better to give them their internal routine so that when/if Ob ever gets fixed to parse properly, it won't force a re-write of Cm's object routines.

svn path=/trunk/; revision=22047
2006-05-25 20:50:58 +00:00
Alex Ionescu c97cf6645c - Remove ROS-internal object macros and use the public ones in obtypes.h instead.
svn path=/trunk/; revision=22045
2006-05-25 20:14:09 +00:00
Alex Ionescu 8481c1fa10 - NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL SVN Logs for more detailed information. Thanks to Andrew (Wax), Thomas and Aleksey for testing.
svn path=/trunk/; revision=21880
2006-05-10 17:47:44 +00:00
Thomas Bluemel 2d01a7cf65 some fixes in NtReadFile and NtWrite file for (a)synchronous pipe handling and parameter checks
svn path=/trunk/; revision=20931
2006-01-17 03:25:55 +00:00
Hartmut Birr ad9750d854 Cleanup isn't necessary after calling the driver in NtQueryDirectoryFile.
svn path=/trunk/; revision=19759
2005-11-29 22:39:12 +00:00
Thomas Bluemel 3bbec11174 properly capture the file name in NtQueryDirectoryFile
svn path=/trunk/; revision=19753
2005-11-29 21:49:41 +00:00
Hartmut Birr eaf958a931 Allocate the memory for the search pattern in kernel space if it is necessary (in NtQueryDirectoryFile).
svn path=/trunk/; revision=19752
2005-11-29 19:07:03 +00:00
Alex Ionescu db3f6ecb75 - Send a hacked access state to FS Drivers, they can depend on one. For now use one with full FILE_ALL_ACCESS privileges.
svn path=/trunk/; revision=19056
2005-11-08 16:59:41 +00:00
Thomas Bluemel 0ecd041efc - if a file object is a named pipe don't allow the FILE_APPEND_DATA access right as it equals FILE_CREATE_PIPE_INSTANCE (NtFlushBuffersFile and NtWriteFile)
- add more parameters probing and capturing code

svn path=/trunk/; revision=18932
2005-11-01 16:17:25 +00:00
Thomas Bluemel 56b2e53628 don't dereference the port in NtSetInformationFile with information class FileCompletionInformation. The Also make setting the completion port thread-safe. This might fix bug 816
svn path=/trunk/; revision=18137
2005-09-28 17:15:57 +00:00
Gunnar Dalsnes b890e50a9e -reorder InsertXscendingOrder macro argument order and update uses
-start to macrofy list enums in ntoskrnl using LIST_FOR_EACH macros
-use IsListEmpty some places instead of manual coding
-profile.c:KeStartProfile() zero correct buffer in (and not the NULL ptr;-)
-improve LIST_FOR_EACH macros so that the iterator is set to NULL at end of enum
-kthread.c:KiServiceCheck() set the shadowtable before calling the win32k proc/thread init funcs
-apc.c:KiInsertQueueApc() insert special apcs in correct fifo order 
-apc.c:KeFlushQueueApc() simplify 
-timer.c:KiExpireTimers() calling RemoveEntryList on a possibly empty list is not ok

svn path=/trunk/; revision=18113
2005-09-26 22:57:48 +00:00
Hartmut Birr e6a04cca76 Merged the main code from NtQueryAttributesFile and NtQueryFullAttributesFile to IopQueryAttributesFile.
Check the access to parameters in IopQueryAttributesFile if we are called from user mode because calling Zw functions from kernel mode will bypass all checks.

svn path=/trunk/; revision=18028
2005-09-24 18:04:13 +00:00
Alex Ionescu 4e8d1019ce - More NDK/MSDDK compatibility fixes.
svn path=/trunk/; revision=17652
2005-09-05 07:51:15 +00:00
Alex Ionescu 118aa9fba3 - Fix kernel32 and ntoskrnl build issues.
- Define public version of DEVOBJ_EXTENSION in DDK.

svn path=/trunk/; revision=17650
2005-09-04 23:48:19 +00:00
Thomas Bluemel 5e348c00c1 - use inlined probing macros for basic types
- minor optimizations by comparing the processor mode against KernelMode (==0) instead of UserMode (==1)

svn path=/trunk/; revision=17467
2005-08-21 19:04:23 +00:00
Hartmut Birr f52a064741 Silence a debug message.
svn path=/trunk/; revision=17249
2005-08-09 19:35:07 +00:00
Hartmut Birr 19f47fc57c If the file object is for a device, we must gather some information
from the object attribute (at least the OBJ_INHERIT flag). We cannot 
use IoCreateStreamFileObject because a handle from such a file object 
is never inheritable.

svn path=/trunk/; revision=17248
2005-08-09 19:12:46 +00:00
Alex Ionescu b1b87307bb - Initialize more fields when creating an Object Type
- Correct the Pool Charge for Object Types, select a Default Object, always use a security procedure, read global flag for maintaing type lists, set the pool type
- Initialize a Default Wait Object.
- Fix security callback for objects.
- Implement SeDefaultObjectMethod for security callbacks of objects which don't have a custom one.

svn path=/trunk/; revision=17176
2005-08-07 18:38:37 +00:00
Filip Navara 9697817837 Stop abusing the non-paged pool.
svn path=/trunk/; revision=16869
2005-07-29 15:08:20 +00:00
Hartmut Birr 1bae97d5ce - Remove the permanent flag from an object if ObInserObject failed (in IoCreateFile).
- Bypass the driver for FilePositionInformation and FileAlignmentInformation in NtQueryInformationFile and NtSetInformationFile.

svn path=/trunk/; revision=16755
2005-07-26 19:31:41 +00:00
Filip Navara 11c02111f0 Properly setup the I/O stack location in IopSecurityFile.
svn path=/trunk/; revision=16736
2005-07-26 11:00:15 +00:00
Thomas Bluemel 1375ddbb83 use ZwQueryInformationFile and ZwSetInformationFile instead of the Nt version since we're passing kernel pointers to them which cause a probe failure in UserMode. This should fix the 1st stage setup
svn path=/trunk/; revision=16708
2005-07-24 09:11:30 +00:00
Thomas Bluemel 9f2bf70ddb removed MmCopyFromCaller and MmCopyToCaller and depend on SEH instead
svn path=/trunk/; revision=16691
2005-07-22 20:52:31 +00:00
Thomas Bluemel cc6ffdce48 fixed some signed/unsigned comparison warnings with -Wsign-compare
svn path=/trunk/; revision=16441
2005-07-05 22:35:29 +00:00
Thomas Bluemel 541151ea53 some %x -> %p fixes
svn path=/trunk/; revision=16416
2005-07-04 22:11:00 +00:00
Alex Ionescu 9b63d671e9 Dprint fixes by our lovely Filip
svn path=/trunk/; revision=16411
2005-07-04 21:01:46 +00:00
Alex Ionescu 95f0ca7fdb Build ntoskrnl with NDK, and don't use rosrtl
svn path=/trunk/; revision=16266
2005-06-25 14:04:56 +00:00
Filip Navara 52f8761d3a Use W32API for NTOSKRNL.
svn path=/trunk/; revision=16053
2005-06-18 18:32:29 +00:00
Hartmut Birr 9029590177 Try always to open a file as named object first.
This is necessary for the redirection to NUL which is used by the new build system.

svn path=/trunk/; revision=15699
2005-05-31 14:56:55 +00:00
Hartmut Birr 17b55d1d60 Changed the indentation to a more readable format (no other changes).
svn path=/trunk/; revision=15698
2005-05-31 14:51:53 +00:00
Alex Ionescu 1d899ce8b3 Fix memory leaks in object manager, use tags and use some more public types
svn path=/trunk/; revision=15486
2005-05-24 21:21:34 +00:00
Hartmut Birr 0eeb5caed9 Set the flag FO_DIRECT_DEVICE_OPEN after the call to IoCreateStreamFileObject in IoCreateFile.
svn path=/trunk/; revision=15451
2005-05-21 12:08:46 +00:00
Steven Edwards 3354ce28a8 started moving tags to a private internal header
svn path=/trunk/; revision=15426
2005-05-20 03:50:13 +00:00
Alex Ionescu 2df4b9dc13 Unnamed objects do not have a base directory.
svn path=/trunk/; revision=15409
2005-05-19 05:26:35 +00:00
Alex Ionescu 00fe79ff10 Object Manager Patch. This patch continues the work done in the previous patch and makes the following changes in order to support OB 2.0 (it basically temporarily fixes a highly incorrect implementation so that caller code will be ready to work with the OB 2.0 without change):
1) The documented Object Create Information Structure and semantics implemented. All Object Attributes and passed data from user-mode is now probed and saved into this object create structure when ObCreateObject is called.
2) ObCreateObject does NOT PERFORM ANY OTHER OPERATION EXCEPT CREATING THE OBJECT ANYMORE. ObCreateObject will NOT insert the Object into the tree and other operations. These are now done correctly by ObInsertObject. Therefore, the biggest hurdle was changing pieces of code which assumed ObCreateObject would be enough.
3) ObInsertObject uses the captured create info for all operations isntead of the Object Attributes.
4) ObFindObject now uses the captured info as well.
5) The OBject name and directory are now stored in the documented Object Name Information, always allocated and freed from non paged pool.

HACKS:
5) Because the registry code is horribly broken and doesn't use ObFindObjectByName, the old ObFindObject had to be temporarily duplicated into CmpFindObject.
7) Win32k used ObInsertObject in CsrInsertObject as a way to create a handle inside csrss. However, OBInsertObject now does more then this. As a temporary hack, ObpCreateHandle is exported from the kernel and called from win32k. A fix needs to be done for this, but I don't know the design of win32k+csrss well enough to find a solution.
8) SEH has been commented out in some places of the new probing code because it breaks smss and explorer. These need to be investigated (seh did not exist in the previous code, so this is not really a hack)
9) Named objects with a parent directory are NOT allowed. However because of bugs in kernel32, the new check has been temporarily disabled. (this check did not exist in the previous code, so this is not really a hack)

The next patch will add a proper ObFindObject which will support a more complete Parse Procedure with context and security information. This is needed for proper registry access (requested by Eric Kohl) and for proper functionality of the Desktop/File creation, which should use the Parse routine, and not the Create Handle Routine. This will also make it possible to remove some previous hacks and pave the way for a fixed Iop/IoCreateFile

svn path=/trunk/; revision=15395
2005-05-18 19:26:47 +00:00
Alex Ionescu 474cd6a3e3 Fix usetup. This hack needs to remain even though it's incorrect since it's what ROS expects. I am working on rewriting IoCreateFile so these hacks can go away. Please do not remove it
svn path=/trunk/; revision=15392
2005-05-18 17:17:34 +00:00
Alex Ionescu fe3de87064 Share NtDevice/FsIoControlFile, fixes NtFsControlFile to have same functionality as NtDev...
svn path=/trunk/; revision=15382
2005-05-17 19:04:57 +00:00
Hartmut Birr 7efa574035 - Reference the file object in IopSecurityFile.
- Don't set FO_DIRECT_DEVICE_OPEN in IoCreateStreamFileObject.  
- Disabled the setting of IRP_NOCACHE, because vfat cannot handle cached and non cached requests for the same file.  
- Set the correct device object in NtWriteFile.


svn path=/trunk/; revision=15381
2005-05-17 19:00:12 +00:00
Alex Ionescu cf6037ee37 Make Object Type creation compatible with OB 2.0 from the caller's point of view. Use real structures for Object Type and ObjectType Initializer. Added two more hacks that I'll remove in the next commit
svn path=/trunk/; revision=15317
2005-05-15 17:59:33 +00:00
Alex Ionescu 030580a782 Cleanup ntlock/unlockfile with proper io semantics..same stuff as previous patches
svn path=/trunk/; revision=15269
2005-05-13 21:07:40 +00:00
Alex Ionescu 6d1d9cbac8 Implement Lookaside List allocation and release for IRPs on Per-CPU Lists, or global system lists if the per-cpu has been exhausted. This should tremendously reduce memory fragmentation and speed up I/o noticeably. Also, don't allocate IRPs with quota charge when they shouldn't.
svn path=/trunk/; revision=15255
2005-05-13 04:49:54 +00:00
Alex Ionescu 2670be2117 Reuse buffer in IopQueryNameFile, since it's temporary and the first one we allocate is already large enough. Also block out SEH in ntread/write file since it seems to crash some user mode code.
svn path=/trunk/; revision=15196
2005-05-09 23:39:08 +00:00
Alex Ionescu de8ae0fbd2 Revert most of IoCreateStreamFileObject... it's wrong but needs to be wrong for now.
svn path=/trunk/; revision=15195
2005-05-09 22:35:43 +00:00
Hartmut Birr 78fdef703c Removed the deallocation of the irp on error after IoBuildSynchronousFsdRequest in NtRead/WriteFile.
There is no irp at this point. If the exception handler is hit, the irp isn't set.

svn path=/trunk/; revision=15192
2005-05-09 21:28:01 +00:00
Steven Edwards e92888a801 strip the whitespace one more time
svn path=/trunk/; revision=15185
2005-05-09 11:03:44 +00:00