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 <string.h>
#include <ntos/keyboard.h>
#include "../../../ntoskrnl/include/internal/i386/io.h"
#include <ntos/minmax.h>
#define NDEBUG
@ -120,9 +119,9 @@ static void KbdWrite(int addr,BYTE data)
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);
outb_p(addr,data);
WRITE_PORT_UCHAR((PUCHAR)addr,data);
}
static int KbdReadData(void)
@ -136,10 +135,10 @@ static int KbdReadData(void)
i=500000;
do
{
status=inb_p(KBD_CTRL_PORT);
status=READ_PORT_UCHAR((PUCHAR)KBD_CTRL_PORT);
if (!(status & KBD_OBF)) // Check if data available
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
continue;
return data;
@ -428,7 +427,7 @@ static BOOLEAN KeyboardHandler(PKINTERRUPT Interrupt, PVOID Context)
CHECKPOINT;
// Read scan code
thisKey=inb_p(KBD_DATA_PORT);
thisKey=READ_PORT_UCHAR((PUCHAR)KBD_DATA_PORT);
if ((thisKey==0xE0)||(thisKey==0xE1)) // Extended key
{
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];
} 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
{
ULONG dummy;
@ -136,17 +144,17 @@ typedef struct _RTL_QUERY_REGISTRY_TABLE
* PURPOSE: Used with RtlCheckRegistryKey, RtlCreateRegistryKey,
* RtlDeleteRegistryKey
*/
enum
{
RTL_REGISTRY_ABSOLUTE,
RTL_REGISTRY_SERVICES,
RTL_REGISTRY_CONTROL,
RTL_REGISTRY_WINDOWS_NT,
RTL_REGISTRY_DEVICEMAP,
RTL_REGISTRY_USER,
RTL_REGISTRY_OPTIONAL,
RTL_REGISTRY_VALUE,
};
#define RTL_REGISTRY_ABSOLUTE 0
#define RTL_REGISTRY_SERVICES 1
#define RTL_REGISTRY_CONTROL 2
#define RTL_REGISTRY_WINDOWS_NT 3
#define RTL_REGISTRY_DEVICEMAP 4
#define RTL_REGISTRY_USER 5
#define RTL_REGISTRY_MAXIMUM 6
#define RTL_REGISTRY_HANDLE 0x40000000
#define RTL_REGISTRY_OPTIONAL 0x80000000
#define SHORT_SIZE (sizeof(USHORT))
#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
RtlAllocateHeap (
HANDLE Heap,
@ -648,13 +664,21 @@ RtlCompareUnicodeString (
LARGE_INTEGER
STDCALL
RtlConvertLongToLargeInteger (
LONG SignedInteger
IN LONG SignedInteger
);
NTSTATUS
STDCALL
RtlConvertSidToUnicodeString (
IN OUT PUNICODE_STRING String,
IN PSID Sid,
IN BOOLEAN AllocateString
);
LARGE_INTEGER
STDCALL
RtlConvertUlongToLargeInteger (
ULONG UnsignedInteger
IN ULONG UnsignedInteger
);
#if 0
@ -692,6 +716,13 @@ RtlCopyUnicodeString (
PUNICODE_STRING SourceString
);
NTSTATUS
STDCALL
RtlCreateAtomTable (
IN ULONG TableSize,
IN OUT PRTL_ATOM_TABLE *AtomTable
);
HANDLE
STDCALL
RtlCreateHeap (
@ -742,6 +773,13 @@ RtlCustomCPToUnicodeN (
ULONG CustomSize
);
NTSTATUS
STDCALL
RtlDeleteAtomFromAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN RTL_ATOM Atom
);
NTSTATUS
STDCALL
RtlDeleteRegistryValue (
@ -750,6 +788,12 @@ RtlDeleteRegistryValue (
PWSTR ValueName
);
NTSTATUS
STDCALL
RtlDestroyAtomTable (
IN PRTL_ATOM_TABLE AtomTable
);
BOOL
STDCALL
RtlDestroyHeap (
@ -901,6 +945,12 @@ RtlFindSetBitsAndClear (
ULONG HintIndex
);
NTSTATUS
STDCALL
RtlFormatCurrentUserKeyPath (
IN OUT PUNICODE_STRING KeyPath
);
VOID
STDCALL
RtlFreeAnsiString (
@ -1235,6 +1285,14 @@ RtlLockHeap (
HANDLE hheap
);
NTSTATUS
STDCALL
RtlLookupAtomInAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN PUNICODE_STRING AtomName,
OUT PRTL_ATOM Atom
);
VOID
STDCALL
RtlMoveMemory (
@ -1315,6 +1373,19 @@ RtlOemToUnicodeN (
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
STDCALL
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
* PROJECT: ReactOS kernel
@ -901,8 +901,8 @@ NtCreateSemaphore(
OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG InitialCount,
IN ULONG MaximumCount
IN LONG InitialCount,
IN LONG MaximumCount
);
NTSTATUS
@ -911,8 +911,8 @@ ZwCreateSemaphore(
OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ULONG InitialCount,
IN ULONG MaximumCount
IN LONG InitialCount,
IN LONG MaximumCount
);
/*
@ -982,6 +982,7 @@ ZwCreateThread(
IN PINITIAL_TEB InitialTeb,
IN BOOLEAN CreateSuspended
);
/*
* FUNCTION: Creates a waitable timer.
* ARGUMENTS:
@ -994,23 +995,22 @@ ZwCreateThread(
* corresponding fields in OBJECT_ATTRIBUTES structure.
* RETURNS: Status
*/
NTSTATUS
STDCALL
STDCALL
NtCreateTimer(
OUT PHANDLE TimerHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN CINT TimerType
IN TIMER_TYPE TimerType
);
NTSTATUS
STDCALL
STDCALL
ZwCreateTimer(
OUT PHANDLE TimerHandle,
IN ACCESS_MASK DesiredAccess,
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
* Length = Size of the infomation structure
*/
NTSTATUS
STDCALL
NtQuerySemaphore(
HANDLE SemaphoreHandle,
CINT SemaphoreInformationClass,
OUT PVOID SemaphoreInformation,
ULONG Length,
PULONG ReturnLength
IN HANDLE SemaphoreHandle,
IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
OUT PVOID SemaphoreInformation,
IN ULONG Length,
OUT PULONG ReturnLength
);
NTSTATUS
STDCALL
ZwQuerySemaphore(
HANDLE SemaphoreHandle,
CINT SemaphoreInformationClass,
OUT PVOID SemaphoreInformation,
ULONG Length,
PULONG ReturnLength
IN HANDLE SemaphoreHandle,
IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
OUT PVOID SemaphoreInformation,
IN ULONG Length,
OUT PULONG ReturnLength
);
/*
* FUNCTION: Queries the information of a symbolic link object.
* ARGUMENTS:
@ -3297,7 +3297,7 @@ ZwQuerySemaphore(
*
*/
NTSTATUS
STDCALL
STDCALL
NtQuerySymbolicLinkObject(
IN HANDLE SymLinkObjHandle,
OUT PUNICODE_STRING LinkTarget,
@ -3305,7 +3305,7 @@ NtQuerySymbolicLinkObject(
);
NTSTATUS
STDCALL
STDCALL
ZwQuerySymbolicLinkObject(
IN HANDLE SymLinkObjHandle,
OUT PUNICODE_STRING LinkName,
@ -3790,7 +3790,6 @@ ZwReadVirtualMemory(
* TerminationPort = Port on which the debugger likes to be notified.
* RETURNS: Status
*/
NTSTATUS
STDCALL
NtRegisterThreadTerminatePort(
@ -3801,6 +3800,7 @@ STDCALL
ZwRegisterThreadTerminatePort(
HANDLE TerminationPort
);
/*
* FUNCTION: Releases a mutant
* ARGUMENTS:
@ -3821,8 +3821,9 @@ ZwReleaseMutant(
IN HANDLE MutantHandle,
IN PULONG ReleaseCount OPTIONAL
);
/*
* FUNCTION: Releases a semaphore
* FUNCTION: Releases a semaphore
* ARGUMENTS:
* SemaphoreHandle = Handle to the semaphore object
* ReleaseCount = Number to decrease the semaphore count
@ -3832,18 +3833,19 @@ ZwReleaseMutant(
NTSTATUS
STDCALL
NtReleaseSemaphore(
IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount,
IN PULONG PreviousCount
IN HANDLE SemaphoreHandle,
IN LONG ReleaseCount,
OUT PLONG PreviousCount
);
NTSTATUS
STDCALL
ZwReleaseSemaphore(
IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount,
IN PULONG PreviousCount
IN HANDLE SemaphoreHandle,
IN LONG ReleaseCount,
OUT PLONG PreviousCount
);
/*
* FUNCTION: Removes an io completion
* ARGUMENTS:

View file

@ -4,8 +4,6 @@
#define NtCurrentProcess() ( (HANDLE) 0xFFFFFFFF )
#define NtCurrentThread() ( (HANDLE) 0xFFFFFFFE )
typedef PVOID RTL_ATOM;
#ifdef __NTOSKRNL__
extern ULONG EXPORTED NtBuildNumber;
#else
@ -83,9 +81,20 @@ extern ULONG IMPORTED NtBuildNumber;
#define ObjectAllInformation 3
#define ObjectDataInformation 4
// 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
@ -94,6 +103,13 @@ typedef enum _EVENT_INFORMATION_CLASS
EventBasicInformation = 0
} EVENT_INFORMATION_CLASS;
typedef struct _EVENT_BASIC_INFORMATION
{
EVENT_TYPE EventType;
LONG EventState;
} EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
// system information
// {Nt|Zw}{Query|Set}SystemInformation
@ -1179,22 +1195,6 @@ typedef struct _MOVEFILE_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
//{

View file

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

View file

@ -9,17 +9,21 @@
* 27/06/00: Created
*/
#ifndef __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_MODIFY_STATE (1)
#define SEMAPHORE_ALL_ACCESS (0x1f0003L)
#define SEMAPHORE_QUERY_STATE (1)
#define SEMAPHORE_MODIFY_STATE (2)
#define EVENT_ALL_ACCESS (0x1f0003L)
#define EVENT_MODIFY_STATE (2)
#define EVENT_QUERY_STATE (1)
#define TIMER_ALL_ACCESS (0x1f0003L)
#define TIMER_QUERY_STATE (1)
#define TIMER_MODIFY_STATE (2)
#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
#
@ -64,7 +64,7 @@ OBJECTS_RTL = \
# Kernel (Ke)
# Note: head.o MUST be the first file!!!
OBJECTS_KE = \
ke/multiboot.o \
ke/multiboot.o \
ke/apc.o \
ke/bug.o \
ke/catch.o \
@ -446,7 +446,7 @@ endif
$(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA)
$(CC) \
-Wl,-T,ntoskrnl.lnk \
-Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \
-mdll \
-o junk.tmp \
@ -479,7 +479,8 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
$(STRIP) \
--strip-debug \
$(TARGETNAME).o
$(CC) -Wl,-T,ntoskrnl.lnk \
$(CC) \
-Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \
-mdll \
-o junk.tmp \
@ -496,7 +497,8 @@ $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
--def $(TARGETNAME).edf \
--kill-at
- $(RM) base.tmp
$(CC) -Wl,-T,ntoskrnl.lnk \
$(CC) \
-Wl,-T,ntoskrnl.lnk \
-nostartfiles -nostdlib \
-mdll \
-o $(TARGETNAME).exe \
@ -534,7 +536,7 @@ install: $(FLOPPY_DIR)/$(TARGETNAME).exe
$(FLOPPY_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe
$(CP) $(TARGETNAME).exe $(FLOPPY_DIR)/$(TARGETNAME).exe
.PHONY: dist
.PHONY: install
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
* PROJECT: ReactOS kernel
@ -23,9 +23,6 @@
/* ----------------------------------------------------- Typedefs */
#define RTL_REGISTRY_MAXIMUM 0
#define RTL_REGISTRY_HANDLE 0
//#define LONG_MAX 0x7fffffff
#define REG_BLOCK_SIZE 4096

View file

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

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
* PROJECT: ReactOS kernel
@ -12,8 +12,6 @@
#include <ddk/ntddk.h>
#include <internal/hal.h>
/* only needed for screen synchronization */
#include <internal/halio.h>
#define SCREEN_SYNCHRONIZATION
@ -118,17 +116,17 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
CursorY = 0;
/* read screen size from the crtc */
/* FIXME: screen size should be read from the boot paramseters */
outb_p (CRTC_COMMAND, CRTC_COLUMNS);
SizeX = inb_p (CRTC_DATA) + 1;
outb_p (CRTC_COMMAND, CRTC_ROWS);
SizeY = inb_p (CRTC_DATA);
outb_p (CRTC_COMMAND, CRTC_OVERFLOW);
Data = inb_p (CRTC_DATA);
/* FIXME: screen size should be read from the boot parameters */
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_COLUMNS);
SizeX = READ_PORT_UCHAR((PUCHAR)CRTC_DATA) + 1;
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_ROWS);
SizeY = READ_PORT_UCHAR((PUCHAR)CRTC_DATA);
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_OVERFLOW);
Data = READ_PORT_UCHAR((PUCHAR)CRTC_DATA);
SizeY |= (((Data & 0x02) << 7) | ((Data & 0x40) << 3));
SizeY++;
outb_p (CRTC_COMMAND, CRTC_SCANLINES);
ScanLines = (inb_p (CRTC_DATA) & 0x1F) + 1;
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_SCANLINES);
ScanLines = (READ_PORT_UCHAR((PUCHAR)CRTC_DATA) & 0x1F) + 1;
SizeY = SizeY / ScanLines;
#ifdef BOCHS_30ROWS
@ -209,10 +207,10 @@ HalDisplayString (
}
#ifdef SCREEN_SYNCHRONIZATION
outb_p(CRTC_COMMAND, CRTC_CURHI);
offset = inb_p(CRTC_DATA)<<8;
outb_p(CRTC_COMMAND, CRTC_CURLO);
offset += inb_p(CRTC_DATA);
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURHI);
offset = READ_PORT_UCHAR((PUCHAR)CRTC_DATA)<<8;
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURLO);
offset += READ_PORT_UCHAR((PUCHAR)CRTC_DATA);
CursorY = offset / SizeX;
CursorX = offset % SizeX;
@ -249,11 +247,10 @@ HalDisplayString (
#ifdef SCREEN_SYNCHRONIZATION
offset = (CursorY * SizeX) + CursorX;
outb_p(CRTC_COMMAND, CRTC_CURLO);
outb_p(CRTC_DATA, offset);
outb_p(CRTC_COMMAND, CRTC_CURHI);
offset >>= 8;
outb_p(CRTC_DATA, offset);
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURLO);
WRITE_PORT_UCHAR((PUCHAR)CRTC_DATA, offset & 0xff);
WRITE_PORT_UCHAR((PUCHAR)CRTC_COMMAND, CRTC_CURHI);
WRITE_PORT_UCHAR((PUCHAR)CRTC_DATA, (offset >> 8) & 0xff);
#endif
}

View file

@ -10,7 +10,6 @@
#include <ddk/ntddk.h>
#include <internal/bitops.h>
#include <internal/halio.h>
#include <internal/ke.h>
#include <internal/ps.h>
@ -59,8 +58,8 @@ static unsigned int HiGetCurrentPICMask(void)
{
unsigned int mask;
mask = inb_p(0x21);
mask = mask | (inb_p(0xa1)<<8);
mask = READ_PORT_UCHAR((PUCHAR)0x21);
mask = mask | (READ_PORT_UCHAR((PUCHAR)0xa1)<<8);
return mask;
}
@ -68,8 +67,8 @@ static unsigned int HiGetCurrentPICMask(void)
static unsigned int HiSetCurrentPICMask(unsigned int mask)
{
outb_p(0x21,mask & 0xff);
outb_p(0xa1,(mask >> 8) & 0xff);
WRITE_PORT_UCHAR((PUCHAR)0x21,mask & 0xff);
WRITE_PORT_UCHAR((PUCHAR)0xa1,(mask >> 8) & 0xff);
return mask;
}
@ -368,10 +367,10 @@ BOOLEAN STDCALL HalBeginSystemInterrupt (ULONG Vector,
return FALSE;
/* Send EOI to the PICs */
outb(0x20,0x20);
WRITE_PORT_UCHAR((PUCHAR)0x20,0x20);
if ((Vector-IRQ_BASE)>=8)
{
outb(0xa0,0x20);
WRITE_PORT_UCHAR((PUCHAR)0xa0,0x20);
}
*OldIrql = KeGetCurrentIrql();
@ -403,11 +402,11 @@ BOOLEAN STDCALL HalDisableSystemInterrupt (ULONG Vector,
irq = Vector - IRQ_BASE;
if (irq<8)
{
outb(0x21,inb(0x21)|(1<<irq));
WRITE_PORT_UCHAR((PUCHAR)0x21, READ_PORT_UCHAR((PUCHAR)0x21)|(1<<irq));
}
else
{
outb(0xa1,inb(0xa1)|(1<<(irq-8)));
WRITE_PORT_UCHAR((PUCHAR)0xa1, READ_PORT_UCHAR((PUCHAR)0xa1)|(1<<(irq-8)));
}
return TRUE;
@ -426,11 +425,11 @@ BOOLEAN STDCALL HalEnableSystemInterrupt (ULONG Vector,
irq = Vector - IRQ_BASE;
if (irq<8)
{
outb(0x21,inb(0x21)&(~(1<<irq)));
WRITE_PORT_UCHAR((PUCHAR)0x21, READ_PORT_UCHAR((PUCHAR)0x21)&(~(1<<irq)));
}
else
{
outb(0xa1,inb(0xa1)&(~(1<<(irq-8))));
WRITE_PORT_UCHAR((PUCHAR)0xa1, READ_PORT_UCHAR((PUCHAR)0xa1)&(~(1<<(irq-8))));
}
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
* PROJECT: ReactOS kernel
@ -12,7 +12,6 @@
#include <ddk/ntddk.h>
#include <internal/hal.h>
#include <internal/i386/io.h>
static VOID
@ -31,20 +30,20 @@ HalReboot (VOID)
__asm__("cli\n");
/* disable periodic interrupt (RTC) */
outb_p (0x70, 0x0b);
data = inb_p (0x71);
outb_p (0x71, data & 0xbf);
WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0b);
data = READ_PORT_UCHAR((PUCHAR)0x71);
WRITE_PORT_UCHAR((PUCHAR)0x71, data & 0xbf);
/* */
outb_p (0x70, 0x0a);
data = inb_p (0x71);
outb_p (0x71, (data & 0xf0) | 0x06);
WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0a);
data = READ_PORT_UCHAR((PUCHAR)0x71);
WRITE_PORT_UCHAR((PUCHAR)0x71, (data & 0xf0) | 0x06);
/* */
outb_p (0x70, 0x15);
WRITE_PORT_UCHAR((PUCHAR)0x70, 0x15);
/* generate RESET signal via keyboard controller */
outb_p (0x64, 0xfe);
WRITE_PORT_UCHAR((PUCHAR)0x64, 0xfe);
/* stop the processor */
#if 1

View file

@ -9,7 +9,6 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <internal/halio.h>
#define NDEBUG
#include <internal/debug.h>
@ -39,9 +38,9 @@ HalQueryCMOS (BYTE Reg)
Reg |= 0x80;
__asm__("cli\n"); // AP unsure as to whether to do this here
outb (0x70, Reg);
Val=inb (0x71);
outb (0x70, 0);
WRITE_PORT_UCHAR((PUCHAR)0x70, Reg);
Val = READ_PORT_UCHAR((PUCHAR)0x71);
WRITE_PORT_UCHAR((PUCHAR)0x70, 0);
__asm__("sti\n"); // AP unsure about this too..
return(Val);
@ -53,9 +52,9 @@ HalSetCMOS (BYTE Reg, BYTE Val)
{
Reg |= 0x80;
__asm__("cli\n"); // AP unsure as to whether to do this here
outb (0x70, Reg);
outb (0x71, Val);
outb (0x70, 0);
WRITE_PORT_UCHAR((PUCHAR)0x70, Reg);
WRITE_PORT_UCHAR((PUCHAR)0x71, Val);
WRITE_PORT_UCHAR((PUCHAR)0x70, 0);
__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
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/nt/atom.c
@ -14,49 +15,193 @@
#include <internal/debug.h>
static PRTL_ATOM_TABLE RtlpGetGlobalAtomTable (VOID);
/* GLOBALS *******************************************************************/
static PRTL_ATOM_TABLE GlobalAtomTable = NULL;
/* FUNCTIONS *****************************************************************/
NTSTATUS
STDCALL
NtAddAtom (
OUT ATOM * Atom,
IN PUNICODE_STRING AtomString
)
NtAddAtom (OUT PRTL_ATOM Atom,
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
STDCALL
NtDeleteAtom (
IN ATOM Atom
)
NtDeleteAtom (IN RTL_ATOM Atom)
{
UNIMPLEMENTED;
PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL)
return STATUS_ACCESS_DENIED;
return (RtlDeleteAtomFromAtomTable(AtomTable,
Atom));
}
NTSTATUS
STDCALL
NtFindAtom (
OUT ATOM * Atom,
IN PUNICODE_STRING AtomString
)
NtFindAtom (OUT PRTL_ATOM Atom,
IN PUNICODE_STRING AtomString)
{
UNIMPLEMENTED;
PRTL_ATOM_TABLE AtomTable;
AtomTable = RtlpGetGlobalAtomTable();
if (AtomTable == NULL)
return STATUS_ACCESS_DENIED;
return (RtlLookupAtomInAtomTable(AtomTable,
AtomString,
Atom));
}
NTSTATUS
STDCALL
NtQueryInformationAtom (
IN HANDLE AtomHandle,
NtQueryInformationAtom (IN RTL_ATOM Atom,
IN CINT AtomInformationClass,
OUT PVOID AtomInformation,
IN ULONG AtomInformationLength,
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)
{
DPRINT("NtpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n",
DPRINT("NtpCreateEvent(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath);
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
@ -48,12 +48,9 @@ NTSTATUS NtpCreateEvent(PVOID ObjectBody,
VOID NtInitializeEventImplementation(VOID)
{
ANSI_STRING AnsiName;
ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
RtlInitAnsiString(&AnsiName,"Event");
RtlAnsiStringToUnicodeString(&ExEventObjectType->TypeName,&AnsiName,TRUE);
RtlCreateUnicodeString(&ExEventObjectType->TypeName, L"Event");
ExEventObjectType->MaxObjects = ULONG_MAX;
ExEventObjectType->MaxHandles = ULONG_MAX;

View file

@ -47,13 +47,9 @@ NTSTATUS NtpCreateSemaphore(PVOID ObjectBody,
VOID NtInitializeSemaphoreImplementation(VOID)
{
UNICODE_STRING TypeName;
ExSemaphoreType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
RtlInitUnicodeString(&TypeName, L"Event");
ExSemaphoreType->TypeName = TypeName;
RtlCreateUnicodeString(&ExSemaphoreType->TypeName, L"Semaphore");
ExSemaphoreType->MaxObjects = ULONG_MAX;
ExSemaphoreType->MaxHandles = ULONG_MAX;
@ -75,8 +71,8 @@ VOID NtInitializeSemaphoreImplementation(VOID)
NTSTATUS STDCALL NtCreateSemaphore(OUT PHANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN ULONG InitialCount,
IN ULONG MaximumCount)
IN LONG InitialCount,
IN LONG MaximumCount)
{
PKSEMAPHORE Semaphore;
@ -98,8 +94,7 @@ NTSTATUS STDCALL NtOpenSemaphore(IN HANDLE SemaphoreHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
NTSTATUS Status;
PKSEMAPHORE Semaphore;
PKSEMAPHORE Semaphore;
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
ObjectAttributes->Attributes,
@ -125,18 +120,46 @@ NTSTATUS STDCALL NtOpenSemaphore(IN HANDLE SemaphoreHandle,
}
NTSTATUS STDCALL NtQuerySemaphore(HANDLE SemaphoreHandle,
CINT SemaphoreInformationClass,
NTSTATUS STDCALL NtQuerySemaphore(IN HANDLE SemaphoreHandle,
IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
OUT PVOID SemaphoreInformation,
ULONG Length,
PULONG ReturnLength)
IN ULONG SemaphoreInformationLength,
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,
IN ULONG ReleaseCount,
IN PULONG PreviousCount)
IN LONG ReleaseCount,
OUT PLONG PreviousCount)
{
PKSEMAPHORE Semaphore;
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
;
@ -615,7 +615,7 @@ READ_REGISTER_BUFFER_USHORT@12
RtlAbsoluteToSelfRelativeSD@12
RtlAddAccessAllowedAce@16
RtlAddAce@20
;RtlAddAtomToAtomTable
RtlAddAtomToAtomTable@12
;RtlAllocateAndInitializeSid
;RtlAllocateHeap
RtlAnsiCharToUnicodeChar@4
@ -642,14 +642,14 @@ RtlCompareUnicodeString@12
;RtlCompressBuffer
;RtlCompressChunks
RtlConvertLongToLargeInteger@4
;RtlConvertSidToUnicodeString
RtlConvertSidToUnicodeString@12
RtlConvertUlongToLargeInteger@4
RtlCopyLuid@8
RtlCopySid@12
RtlCopyString@8
RtlCopyUnicodeString@8
RtlCreateAcl@12
;RtlCreateAtomTable
RtlCreateAtomTable@8
;RtlCreateHeap
RtlCreateRegistryKey@8
RtlCreateSecurityDescriptor@8
@ -659,12 +659,12 @@ RtlCustomCPToUnicodeN@24
;RtlDecompressChunks
;RtlDecompressFragment
;RtlDelete
;RtlDeleteAtomFromAtomTable
RtlDeleteAtomFromAtomTable@8
;RtlDeleteElementGenericTable
;RtlDeleteNoSplay
RtlDeleteRegistryValue@12
;RtlDescribeChunk
;RtlDestroyAtomTable
RtlDestroyAtomTable@4
;RtlDestroyHeap
RtlDowncaseUnicodeString@12
;RtlEmptyAtomTable
@ -692,7 +692,7 @@ RtlFindLongestRunSet@8
RtlFindSetBits@12
RtlFindSetBitsAndClear@12
;RtlFindUnicodePrefix
;RtlFormatCurrentUserKeyPath
RtlFormatCurrentUserKeyPath@4
RtlFreeAnsiString@4
;RtlFreeHeap
RtlFreeOemString@4
@ -729,7 +729,7 @@ RtlLargeIntegerSubtract@16
RtlLengthRequiredSid@4
RtlLengthSecurityDescriptor@4
RtlLengthSid@4
;RtlLookupAtomInAtomTable
RtlLookupAtomInAtomTable@12
;RtlLookupElementGenericTable
RtlMapGenericMask@8
RtlMoveMemory@12
@ -745,7 +745,7 @@ RtlOemStringToCountedUnicodeString@12
RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString@12
RtlOemToUnicodeN@20
;RtlPinAtomInAtomTable
RtlPinAtomInAtomTable@8
RtlPrefixString@12
RtlPrefixUnicodeString@12
;RtlQueryAtomInAtomTable
@ -1078,8 +1078,8 @@ KeGetCurrentIrql@0
KeLowerIrql@4
KeQueryPerformanceCounter@4
KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel@0
;KeRaiseIrqlToSynchLevel@0
KeRaiseIrqlToDpcLevel@0
KeRaiseIrqlToSynchLevel@0
KeReleaseSpinLock@8
KeStallExecutionProcessor@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
;
@ -614,7 +614,7 @@ READ_REGISTER_BUFFER_USHORT=READ_REGISTER_BUFFER_USHORT@12
RtlAbsoluteToSelfRelativeSD=RtlAbsoluteToSelfRelativeSD@12
RtlAddAccessAllowedAce=RtlAddAccessAllowedAce@16
RtlAddAce=RtlAddAce@20
;RtlAddAtomToAtomTable
RtlAddAtomToAtomTable=RtlAddAtomToAtomTable@12
;RtlAllocateAndInitializeSid
;RtlAllocateHeap
RtlAnsiCharToUnicodeChar=RtlAnsiCharToUnicodeChar@4
@ -641,14 +641,14 @@ RtlCompareUnicodeString=RtlCompareUnicodeString@12
;RtlCompressBuffer
;RtlCompressChunks
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
;RtlConvertSidToUnicodeString
RtlConvertSidToUnicodeString=RtlConvertSidToUnicodeString@12
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
RtlCopyLuid=RtlCopyLuid@8
RtlCopySid=RtlCopySid@12
RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlCreateAcl=RtlCreateAcl@12
;RtlCreateAtomTable
RtlCreateAtomTable=RtlCreateAtomTable@8
;RtlCreateHeap
RtlCreateRegistryKey=RtlCreateRegistryKey@8
RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8
@ -658,12 +658,12 @@ RtlCustomCPToUnicodeN=RtlCustomCPToUnicodeN@24
;RtlDecompressChunks
;RtlDecompressFragment
;RtlDelete
;RtlDeleteAtomFromAtomTable
RtlDeleteAtomFromAtomTable=RtlDeleteAtomFromAtomTable@8
;RtlDeleteElementGenericTable
;RtlDeleteNoSplay
RtlDeleteRegistryValue=RtlDeleteRegistryValue@12
;RtlDescribeChunk
;RtlDestroyAtomTable
RtlDestroyAtomTable=RtlDestroyAtomTable@4
;RtlDestroyHeap
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
;RtlEmptyAtomTable
@ -691,7 +691,7 @@ RtlFindLongestRunSet=RtlFindLongestRunSet@8
RtlFindSetBits=RtlFindSetBits@12
RtlFindSetBitsAndClear=RtlFindSetBitsAndClear@12
;RtlFindUnicodePrefix
;RtlFormatCurrentUserKeyPath
RtlFormatCurrentUserKeyPath=RtlFormatCurrentUserKeyPath@4
RtlFreeAnsiString=RtlFreeAnsiString@4
;RtlFreeHeap
RtlFreeOemString=RtlFreeOemString@4
@ -728,7 +728,7 @@ RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16
RtlLengthRequiredSid=RtlLengthRequiredSid@4
RtlLengthSecurityDescriptor=RtlLengthSecurityDescriptor@4
RtlLengthSid=RtlLengthSid@4
;RtlLookupAtomInAtomTable
RtlLookupAtomInAtomTable=RtlLookupAtomInAtomTable@12
;RtlLookupElementGenericTable
RtlMapGenericMask=RtlMapGenericMask@8
RtlMoveMemory=RtlMoveMemory@12
@ -743,7 +743,7 @@ RtlNumberOfSetBits=RtlNumberOfSetBits@4
RtlOemStringToCountedUnicodeString=RtlOemStringToCountedUnicodeString@12
RtlOemStringToUnicodeSize=RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString=RtlOemStringToUnicodeString@12
;RtlPinAtomInAtomTable
RtlPinAtomInAtomTable=RtlPinAtomInAtomTable@8
RtlPrefixString=RtlPrefixString@12
RtlPrefixUnicodeString=RtlPrefixUnicodeString@12
;RtlQueryAtomInAtomTable
@ -1079,8 +1079,8 @@ KeGetCurrentIrql=KeGetCurrentIrql@0
KeLowerIrql=KeLowerIrql@4
KeQueryPerformanceCounter=KeQueryPerformanceCounter@4
KeRaiseIrql=KeRaiseIrql@8
;KeRaiseIrqlToDpcLevel=KeRaiseIrqlToDpcLevel@0
;KeRaiseIrqlToSynchLevel=KeRaiseIrqlToSynchLevel@0
KeRaiseIrqlToDpcLevel=KeRaiseIrqlToDpcLevel@0
KeRaiseIrqlToSynchLevel=KeRaiseIrqlToSynchLevel@0
KeReleaseSpinLock=KeReleaseSpinLock@8
KeStallExecutionProcessor=KeStallExecutionProcessor@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
* PROJECT: ReactOS kernel
@ -89,4 +89,77 @@ NTSTATUS STDCALL RtlCopySid (ULONG BufferLength, PSID Dest, PSID Src)
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 */