mirror of
https://github.com/reactos/reactos.git
synced 2025-05-17 16:27:00 +00:00
[NTOSKRNL/WIN32K/NDK]
- OkToClose procedure (OB_OKAYTOCLOSE_METHOD) returns BOOLEAN, not NTSTATUS - Check ppi for NULL before dereferencing it in IntWinstaOkToClose (it is NULL, if we do our job of cleaning up the win32 process properly) - Set the win32 process info to NULL on process cleanup - Free THREADINFO and PROCESSINFO instead of leaking them - Set NULL cursor, when the last thread is cleaned up in win32k, so we don't call UserSetCursor() in the process cleanup, when we don't have a THREADINFO anymore. This should hopefully fix a crash of MSVC builds. - Remove unused UserGetNextHandle function - Fix some warnings svn path=/trunk/; revision=53211
This commit is contained in:
parent
6e9b31dafd
commit
62f7fcc714
7 changed files with 33 additions and 42 deletions
|
@ -236,7 +236,7 @@ typedef NTSTATUS
|
|||
IN KPROCESSOR_MODE AccessMode
|
||||
);
|
||||
|
||||
typedef NTSTATUS
|
||||
typedef BOOLEAN
|
||||
(NTAPI *OB_OKAYTOCLOSE_METHOD)(
|
||||
IN PEPROCESS Process OPTIONAL,
|
||||
IN PVOID Object,
|
||||
|
|
|
@ -43,7 +43,7 @@ PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
NTSTATUS
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
ExpDesktopOkToClose( IN PEPROCESS Process OPTIONAL,
|
||||
IN PVOID Object,
|
||||
|
@ -57,10 +57,10 @@ ExpDesktopOkToClose( IN PEPROCESS Process OPTIONAL,
|
|||
Parameters.Handle = Handle;
|
||||
Parameters.PreviousMode = AccessMode;
|
||||
|
||||
return ExpDesktopObjectOkToClose(&Parameters);
|
||||
return NT_SUCCESS(ExpDesktopObjectOkToClose(&Parameters));
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
ExpWindowStationOkToClose( IN PEPROCESS Process OPTIONAL,
|
||||
IN PVOID Object,
|
||||
|
@ -74,7 +74,7 @@ ExpWindowStationOkToClose( IN PEPROCESS Process OPTIONAL,
|
|||
Parameters.Handle = Handle;
|
||||
Parameters.PreviousMode = AccessMode;
|
||||
|
||||
return ExpWindowStationObjectOkToClose(&Parameters);
|
||||
return NT_SUCCESS(ExpWindowStationObjectOkToClose(&Parameters));
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -35,8 +35,8 @@ typedef struct _ROSSYM_KM_OWN_CONTEXT {
|
|||
static BOOLEAN LoadSymbols;
|
||||
static LIST_ENTRY SymbolFileListHead;
|
||||
static KSPIN_LOCK SymbolFileListLock;
|
||||
static PROSSYM_INFO KdbpRosSymInfo;
|
||||
static ULONG_PTR KdbpImageBase;
|
||||
//static PROSSYM_INFO KdbpRosSymInfo;
|
||||
//static ULONG_PTR KdbpImageBase;
|
||||
BOOLEAN KdbpSymbolsInitialized = FALSE;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
@ -178,7 +178,9 @@ KdbSymPrintAddress(
|
|||
PMEMORY_AREA MemoryArea = NULL;
|
||||
PROS_SECTION_OBJECT SectionObject;
|
||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||
#if 0
|
||||
PROSSYM_KM_OWN_CONTEXT FileContext;
|
||||
#endif
|
||||
ULONG_PTR RelativeAddress;
|
||||
NTSTATUS Status;
|
||||
ROSSYM_LINEINFO LineInfo = {0};
|
||||
|
@ -599,7 +601,7 @@ KdbSymProcessSymbols(
|
|||
UNICODE_STRING ModuleNameCopy;
|
||||
RtlInitUnicodeString(&SystemRoot, L"\\SystemRoot\\system32\\Drivers\\");
|
||||
ModuleNameCopy.Length = 0;
|
||||
ModuleNameCopy.MaximumLength =
|
||||
ModuleNameCopy.MaximumLength =
|
||||
LdrEntry->BaseDllName.MaximumLength + SystemRoot.MaximumLength;
|
||||
ModuleNameCopy.Buffer = ExAllocatePool(NonPagedPool, SystemRoot.MaximumLength + LdrEntry->BaseDllName.MaximumLength);
|
||||
RtlCopyUnicodeString(&ModuleNameCopy, &SystemRoot);
|
||||
|
|
|
@ -203,6 +203,10 @@ Win32kProcessCallback(struct _EPROCESS *Process,
|
|||
GdiPoolDestroy(Win32Process->pPoolDcAttr);
|
||||
GdiPoolDestroy(Win32Process->pPoolBrushAttr);
|
||||
GdiPoolDestroy(Win32Process->pPoolRgnAttr);
|
||||
|
||||
/* Ftee the PROCESSINFO */
|
||||
PsSetProcessWin32Process(Process, NULL);
|
||||
ExFreePoolWithTag(Win32Process, USERTAG_PROCESSINFO);
|
||||
}
|
||||
|
||||
RETURN( STATUS_SUCCESS);
|
||||
|
@ -418,10 +422,18 @@ Win32kThreadCallback(struct _ETHREAD *Thread,
|
|||
|
||||
IntSetThreadDesktop(NULL, TRUE);
|
||||
|
||||
/* Decrement thread count */
|
||||
/* Decrement thread count and check if its 0 */
|
||||
ppiCurrent->cThreads--;
|
||||
if (ppiCurrent->cThreads == 0)
|
||||
{
|
||||
/* UGLY: Prevent this function from being called later
|
||||
when we don't have a THREADINFO anymore. */
|
||||
UserSetCursor(NULL, TRUE);
|
||||
}
|
||||
|
||||
/* Free the THREADINFO */
|
||||
PsSetThreadWin32Thread(Thread, NULL);
|
||||
ExFreePoolWithTag(ptiCurrent, USERTAG_THREADINFO);
|
||||
}
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
|
|
@ -182,10 +182,10 @@ IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
|
|||
if( Parameters->Handle == pti->ppi->hdeskStartup ||
|
||||
Parameters->Handle == pti->hdesk)
|
||||
{
|
||||
return FALSE;
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
|
|
@ -261,31 +261,7 @@ void *get_user_object_handle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT
|
|||
return entry->ptr;
|
||||
}
|
||||
|
||||
/* return the next user handle after 'handle' that is of a given type */
|
||||
PVOID UserGetNextHandle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE type )
|
||||
{
|
||||
PUSER_HANDLE_ENTRY entry;
|
||||
|
||||
if (!*handle)
|
||||
entry = ht->handles;
|
||||
else
|
||||
{
|
||||
int index = (((unsigned int)*handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
|
||||
if (index < 0 || index >= ht->nb_handles)
|
||||
return NULL;
|
||||
entry = ht->handles + index + 1; /* start from the next one */
|
||||
}
|
||||
while (entry < ht->handles + ht->nb_handles)
|
||||
{
|
||||
if (!type || entry->type == type)
|
||||
{
|
||||
*handle = entry_to_handle(ht, entry );
|
||||
return entry->ptr;
|
||||
}
|
||||
entry++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL FASTCALL UserCreateHandleTable(VOID)
|
||||
{
|
||||
|
@ -383,7 +359,7 @@ UserCreateObject( PUSER_HANDLE_TABLE ht,
|
|||
case otMenu:
|
||||
case otCallProc:
|
||||
((PPROCDESKHEAD)Object)->rpdesk = rpdesk;
|
||||
((PPROCDESKHEAD)Object)->pSelf = Object;
|
||||
((PPROCDESKHEAD)Object)->pSelf = Object;
|
||||
break;
|
||||
|
||||
case otCursorIcon:
|
||||
|
@ -469,7 +445,7 @@ FASTCALL
|
|||
UserDeleteObject(HANDLE h, USER_OBJECT_TYPE type )
|
||||
{
|
||||
PVOID body = UserGetObject(gHandleTable, h, type);
|
||||
|
||||
|
||||
if (!body) return FALSE;
|
||||
|
||||
ASSERT( ((PHEAD)body)->cLockObj >= 1);
|
||||
|
|
|
@ -187,19 +187,20 @@ IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters)
|
|||
return STATUS_OBJECT_TYPE_MISMATCH;
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IntWinstaOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters)
|
||||
{
|
||||
PPROCESSINFO ppi;
|
||||
|
||||
ppi = PsGetCurrentProcessWin32Process();
|
||||
|
||||
if(Parameters->Handle == ppi->hwinsta)
|
||||
if(ppi && (Parameters->Handle == ppi->hwinsta))
|
||||
{
|
||||
return FALSE;
|
||||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
@ -974,7 +975,7 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
|
|||
/*
|
||||
* FIXME - don't allow changing the window station if there are threads that are attached to desktops and own gui objects
|
||||
*/
|
||||
|
||||
|
||||
PsSetProcessWindowStation(ppi->peProcess, hWindowStation);
|
||||
|
||||
ppi->prpwinsta = NewWinSta;
|
||||
|
|
Loading…
Reference in a new issue