--- trunk/reactos/lib/rtl/registry.c 2005-01-21 23:01:33 UTC (rev 13198)
+++ trunk/reactos/lib/rtl/registry.c 2005-01-21 23:35:19 UTC (rev 13199)
@@ -44,7 +44,7 @@
if (RelativeTo & RTL_REGISTRY_HANDLE)
{
- Status = NtDuplicateObject(NtCurrentProcess(),
+ Status = ZwDuplicateObject(NtCurrentProcess(),
(HANDLE)Path,
NtCurrentProcess(),
KeyHandle,
@@ -129,7 +129,7 @@
if (Create == TRUE)
{
- Status = NtCreateKey(KeyHandle,
+ Status = ZwCreateKey(KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes,
0,
@@ -139,7 +139,7 @@
}
else
{
- Status = NtOpenKey(KeyHandle,
+ Status = ZwOpenKey(KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes);
}
@@ -165,7 +165,7 @@
if (!NT_SUCCESS(Status))
return(Status);
- NtClose(KeyHandle);
+ ZwClose(KeyHandle);
return(STATUS_SUCCESS);
}
@@ -188,7 +188,7 @@
if (!NT_SUCCESS(Status))
return(Status);
- NtClose(KeyHandle);
+ ZwClose(KeyHandle);
return(STATUS_SUCCESS);
}
@@ -216,10 +216,10 @@
RtlInitUnicodeString(&Name,
ValueName);
- Status = NtDeleteValueKey(KeyHandle,
+ Status = ZwDeleteValueKey(KeyHandle,
&Name);
- NtClose(KeyHandle);
+ ZwClose(KeyHandle);
return(Status);
}
@@ -240,7 +240,7 @@
DPRINT ("RtlFormatCurrentUserKeyPath() called\n");
- Status = NtOpenThreadToken (NtCurrentThread (),
+ Status = ZwOpenThreadToken (NtCurrentThread (),
TOKEN_READ,
TRUE,
&TokenHandle);
@@ -248,30 +248,30 @@
{
if (Status != STATUS_NO_TOKEN)
{
- DPRINT1 ("NtOpenThreadToken() failed (Status %lx)\n", Status);
+ DPRINT1 ("ZwOpenThreadToken() failed (Status %lx)\n", Status);
return Status;
}
- Status = NtOpenProcessToken (NtCurrentProcess (),
+ Status = ZwOpenProcessToken (NtCurrentProcess (),
TOKEN_READ,
&TokenHandle);
if (!NT_SUCCESS (Status))
{
- DPRINT1 ("NtOpenProcessToken() failed (Status %lx)\n", Status);
+ DPRINT1 ("ZwOpenProcessToken() failed (Status %lx)\n", Status);
return Status;
}
}
SidBuffer = (PSID_AND_ATTRIBUTES)Buffer;
- Status = NtQueryInformationToken (TokenHandle,
+ Status = ZwQueryInformationToken (TokenHandle,
TokenUser,
(PVOID)SidBuffer,
256,
&Length);
- NtClose (TokenHandle);
+ ZwClose (TokenHandle);
if (!NT_SUCCESS(Status))
{
- DPRINT1 ("NtQueryInformationToken() failed (Status %lx)\n", Status);
+ DPRINT1 ("ZwQueryInformationToken() failed (Status %lx)\n", Status);
return Status;
}
@@ -329,7 +329,7 @@
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
- Status = NtOpenKey(KeyHandle,
+ Status = ZwOpenKey(KeyHandle,
DesiredAccess,
&ObjectAttributes);
RtlFreeUnicodeString(&KeyPath);
@@ -346,7 +346,7 @@
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
- Status = NtOpenKey(KeyHandle,
+ Status = ZwOpenKey(KeyHandle,
DesiredAccess,
&ObjectAttributes);
@@ -403,7 +403,7 @@
if (((QueryEntry->Flags & (RTL_QUERY_REGISTRY_SUBKEY | RTL_QUERY_REGISTRY_TOPKEY)) != 0) &&
(BaseKeyHandle != CurrentKeyHandle))
{
- NtClose(CurrentKeyHandle);
+ ZwClose(CurrentKeyHandle);
CurrentKeyHandle = BaseKeyHandle;
}
@@ -418,7 +418,7 @@
OBJ_CASE_INSENSITIVE,
BaseKeyHandle,
NULL);
- Status = NtOpenKey(&CurrentKeyHandle,
+ Status = ZwOpenKey(&CurrentKeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
@@ -439,7 +439,7 @@
break;
}
- Status = NtQueryValueKey(CurrentKeyHandle,
+ Status = ZwQueryValueKey(CurrentKeyHandle,
&KeyName,
KeyValuePartialInformation,
ValueInfo,
@@ -601,7 +601,7 @@
break;
}
- Status = NtQueryValueKey(CurrentKeyHandle,
+ Status = ZwQueryValueKey(CurrentKeyHandle,
&KeyName,
KeyValuePartialInformation,
ValueInfo,
@@ -725,7 +725,7 @@
Index = 0;
while (TRUE)
{
- Status = NtEnumerateValueKey(CurrentKeyHandle,
+ Status = ZwEnumerateValueKey(CurrentKeyHandle,
Index,
KeyValueFullInformation,
FullValueInfo,
@@ -848,9 +848,9 @@
}
if (CurrentKeyHandle != BaseKeyHandle)
- NtClose(CurrentKeyHandle);
+ ZwClose(CurrentKeyHandle);
- NtClose(BaseKeyHandle);
+ ZwClose(BaseKeyHandle);
return(Status);
}
@@ -881,14 +881,14 @@
RtlInitUnicodeString(&Name,
ValueName);
- Status = NtSetValueKey(KeyHandle,
+ Status = ZwSetValueKey(KeyHandle,
&Name,
0,
ValueType,
ValueData,
ValueLength);
if (NT_SUCCESS(Status))
- NtClose(KeyHandle);
+ ZwClose(KeyHandle);
return(Status);
}
@@ -908,7 +908,7 @@
if (ObjectAttributes != NULL)
ObjectAttributes->Attributes &= ~(OBJ_PERMANENT | OBJ_EXCLUSIVE);
- return(NtCreateKey(KeyHandle,
+ return(ZwCreateKey(KeyHandle,
DesiredAccess,
ObjectAttributes,
0,
@@ -941,7 +941,7 @@
return(STATUS_NO_MEMORY);
}
- Status = NtEnumerateKey(KeyHandle,
+ Status = ZwEnumerateKey(KeyHandle,
Index,
KeyBasicInformation,
KeyInfo,
@@ -978,7 +978,7 @@
NTSTATUS STDCALL
RtlpNtMakeTemporaryKey(IN HANDLE KeyHandle)
{
- return(NtDeleteKey(KeyHandle));
+ return(ZwDeleteKey(KeyHandle));
}
@@ -994,7 +994,7 @@
if (ObjectAttributes != NULL)
ObjectAttributes->Attributes &= ~(OBJ_PERMANENT | OBJ_EXCLUSIVE);
- return(NtOpenKey(KeyHandle,
+ return(ZwOpenKey(KeyHandle,
DesiredAccess,
ObjectAttributes));
}
@@ -1027,7 +1027,7 @@
if (ValueInfo == NULL)
return(STATUS_NO_MEMORY);
- Status = NtQueryValueKey(KeyHandle,
+ Status = ZwQueryValueKey(KeyHandle,
&ValueName,
KeyValuePartialInformation,
ValueInfo,
@@ -1068,7 +1068,7 @@
RtlInitUnicodeString(&ValueName,
NULL);
- return(NtSetValueKey(KeyHandle,
+ return(ZwSetValueKey(KeyHandle,
&ValueName,
0,
Type,
--- trunk/reactos/ntoskrnl/ex/event.c 2005-01-21 23:01:33 UTC (rev 13198)
+++ trunk/reactos/ntoskrnl/ex/event.c 2005-01-21 23:35:19 UTC (rev 13199)
@@ -124,58 +124,77 @@
IN EVENT_TYPE EventType,
IN BOOLEAN InitialState)
{
+/*
+ * @implemented
+ */
+NTSTATUS STDCALL
+NtCreateEvent(OUT PHANDLE EventHandle,
+ IN ACCESS_MASK DesiredAccess,
+ IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+ IN EVENT_TYPE EventType,
+ IN BOOLEAN InitialState)
+{
+ KPROCESSOR_MODE PreviousMode;
PKEVENT Event;
HANDLE hEvent;
- NTSTATUS Status;
- OBJECT_ATTRIBUTES SafeObjectAttributes;
-
- if (ObjectAttributes != NULL)
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ PreviousMode = ExGetPreviousMode();
+
+ if(PreviousMode == UserMode)
+ {
+ _SEH_TRY
{
- Status = MmCopyFromCaller(&SafeObjectAttributes, ObjectAttributes,
- sizeof(OBJECT_ATTRIBUTES));
- if (!NT_SUCCESS(Status))
- {
- return(Status);
- }
- ObjectAttributes = &SafeObjectAttributes;
+ ProbeForWrite(EventHandle,
+ sizeof(HANDLE),
+ sizeof(ULONG));
}
-
- Status = ObCreateObject(ExGetPreviousMode(),
- ExEventObjectType,
- ObjectAttributes,
- ExGetPreviousMode(),
- NULL,
- sizeof(KEVENT),
- 0,
- 0,
- (PVOID*)&Event);
- if (!NT_SUCCESS(Status))
+ _SEH_HANDLE
{
- return(Status);
+ Status = _SEH_GetExceptionCode();
}
- KeInitializeEvent(Event,
- EventType,
- InitialState);
-
- Status = ObInsertObject ((PVOID)Event,
- NULL,
- DesiredAccess,
- 0,
- NULL,
- &hEvent);
- ObDereferenceObject(Event);
- if (!NT_SUCCESS(Status))
+ _SEH_END;
+ }
+
+ Status = ObCreateObject(PreviousMode,
+ ExEventObjectType,
+ ObjectAttributes,
+ PreviousMode,
+ NULL,
+ sizeof(KEVENT),
+ 0,
+ 0,
+ (PVOID*)&Event);
+ if(NT_SUCCESS(Status))
+ {
+ KeInitializeEvent(Event,
+ EventType,
+ InitialState);
+
+
+ Status = ObInsertObject((PVOID)Event,
+ NULL,
+ DesiredAccess,
+ 0,
+ NULL,
+ &hEvent);
+ ObDereferenceObject(Event);
+
+ if(NT_SUCCESS(Status))
{
- return Status;
+ _SEH_TRY
+ {
+ *EventHandle = hEvent;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
}
-
- Status = MmCopyToCaller(EventHandle, &hEvent, sizeof(HANDLE));
- if (!NT_SUCCESS(Status))
- {
- ZwClose(hEvent);
- return(Status);
- }
- return(STATUS_SUCCESS);
+ }
+
+ return Status;
}