mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
some __stdcall fixes in ntoskrnl and ntdll
svn path=/trunk/; revision=629
This commit is contained in:
parent
5aaaad5c93
commit
fa3a5c2c71
35 changed files with 3547 additions and 1632 deletions
|
@ -1,16 +1,53 @@
|
|||
#ifndef _NTOS_EXFUNCS_H
|
||||
#define _NTOS_EXFUNCS_H
|
||||
|
||||
/* EXECUTIVE ROUTINES ******************************************************/
|
||||
|
||||
VOID ExAcquireFastMutex(PFAST_MUTEX FastMutex);
|
||||
VOID ExAcquireFastMutexUnsafe(PFAST_MUTEX FastMutex);
|
||||
|
||||
BOOLEAN ExAcquireResourceExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireResourceExclusiveLite(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireResourceSharedLite(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireSharedStarveExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
BOOLEAN ExAcquireSharedWaitForExclusive(PERESOURCE Resource, BOOLEAN Wait);
|
||||
PVOID ExAllocateFromNPagedLookasideList(PNPAGED_LOOKASIDE_LIST LookSide);
|
||||
PVOID ExAllocateFromPagedLookasideList(PPAGED_LOOKASIDE_LIST LookSide);
|
||||
PVOID ExAllocateFromZone(PZONE_HEADER Zone);
|
||||
VOID
|
||||
ExAcquireFastMutex (
|
||||
PFAST_MUTEX FastMutex
|
||||
);
|
||||
VOID
|
||||
ExAcquireFastMutexUnsafe (
|
||||
PFAST_MUTEX FastMutex
|
||||
);
|
||||
BOOLEAN
|
||||
ExAcquireResourceExclusive (
|
||||
PERESOURCE Resource,
|
||||
BOOLEAN Wait
|
||||
);
|
||||
BOOLEAN
|
||||
ExAcquireResourceExclusiveLite (
|
||||
PERESOURCE Resource,
|
||||
BOOLEAN Wait
|
||||
);
|
||||
BOOLEAN
|
||||
ExAcquireResourceSharedLite (
|
||||
PERESOURCE Resource,
|
||||
BOOLEAN Wait
|
||||
);
|
||||
BOOLEAN
|
||||
ExAcquireSharedStarveExclusive (
|
||||
PERESOURCE Resource,
|
||||
BOOLEAN Wait
|
||||
);
|
||||
BOOLEAN
|
||||
ExAcquireSharedWaitForExclusive (
|
||||
PERESOURCE Resource,
|
||||
BOOLEAN Wait
|
||||
);
|
||||
PVOID
|
||||
ExAllocateFromNPagedLookasideList (
|
||||
PNPAGED_LOOKASIDE_LIST LookSide
|
||||
);
|
||||
PVOID
|
||||
ExAllocateFromPagedLookasideList (
|
||||
PPAGED_LOOKASIDE_LIST LookSide
|
||||
);
|
||||
PVOID
|
||||
ExAllocateFromZone (
|
||||
PZONE_HEADER Zone
|
||||
);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates memory from the nonpaged pool
|
||||
|
@ -20,133 +57,371 @@ PVOID ExAllocateFromZone(PZONE_HEADER Zone);
|
|||
* RETURNS:
|
||||
* the address of the block if it succeeds
|
||||
*/
|
||||
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);
|
||||
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
|
||||
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
|
||||
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,
|
||||
PKSPIN_LOCK Lock);
|
||||
VOID RemoveEntryFromList(PLIST_ENTRY ListHead, PLIST_ENTRY Entry);
|
||||
PLIST_ENTRY ExInterlockedRemoveHeadList(PLIST_ENTRY Head, PKSPIN_LOCK Lock);
|
||||
|
||||
PLIST_ENTRY ExInterlockedInsertTailList(PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
|
||||
PLIST_ENTRY ExInterlockedInsertHeadList(PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
|
||||
VOID ExQueueWorkItem(PWORK_QUEUE_ITEM WorkItem,
|
||||
WORK_QUEUE_TYPE QueueType);
|
||||
VOID ExRaiseStatus(NTSTATUS Status);
|
||||
VOID ExReinitializeResourceLite(PERESOURCE Resource);
|
||||
VOID ExReleaseFastMutex(PFAST_MUTEX Mutex);
|
||||
VOID ExReleaseFastMutexUnsafe(PFAST_MUTEX Mutex);
|
||||
VOID ExReleaseResource(PERESOURCE Resource);
|
||||
VOID ExReleaseResourceForThread(PERESOURCE Resource,
|
||||
ERESOURCE_THREAD ResourceThreadId);
|
||||
VOID ExReleaseResourceForThreadLite(PERESOURCE Resource,
|
||||
ERESOURCE_THREAD ResourceThreadId);
|
||||
VOID ExSystemTimeToLocalTime(PLARGE_INTEGER SystemTime,
|
||||
PLARGE_INTEGER LocalTime);
|
||||
BOOLEAN ExTryToAcquireFastMutex(PFAST_MUTEX FastMutex);
|
||||
BOOLEAN ExTryToAcquireResourceExclusiveLite(PERESOURCE Resource);
|
||||
PVOID InterlockedCompareExchange(PVOID* Destination,
|
||||
PVOID Exchange,
|
||||
PVOID Comperand);
|
||||
LONG InterlockedDecrement(PLONG Addend);
|
||||
LONG InterlockedExchange(PLONG Target, LONG Value);
|
||||
LONG InterlockedExchangeAdd(PLONG Addend, LONG Value);
|
||||
LONG InterlockedIncrement(PLONG Addend);
|
||||
|
||||
PVOID ExInterlockedAllocateFromZone(PZONE_HEADER Zone, PKSPIN_LOCK Lock);
|
||||
PVOID ExInterlockedFreeToZone(PZONE_HEADER Zone, PVOID Block,
|
||||
PKSPIN_LOCK Lock);
|
||||
NTSTATUS ExInterlockedExtendZone(PZONE_HEADER Zone, PVOID Segment,
|
||||
ULONG SegmentSize, PKSPIN_LOCK Lock);
|
||||
PSINGLE_LIST_ENTRY ExInterlockedPopEntryList(PSINGLE_LIST_ENTRY ListHead,
|
||||
PKSPIN_LOCK Lock);
|
||||
PSINGLE_LIST_ENTRY ExInterlockedPushEntryList(PSINGLE_LIST_ENTRY ListHead,
|
||||
PSINGLE_LIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
PSINGLE_LIST_ENTRY ExInterlockedPushEntrySList(PSLIST_HEADER ListHead,
|
||||
PSINGLE_LIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock);
|
||||
PSINGLE_LIST_ENTRY ExInterlockedPopEntrySList(PSLIST_HEADER ListHead,
|
||||
PKSPIN_LOCK Lock);
|
||||
BOOLEAN ExIsFullZone(PZONE_HEADER Zone);
|
||||
BOOLEAN ExIsObjectInFirstZoneSegment(PZONE_HEADER Zone, PVOID Object);
|
||||
VOID ExLocalTimeToSystemTime(PLARGE_INTEGER LocalTime,
|
||||
PLARGE_INTEGER SystemTime);
|
||||
|
||||
typedef unsigned int (exception_hook)(CONTEXT* c, unsigned int exp);
|
||||
unsigned int ExHookException(exception_hook fn, unsigned int exp);
|
||||
|
||||
INTERLOCKED_RESULT ExInterlockedDecrementLong(PLONG Addend,
|
||||
PKSPIN_LOCK Lock);
|
||||
ULONG ExInterlockedExchangeUlong(PULONG Target,
|
||||
ULONG Value,
|
||||
PKSPIN_LOCK Lock);
|
||||
INTERLOCKED_RESULT ExInterlockedIncrementLong(PLONG Addend,
|
||||
PKSPIN_LOCK Lock);
|
||||
BOOLEAN ExIsResourceAcquiredExclusiveLite(PERESOURCE Resource);
|
||||
ULONG ExIsResourceAcquiredSharedLite(PERESOURCE Resource);
|
||||
USHORT ExQueryDepthSListHead(PSLIST_HEADER SListHead);
|
||||
VOID
|
||||
ExInterlockedRemoveEntryList (
|
||||
PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY Entry,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
VOID
|
||||
RemoveEntryFromList (
|
||||
PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY Entry
|
||||
);
|
||||
PLIST_ENTRY
|
||||
ExInterlockedRemoveHeadList (
|
||||
PLIST_ENTRY Head,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PLIST_ENTRY
|
||||
ExInterlockedInsertTailList (
|
||||
PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PLIST_ENTRY
|
||||
ExInterlockedInsertHeadList (
|
||||
PLIST_ENTRY ListHead,
|
||||
PLIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
VOID
|
||||
ExQueueWorkItem (
|
||||
PWORK_QUEUE_ITEM WorkItem,
|
||||
WORK_QUEUE_TYPE QueueType
|
||||
);
|
||||
VOID
|
||||
ExRaiseStatus (
|
||||
NTSTATUS Status
|
||||
);
|
||||
VOID
|
||||
ExReinitializeResourceLite (
|
||||
PERESOURCE Resource
|
||||
);
|
||||
VOID
|
||||
ExReleaseFastMutex (
|
||||
PFAST_MUTEX Mutex
|
||||
);
|
||||
VOID
|
||||
ExReleaseFastMutexUnsafe (
|
||||
PFAST_MUTEX Mutex
|
||||
);
|
||||
VOID
|
||||
ExReleaseResource (
|
||||
PERESOURCE Resource
|
||||
);
|
||||
VOID
|
||||
ExReleaseResourceForThread (
|
||||
PERESOURCE Resource,
|
||||
ERESOURCE_THREAD ResourceThreadId
|
||||
);
|
||||
VOID
|
||||
ExReleaseResourceForThreadLite (
|
||||
PERESOURCE Resource,
|
||||
ERESOURCE_THREAD ResourceThreadId
|
||||
);
|
||||
VOID
|
||||
ExSystemTimeToLocalTime (
|
||||
PLARGE_INTEGER SystemTime,
|
||||
PLARGE_INTEGER LocalTime
|
||||
);
|
||||
BOOLEAN
|
||||
ExTryToAcquireFastMutex (
|
||||
PFAST_MUTEX FastMutex
|
||||
);
|
||||
BOOLEAN
|
||||
ExTryToAcquireResourceExclusiveLite (
|
||||
PERESOURCE Resource
|
||||
);
|
||||
/*
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedCompareExchange (
|
||||
PLONG Target,
|
||||
LONG Value,
|
||||
LONG Reference
|
||||
);
|
||||
*/
|
||||
PVOID
|
||||
FASTCALL
|
||||
InterlockedCompareExchange (
|
||||
PVOID * Destination,
|
||||
PVOID Exchange,
|
||||
PVOID Comperand
|
||||
);
|
||||
#ifdef _GNU_H_WINDOWS_H
|
||||
#ifdef InterlockedDecrement
|
||||
#undef InterlockedDecrement
|
||||
#undef InterlockedExchange
|
||||
#undef InterlockedExchangeAdd
|
||||
#undef InterlockedIncrement
|
||||
#endif /* def InterlockedDecrement */
|
||||
#endif /* def _GNU_H_WINDOWS_H */
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedDecrement (
|
||||
PLONG Addend
|
||||
);
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedExchange (
|
||||
PLONG Target,
|
||||
LONG Value
|
||||
);
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedExchangeAdd (
|
||||
PLONG Addend,
|
||||
LONG Value
|
||||
);
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedIncrement (
|
||||
PLONG Addend
|
||||
);
|
||||
/*---*/
|
||||
PVOID
|
||||
ExInterlockedAllocateFromZone (
|
||||
PZONE_HEADER Zone,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PVOID
|
||||
ExInterlockedFreeToZone (
|
||||
PZONE_HEADER Zone,
|
||||
PVOID Block,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
NTSTATUS
|
||||
ExInterlockedExtendZone (
|
||||
PZONE_HEADER Zone,
|
||||
PVOID Segment,
|
||||
ULONG SegmentSize,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PSINGLE_LIST_ENTRY
|
||||
ExInterlockedPopEntryList (
|
||||
PSINGLE_LIST_ENTRY ListHead,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PSINGLE_LIST_ENTRY
|
||||
ExInterlockedPushEntryList (
|
||||
PSINGLE_LIST_ENTRY ListHead,
|
||||
PSINGLE_LIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PSINGLE_LIST_ENTRY
|
||||
ExInterlockedPushEntrySList (
|
||||
PSLIST_HEADER ListHead,
|
||||
PSINGLE_LIST_ENTRY ListEntry,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
PSINGLE_LIST_ENTRY
|
||||
ExInterlockedPopEntrySList (
|
||||
PSLIST_HEADER ListHead,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
BOOLEAN
|
||||
ExIsFullZone (
|
||||
PZONE_HEADER Zone
|
||||
);
|
||||
BOOLEAN
|
||||
ExIsObjectInFirstZoneSegment (
|
||||
PZONE_HEADER Zone,
|
||||
PVOID Object
|
||||
);
|
||||
VOID
|
||||
ExLocalTimeToSystemTime (
|
||||
PLARGE_INTEGER LocalTime,
|
||||
PLARGE_INTEGER SystemTime
|
||||
);
|
||||
|
||||
typedef
|
||||
unsigned int
|
||||
(exception_hook) (
|
||||
CONTEXT * c,
|
||||
unsigned int exp
|
||||
);
|
||||
unsigned int
|
||||
ExHookException (
|
||||
exception_hook fn,
|
||||
unsigned int exp
|
||||
);
|
||||
INTERLOCKED_RESULT
|
||||
ExInterlockedDecrementLong (
|
||||
PLONG Addend,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
ULONG
|
||||
ExInterlockedExchangeUlong (
|
||||
PULONG Target,
|
||||
ULONG Value,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
INTERLOCKED_RESULT
|
||||
ExInterlockedIncrementLong (
|
||||
PLONG Addend,
|
||||
PKSPIN_LOCK Lock
|
||||
);
|
||||
BOOLEAN
|
||||
ExIsResourceAcquiredExclusiveLite (
|
||||
PERESOURCE Resource
|
||||
);
|
||||
ULONG
|
||||
ExIsResourceAcquiredSharedLite (
|
||||
PERESOURCE Resource
|
||||
);
|
||||
USHORT
|
||||
ExQueryDepthSListHead (
|
||||
PSLIST_HEADER SListHead
|
||||
);
|
||||
|
||||
#endif /* ndef _NTOS_EXFUNCS_H */
|
||||
|
|
|
@ -370,6 +370,7 @@ IoCreateNotificationEvent (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoCreateSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName
|
||||
|
@ -382,6 +383,7 @@ IoCreateSynchronizationEvent (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoCreateUnprotectedSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName
|
||||
|
@ -404,6 +406,7 @@ IoDeleteDevice (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoDeleteSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName
|
||||
);
|
||||
|
|
|
@ -20,6 +20,11 @@ extern "C"
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
/* GCC can not handle __fastcall */
|
||||
#ifndef FASTCALL
|
||||
#define FASTCALL STDCALL
|
||||
#endif
|
||||
|
||||
#include <internal/id.h>
|
||||
#include <ddk/status.h>
|
||||
#include <ddk/ntdef.h>
|
||||
|
|
|
@ -200,6 +200,7 @@ RtlCharToInteger (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCheckRegistryKey (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path
|
||||
|
@ -263,6 +264,7 @@ RtlCopyUnicodeString (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCreateRegistryKey (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path
|
||||
|
@ -275,6 +277,7 @@ RtlCreateSecurityDescriptor (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlDeleteRegistryValue (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path,
|
||||
|
@ -575,6 +578,7 @@ RtlMoveMemory (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlQueryRegistryValues (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path,
|
||||
|
@ -713,6 +717,7 @@ RtlValidSecurityDescriptor (
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlWriteRegistryValue (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path,
|
||||
|
@ -768,6 +773,7 @@ RtlUnlockHeap (
|
|||
);
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
RtlCompactHeap (
|
||||
HANDLE hheap,
|
||||
DWORD flags
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: zw.h,v 1.17 1999/07/22 21:29:46 ekohl Exp $
|
||||
/* $Id: zw.h,v 1.18 1999/08/29 06:58:59 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -4143,21 +4143,21 @@ ZwSetHighWaitLowEventPair(
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
NtSetInformationFile(
|
||||
IN HANDLE FileHandle,
|
||||
IN PIO_STATUS_BLOCK IoStatusBlock,
|
||||
IN PVOID FileInformation,
|
||||
IN ULONG Length,
|
||||
IN FILE_INFORMATION_CLASS FileInformationClass
|
||||
);
|
||||
IN HANDLE FileHandle,
|
||||
IN PIO_STATUS_BLOCK IoStatusBlock,
|
||||
IN PVOID FileInformation,
|
||||
IN ULONG Length,
|
||||
IN FILE_INFORMATION_CLASS FileInformationClass
|
||||
);
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
ZwSetInformationFile(
|
||||
IN HANDLE FileHandle,
|
||||
IN PIO_STATUS_BLOCK IoStatusBlock,
|
||||
IN PVOID FileInformation,
|
||||
IN ULONG Length,
|
||||
IN FILE_INFORMATION_CLASS FileInformationClass
|
||||
);
|
||||
IN HANDLE FileHandle,
|
||||
IN PIO_STATUS_BLOCK IoStatusBlock,
|
||||
IN PVOID FileInformation,
|
||||
IN ULONG Length,
|
||||
IN FILE_INFORMATION_CLASS FileInformationClass
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,36 @@
|
|||
VOID WINAPI __RtlInitHeap(PVOID base, ULONG minsize, ULONG maxsize);
|
||||
VOID
|
||||
WINAPI
|
||||
__RtlInitHeap (
|
||||
PVOID base,
|
||||
ULONG minsize,
|
||||
ULONG maxsize
|
||||
);
|
||||
|
||||
#define HEAP_BASE (0xa0000000)
|
||||
|
||||
VOID RtlDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
|
||||
VOID RtlEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
|
||||
VOID RtlInitializeCriticalSection(LPCRITICAL_SECTION pcritical);
|
||||
VOID RtlLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
|
||||
WINBOOL RtlTryEntryCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
|
||||
DWORD WINAPI RtlCompactHeap( HANDLE heap, DWORD flags );
|
||||
VOID
|
||||
RtlDeleteCriticalSection (
|
||||
LPCRITICAL_SECTION lpCriticalSection
|
||||
);
|
||||
VOID
|
||||
RtlEnterCriticalSection (
|
||||
LPCRITICAL_SECTION lpCriticalSection
|
||||
);
|
||||
VOID
|
||||
RtlInitializeCriticalSection (
|
||||
LPCRITICAL_SECTION pcritical
|
||||
);
|
||||
VOID
|
||||
RtlLeaveCriticalSection (
|
||||
LPCRITICAL_SECTION lpCriticalSection
|
||||
);
|
||||
WINBOOL
|
||||
RtlTryEntryCriticalSection (
|
||||
LPCRITICAL_SECTION lpCriticalSection
|
||||
);
|
||||
UINT
|
||||
STDCALL
|
||||
RtlCompactHeap (
|
||||
HANDLE heap,
|
||||
DWORD flags
|
||||
);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define RES_UINT_FV_MINOR 0
|
||||
#define RES_UINT_FV_REVISION 14
|
||||
/* Build number as YYYYMMDD */
|
||||
#define RES_UINT_FV_BUILD 19990717
|
||||
#define RES_UINT_FV_BUILD 19990828
|
||||
|
||||
/* ReactOS Product Version UINTs */
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: find.c,v 1.21 1999/08/29 06:59:01 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/file/find.c
|
||||
|
@ -178,7 +179,10 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
return(IData);
|
||||
}
|
||||
|
||||
HANDLE FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
||||
{
|
||||
WCHAR lpFileNameW[MAX_PATH];
|
||||
ULONG i;
|
||||
|
@ -227,7 +231,10 @@ HANDLE FindFirstFileA(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData)
|
|||
return(IData);
|
||||
}
|
||||
|
||||
WINBOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData)
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData)
|
||||
{
|
||||
PWIN32_FIND_DATA_ASCII Ret;
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
|
@ -265,7 +272,10 @@ WINBOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATA lpFindFileData)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
BOOL FindClose(HANDLE hFindFile)
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FindClose(HANDLE hFindFile)
|
||||
{
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
|
||||
|
@ -282,8 +292,13 @@ BOOL FindClose(HANDLE hFindFile)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
HANDLE STDCALL FindFirstFileW(LPCWSTR lpFileName,
|
||||
LPWIN32_FIND_DATA lpFindFileData)
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
FindFirstFileW (
|
||||
LPCWSTR lpFileName,
|
||||
LPWIN32_FIND_DATA lpFindFileData
|
||||
)
|
||||
{
|
||||
PWIN32_FIND_DATA_UNICODE Ret;
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
|
@ -299,8 +314,13 @@ HANDLE STDCALL FindFirstFileW(LPCWSTR lpFileName,
|
|||
return(IData);
|
||||
}
|
||||
|
||||
WINBOOL STDCALL FindNextFileW(HANDLE hFindFile,
|
||||
LPWIN32_FIND_DATA lpFindFileData)
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
FindNextFileW (
|
||||
HANDLE hFindFile,
|
||||
LPWIN32_FIND_DATA lpFindFileData
|
||||
)
|
||||
{
|
||||
PWIN32_FIND_DATA_UNICODE Ret;
|
||||
PKERNEL32_FIND_FILE_DATA IData;
|
||||
|
@ -320,3 +340,6 @@ WINBOOL STDCALL FindNextFileW(HANDLE hFindFile,
|
|||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: lfile.c,v 1.4 1999/08/29 06:59:01 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/file/lfile.c
|
||||
|
@ -16,67 +17,104 @@
|
|||
|
||||
|
||||
|
||||
long _hread(
|
||||
HFILE hFile,
|
||||
LPVOID lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
long
|
||||
STDCALL
|
||||
_hread(
|
||||
HFILE hFile,
|
||||
LPVOID lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
{
|
||||
DWORD NumberOfBytesRead;
|
||||
if ( ReadFile((HANDLE)hFile,(LPVOID)lpBuffer,(DWORD)lBytes,&NumberOfBytesRead, NULL) == FALSE )
|
||||
DWORD NumberOfBytesRead;
|
||||
|
||||
if (ReadFile(
|
||||
(HANDLE) hFile,
|
||||
(LPVOID) lpBuffer,
|
||||
(DWORD) lBytes,
|
||||
& NumberOfBytesRead,
|
||||
NULL
|
||||
) == FALSE)
|
||||
{
|
||||
return -1;
|
||||
else
|
||||
return NumberOfBytesRead;
|
||||
|
||||
}
|
||||
|
||||
UINT STDCALL _lread(HFILE fd,LPVOID buffer,UINT count)
|
||||
{
|
||||
return _hread(fd,buffer, count);
|
||||
}
|
||||
|
||||
|
||||
long _hwrite(
|
||||
HFILE hFile,
|
||||
LPCSTR lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
{
|
||||
|
||||
DWORD NumberOfBytesWritten;
|
||||
if ( lBytes == 0 ) {
|
||||
if ( SetEndOfFile((HANDLE) hFile ) == FALSE )
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
if ( WriteFile((HANDLE)hFile,(LPVOID)lpBuffer,(DWORD)lBytes, &NumberOfBytesWritten,NULL) == FALSE )
|
||||
return -1;
|
||||
else
|
||||
return NumberOfBytesWritten;
|
||||
|
||||
return NumberOfBytesRead;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//19990828.EA: aliased in DEF
|
||||
UINT
|
||||
STDCALL
|
||||
_lread (
|
||||
HFILE fd,
|
||||
LPVOID buffer,
|
||||
UINT count
|
||||
)
|
||||
{
|
||||
return _hread(
|
||||
fd,
|
||||
buffer,
|
||||
count
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
long
|
||||
STDCALL
|
||||
_hwrite (
|
||||
HFILE hFile,
|
||||
LPCSTR lpBuffer,
|
||||
long lBytes
|
||||
)
|
||||
{
|
||||
DWORD NumberOfBytesWritten;
|
||||
|
||||
if (lBytes == 0)
|
||||
{
|
||||
if ( SetEndOfFile((HANDLE) hFile ) == FALSE )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if ( WriteFile(
|
||||
(HANDLE) hFile,
|
||||
(LPVOID) lpBuffer,
|
||||
(DWORD) lBytes,
|
||||
& NumberOfBytesWritten,
|
||||
NULL
|
||||
) == FALSE )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return NumberOfBytesWritten;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//19990828.EA: aliased in DEF
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
_lwrite(
|
||||
HFILE hFile,
|
||||
LPCSTR lpBuffer,
|
||||
UINT uBytes
|
||||
HFILE hFile,
|
||||
LPCSTR lpBuffer,
|
||||
UINT uBytes
|
||||
)
|
||||
{
|
||||
return _hwrite(hFile,lpBuffer,uBytes);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HFILE _lopen( LPCSTR lpPathName, int iReadWrite )
|
||||
HFILE
|
||||
STDCALL
|
||||
_lopen (
|
||||
LPCSTR lpPathName,
|
||||
int iReadWrite
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
|
||||
DWORD dwAccessMask = 0;
|
||||
DWORD dwShareMode = 0;
|
||||
|
||||
|
@ -87,31 +125,39 @@ HFILE _lopen( LPCSTR lpPathName, int iReadWrite )
|
|||
else if ( (iReadWrite & OF_WRITE ) == OF_WRITE )
|
||||
dwAccessMask = GENERIC_WRITE;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ((iReadWrite & OF_SHARE_COMPAT) == OF_SHARE_COMPAT )
|
||||
dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_DENY_NONE) == OF_SHARE_DENY_NONE)
|
||||
dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_DENY_READ) == OF_SHARE_DENY_READ)
|
||||
dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_DENY_WRITE) == OF_SHARE_DENY_WRITE )
|
||||
dwShareMode = FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_EXCLUSIVE) == OF_SHARE_EXCLUSIVE)
|
||||
dwShareMode = 0;
|
||||
if ((iReadWrite & OF_SHARE_COMPAT) == OF_SHARE_COMPAT )
|
||||
dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_DENY_NONE) == OF_SHARE_DENY_NONE)
|
||||
dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_DENY_READ) == OF_SHARE_DENY_READ)
|
||||
dwShareMode = FILE_SHARE_WRITE | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_DENY_WRITE) == OF_SHARE_DENY_WRITE )
|
||||
dwShareMode = FILE_SHARE_READ | FILE_SHARE_DELETE;
|
||||
else if ((iReadWrite & OF_SHARE_EXCLUSIVE) == OF_SHARE_EXCLUSIVE)
|
||||
dwShareMode = 0;
|
||||
|
||||
|
||||
|
||||
SetLastError(0);
|
||||
return (HFILE) CreateFileA( lpPathName,dwAccessMask,dwShareMode,
|
||||
NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
|
||||
return (HFILE) CreateFileA(
|
||||
lpPathName,
|
||||
dwAccessMask,
|
||||
dwShareMode,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
HFILE _lcreat( LPCSTR lpPathName, int iAttribute )
|
||||
HFILE
|
||||
STDCALL
|
||||
_lcreat (
|
||||
LPCSTR lpPathName,
|
||||
int iAttribute
|
||||
)
|
||||
{
|
||||
|
||||
DWORD FileAttributes = 0;
|
||||
|
@ -125,28 +171,47 @@ HFILE _lcreat( LPCSTR lpPathName, int iAttribute )
|
|||
else if ( iAttribute == 4 )
|
||||
FileAttributes |= FILE_ATTRIBUTE_SYSTEM;
|
||||
|
||||
return(HFILE) CreateFileA( lpPathName,GENERIC_ALL,FILE_SHARE_READ|FILE_SHARE_WRITE,
|
||||
NULL,CREATE_ALWAYS,iAttribute ,NULL);
|
||||
return (HFILE) CreateFileA(
|
||||
lpPathName,
|
||||
GENERIC_ALL,
|
||||
(FILE_SHARE_READ | FILE_SHARE_WRITE),
|
||||
NULL,
|
||||
CREATE_ALWAYS,
|
||||
iAttribute,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int _lclose(
|
||||
HFILE hFile
|
||||
)
|
||||
int
|
||||
STDCALL
|
||||
_lclose (
|
||||
HFILE hFile
|
||||
)
|
||||
{
|
||||
if ( CloseHandle((HANDLE)hFile) )
|
||||
{
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
LONG _llseek(
|
||||
HFILE hFile,
|
||||
LONG lOffset,
|
||||
int iOrigin
|
||||
)
|
||||
|
||||
LONG
|
||||
STDCALL
|
||||
_llseek(
|
||||
HFILE hFile,
|
||||
LONG lOffset,
|
||||
int iOrigin
|
||||
)
|
||||
{
|
||||
return SetFilePointer((HANDLE) hFile, lOffset, NULL,(DWORD)iOrigin );
|
||||
return SetFilePointer(
|
||||
(HANDLE) hFile,
|
||||
lOffset,
|
||||
NULL,
|
||||
(DWORD) iOrigin
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: kernel32.edf,v 1.1 1999/07/17 23:10:20 ea Exp $
|
||||
; $Id: kernel32.edf,v 1.2 1999/08/29 06:59:01 ea Exp $
|
||||
;
|
||||
; kernel32.edf
|
||||
;
|
||||
|
@ -649,8 +649,8 @@ _lclose=_lclose@4
|
|||
_lcreat=_lcreat@8
|
||||
_llseek=_llseek@12
|
||||
_lopen=_lopen@8
|
||||
_lread=_lread@12
|
||||
_lwrite=_lwrite@12
|
||||
_lread=_hread@12
|
||||
_lwrite=_hwrite@12
|
||||
lstrcat=lstrcatA@8
|
||||
lstrcatA=lstrcatA@8
|
||||
lstrcatW=lstrcatW@8
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: heap.c,v 1.15 1999/08/29 06:59:01 ea Exp $
|
||||
*
|
||||
* kernel/heap.c
|
||||
* Copyright (C) 1996, Onno Hovers, All rights reserved
|
||||
*
|
||||
|
@ -117,9 +118,17 @@ BOOL WINAPI HeapUnlock(HANDLE hheap)
|
|||
* NT uses this function to compact moveable blocks and other things *
|
||||
* Here it does not compact, but it finds the largest free region *
|
||||
*********************************************************************/
|
||||
UINT HeapCompact(HANDLE hheap, DWORD flags)
|
||||
UINT
|
||||
STDCALL
|
||||
HeapCompact (
|
||||
HANDLE hheap,
|
||||
DWORD flags
|
||||
)
|
||||
{
|
||||
return(RtlCompactHeap(hheap, flags));
|
||||
return RtlCompactHeap(
|
||||
hheap,
|
||||
flags
|
||||
);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -140,3 +149,5 @@ BOOL WINAPI HeapValidate(HANDLE hheap, DWORD flags, LPCVOID pmem)
|
|||
return(RtlValidateHeap(hheap, flags, (PVOID)pmem));
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/* $Id: error.c,v 1.11 1999/08/29 06:59:02 ea Exp $
|
||||
*
|
||||
* reactos/lib/kernel32/misc/error.c
|
||||
*
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddbeep.h>
|
||||
|
@ -9,26 +14,39 @@
|
|||
static DWORD LastError=0;
|
||||
|
||||
|
||||
VOID SetLastError(DWORD dwErrorCode)
|
||||
VOID
|
||||
STDCALL
|
||||
SetLastError (
|
||||
DWORD dwErrorCode
|
||||
)
|
||||
{
|
||||
LastError = dwErrorCode;
|
||||
/* FIXME: it is per thread */
|
||||
LastError = dwErrorCode;
|
||||
}
|
||||
|
||||
DWORD GetLastError(VOID)
|
||||
DWORD
|
||||
STDCALL
|
||||
GetLastError (VOID)
|
||||
{
|
||||
return(LastError);
|
||||
/* FIXME: it is per thread */
|
||||
return LastError;
|
||||
}
|
||||
|
||||
BOOL __ErrorReturnFalse(ULONG ErrorCode)
|
||||
|
||||
BOOL
|
||||
__ErrorReturnFalse (ULONG ErrorCode)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
PVOID __ErrorReturnNull(ULONG ErrorCode)
|
||||
|
||||
PVOID
|
||||
__ErrorReturnNull (ULONG ErrorCode)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
Beep (DWORD dwFreq, DWORD dwDuration)
|
||||
|
@ -65,3 +83,5 @@ Beep (DWORD dwFreq, DWORD dwDuration)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* $Id: stubs.c,v 1.2 1999/07/17 23:10:20 ea Exp $
|
||||
/* $Id: stubs.c,v 1.3 1999/08/29 06:59:03 ea Exp $
|
||||
*
|
||||
* KERNEL32.DLL stubs (unimplemented functions)
|
||||
* Remove from this file, if you implement them.
|
||||
*/
|
||||
|
@ -3443,17 +3444,6 @@ RegisterConsoleVDM (
|
|||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
RegisterWaitForInputIdle (
|
||||
DWORD Unknown0
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
RegisterWowBaseHandlers (
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: lib.c,v 1.3 1999/08/29 06:59:03 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/proc/proc.c
|
||||
|
@ -23,20 +24,37 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
HINSTANCE LoadLibraryW(LPCWSTR lpLibFileName)
|
||||
HINSTANCE
|
||||
STDCALL
|
||||
LoadLibraryW (
|
||||
LPCWSTR lpLibFileName
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
HINSTANCE LoadLibraryA(LPCSTR lpLibFileName)
|
||||
|
||||
HINSTANCE
|
||||
STDCALL
|
||||
LoadLibraryA (
|
||||
LPCSTR lpLibFileName
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
BOOL STDCALL FreeLibrary(HMODULE hLibModule)
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FreeLibrary (
|
||||
HMODULE hLibModule
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: proc.c,v 1.19 1999/08/29 06:59:03 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/proc/proc.c
|
||||
|
@ -49,44 +50,79 @@ typedef struct _WSTARTUPINFO {
|
|||
|
||||
WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle;
|
||||
|
||||
VOID RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle);
|
||||
VOID
|
||||
STDCALL
|
||||
RegisterWaitForInputIdle (
|
||||
WaitForInputIdleType lpfnRegisterWaitForInputIdle
|
||||
);
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
WINBOOL STDCALL GetProcessId(HANDLE hProcess, LPDWORD lpProcessId);
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetProcessId (
|
||||
HANDLE hProcess,
|
||||
LPDWORD lpProcessId
|
||||
);
|
||||
|
||||
FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName)
|
||||
|
||||
FARPROC
|
||||
STDCALL
|
||||
GetProcAddress (
|
||||
HMODULE hModule,
|
||||
LPCSTR lpProcName
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(NULL);
|
||||
UNIMPLEMENTED;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WINBOOL STDCALL GetProcessTimes(HANDLE hProcess,
|
||||
LPFILETIME lpCreationTime,
|
||||
LPFILETIME lpExitTime,
|
||||
LPFILETIME lpKernelTime,
|
||||
LPFILETIME lpUserTime)
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetProcessTimes (
|
||||
HANDLE hProcess,
|
||||
LPFILETIME lpCreationTime,
|
||||
LPFILETIME lpExitTime,
|
||||
LPFILETIME lpKernelTime,
|
||||
LPFILETIME lpUserTime
|
||||
)
|
||||
{
|
||||
dprintf("GetProcessTimes is unimplemented\n");
|
||||
return(FALSE);
|
||||
dprintf("GetProcessTimes is unimplemented\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HANDLE STDCALL GetCurrentProcess(VOID)
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
GetCurrentProcess (VOID)
|
||||
{
|
||||
return (HANDLE)NtCurrentProcess();
|
||||
return (HANDLE) NtCurrentProcess();
|
||||
}
|
||||
|
||||
HANDLE STDCALL GetCurrentThread(VOID)
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
GetCurrentThread (VOID)
|
||||
{
|
||||
return (HANDLE)NtCurrentThread();
|
||||
return (HANDLE) NtCurrentThread();
|
||||
}
|
||||
|
||||
DWORD STDCALL GetCurrentProcessId(VOID)
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
GetCurrentProcessId (VOID)
|
||||
{
|
||||
return (DWORD)(GetTeb()->Cid).UniqueProcess;
|
||||
return (DWORD) (GetTeb()->Cid).UniqueProcess;
|
||||
}
|
||||
|
||||
WINBOOL STDCALL GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode)
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetExitCodeProcess (
|
||||
HANDLE hProcess,
|
||||
LPDWORD lpExitCode
|
||||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
PROCESS_BASIC_INFORMATION ProcessBasic;
|
||||
|
@ -106,7 +142,13 @@ WINBOOL STDCALL GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
WINBOOL STDCALL GetProcessId(HANDLE hProcess, LPDWORD lpProcessId )
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetProcessId (
|
||||
HANDLE hProcess,
|
||||
LPDWORD lpProcessId
|
||||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
PROCESS_BASIC_INFORMATION ProcessBasic;
|
||||
|
@ -126,7 +168,13 @@ WINBOOL STDCALL GetProcessId(HANDLE hProcess, LPDWORD lpProcessId )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
PWSTR InternalAnsiToUnicode(PWSTR Out, LPCSTR In, ULONG MaxLength)
|
||||
|
||||
PWSTR
|
||||
InternalAnsiToUnicode (
|
||||
PWSTR Out,
|
||||
LPCSTR In,
|
||||
ULONG MaxLength
|
||||
)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
|
@ -148,9 +196,14 @@ PWSTR InternalAnsiToUnicode(PWSTR Out, LPCSTR In, ULONG MaxLength)
|
|||
}
|
||||
}
|
||||
|
||||
HANDLE STDCALL OpenProcess(DWORD dwDesiredAccess,
|
||||
WINBOOL bInheritHandle,
|
||||
DWORD dwProcessId)
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
OpenProcess (
|
||||
DWORD dwDesiredAccess,
|
||||
WINBOOL bInheritHandle,
|
||||
DWORD dwProcessId
|
||||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
HANDLE ProcessHandle;
|
||||
|
@ -183,7 +236,13 @@ HANDLE STDCALL OpenProcess(DWORD dwDesiredAccess,
|
|||
return ProcessHandle;
|
||||
}
|
||||
|
||||
UINT WinExec (LPCSTR lpCmdLine, UINT uCmdShow)
|
||||
|
||||
UINT
|
||||
STDCALL
|
||||
WinExec (
|
||||
LPCSTR lpCmdLine,
|
||||
UINT uCmdShow
|
||||
)
|
||||
{
|
||||
STARTUPINFO StartupInfo;
|
||||
PROCESS_INFORMATION ProcessInformation;
|
||||
|
@ -217,27 +276,45 @@ UINT WinExec (LPCSTR lpCmdLine, UINT uCmdShow)
|
|||
}
|
||||
|
||||
|
||||
|
||||
VOID RegisterWaitForInputIdle(WaitForInputIdleType
|
||||
lpfnRegisterWaitForInputIdle)
|
||||
VOID
|
||||
STDCALL
|
||||
RegisterWaitForInputIdle (
|
||||
WaitForInputIdleType lpfnRegisterWaitForInputIdle
|
||||
)
|
||||
{
|
||||
lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle;
|
||||
return;
|
||||
lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle;
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD STDCALL WaitForInputIdle(HANDLE hProcess,
|
||||
DWORD dwMilliseconds)
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
WaitForInputIdle (
|
||||
HANDLE hProcess,
|
||||
DWORD dwMilliseconds
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID STDCALL Sleep(DWORD dwMilliseconds)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
Sleep (
|
||||
DWORD dwMilliseconds
|
||||
)
|
||||
{
|
||||
SleepEx(dwMilliseconds,FALSE);
|
||||
return;
|
||||
SleepEx (dwMilliseconds, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD STDCALL SleepEx(DWORD dwMilliseconds, BOOL bAlertable)
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
SleepEx (
|
||||
DWORD dwMilliseconds,
|
||||
BOOL bAlertable
|
||||
)
|
||||
{
|
||||
TIME Interval;
|
||||
NTSTATUS errCode;
|
||||
|
@ -245,14 +322,20 @@ DWORD STDCALL SleepEx(DWORD dwMilliseconds, BOOL bAlertable)
|
|||
Interval.QuadPart = dwMilliseconds * 1000;
|
||||
|
||||
errCode = NtDelayExecution(bAlertable,&Interval);
|
||||
if ( !NT_SUCCESS(errCode) ) {
|
||||
if ( !NT_SUCCESS(errCode) )
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID STDCALL GetStartupInfoW(LPSTARTUPINFO _lpStartupInfo)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
GetStartupInfoW (
|
||||
LPSTARTUPINFO _lpStartupInfo
|
||||
)
|
||||
{
|
||||
NT_PEB *pPeb = NtCurrentPeb();
|
||||
LPWSTARTUPINFO lpStartupInfo = (LPWSTARTUPINFO)_lpStartupInfo;
|
||||
|
@ -305,7 +388,11 @@ VOID STDCALL GetStartupInfoW(LPSTARTUPINFO _lpStartupInfo)
|
|||
}
|
||||
|
||||
|
||||
VOID STDCALL GetStartupInfoA(LPSTARTUPINFO lpStartupInfo)
|
||||
VOID
|
||||
STDCALL
|
||||
GetStartupInfoA (
|
||||
LPSTARTUPINFO lpStartupInfo
|
||||
)
|
||||
{
|
||||
NT_PEB *pPeb = NtCurrentPeb();
|
||||
ULONG i = 0;
|
||||
|
@ -355,26 +442,50 @@ VOID STDCALL GetStartupInfoA(LPSTARTUPINFO lpStartupInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
BOOL STDCALL FlushInstructionCache(HANDLE hProcess,
|
||||
LPCVOID lpBaseAddress,
|
||||
DWORD dwSize)
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FlushInstructionCache (
|
||||
HANDLE hProcess,
|
||||
LPCVOID lpBaseAddress,
|
||||
DWORD dwSize
|
||||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
errCode = NtFlushInstructionCache(hProcess,(PVOID)lpBaseAddress,dwSize);
|
||||
if (!NT_SUCCESS(errCode))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
NTSTATUS errCode;
|
||||
|
||||
errCode = NtFlushInstructionCache(
|
||||
hProcess,
|
||||
(PVOID) lpBaseAddress,
|
||||
dwSize
|
||||
);
|
||||
if (!NT_SUCCESS(errCode))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID STDCALL ExitProcess(UINT uExitCode)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
ExitProcess (
|
||||
UINT uExitCode
|
||||
)
|
||||
{
|
||||
NtTerminateProcess(NtCurrentProcess(), uExitCode);
|
||||
NtTerminateProcess(
|
||||
NtCurrentProcess(),
|
||||
uExitCode
|
||||
);
|
||||
}
|
||||
|
||||
WINBOOL STDCALL TerminateProcess(HANDLE hProcess, UINT uExitCode)
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
TerminateProcess (
|
||||
HANDLE hProcess,
|
||||
UINT uExitCode
|
||||
)
|
||||
{
|
||||
NTSTATUS errCode;
|
||||
errCode = NtTerminateProcess(hProcess, uExitCode);
|
||||
|
@ -386,7 +497,12 @@ WINBOOL STDCALL TerminateProcess(HANDLE hProcess, UINT uExitCode)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
VOID STDCALL FatalAppExitA(UINT uAction, LPCSTR lpMessageText)
|
||||
VOID
|
||||
STDCALL
|
||||
FatalAppExitA (
|
||||
UINT uAction,
|
||||
LPCSTR lpMessageText
|
||||
)
|
||||
{
|
||||
WCHAR MessageTextW[MAX_PATH];
|
||||
UINT i;
|
||||
|
@ -404,7 +520,15 @@ VOID STDCALL FatalAppExitA(UINT uAction, LPCSTR lpMessageText)
|
|||
|
||||
|
||||
|
||||
VOID STDCALL FatalAppExitW(UINT uAction, LPCWSTR lpMessageText)
|
||||
VOID
|
||||
STDCALL
|
||||
FatalAppExitW (
|
||||
UINT uAction,
|
||||
LPCWSTR lpMessageText
|
||||
)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: critical.c,v 1.5 1999/08/29 06:59:03 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/sync/critical.c
|
||||
|
@ -15,29 +16,46 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID InitializeCriticalSection(LPCRITICAL_SECTION pcritical)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
InitializeCriticalSection(LPCRITICAL_SECTION pcritical)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
WINBOOL TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
; $Id: ntdll.def,v 1.13 1999/08/29 06:59:04 ea Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
EXPORTS
|
||||
InitializeObjectAttributes
|
||||
NtAcceptConnectPort@24
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
; $Id: ntdll.edf,v 1.4 1999/08/29 06:59:04 ea Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
EXPORTS
|
||||
InitializeObjectAttributes
|
||||
NtAcceptConnectPort=NtAcceptConnectPort@24
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: startup.c,v 1.9 1999/08/29 06:59:04 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/ldr/startup.c
|
||||
|
@ -9,6 +10,7 @@
|
|||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <reactos/config.h>
|
||||
#define WIN32_NO_PEHDR
|
||||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
@ -18,7 +20,9 @@
|
|||
#include <ntdll/ldr.h>
|
||||
#include <ntdll/rtl.h>
|
||||
|
||||
#ifndef DBG_NTDLL_LDR_STARTUP
|
||||
#define NDEBUG
|
||||
#endif
|
||||
#include <ntdll/ntdll.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
@ -30,8 +34,11 @@ extern HANDLE __ProcessHeap;
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle,
|
||||
PHANDLE PtrNTDllSectionHandle)
|
||||
NTSTATUS
|
||||
LdrMapNTDllForProcess (
|
||||
HANDLE ProcessHandle,
|
||||
PHANDLE PtrNTDllSectionHandle
|
||||
)
|
||||
{
|
||||
ULONG InitialViewSize;
|
||||
NTSTATUS Status;
|
||||
|
@ -125,3 +132,6 @@ VOID LdrStartup(HANDLE SectionHandle,
|
|||
Status = EntryPoint();
|
||||
ZwTerminateProcess(NtCurrentProcess(),Status);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: registry.c,v 1.18 1999/08/29 06:59:05 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/cm/registry.c
|
||||
|
@ -363,13 +364,16 @@ CHECKPOINT;
|
|||
|
||||
|
||||
NTSTATUS
|
||||
NtCreateKey(OUT PHANDLE KeyHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN ULONG TitleIndex,
|
||||
IN PUNICODE_STRING Class,
|
||||
IN ULONG CreateOptions,
|
||||
OUT PULONG Disposition)
|
||||
STDCALL
|
||||
NtCreateKey (
|
||||
OUT PHANDLE KeyHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN ULONG TitleIndex,
|
||||
IN PUNICODE_STRING Class,
|
||||
IN ULONG CreateOptions,
|
||||
OUT PULONG Disposition
|
||||
)
|
||||
{
|
||||
#if PROTO_REG
|
||||
PWSTR KeyNameBuf;
|
||||
|
@ -455,7 +459,10 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
|
||||
|
||||
NTSTATUS
|
||||
NtDeleteKey(IN HANDLE KeyHandle)
|
||||
STDCALL
|
||||
NtDeleteKey (
|
||||
IN HANDLE KeyHandle
|
||||
)
|
||||
{
|
||||
#ifdef PROTO_REG
|
||||
NTSTATUS Status;
|
||||
|
@ -489,12 +496,15 @@ NtDeleteKey(IN HANDLE KeyHandle)
|
|||
|
||||
|
||||
NTSTATUS
|
||||
NtEnumerateKey(IN HANDLE KeyHandle,
|
||||
IN ULONG Index,
|
||||
IN KEY_INFORMATION_CLASS KeyInformationClass,
|
||||
OUT PVOID KeyInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength)
|
||||
STDCALL
|
||||
NtEnumerateKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN ULONG Index,
|
||||
IN KEY_INFORMATION_CLASS KeyInformationClass,
|
||||
OUT PVOID KeyInformation,
|
||||
IN ULONG Length,
|
||||
OUT PULONG ResultLength
|
||||
)
|
||||
{
|
||||
#ifdef PROTO_REG
|
||||
NTSTATUS Status;
|
||||
|
@ -637,7 +647,9 @@ NtEnumerateKey(IN HANDLE KeyHandle,
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtEnumerateValueKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN ULONG Index,
|
||||
|
@ -654,8 +666,12 @@ NtEnumerateValueKey (
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NtFlushKey(IN HANDLE KeyHandle)
|
||||
STDCALL
|
||||
NtFlushKey (
|
||||
IN HANDLE KeyHandle
|
||||
)
|
||||
{
|
||||
#ifdef PROTO_REG
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -664,10 +680,14 @@ NtFlushKey(IN HANDLE KeyHandle)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NtOpenKey(OUT PHANDLE KeyHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
STDCALL
|
||||
NtOpenKey (
|
||||
OUT PHANDLE KeyHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
{
|
||||
#ifdef PROTO_REG
|
||||
NTSTATUS Status;
|
||||
|
@ -757,7 +777,9 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQueryKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN KEY_INFORMATION_CLASS KeyInformationClass,
|
||||
|
@ -895,7 +917,9 @@ NtQueryKey (
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQueryValueKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
|
@ -1024,7 +1048,9 @@ NtQueryValueKey (
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtSetValueKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
|
@ -1088,7 +1114,8 @@ NtSetValueKey (
|
|||
#endif
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtDeleteValueKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN PUNICODE_STRING ValueName
|
||||
|
@ -1246,6 +1273,7 @@ NtInitializeRegistry (
|
|||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCheckRegistryKey (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path
|
||||
|
@ -1256,6 +1284,7 @@ RtlCheckRegistryKey (
|
|||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCreateRegistryKey (
|
||||
IN ULONG RelativeTo,
|
||||
IN PWSTR Path
|
||||
|
@ -1266,6 +1295,7 @@ RtlCreateRegistryKey (
|
|||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlDeleteRegistryValue (
|
||||
IN ULONG RelativeTo,
|
||||
IN PWSTR Path,
|
||||
|
@ -1277,6 +1307,7 @@ RtlDeleteRegistryValue (
|
|||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlQueryRegistryValues (
|
||||
IN ULONG RelativeTo,
|
||||
IN PWSTR Path,
|
||||
|
@ -1290,6 +1321,7 @@ RtlQueryRegistryValues (
|
|||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlWriteRegistryValue (
|
||||
ULONG RelativeTo,
|
||||
PWSTR Path,
|
||||
|
@ -2690,4 +2722,4 @@ CmiReleaseBlock(PREGISTRY_FILE RegistryFile,
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: interlck.c,v 1.2 1999/08/29 06:59:06 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ex/interlck.c
|
||||
|
@ -16,28 +17,46 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
INTERLOCKED_RESULT ExInterlockedDecrementLong(PLONG Addend,
|
||||
PKSPIN_LOCK Lock)
|
||||
INTERLOCKED_RESULT
|
||||
ExInterlockedDecrementLong (
|
||||
PLONG Addend,
|
||||
PKSPIN_LOCK Lock
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
ULONG ExInterlockedExchangeUlong(PULONG Target,
|
||||
ULONG Value,
|
||||
PKSPIN_LOCK Lock)
|
||||
|
||||
ULONG
|
||||
ExInterlockedExchangeUlong (
|
||||
PULONG Target,
|
||||
ULONG Value,
|
||||
PKSPIN_LOCK Lock
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
ULONG ExInterlockedAddUlong(PULONG Addend,
|
||||
ULONG Increment,
|
||||
PKSPIN_LOCK Lock)
|
||||
|
||||
ULONG
|
||||
ExInterlockedAddUlong (
|
||||
PULONG Addend,
|
||||
ULONG Increment,
|
||||
PKSPIN_LOCK Lock
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
INTERLOCKED_RESULT ExInterlockedIncrementLong(PLONG Addend,
|
||||
PKSPIN_LOCK Lock)
|
||||
|
||||
INTERLOCKED_RESULT
|
||||
ExInterlockedIncrementLong (
|
||||
PLONG Addend,
|
||||
PKSPIN_LOCK Lock
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: device.c,v 1.10 1999/08/29 06:59:06 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/io/device.c
|
||||
|
@ -33,20 +34,32 @@ NtUnloadDriver (
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtLoadDriver
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Loads a device driver.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* DriverServiceName
|
||||
* Name of the service to load (registry key).
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*
|
||||
* REVISIONS
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtLoadDriver (
|
||||
PUNICODE_STRING DriverServiceName
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Loads a driver
|
||||
* ARGUMENTS:
|
||||
* DriverServiceName = Name of the service to load (registry key)
|
||||
* RETURNS: Status
|
||||
*/
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
IoAttachDeviceByPointer (
|
||||
PDEVICE_OBJECT SourceDevice,
|
||||
|
@ -307,3 +320,6 @@ NTSTATUS IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
|||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: file.c,v 1.9 1999/08/29 06:59:06 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/io/file.c
|
||||
|
@ -89,7 +90,9 @@ NtQueryInformationFile (
|
|||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtSetInformationFile (
|
||||
HANDLE FileHandle,
|
||||
PIO_STATUS_BLOCK IoStatusBlock,
|
||||
|
@ -98,65 +101,100 @@ NtSetInformationFile (
|
|||
FILE_INFORMATION_CLASS FileInformationClass
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
|
||||
DPRINT("NtSetInformationFile(Handle %x StatBlk %x FileInfo %x Length %d Class %d)\n",
|
||||
FileHandle,
|
||||
IoStatusBlock,
|
||||
FileInformation,
|
||||
Length,
|
||||
FileInformationClass);
|
||||
DPRINT(
|
||||
"NtSetInformationFile(Handle %x StatBlk %x FileInfo %x Length %d Class %d)\n",
|
||||
FileHandle,
|
||||
IoStatusBlock,
|
||||
FileInformation,
|
||||
Length,
|
||||
FileInformationClass
|
||||
);
|
||||
|
||||
/* Get the file object from the file handle */
|
||||
Status = ObReferenceObjectByHandle(FileHandle,
|
||||
FILE_WRITE_ATTRIBUTES,
|
||||
IoFileType,
|
||||
UserMode,
|
||||
(PVOID *) &FileObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
DPRINT("FileObject %x\n", FileObject);
|
||||
/* Get the file object from the file handle */
|
||||
Status = ObReferenceObjectByHandle(
|
||||
FileHandle,
|
||||
FILE_WRITE_ATTRIBUTES,
|
||||
IoFileType,
|
||||
UserMode,
|
||||
(PVOID *) & FileObject,
|
||||
NULL
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("FileObject %x\n", FileObject);
|
||||
|
||||
/* initialize an event object to wait on for the request */
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
/*
|
||||
* Initialize an event object to wait
|
||||
* on for the request.
|
||||
*/
|
||||
KeInitializeEvent(
|
||||
& Event,
|
||||
NotificationEvent,
|
||||
FALSE
|
||||
);
|
||||
/*
|
||||
* Build the IRP to be sent to the driver
|
||||
* for the request.
|
||||
*/
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
IRP_MJ_SET_INFORMATION,
|
||||
FileObject->DeviceObject,
|
||||
FileInformation,
|
||||
Length,
|
||||
0,
|
||||
& Event,
|
||||
IoStatusBlock
|
||||
);
|
||||
|
||||
/* build the IRP to be sent to the driver for the request */
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_SET_INFORMATION,
|
||||
FileObject->DeviceObject,
|
||||
FileInformation,
|
||||
Length,
|
||||
0,
|
||||
&Event,
|
||||
IoStatusBlock);
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->FileObject = FileObject;
|
||||
StackPtr->Parameters.SetFile.Length = Length;
|
||||
StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass;
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->FileObject = FileObject;
|
||||
StackPtr->Parameters.SetFile.Length = Length;
|
||||
StackPtr->Parameters.SetFile.FileInformationClass =
|
||||
FileInformationClass;
|
||||
|
||||
/* Pass the IRP to the FSD (and wait for it if required) */
|
||||
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
|
||||
Status = IoCallDriver(FileObject->DeviceObject, Irp);
|
||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
/*
|
||||
* Pass the IRP to the FSD (and wait for
|
||||
* it if required)
|
||||
*/
|
||||
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
|
||||
Status = IoCallDriver(
|
||||
FileObject->DeviceObject,
|
||||
Irp
|
||||
);
|
||||
if ( (Status == STATUS_PENDING)
|
||||
&& (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
)
|
||||
{
|
||||
KeWaitForSingleObject(
|
||||
& Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL
|
||||
);
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
PGENERIC_MAPPING IoGetFileObjectGenericMapping(VOID)
|
||||
|
||||
PGENERIC_MAPPING
|
||||
IoGetFileObjectGenericMapping(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQueryAttributesFile (
|
||||
|
@ -210,3 +248,4 @@ NtSetEaFile (
|
|||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: rw.c,v 1.26 1999/08/29 06:59:06 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/io/rw.c
|
||||
|
@ -21,7 +22,22 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtReadFile
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtReadFile (
|
||||
HANDLE FileHandle,
|
||||
HANDLE EventHandle,
|
||||
|
@ -34,94 +50,142 @@ NtReadFile (
|
|||
PULONG Key
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
PKEVENT ptrEvent = NULL;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
PKEVENT ptrEvent = NULL;
|
||||
KEVENT Event;
|
||||
|
||||
DPRINT("NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, "
|
||||
"IoStatusBlock %x)\n",
|
||||
FileHandle,Buffer,Length,ByteOffset,IoStatusBlock);
|
||||
DPRINT(
|
||||
"NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, "
|
||||
"IoStatusBlock %x)\n",
|
||||
FileHandle,
|
||||
Buffer,
|
||||
Length,
|
||||
ByteOffset,
|
||||
IoStatusBlock
|
||||
);
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
Status = ObReferenceObjectByHandle(FileHandle,
|
||||
FILE_READ_DATA,
|
||||
IoFileType,
|
||||
UserMode,
|
||||
(PVOID *) &FileObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtReadFile() = %x\n",Status);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("ByteOffset %x FileObject->CurrentByteOffset %d\n",
|
||||
ByteOffset,
|
||||
FileObject->CurrentByteOffset.LowPart);
|
||||
if (ByteOffset==NULL)
|
||||
{
|
||||
ByteOffset = &(FileObject->CurrentByteOffset);
|
||||
}
|
||||
|
||||
if (EventHandle != NULL)
|
||||
{
|
||||
Status = ObReferenceObjectByHandle(EventHandle,
|
||||
SYNCHRONIZE,
|
||||
ExEventType,
|
||||
UserMode,
|
||||
(PVOID *)ptrEvent,
|
||||
NULL);
|
||||
Status = ObReferenceObjectByHandle(
|
||||
FileHandle,
|
||||
FILE_READ_DATA,
|
||||
IoFileType,
|
||||
UserMode,
|
||||
(PVOID *) & FileObject,
|
||||
NULL
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||
ptrEvent = &Event;
|
||||
}
|
||||
{
|
||||
DPRINT("NtReadFile() = %x\n",Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT(
|
||||
"ByteOffset %x FileObject->CurrentByteOffset %d\n",
|
||||
ByteOffset,
|
||||
FileObject->CurrentByteOffset.LowPart
|
||||
);
|
||||
if (ByteOffset == NULL)
|
||||
{
|
||||
ByteOffset = & (FileObject->CurrentByteOffset);
|
||||
}
|
||||
|
||||
if (EventHandle != NULL)
|
||||
{
|
||||
Status = ObReferenceObjectByHandle(
|
||||
EventHandle,
|
||||
SYNCHRONIZE,
|
||||
ExEventType,
|
||||
UserMode,
|
||||
(PVOID *) ptrEvent,
|
||||
NULL
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
KeInitializeEvent(
|
||||
& Event,
|
||||
NotificationEvent,
|
||||
FALSE
|
||||
);
|
||||
ptrEvent = & Event;
|
||||
}
|
||||
|
||||
DPRINT("FileObject %x\n",FileObject);
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||
FileObject->DeviceObject,
|
||||
Buffer,
|
||||
Length,
|
||||
ByteOffset,
|
||||
ptrEvent,
|
||||
IoStatusBlock);
|
||||
DPRINT("FileObject %x\n",FileObject);
|
||||
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
IRP_MJ_READ,
|
||||
FileObject->DeviceObject,
|
||||
Buffer,
|
||||
Length,
|
||||
ByteOffset,
|
||||
ptrEvent,
|
||||
IoStatusBlock
|
||||
);
|
||||
|
||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->FileObject = FileObject;
|
||||
if (Key!=NULL)
|
||||
{
|
||||
StackPtr->Parameters.Read.Key = *Key;
|
||||
}
|
||||
else
|
||||
{
|
||||
StackPtr->Parameters.Read.Key = 0;
|
||||
}
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->FileObject = FileObject;
|
||||
if (Key != NULL)
|
||||
{
|
||||
StackPtr->Parameters.Read.Key = *Key;
|
||||
}
|
||||
else
|
||||
{
|
||||
StackPtr->Parameters.Read.Key = 0;
|
||||
}
|
||||
|
||||
Status = IoCallDriver(FileObject->DeviceObject, Irp);
|
||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||
Status = IoStatusBlock->Status;
|
||||
}
|
||||
DPRINT("NtReadFile() = %x\n",Status);
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
return(Status);
|
||||
Status = IoCallDriver(
|
||||
FileObject->DeviceObject,
|
||||
Irp
|
||||
);
|
||||
if (
|
||||
(Status == STATUS_PENDING)
|
||||
&& (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
)
|
||||
{
|
||||
KeWaitForSingleObject(
|
||||
& Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL
|
||||
);
|
||||
Status = IoStatusBlock->Status;
|
||||
}
|
||||
|
||||
DPRINT("NtReadFile() = %x\n",Status);
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtWriteFile
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtWriteFile (
|
||||
HANDLE FileHandle,
|
||||
HANDLE EventHandle,
|
||||
|
@ -134,63 +198,101 @@ NtWriteFile (
|
|||
PULONG Key
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
|
||||
DPRINT("NtWriteFile(FileHandle %x, Buffer %x, Length %d)\n",
|
||||
FileHandle,Buffer,Length);
|
||||
DPRINT(
|
||||
"NtWriteFile(FileHandle %x, Buffer %x, Length %d)\n",
|
||||
FileHandle,
|
||||
Buffer,
|
||||
Length
|
||||
);
|
||||
|
||||
Status = ObReferenceObjectByHandle(FileHandle,
|
||||
FILE_WRITE_DATA,
|
||||
IoFileType,
|
||||
UserMode,
|
||||
(PVOID *) &FileObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
if (ByteOffset==NULL)
|
||||
{
|
||||
ByteOffset = &(FileObject->CurrentByteOffset);
|
||||
}
|
||||
Status = ObReferenceObjectByHandle(
|
||||
FileHandle,
|
||||
FILE_WRITE_DATA,
|
||||
IoFileType,
|
||||
UserMode,
|
||||
(PVOID *) & FileObject,
|
||||
NULL
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
if (ByteOffset == NULL)
|
||||
{
|
||||
ByteOffset = & (FileObject->CurrentByteOffset);
|
||||
}
|
||||
|
||||
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
|
||||
FileObject->DeviceObject,
|
||||
Buffer,
|
||||
Length,
|
||||
ByteOffset,
|
||||
&Event,
|
||||
IoStatusBlock);
|
||||
KeInitializeEvent(
|
||||
& Event,
|
||||
NotificationEvent,
|
||||
FALSE
|
||||
);
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
IRP_MJ_WRITE,
|
||||
FileObject->DeviceObject,
|
||||
Buffer,
|
||||
Length,
|
||||
ByteOffset,
|
||||
& Event,
|
||||
IoStatusBlock
|
||||
);
|
||||
|
||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||
|
||||
DPRINT("FileObject->DeviceObject %x\n",FileObject->DeviceObject);
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->FileObject = FileObject;
|
||||
if (Key!=NULL)
|
||||
{
|
||||
StackPtr->Parameters.Write.Key = *Key;
|
||||
}
|
||||
else
|
||||
{
|
||||
StackPtr->Parameters.Write.Key = 0;
|
||||
}
|
||||
Status = IoCallDriver(FileObject->DeviceObject,Irp);
|
||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
return(Status);
|
||||
DPRINT("FileObject->DeviceObject %x\n",FileObject->DeviceObject);
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->FileObject = FileObject;
|
||||
if (Key != NULL)
|
||||
{
|
||||
StackPtr->Parameters.Write.Key = *Key;
|
||||
}
|
||||
else
|
||||
{
|
||||
StackPtr->Parameters.Write.Key = 0;
|
||||
}
|
||||
Status = IoCallDriver(
|
||||
FileObject->DeviceObject,
|
||||
Irp
|
||||
);
|
||||
if (
|
||||
(Status == STATUS_PENDING)
|
||||
&& (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
)
|
||||
{
|
||||
KeWaitForSingleObject(
|
||||
& Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL
|
||||
);
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtReadFileScatter
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtReadFileScatter (
|
||||
|
@ -209,6 +311,19 @@ NtReadFileScatter (
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtWriteFileGather
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtWriteFileGather (
|
||||
|
@ -225,3 +340,6 @@ NtWriteFileGather (
|
|||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: symlink.c,v 1.9 1999/08/29 06:59:08 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/io/symlink.c
|
||||
|
@ -19,197 +20,400 @@
|
|||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
typedef struct
|
||||
typedef
|
||||
struct
|
||||
{
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
UNICODE_STRING TargetName;
|
||||
OBJECT_ATTRIBUTES Target;
|
||||
CSHORT Type;
|
||||
CSHORT Size;
|
||||
UNICODE_STRING TargetName;
|
||||
OBJECT_ATTRIBUTES Target;
|
||||
|
||||
} SYMLNK_OBJECT, *PSYMLNK_OBJECT;
|
||||
|
||||
POBJECT_TYPE IoSymbolicLinkType = NULL;
|
||||
|
||||
POBJECT_TYPE
|
||||
IoSymbolicLinkType = NULL;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
NTSTATUS IopCreateSymbolicLink(PVOID Object,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
if (Parent != NULL && RemainingPath != NULL)
|
||||
{
|
||||
ObAddEntryDirectory(Parent, Object, RemainingPath+1);
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
PVOID IopParseSymbolicLink(PVOID Object,
|
||||
PWSTR* RemainingPath)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PSYMLNK_OBJECT SymlinkObject = (PSYMLNK_OBJECT)Object;
|
||||
PVOID ReturnedObject;
|
||||
|
||||
Status = ObReferenceObjectByName(SymlinkObject->Target.ObjectName,
|
||||
0,
|
||||
NULL,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
NULL,
|
||||
UserMode,
|
||||
NULL,
|
||||
&ReturnedObject);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
return(ReturnedObject);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
VOID IoInitSymbolicLinkImplementation(VOID)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
|
||||
IoSymbolicLinkType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
||||
|
||||
IoSymbolicLinkType->TotalObjects = 0;
|
||||
IoSymbolicLinkType->TotalHandles = 0;
|
||||
IoSymbolicLinkType->MaxObjects = ULONG_MAX;
|
||||
IoSymbolicLinkType->MaxHandles = ULONG_MAX;
|
||||
IoSymbolicLinkType->PagedPoolCharge = 0;
|
||||
IoSymbolicLinkType->NonpagedPoolCharge = sizeof(SYMLNK_OBJECT);
|
||||
IoSymbolicLinkType->Dump = NULL;
|
||||
IoSymbolicLinkType->Open = NULL;
|
||||
IoSymbolicLinkType->Close = NULL;
|
||||
IoSymbolicLinkType->Delete = NULL;
|
||||
IoSymbolicLinkType->Parse = IopParseSymbolicLink;
|
||||
IoSymbolicLinkType->Security = NULL;
|
||||
IoSymbolicLinkType->QueryName = NULL;
|
||||
IoSymbolicLinkType->OkayToClose = NULL;
|
||||
IoSymbolicLinkType->Create = IopCreateSymbolicLink;
|
||||
|
||||
RtlInitAnsiString(&AnsiString,"Symbolic Link");
|
||||
RtlAnsiStringToUnicodeString(&IoSymbolicLinkType->TypeName,
|
||||
&AnsiString,TRUE);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME INTERNAL
|
||||
* IopCreateSymbolicLink
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURNN VALUE
|
||||
* Status.
|
||||
*
|
||||
* REVISIONS
|
||||
*/
|
||||
NTSTATUS
|
||||
IopCreateSymbolicLink (
|
||||
PVOID Object,
|
||||
PVOID Parent,
|
||||
PWSTR RemainingPath,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
{
|
||||
if ( (Parent != NULL)
|
||||
&& (RemainingPath != NULL)
|
||||
)
|
||||
{
|
||||
ObAddEntryDirectory(
|
||||
Parent,
|
||||
Object,
|
||||
RemainingPath + 1
|
||||
);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME INTERNAL
|
||||
* IopParseSymbolicLink
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURNN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*/
|
||||
PVOID
|
||||
IopParseSymbolicLink (
|
||||
PVOID Object,
|
||||
PWSTR * RemainingPath
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PSYMLNK_OBJECT SymlinkObject = (PSYMLNK_OBJECT) Object;
|
||||
PVOID ReturnedObject;
|
||||
|
||||
Status = ObReferenceObjectByName(
|
||||
SymlinkObject->Target.ObjectName,
|
||||
0,
|
||||
NULL,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
NULL,
|
||||
UserMode,
|
||||
NULL,
|
||||
& ReturnedObject
|
||||
);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
return ReturnedObject;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME INTERNAL
|
||||
* IoInitSymbolicLinkImplementation
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
* None.
|
||||
*
|
||||
* RETURNN VALUE
|
||||
* None.
|
||||
*
|
||||
* REVISIONS
|
||||
*/
|
||||
VOID
|
||||
IoInitSymbolicLinkImplementation (VOID)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
|
||||
IoSymbolicLinkType = ExAllocatePool(
|
||||
NonPagedPool,
|
||||
sizeof (OBJECT_TYPE)
|
||||
);
|
||||
|
||||
IoSymbolicLinkType->TotalObjects = 0;
|
||||
IoSymbolicLinkType->TotalHandles = 0;
|
||||
IoSymbolicLinkType->MaxObjects = ULONG_MAX;
|
||||
IoSymbolicLinkType->MaxHandles = ULONG_MAX;
|
||||
IoSymbolicLinkType->PagedPoolCharge = 0;
|
||||
IoSymbolicLinkType->NonpagedPoolCharge = sizeof (SYMLNK_OBJECT);
|
||||
IoSymbolicLinkType->Dump = NULL;
|
||||
IoSymbolicLinkType->Open = NULL;
|
||||
IoSymbolicLinkType->Close = NULL;
|
||||
IoSymbolicLinkType->Delete = NULL;
|
||||
IoSymbolicLinkType->Parse = IopParseSymbolicLink;
|
||||
IoSymbolicLinkType->Security = NULL;
|
||||
IoSymbolicLinkType->QueryName = NULL;
|
||||
IoSymbolicLinkType->OkayToClose = NULL;
|
||||
IoSymbolicLinkType->Create = IopCreateSymbolicLink;
|
||||
|
||||
RtlInitAnsiString(
|
||||
& AnsiString,
|
||||
"Symbolic Link"
|
||||
);
|
||||
RtlAnsiStringToUnicodeString(
|
||||
& IoSymbolicLinkType->TypeName,
|
||||
& AnsiString,
|
||||
TRUE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtOpenSymbolicLinkObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtOpenSymbolicLinkObject (
|
||||
OUT PHANDLE LinkHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
PVOID Object;
|
||||
|
||||
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
UserMode,
|
||||
NULL,
|
||||
&Object);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = ObReferenceObjectByName(
|
||||
ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
UserMode,
|
||||
NULL,
|
||||
& Object
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
FALSE,
|
||||
LinkHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = ObCreateHandle(
|
||||
PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
FALSE,
|
||||
LinkHandle
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtQuerySymbolicLinkObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQuerySymbolicLinkObject (
|
||||
IN HANDLE LinkHandle,
|
||||
IN OUT PUNICODE_STRING LinkTarget,
|
||||
OUT PULONG ReturnedLength OPTIONAL
|
||||
)
|
||||
{
|
||||
PSYMLNK_OBJECT SymlinkObject;
|
||||
NTSTATUS Status;
|
||||
PSYMLNK_OBJECT SymlinkObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = ObReferenceObjectByHandle(LinkHandle,
|
||||
SYMBOLIC_LINK_QUERY,
|
||||
IoSymbolicLinkType,
|
||||
UserMode,
|
||||
(PVOID*)&SymlinkObject,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = ObReferenceObjectByHandle(
|
||||
LinkHandle,
|
||||
SYMBOLIC_LINK_QUERY,
|
||||
IoSymbolicLinkType,
|
||||
UserMode,
|
||||
(PVOID *) & SymlinkObject,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
RtlCopyUnicodeString(LinkTarget,SymlinkObject->Target.ObjectName);
|
||||
if (ReturnedLength!=NULL)
|
||||
{
|
||||
*ReturnedLength=SymlinkObject->Target.Length;
|
||||
}
|
||||
ObDereferenceObject(SymlinkObject);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS IoCreateUnprotectedSymbolicLink(PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName)
|
||||
{
|
||||
return(IoCreateSymbolicLink(SymbolicLinkName,DeviceName));
|
||||
}
|
||||
|
||||
NTSTATUS IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE SymbolicLinkHandle;
|
||||
PSYMLNK_OBJECT SymbolicLink;
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
DPRINT("IoCreateSymbolicLink(SymbolicLinkName %w, DeviceName %w)\n",
|
||||
SymbolicLinkName->Buffer,DeviceName->Buffer);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,SymbolicLinkName,0,NULL,NULL);
|
||||
SymbolicLink = ObCreateObject(&SymbolicLinkHandle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
IoSymbolicLinkType);
|
||||
if (SymbolicLink == NULL)
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
|
||||
ZwClose(SymbolicLinkHandle);
|
||||
SymbolicLink->TargetName.Length = 0;
|
||||
SymbolicLink->TargetName.MaximumLength =
|
||||
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
|
||||
SymbolicLink->TargetName.Buffer = ExAllocatePool(NonPagedPool,
|
||||
SymbolicLink->TargetName.MaximumLength);
|
||||
RtlCopyUnicodeString(&(SymbolicLink->TargetName), DeviceName);
|
||||
DPRINT("DeviceName %w\n", SymbolicLink->TargetName.Buffer);
|
||||
InitializeObjectAttributes(&(SymbolicLink->Target),
|
||||
&(SymbolicLink->TargetName),0,NULL,NULL);
|
||||
DPRINT("%s() = STATUS_SUCCESS\n",__FUNCTION__);
|
||||
return(STATUS_SUCCESS);
|
||||
RtlCopyUnicodeString(
|
||||
LinkTarget,
|
||||
SymlinkObject->Target.ObjectName
|
||||
);
|
||||
if (ReturnedLength != NULL)
|
||||
{
|
||||
*ReturnedLength = SymlinkObject->Target.Length;
|
||||
}
|
||||
ObDereferenceObject(SymlinkObject);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* IoCreateUnprotectedSymbolicLink
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
IoDeleteSymbolicLink(PUNICODE_STRING DeviceName)
|
||||
STDCALL
|
||||
IoCreateUnprotectedSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName
|
||||
)
|
||||
{
|
||||
return IoCreateSymbolicLink(
|
||||
SymbolicLinkName,
|
||||
DeviceName
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* IoCreateSymbolicLink
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoCreateSymbolicLink (
|
||||
PUNICODE_STRING SymbolicLinkName,
|
||||
PUNICODE_STRING DeviceName
|
||||
)
|
||||
{
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
HANDLE SymbolicLinkHandle;
|
||||
PSYMLNK_OBJECT SymbolicLink;
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
DPRINT(
|
||||
"IoCreateSymbolicLink(SymbolicLinkName %w, DeviceName %w)\n",
|
||||
SymbolicLinkName->Buffer,
|
||||
DeviceName->Buffer
|
||||
);
|
||||
|
||||
InitializeObjectAttributes(
|
||||
& ObjectAttributes,
|
||||
SymbolicLinkName,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
SymbolicLink = ObCreateObject(
|
||||
& SymbolicLinkHandle,
|
||||
SYMBOLIC_LINK_ALL_ACCESS,
|
||||
& ObjectAttributes,
|
||||
IoSymbolicLinkType
|
||||
);
|
||||
if (SymbolicLink == NULL)
|
||||
{
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
ZwClose(SymbolicLinkHandle);
|
||||
|
||||
SymbolicLink->TargetName.Length = 0;
|
||||
SymbolicLink->TargetName.MaximumLength =
|
||||
((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR));
|
||||
SymbolicLink->TargetName.Buffer =
|
||||
ExAllocatePool(
|
||||
NonPagedPool,
|
||||
SymbolicLink->TargetName.MaximumLength
|
||||
);
|
||||
RtlCopyUnicodeString(
|
||||
& (SymbolicLink->TargetName),
|
||||
DeviceName
|
||||
);
|
||||
|
||||
DPRINT("DeviceName %w\n", SymbolicLink->TargetName.Buffer);
|
||||
|
||||
InitializeObjectAttributes(
|
||||
& (SymbolicLink->Target),
|
||||
& (SymbolicLink->TargetName),
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
DPRINT("%s() = STATUS_SUCCESS\n",__FUNCTION__);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* IoDeleteSymbolicLink
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
IoDeleteSymbolicLink (
|
||||
PUNICODE_STRING DeviceName
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME (EXPORTED as Zw)
|
||||
* NtCreateSymbolicLinkObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCreateSymbolicLinkObject (
|
||||
|
@ -222,3 +426,5 @@ NtCreateSymbolicLinkObject (
|
|||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: main.c,v 1.22 1999/08/29 06:59:10 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/main.c
|
||||
|
@ -107,13 +108,13 @@ extern int edata;
|
|||
extern int end;
|
||||
|
||||
static char * INIData =
|
||||
"[HKEY_LOCAL_MACHINE\HARDWARE]\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\\HARDWARE]\r\n"
|
||||
"\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP]\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP]\r\n"
|
||||
"\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\AtDisk]\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\AtDisk]\r\n"
|
||||
"\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\AtDisk\Controller 0]\r\n"
|
||||
"[HKEY_LOCAL_MACHINE\\HARDWARE\\DEVICEMAP\\AtDisk\\Controller 0]\r\n"
|
||||
"Controller Address=dword:000001f0\r\n"
|
||||
"Controller Interrupt=dword:0000000e\r\n"
|
||||
"\r\n"
|
||||
|
@ -148,7 +149,7 @@ asmlinkage void _main(boot_param* _bp)
|
|||
*/
|
||||
HalInitConsole(&bp);
|
||||
|
||||
DbgPrint("Starting ReactOS "KERNEL_VERSION"\n");
|
||||
DbgPrint("Starting ReactOS "KERNEL_VERSION" (Build "__DATE__", "__TIME__")\n");
|
||||
|
||||
start = KERNEL_BASE + PAGE_ROUND_UP(bp.module_length[0]);
|
||||
if (start < ((int)&end))
|
||||
|
@ -214,3 +215,5 @@ asmlinkage void _main(boot_param* _bp)
|
|||
PsTerminateSystemThread(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: section.c,v 1.14 1999/08/29 06:59:10 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/section.c
|
||||
|
@ -179,39 +180,110 @@ NtCreateSection (
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME
|
||||
* NtOpenSection
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
* SectionHandle
|
||||
*
|
||||
* DesiredAccess
|
||||
*
|
||||
* ObjectAttributes
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtOpenSection (
|
||||
PHANDLE SectionHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
{
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
|
||||
*SectionHandle = 0;
|
||||
*SectionHandle = 0;
|
||||
|
||||
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
MmSectionType,
|
||||
UserMode,
|
||||
NULL,
|
||||
&Object);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = ObReferenceObjectByName(
|
||||
ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
MmSectionType,
|
||||
UserMode,
|
||||
NULL,
|
||||
& Object
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
FALSE,
|
||||
SectionHandle);
|
||||
return(Status);
|
||||
Status = ObCreateHandle(
|
||||
PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
FALSE,
|
||||
SectionHandle
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtMapViewOfSection
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Maps a view of a section into the virtual address space of a
|
||||
* process.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* SectionHandle
|
||||
* Handle of the section.
|
||||
*
|
||||
* ProcessHandle
|
||||
* Handle of the process.
|
||||
*
|
||||
* BaseAddress
|
||||
* Desired base address (or NULL) on entry;
|
||||
* Actual base address of the view on exit.
|
||||
*
|
||||
* ZeroBits
|
||||
* Number of high order address bits that must be zero.
|
||||
*
|
||||
* CommitSize
|
||||
* Size in bytes of the initially committed section of
|
||||
* the view.
|
||||
*
|
||||
* SectionOffset
|
||||
* Offset in bytes from the beginning of the section
|
||||
* to the beginning of the view.
|
||||
*
|
||||
* ViewSize
|
||||
* Desired length of map (or zero to map all) on entry
|
||||
* Actual length mapped on exit.
|
||||
*
|
||||
* InheritDisposition
|
||||
* Specified how the view is to be shared with
|
||||
* child processes.
|
||||
*
|
||||
* AllocateType
|
||||
* Type of allocation for the pages.
|
||||
*
|
||||
* Protect
|
||||
* Protection for the committed region of the view.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtMapViewOfSection (
|
||||
|
@ -226,137 +298,158 @@ NtMapViewOfSection (
|
|||
ULONG AllocationType,
|
||||
ULONG Protect
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Maps a view of a section into the virtual address space of a
|
||||
* process
|
||||
* ARGUMENTS:
|
||||
* SectionHandle = Handle of the section
|
||||
* ProcessHandle = Handle of the process
|
||||
* BaseAddress = Desired base address (or NULL) on entry
|
||||
* Actual base address of the view on exit
|
||||
* ZeroBits = Number of high order address bits that must be zero
|
||||
* CommitSize = Size in bytes of the initially committed section of
|
||||
* the view
|
||||
* SectionOffset = Offset in bytes from the beginning of the section
|
||||
* to the beginning of the view
|
||||
* ViewSize = Desired length of map (or zero to map all) on entry
|
||||
* Actual length mapped on exit
|
||||
* InheritDisposition = Specified how the view is to be shared with
|
||||
* child processes
|
||||
* AllocateType = Type of allocation for the pages
|
||||
* Protect = Protection for the committed region of the view
|
||||
* RETURNS: Status
|
||||
*/
|
||||
{
|
||||
PSECTION_OBJECT Section;
|
||||
PEPROCESS Process;
|
||||
MEMORY_AREA* Result;
|
||||
NTSTATUS Status;
|
||||
PSECTION_OBJECT Section;
|
||||
PEPROCESS Process;
|
||||
MEMORY_AREA * Result;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("NtMapViewOfSection(Section:%08lx, Process:%08lx,\n"
|
||||
" Base:%08lx, ZeroBits:%08lx, CommitSize:%08lx,\n"
|
||||
" SectionOffs:%08lx, *ViewSize:%08lx, InheritDisp:%08lx,\n"
|
||||
" AllocType:%08lx, Protect:%08lx)\n",
|
||||
SectionHandle,
|
||||
ProcessHandle,
|
||||
BaseAddress,
|
||||
ZeroBits,
|
||||
CommitSize,
|
||||
SectionOffset,
|
||||
*ViewSize,
|
||||
InheritDisposition,
|
||||
AllocationType,
|
||||
Protect);
|
||||
DPRINT(" *Base:%08lx\n", *BaseAddress);
|
||||
DPRINT(
|
||||
"NtMapViewOfSection(Section:%08lx, Process:%08lx,\n"
|
||||
" Base:%08lx, ZeroBits:%08lx, CommitSize:%08lx,\n"
|
||||
" SectionOffs:%08lx, *ViewSize:%08lx, InheritDisp:%08lx,\n"
|
||||
" AllocType:%08lx, Protect:%08lx)\n",
|
||||
SectionHandle,
|
||||
ProcessHandle,
|
||||
BaseAddress,
|
||||
ZeroBits,
|
||||
CommitSize,
|
||||
SectionOffset,
|
||||
*ViewSize,
|
||||
InheritDisposition,
|
||||
AllocationType,
|
||||
Protect
|
||||
);
|
||||
|
||||
Status = ObReferenceObjectByHandle(SectionHandle,
|
||||
SECTION_MAP_READ,
|
||||
MmSectionType,
|
||||
UserMode,
|
||||
(PVOID*)&Section,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
DPRINT("ObReference failed rc=%x\n",Status);
|
||||
return(Status);
|
||||
}
|
||||
DPRINT(" *Base:%08lx\n", *BaseAddress);
|
||||
|
||||
DPRINT("Section %x\n",Section);
|
||||
Status = ObReferenceObjectByHandle(
|
||||
SectionHandle,
|
||||
SECTION_MAP_READ,
|
||||
MmSectionType,
|
||||
UserMode,
|
||||
(PVOID *) & Section,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
DPRINT("ObReference failed rc=%x\n",Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
PROCESS_VM_OPERATION,
|
||||
PsProcessType,
|
||||
UserMode,
|
||||
(PVOID*)&Process,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
DPRINT("Section %x\n",Section);
|
||||
|
||||
Status = ObReferenceObjectByHandle(
|
||||
ProcessHandle,
|
||||
PROCESS_VM_OPERATION,
|
||||
PsProcessType,
|
||||
UserMode,
|
||||
(PVOID *) & Process,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
ObDereferenceObject(Section);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("ViewSize %x\n",ViewSize);
|
||||
|
||||
if ((*ViewSize) > Section->MaximumSize.u.LowPart)
|
||||
{
|
||||
(*ViewSize) = Section->MaximumSize.u.LowPart;
|
||||
}
|
||||
|
||||
Status = MmCreateMemoryArea(
|
||||
UserMode,
|
||||
Process,
|
||||
MEMORY_AREA_SECTION_VIEW_COMMIT,
|
||||
BaseAddress,
|
||||
* ViewSize,
|
||||
Protect,
|
||||
& Result
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtMapViewOfSection() = %x\n",Status);
|
||||
|
||||
ObDereferenceObject(Process);
|
||||
ObDereferenceObject(Section);
|
||||
|
||||
return Status;
|
||||
}
|
||||
Result->Data.SectionData.Section = Section;
|
||||
|
||||
DPRINT("SectionOffset %x\n",SectionOffset);
|
||||
|
||||
if (SectionOffset == NULL)
|
||||
{
|
||||
Result->Data.SectionData.ViewOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Result->Data.SectionData.ViewOffset =
|
||||
SectionOffset->u.LowPart;
|
||||
}
|
||||
|
||||
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
||||
ObDereferenceObject(Process);
|
||||
ObDereferenceObject(Section);
|
||||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("ViewSize %x\n",ViewSize);
|
||||
if ((*ViewSize) > Section->MaximumSize.u.LowPart)
|
||||
{
|
||||
(*ViewSize) = Section->MaximumSize.u.LowPart;
|
||||
}
|
||||
|
||||
Status = MmCreateMemoryArea(UserMode,
|
||||
Process,
|
||||
MEMORY_AREA_SECTION_VIEW_COMMIT,
|
||||
BaseAddress,
|
||||
*ViewSize,
|
||||
Protect,
|
||||
&Result);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtMapViewOfSection() = %x\n",Status);
|
||||
ObDereferenceObject(Process);
|
||||
ObDereferenceObject(Section);
|
||||
return(Status);
|
||||
}
|
||||
Result->Data.SectionData.Section = Section;
|
||||
|
||||
DPRINT("SectionOffset %x\n",SectionOffset);
|
||||
|
||||
if (SectionOffset == NULL)
|
||||
{
|
||||
Result->Data.SectionData.ViewOffset = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Result->Data.SectionData.ViewOffset = SectionOffset->u.LowPart;
|
||||
}
|
||||
|
||||
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
||||
ObDereferenceObject(Process);
|
||||
ObDereferenceObject(Section);
|
||||
return(STATUS_SUCCESS);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtUnmapViewOfSection
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
* ProcessHandle
|
||||
*
|
||||
* BaseAddress
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtUnmapViewOfSection (
|
||||
HANDLE ProcessHandle,
|
||||
PVOID BaseAddress
|
||||
)
|
||||
{
|
||||
PEPROCESS Process;
|
||||
NTSTATUS Status;
|
||||
PEPROCESS Process;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
PROCESS_VM_OPERATION,
|
||||
PsProcessType,
|
||||
UserMode,
|
||||
(PVOID*)&Process,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = MmFreeMemoryArea(Process,BaseAddress,0,TRUE);
|
||||
ObDereferenceObject(Process);
|
||||
return(Status);
|
||||
Status = ObReferenceObjectByHandle(
|
||||
ProcessHandle,
|
||||
PROCESS_VM_OPERATION,
|
||||
PsProcessType,
|
||||
UserMode,
|
||||
(PVOID *) & Process,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
Status = MmFreeMemoryArea(
|
||||
Process,
|
||||
BaseAddress,
|
||||
0,
|
||||
TRUE
|
||||
);
|
||||
ObDereferenceObject(Process);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
@ -395,3 +488,6 @@ NtExtendSection (
|
|||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.15 1999/08/17 12:01:38 ekohl Exp $
|
||||
; $Id: ntoskrnl.def,v 1.16 1999/08/29 06:59:05 ea Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -104,7 +104,7 @@ IoConnectInterrupt
|
|||
IoCreateController
|
||||
IoCreateDevice
|
||||
IoCreateStreamFileObject
|
||||
IoCreateSymbolicLink
|
||||
IoCreateSymbolicLink@8
|
||||
IoDeleteController
|
||||
IoDeleteDevice
|
||||
IoDisconnectInterrupt
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.3 1999/08/17 12:01:39 ekohl Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.4 1999/08/29 06:59:05 ea Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -104,7 +104,7 @@ IoConnectInterrupt
|
|||
IoCreateController
|
||||
IoCreateDevice
|
||||
IoCreateStreamFileObject
|
||||
IoCreateSymbolicLink
|
||||
IoCreateSymbolicLink=IoCreateSymbolicLink@8
|
||||
IoDeleteController
|
||||
IoDeleteDevice
|
||||
IoDisconnectInterrupt
|
||||
|
@ -129,7 +129,7 @@ NtAllocateUuids=NtAllocateUuids@12
|
|||
NtAllocateVirtualMemory=NtAllocateVirtualMemory@24
|
||||
;NtBuildNumber <--- variable?
|
||||
NtClose=NtClose@4
|
||||
;NtConnectPort=;NtConnectPort@32
|
||||
;NtConnectPort@32
|
||||
NtConnectPort=NtConnectPort@8
|
||||
NtCreateEvent=NtCreateEvent@20
|
||||
NtCreateFile=NtCreateFile@44
|
||||
|
@ -155,13 +155,13 @@ NtQueryEaFile=NtQueryEaFile@36
|
|||
NtQueryInformationFile=NtQueryInformationFile@20
|
||||
NtQueryInformationProcess=NtQueryInformationProcess@20
|
||||
NtQueryInformationToken=NtQueryInformationToken@20
|
||||
;NtQueryOleDirectoryFile=;NtQueryOleDirectoryFile@ <--- ?
|
||||
;NtQueryOleDirectoryFile@ <--- ?
|
||||
NtQuerySecurityObject=NtQuerySecurityObject@20
|
||||
NtQueryVolumeInformationFile=NtQueryVolumeInformationFile@20
|
||||
NtReadFile=NtReadFile@36
|
||||
;NtRequestPort=;NtRequestPort@8
|
||||
;NtRequestPort@8
|
||||
NtRequestPort=NtRequestPort@20
|
||||
;NtRequestWaitReplyPort=;NtRequestWaitReplyPort@8
|
||||
;NtRequestWaitReplyPort@8
|
||||
NtRequestWaitReplyPort=NtRequestWaitReplyPort@0
|
||||
NtSetEvent=NtSetEvent@8
|
||||
NtSetInformationFile=NtSetInformationFile@20
|
||||
|
@ -169,7 +169,7 @@ NtSetInformationProcess=NtSetInformationProcess@16
|
|||
NtSetInformationThread=NtSetInformationThread@16
|
||||
NtSetSecurityObject=NtSetSecurityObject@12
|
||||
NtUnlockFile=NtUnlockFile@20
|
||||
;NtVdmControl=;NtVdmControl@8 <--- ?
|
||||
;NtVdmControl@8 <--- ?
|
||||
NtWaitForSingleObject=NtWaitForSingleObject@12
|
||||
NtWriteFile=NtWriteFile@36
|
||||
RtlAnsiStringToUnicodeString
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: dirobj.c,v 1.5 1999/08/29 06:59:10 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ob/dirobj.c
|
||||
|
@ -22,50 +23,107 @@
|
|||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtOpenDirectoryObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Opens a namespace directory object.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* DirectoryHandle (OUT)
|
||||
* Variable which receives the directory handle.
|
||||
*
|
||||
* DesiredAccess
|
||||
* Desired access to the directory.
|
||||
*
|
||||
* ObjectAttributes
|
||||
* Structure describing the directory.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*
|
||||
* NOTES
|
||||
* Undocumented.
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtOpenDirectoryObject (
|
||||
PHANDLE DirectoryHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Opens a namespace directory object
|
||||
* ARGUMENTS:
|
||||
* DirectoryHandle (OUT) = Variable which receives the directory handle
|
||||
* DesiredAccess = Desired access to the directory
|
||||
* ObjectAttributes = Structure describing the directory
|
||||
* RETURNS: Status
|
||||
* NOTES: Undocumented
|
||||
*/
|
||||
{
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
|
||||
*DirectoryHandle = 0;
|
||||
*DirectoryHandle = 0;
|
||||
|
||||
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
ObDirectoryType,
|
||||
UserMode,
|
||||
NULL,
|
||||
&Object);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = ObReferenceObjectByName(
|
||||
ObjectAttributes->ObjectName,
|
||||
ObjectAttributes->Attributes,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
ObDirectoryType,
|
||||
UserMode,
|
||||
NULL,
|
||||
& Object
|
||||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = ObCreateHandle(PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
FALSE,
|
||||
DirectoryHandle);
|
||||
return(STATUS_SUCCESS);
|
||||
Status = ObCreateHandle(
|
||||
PsGetCurrentProcess(),
|
||||
Object,
|
||||
DesiredAccess,
|
||||
FALSE,
|
||||
DirectoryHandle
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtQueryDirectoryObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Reads information from a namespace directory.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* DirObjInformation (OUT)
|
||||
* Buffer to hold the data read.
|
||||
*
|
||||
* BufferLength
|
||||
* Size of the buffer in bytes.
|
||||
*
|
||||
* GetNextIndex
|
||||
* If TRUE then set ObjectIndex to the index of the
|
||||
* next object.
|
||||
* If FALSE then set ObjectIndex to the number of
|
||||
* objects in the directory.
|
||||
*
|
||||
* IgnoreInputIndex
|
||||
* If TRUE start reading at index 0.
|
||||
* If FALSE start reading at the index specified
|
||||
* by object index.
|
||||
*
|
||||
* ObjectIndex
|
||||
* Zero based index into the directory, interpretation
|
||||
* depends on IgnoreInputIndex and GetNextIndex.
|
||||
*
|
||||
* DataWritten (OUT)
|
||||
* Caller supplied storage for the number of bytes
|
||||
* written (or NULL).
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQueryDirectoryObject (
|
||||
IN HANDLE DirObjHandle,
|
||||
OUT POBJDIR_INFORMATION DirObjInformation,
|
||||
|
@ -75,114 +133,149 @@ NtQueryDirectoryObject (
|
|||
IN OUT PULONG ObjectIndex,
|
||||
OUT PULONG DataWritten OPTIONAL
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Reads information from a namespace directory
|
||||
* ARGUMENTS:
|
||||
* DirObjInformation (OUT) = Buffer to hold the data read
|
||||
* BufferLength = Size of the buffer in bytes
|
||||
* GetNextIndex = If TRUE then set ObjectIndex to the index of the
|
||||
* next object
|
||||
* If FALSE then set ObjectIndex to the number of
|
||||
* objects in the directory
|
||||
* IgnoreInputIndex = If TRUE start reading at index 0
|
||||
* If FALSE start reading at the index specified
|
||||
* by object index
|
||||
* ObjectIndex = Zero based index into the directory, interpretation
|
||||
* depends on IgnoreInputIndex and GetNextIndex
|
||||
* DataWritten (OUT) = Caller supplied storage for the number of bytes
|
||||
* written (or NULL)
|
||||
* RETURNS: Status
|
||||
*/
|
||||
{
|
||||
PDIRECTORY_OBJECT dir = NULL;
|
||||
ULONG EntriesToRead;
|
||||
PLIST_ENTRY current_entry;
|
||||
POBJECT_HEADER current;
|
||||
ULONG i=0;
|
||||
ULONG EntriesToSkip;
|
||||
NTSTATUS Status;
|
||||
PDIRECTORY_OBJECT dir = NULL;
|
||||
ULONG EntriesToRead;
|
||||
PLIST_ENTRY current_entry;
|
||||
POBJECT_HEADER current;
|
||||
ULONG i=0;
|
||||
ULONG EntriesToSkip;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
DPRINT(
|
||||
"NtQueryDirectoryObject(DirObjHandle %x)\n",
|
||||
DirObjHandle
|
||||
);
|
||||
DPRINT(
|
||||
"dir %x namespc_root %x\n",
|
||||
dir,
|
||||
HEADER_TO_BODY(&(namespc_root.hdr))
|
||||
);
|
||||
|
||||
DPRINT("NtQueryDirectoryObject(DirObjHandle %x)\n",DirObjHandle);
|
||||
DPRINT("dir %x namespc_root %x\n",dir,HEADER_TO_BODY(&(namespc_root.hdr)));
|
||||
// assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
// assert_irql(PASSIVE_LEVEL);
|
||||
Status = ObReferenceObjectByHandle(
|
||||
DirObjHandle,
|
||||
DIRECTORY_QUERY,
|
||||
ObDirectoryType,
|
||||
UserMode,
|
||||
(PVOID *) & dir,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
EntriesToRead = BufferLength / sizeof (OBJDIR_INFORMATION);
|
||||
*DataWritten = 0;
|
||||
|
||||
Status = ObReferenceObjectByHandle(DirObjHandle,
|
||||
DIRECTORY_QUERY,
|
||||
ObDirectoryType,
|
||||
UserMode,
|
||||
(PVOID*)&dir,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
DPRINT("EntriesToRead %d\n",EntriesToRead);
|
||||
|
||||
EntriesToRead = BufferLength / sizeof(OBJDIR_INFORMATION);
|
||||
*DataWritten = 0;
|
||||
current_entry = dir->head.Flink;
|
||||
|
||||
DPRINT("EntriesToRead %d\n",EntriesToRead);
|
||||
|
||||
current_entry = dir->head.Flink;
|
||||
|
||||
/*
|
||||
* Optionally, skip over some entries at the start of the directory
|
||||
*/
|
||||
if (!IgnoreInputIndex)
|
||||
{
|
||||
CHECKPOINT;
|
||||
/*
|
||||
* Optionally, skip over some entries at the start of the directory
|
||||
*/
|
||||
if (!IgnoreInputIndex)
|
||||
{
|
||||
CHECKPOINT;
|
||||
|
||||
EntriesToSkip = *ObjectIndex;
|
||||
while ( i<EntriesToSkip && current_entry!=NULL)
|
||||
{
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
}
|
||||
EntriesToSkip = *ObjectIndex;
|
||||
while ( (i < EntriesToSkip) && (current_entry != NULL))
|
||||
{
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("DirObjInformation %x\n",DirObjInformation);
|
||||
DPRINT("DirObjInformation %x\n",DirObjInformation);
|
||||
|
||||
/*
|
||||
* Read the maximum entries possible into the buffer
|
||||
*/
|
||||
while ( i<EntriesToRead && current_entry!=(&(dir->head)))
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,OBJECT_HEADER,Entry);
|
||||
DPRINT("Scanning %w\n",current->Name.Buffer);
|
||||
DirObjInformation[i].ObjectName.Buffer =
|
||||
ExAllocatePool(NonPagedPool,(current->Name.Length+1)*2);
|
||||
DirObjInformation[i].ObjectName.Length = current->Name.Length;
|
||||
DirObjInformation[i].ObjectName.MaximumLength = current->Name.Length;
|
||||
DPRINT("DirObjInformation[i].ObjectName.Buffer %x\n",
|
||||
DirObjInformation[i].ObjectName.Buffer);
|
||||
RtlCopyUnicodeString(&DirObjInformation[i].ObjectName,
|
||||
&(current->Name));
|
||||
i++;
|
||||
current_entry = current_entry->Flink;
|
||||
(*DataWritten) = (*DataWritten) + sizeof(OBJDIR_INFORMATION);
|
||||
/*
|
||||
* Read the maximum entries possible into the buffer
|
||||
*/
|
||||
while ( (i < EntriesToRead) && (current_entry != (&(dir->head))))
|
||||
{
|
||||
current = CONTAINING_RECORD(
|
||||
current_entry,
|
||||
OBJECT_HEADER,
|
||||
Entry
|
||||
);
|
||||
DPRINT(
|
||||
"Scanning %w\n",
|
||||
current->Name.Buffer
|
||||
);
|
||||
|
||||
DirObjInformation[i].ObjectName.Buffer =
|
||||
ExAllocatePool(
|
||||
NonPagedPool,
|
||||
(current->Name.Length + 1) * 2
|
||||
);
|
||||
DirObjInformation[i].ObjectName.Length =
|
||||
current->Name.Length;
|
||||
DirObjInformation[i].ObjectName.MaximumLength =
|
||||
current->Name.Length;
|
||||
|
||||
DPRINT(
|
||||
"DirObjInformation[i].ObjectName.Buffer %x\n",
|
||||
DirObjInformation[i].ObjectName.Buffer
|
||||
);
|
||||
|
||||
RtlCopyUnicodeString(
|
||||
& DirObjInformation[i].ObjectName,
|
||||
& (current->Name)
|
||||
);
|
||||
i++;
|
||||
current_entry = current_entry->Flink;
|
||||
(*DataWritten) = (*DataWritten) + sizeof (OBJDIR_INFORMATION);
|
||||
|
||||
CHECKPOINT;
|
||||
}
|
||||
CHECKPOINT;
|
||||
}
|
||||
CHECKPOINT;
|
||||
|
||||
/*
|
||||
* Optionally, count the number of entries in the directory
|
||||
*/
|
||||
if (GetNextIndex)
|
||||
{
|
||||
*ObjectIndex=i;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( current_entry!=(&(dir->head)) )
|
||||
{
|
||||
current_entry=current_entry->Flink;
|
||||
i++;
|
||||
}
|
||||
*ObjectIndex=i;
|
||||
}
|
||||
return(STATUS_SUCCESS);
|
||||
/*
|
||||
* Optionally, count the number of entries in the directory
|
||||
*/
|
||||
if (GetNextIndex)
|
||||
{
|
||||
*ObjectIndex = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( current_entry != (&(dir->head)) )
|
||||
{
|
||||
current_entry = current_entry->Flink;
|
||||
i++;
|
||||
}
|
||||
*ObjectIndex = i;
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME (EXPORTED as Zw)
|
||||
* NtCreateDirectoryObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Creates or opens a directory object (a container for other
|
||||
* objects).
|
||||
*
|
||||
* ARGUMENTS
|
||||
* DirectoryHandle (OUT)
|
||||
* Caller supplied storage for the handle of the
|
||||
* directory.
|
||||
*
|
||||
* DesiredAccess
|
||||
* Access desired to the directory.
|
||||
*
|
||||
* ObjectAttributes
|
||||
* Object attributes initialized with
|
||||
* InitializeObjectAttributes.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCreateDirectoryObject (
|
||||
|
@ -190,56 +283,77 @@ NtCreateDirectoryObject (
|
|||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes
|
||||
)
|
||||
/*
|
||||
* FUNCTION: Creates or opens a directory object (a container for other
|
||||
* objects)
|
||||
* ARGUMENTS:
|
||||
* DirectoryHandle (OUT) = Caller supplied storage for the handle
|
||||
* of the directory
|
||||
* DesiredAccess = Access desired to the directory
|
||||
* ObjectAttributes = Object attributes initialized with
|
||||
* InitializeObjectAttributes
|
||||
* RETURNS: Status
|
||||
*/
|
||||
{
|
||||
PDIRECTORY_OBJECT dir;
|
||||
PDIRECTORY_OBJECT dir;
|
||||
|
||||
dir = ObCreateObject(DirectoryHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
ObDirectoryType);
|
||||
return(STATUS_SUCCESS);
|
||||
dir = ObCreateObject(
|
||||
DirectoryHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
ObDirectoryType
|
||||
);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID InitializeObjectAttributes(POBJECT_ATTRIBUTES InitializedAttributes,
|
||||
PUNICODE_STRING ObjectName,
|
||||
ULONG Attributes,
|
||||
HANDLE RootDirectory,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||
/*
|
||||
* FUNCTION: Sets up a parameter of type OBJECT_ATTRIBUTES for a
|
||||
* subsequent call to ZwCreateXXX or ZwOpenXXX
|
||||
* ARGUMENTS:
|
||||
* InitializedAttributes (OUT) = Caller supplied storage for the
|
||||
* object attributes
|
||||
* ObjectName = Full path name for object
|
||||
* Attributes = Attributes for the object
|
||||
* RootDirectory = Where the object should be placed or NULL
|
||||
* SecurityDescriptor = Ignored
|
||||
|
||||
/**********************************************************************
|
||||
* NAME (MACRO in DDK)
|
||||
* InitializeObjectAttributes
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Sets up a parameter of type OBJECT_ATTRIBUTES for a
|
||||
* subsequent call to ZwCreateXXX or ZwOpenXXX.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* InitializedAttributes (OUT)
|
||||
* Caller supplied storage for the object attributes.
|
||||
*
|
||||
* ObjectName
|
||||
* Full path name for object.
|
||||
*
|
||||
* Attributes
|
||||
* Attributes for the object.
|
||||
*
|
||||
* RootDirectory
|
||||
* Where the object should be placed or NULL.
|
||||
*
|
||||
* SecurityDescriptor
|
||||
* Ignored.
|
||||
*
|
||||
* NOTE:
|
||||
* Either ObjectName is a fully qualified pathname or a path relative
|
||||
* to RootDirectory
|
||||
* NOTE
|
||||
* Either ObjectName is a fully qualified pathname or a path
|
||||
* relative to RootDirectory.
|
||||
*/
|
||||
VOID
|
||||
InitializeObjectAttributes (
|
||||
POBJECT_ATTRIBUTES InitializedAttributes,
|
||||
PUNICODE_STRING ObjectName,
|
||||
ULONG Attributes,
|
||||
HANDLE RootDirectory,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor
|
||||
)
|
||||
{
|
||||
DPRINT("InitializeObjectAttributes(InitializedAttributes %x "
|
||||
"ObjectName %x Attributes %x RootDirectory %x)\n",
|
||||
InitializedAttributes,ObjectName,Attributes,RootDirectory);
|
||||
InitializedAttributes->Length=sizeof(OBJECT_ATTRIBUTES);
|
||||
InitializedAttributes->RootDirectory=RootDirectory;
|
||||
InitializedAttributes->ObjectName=ObjectName;
|
||||
InitializedAttributes->Attributes=Attributes;
|
||||
InitializedAttributes->SecurityDescriptor=SecurityDescriptor;
|
||||
InitializedAttributes->SecurityQualityOfService=NULL;
|
||||
DPRINT(
|
||||
"InitializeObjectAttributes(InitializedAttributes %x "
|
||||
"ObjectName %x Attributes %x RootDirectory %x)\n",
|
||||
InitializedAttributes,
|
||||
ObjectName,
|
||||
Attributes,
|
||||
RootDirectory
|
||||
);
|
||||
InitializedAttributes->Length =
|
||||
sizeof (OBJECT_ATTRIBUTES);
|
||||
InitializedAttributes->RootDirectory =
|
||||
RootDirectory;
|
||||
InitializedAttributes->ObjectName =
|
||||
ObjectName;
|
||||
InitializedAttributes->Attributes =
|
||||
Attributes;
|
||||
InitializedAttributes->SecurityDescriptor =
|
||||
SecurityDescriptor;
|
||||
InitializedAttributes->SecurityQualityOfService =
|
||||
NULL;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: handle.c,v 1.11 1999/08/29 06:59:11 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ob/handle.c
|
||||
|
@ -35,7 +36,10 @@ typedef struct
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
static PHANDLE_REP ObpGetObjectByHandle(PEPROCESS Process,
|
||||
|
||||
static
|
||||
PHANDLE_REP
|
||||
ObpGetObjectByHandle(PEPROCESS Process,
|
||||
HANDLE h)
|
||||
/*
|
||||
* FUNCTION: Get the data structure for a handle
|
||||
|
@ -70,6 +74,7 @@ static PHANDLE_REP ObpGetObjectByHandle(PEPROCESS Process,
|
|||
return(&(blk->handles[handle%HANDLE_BLOCK_ENTRIES]));
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtDuplicateObject (
|
||||
|
@ -150,7 +155,9 @@ NtDuplicateObject (
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID ObDeleteHandleTable(PEPROCESS Process)
|
||||
|
||||
VOID
|
||||
ObDeleteHandleTable(PEPROCESS Process)
|
||||
/*
|
||||
* FUNCTION: Deletes the handle table associated with a process
|
||||
*/
|
||||
|
@ -185,7 +192,9 @@ VOID ObDeleteHandleTable(PEPROCESS Process)
|
|||
}
|
||||
}
|
||||
|
||||
VOID ObCreateHandleTable(PEPROCESS Parent,
|
||||
|
||||
VOID
|
||||
ObCreateHandleTable(PEPROCESS Parent,
|
||||
BOOLEAN Inherit,
|
||||
PEPROCESS Process)
|
||||
/*
|
||||
|
@ -207,7 +216,9 @@ VOID ObCreateHandleTable(PEPROCESS Parent,
|
|||
}
|
||||
}
|
||||
|
||||
VOID ObDeleteHandle(HANDLE Handle)
|
||||
|
||||
VOID
|
||||
ObDeleteHandle(HANDLE Handle)
|
||||
{
|
||||
PHANDLE_REP Rep;
|
||||
|
||||
|
@ -218,7 +229,9 @@ VOID ObDeleteHandle(HANDLE Handle)
|
|||
DPRINT("Finished ObDeleteHandle()\n");
|
||||
}
|
||||
|
||||
NTSTATUS ObCreateHandle(PEPROCESS Process,
|
||||
|
||||
NTSTATUS
|
||||
ObCreateHandle(PEPROCESS Process,
|
||||
PVOID ObjectBody,
|
||||
ACCESS_MASK GrantedAccess,
|
||||
BOOLEAN Inherit,
|
||||
|
@ -289,7 +302,8 @@ NTSTATUS ObCreateHandle(PEPROCESS Process,
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS ObReferenceObjectByHandle(HANDLE Handle,
|
||||
NTSTATUS
|
||||
ObReferenceObjectByHandle(HANDLE Handle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
|
@ -378,46 +392,66 @@ NTSTATUS ObReferenceObjectByHandle(HANDLE Handle,
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS NtClose(HANDLE Handle)
|
||||
/*
|
||||
* FUNCTION: Closes a handle reference to an object
|
||||
* ARGUMENTS:
|
||||
* Handle = handle to close
|
||||
* RETURNS: Status
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtClose
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Closes a handle reference to an object.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* Handle
|
||||
* Handle to close.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* Status.
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtClose(HANDLE Handle)
|
||||
{
|
||||
PVOID ObjectBody;
|
||||
POBJECT_HEADER Header;
|
||||
PHANDLE_REP HandleRep;
|
||||
PVOID ObjectBody;
|
||||
POBJECT_HEADER Header;
|
||||
PHANDLE_REP HandleRep;
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
DPRINT("NtClose(Handle %x)\n",Handle);
|
||||
DPRINT("NtClose(Handle %x)\n",Handle);
|
||||
|
||||
HandleRep = ObpGetObjectByHandle(PsGetCurrentProcess(),
|
||||
Handle);
|
||||
if (HandleRep == NULL)
|
||||
{
|
||||
return(STATUS_INVALID_HANDLE);
|
||||
}
|
||||
ObjectBody = HandleRep->ObjectBody;
|
||||
HandleRep = ObpGetObjectByHandle(
|
||||
PsGetCurrentProcess(),
|
||||
Handle
|
||||
);
|
||||
if (HandleRep == NULL)
|
||||
{
|
||||
return STATUS_INVALID_HANDLE;
|
||||
}
|
||||
ObjectBody = HandleRep->ObjectBody;
|
||||
|
||||
HandleRep->ObjectBody = NULL;
|
||||
HandleRep->ObjectBody = NULL;
|
||||
|
||||
Header = BODY_TO_HEADER(ObjectBody);
|
||||
Header = BODY_TO_HEADER(ObjectBody);
|
||||
|
||||
Header->RefCount++;
|
||||
Header->HandleCount--;
|
||||
Header->RefCount++;
|
||||
Header->HandleCount--;
|
||||
|
||||
if (Header->ObjectType != NULL &&
|
||||
Header->ObjectType->Close != NULL)
|
||||
{
|
||||
Header->ObjectType->Close(ObjectBody, Header->HandleCount);
|
||||
}
|
||||
if ( (Header->ObjectType != NULL)
|
||||
&& (Header->ObjectType->Close != NULL)
|
||||
)
|
||||
{
|
||||
Header->ObjectType->Close(
|
||||
ObjectBody,
|
||||
Header->HandleCount
|
||||
);
|
||||
}
|
||||
|
||||
Header->RefCount--;
|
||||
Header->RefCount--;
|
||||
|
||||
ObPerformRetentionChecks(Header);
|
||||
ObPerformRetentionChecks(Header);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: ntobj.c,v 1.5 1999/08/29 06:59:11 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ob/ntobj.c
|
||||
|
@ -47,39 +48,60 @@ NtQueryObject (
|
|||
}
|
||||
|
||||
|
||||
VOID ObMakeTemporaryObject(PVOID ObjectBody)
|
||||
VOID
|
||||
ObMakeTemporaryObject (
|
||||
PVOID ObjectBody
|
||||
)
|
||||
{
|
||||
POBJECT_HEADER ObjectHeader;
|
||||
POBJECT_HEADER ObjectHeader;
|
||||
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
ObjectHeader->Permanent = FALSE;
|
||||
ObjectHeader = BODY_TO_HEADER(ObjectBody);
|
||||
ObjectHeader->Permanent = FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* NtMakeTemporaryObject
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* REVISIONS
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtMakeTemporaryObject (
|
||||
HANDLE Handle
|
||||
)
|
||||
{
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
POBJECT_HEADER ObjectHeader;
|
||||
PVOID Object;
|
||||
NTSTATUS Status;
|
||||
POBJECT_HEADER ObjectHeader;
|
||||
|
||||
Status = ObReferenceObjectByHandle(Handle,
|
||||
0,
|
||||
NULL,
|
||||
KernelMode,
|
||||
&Object,
|
||||
NULL);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return(Status);
|
||||
}
|
||||
Status = ObReferenceObjectByHandle(
|
||||
Handle,
|
||||
0,
|
||||
NULL,
|
||||
KernelMode,
|
||||
& Object,
|
||||
NULL
|
||||
);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
ObjectHeader = BODY_TO_HEADER(Object);
|
||||
ObjectHeader->Permanent = FALSE;
|
||||
ObjectHeader = BODY_TO_HEADER(Object);
|
||||
ObjectHeader->Permanent = FALSE;
|
||||
|
||||
ObDereferenceObject(Object);
|
||||
ObDereferenceObject(Object);
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: thread.c,v 1.25 1999/08/29 06:59:11 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ps/thread.c
|
||||
|
@ -117,100 +118,129 @@ VOID PsBeginThread(PKSTART_ROUTINE StartRoutine, PVOID StartContext)
|
|||
KeBugCheck(0);
|
||||
}
|
||||
|
||||
static PETHREAD PsScanThreadList(KPRIORITY Priority)
|
||||
static
|
||||
PETHREAD
|
||||
PsScanThreadList (
|
||||
KPRIORITY Priority
|
||||
)
|
||||
{
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
PETHREAD oldest = NULL;
|
||||
ULONG oldest_time = 0;
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
PETHREAD oldest = NULL;
|
||||
ULONG oldest_time = 0;
|
||||
|
||||
// DPRINT("PsScanThreadList(Priority %d)\n",Priority);
|
||||
// DPRINT("PsScanThreadList(Priority %d)\n",Priority);
|
||||
|
||||
current_entry = PriorityListHead[THREAD_PRIORITY_MAX+Priority].Flink;
|
||||
while (current_entry != &PriorityListHead[THREAD_PRIORITY_MAX+Priority])
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,ETHREAD,Tcb.Entry);
|
||||
current_entry =
|
||||
PriorityListHead[THREAD_PRIORITY_MAX + Priority].Flink;
|
||||
|
||||
if (current->Tcb.State == THREAD_STATE_TERMINATED &&
|
||||
current != CurrentThread)
|
||||
{
|
||||
PsReleaseThread(current);
|
||||
}
|
||||
while (current_entry != &PriorityListHead[THREAD_PRIORITY_MAX+Priority])
|
||||
{
|
||||
current = CONTAINING_RECORD(
|
||||
current_entry,
|
||||
ETHREAD,
|
||||
Tcb.Entry
|
||||
);
|
||||
|
||||
if (current->Tcb.State == THREAD_STATE_RUNNABLE)
|
||||
{
|
||||
if (oldest == NULL || oldest_time > current->Tcb.LastTick)
|
||||
{
|
||||
oldest = current;
|
||||
oldest_time = current->Tcb.LastTick;
|
||||
}
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
// DPRINT("PsScanThreadList() = %x\n",oldest);
|
||||
return(oldest);
|
||||
if ( (current->Tcb.State == THREAD_STATE_TERMINATED)
|
||||
&& (current != CurrentThread)
|
||||
)
|
||||
{
|
||||
PsReleaseThread(current);
|
||||
}
|
||||
|
||||
if (current->Tcb.State == THREAD_STATE_RUNNABLE)
|
||||
{
|
||||
if ( (oldest == NULL)
|
||||
|| (oldest_time > current->Tcb.LastTick)
|
||||
)
|
||||
{
|
||||
oldest = current;
|
||||
oldest_time = current->Tcb.LastTick;
|
||||
}
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
// DPRINT("PsScanThreadList() = %x\n",oldest);
|
||||
return oldest;
|
||||
}
|
||||
|
||||
VOID PsDispatchThread(VOID)
|
||||
|
||||
VOID
|
||||
PsDispatchThread (VOID)
|
||||
{
|
||||
KPRIORITY CurrentPriority;
|
||||
PETHREAD Candidate;
|
||||
KIRQL irql;
|
||||
LARGE_INTEGER TickCount;
|
||||
KPRIORITY CurrentPriority;
|
||||
PETHREAD Candidate;
|
||||
KIRQL irql;
|
||||
LARGE_INTEGER TickCount;
|
||||
|
||||
if (!DoneInitYet)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DoneInitYet)
|
||||
{
|
||||
return;
|
||||
}
|
||||
KeAcquireSpinLock(
|
||||
& ThreadListLock,
|
||||
& irql
|
||||
);
|
||||
|
||||
KeAcquireSpinLock(&ThreadListLock, &irql);
|
||||
|
||||
DPRINT("PsDispatchThread() Current %x\n",CurrentThread);
|
||||
DPRINT("PsDispatchThread() Current %x\n",CurrentThread);
|
||||
|
||||
if (CurrentThread->Tcb.State==THREAD_STATE_RUNNING)
|
||||
{
|
||||
CurrentThread->Tcb.State=THREAD_STATE_RUNNABLE;
|
||||
}
|
||||
if (CurrentThread->Tcb.State == THREAD_STATE_RUNNING)
|
||||
{
|
||||
CurrentThread->Tcb.State = THREAD_STATE_RUNNABLE;
|
||||
}
|
||||
|
||||
for (CurrentPriority=THREAD_PRIORITY_TIME_CRITICAL;
|
||||
CurrentPriority>=THREAD_PRIORITY_IDLE;
|
||||
CurrentPriority--)
|
||||
{
|
||||
Candidate = PsScanThreadList(CurrentPriority);
|
||||
if (Candidate == CurrentThread)
|
||||
{
|
||||
DPRINT("Scheduling current thread\n");
|
||||
KeQueryTickCount(&TickCount);
|
||||
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||
CurrentThread->Tcb.State = THREAD_STATE_RUNNING;
|
||||
KeReleaseSpinLock(&ThreadListLock,irql);
|
||||
return;
|
||||
}
|
||||
if (Candidate != NULL)
|
||||
{
|
||||
DPRINT("Scheduling %x\n",Candidate);
|
||||
for ( CurrentPriority = THREAD_PRIORITY_TIME_CRITICAL;
|
||||
(CurrentPriority >= THREAD_PRIORITY_IDLE);
|
||||
CurrentPriority--
|
||||
)
|
||||
{
|
||||
Candidate = PsScanThreadList(CurrentPriority);
|
||||
if (Candidate == CurrentThread)
|
||||
{
|
||||
DPRINT("Scheduling current thread\n");
|
||||
KeQueryTickCount(&TickCount);
|
||||
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||
CurrentThread->Tcb.State = THREAD_STATE_RUNNING;
|
||||
KeReleaseSpinLock(
|
||||
& ThreadListLock,
|
||||
irql
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (Candidate != NULL)
|
||||
{
|
||||
DPRINT("Scheduling %x\n",Candidate);
|
||||
|
||||
Candidate->Tcb.State = THREAD_STATE_RUNNING;
|
||||
|
||||
Candidate->Tcb.State = THREAD_STATE_RUNNING;
|
||||
KeQueryTickCount(&TickCount);
|
||||
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||
|
||||
KeQueryTickCount(&TickCount);
|
||||
CurrentThread->Tcb.LastTick = TickCount.u.LowPart;
|
||||
CurrentThread = Candidate;
|
||||
|
||||
CurrentThread = Candidate;
|
||||
|
||||
HalTaskSwitch(&CurrentThread->Tcb);
|
||||
KeReleaseSpinLock(&ThreadListLock, irql);
|
||||
return;
|
||||
}
|
||||
}
|
||||
DbgPrint("CRITICAL: No threads are runnable\n");
|
||||
KeBugCheck(0);
|
||||
HalTaskSwitch(&CurrentThread->Tcb);
|
||||
KeReleaseSpinLock(
|
||||
& ThreadListLock,
|
||||
irql
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
DbgPrint("CRITICAL: No threads are runnable\n");
|
||||
KeBugCheck(0);
|
||||
}
|
||||
|
||||
NTSTATUS PsInitializeThread(HANDLE ProcessHandle,
|
||||
PETHREAD* ThreadPtr,
|
||||
PHANDLE ThreadHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ThreadAttributes)
|
||||
|
||||
NTSTATUS
|
||||
PsInitializeThread (
|
||||
HANDLE ProcessHandle,
|
||||
PETHREAD * ThreadPtr,
|
||||
PHANDLE ThreadHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ThreadAttributes
|
||||
)
|
||||
{
|
||||
PETHREAD Thread;
|
||||
NTSTATUS Status;
|
||||
|
@ -273,7 +303,9 @@ NTSTATUS PsInitializeThread(HANDLE ProcessHandle,
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
VOID PsResumeThread(PETHREAD Thread)
|
||||
|
||||
VOID
|
||||
PsResumeThread(PETHREAD Thread)
|
||||
{
|
||||
DPRINT("PsResumeThread(Thread %x)\n",Thread);
|
||||
Thread->Tcb.SuspendCount--;
|
||||
|
@ -286,7 +318,9 @@ VOID PsResumeThread(PETHREAD Thread)
|
|||
DPRINT("Finished PsResumeThread()\n");
|
||||
}
|
||||
|
||||
VOID PsSuspendThread(PETHREAD Thread)
|
||||
|
||||
VOID
|
||||
PsSuspendThread(PETHREAD Thread)
|
||||
{
|
||||
DPRINT("PsSuspendThread(Thread %x)\n",Thread);
|
||||
Thread->Tcb.SuspendCount++;
|
||||
|
@ -300,12 +334,16 @@ VOID PsSuspendThread(PETHREAD Thread)
|
|||
}
|
||||
}
|
||||
|
||||
VOID PiDeleteThread(PVOID ObjectBody)
|
||||
|
||||
VOID
|
||||
PiDeleteThread(PVOID ObjectBody)
|
||||
{
|
||||
DbgPrint("PiDeleteThread(ObjectBody %x)\n",ObjectBody);
|
||||
}
|
||||
|
||||
VOID PsInitThreadManagment(VOID)
|
||||
|
||||
VOID
|
||||
PsInitThreadManagment(VOID)
|
||||
/*
|
||||
* FUNCTION: Initialize thread managment
|
||||
*/
|
||||
|
@ -354,7 +392,9 @@ VOID PsInitThreadManagment(VOID)
|
|||
DoneInitYet = TRUE;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCreateThread (
|
||||
PHANDLE ThreadHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
|
@ -400,7 +440,9 @@ NtCreateThread (
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle,
|
||||
|
||||
NTSTATUS
|
||||
PsCreateSystemThread(PHANDLE ThreadHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
HANDLE ProcessHandle,
|
||||
|
@ -454,12 +496,16 @@ NTSTATUS PsCreateSystemThread(PHANDLE ThreadHandle,
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
LONG KeSetBasePriorityThread(PKTHREAD Thread, LONG Increment)
|
||||
|
||||
LONG
|
||||
KeSetBasePriorityThread(PKTHREAD Thread, LONG Increment)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
KPRIORITY KeSetPriorityThread(PKTHREAD Thread, KPRIORITY Priority)
|
||||
|
||||
KPRIORITY
|
||||
KeSetPriorityThread(PKTHREAD Thread, KPRIORITY Priority)
|
||||
{
|
||||
KPRIORITY OldPriority;
|
||||
OldPriority = Thread->BasePriority;
|
||||
|
@ -638,3 +684,6 @@ NtYieldExecution(VOID)
|
|||
PsDispatchThread();
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,58 +1,210 @@
|
|||
/* $Id: interlck.c,v 1.3 1999/08/29 06:59:11 ea Exp $
|
||||
*
|
||||
* reactos/ntoskrnl/rtl/interlck.c
|
||||
*
|
||||
* FIXME: change decorated names when __fastcall will be available
|
||||
* (for both egcs 1.1.2 and gcc 2.95 FASTCALL == STDCALL).
|
||||
*/
|
||||
#include <reactos/config.h>
|
||||
#include <ntos.h>
|
||||
#include <internal/debug.h>
|
||||
|
||||
void InterlockedIncrement(void);
|
||||
__asm__("\n\t.global _InterlockedIncrement\n\t"
|
||||
"_InterlockedIncrement:\n\t"
|
||||
"pushl %ebp\n\t"
|
||||
"movl %esp,%ebp\n\t"
|
||||
"pushl %ebx\n\t"
|
||||
"movl $1,%eax\n\t"
|
||||
"movl 8(%ebp),%ebx\n\t"
|
||||
"xaddl %eax,(%ebx)\n\t"
|
||||
"popl %ebx\n\t"
|
||||
"movl %ebp,%esp\n\t"
|
||||
"popl %ebp\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedIncrement@0
|
||||
* STDCALL : _InterlockedIncrement@4
|
||||
*/
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedIncrement (
|
||||
PLONG Addend
|
||||
);
|
||||
__asm__(
|
||||
"\n\t.global _InterlockedIncrement@4\n\t"
|
||||
"_InterlockedIncrement@4:\n\t"
|
||||
"pushl %ebp\n\t"
|
||||
"movl %esp,%ebp\n\t"
|
||||
"pushl %ebx\n\t"
|
||||
"movl $1,%eax\n\t"
|
||||
"movl 8(%ebp),%ebx\n\t"
|
||||
"xaddl %eax,(%ebx)\n\t"
|
||||
"popl %ebx\n\t"
|
||||
"movl %ebp,%esp\n\t"
|
||||
"popl %ebp\n\t"
|
||||
"ret $4\n\t"
|
||||
);
|
||||
/*
|
||||
__asm__(
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
".global _InterlockedIncrement@4\n"
|
||||
"\t_InterlockedIncrement@4:\n"
|
||||
"\tmovl 4(%esp), %ecx\n"
|
||||
#else
|
||||
".global @InterlockedIncrement@0\n"
|
||||
"\t@InterlockedIncrement@0:\n"
|
||||
#endif
|
||||
"\tmov $1, %eax\n"
|
||||
"\txadd %ecx, %eax\n"
|
||||
"\tinc %eax\n\n"
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
"\tret $4\n"
|
||||
#endif
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
void InterlockedDecrement(void);
|
||||
__asm__("\n\t.global _InterlockedDecrement\n\t"
|
||||
"_InterlockedDecrement:\n\t"
|
||||
"movl $0xffffffff,%eax\n\t"
|
||||
"movl 4(%esp),%ebx\n\t"
|
||||
"xaddl %eax,(%ebx)\n\t"
|
||||
"decl %eax\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
void InterlockedExchange(void);
|
||||
__asm__("\n\t.global _InterlockedExchange\n\t"
|
||||
"_InterlockedExchange:\n\t"
|
||||
"pushl %ebp\n\t"
|
||||
"movl %esp,%ebp\n\t"
|
||||
"pushl %eax\n\t"
|
||||
"pushl %ebx\n\t"
|
||||
"movl 12(%ebp),%eax\n\t"
|
||||
"movl 8(%ebp),%ebx\n\t"
|
||||
"xchgl %eax,(%ebx)\n\t"
|
||||
"popl %ebx\n\t"
|
||||
"popl %eax\n\t"
|
||||
"movl %ebp,%esp\n\t"
|
||||
"popl %ebp\n\t"
|
||||
"ret\n\t");
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedDecrement@0
|
||||
* STDCALL : _InterlockedDecrement@4
|
||||
*/
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedDecrement (
|
||||
PLONG Addend
|
||||
);
|
||||
__asm__(
|
||||
"\n\t.global _InterlockedDecrement@4\n\t"
|
||||
"_InterlockedDecrement@4:\n\t"
|
||||
"movl $0xffffffff,%eax\n\t"
|
||||
"movl 4(%esp),%ebx\n\t"
|
||||
"xaddl %eax,(%ebx)\n\t"
|
||||
"decl %eax\n\t"
|
||||
"ret $4\n\t"
|
||||
);
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedExchange@0
|
||||
* STDCALL : _InterlockedExchange@8
|
||||
*/
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedExchange (
|
||||
PLONG Target,
|
||||
LONG Value
|
||||
);
|
||||
__asm__(
|
||||
"\n\t.global _InterlockedExchange@8\n\t"
|
||||
"_InterlockedExchange@8:\n\t"
|
||||
"pushl %ebp\n\t"
|
||||
"movl %esp,%ebp\n\t"
|
||||
"pushl %eax\n\t"
|
||||
"pushl %ebx\n\t"
|
||||
"movl 12(%ebp),%eax\n\t"
|
||||
"movl 8(%ebp),%ebx\n\t"
|
||||
"xchgl %eax,(%ebx)\n\t"
|
||||
"popl %ebx\n\t"
|
||||
"popl %eax\n\t"
|
||||
"movl %ebp,%esp\n\t"
|
||||
"popl %ebp\n\t"
|
||||
"ret $8\n\t"
|
||||
);
|
||||
/*
|
||||
__asm__(
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
".global _InterlockedExchange@8\n"
|
||||
"_InterlockedExchange@8:\n"
|
||||
"\tmovl 4(%esp), %ecx\n"
|
||||
"\tmovl 8(%esp), %edx\n"
|
||||
#else
|
||||
".global @InterlockedExchange@0\n"
|
||||
"@InterlockedExchange@0:\n"
|
||||
#endif
|
||||
"\tmovl %ecx, %eax\n"
|
||||
"__InterlockedExchange_Loop:\n"
|
||||
"\tlock\n"
|
||||
"\tcmpxchg %ecx, %edx\n"
|
||||
"\tjne __InterlockedExchange_Loop\n"
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
"\tmovl %ecx, 4(%esp)\n"
|
||||
"\tret $8\n"
|
||||
#else
|
||||
"\tret\n"
|
||||
#endif
|
||||
);
|
||||
*/
|
||||
|
||||
void InterlockedExchangeAdd(void);
|
||||
__asm__("\n\t.global _InterlockedExchangeAdd\n\t"
|
||||
"_InterlockedExchangeAdd:\n\t"
|
||||
"movl 8(%esp),%eax\n\t"
|
||||
"movl 4(%esp),%ebx\n\t"
|
||||
"xaddl %eax,(%ebx)\n\t"
|
||||
"ret\n\t");
|
||||
|
||||
void InterlockedCompareExchange(void);
|
||||
__asm__("\n\t.global _InterlockedCompareExchange\n\t"
|
||||
"_InterlockedCompareExchange:\n\t"
|
||||
"movl 12(%esp),%eax\n\t"
|
||||
"movl 8(%esp),%edx\n\t"
|
||||
"movl 4(%esp),%ebx\n\t"
|
||||
"cmpxchg %edx,(%ebx)\n\t"
|
||||
"movl %edx,%eax\n\t"
|
||||
"ret\n\t");
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedExchangeAdd@0
|
||||
* STDCALL : _InterlockedExchangeAdd@8
|
||||
*/
|
||||
LONG
|
||||
FASTCALL
|
||||
InterlockedExchangeAdd (
|
||||
PLONG Addend,
|
||||
LONG Value
|
||||
);
|
||||
__asm__(
|
||||
"\n\t.global _InterlockedExchangeAdd@8\n\t"
|
||||
"_InterlockedExchangeAdd@8:\n\t"
|
||||
"movl 8(%esp),%eax\n\t"
|
||||
"movl 4(%esp),%ebx\n\t"
|
||||
"xaddl %eax,(%ebx)\n\t"
|
||||
"ret $8\n\t"
|
||||
);
|
||||
/*
|
||||
__asm__(
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
".global _InterlockedExchangeAdd@8\n"
|
||||
"\t_InterlockedExchangeAdd@8:\n"
|
||||
"\tmovl 4(%esp), %ecx\n"
|
||||
"\tmovl 8(%esp), %edx\n"
|
||||
#else
|
||||
".global @InterlockedExchangeAdd@0\n"
|
||||
"\t@InterlockedExchangeAdd@0:\n"
|
||||
#endif
|
||||
"\txadd %edx, %ecx\n"
|
||||
"\tmovl %edx, %eax\n"
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
"\tret $8\n"
|
||||
#else
|
||||
"\tret\n"
|
||||
#endif
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* FASTCALL: @InterlockedCompareExchange@4
|
||||
* STDCALL : _InterlockedCompareExchange@12
|
||||
*/
|
||||
PVOID
|
||||
FASTCALL
|
||||
InterlockedCompareExchange (
|
||||
PVOID * Destination,
|
||||
PVOID Exchange,
|
||||
PVOID Comperand
|
||||
);
|
||||
__asm__(
|
||||
"\n\t.global _InterlockedCompareExchange@12\n\t"
|
||||
"_InterlockedCompareExchange@12:\n\t"
|
||||
"movl 12(%esp),%eax\n\t"
|
||||
"movl 8(%esp),%edx\n\t"
|
||||
"movl 4(%esp),%ebx\n\t"
|
||||
"cmpxchg %edx,(%ebx)\n\t"
|
||||
"movl %edx,%eax\n\t"
|
||||
"ret $12\n\t"
|
||||
);
|
||||
/*
|
||||
__asm__(
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
".global _InterlockedCompareExchange@12\n"
|
||||
"\t_InterlockedCompareExchange@12:\n"
|
||||
"\tmovl 4(%esp), %ecx\n"
|
||||
"\tmovl 8(%esp), %edx\n"
|
||||
"\tmovl 12(%esp), %eax\n"
|
||||
#else
|
||||
".global @InterlockedCompareExchange@4\n"
|
||||
"\t@InterlockedCompareExchange@4:\n"
|
||||
"\tmovl 4(%esp), %eax\n"
|
||||
#endif
|
||||
"\tcmpxchg %ecx, %edx\n"
|
||||
#ifndef CONFIG_USE_FASTCALL
|
||||
"\tret $12\n"
|
||||
#else
|
||||
"\tret $4\n"
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue