Fix one of the added hacks. ObpCreateHAndle not exported anymore, and win32k now duplicates the handle nicely (Also faster since we don't have to attach/detach to csr anymore

svn path=/trunk/; revision=15416
This commit is contained in:
Alex Ionescu 2005-05-19 23:26:56 +00:00
parent 026d788dcc
commit 04f9bb0465
4 changed files with 41 additions and 39 deletions

View file

@ -823,7 +823,6 @@ ObAssignSecurity@16
;ObCheckCreateObjectAccess@28
;ObCheckObjectAccess@20
ObCreateObject@36
ObpCreateHandle ; FIXME! See win32k/ntuser/csr.c!
ObFindHandleForObject@20
ObGetObjectPointerCount@4
ObGetObjectSecurity@12

View file

@ -15,7 +15,11 @@ extern PEPROCESS CsrProcess;
extern NTSTATUS FASTCALL CsrInit(void);
extern NTSTATUS FASTCALL CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply);
extern NTSTATUS FASTCALL CsrCloseHandle(HANDLE Handle);
extern NTSTATUS STDCALL CsrInsertObject(PVOID, PACCESS_STATE, ACCESS_MASK, ULONG, PVOID*, PHANDLE);
NTSTATUS
STDCALL
CsrInsertObject(HANDLE ObjectHandle,
ACCESS_MASK DesiredAccess,
PHANDLE Handle);
#endif /* CSR_H_INCLUDED */

View file

@ -11,13 +11,6 @@
static HANDLE WindowsApiPort = NULL;
PEPROCESS CsrProcess = NULL;
NTSTATUS
ObpCreateHandle(PEPROCESS Process,
PVOID ObjectBody,
ACCESS_MASK GrantedAccess,
BOOLEAN Inherit,
PHANDLE HandleReturn);
NTSTATUS FASTCALL
CsrInit(void)
@ -83,36 +76,45 @@ CsrNotify(PCSRSS_API_REQUEST Request, PCSRSS_API_REPLY Reply)
return Status;
}
NTSTATUS STDCALL
CsrInsertObject(PVOID Object,
PACCESS_STATE PassedAccessState,
NTSTATUS
STDCALL
CsrInsertObject(HANDLE ObjectHandle,
ACCESS_MASK DesiredAccess,
ULONG AdditionalReferences,
PVOID* ReferencedObject,
PHANDLE Handle)
{
NTSTATUS Status;
PEPROCESS OldProcess;
/* Switch to the process in which the handle is valid */
OldProcess = PsGetCurrentProcess();
if (CsrProcess != OldProcess)
{
KeAttachProcess(CsrProcess);
}
/* FIXME!!!!!!!!! SOMETHING HAS GOT TO BE DONE ABOUT THIS !!!!! */
Status = ObpCreateHandle(PsGetCurrentProcess(),
Object,
DesiredAccess,
BODY_TO_HEADER(Object)->Inherit,
Handle);
/* FIXME!!!!!!!!! SOMETHING HAS GOT TO BE DONE ABOUT ^^^^ THAT !!!!! */
if (CsrProcess != OldProcess)
{
KeDetachProcess();
}
HANDLE CsrProcessHandle;
OBJECT_ATTRIBUTES ObjectAttributes;
CLIENT_ID Cid;
/* Put CSR'S CID */
Cid.UniqueProcess = CsrProcess->UniqueProcessId;
Cid.UniqueThread = 0;
/* Empty Attributes */
InitializeObjectAttributes(&ObjectAttributes,
NULL,
0,
NULL,
NULL);
/* Get a Handle to Csrss */
Status = ZwOpenProcess(&CsrProcessHandle,
PROCESS_DUP_HANDLE,
&ObjectAttributes,
&Cid);
/* Duplicate the Handle */
Status = ZwDuplicateObject(NtCurrentProcess(),
ObjectHandle,
CsrProcessHandle,
Handle,
DesiredAccess,
TRUE,
0);
/* Close our handle to CSRSS */
NtClose(CsrProcessHandle);
return Status;
}

View file

@ -843,11 +843,8 @@ NtUserCreateDesktop(
* Create a handle for CSRSS and notify CSRSS
*/
Request.Type = CSRSS_CREATE_DESKTOP;
Status = CsrInsertObject((PVOID)DesktopObject,
NULL,
Status = CsrInsertObject(Desktop,
GENERIC_ALL,
0,
NULL,
(HANDLE*)&Request.Data.CreateDesktopRequest.DesktopHandle);
if (! NT_SUCCESS(Status))
{