mirror of
https://github.com/reactos/reactos.git
synced 2024-11-02 12:53:33 +00:00
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:
parent
026d788dcc
commit
04f9bb0465
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue