This commit was generated by cvs2svn to compensate for changes in r10,

which included commits to RCS files with non-trunk default branches.

svn path=/trunk/; revision=11
This commit is contained in:
Rex Jolliff 1998-08-25 04:27:41 +00:00
parent 9e7d29f65a
commit b5efc5cfc5
57 changed files with 17069 additions and 14875 deletions

View file

@ -1 +1 @@
loaders\dos\loadros kernel\kimage.bin %1 %2 %3 %4 loaders\dos\loadros ntoskrnl\kimage.bin %1 %2 %3 %4

View file

@ -2,7 +2,8 @@
#include <internal/hal/irq.h> #include <internal/hal/irq.h>
#include <ddk/kedef.h>
#include <ddk/iodef.h>
/* /*
* PURPOSE: Number of a thread priority levels * PURPOSE: Number of a thread priority levels
@ -32,134 +33,6 @@ enum
PagedPoolCacheAligned, PagedPoolCacheAligned,
}; };
/*
* PURPOSE: Irp flags
*/
enum
{
/*
* Read any data from the actual backing media
*/
IRP_NOCACHE,
/*
* The I/O operation is performing paging
*/
IRP_PAGING_IO,
/*
* The IRP is for a mount operation
*/
IRP_MOUNT_COMPLETION,
/*
* The API expects synchronous behaviour
*/
IRP_SYNCHRONOUS_API,
/*
* The IRP is associated with a larger operation
*/
IRP_ASSOCIATED_IRP,
/*
* The AssociatedIrp.SystemBuffer field is valid
*/
IRP_BUFFERED_IO,
/*
* The system buffer was allocated from pool and should be deallocated
* by the I/O manager
*/
IRP_DEALLOCATE_BUFFER,
/*
* The IRP is for an input operation
*/
IRP_INPUT_OPERATION,
/*
* The paging operation should complete synchronously
*/
IRP_SYNCHRONOUS_PAGING_IO,
/*
* The IRP represents a filesystem create operation
*/
IRP_CREATE_OPERATION,
/*
* The IRP represents a filesystem read operation
*/
IRP_READ_OPERATION,
/*
* The IRP represents a filesystem write operation
*/
IRP_WRITE_OPERATION,
/*
* The IRP represents a filesystem close operation
*/
IRP_CLOSE_OPERATION,
/*
* Asynchronous behavior is advised but not required
*/
IRP_DEFER_IO_COMPLETION,
};
/*
* I/O operation flags
*/
enum
{
/*
* Force an access check even if opened in kernel mode
*/
SL_FORCE_ACCESS_CHECK,
/*
* The file being opened is a paging file
*/
SL_OPEN_PAGING_FILE,
SL_OPEN_TARGET_DIRECTORY,
SL_CASE_SENSITIVE,
SL_KEY_SPECIFIED,
SL_OVERRIDE_VERIFY_VOLUME,
SL_WRITE_THROUGH,
SL_FT_SEQUENTIAL_WRITE,
SL_FAIL_IMMEDIATELY,
SL_EXCLUSIVE_LOCK,
SL_RESTART_SCAN,
SL_RETURN_SINGLE_ENTRY,
SL_INDEX_SPECIFIED,
SL_WATCH_TREE,
SL_ALLOW_RAW_MOUNT,
};
/*
* Possible flags for the device object flags
*/
enum
{
DO_BUFFERED_IO = 0x1,
DO_DIRECT_IO = 0x2,
};
/* /*
* Possible status codes * Possible status codes
* FIXME: These may not be the actual values used by NT * FIXME: These may not be the actual values used by NT
@ -299,77 +172,118 @@ enum
STATUS_SEMAPHORE_LIMIT_EXCEEDED, STATUS_SEMAPHORE_LIMIT_EXCEEDED,
STATUS_DISK_FULL, STATUS_DISK_FULL,
STATUS_LOCK_NOT_GRANTED, STATUS_LOCK_NOT_GRANTED,
};
/* STATUS_DEVICE_NOT_READY,
* Possible device types STATUS_IO_TIMEOUT,
*/ STATUS_MEDIA_WRITE_PROTECTED,
enum STATUS_NO_MEDIA_IN_DRIVE,
{ STATUS_VERIFY_REQUIRED,
/* STATUS_UNRECOGNIZED_MEDIA,
* Standard define types // STATUS_WRONG_VOLUME,
*/
FILE_DEVICE_BEEP,
FILE_DEVICE_CDROM,
FILE_DEVICE_CONTROLLER,
FILE_DEVICE_DISK,
FILE_DEVICE_INPORT_PORT,
FILE_DEVICE_KEYBOARD,
FILE_DEVICE_MIDI_IN,
FILE_DEVICE_MIDI_OUT,
FILE_DEVICE_MOUSE,
FILE_DEVICE_NULL,
FILE_DEVICE_PARALLEL_PORT,
FILE_DEVICE_PRINTER,
FILE_DEVICE_SCANNER,
FILE_DEVICE_SERIAL_MOUSE_PORT,
FILE_DEVICE_SERIAL_PORT,
FILE_DEVICE_SCREEN,
FILE_DEVICE_TAPE,
FILE_DEVICE_UNKNOWN,
FILE_DEVICE_VIDEO,
FILE_DEVICE_VIRTUAL_DISK,
FILE_DEVICE_WAVE_IN,
FILE_DEVICE_WAVE_OUT,
FILE_DEVICE_8042_PORT,
/*
* Values beyond this are reserved for ISVs
*/
FILE_DEVICE_FIRST_FREE = 32768
};
/*
* Possible device characteristics
*/
enum
{
FILE_REMOVABLE_MEDIA = 0x1,
FILE_READ_ONLY_DEVICE = 0x2,
FILE_FLOPPY_DISKETTE = 0x4,
FILE_WRITE_ONCE_MEDIA = 0x8,
FILE_REMOTE_DEVICE = 0x10,
};
/*
* PURPOSE: Bus types
*/
enum
{
Internal,
Isa,
MicroChannel,
TurboChannel,
PCIBus,
MaximumInterfaceType,
}; };
/* /*
* This is a list of bug check types (not MS's) * This is a list of bug check types (not MS's)
*/ */
enum enum
{
APC_INDEX_MISMATCH = 1,
DEVICE_QUEUE_NOT_BUSY,
INVALID_AFFINITY_SET,
INVALID_DATA_ACCESS_TRAP,
INVALID_PROCESS_ATTACH_ATTEMPT,
INVALID_PROCESS_DEATTACH_ATTEMPT,
INVALID_SOFTWARE_INTERRUPT,
IRQL_NOT_DISPATCH_LEVEL,
IRQL_NOT_GREATER_OR_EQUAL,
NO_EXCEPTION_HANDLING_SUPPORT,
MAXIMUM_WAIT_OBJECTS_EXCEEDED,
MUTEX_LEVEL_NUMBER_VIOLATION,
NO_USER_MODE_CONTEXT,
SPIN_LOCK_ALREADY_OWNED,
SPIN_LOCK_NOT_OWNED,
THREAD_NOT_MUTEX_OWNER,
TRAP_CAUSE_UNKNOWN,
EMPTY_THREAD_REAPER_LIST,
CREATE_DELETE_LOCK_NOT_LOCKED,
LAST_CHANCE_CALLED_FROM_KMODE,
CID_HANDLE_CREATION,
CID_HANDLE_DELETION,
REFERENCE_BY_POINTER,
BAD_POOL_HEADER,
MEMORY_MANAGMENT,
PFN_SHARE_COUNT,
PFN_REFERENCE_COUNT,
NO_SPIN_LOCK_AVAILABLE,
KMODE_EXCEPTION_NOT_HANDLED,
SHARED_RESOURCE_CONV_ERROR,
KERNEL_APC_PENDING_DURING_EXIT,
QUOTA_UNDERFLOW,
FILE_SYSTEM,
FAT_FILE_SYSTEM,
NTFS_FILE_SYSTEM,
NPFS_FILE_SYSTEM,
CDFS_FILE_SYSTEM,
RDR_FILE_SYSTEM,
CORRUPT_ACCESS_TOKEN,
SECURITY_SYSTEM,
INCONSISTENT_IRP,
PANIC_STACK_SWITCH,
PORT_DRIVER_INTERNAL,
SCSI_DISK_DRIVER_INTERNAL,
INSTRUCTION_BUS_ERROR,
SET_OF_INVALID_CONTEXT,
PHASE0_INITIALIZATION_FAILED,
PHASE1_INITIALIZATION_FAILED,
UNEXPECTED_INITIALIZATION_CALL,
CACHE_MANAGER,
NO_MORE_IRP_STACK_LOCATIONS,
DEVICE_REFERENCE_COUNT_NOT_ZERO,
FLOPPY_INTERNAL_ERROR,
SERIAL_DRIVER_INTERNAL,
SYSTEM_EXIT_OWNED_MUTEX,
SYSTEM_UNWIND_PREVIOUS_USER,
SYSTEN_SERVICE_EXCEPTION,
INTERRUPT_UNWIND_ATTEMPTED,
INTERRUPT_EXCEPTION_NOT_HANDLED,
MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED,
NO_MORE_SYSTEM_PTES,
TARGET_MDL_TOO_SMALL,
MUST_SUCCEED_POOL_EMPTY,
ATDISK_DRIVER_INTERNAL,
NO_SUCH_PARTITION,
MULTIPLE_IRP_COMPLETE_REQUESTS,
INSUFFICENT_SYSTEM_MAP_PAGES,
DEREF_UNKNOWN_LOGON_SERVICE,
REF_UNKNOWN_LOGON_SERVICE,
CANCEL_STATE_IN_COMPLETED_IRP,
PAGE_FAULT_WITH_INTERRUPTS_OFF,
IRQL_GT_ZERO_AT_SYSTEM_SERVICE,
STREAMS_INTERNAL_ERROR,
FATAL_UNHANDLED_HARD_ERROR,
NO_PAGES_AVAILABLE,
PFN_LIST_CORRUPT,
NDIS_INTERNAL_ERROR,
PAGE_FAULT_IN_NONPAGED_AREA,
REGISTRY_ERROR,
MAILSLOT_FILE_SYSTEM,
NO_BOOT_DEVICE,
LM_SERVER_INTERNAL_ERROR,
DATA_COHERENCY_EXCEPTION,
INSTRUCTION_COHERENCY_EXCEPTION,
XNS_INTERNAL_ERROR,
FTDISK_INTERNAL_ERROR,
PINBALL_FILE_SYSTEM,
CRITICAL_SERVICE_FAILED,
SET_ENV_VAR_FAILED,
HAL_INITIALIZED_FAILED,
UNSUPPORTED_PROCESSOR,
OBJECT_INITIALIZATION_FAILED,
SECURITY_INITIALIZATION_FAILED,
PROCESS_INITIALIZATION_FAILED,
HAL1_INITIALIZATION_FAILED,
};
enum
{ {
KBUG_NONE, KBUG_NONE,
KBUG_ORPHANED_IRP, KBUG_ORPHANED_IRP,
@ -380,14 +294,14 @@ enum
/* /*
* These are well known but the actual value is unknown * These are well known but the actual value is unknown
*/ */
NO_PAGES_AVAILABLE, // NO_PAGES_AVAILABLE,
/* /*
* These are well known (MS) bug types * These are well known (MS) bug types
* (Reference: NT Insider 1997 - http://www.osr.com) * (Reference: NT Insider 1997 - http://www.osr.com)
*/ */
IRQL_NOT_LESS_OR_EQUAL = 0xa, IRQL_NOT_LESS_OR_EQUAL = 0xa,
KMODE_EXCEPTION_NOT_HANDLED = 0x1e, // KMODE_EXCEPTION_NOT_HANDLED = 0x1e,
UNEXPECTED_KERNEL_MODE_TRAP = 0x7f, UNEXPECTED_KERNEL_MODE_TRAP = 0x7f,
PAGE_FAULT_IN_NON_PAGED_AREA = 0x50, PAGE_FAULT_IN_NON_PAGED_AREA = 0x50,
}; };
@ -442,42 +356,6 @@ enum
IRP_MN_POWER_SEQUENCE, IRP_MN_POWER_SEQUENCE,
}; };
/*
* FIXME: These are not in the correct order
*/
enum
{
IRP_MJ_CREATE,
IRP_MJ_CREATE_NAMED_PIPE,
IRP_MJ_CLOSE,
IRP_MJ_READ,
IRP_MJ_WRITE,
IRP_MJ_QUERY_INFORMATION,
IRP_MJ_SET_INFORMATION,
IRP_MJ_QUERY_EA,
IRP_MJ_SET_EA,
IRP_MJ_FLUSH_BUFFERS,
IRP_MJ_QUERY_VOLUME_INFORMATION,
IRP_MJ_SET_VOLUME_INFORMATION,
IRP_MJ_DIRECTORY_CONTROL,
IRP_MJ_FILE_SYSTEM_CONTROL,
IRP_MJ_DEVICE_CONTROL,
IRP_MJ_INTERNAL_DEVICE_CONTROL,
IRP_MJ_SHUTDOWN,
IRP_MJ_LOCK_CONTROL,
IRP_MJ_CLEANUP,
IRP_MJ_CREATE_MAILSLOT,
IRP_MJ_QUERY_SECURITY,
IRP_MJ_SET_SECURITY,
IRP_MJ_QUERY_POWER,
IRP_MJ_SET_POWER,
IRP_MJ_DEVICE_CHANGE,
IRP_MJ_QUERY_QUOTA,
IRP_MJ_SET_QUOTA,
IRP_MJ_PNP_POWER,
IRP_MJ_MAXIMUM_FUNCTION,
};
/* /*
* PURPOSE: Used all over * PURPOSE: Used all over
*/ */

View file

@ -1,14 +1,16 @@
/* EXECUTIVE ROUTINES ******************************************************/ /* EXECUTIVE ROUTINES ******************************************************/
//VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex); VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex);
VOID ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex);
BOOLEAN ExAcquireResourceExclusive(PERESOURCE Resource, BOOLEAN Wait);
/* BOOLEAN ExAcquireResourceExclusiveLite(PERESOURCE Resource, BOOLEAN Wait);
* FUNCTION: Releases previously allocated memory BOOLEAN ExAcquireResourceSharedLite(PERESOURCE Resource, BOOLEAN Wait);
* ARGUMENTS: BOOLEAN ExAcquireSharedStarveExclusive(PERESOURCE Resource, BOOLEAN Wait);
* block = block to free BOOLEAN ExAcquireSharedWaitForExclusive(PERESOURCE Resource, BOOLEAN Wait);
*/ PVOID ExAllocateFromNPagedLookasideList(PNPAGED_LOOKASIDE_LIST LookSide);
VOID ExFreePool(PVOID block); PVOID ExAllocateFromPagedLookasideList(PPAGED_LOOKASIDE_LIST LookSide);
PVOID ExAllocateFromZone(PZONE_HEADER Zone);
/* /*
* FUNCTION: Allocates memory from the nonpaged pool * FUNCTION: Allocates memory from the nonpaged pool
@ -20,6 +22,63 @@ VOID ExFreePool(PVOID block);
*/ */
PVOID ExAllocatePool(POOL_TYPE PoolType, ULONG size); PVOID ExAllocatePool(POOL_TYPE PoolType, ULONG size);
PVOID ExAllocatePoolWithQuota(POOL_TYPE PoolType, ULONG NumberOfBytes);
PVOID ExAllocatePoolWithQuotaTag(POOL_TYPE PoolType, ULONG NumberOfBytes,
ULONG Tag);
PVOID ExAllocatePoolWithTag(POOL_TYPE PoolType, ULONG NumberOfBytes,
ULONG Tag);
VOID ExConvertExclusiveToSharedLite(PERESOURCE Resource);
VOID ExDeleteNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside);
VOID ExDeletePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside);
NTSTATUS ExDeleteResource(PERESOURCE Resource);
NTSTATUS ExDeleteResourceLite(PERESOURCE Resource);
NTSTATUS ExExtendZone(PZONE_HEADER Zone, PVOID Segment, ULONG SegmentSize);
/*
* FUNCTION: Releases previously allocated memory
* ARGUMENTS:
* block = block to free
*/
VOID ExFreePool(PVOID block);
VOID ExFreeToNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
PVOID Entry);
VOID ExFreeToPagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
PVOID Entry);
PVOID ExFreeToZone(PZONE_HEADER Zone, PVOID Block);
ERESOURCE_THREAD ExGetCurrentResourceThread(VOID);
ULONG ExGetExclusiveWaiterCount(PERESOURCE Resource);
ULONG ExGetSharedWaiterCount(PERESOURCE Resource);
VOID ExInitializeFastMutex(PFAST_MUTEX FastMutex);
VOID ExInitializeNPagedLookasideList(PNPAGED_LOOKASIDE_LIST Lookaside,
PALLOCATE_FUNCTION Allocate,
PFREE_FUNCTION Free,
ULONG Flags,
ULONG Size,
ULONG Tag,
USHORT Depth);
VOID ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST Lookaside,
PALLOCATE_FUNCTION Allocate,
PFREE_FUNCTION Free,
ULONG Flags,
ULONG Size,
ULONG Tag,
USHORT Depth);
NTSTATUS ExInitializeResource(PERESOURCE Resource);
NTSTATUS ExInitializeResourceLite(PERESOURCE Resource);
VOID ExInitializeSListHead(PSLIST_HEADER SListHead);
VOID ExInitializeWorkItem(PWORK_QUEUE_ITEM Item,
PWORKER_THREAD_ROUTINE Routine,
PVOID Context);
NTSTATUS ExInitializeZone(PZONE_HEADER Zone,
ULONG BlockSize,
PVOID InitialSegment,
ULONG InitialSegmentSize);
LARGE_INTEGER ExInterlockedAddLargeInteger(PLARGE_INTEGER Addend,
LARGE_INTEGER Increment,
PKSPIN_LOCK Lock);
ULONG ExInterlockedAddUlong(PULONG Addend, ULONG Increment, PKSPIN_LOCK Lock);
VOID ExInterlockedRemoveEntryList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry, VOID ExInterlockedRemoveEntryList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry,
PKSPIN_LOCK Lock); PKSPIN_LOCK Lock);
VOID RemoveEntryFromList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry); VOID RemoveEntryFromList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry);
@ -33,3 +92,5 @@ PLIST_ENTRY ExInterlockedInsertHeadList(PLIST_ENTRY ListHead,
PLIST_ENTRY ListEntry, PLIST_ENTRY ListEntry,
PKSPIN_LOCK Lock); PKSPIN_LOCK Lock);
VOID ExQueueWorkItem(PWORK_QUEUE_ITEM WorkItem,
WORK_QUEUE_TYPE QueueType);

View file

@ -1,3 +1,50 @@
typedef ULONG INTERLOCKED_RESULT;
typedef ULONG WORK_QUEUE_TYPE;
typedef ULONG ERESOURCE_THREAD, *PERESOURCE_THREAD;
typedef struct _OWNER_ENTRY
{
ERESOURCE_THREAD OwnerThread;
union
{
LONG OwnerCount;
ULONG TableSize;
} a;
} OWNER_ENTRY, *POWNER_ENTRY;
typedef struct _ERESOURCE
{
LIST_ENTRY SystemResourcesList;
POWNER_ENTRY OwnerTable;
SHORT ActiveCount;
USHORT Flag;
PKSEMAPHORE SharedWaiters;
PKEVENT ExclusiveWaiters;
OWNER_ENTRY OwnerThreads[2];
ULONG ContentionCount;
USHORT NumberOfSharedWaiters;
USHORT NumberOfExclusiveWaiters;
union
{
PVOID Address;
ULONG CreatorBackTraceIndex;
} a;
KSPIN_LOCK SpinLock;
} ERESOURCE, *PERESOURCE;
typedef struct
{
LONG Count;
PKTHREAD Owner;
ULONG Contention;
KEVENT Event;
ULONG OldIrql;
} FAST_MUTEX, *PFAST_MUTEX;
typedef struct _ZONE_HEADER typedef struct _ZONE_HEADER
{ {
SINGLE_LIST_ENTRY FreeList; SINGLE_LIST_ENTRY FreeList;
@ -16,3 +63,65 @@ typedef struct _ZONE_ENTRY
{ {
SINGLE_LIST_ENTRY Entry; SINGLE_LIST_ENTRY Entry;
} ZONE_ENTRY, *PZONE_ENTRY; } ZONE_ENTRY, *PZONE_ENTRY;
typedef VOID (*PWORKER_THREAD_ROUTINE)(PVOID Parameter);
typedef struct _WORK_QUEUE_ITEM
{
LIST_ENTRY Entry;
PWORKER_THREAD_ROUTINE Routine;
PVOID Context;
} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
typedef PVOID (*PALLOCATE_FUNCTION)(POOL_TYPE PoolType,
ULONG NumberOfBytes,
ULONG Tag);
typedef VOID (*PFREE_FUNCTION)(PVOID Buffer);
typedef union _SLIST_HEADER
{
ULONGLONG Alignment;
struct
{
SINGLE_LIST_ENTRY Next;
USHORT Depth;
USHORT Sequence;
} s;
} SLIST_HEADER, *PSLIST_HEADER;
typedef struct
{
SLIST_HEADER ListHead;
USHORT Depth;
USHORT Pad;
ULONG TotalAllocates;
ULONG AllocateMisses;
ULONG TotalFrees;
ULONG TotalMisses;
POOL_TYPE Type;
ULONG Tag;
ULONG Size;
PALLOCATE_FUNCTION Allocate;
PFREE_FUNCTION Free;
LIST_ENTRY ListEntry;
KSPIN_LOCK Lock;
} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
typedef struct
{
SLIST_HEADER ListHead;
USHORT Depth;
USHORT Pad;
ULONG TotalAllocates;
ULONG AllocateMisses;
ULONG TotalFrees;
ULONG TotalMisses;
POOL_TYPE Type;
ULONG Tag;
ULONG Size;
PALLOCATE_FUNCTION Allocate;
PFREE_FUNCTION Free;
LIST_ENTRY ListEntry;
FAST_MUTEX Lock;
} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;

View file

@ -224,7 +224,7 @@ BOOLEAN IoCancelIrp(PIRP Irp);
NTSTATUS IoCheckShareAccess(ACCESS_MASK DesiredAccess, NTSTATUS IoCheckShareAccess(ACCESS_MASK DesiredAccess,
ULONG DesiredShareAccess, ULONG DesiredShareAccess,
PFILE_OBJECT FileObject, PFILE_OBJECT FileObject,
// PSHARE_ACCESS ShareAccess, PSHARE_ACCESS ShareAccess,
BOOLEAN Update); BOOLEAN Update);
/* /*
@ -404,7 +404,7 @@ BOOLEAN IoRaiseHardInformationalError(NTSTATUS ErrorStatus,
NTSTATUS IoReadPartitionTable(PDEVICE_OBJECT DeviceObject, NTSTATUS IoReadPartitionTable(PDEVICE_OBJECT DeviceObject,
ULONG SectorSize, ULONG SectorSize,
BOOLEAN ReturnedRecognizedPartitions, BOOLEAN ReturnedRecognizedPartitions,
struct _DRIVER_LAYOUT_INFORMATION** PBuffer); struct _DRIVE_LAYOUT_INFORMATION** PBuffer);
VOID IoRegisterDriverReinitialization(PDRIVER_OBJECT DriverObject, VOID IoRegisterDriverReinitialization(PDRIVER_OBJECT DriverObject,
PDRIVER_REINITIALIZE ReinitRoutine, PDRIVER_REINITIALIZE ReinitRoutine,
@ -502,3 +502,22 @@ NTSTATUS IoWritePartitionTable(PDEVICE_OBJECT DeviceObject,
ULONG SectorsPerTrack, ULONG SectorsPerTrack,
ULONG NumberOfHeads, ULONG NumberOfHeads,
struct _DRIVE_LAYOUT_INFORMATION* PBuffer); struct _DRIVE_LAYOUT_INFORMATION* PBuffer);
typedef ULONG FS_INFORMATION_CLASS;
// Preliminary guess
NTKERNELAPI NTSTATUS IoQueryFileVolumeInformation(IN PFILE_OBJECT FileObject,
IN FS_INFORMATION_CLASS FsInformationClass,
IN ULONG Length,
OUT PVOID FsInformation,
OUT PULONG ReturnedLength);
NTKERNELAPI // confirmed - Undocumented because it does not require a valid file handle
NTSTATUS
IoQueryFileInformation(
IN PFILE_OBJECT FileObject,
IN FILE_INFORMATION_CLASS FileInformationClass,
IN ULONG Length,
OUT PVOID FileInformation,
OUT PULONG ReturnedLength
);

View file

@ -16,10 +16,14 @@ struct _IO_STATUS_BLOCK;
/* SIMPLE TYPES *************************************************************/ /* SIMPLE TYPES *************************************************************/
enum
{
DeallocateObject,
KeepObject,
};
typedef ULONG INTERFACE_TYPE; typedef ULONG INTERFACE_TYPE;
typedef INTERFACE_TYPE* PINTERFACE_TYPE; typedef INTERFACE_TYPE* PINTERFACE_TYPE;
typedef ULONG CONFIGURATION_TYPE;
typedef CONFIGURATION_TYPE* PCONFIGURATION_TYPE;
/* /*
* FIXME: Definition needed * FIXME: Definition needed
@ -62,8 +66,9 @@ typedef VOID (*PIO_APC_ROUTINE) (PVOID ApcContext,
*/ */
typedef struct _IO_TIMER typedef struct _IO_TIMER
{ {
} IO_TIMER, PIO_TIMER; KTIMER timer;
KDPC dpc;
} IO_TIMER, *PIO_TIMER;
/* /*
* PURPOSE: IRP stack location * PURPOSE: IRP stack location
@ -136,9 +141,6 @@ typedef struct _IO_STACK_LOCATION
*/ */
PIO_COMPLETION_ROUTINE CompletionRoutine; PIO_COMPLETION_ROUTINE CompletionRoutine;
PVOID CompletionContext; PVOID CompletionContext;
BOOLEAN InvokeOnSuccess;
BOOLEAN InvokeOnError;
BOOLEAN InvokeOnCancel;
/* /*
* Driver created device object representing the target device * Driver created device object representing the target device
@ -176,6 +178,52 @@ typedef NTSTATUS (*PDRIVER_INITIALIZE)(struct _DRIVER_OBJECT* DriverObject,
typedef NTSTATUS (*PDRIVER_CANCEL)(struct _DRIVER_OBJECT* DriverObject, typedef NTSTATUS (*PDRIVER_CANCEL)(struct _DRIVER_OBJECT* DriverObject,
PUNICODE_STRING RegistryPath); PUNICODE_STRING RegistryPath);
typedef struct _SECTION_OBJECT_POINTERS
{
PVOID DataSectionObject;
PVOID SharedCacheMap;
PVOID ImageSectionObject;
} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
typedef struct _IO_COMPLETION_CONTEXT
{
PVOID Port;
ULONG Key;
} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
typedef struct _FILE_OBJECT
{
CSHORT Type;
CSHORT Size;
struct _DEVICE_OBJECT* DeviceObject;
struct _VPB* Vpb;
PVOID FsContext;
PVOID FsContext2;
PSECTION_OBJECT_POINTERS SectionObjectPointers;
PVOID PrivateCacheMap;
NTSTATUS FinalStatus;
struct _FILE_OBJECT* RelatedFileObject;
BOOLEAN LockOperation;
BOOLEAN DeletePending;
BOOLEAN ReadAccess;
BOOLEAN WriteAccess;
BOOLEAN DeleteAccess;
BOOLEAN SharedRead;
BOOLEAN SharedWrite;
BOOLEAN SharedDelete;
ULONG Flags;
UNICODE_STRING FileName;
LARGE_INTEGER CurrentByteOffset;
ULONG Waiters;
ULONG Busy;
PVOID LastLock;
KEVENT Lock;
KEVENT Event;
PIO_COMPLETION_CONTEXT CompletionContext;
} FILE_OBJECT, *PFILE_OBJECT;
typedef struct _IRP typedef struct _IRP
{ {
PMDL MdlAddress; PMDL MdlAddress;
@ -212,13 +260,11 @@ typedef struct _IRP
struct struct
{ {
KDEVICE_QUEUE_ENTRY DeviceQueueEntry; KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
// PETHREAD Thread; PETHREAD Thread;
PVOID Thread;
PCHAR AuxiliaryBuffer; PCHAR AuxiliaryBuffer;
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
struct _IO_STACK_LOCATION* CurrentStackLocation; struct _IO_STACK_LOCATION* CurrentStackLocation;
// PFILE_OBJECT OriginalFileObject; PFILE_OBJECT OriginalFileObject;
PVOID OriginalFileObject;
} Overlay; } Overlay;
KAPC Apc; KAPC Apc;
ULONG CompletionKey; ULONG CompletionKey;
@ -288,7 +334,7 @@ typedef NTSTATUS (*PFAST_IO_DISPATCH)(struct _DEVICE_OBJECT*, IRP*);
/* /*
* Dispatch routine type declaration * Dispatch routine type declaration
*/ */
typedef NTSTATUS (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT*, IRP*); typedef VOID (*PDRIVER_STARTIO)(struct _DEVICE_OBJECT*, IRP*);
/* /*
* Dispatch routine type declaration * Dispatch routine type declaration
@ -326,14 +372,6 @@ typedef struct _DRIVER_OBJECT
} DRIVER_OBJECT, *PDRIVER_OBJECT; } DRIVER_OBJECT, *PDRIVER_OBJECT;
typedef struct _FILE_OBJECT
{
PDEVICE_OBJECT DeviceObject;
PVOID FsContext;
} FILE_OBJECT, *PFILE_OBJECT;
typedef struct _CONFIGURATION_INFORMATION typedef struct _CONFIGURATION_INFORMATION
{ {
ULONG DiskCount; ULONG DiskCount;
@ -355,20 +393,6 @@ typedef VOID (*PIO_DPC_ROUTINE)(PKDPC Dpc,
typedef VOID (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject, typedef VOID (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject,
PVOID Context); PVOID Context);
#if PKEY_VALUE_FULL_INFORMATION_DEFINED
typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)(PVOID Context,
PUNICODE_STRING PathName,
INTERFACE_TYPE BusType,
ULONG BusNumber,
PKEY_VALUE_FULL_INFORMATION* BusKey,
CONFIGURATION_TYPE ControllerType,
ULONG ControllerNumber,
PKEY_VALUE_FULL_INFORMATION* CtrlKey,
CONFIGURATION_TYPE PeripheralType,
ULONG PeripheralNumber,
PKEY_VALUE_FULL_INFORMATION* PrphKey);
#endif
#if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS #if WINDOWS_STRUCTS_DOESNT_ALREADY_DEFINE_THIS
typedef struct _PARTITION_INFORMATION typedef struct _PARTITION_INFORMATION
{ {
@ -390,4 +414,142 @@ typedef struct _DRIVER_LAYOUT_INFORMATION
PARTITION_INFORMATION PartitionEntry[1]; PARTITION_INFORMATION PartitionEntry[1];
} DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION; } DRIVER_LAYOUT_INFORMATION, *PDRIVER_LAYOUT_INFORMATION;
typedef struct _IO_RESOURCE_DESCRIPTOR
{
UCHAR Option;
UCHAR Type;
UCHAR SharedDisposition;
/*
* Reserved for system use
*/
UCHAR Spare1;
USHORT Flags;
/*
* Reserved for system use
*/
UCHAR Spare2;
union
{
struct
{
ULONG Length;
ULONG Alignment;
PHYSICAL_ADDRESS MinimumAddress;
PHYSICAL_ADDRESS MaximumAddress;
} Port;
struct
{
ULONG Length;
ULONG Alignment;
PHYSICAL_ADDRESS MinimumAddress;
PHYSICAL_ADDRESS MaximumAddress;
} Memory;
struct
{
ULONG MinimumVector;
ULONG MaximumVector;
} Interrupt;
struct
{
ULONG MinimumChannel;
ULONG MaximumChannel;
} Dma;
} u;
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
typedef struct _IO_RESOURCE_LIST
{
USHORT Version;
USHORT Revision;
ULONG Count;
IO_RESOURCE_DESCRIPTOR Descriptors[1];
} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
{
/*
* List size in bytes
*/
ULONG ListSize;
/*
* System defined enum for the bus
*/
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
ULONG SlotNumber;
ULONG Reserved[3];
ULONG AlternativeLists;
IO_RESOURCE_LIST List[1];
} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
typedef struct
{
UCHAR Type;
UCHAR ShareDisposition;
USHORT Flags;
union
{
struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
} Port;
struct
{
ULONG Level;
ULONG Vector;
ULONG Affinity;
} Interrupt;
struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
} Memory;
struct
{
ULONG Channel;
ULONG Port;
ULONG Reserved1;
} Dma;
struct
{
ULONG DataSize;
ULONG Reserved1;
ULONG Reserved2;
} DeviceSpecificData;
} u;
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
typedef struct
{
USHORT Version;
USHORT Revision;
ULONG Count;
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
} CM_PARTIAL_RESOURCE_LIST;
typedef struct
{
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
} CM_FULL_RESOURCE_DESCRIPTOR;
typedef struct
{
ULONG Count;
CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
#endif __INCLUDE_DDK_IOTYPES_H #endif __INCLUDE_DDK_IOTYPES_H

View file

@ -1,6 +1,17 @@
#ifndef __INCLUDE_DDK_KEFUNCS_H
#define __INCLUDE_DDK_KEFUNCS_H
/* KERNEL FUNCTIONS ********************************************************/ /* KERNEL FUNCTIONS ********************************************************/
/*
* FUNCTION: Acquires a spinlock so the caller can synchronize access to
* data
* ARGUMENTS:
* SpinLock = Initialized spinlock
* OldIrql (OUT) = Set the previous irql on return
*/
VOID KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql); VOID KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql);
VOID KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock); VOID KeAcquireSpinLockAtDpcLevel(PKSPIN_LOCK SpinLock);
BOOLEAN KeCancelTimer(PKTIMER Timer); BOOLEAN KeCancelTimer(PKTIMER Timer);
VOID KeClearEvent(PKEVENT Event); VOID KeClearEvent(PKEVENT Event);
@ -14,6 +25,7 @@ VOID KeFlushIoBuffers(PMDL Mdl, BOOLEAN ReadOperation, BOOLEAN DmaOperation);
KIRQL KeGetCurrentIrql(VOID); KIRQL KeGetCurrentIrql(VOID);
ULONG KeGetCurrentProcessorNumber(VOID); ULONG KeGetCurrentProcessorNumber(VOID);
ULONG KeGetDcacheFillSize(VOID); ULONG KeGetDcacheFillSize(VOID);
PKTHREAD KeGetCurrentThread(VOID);
VOID KeInitializeCallbackRecord(PKBUGCHECK_CALLBACK_RECORD CallbackRecord); VOID KeInitializeCallbackRecord(PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
VOID KeInitializeDeviceQueue(PKDEVICE_QUEUE DeviceQueue); VOID KeInitializeDeviceQueue(PKDEVICE_QUEUE DeviceQueue);
VOID KeInitializeDpc(PKDPC Dpc, PKDEFERRED_ROUTINE DeferredRoutine, VOID KeInitializeDpc(PKDPC Dpc, PKDEFERRED_ROUTINE DeferredRoutine,
@ -122,3 +134,5 @@ VOID KeBugCheckEx(ULONG BugCheckCode,
* RETURNS: Doesn't * RETURNS: Doesn't
*/ */
VOID KeBugCheck(ULONG BugCheckCode); VOID KeBugCheck(ULONG BugCheckCode);
#endif /* __INCLUDE_DDK_KEFUNCS_H */

View file

@ -1,63 +1,154 @@
/* KERNEL TYPES **************************************************************/
#ifndef __INCLUDE_DDK_KETYPES_H
#define __INCLUDE_DDK_KETYPES_H
typedef LONG KPRIORITY; typedef LONG KPRIORITY;
typedef VOID (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length); typedef VOID (*PKBUGCHECK_CALLBACK_ROUTINE)(PVOID Buffer, ULONG Length);
typedef BOOLEAN (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext); typedef BOOLEAN (*PKSYNCHRONIZE_ROUTINE)(PVOID SynchronizeContext);
struct _KAPC;
typedef VOID (*PKNORMAL_ROUTINE)(PVOID NormalContext,
PVOID SystemArgument1,
PVOID SystemArgument2);
typedef VOID (*PKKERNEL_ROUTINE)(struct _KAPC* Apc,
PKNORMAL_ROUTINE* NormalRoutine,
PVOID* NormalContext,
PVOID* SystemArgument1,
PVOID* SystemArgument2);
typedef VOID (*PKRUNDOWN_ROUTINE)(struct _KAPC* Apc);
typedef struct
/*
* PURPOSE: Object describing the wait a thread is currently performing
*/
{
LIST_ENTRY WaitListEntry;
struct _KTHREAD* Thread;
PVOID Object;
struct _KWAIT_BLOCK* NextWaitBlock;
USHORT WaitKey;
USHORT WaitType;
} KWAIT_BLOCK, *PKWAIT_BLOCK;
typedef struct _ETHREAD
/*
* PURPOSE: Describes a thread of execution
*/
{
CSHORT Type;
CSHORT Size;
/*
* PURPOSE: Head of the queue of apcs
*/
LIST_ENTRY apc_queue_head;
/*
* PURPOSE: Entry in the linked list of threads
*/
LIST_ENTRY Entry;
/*
* PURPOSE: Current state of the thread
*/
ULONG State;
/*
* PURPOSE: Priority modifier of the thread
*/
ULONG Priority;
/*
* PURPOSE: Pointer to our process
*/
struct _EPROCESS* Process;
/*
* PURPOSE: Handle of our process
*/
HANDLE ProcessHandle;
/*
* PURPOSE: Thread affinity mask
*/
ULONG AffinityMask;
/*
* PURPOSE: Saved thread context
*/
hal_thread_state context;
} KTHREAD, *PKTHREAD, *PETHREAD;
typedef struct _DISPATCHER_HEADER
{
UCHAR Type;
UCHAR Absolute;
UCHAR Size;
UCHAR Inserted;
LONG SignalState;
LIST_ENTRY WaitListHead;
} DISPATCHER_HEADER;
typedef struct _KAPC
{
CSHORT Type;
CSHORT Size;
ULONG Spare0;
struct _KTHREAD* Thread;
LIST_ENTRY ApcListEntry;
PKKERNEL_ROUTINE KernelRoutine;
PKRUNDOWN_ROUTINE RundownRoutine;
PKNORMAL_ROUTINE NormalRoutine;
PVOID NormalContext;
PVOID SystemArgument1;
PVOID SystemArgument2;
CCHAR ApcStateIndex;
KPROCESSOR_MODE ApcMode;
BOOLEAN Inserted;
} KAPC, *PKAPC;
typedef struct typedef struct
{ {
LIST_ENTRY Entry;
PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
PVOID Buffer;
ULONG Length;
PUCHAR Component;
ULONG Checksum;
UCHAR State;
} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD; } KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
typedef struct typedef struct
{ {
DISPATCHER_HEADER Header;
LIST_ENTRY MutantListEntry;
struct _KTHREAD* OwnerThread;
BOOLEAN Abandoned;
UCHAR ApcDisable;
} KMUTEX, *PKMUTEX; } KMUTEX, *PKMUTEX;
typedef struct typedef struct
{ {
DISPATCHER_HEADER Header;
LONG Limit;
} KSEMAPHORE, *PKSEMAPHORE; } KSEMAPHORE, *PKSEMAPHORE;
typedef struct typedef struct _KEVENT
{
} KTHREAD, *PKTHREAD;
/*
* PURPOSE: Included in every object that a thread can wait on
*/
typedef struct
{
/*
* PURPOSE: True if the object is signaling a change of state
*/
BOOLEAN signaled;
/*
* PURPOSE: Head of the queue of threads waiting on this object
*/
LIST_ENTRY wait_queue_head;
/*
* PURPOSE: True if all the threads waiting should be woken when the
* object changes state
*/
BOOLEAN wake_all;
} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
/* /*
* PURPOSE: Describes an event * PURPOSE: Describes an event
*/ */
typedef struct _KEVENT
{ {
/* /*
* PURPOSE: So we can use the general wait routine * PURPOSE: So we can use the general wait routine
*/ */
DISPATCHER_HEADER hdr; DISPATCHER_HEADER Header;
/*
* PURPOSE: Type of event, notification or synchronization
*/
EVENT_TYPE type;
} KEVENT, *PKEVENT; } KEVENT, *PKEVENT;
@ -66,14 +157,6 @@ typedef struct _KSPIN_LOCK
KIRQL irql; KIRQL irql;
} KSPIN_LOCK, *PKSPIN_LOCK; } KSPIN_LOCK, *PKSPIN_LOCK;
typedef struct
{
} KAPC;
typedef struct
{
} UNICODE_STRING;
typedef VOID (*PDRIVER_ADD_DEVICE)(VOID); typedef VOID (*PDRIVER_ADD_DEVICE)(VOID);
struct _KDPC; struct _KDPC;
@ -139,3 +222,63 @@ typedef struct _KDEVICE_QUEUE_ENTRY
typedef struct _WAIT_CONTEXT_BLOCK typedef struct _WAIT_CONTEXT_BLOCK
{ {
} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
typedef struct _KTIMER
{
/*
* Pointers to maintain the linked list of activated timers
*/
LIST_ENTRY entry;
/*
* Absolute expiration time in system time units
*/
unsigned long long expire_time;
/*
* Optional dpc associated with the timer
*/
PKDPC dpc;
/*
* True if the timer is signaled
*/
BOOLEAN signaled;
/*
* True if the timer is in the system timer queue
*/
BOOLEAN running;
/*
* Type of the timer either Notification or Synchronization
*/
TIMER_TYPE type;
/*
* Period of the timer in milliseconds (zero if once-only)
*/
ULONG period;
} KTIMER, *PKTIMER;
struct _KINTERRUPT;
typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
PVOID ServiceContext);
typedef struct _KINTERRUPT
{
ULONG Vector;
KAFFINITY ProcessorEnableMask;
PKSPIN_LOCK IrqLock;
BOOLEAN Shareable;
BOOLEAN FloatingSave;
PKSERVICE_ROUTINE ServiceRoutine;
PVOID ServiceContext;
LIST_ENTRY Entry;
KIRQL SynchLevel;
} KINTERRUPT, *PKINTERRUPT;
#endif /* __INCLUDE_DDK_KETYPES_H */

View file

@ -152,7 +152,7 @@ PVOID MmGetSystemAddressForMdl(PMDL Mdl);
* BaseVa = Base virtual address of the buffer * BaseVa = Base virtual address of the buffer
* Length = Length in bytes of the buffer * Length = Length in bytes of the buffer
*/ */
VOID MmInitalizeMdl(PMDL MemoryDescriptorList, PVOID BaseVa, ULONG Length); VOID MmInitializeMdl(PMDL MemoryDescriptorList, PVOID BaseVa, ULONG Length);
/* /*
* FUNCTION: Checks whether an address is valid for read/write * FUNCTION: Checks whether an address is valid for read/write

View file

@ -1,24 +1,14 @@
typedef struct _MDL typedef struct _MDL
/* /*
* PURPOSE: Describes a user buffer passed to a system API * PURPOSE: Describes a user buffer passed to a system API
*/ */
{ {
/* struct _MDL* Next;
* Base address of the buffer in user mode CSHORT Size;
*/ CSHORT MdlFlags;
PVOID Base; struct _EPROCESS* Process;
PVOID MappedSystemVa;
/* PVOID StartVa;
* Length of the buffer in bytes ULONG ByteCount;
*/ ULONG ByteOffset;
ULONG Length;
/*
* System address of buffer or NULL if not mapped
*/
PVOID SysBase;
/*
* Below this is a variable length list of page physical address
*/
} MDL, *PMDL; } MDL, *PMDL;

View file

@ -19,12 +19,43 @@ extern "C"
/* INCLUDES ***************************************************************/ /* INCLUDES ***************************************************************/
#include <windows.h> #include <windows.h>
#include <internal/hal/page.h>
#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0)
#define NTKERNELAPI
#define CTL_CODE(Dev, Func, Meth, Acc) ( ((Dev)<<16) | ((Acc)<<14) | ((Func)<<2) | (Meth))
// IOCTL Parameter buffering methods
#define METHOD_BUFFERED 0
#define METHOD_IN_DIRECT 1
#define METHOD_OUT_DIRECT 2
#define METHOD_NEITHER 3
// IOCTL File access type
#define FILE_ANY_ACCESS 0
#define FILE_READ_ACCESS 1
#define FILE_WRITE_ACCESS 2
#define QUAD_PART(LI) (*(LONGLONG *)(&LI))
enum {
STATUS_NOT_SUPPORTED = 9999,
STATUS_DISK_OPERATION_FAILED
};
#define IO_DISK_INCREMENT 4
#define FILE_WORD_ALIGNMENT 0x0001
#define FILE_OPENED 0x0001
#include <ddk/defines.h> #include <ddk/defines.h>
#include <ddk/types.h> #include <ddk/types.h>
#include <ddk/structs.h> #include <ddk/structs.h>
#include <ddk/setypes.h>
#include <internal/hal/ddk.h> #include <internal/hal/ddk.h>
#include <ddk/rtl.h> #include <ddk/rtl.h>
#include <ddk/zw.h> #include <ddk/zw.h>
#include <ddk/exfuncs.h> #include <ddk/exfuncs.h>
@ -32,6 +63,9 @@ extern "C"
#include <ddk/kefuncs.h> #include <ddk/kefuncs.h>
#include <ddk/iofuncs.h> #include <ddk/iofuncs.h>
#include <ddk/psfuncs.h> #include <ddk/psfuncs.h>
#include <ddk/obfuncs.h>
ULONG DbgPrint(PCH Format,...);
#ifdef __cplusplus #ifdef __cplusplus
}; };

View file

@ -12,7 +12,7 @@ typedef struct _OBJECT_TYPE
/* /*
* PURPOSE: Name of the type * PURPOSE: Name of the type
*/ */
LPCSTR TypeName; UNICODE_STRING TypeName;
/* /*
* PURPOSE: Total number of objects of this type * PURPOSE: Total number of objects of this type
@ -96,7 +96,7 @@ typedef struct _OBJECT
/* /*
* PURPOSE: Name of this entry * PURPOSE: Name of this entry
*/ */
LPCSTR name; UNICODE_STRING name;
/* /*
* PURPOSE: Our entry in our parents list of subdirectory * PURPOSE: Our entry in our parents list of subdirectory
@ -139,11 +139,11 @@ typedef struct _OBJECT_ATTRIBUTES
*/ */
ULONG Attributes; ULONG Attributes;
//SECURITY_DESCRIPTOR SecurityDescriptor SECURITY_DESCRIPTOR SecurityDescriptor;
//SecurityQualityOfService // SecurityQualityOfService
struct _DIRECTORY_OBJECT* parent; struct _DIRECTORY_OBJECT* parent;
char* name; UNICODE_STRING name;
char* path; UNICODE_STRING path;
} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;

View file

@ -25,3 +25,8 @@ NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle,
PCLIENT_ID ClientId, PCLIENT_ID ClientId,
PKSTART_ROUTINE StartRoutine, PKSTART_ROUTINE StartRoutine,
PVOID StartContext); PVOID StartContext);
NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus);
NTSTATUS PsSuspendThread(VOID);
NTSTATUS PsWakeThread(PETHREAD Thread);
PETHREAD PsGetCurrentThread(VOID);
PEPROCESS PsGetCurrentProcess(VOID);

View file

@ -3,6 +3,8 @@
#include <kernel32/heap.h> #include <kernel32/heap.h>
typedef ULONG THREADINFOCLASS;
typedef struct _CLIENT_ID typedef struct _CLIENT_ID
{ {
HANDLE UniqueProcess; HANDLE UniqueProcess;
@ -60,10 +62,7 @@ typedef struct _NT_PEB
WORD wMinorVersion; WORD wMinorVersion;
WORD wBuildNumber; WORD wBuildNumber;
WORD wPlatformId; WORD wPlatformId;
} NT_PEB; } NT_PEB, *PPEB;
typedef NT_PEB *PPEB;
typedef struct _NT_TIB { typedef struct _NT_TIB {
@ -104,8 +103,58 @@ typedef struct _EPROCESS
{ {
} EPROCESS, *PEPROCESS; } EPROCESS, *PEPROCESS;
//typedef KTHREAD ETHREAD, *PETHREAD;
#if ETHREAD_NOT_THE_SAME_AS_KTHREAD
typedef struct _ETHREAD typedef struct _ETHREAD
{ {
EPROCESS* Process;
} ETHREAD, *PETHREAD; } ETHREAD, *PETHREAD;
/*
* PURPOSE: Thread object
*/
typedef struct
{
CSHORT Type;
CSHORT Size;
/*
* PURPOSE: Entry in the linked list of threads
*/
LIST_ENTRY Entry;
/*
* PURPOSE: Current state of the thread
*/
ULONG State;
/*
* PURPOSE: Priority modifier of the thread
*/
ULONG Priority;
/*
* PURPOSE: Pointer to our parent process
*/
// PEPROCESS Parent;
/*
* PURPOSE: Handle of our parent process
*/
HANDLE ParentHandle;
/*
* PURPOSE: Not currently used
*/
ULONG AffinityMask;
/*
* PURPOSE: Saved thread context
*/
hal_thread_state context;
} THREAD_OBJECT, *PTHREAD_OBJECT;
#endif
#endif /* __INCLUDE_DDK_PSTYPES_H */ #endif /* __INCLUDE_DDK_PSTYPES_H */

View file

@ -5,6 +5,52 @@
#ifndef __DDK_RTL_H #ifndef __DDK_RTL_H
#define __DDK_RTL_H #define __DDK_RTL_H
typedef struct _CONTROLLER_OBJECT
{
CSHORT Type;
CSHORT Size;
PVOID ControllerExtension;
KDEVICE_QUEUE DeviceWaitQueue;
ULONG Spare1;
LARGE_INTEGER Spare2;
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
typedef struct _STRING
{
/*
* Length in bytes of the string stored in buffer
*/
USHORT Length;
/*
* Maximum length of the string
*/
USHORT MaximumLength;
/*
* String
*/
PCHAR Buffer;
} STRING, *PSTRING;
typedef struct _ANSI_STRING
{
/*
* Length in bytes of the string stored in buffer
*/
USHORT Length;
/*
* Maximum length of the string
*/
USHORT MaximumLength;
/*
* String
*/
PCHAR Buffer;
} ANSI_STRING, *PANSI_STRING;
typedef struct _TIME_FIELDS typedef struct _TIME_FIELDS
{ {
CSHORT Year; CSHORT Year;
@ -179,6 +225,43 @@ VOID RtlStoreLong(PULONG Address, ULONG Value);
VOID RtlStoreUshort(PUSHORT Address, USHORT Value); VOID RtlStoreUshort(PUSHORT Address, USHORT Value);
BOOLEAN RtlTimeFieldsToTime(PTIME_FIELDS TimeFields, PLARGE_INTEGER Time); BOOLEAN RtlTimeFieldsToTime(PTIME_FIELDS TimeFields, PLARGE_INTEGER Time);
VOID RtlTimeToTimeFields(PLARGE_INTEGER Time, PTIME_FIELDS TimeFields); VOID RtlTimeToTimeFields(PLARGE_INTEGER Time, PTIME_FIELDS TimeFields);
PWSTR RtlStrtok(PUNICODE_STRING _string, PWSTR _sep, PWSTR* temp);
typedef struct {
ULONG Length;
ULONG Unknown[11];
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
// Heap creation routine
HANDLE
STDCALL
RtlCreateHeap(
ULONG Flags,
PVOID BaseAddress,
ULONG SizeToReserve,
ULONG SizeToCommit,
PVOID Unknown,
PRTL_HEAP_DEFINITION Definition
);
PVOID
STDCALL
RtlAllocateHeap(
HANDLE Heap,
ULONG Flags,
ULONG Size
);
BOOLEAN
STDCALL
RtlFreeHeap(
HANDLE Heap,
ULONG Flags,
PVOID Address
);
#endif /* __DDK_RTL_H */ #endif /* __DDK_RTL_H */

View file

@ -9,310 +9,6 @@
#include <ddk/extypes.h> #include <ddk/extypes.h>
#include <ddk/pstypes.h> #include <ddk/pstypes.h>
/*
* PURPOSE: Thread object
*/
typedef struct
{
CSHORT Type;
CSHORT Size;
/*
* PURPOSE: Entry in the linked list of threads
*/
LIST_ENTRY Entry;
/*
* PURPOSE: Current state of the thread
*/
ULONG State;
/*
* PURPOSE: Priority modifier of the thread
*/
ULONG Priority;
/*
* PURPOSE: Pointer to our parent process
*/
// PEPROCESS Parent;
/*
* PURPOSE: Handle of our parent process
*/
HANDLE ParentHandle;
/*
* PURPOSE: Not currently used
*/
ULONG AffinityMask;
/*
* PURPOSE: Saved thread context
*/
hal_thread_state context;
} THREAD_OBJECT, *PTHREAD_OBJECT;
/*
* PURPOSE: Object describing the wait a thread is currently performing
*/
typedef struct
{
/*
* PURPOSE: Pointer to the waiting thread
*/
PTHREAD_OBJECT thread;
/*
* PURPOSE: Entry in the wait queue for the object being waited on
*/
LIST_ENTRY Entry;
/*
* PURPOSE: Pointer to the object being waited on
*/
DISPATCHER_HEADER* wait_object;
} KWAIT_BLOCK, *PKWAIT_BLOCK;
typedef struct _ADAPTER_OBJECT typedef struct _ADAPTER_OBJECT
{ {
} ADAPTER_OBJECT, *PADAPTER_OBJECT; } ADAPTER_OBJECT, *PADAPTER_OBJECT;
typedef struct _CONTROLLER_OBJECT
{
PVOID ControllerExtension;
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
typedef struct _STRING
{
/*
* Length in bytes of the string stored in buffer
*/
USHORT Length;
/*
* Maximum length of the string
*/
USHORT MaximumLength;
/*
* String
*/
PCHAR Buffer;
} STRING, *PSTRING;
typedef struct _ANSI_STRING
{
/*
* Length in bytes of the string stored in buffer
*/
USHORT Length;
/*
* Maximum length of the string
*/
USHORT MaximumLength;
/*
* String
*/
PCHAR Buffer;
} ANSI_STRING, *PANSI_STRING;
typedef struct _KTIMER
{
/*
* Pointers to maintain the linked list of activated timers
*/
LIST_ENTRY entry;
/*
* Absolute expiration time in system time units
*/
unsigned long long expire_time;
/*
* Optional dpc associated with the timer
*/
PKDPC dpc;
/*
* True if the timer is signaled
*/
BOOLEAN signaled;
/*
* True if the timer is in the system timer queue
*/
BOOLEAN running;
/*
* Type of the timer either Notification or Synchronization
*/
TIMER_TYPE type;
/*
* Period of the timer in milliseconds (zero if once-only)
*/
ULONG period;
} KTIMER, *PKTIMER;
typedef struct _IO_RESOURCE_DESCRIPTOR
{
UCHAR Option;
UCHAR Type;
UCHAR SharedDisposition;
/*
* Reserved for system use
*/
UCHAR Spare1;
USHORT Flags;
/*
* Reserved for system use
*/
UCHAR Spare2;
union
{
struct
{
ULONG Length;
ULONG Alignment;
PHYSICAL_ADDRESS MinimumAddress;
PHYSICAL_ADDRESS MaximumAddress;
} Port;
struct
{
ULONG Length;
ULONG Alignment;
PHYSICAL_ADDRESS MinimumAddress;
PHYSICAL_ADDRESS MaximumAddress;
} Memory;
struct
{
ULONG MinimumVector;
ULONG MaximumVector;
} Interrupt;
struct
{
ULONG MinimumChannel;
ULONG MaximumChannel;
} Dma;
} u;
} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
typedef struct _IO_RESOURCE_LIST
{
USHORT Version;
USHORT Revision;
ULONG Count;
IO_RESOURCE_DESCRIPTOR Descriptors[1];
} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
typedef struct _IO_RESOURCES_REQUIREMENTS_LIST
{
/*
* List size in bytes
*/
ULONG ListSize;
/*
* System defined enum for the bus
*/
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
ULONG SlotNumber;
ULONG Reserved[3];
ULONG AlternativeLists;
IO_RESOURCE_LIST List[1];
} IO_RESOURCES_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
typedef struct
{
UCHAR Type;
UCHAR ShareDisposition;
USHORT Flags;
union
{
struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
} Port;
struct
{
ULONG Level;
ULONG Vector;
ULONG Affinity;
} Interrupt;
struct
{
PHYSICAL_ADDRESS Start;
ULONG Length;
} Memory;
struct
{
ULONG Channel;
ULONG Port;
ULONG Reserved1;
} Dma;
struct
{
ULONG DataSize;
ULONG Reserved1;
ULONG Reserved2;
} DeviceSpecificData;
} u;
} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
typedef struct
{
USHORT Version;
USHORT Revision;
ULONG Count;
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
} CM_PARTIAL_RESOURCE_LIST;
typedef struct
{
INTERFACE_TYPE InterfaceType;
ULONG BusNumber;
CM_PARTIAL_RESOURCE_LIST PartialResourceList;
} CM_FULL_RESOURCE_DESCRIPTOR;
typedef struct
{
ULONG Count;
CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
struct _KINTERRUPT;
typedef BOOLEAN (*PKSERVICE_ROUTINE)(struct _KINTERRUPT* Interrupt,
PVOID ServiceContext);
typedef struct _KINTERRUPT
{
ULONG Vector;
KAFFINITY ProcessorEnableMask;
PKSPIN_LOCK IrqLock;
BOOLEAN Shareable;
BOOLEAN FloatingSave;
PKSERVICE_ROUTINE ServiceRoutine;
PVOID ServiceContext;
LIST_ENTRY Entry;
KIRQL SynchLevel;
} KINTERRUPT, *PKINTERRUPT;

View file

@ -6,12 +6,9 @@
typedef const int CINT; typedef const int CINT;
typedef ULONG KAFFINITY; typedef ULONG KAFFINITY, *PKAFFINITY;
typedef KAFFINITY *PKAFFINITY;
//typedef LONG KPRIORITY; typedef LONG NTSTATUS, *PNTSTATUS;
typedef LONG NTSTATUS;
typedef ULONG DEVICE_TYPE; typedef ULONG DEVICE_TYPE;
@ -35,20 +32,12 @@ typedef unsigned long long ULONGLONG;
*/ */
//typedef LONG NTSTATUS; //typedef LONG NTSTATUS;
/*
* Unicode string type
* FIXME: Real unicode please
*/
typedef char* PUNICODE_STRING;
#if REAL_UNICODE
typedef struct _UNICODE_STRING typedef struct _UNICODE_STRING
{ {
USHORT Length; USHORT Length;
USHORT MaximumLength; USHORT MaximumLength;
PWSTR Buffer; PWSTR Buffer;
} UNICODE_STRING, *PUNICODE_STRING; } UNICODE_STRING, *PUNICODE_STRING;
#endif
typedef enum _SECTION_INHERIT { typedef enum _SECTION_INHERIT {
ViewShare = 1, ViewShare = 1,
@ -58,12 +47,10 @@ typedef enum _SECTION_INHERIT {
/* /*
* Various other types (all quite pointless) * Various other types (all quite pointless)
*/ */
//typedef ULONG DEVICE_TYPE;
typedef ULONG KPROCESSOR_MODE; typedef ULONG KPROCESSOR_MODE;
typedef ULONG KIRQL; typedef UCHAR KIRQL;
typedef KIRQL* PKIRQL; typedef KIRQL* PKIRQL;
typedef ULONG IO_ALLOCATION_ACTION; typedef ULONG IO_ALLOCATION_ACTION;
//typedef ULONG INTERFACE_TYPE;
typedef ULONG POOL_TYPE; typedef ULONG POOL_TYPE;
typedef ULONG TIMER_TYPE; typedef ULONG TIMER_TYPE;
typedef ULONG MM_SYSTEM_SIZE; typedef ULONG MM_SYSTEM_SIZE;
@ -71,15 +58,10 @@ typedef ULONG LOCK_OPERATION;
typedef ULONG KEY_INFORMATION_CLASS; typedef ULONG KEY_INFORMATION_CLASS;
typedef ULONG FILE_INFORMATION_CLASS; typedef ULONG FILE_INFORMATION_CLASS;
typedef ULONG KEY_VALUE_INFORMATION_CLASS; typedef ULONG KEY_VALUE_INFORMATION_CLASS;
//typedef ULONG SECTION_INHERIT;
typedef ULONG EVENT_TYPE;
//typedef ULONG KAFFINITY;
//typedef KAFFINITY* PKAFFINITY;
typedef ULONG PHYSICAL_ADDRESS; typedef ULONG PHYSICAL_ADDRESS;
typedef PHYSICAL_ADDRESS* PPHYSICAL_ADDRESS; typedef PHYSICAL_ADDRESS* PPHYSICAL_ADDRESS;
typedef ULONG WAIT_TYPE; typedef ULONG WAIT_TYPE;
typedef ULONG KWAIT_REASON; //typedef ULONG KINTERRUPT_MODE;
typedef ULONG KINTERRUPT_MODE;
typedef USHORT CSHORT; typedef USHORT CSHORT;
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,9 @@
#ifndef _LINUX_CTYPE_H #ifndef _LINUX_CTYPE_H
#define _LINUX_CTYPE_H #define _LINUX_CTYPE_H
#ifdef USE_OLD_CTYPE_IMPLEMENTATION
#define _U 0x01 /* upper */ #define _U 0x01 /* upper */
#define _L 0x02 /* lower */ #define _L 0x02 /* lower */
#define _D 0x04 /* digit */ #define _D 0x04 /* digit */
@ -31,4 +34,38 @@ extern char _ctmp;
#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp) #define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp) #define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)
#else
#define upalpha ('A' - 'a')
extern inline char toupper(char c)
{
if ((c>='a') && (c<='z')) return (c+upalpha);
return(c);
}
extern inline int islower(char c)
{
if ((c>='a') && (c<='z')) return 1;
return 0;
}
extern inline int isdigit(char c)
{
if ((c>='0') && (c<='9')) return 1;
return 0;
}
extern inline int isxdigit(char c)
{
if (((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z')))
{
return 1;
}
return 0;
}
#endif
#endif #endif

View file

@ -16,6 +16,7 @@
#ifndef __INTERNAL_DEBUG #ifndef __INTERNAL_DEBUG
#define __INTERNAL_DEBUG #define __INTERNAL_DEBUG
#define UNIMPLEMENTED do {printk("%s at %s:%d is umimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
#ifndef NDEBUG #ifndef NDEBUG
#define DPRINT(fmt,args...) do { printk("(%s:%d) ",__FILE__,__LINE__); printk(fmt,args); } while(0); #define DPRINT(fmt,args...) do { printk("(%s:%d) ",__FILE__,__LINE__); printk(fmt,args); } while(0);
@ -34,6 +35,7 @@
* x = Maximum irql * x = Maximum irql
*/ */
#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x)) #define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
#define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
#define HBP_EXECUTE (0) #define HBP_EXECUTE (0)
#define HBP_WRITE (1) #define HBP_WRITE (1)

View file

@ -114,33 +114,4 @@ BOOLEAN HalTranslateBusAddress(INTERFACE_TYPE InterfaceType,
PULONG AddressSpace, PULONG AddressSpace,
PPHYSICAL_ADDRESS TranslatedAddress); PPHYSICAL_ADDRESS TranslatedAddress);
struct __xchg_dummy { unsigned long a[100]; };
#define __xg(x) ((struct __xchg_dummy *)(x))
extern inline LONG InterlockedDecrement(PLONG Addend)
/*
* FUNCTION: Decrements a variable as an atomic operations
* ARGUMENTS:
* Addend = Value to be decremented
* RETURNS: The decremented value
*/
{
}
extern inline LONG InterlockedExchange(PLONG Target, LONG Value)
/*
* FUNCTION: Sets a variable as an atomic operation
* ARGUMENTS:
* Target = Variable to be set
* Value = Caller specified value to set
* RETURNS: The previous value of the target
*/
{
__asm__("xchgl %0,%1"
:"=r" (Value)
:"m" (*__xg(Target)), "0" (Value)
:"memory");
return(Value);
}
#endif /* __INCLUDE_INTERNAL_HAL_DDK_H */ #endif /* __INCLUDE_INTERNAL_HAL_DDK_H */

View file

@ -48,6 +48,11 @@ extern inline unsigned int physical_to_linear(unsigned int x)
return(x+IDMAP_BASE); return(x+IDMAP_BASE);
} }
extern inline unsigned int linear_to_physical(unsigned int x)
{
return(x-IDMAP_BASE);
}
#define FLUSH_TLB __asm__("movl %cr3,%eax\n\tmovl %eax,%cr3\n\t") #define FLUSH_TLB __asm__("movl %cr3,%eax\n\tmovl %eax,%cr3\n\t")
extern inline unsigned int* get_page_directory(void) extern inline unsigned int* get_page_directory(void)

View file

@ -8,16 +8,11 @@
* 28/05/97: Created * 28/05/97: Created
*/ */
#ifndef __INTERNAL_IOMGR_H #ifndef __INCLUDE_INTERNAL_IOMGR_H
#define __INTERNAL_IOMGR_H #define __INCLUDE_INTERNAL_IOMGR_H
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
/*
* FUNCTION:
*/
NTSTATUS IoBeginIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
/* /*
* FUNCTION: Called to initalize a loaded driver * FUNCTION: Called to initalize a loaded driver
* ARGUMENTS: * ARGUMENTS:
@ -26,4 +21,7 @@ NTSTATUS IoBeginIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
*/ */
NTSTATUS InitalizeLoadedDriver(PDRIVER_INITIALIZE entry); NTSTATUS InitalizeLoadedDriver(PDRIVER_INITIALIZE entry);
VOID IoInitCancelHandling(VOID);
#endif #endif

View file

@ -11,6 +11,19 @@
#include <internal/linkage.h> #include <internal/linkage.h>
#include <stdarg.h> #include <stdarg.h>
/*
* Use these to place a function in a specific section of the executable
*/
#define PLACE_IN_SECTION(s) __attribute__((section (s)))
#define INIT_FUNCTION (PLACE_IN_SECTION("init"))
#define PAGE_LOCKED_FUNCTION (PLACE_IN_SECTION("pagelk"))
#define PAGE_UNLOCKED_FUNCTION (PLACE_IN_SECTION("pagepo"))
/*
* Maximum size of the kmalloc area (this is totally arbitary)
*/
#define NONPAGED_POOL_SIZE (4*1024*1024)
VOID KiInterruptDispatch(unsigned int irq); VOID KiInterruptDispatch(unsigned int irq);
VOID KiDispatchInterrupt(unsigned int irq); VOID KiDispatchInterrupt(unsigned int irq);
VOID KeTimerInterrupt(VOID); VOID KeTimerInterrupt(VOID);
@ -78,7 +91,10 @@ void HalInit(boot_param* bp);
void IoInit(void); void IoInit(void);
void ObjNamespcInit(void); void ObjNamespcInit(void);
void PsMgrInit(void); void PsMgrInit(void);
void KeInitializeBugCheck(void);
VOID KeInitializeDispatcher(VOID);
void TstBegin(void);
void KeCalibrateTimerLoop(void);
/* /*
* FUNCTION: Called to execute queued dpcs * FUNCTION: Called to execute queued dpcs

View file

@ -28,7 +28,7 @@ typedef struct
unsigned int raw_data_off; unsigned int raw_data_off;
} module; } module;
int process_boot_module(unsigned int start); BOOLEAN process_boot_module(unsigned int start);
#endif #endif

View file

@ -43,11 +43,12 @@ enum
OBJTYP_MAX, OBJTYP_MAX,
}; };
BOOL ObjAddObjectToNameSpace(const char* path, POBJECT_HEADER Object); BOOL ObAddObjectToNameSpace(PUNICODE_STRING path, POBJECT_HEADER Object);
VOID ObRegisterType(CSHORT id, OBJECT_TYPE* type); VOID ObRegisterType(CSHORT id, OBJECT_TYPE* type);
VOID ObInitializeObjectHeader(CSHORT id, LPCSTR name, POBJECT_HEADER obj); VOID ObInitializeObjectHeader(CSHORT id, PUNICODE_STRING name,
POBJECT_HEADER obj);
/* /*
* FUNCTION: Get the size of an object * FUNCTION: Get the size of an object
@ -59,7 +60,7 @@ ULONG ObSizeOf(CSHORT Type);
HANDLE ObAddHandle(PVOID obj); HANDLE ObAddHandle(PVOID obj);
PVOID ObGetObjectByHandle(HANDLE h); PVOID ObGetObjectByHandle(HANDLE h);
PVOID ObLookupObject(PDIRECTORY_OBJECT root, const char* _string); PVOID ObLookupObject(PDIRECTORY_OBJECT root, PUNICODE_STRING _string);
PVOID ObGenericCreateObject(PHANDLE Handle, PVOID ObGenericCreateObject(PHANDLE Handle,
ACCESS_MASK DesiredAccess, ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes, POBJECT_ATTRIBUTES ObjectAttributes,

View file

@ -5,15 +5,7 @@
#include <internal/linkage.h> #include <internal/linkage.h>
/* static PVOID ExAllocatePagedPool(POOL_TYPE Type, ULONG size);
* Maximum size of the kmalloc area (this is totally arbitary) static PVOID ExAllocateNonPagedPool(POOL_TYPE Type, ULONG size);
*/
#define NONPAGED_POOL_SIZE (4*1024*1024)
/*
* Allocates an arbitary sized block at any alignment
*/
//asmlinkage void* ExAllocatePool(ULONG size);
//asmlinkage void ExFreePool(void* block);
#endif /* __INTERNAL_POOL_H */ #endif /* __INTERNAL_POOL_H */

View file

@ -28,7 +28,7 @@ enum
/* /*
* PURPOSE: Doesn't want to run * PURPOSE: Doesn't want to run
*/ */
THREAD_STATE_SLEEPING, THREAD_STATE_SUSPENDED,
/* /*
* Waiting to be freed * Waiting to be freed
@ -36,15 +36,13 @@ enum
THREAD_STATE_TERMINATED, THREAD_STATE_TERMINATED,
}; };
NTSTATUS PsTerminateSystemThread(NTSTATUS ExitStatus);
/* /*
* Functions the HAL must provide * Functions the HAL must provide
*/ */
void HalInitFirstTask(PTHREAD_OBJECT thread); void HalInitFirstTask(PKTHREAD thread);
void HalInitTask(PTHREAD_OBJECT thread, PKSTART_ROUTINE fn, BOOLEAN HalInitTask(PKTHREAD thread, PKSTART_ROUTINE fn,
PVOID StartContext); PVOID StartContext);
void HalTaskSwitch(PTHREAD_OBJECT thread); void HalTaskSwitch(PKTHREAD thread);
#endif #endif

View file

@ -9,9 +9,9 @@
#ifndef __VERSION_H #ifndef __VERSION_H
#define __VERSION_H #define __VERSION_H
#define KERNEL_VERSION "0.0.7" #define KERNEL_VERSION "0.0.8"
#define KERNEL_MAJOR_VERSION 0 #define KERNEL_MAJOR_VERSION 0
#define KERNEL_MINOR_VERSION 0 #define KERNEL_MINOR_VERSION 0
#define KERNEL_PATCH_LEVEL 7 #define KERNEL_PATCH_LEVEL 8
#endif #endif

View file

@ -55,7 +55,7 @@ typedef unsigned long long u64;
typedef unsigned int size_t; typedef unsigned int size_t;
typedef size_t __kernel_size_t; typedef size_t __kernel_size_t;
typedef unsigned short wchar_t; //typedef unsigned short wchar_t;
#endif /* _LINUX_TYPES_H */ #endif /* _LINUX_TYPES_H */

View file

@ -41,7 +41,9 @@
#include <base.h> #include <base.h>
/* WIN32 messages */ /* WIN32 messages */
#ifndef _WIN32_LEAN_AND_MEAN
#include <messages.h> #include <messages.h>
#endif
/* WIN32 definitions */ /* WIN32 definitions */
#include <defines.h> #include <defines.h>
@ -52,7 +54,9 @@
#include <structs.h> #include <structs.h>
/* WIN32 functions */ /* WIN32 functions */
#ifndef _WIN32_LEAN_AND_MEAN
#include <funcs.h> #include <funcs.h>
#endif
#endif /* ! defined (RC_INVOKED) */ #endif /* ! defined (RC_INVOKED) */
@ -63,8 +67,10 @@
/* Windows sockets specification version 1.1 */ /* Windows sockets specification version 1.1 */
#ifdef Win32_Winsock #ifdef Win32_Winsock
#ifndef _WIN32_LEAN_AND_MEAN
#include <sockets.h> #include <sockets.h>
#endif #endif
#endif
/* There is a conflict with BOOL between Objective-C and Win32, /* There is a conflict with BOOL between Objective-C and Win32,
so the Windows32 API Library defines and uses WINBOOL. so the Windows32 API Library defines and uses WINBOOL.

View file

@ -10,6 +10,8 @@
#include <types.h> /* for size_t */ #include <types.h> /* for size_t */
typedef unsigned short wchar_t;
#ifndef NULL #ifndef NULL
#define NULL ((void *) 0) #define NULL ((void *) 0)
#endif #endif
@ -38,8 +40,8 @@ extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count);
/* /*
* Include machine specific inline routines * Include machine specific inline routines
*/ */
#ifndef _I386_STRING_H_ //#ifndef _I386_STRING_H_
#define _I386_STRING_H_ //#define _I386_STRING_H_
/* /*
* On a 486 or Pentium, we are better off not using the * On a 486 or Pentium, we are better off not using the
@ -70,7 +72,7 @@ extern int wcsnicmp(const wchar_t* cs,const wchar_t * ct, size_t count);
#define __HAVE_ARCH_WCSCPY #define __HAVE_ARCH_WCSCPY
inline wchar_t * wcscpy(wchar_t * dest,const wchar_t *src) extern inline wchar_t * wcscpy(wchar_t * dest,const wchar_t *src)
{ {
__asm__ __volatile__( __asm__ __volatile__(
"cld\n" "cld\n"
@ -524,7 +526,7 @@ __asm__ __volatile__(
return __res; return __res;
} }
#endif //#endif
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -8,12 +8,7 @@ todo: improve debug info
#include <thread.h> #include <thread.h>
WINBASEAPI WINBASEAPI BOOL WINAPI SwitchToThread(VOID )
BOOL
WINAPI
SwitchToThread(
VOID
)
{ {
return NtYieldExecution(); return NtYieldExecution();
} }

Binary file not shown.

View file

@ -3,7 +3,7 @@
* PROJECT: ReactOS version of ntdll * PROJECT: ReactOS version of ntdll
* FILE: lib/ntdll/genntdll.c * FILE: lib/ntdll/genntdll.c
* PURPOSE: Generates the system call stubs in ntdll * PURPOSE: Generates the system call stubs in ntdll
* PROGRAMMER: David Welch (welch@welch) * PROGRAMMER: David Welch (welch@mcmail.com)
*/ */
/* INCLUDE ******************************************************************/ /* INCLUDE ******************************************************************/
@ -19,11 +19,10 @@ int process(FILE* in, FILE* out)
char* s; char* s;
char* name; char* name;
char* value; char* value;
char* nr_args;
fprintf(out,"/*\n"); fprintf(out,"; Machine generated, don't edit\n");
fprintf(out," * Machine generated, don't edit\n"); fprintf(out,"\n\n");
fprintf(out," */\n\n");
fprintf(out,"#include <ntdll/napi.h>\n\n");
while (!feof(in) && fgets(line,255,in)!=NULL) while (!feof(in) && fgets(line,255,in)!=NULL)
{ {
@ -37,12 +36,15 @@ int process(FILE* in, FILE* out)
{ {
name = strtok(s," \t"); name = strtok(s," \t");
value = strtok(NULL," \t"); value = strtok(NULL," \t");
printf("name %s value %s\n",name,value); nr_args = strtok(NULL," \t");
fprintf(out,"NTSTATUS %s(UCHAR first_arg)\n",name); // printf("name %s value %s\n",name,value);
fprintf(out,"{\n");
fprintf(out,"\tMAKE_NTAPI_CALL(%s,first_arg);\n",value); fprintf(out,"%s:\n",name);
fprintf(out,"}\n"); fprintf(out,"\tmov\teax,%s\n",value);
fprintf(out,"\tlea\tedx,[esp+4]\n");
fprintf(out,"\tint\t2Eh\n");
fprintf(out,"\tret\t%s\n\n",nr_args);
} }
} }
} }

Binary file not shown.

Binary file not shown.

View file

@ -233,11 +233,12 @@ _load_file:
; ;
; Convert the length into ; Convert the length into
; ;
mov [size_mod_4k],ax mov [size_mod_4k],bx
and word [size_mod_4k],0fffh and word [size_mod_4k],0fffh
shr ax,12 shr ebx,12
mov [size_div_4k],ax mov [size_div_4k],ebx
; ;
; Seek to beginning of file ; Seek to beginning of file

Binary file not shown.

View file

@ -34,13 +34,13 @@ all: $(COMPONENTS) $(LOADERS) $(MODULES)
# #
parallel: dummy parallel: dummy
make -C modules/parallel make -C services/parallel
keyboard: dummy keyboard: dummy
make -C modules/keyboard make -C services/keyboard
mouse: dummy mouse: dummy
make -C modules/mouse make -C services/mouse
# #
# Kernel loaders # Kernel loaders
@ -54,7 +54,7 @@ dos: dummy
# #
kernel: dummy kernel: dummy
make -C kernel make -C ntoskrnl
lib: dummy lib: dummy
make -C lib make -C lib

View file

@ -2,10 +2,10 @@ DIRECTORIES
system : compiled versions of the various system components and system : compiled versions of the various system components and
libraries libraries
mkernel : microkernel source ntoskrnl : microkernel source
mkernel/hal : hardware abstraction layer source ntoskrnl/hal : hardware abstraction layer source
mkernel/mm : memory managment subsystem source ntoskrnl/mm : memory managment subsystem source
mkernel/iomgr : IO manager subsystem source ntoskrnl/io : IO manager subsystem source
include : win32 headers include : win32 headers
include/internal : kernel private header files include/internal : kernel private header files
include/ntdll : system library private header files include/ntdll : system library private header files
@ -18,3 +18,4 @@ lib/kernel32 : kernel32 source
doc : documentation doc : documentation
loaders/dos : DOS based loader loaders/dos : DOS based loader
loaders/boot : boot loader loaders/boot : boot loader
services : various services (device drivers, filesystems etc)

View file

@ -42,9 +42,10 @@ endif
# #
# Create variables for all the compiler tools # Create variables for all the compiler tools
# #
DEFINES = -DCHECKED_BUILD -DWIN32_LEAN_AND_MEAN -DDBG
CC = $(PREFIX)gcc CC = $(PREFIX)gcc
NATIVE_CC = gcc NATIVE_CC = gcc
CFLAGS = -O2 -I../../include -I../include -fno-builtin -DCHECKED_BUILD $(DEFINES) -Wall -Wstrict-prototypes CFLAGS = -O2 -I../../include -I../include -fno-builtin $(DEFINES) -Wall -Wstrict-prototypes
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
NASM = nasm NASM = nasm
NFLAGS = -i../include/ -f$(NASM_FORMAT) NFLAGS = -i../include/ -f$(NASM_FORMAT)