Author: ion
Date: Thu Sep 12 23:55:56 2013
New Revision: 60069
URL:
http://svn.reactos.org/svn/reactos?rev=60069&view=rev
Log:
[NPFS-NEW]: Implement NpImpersonate, needed by FSCTL_PIPE_IMPERSONATE, called by
ImpersonateNamedPipeClient (in advapi). Down to only 12 kernel32:pipe failures, a 1100%
improvement over npfs.
Modified:
trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c
trunk/reactos/drivers/filesystems/npfs_new/secursup.c
Modified: trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/fsctrl.c [iso-8859-1] Thu Sep 12 23:55:56
2013
@@ -91,8 +91,29 @@
NpImpersonate(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ ULONG NamedPipeEnd;
+ PNP_CCB Ccb;
+ NTSTATUS Status;
+ NODE_TYPE_CODE NodeTypeCode;
+ PIO_STACK_LOCATION IoStack;
+ PAGED_CODE();
+
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb,
&NamedPipeEnd);
+ if (NodeTypeCode == NPFS_NTC_CCB)
+ {
+ if (NamedPipeEnd == FILE_PIPE_SERVER_END)
+ {
+ Status = NpImpersonateClientContext(Ccb);
+ }
+ else
+ {
+ Status = STATUS_ILLEGAL_FUNCTION;
+ }
+ }
+
+ return Status;
}
NTSTATUS
Modified: trunk/reactos/drivers/filesystems/npfs_new/secursup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs_n…
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs_new/secursup.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs_new/secursup.c [iso-8859-1] Thu Sep 12 23:55:56
2013
@@ -14,6 +14,26 @@
#define NPFS_BUGCHECK_FILE_ID (NPFS_BUGCHECK_SECURSUP)
/* FUNCTIONS ******************************************************************/
+
+NTSTATUS
+NTAPI
+NpImpersonateClientContext(IN PNP_CCB Ccb)
+{
+ NTSTATUS Status;
+ PSECURITY_CLIENT_CONTEXT ClientContext;
+ PAGED_CODE();
+
+ ClientContext = Ccb->ClientContext;
+ if (ClientContext)
+ {
+ Status = SeImpersonateClientEx(ClientContext, NULL);
+ }
+ else
+ {
+ Status = STATUS_CANNOT_IMPERSONATE;
+ }
+ return Status;
+}
VOID
NTAPI