You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
2.8 KiB
151 lines
2.8 KiB
|
|
/*************************************************************************
|
|
*
|
|
* musspl.c
|
|
*
|
|
* (previously called ctxspl.c)
|
|
*
|
|
* copyright notice: Copyright 1997, Microsoft
|
|
*
|
|
* Author:
|
|
*************************************************************************/
|
|
|
|
#include "precomp.h"
|
|
#pragma hdrstop
|
|
|
|
/*
|
|
* Global data
|
|
*/
|
|
CRITICAL_SECTION ThreadCriticalSection;
|
|
|
|
/*
|
|
* External references
|
|
*/
|
|
extern DWORD GetSpoolMessages();
|
|
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* MultiUserSpoolerInit
|
|
*
|
|
* Init the spooler data upcall thread for WIN32K.SYS
|
|
*
|
|
* ENTRY:
|
|
* Param1 (input/output)
|
|
* Comments
|
|
*
|
|
* EXIT:
|
|
* STATUS_SUCCESS - no error
|
|
*
|
|
****************************************************************************/
|
|
|
|
NTSTATUS
|
|
MultiUserSpoolerInit()
|
|
{
|
|
DWORD Win32status;
|
|
NTSTATUS Status;
|
|
|
|
Status = RtlInitializeCriticalSection(&ThreadCriticalSection);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
{
|
|
//
|
|
// Create Kernel Spooler Message Thread
|
|
//
|
|
Win32status = GetSpoolMessages();
|
|
|
|
if (Win32status != ERROR_SUCCESS)
|
|
{
|
|
Status = STATUS_UNSUCCESSFUL;
|
|
}
|
|
else
|
|
{
|
|
Status = STATUS_SUCCESS;
|
|
}
|
|
}
|
|
|
|
return Status;
|
|
}
|
|
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* AllocSplMem
|
|
*
|
|
* Comment
|
|
*
|
|
* ENTRY:
|
|
* Param1 (input/output)
|
|
* Comments
|
|
*
|
|
* EXIT:
|
|
* STATUS_SUCCESS - no error
|
|
*
|
|
****************************************************************************/
|
|
|
|
LPVOID
|
|
AllocSplMem(
|
|
DWORD cb)
|
|
{
|
|
LPDWORD pMem;
|
|
|
|
pMem=(LPDWORD)LocalAlloc(LPTR, cb);
|
|
|
|
if (!pMem)
|
|
{
|
|
return NULL;
|
|
}
|
|
return (LPVOID)pMem;
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* FreeSplMem
|
|
*
|
|
* Comment
|
|
*
|
|
* ENTRY:
|
|
* Param1 (input/output)
|
|
* Comments
|
|
*
|
|
* EXIT:
|
|
* STATUS_SUCCESS - no error
|
|
*
|
|
****************************************************************************/
|
|
|
|
BOOL
|
|
FreeSplMem(
|
|
LPVOID pMem)
|
|
{
|
|
return LocalFree((HLOCAL)pMem) == NULL;
|
|
}
|
|
|
|
/*****************************************************************************
|
|
*
|
|
* ReallocSplMem
|
|
*
|
|
* Comment
|
|
*
|
|
* ENTRY:
|
|
* Param1 (input/output)
|
|
* Comments
|
|
*
|
|
* EXIT:
|
|
* STATUS_SUCCESS - no error
|
|
*
|
|
****************************************************************************/
|
|
|
|
LPVOID
|
|
ReallocSplMem(
|
|
LPVOID lpOldMem,
|
|
DWORD cbOld,
|
|
DWORD cbNew)
|
|
{
|
|
if (lpOldMem)
|
|
return LocalReAlloc(lpOldMem, cbNew, LMEM_MOVEABLE);
|
|
else
|
|
return AllocSplMem(cbNew);
|
|
UNREFERENCED_PARAMETER(cbOld);
|
|
}
|
|
|
|
|