Added atom table stubs

Implemented NtQuerySemaphore()
Implemented RtlConvertSidToUnicode()
Replaced more calls to Linux io functions
Some minor fixes

svn path=/trunk/; revision=1391
This commit is contained in:
Eric Kohl 2000-10-08 12:51:25 +00:00
parent 4e21487a31
commit 9e2f41853a
19 changed files with 520 additions and 211 deletions

View file

@ -12,7 +12,6 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <string.h> #include <string.h>
#include <ntos/keyboard.h> #include <ntos/keyboard.h>
#include "../../../ntoskrnl/include/internal/i386/io.h"
#include <ntos/minmax.h> #include <ntos/minmax.h>
#define NDEBUG #define NDEBUG
@ -120,9 +119,9 @@ static void KbdWrite(int addr,BYTE data)
do do
{ {
status=inb_p(KBD_CTRL_PORT); // Wait until input buffer empty status=READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT); // Wait until input buffer empty
} while(status & KBD_IBF); } while(status & KBD_IBF);
outb_p(addr,data); WRITE_PORT_UCHAR((PUCHAR)addr,data);
} }
static int KbdReadData(void) static int KbdReadData(void)
@ -136,10 +135,10 @@ static int KbdReadData(void)
i=500000; i=500000;
do do
{ {
status=inb_p(KBD_CTRL_PORT); status=READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT);
if (!(status & KBD_OBF)) // Check if data available if (!(status & KBD_OBF)) // Check if data available
continue; continue;
data=inb_p(KBD_DATA_PORT); data=READ_PORT_UCHAR((PUCHAR)KBD_DATA_PORT);
if (status & (KBD_GTO | KBD_PERR)) // Check for timeout error if (status & (KBD_GTO | KBD_PERR)) // Check for timeout error
continue; continue;
return data; return data;
@ -428,7 +427,7 @@ static BOOLEAN KeyboardHandler(PKINTERRUPT Interrupt, PVOID Context)
CHECKPOINT; CHECKPOINT;
// Read scan code // Read scan code
thisKey=inb_p(KBD_DATA_PORT); thisKey=READ_PORT_UCHAR((PUCHAR)KBD_DATA_PORT);
if ((thisKey==0xE0)||(thisKey==0xE1)) // Extended key if ((thisKey==0xE0)||(thisKey==0xE1)) // Extended key
{ {
extKey=1; // Wait for next byte extKey=1; // Wait for next byte

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.41 2000/10/07 13:41:46 dwelch Exp $ /* $Id: rtl.h,v 1.42 2000/10/08 12:42:24 ekohl Exp $
* *
*/ */
@ -77,6 +77,14 @@ typedef struct {
ULONG Unknown[11]; ULONG Unknown[11];
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION; } RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
typedef USHORT RTL_ATOM, *PRTL_ATOM;
typedef struct _RTL_ATOM_TABLE
{
ULONG Dummy;
} RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
struct _LB_RANGE struct _LB_RANGE
{ {
ULONG dummy; ULONG dummy;
@ -136,17 +144,17 @@ typedef struct _RTL_QUERY_REGISTRY_TABLE
* PURPOSE: Used with RtlCheckRegistryKey, RtlCreateRegistryKey, * PURPOSE: Used with RtlCheckRegistryKey, RtlCreateRegistryKey,
* RtlDeleteRegistryKey * RtlDeleteRegistryKey
*/ */
enum #define RTL_REGISTRY_ABSOLUTE 0
{ #define RTL_REGISTRY_SERVICES 1
RTL_REGISTRY_ABSOLUTE, #define RTL_REGISTRY_CONTROL 2
RTL_REGISTRY_SERVICES, #define RTL_REGISTRY_WINDOWS_NT 3
RTL_REGISTRY_CONTROL, #define RTL_REGISTRY_DEVICEMAP 4
RTL_REGISTRY_WINDOWS_NT, #define RTL_REGISTRY_USER 5
RTL_REGISTRY_DEVICEMAP, #define RTL_REGISTRY_MAXIMUM 6
RTL_REGISTRY_USER,
RTL_REGISTRY_OPTIONAL, #define RTL_REGISTRY_HANDLE 0x40000000
RTL_REGISTRY_VALUE, #define RTL_REGISTRY_OPTIONAL 0x80000000
};
#define SHORT_SIZE (sizeof(USHORT)) #define SHORT_SIZE (sizeof(USHORT))
#define SHORT_MASK (SHORT_SIZE-1) #define SHORT_MASK (SHORT_SIZE-1)
@ -513,6 +521,14 @@ RemoveTailList (
} }
NTSTATUS
STDCALL
RtlAddAtomToAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN PWSTR AtomName,
OUT PRTL_ATOM Atom
);
PVOID STDCALL PVOID STDCALL
RtlAllocateHeap ( RtlAllocateHeap (
HANDLE Heap, HANDLE Heap,
@ -648,13 +664,21 @@ RtlCompareUnicodeString (
LARGE_INTEGER LARGE_INTEGER
STDCALL STDCALL
RtlConvertLongToLargeInteger ( RtlConvertLongToLargeInteger (
LONG SignedInteger IN LONG SignedInteger
);
NTSTATUS
STDCALL
RtlConvertSidToUnicodeString (
IN OUT PUNICODE_STRING String,
IN PSID Sid,
IN BOOLEAN AllocateString
); );
LARGE_INTEGER LARGE_INTEGER
STDCALL STDCALL
RtlConvertUlongToLargeInteger ( RtlConvertUlongToLargeInteger (
ULONG UnsignedInteger IN ULONG UnsignedInteger
); );
#if 0 #if 0
@ -692,6 +716,13 @@ RtlCopyUnicodeString (
PUNICODE_STRING SourceString PUNICODE_STRING SourceString
); );
NTSTATUS
STDCALL
RtlCreateAtomTable (
IN ULONG TableSize,
IN OUT PRTL_ATOM_TABLE *AtomTable
);
HANDLE HANDLE
STDCALL STDCALL
RtlCreateHeap ( RtlCreateHeap (
@ -742,6 +773,13 @@ RtlCustomCPToUnicodeN (
ULONG CustomSize ULONG CustomSize
); );
NTSTATUS
STDCALL
RtlDeleteAtomFromAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN RTL_ATOM Atom
);
NTSTATUS NTSTATUS
STDCALL STDCALL
RtlDeleteRegistryValue ( RtlDeleteRegistryValue (
@ -750,6 +788,12 @@ RtlDeleteRegistryValue (
PWSTR ValueName PWSTR ValueName
); );
NTSTATUS
STDCALL
RtlDestroyAtomTable (
IN PRTL_ATOM_TABLE AtomTable
);
BOOL BOOL
STDCALL STDCALL
RtlDestroyHeap ( RtlDestroyHeap (
@ -901,6 +945,12 @@ RtlFindSetBitsAndClear (
ULONG HintIndex ULONG HintIndex
); );
NTSTATUS
STDCALL
RtlFormatCurrentUserKeyPath (
IN OUT PUNICODE_STRING KeyPath
);
VOID VOID
STDCALL STDCALL
RtlFreeAnsiString ( RtlFreeAnsiString (
@ -1235,6 +1285,14 @@ RtlLockHeap (
HANDLE hheap HANDLE hheap
); );
NTSTATUS
STDCALL
RtlLookupAtomInAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN PUNICODE_STRING AtomName,
OUT PRTL_ATOM Atom
);
VOID VOID
STDCALL STDCALL
RtlMoveMemory ( RtlMoveMemory (
@ -1315,6 +1373,19 @@ RtlOemToUnicodeN (
ULONG OemSize ULONG OemSize
); );
NTSTATUS
STDCALL
RtlOpenCurrentUser (
IN ACCESS_MASK DesiredAccess,
OUT PHANDLE KeyHandle
);
NTSTATUS STDCALL
RtlPinAtomInAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN PRTL_ATOM Atom
);
BOOLEAN BOOLEAN
STDCALL STDCALL
RtlPrefixString ( RtlPrefixString (

View file

@ -1,5 +1,5 @@
/* $Id: zw.h,v 1.36 2000/10/06 22:53:22 ekohl Exp $ /* $Id: zw.h,v 1.37 2000/10/08 12:42:24 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -901,8 +901,8 @@ NtCreateSemaphore(
OUT PHANDLE SemaphoreHandle, OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG InitialCount, IN LONG InitialCount,
IN ULONG MaximumCount IN LONG MaximumCount
); );
NTSTATUS NTSTATUS
@ -911,8 +911,8 @@ ZwCreateSemaphore(
OUT PHANDLE SemaphoreHandle, OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG InitialCount, IN LONG InitialCount,
IN ULONG MaximumCount IN LONG MaximumCount
); );
/* /*
@ -982,6 +982,7 @@ ZwCreateThread(
IN PINITIAL_TEB InitialTeb, IN PINITIAL_TEB InitialTeb,
IN BOOLEAN CreateSuspended IN BOOLEAN CreateSuspended
); );
/* /*
* FUNCTION: Creates a waitable timer. * FUNCTION: Creates a waitable timer.
* ARGUMENTS: * ARGUMENTS:
@ -994,23 +995,22 @@ ZwCreateThread(
* corresponding fields in OBJECT_ATTRIBUTES structure. * corresponding fields in OBJECT_ATTRIBUTES structure.
* RETURNS: Status * RETURNS: Status
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
NtCreateTimer( NtCreateTimer(
OUT PHANDLE TimerHandle, OUT PHANDLE TimerHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN CINT TimerType IN TIMER_TYPE TimerType
); );
NTSTATUS NTSTATUS
STDCALL STDCALL
ZwCreateTimer( ZwCreateTimer(
OUT PHANDLE TimerHandle, OUT PHANDLE TimerHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN CINT TimerType IN TIMER_TYPE TimerType
); );
/* /*
@ -3266,27 +3266,27 @@ ZwQuerySecurityObject(
* SemaphoreInformation = Caller supplies storage for the semaphore information structure * SemaphoreInformation = Caller supplies storage for the semaphore information structure
* Length = Size of the infomation structure * Length = Size of the infomation structure
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
NtQuerySemaphore( NtQuerySemaphore(
HANDLE SemaphoreHandle, IN HANDLE SemaphoreHandle,
CINT SemaphoreInformationClass, IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
OUT PVOID SemaphoreInformation, OUT PVOID SemaphoreInformation,
ULONG Length, IN ULONG Length,
PULONG ReturnLength OUT PULONG ReturnLength
); );
NTSTATUS NTSTATUS
STDCALL STDCALL
ZwQuerySemaphore( ZwQuerySemaphore(
HANDLE SemaphoreHandle, IN HANDLE SemaphoreHandle,
CINT SemaphoreInformationClass, IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
OUT PVOID SemaphoreInformation, OUT PVOID SemaphoreInformation,
ULONG Length, IN ULONG Length,
PULONG ReturnLength OUT PULONG ReturnLength
); );
/* /*
* FUNCTION: Queries the information of a symbolic link object. * FUNCTION: Queries the information of a symbolic link object.
* ARGUMENTS: * ARGUMENTS:
@ -3297,7 +3297,7 @@ ZwQuerySemaphore(
* *
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
NtQuerySymbolicLinkObject( NtQuerySymbolicLinkObject(
IN HANDLE SymLinkObjHandle, IN HANDLE SymLinkObjHandle,
OUT PUNICODE_STRING LinkTarget, OUT PUNICODE_STRING LinkTarget,
@ -3305,7 +3305,7 @@ NtQuerySymbolicLinkObject(
); );
NTSTATUS NTSTATUS
STDCALL STDCALL
ZwQuerySymbolicLinkObject( ZwQuerySymbolicLinkObject(
IN HANDLE SymLinkObjHandle, IN HANDLE SymLinkObjHandle,
OUT PUNICODE_STRING LinkName, OUT PUNICODE_STRING LinkName,
@ -3790,7 +3790,6 @@ ZwReadVirtualMemory(
* TerminationPort = Port on which the debugger likes to be notified. * TerminationPort = Port on which the debugger likes to be notified.
* RETURNS: Status * RETURNS: Status
*/ */
NTSTATUS NTSTATUS
STDCALL STDCALL
NtRegisterThreadTerminatePort( NtRegisterThreadTerminatePort(
@ -3801,6 +3800,7 @@ STDCALL
ZwRegisterThreadTerminatePort( ZwRegisterThreadTerminatePort(
HANDLE TerminationPort HANDLE TerminationPort
); );
/* /*
* FUNCTION: Releases a mutant * FUNCTION: Releases a mutant
* ARGUMENTS: * ARGUMENTS:
@ -3821,8 +3821,9 @@ ZwReleaseMutant(
IN HANDLE MutantHandle, IN HANDLE MutantHandle,
IN PULONG ReleaseCount OPTIONAL IN PULONG ReleaseCount OPTIONAL
); );
/* /*
* FUNCTION: Releases a semaphore * FUNCTION: Releases a semaphore
* ARGUMENTS: * ARGUMENTS:
* SemaphoreHandle = Handle to the semaphore object * SemaphoreHandle = Handle to the semaphore object
* ReleaseCount = Number to decrease the semaphore count * ReleaseCount = Number to decrease the semaphore count
@ -3832,18 +3833,19 @@ ZwReleaseMutant(
NTSTATUS NTSTATUS
STDCALL STDCALL
NtReleaseSemaphore( NtReleaseSemaphore(
IN HANDLE SemaphoreHandle, IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount, IN LONG ReleaseCount,
IN PULONG PreviousCount OUT PLONG PreviousCount
); );
NTSTATUS NTSTATUS
STDCALL STDCALL
ZwReleaseSemaphore( ZwReleaseSemaphore(
IN HANDLE SemaphoreHandle, IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount, IN LONG ReleaseCount,
IN PULONG PreviousCount OUT PLONG PreviousCount
); );
/* /*
* FUNCTION: Removes an io completion * FUNCTION: Removes an io completion
* ARGUMENTS: * ARGUMENTS:

View file

@ -4,8 +4,6 @@
#define NtCurrentProcess() ( (HANDLE) 0xFFFFFFFF ) #define NtCurrentProcess() ( (HANDLE) 0xFFFFFFFF )
#define NtCurrentThread() ( (HANDLE) 0xFFFFFFFE ) #define NtCurrentThread() ( (HANDLE) 0xFFFFFFFE )
typedef PVOID RTL_ATOM;
#ifdef __NTOSKRNL__ #ifdef __NTOSKRNL__
extern ULONG EXPORTED NtBuildNumber; extern ULONG EXPORTED NtBuildNumber;
#else #else
@ -83,9 +81,20 @@ extern ULONG IMPORTED NtBuildNumber;
#define ObjectAllInformation 3 #define ObjectAllInformation 3
#define ObjectDataInformation 4 #define ObjectDataInformation 4
// semaphore information // semaphore information
#define SemaphoreBasicInformation 0 typedef enum _SEMAPHORE_INFORMATION_CLASS
{
SemaphoreBasicInformation = 0
} SEMAPHORE_INFORMATION_CLASS;
typedef struct _SEMAPHORE_BASIC_INFORMATION
{
LONG CurrentCount;
LONG MaximumCount;
} SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
// event information // event information
@ -94,6 +103,13 @@ typedef enum _EVENT_INFORMATION_CLASS
EventBasicInformation = 0 EventBasicInformation = 0
} EVENT_INFORMATION_CLASS; } EVENT_INFORMATION_CLASS;
typedef struct _EVENT_BASIC_INFORMATION
{
EVENT_TYPE EventType;
LONG EventState;
} EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
// system information // system information
// {Nt|Zw}{Query|Set}SystemInformation // {Nt|Zw}{Query|Set}SystemInformation
@ -1179,22 +1195,6 @@ typedef struct _MOVEFILE_DESCRIPTOR
} MOVEFILE_DESCRIPTOR, *PMOVEFILE_DESCRIPTOR; } MOVEFILE_DESCRIPTOR, *PMOVEFILE_DESCRIPTOR;
// semaphore information
typedef struct _SEMAPHORE_BASIC_INFORMATION
{
ULONG CurrentCount;
ULONG MaximumCount;
} SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
// event information
typedef struct _EVENT_BASIC_INFORMATION
{
EVENT_TYPE EventType;
LONG EventState;
} EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
//typedef enum _TIMER_TYPE //typedef enum _TIMER_TYPE
//{ //{

View file

@ -38,19 +38,20 @@
#define MEM_TOP_DOWN (1048576) #define MEM_TOP_DOWN (1048576)
#define EXCEPTION_GUARD_PAGE (0x80000001L) #define EXCEPTION_GUARD_PAGE (0x80000001L)
#define SECTION_EXTEND_SIZE (0x10) #define SECTION_EXTEND_SIZE (0x10)
#define SECTION_MAP_EXECUTE (0x8)
#define SECTION_MAP_READ (0x4) #define SECTION_MAP_READ (0x4)
#define SECTION_MAP_WRITE (0x2) #define SECTION_MAP_WRITE (0x2)
#define SECTION_QUERY (0x1) #define SECTION_QUERY (0x1)
#define SECTION_ALL_ACCESS (0xf001fL) #define SECTION_ALL_ACCESS (0xf001fL)
typedef struct _MEMORY_BASIC_INFORMATION { typedef struct _MEMORY_BASIC_INFORMATION {
PVOID BaseAddress; PVOID BaseAddress;
PVOID AllocationBase; PVOID AllocationBase;
DWORD AllocationProtect; DWORD AllocationProtect;
DWORD RegionSize; DWORD RegionSize;
DWORD State; DWORD State;
DWORD Protect; DWORD Protect;
DWORD Type; DWORD Type;
} MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION; } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
#define FILE_MAP_ALL_ACCESS (0xf001fL) #define FILE_MAP_ALL_ACCESS (0xf001fL)

View file

@ -9,17 +9,21 @@
* 27/06/00: Created * 27/06/00: Created
*/ */
#ifndef __INCLUDE_SYNCH_H #ifndef __INCLUDE_SYNCH_H
#define __INCLUDE_SYNCH_H #define __INCLUDE_SYNCH_H
#define EVENT_ALL_ACCESS (0x1f0003L)
#define EVENT_QUERY_STATE (1)
#define EVENT_MODIFY_STATE (2)
#define MUTEX_ALL_ACCESS (0x1f0001L) #define MUTEX_ALL_ACCESS (0x1f0001L)
#define MUTEX_MODIFY_STATE (1) #define MUTEX_MODIFY_STATE (1)
#define SEMAPHORE_ALL_ACCESS (0x1f0003L) #define SEMAPHORE_ALL_ACCESS (0x1f0003L)
#define SEMAPHORE_QUERY_STATE (1)
#define SEMAPHORE_MODIFY_STATE (2) #define SEMAPHORE_MODIFY_STATE (2)
#define EVENT_ALL_ACCESS (0x1f0003L) #define TIMER_ALL_ACCESS (0x1f0003L)
#define EVENT_MODIFY_STATE (2) #define TIMER_QUERY_STATE (1)
#define EVENT_QUERY_STATE (1) #define TIMER_MODIFY_STATE (2)
#endif /* __INCLUDE_PS_H */ #endif /* __INCLUDE_PS_H */

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1 2000/10/07 13:41:50 dwelch Exp $ # $Id: Makefile,v 1.2 2000/10/08 12:43:56 ekohl Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -64,7 +64,7 @@ OBJECTS_RTL = \
# Kernel (Ke) # Kernel (Ke)
# Note: head.o MUST be the first file!!! # Note: head.o MUST be the first file!!!
OBJECTS_KE = \ OBJECTS_KE = \
ke/multiboot.o \ ke/multiboot.o \
ke/apc.o \ ke/apc.o \
ke/bug.o \ ke/bug.o \
ke/catch.o \ ke/catch.o \
@ -446,7 +446,7 @@ endif
$(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA) $(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA)
$(CC) \ $(CC) \
-Wl,-T,ntoskrnl.lnk \ -Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \ -nostartfiles -nostdlib \
-mdll \ -mdll \
-o junk.tmp \ -o junk.tmp \
@ -479,7 +479,8 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
$(STRIP) \ $(STRIP) \
--strip-debug \ --strip-debug \
$(TARGETNAME).o $(TARGETNAME).o
$(CC) -Wl,-T,ntoskrnl.lnk \ $(CC) \
-Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \ -nostartfiles -nostdlib \
-mdll \ -mdll \
-o junk.tmp \ -o junk.tmp \
@ -496,7 +497,8 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
--def $(TARGETNAME).edf \ --def $(TARGETNAME).edf \
--kill-at --kill-at
- $(RM) base.tmp - $(RM) base.tmp
$(CC) -Wl,-T,ntoskrnl.lnk \ $(CC) \
-Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \ -nostartfiles -nostdlib \
-mdll \ -mdll \
-o $(TARGETNAME).exe \ -o $(TARGETNAME).exe \
@ -534,7 +536,7 @@ install: $(FLOPPY_DIR)/$(TARGETNAME).exe
$(FLOPPY_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe $(FLOPPY_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe
$(CP) $(TARGETNAME).exe $(FLOPPY_DIR)/$(TARGETNAME).exe $(CP) $(TARGETNAME).exe $(FLOPPY_DIR)/$(TARGETNAME).exe
.PHONY: dist .PHONY: install
dist: ../$(DIST_DIR)/$(TARGETNAME).exe dist: ../$(DIST_DIR)/$(TARGETNAME).exe

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.41 2000/10/07 18:44:06 dwelch Exp $ /* $Id: registry.c,v 1.42 2000/10/08 12:44:36 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -23,9 +23,6 @@
/* ----------------------------------------------------- Typedefs */ /* ----------------------------------------------------- Typedefs */
#define RTL_REGISTRY_MAXIMUM 0
#define RTL_REGISTRY_HANDLE 0
//#define LONG_MAX 0x7fffffff //#define LONG_MAX 0x7fffffff
#define REG_BLOCK_SIZE 4096 #define REG_BLOCK_SIZE 4096

View file

@ -12,8 +12,9 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
//#include <internal/debug.h> #define NDEBUG
#include <internal/i386/io.h> #include <internal/debug.h>
/* CONSTANTS *****************************************************************/ /* CONSTANTS *****************************************************************/
@ -44,8 +45,8 @@ HalMakeBeep (
"cli\n\t"); "cli\n\t");
/* speaker off */ /* speaker off */
b = inb_p(PORT_B); b = READ_PORT_UCHAR((PUCHAR)PORT_B);
outb_p(PORT_B, b & 0xFC); WRITE_PORT_UCHAR((PUCHAR)PORT_B, b & 0xFC);
if (Frequency) if (Frequency)
{ {
@ -60,12 +61,12 @@ HalMakeBeep (
} }
/* set timer divider */ /* set timer divider */
outb_p(TIMER3, 0xB6); WRITE_PORT_UCHAR((PUCHAR)TIMER3, 0xB6);
outb_p(TIMER2, (UCHAR)(Divider & 0xFF)); WRITE_PORT_UCHAR((PUCHAR)TIMER2, (UCHAR)(Divider & 0xFF));
outb_p(TIMER2, (UCHAR)((Divider>>8) & 0xFF)); WRITE_PORT_UCHAR((PUCHAR)TIMER2, (UCHAR)((Divider>>8) & 0xFF));
/* speaker on */ /* speaker on */
outb_p(PORT_B, inb_p(PORT_B) | 0x03); WRITE_PORT_UCHAR((PUCHAR)PORT_B, READ_PORT_UCHAR((PUCHAR)PORT_B) | 0x03);
} }
/* restore flags */ /* restore flags */

View file

@ -1,4 +1,4 @@
/* $Id: display.c,v 1.10 2000/10/07 13:41:50 dwelch Exp $ /* $Id: display.c,v 1.11 2000/10/08 12:46:31 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -12,8 +12,6 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/hal.h> #include <internal/hal.h>
/* only needed for screen synchronization */
#include <internal/halio.h>
#define SCREEN_SYNCHRONIZATION #define SCREEN_SYNCHRONIZATION
@ -118,17 +116,17 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
CursorY = 0; CursorY = 0;
/* read screen size from the crtc */ /* read screen size from the crtc */
/* FIXME: screen size should be read from the boot paramseters */ /* FIXME: screen size should be read from the boot parameters */
outb_p (CRTC_COMMAND, CRTC_COLUMNS); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_COLUMNS);
SizeX = inb_p (CRTC_DATA) + 1; SizeX = READ_PORT_UCHAR((PUCHAR)CRTC_DATA) + 1;
outb_p (CRTC_COMMAND, CRTC_ROWS); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_ROWS);
SizeY = inb_p (CRTC_DATA); SizeY = READ_PORT_UCHAR((PUCHAR)CRTC_DATA);
outb_p (CRTC_COMMAND, CRTC_OVERFLOW); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_OVERFLOW);
Data = inb_p (CRTC_DATA); Data = READ_PORT_UCHAR((PUCHAR)CRTC_DATA);
SizeY |= (((Data & 0x02) << 7) | ((Data & 0x40) << 3)); SizeY |= (((Data & 0x02) << 7) | ((Data & 0x40) << 3));
SizeY++; SizeY++;
outb_p (CRTC_COMMAND, CRTC_SCANLINES); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_SCANLINES);
ScanLines = (inb_p (CRTC_DATA) & 0x1F) + 1; ScanLines = (READ_PORT_UCHAR((PUCHAR)CRTC_DATA) & 0x1F) + 1;
SizeY = SizeY / ScanLines; SizeY = SizeY / ScanLines;
#ifdef BOCHS_30ROWS #ifdef BOCHS_30ROWS
@ -209,10 +207,10 @@ HalDisplayString (
} }
#ifdef SCREEN_SYNCHRONIZATION #ifdef SCREEN_SYNCHRONIZATION
outb_p(CRTC_COMMAND, CRTC_CURHI); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURHI);
offset = inb_p(CRTC_DATA)<<8; offset = READ_PORT_UCHAR((PUCHAR)CRTC_DATA)<<8;
outb_p(CRTC_COMMAND, CRTC_CURLO); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURLO);
offset += inb_p(CRTC_DATA); offset += READ_PORT_UCHAR((PUCHAR)CRTC_DATA);
CursorY = offset / SizeX; CursorY = offset / SizeX;
CursorX = offset % SizeX; CursorX = offset % SizeX;
@ -249,11 +247,10 @@ HalDisplayString (
#ifdef SCREEN_SYNCHRONIZATION #ifdef SCREEN_SYNCHRONIZATION
offset = (CursorY * SizeX) + CursorX; offset = (CursorY * SizeX) + CursorX;
outb_p(CRTC_COMMAND, CRTC_CURLO); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURLO);
outb_p(CRTC_DATA, offset); WRITE_PORT_UCHAR((PUCHAR)CRTC_DATA, offset & 0xff);
outb_p(CRTC_COMMAND, CRTC_CURHI); WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURHI);
offset >>= 8; WRITE_PORT_UCHAR((PUCHAR)CRTC_DATA, (offset >> 8) & 0xff);
outb_p(CRTC_DATA, offset);
#endif #endif
} }

View file

@ -10,7 +10,6 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/bitops.h> #include <internal/bitops.h>
#include <internal/halio.h>
#include <internal/ke.h> #include <internal/ke.h>
#include <internal/ps.h> #include <internal/ps.h>
@ -59,8 +58,8 @@ static unsigned int HiGetCurrentPICMask(void)
{ {
unsigned int mask; unsigned int mask;
mask = inb_p(0x21); mask = READ_PORT_UCHAR((PUCHAR)0x21);
mask = mask | (inb_p(0xa1)<<8); mask = mask | (READ_PORT_UCHAR((PUCHAR)0xa1)<<8);
return mask; return mask;
} }
@ -68,8 +67,8 @@ static unsigned int HiGetCurrentPICMask(void)
static unsigned int HiSetCurrentPICMask(unsigned int mask) static unsigned int HiSetCurrentPICMask(unsigned int mask)
{ {
outb_p(0x21,mask & 0xff); WRITE_PORT_UCHAR((PUCHAR)0x21,mask & 0xff);
outb_p(0xa1,(mask >> 8) & 0xff); WRITE_PORT_UCHAR((PUCHAR)0xa1,(mask >> 8) & 0xff);
return mask; return mask;
} }
@ -368,10 +367,10 @@ BOOLEAN STDCALL HalBeginSystemInterrupt (ULONG Vector,
return FALSE; return FALSE;
/* Send EOI to the PICs */ /* Send EOI to the PICs */
outb(0x20,0x20); WRITE_PORT_UCHAR((PUCHAR)0x20,0x20);
if ((Vector-IRQ_BASE)>=8) if ((Vector-IRQ_BASE)>=8)
{ {
outb(0xa0,0x20); WRITE_PORT_UCHAR((PUCHAR)0xa0,0x20);
} }
*OldIrql = KeGetCurrentIrql(); *OldIrql = KeGetCurrentIrql();
@ -403,11 +402,11 @@ BOOLEAN STDCALL HalDisableSystemInterrupt (ULONG Vector,
irq = Vector - IRQ_BASE; irq = Vector - IRQ_BASE;
if (irq<8) if (irq<8)
{ {
outb(0x21,inb(0x21)|(1<<irq)); WRITE_PORT_UCHAR((PUCHAR)0x21, READ_PORT_UCHAR((PUCHAR)0x21)|(1<<irq));
} }
else else
{ {
outb(0xa1,inb(0xa1)|(1<<(irq-8))); WRITE_PORT_UCHAR((PUCHAR)0xa1, READ_PORT_UCHAR((PUCHAR)0xa1)|(1<<(irq-8)));
} }
return TRUE; return TRUE;
@ -426,11 +425,11 @@ BOOLEAN STDCALL HalEnableSystemInterrupt (ULONG Vector,
irq = Vector - IRQ_BASE; irq = Vector - IRQ_BASE;
if (irq<8) if (irq<8)
{ {
outb(0x21,inb(0x21)&(~(1<<irq))); WRITE_PORT_UCHAR((PUCHAR)0x21, READ_PORT_UCHAR((PUCHAR)0x21)&(~(1<<irq)));
} }
else else
{ {
outb(0xa1,inb(0xa1)&(~(1<<(irq-8)))); WRITE_PORT_UCHAR((PUCHAR)0xa1, READ_PORT_UCHAR((PUCHAR)0xa1)&(~(1<<(irq-8))));
} }
return TRUE; return TRUE;

View file

@ -1,4 +1,4 @@
/* $Id: reboot.c,v 1.5 2000/08/12 19:33:20 dwelch Exp $ /* $Id: reboot.c,v 1.6 2000/10/08 12:46:31 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -12,7 +12,6 @@
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/hal.h> #include <internal/hal.h>
#include <internal/i386/io.h>
static VOID static VOID
@ -31,20 +30,20 @@ HalReboot (VOID)
__asm__("cli\n"); __asm__("cli\n");
/* disable periodic interrupt (RTC) */ /* disable periodic interrupt (RTC) */
outb_p (0x70, 0x0b); WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0b);
data = inb_p (0x71); data = READ_PORT_UCHAR((PUCHAR)0x71);
outb_p (0x71, data & 0xbf); WRITE_PORT_UCHAR((PUCHAR)0x71, data & 0xbf);
/* */ /* */
outb_p (0x70, 0x0a); WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0a);
data = inb_p (0x71); data = READ_PORT_UCHAR((PUCHAR)0x71);
outb_p (0x71, (data & 0xf0) | 0x06); WRITE_PORT_UCHAR((PUCHAR)0x71, (data & 0xf0) | 0x06);
/* */ /* */
outb_p (0x70, 0x15); WRITE_PORT_UCHAR((PUCHAR)0x70, 0x15);
/* generate RESET signal via keyboard controller */ /* generate RESET signal via keyboard controller */
outb_p (0x64, 0xfe); WRITE_PORT_UCHAR((PUCHAR)0x64, 0xfe);
/* stop the processor */ /* stop the processor */
#if 1 #if 1

View file

@ -9,7 +9,6 @@
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/halio.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -39,9 +38,9 @@ HalQueryCMOS (BYTE Reg)
Reg |= 0x80; Reg |= 0x80;
__asm__("cli\n"); // AP unsure as to whether to do this here __asm__("cli\n"); // AP unsure as to whether to do this here
outb (0x70, Reg); WRITE_PORT_UCHAR((PUCHAR)0x70, Reg);
Val=inb (0x71); Val = READ_PORT_UCHAR((PUCHAR)0x71);
outb (0x70, 0); WRITE_PORT_UCHAR((PUCHAR)0x70, 0);
__asm__("sti\n"); // AP unsure about this too.. __asm__("sti\n"); // AP unsure about this too..
return(Val); return(Val);
@ -53,9 +52,9 @@ HalSetCMOS (BYTE Reg, BYTE Val)
{ {
Reg |= 0x80; Reg |= 0x80;
__asm__("cli\n"); // AP unsure as to whether to do this here __asm__("cli\n"); // AP unsure as to whether to do this here
outb (0x70, Reg); WRITE_PORT_UCHAR((PUCHAR)0x70, Reg);
outb (0x71, Val); WRITE_PORT_UCHAR((PUCHAR)0x71, Val);
outb (0x70, 0); WRITE_PORT_UCHAR((PUCHAR)0x70, 0);
__asm__("sti\n"); // AP unsure about this too.. __asm__("sti\n"); // AP unsure about this too..
} }

View file

@ -1,4 +1,5 @@
/* /* $Id: atom.c,v 1.4 2000/10/08 12:49:26 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/nt/atom.c * FILE: ntoskrnl/nt/atom.c
@ -14,49 +15,193 @@
#include <internal/debug.h> #include <internal/debug.h>
static PRTL_ATOM_TABLE RtlpGetGlobalAtomTable (VOID);
/* GLOBALS *******************************************************************/
static PRTL_ATOM_TABLE GlobalAtomTable = NULL;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS NTSTATUS
STDCALL STDCALL
NtAddAtom ( NtAddAtom (OUT PRTL_ATOM Atom,
OUT ATOM * Atom, IN PUNICODE_STRING AtomString)
IN PUNICODE_STRING AtomString
)
{ {
UNIMPLEMENTED; PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL)
return STATUS_ACCESS_DENIED;
return (RtlAddAtomToAtomTable(AtomTable,
AtomString->Buffer,
Atom));
} }
NTSTATUS NTSTATUS
STDCALL STDCALL
NtDeleteAtom ( NtDeleteAtom (IN RTL_ATOM Atom)
IN ATOM Atom
)
{ {
UNIMPLEMENTED; PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL)
return STATUS_ACCESS_DENIED;
return (RtlDeleteAtomFromAtomTable(AtomTable,
Atom));
} }
NTSTATUS NTSTATUS
STDCALL STDCALL
NtFindAtom ( NtFindAtom (OUT PRTL_ATOM Atom,
OUT ATOM * Atom, IN PUNICODE_STRING AtomString)
IN PUNICODE_STRING AtomString
)
{ {
UNIMPLEMENTED; PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL)
return STATUS_ACCESS_DENIED;
return (RtlLookupAtomInAtomTable(AtomTable,
AtomString,
Atom));
} }
NTSTATUS NTSTATUS
STDCALL STDCALL
NtQueryInformationAtom ( NtQueryInformationAtom (IN RTL_ATOM Atom,
IN HANDLE AtomHandle,
IN CINT AtomInformationClass, IN CINT AtomInformationClass,
OUT PVOID AtomInformation, OUT PVOID AtomInformation,
IN ULONG AtomInformationLength, IN ULONG AtomInformationLength,
OUT PULONG ReturnLength OUT PULONG ReturnLength
) )
{ {
UNIMPLEMENTED; #if 0
PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL)
return STATUS_ACCESS_DENIED;
return (RtlQueryAtomInAtomTable(AtomTable,
Atom,
#endif
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
} }
static PRTL_ATOM_TABLE
RtlpGetGlobalAtomTable (VOID)
{
NTSTATUS Status;
if (GlobalAtomTable != NULL)
return GlobalAtomTable;
Status = RtlCreateAtomTable(37, &GlobalAtomTable);
if (!NT_SUCCESS(Status))
return NULL;
return GlobalAtomTable;
}
NTSTATUS STDCALL
RtlCreateAtomTable (ULONG TableSize,
PRTL_ATOM_TABLE *AtomTable)
{
#if 0
PRTL_ATOM_TABLE Table;
/* allocate atom table */
Table = ExAllocatePool(NonPagedPool,
TableSize * sizeof(RTL_ATOM_ENTRY) +
sizeof(RTL_ATOM_TABLE));
if (Table == NULL)
return STATUS_NO_MEMORY;
Table->TableSize = TableSize;
/* FIXME: more code here */
*AtomTable = Table;
return STATUS_SUCCESS;
#endif
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
NTSTATUS STDCALL
RtlDestroyAtomTable (IN PRTL_ATOM_TABLE AtomTable)
{
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlEmptyAtomTable (IN PRTL_ATOM_TABLE AtomTable,
ULONG Unknown2)
{
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlAddAtomToAtomTable (IN PRTL_ATOM_TABLE AtomTable,
IN PWSTR AtomName,
OUT PRTL_ATOM Atom)
{
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlDeleteAtomFromAtomTable (IN PRTL_ATOM_TABLE AtomTable,
IN RTL_ATOM Atom)
{
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlLookupAtomInAtomTable (IN PRTL_ATOM_TABLE AtomTable,
IN PUNICODE_STRING AtomName,
OUT PRTL_ATOM Atom)
{
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlPinAtomInAtomTable (IN PRTL_ATOM_TABLE AtomTable,
IN PRTL_ATOM Atom)
{
UNIMPLEMENTED;
return STATUS_SUCCESS;
}
/*
NTSTATUS STDCALL
RtlQueryAtomInAtomTable (IN PRTL_ATOM_TABLE AtomTable,
IN RTL_ATOM Atom,
*/
/* EOF */

View file

@ -31,7 +31,7 @@ NTSTATUS NtpCreateEvent(PVOID ObjectBody,
POBJECT_ATTRIBUTES ObjectAttributes) POBJECT_ATTRIBUTES ObjectAttributes)
{ {
DPRINT("NtpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n", DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath); ObjectBody, Parent, RemainingPath);
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL) if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
@ -48,12 +48,9 @@ NTSTATUS NtpCreateEvent(PVOID ObjectBody,
VOID NtInitializeEventImplementation(VOID) VOID NtInitializeEventImplementation(VOID)
{ {
ANSI_STRING AnsiName;
ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE)); ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
RtlInitAnsiString(&AnsiName,"Event"); RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event");
RtlAnsiStringToUnicodeString(&ExEventObjectType->TypeName,&AnsiName,TRUE);
ExEventObjectType->MaxObjects = ULONG_MAX; ExEventObjectType->MaxObjects = ULONG_MAX;
ExEventObjectType->MaxHandles = ULONG_MAX; ExEventObjectType->MaxHandles = ULONG_MAX;

View file

@ -47,13 +47,9 @@ NTSTATUS NtpCreateSemaphore(PVOID ObjectBody,
VOID NtInitializeSemaphoreImplementation(VOID) VOID NtInitializeSemaphoreImplementation(VOID)
{ {
UNICODE_STRING TypeName;
ExSemaphoreType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); ExSemaphoreType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
RtlInitUnicodeString(&TypeName, L"Event"); RtlCreateUnicodeString(&ExSemaphoreType->TypeName, L"Semaphore");
ExSemaphoreType->TypeName = TypeName;
ExSemaphoreType->MaxObjects = ULONG_MAX; ExSemaphoreType->MaxObjects = ULONG_MAX;
ExSemaphoreType->MaxHandles = ULONG_MAX; ExSemaphoreType->MaxHandles = ULONG_MAX;
@ -75,8 +71,8 @@ VOID NtInitializeSemaphoreImplementation(VOID)
NTSTATUS STDCALL NtCreateSemaphore(OUT PHANDLE SemaphoreHandle, NTSTATUS STDCALL NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
IN ULONG InitialCount, IN LONG InitialCount,
IN ULONG MaximumCount) IN LONG MaximumCount)
{ {
PKSEMAPHORE Semaphore; PKSEMAPHORE Semaphore;
@ -98,8 +94,7 @@ NTSTATUS STDCALL NtOpenSemaphore(IN HANDLE SemaphoreHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes) IN POBJECT_ATTRIBUTES ObjectAttributes)
{ {
NTSTATUS Status; NTSTATUS Status;
PKSEMAPHORE Semaphore; PKSEMAPHORE Semaphore;
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName, Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
ObjectAttributes->Attributes, ObjectAttributes->Attributes,
@ -125,18 +120,46 @@ NTSTATUS STDCALL NtOpenSemaphore(IN HANDLE SemaphoreHandle,
} }
NTSTATUS STDCALL NtQuerySemaphore(HANDLE SemaphoreHandle, NTSTATUS STDCALL NtQuerySemaphore(IN HANDLE SemaphoreHandle,
CINT SemaphoreInformationClass, IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
OUT PVOID SemaphoreInformation, OUT PVOID SemaphoreInformation,
ULONG Length, IN ULONG SemaphoreInformationLength,
PULONG ReturnLength) OUT PULONG ReturnLength)
{ {
UNIMPLEMENTED; PSEMAPHORE_BASIC_INFORMATION Info;
PKSEMAPHORE Semaphore;
NTSTATUS Status;
Info = (PSEMAPHORE_BASIC_INFORMATION)SemaphoreInformation;
if (SemaphoreInformationClass > SemaphoreBasicInformation)
return STATUS_INVALID_INFO_CLASS;
if (SemaphoreInformationLength < sizeof(SEMAPHORE_BASIC_INFORMATION))
return STATUS_INFO_LENGTH_MISMATCH;
Status = ObReferenceObjectByHandle(SemaphoreHandle,
SEMAPHORE_QUERY_STATE,
ExSemaphoreType,
UserMode,
(PVOID*)&Semaphore,
NULL);
if (!NT_SUCCESS(Status))
return Status;
Info->CurrentCount = KeReadStateSemaphore(Semaphore);
Info->MaximumCount = Semaphore->Limit;
*ReturnLength = sizeof(SEMAPHORE_BASIC_INFORMATION);
ObDereferenceObject(Semaphore);
return STATUS_SUCCESS;
} }
NTSTATUS STDCALL NtReleaseSemaphore(IN HANDLE SemaphoreHandle, NTSTATUS STDCALL NtReleaseSemaphore(IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount, IN LONG ReleaseCount,
IN PULONG PreviousCount) OUT PLONG PreviousCount)
{ {
PKSEMAPHORE Semaphore; PKSEMAPHORE Semaphore;
NTSTATUS Status; NTSTATUS Status;

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.88 2000/09/06 02:08:00 phreak Exp $ ; $Id: ntoskrnl.def,v 1.89 2000/10/08 12:43:56 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -615,7 +615,7 @@ READ_REGISTER_BUFFER_USHORT@12
RtlAbsoluteToSelfRelativeSD@12 RtlAbsoluteToSelfRelativeSD@12
RtlAddAccessAllowedAce@16 RtlAddAccessAllowedAce@16
RtlAddAce@20 RtlAddAce@20
;RtlAddAtomToAtomTable RtlAddAtomToAtomTable@12
;RtlAllocateAndInitializeSid ;RtlAllocateAndInitializeSid
;RtlAllocateHeap ;RtlAllocateHeap
RtlAnsiCharToUnicodeChar@4 RtlAnsiCharToUnicodeChar@4
@ -642,14 +642,14 @@ RtlCompareUnicodeString@12
;RtlCompressBuffer ;RtlCompressBuffer
;RtlCompressChunks ;RtlCompressChunks
RtlConvertLongToLargeInteger@4 RtlConvertLongToLargeInteger@4
;RtlConvertSidToUnicodeString RtlConvertSidToUnicodeString@12
RtlConvertUlongToLargeInteger@4 RtlConvertUlongToLargeInteger@4
RtlCopyLuid@8 RtlCopyLuid@8
RtlCopySid@12 RtlCopySid@12
RtlCopyString@8 RtlCopyString@8
RtlCopyUnicodeString@8 RtlCopyUnicodeString@8
RtlCreateAcl@12 RtlCreateAcl@12
;RtlCreateAtomTable RtlCreateAtomTable@8
;RtlCreateHeap ;RtlCreateHeap
RtlCreateRegistryKey@8 RtlCreateRegistryKey@8
RtlCreateSecurityDescriptor@8 RtlCreateSecurityDescriptor@8
@ -659,12 +659,12 @@ RtlCustomCPToUnicodeN@24
;RtlDecompressChunks ;RtlDecompressChunks
;RtlDecompressFragment ;RtlDecompressFragment
;RtlDelete ;RtlDelete
;RtlDeleteAtomFromAtomTable RtlDeleteAtomFromAtomTable@8
;RtlDeleteElementGenericTable ;RtlDeleteElementGenericTable
;RtlDeleteNoSplay ;RtlDeleteNoSplay
RtlDeleteRegistryValue@12 RtlDeleteRegistryValue@12
;RtlDescribeChunk ;RtlDescribeChunk
;RtlDestroyAtomTable RtlDestroyAtomTable@4
;RtlDestroyHeap ;RtlDestroyHeap
RtlDowncaseUnicodeString@12 RtlDowncaseUnicodeString@12
;RtlEmptyAtomTable ;RtlEmptyAtomTable
@ -692,7 +692,7 @@ RtlFindLongestRunSet@8
RtlFindSetBits@12 RtlFindSetBits@12
RtlFindSetBitsAndClear@12 RtlFindSetBitsAndClear@12
;RtlFindUnicodePrefix ;RtlFindUnicodePrefix
;RtlFormatCurrentUserKeyPath RtlFormatCurrentUserKeyPath@4
RtlFreeAnsiString@4 RtlFreeAnsiString@4
;RtlFreeHeap ;RtlFreeHeap
RtlFreeOemString@4 RtlFreeOemString@4
@ -729,7 +729,7 @@ RtlLargeIntegerSubtract@16
RtlLengthRequiredSid@4 RtlLengthRequiredSid@4
RtlLengthSecurityDescriptor@4 RtlLengthSecurityDescriptor@4
RtlLengthSid@4 RtlLengthSid@4
;RtlLookupAtomInAtomTable RtlLookupAtomInAtomTable@12
;RtlLookupElementGenericTable ;RtlLookupElementGenericTable
RtlMapGenericMask@8 RtlMapGenericMask@8
RtlMoveMemory@12 RtlMoveMemory@12
@ -745,7 +745,7 @@ RtlOemStringToCountedUnicodeString@12
RtlOemStringToUnicodeSize@4 RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString@12 RtlOemStringToUnicodeString@12
RtlOemToUnicodeN@20 RtlOemToUnicodeN@20
;RtlPinAtomInAtomTable RtlPinAtomInAtomTable@8
RtlPrefixString@12 RtlPrefixString@12
RtlPrefixUnicodeString@12 RtlPrefixUnicodeString@12
;RtlQueryAtomInAtomTable ;RtlQueryAtomInAtomTable
@ -1078,8 +1078,8 @@ KeGetCurrentIrql@0
KeLowerIrql@4 KeLowerIrql@4
KeQueryPerformanceCounter@4 KeQueryPerformanceCounter@4
KeRaiseIrql@8 KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel@0 KeRaiseIrqlToDpcLevel@0
;KeRaiseIrqlToSynchLevel@0 KeRaiseIrqlToSynchLevel@0
KeReleaseSpinLock@8 KeReleaseSpinLock@8
KeStallExecutionProcessor@4 KeStallExecutionProcessor@4
;@KfAcquireSpinLock@4 ;@KfAcquireSpinLock@4

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.75 2000/09/06 02:08:00 phreak Exp $ ; $Id: ntoskrnl.edf,v 1.76 2000/10/08 12:43:56 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -614,7 +614,7 @@ READ_REGISTER_BUFFER_USHORT=READ_REGISTER_BUFFER_USHORT@12
RtlAbsoluteToSelfRelativeSD=RtlAbsoluteToSelfRelativeSD@12 RtlAbsoluteToSelfRelativeSD=RtlAbsoluteToSelfRelativeSD@12
RtlAddAccessAllowedAce=RtlAddAccessAllowedAce@16 RtlAddAccessAllowedAce=RtlAddAccessAllowedAce@16
RtlAddAce=RtlAddAce@20 RtlAddAce=RtlAddAce@20
;RtlAddAtomToAtomTable RtlAddAtomToAtomTable=RtlAddAtomToAtomTable@12
;RtlAllocateAndInitializeSid ;RtlAllocateAndInitializeSid
;RtlAllocateHeap ;RtlAllocateHeap
RtlAnsiCharToUnicodeChar=RtlAnsiCharToUnicodeChar@4 RtlAnsiCharToUnicodeChar=RtlAnsiCharToUnicodeChar@4
@ -641,14 +641,14 @@ RtlCompareUnicodeString=RtlCompareUnicodeString@12
;RtlCompressBuffer ;RtlCompressBuffer
;RtlCompressChunks ;RtlCompressChunks
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4 RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
;RtlConvertSidToUnicodeString RtlConvertSidToUnicodeString=RtlConvertSidToUnicodeString@12
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4 RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
RtlCopyLuid=RtlCopyLuid@8 RtlCopyLuid=RtlCopyLuid@8
RtlCopySid=RtlCopySid@12 RtlCopySid=RtlCopySid@12
RtlCopyString=RtlCopyString@8 RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8 RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlCreateAcl=RtlCreateAcl@12 RtlCreateAcl=RtlCreateAcl@12
;RtlCreateAtomTable RtlCreateAtomTable=RtlCreateAtomTable@8
;RtlCreateHeap ;RtlCreateHeap
RtlCreateRegistryKey=RtlCreateRegistryKey@8 RtlCreateRegistryKey=RtlCreateRegistryKey@8
RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8 RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8
@ -658,12 +658,12 @@ RtlCustomCPToUnicodeN=RtlCustomCPToUnicodeN@24
;RtlDecompressChunks ;RtlDecompressChunks
;RtlDecompressFragment ;RtlDecompressFragment
;RtlDelete ;RtlDelete
;RtlDeleteAtomFromAtomTable RtlDeleteAtomFromAtomTable=RtlDeleteAtomFromAtomTable@8
;RtlDeleteElementGenericTable ;RtlDeleteElementGenericTable
;RtlDeleteNoSplay ;RtlDeleteNoSplay
RtlDeleteRegistryValue=RtlDeleteRegistryValue@12 RtlDeleteRegistryValue=RtlDeleteRegistryValue@12
;RtlDescribeChunk ;RtlDescribeChunk
;RtlDestroyAtomTable RtlDestroyAtomTable=RtlDestroyAtomTable@4
;RtlDestroyHeap ;RtlDestroyHeap
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12 RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
;RtlEmptyAtomTable ;RtlEmptyAtomTable
@ -691,7 +691,7 @@ RtlFindLongestRunSet=RtlFindLongestRunSet@8
RtlFindSetBits=RtlFindSetBits@12 RtlFindSetBits=RtlFindSetBits@12
RtlFindSetBitsAndClear=RtlFindSetBitsAndClear@12 RtlFindSetBitsAndClear=RtlFindSetBitsAndClear@12
;RtlFindUnicodePrefix ;RtlFindUnicodePrefix
;RtlFormatCurrentUserKeyPath RtlFormatCurrentUserKeyPath=RtlFormatCurrentUserKeyPath@4
RtlFreeAnsiString=RtlFreeAnsiString@4 RtlFreeAnsiString=RtlFreeAnsiString@4
;RtlFreeHeap ;RtlFreeHeap
RtlFreeOemString=RtlFreeOemString@4 RtlFreeOemString=RtlFreeOemString@4
@ -728,7 +728,7 @@ RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16
RtlLengthRequiredSid=RtlLengthRequiredSid@4 RtlLengthRequiredSid=RtlLengthRequiredSid@4
RtlLengthSecurityDescriptor=RtlLengthSecurityDescriptor@4 RtlLengthSecurityDescriptor=RtlLengthSecurityDescriptor@4
RtlLengthSid=RtlLengthSid@4 RtlLengthSid=RtlLengthSid@4
;RtlLookupAtomInAtomTable RtlLookupAtomInAtomTable=RtlLookupAtomInAtomTable@12
;RtlLookupElementGenericTable ;RtlLookupElementGenericTable
RtlMapGenericMask=RtlMapGenericMask@8 RtlMapGenericMask=RtlMapGenericMask@8
RtlMoveMemory=RtlMoveMemory@12 RtlMoveMemory=RtlMoveMemory@12
@ -743,7 +743,7 @@ RtlNumberOfSetBits=RtlNumberOfSetBits@4
RtlOemStringToCountedUnicodeString=RtlOemStringToCountedUnicodeString@12 RtlOemStringToCountedUnicodeString=RtlOemStringToCountedUnicodeString@12
RtlOemStringToUnicodeSize=RtlOemStringToUnicodeSize@4 RtlOemStringToUnicodeSize=RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString=RtlOemStringToUnicodeString@12 RtlOemStringToUnicodeString=RtlOemStringToUnicodeString@12
;RtlPinAtomInAtomTable RtlPinAtomInAtomTable=RtlPinAtomInAtomTable@8
RtlPrefixString=RtlPrefixString@12 RtlPrefixString=RtlPrefixString@12
RtlPrefixUnicodeString=RtlPrefixUnicodeString@12 RtlPrefixUnicodeString=RtlPrefixUnicodeString@12
;RtlQueryAtomInAtomTable ;RtlQueryAtomInAtomTable
@ -1079,8 +1079,8 @@ KeGetCurrentIrql=KeGetCurrentIrql@0
KeLowerIrql=KeLowerIrql@4 KeLowerIrql=KeLowerIrql@4
KeQueryPerformanceCounter=KeQueryPerformanceCounter@4 KeQueryPerformanceCounter=KeQueryPerformanceCounter@4
KeRaiseIrql=KeRaiseIrql@8 KeRaiseIrql=KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel=KeRaiseIrqlToDpcLevel@0 KeRaiseIrqlToDpcLevel=KeRaiseIrqlToDpcLevel@0
;KeRaiseIrqlToSynchLevel=KeRaiseIrqlToSynchLevel@0 KeRaiseIrqlToSynchLevel=KeRaiseIrqlToSynchLevel@0
KeReleaseSpinLock=KeReleaseSpinLock@8 KeReleaseSpinLock=KeReleaseSpinLock@8
KeStallExecutionProcessor=KeStallExecutionProcessor@4 KeStallExecutionProcessor=KeStallExecutionProcessor@4
;KfAcquireSpinLock=@KfAcquireSpinLock@4 ;KfAcquireSpinLock=@KfAcquireSpinLock@4

View file

@ -1,4 +1,4 @@
/* $Id: sid.c,v 1.4 2000/04/15 23:14:32 ekohl Exp $ /* $Id: sid.c,v 1.5 2000/10/08 12:50:13 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -89,4 +89,77 @@ NTSTATUS STDCALL RtlCopySid (ULONG BufferLength, PSID Dest, PSID Src)
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS STDCALL
RtlConvertSidToUnicodeString(PUNICODE_STRING String,
PSID Sid,
BOOLEAN AllocateString)
{
WCHAR Buffer[256];
PWSTR Ptr;
ULONG Length;
ULONG i;
if (!RtlValidSid(Sid))
return STATUS_INVALID_SID;
Ptr = Bufer;
Ptr += swprintf (Ptr,
L"S-%u-",
Sid->Revision);
if(!Sid->IdentifierAuthority.Value[0] &&
!Sid->IdentifierAuthority.Value[1])
{
Ptr += swprintf(Ptr,
L"%u",
(ULONG)Sid->IdentifierAuthority.Value[2] << 24 |
(ULONG)Sid->IdentifierAuthority.Value[3] << 16 |
(ULONG)Sid->IdentifierAuthority.Value[4] << 8 |
(ULONG)Sid->IdentifierAuthority.Value[5]);
}
else
{
Ptr += swprintf(Ptr,
L"0x%02hx%02hx%02hx%02hx%02hx%02hx",
Sid->IdentifierAuthority.Value[0],
Sid->IdentifierAuthority.Value[1],
Sid->IdentifierAuthority.Value[2],
Sid->IdentifierAuthority.Value[3],
Sid->IdentifierAuthority.Value[4],
Sid->IdentifierAuthority.Value[5]);
}
for (i = 0; i < Sid->SubAuthorityCount; i++)
{
Ptr += swprintf(Ptr,
L"-%u",
Sid->SubAuthority[i]);
}
Length = (Ptr - Buffer) * sizeof(WCHAR);
if (AllocateString)
{
String->Buffer = ExAllocatePool(NonPagedPool,
Length + sizeof(WCHAR));
if (String->Buffer == NULL)
return STATUS_NO_MEMORY;
String->MaximumLength = Length + sizeof(WCHAR);
}
else
{
if (Length > String->MaximumLength)
return STATUS_BUFFER_TOO_SMALL;
}
String->Length = Length;
memmove(String->Buffer,
Buffer,
Length);
if (Length < String->MaximumLength)
String->Buffer[Length] = 0;
return STATUS_SUCCESS;
}
/* EOF */ /* EOF */