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.
256 lines
5.1 KiB
256 lines
5.1 KiB
/*++
|
|
|
|
Copyright (c) 1996 Microsoft Corporation
|
|
All rights reserved
|
|
|
|
Module Name:
|
|
|
|
local.h
|
|
|
|
Abstract:
|
|
|
|
DDK version of local.h
|
|
|
|
Environment:
|
|
|
|
User Mode -Win32
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
// @@BEGIN_DDKSPLIT
|
|
#ifdef INTERNAL
|
|
|
|
#include "splcom.h"
|
|
|
|
#endif
|
|
// @@END_DDKSPLIT
|
|
|
|
|
|
#define READTHREADTIMEOUT 5000
|
|
#define READ_THREAD_EOJ_TIMEOUT 60000 // 1 min
|
|
#define READ_THREAD_ERROR_WAITTIME 5000 // 5 sec
|
|
#define READ_THREAD_IDLE_WAITTIME 30000 // 30 sec
|
|
|
|
#define ALL_JOBS 0xFFFFFFFF
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
// EXTERN VARIABLES
|
|
// ---------------------------------------------------------------------
|
|
extern HANDLE hInst;
|
|
extern DWORD dwReadThreadErrorTimeout;
|
|
extern DWORD dwReadThreadEOJTimeout;
|
|
extern DWORD dwReadThreadIdleTimeoutOther;
|
|
|
|
extern CRITICAL_SECTION pjlMonSection;
|
|
extern DWORD SplDbgLevel;
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
// FUNCTION PROTOTYPE
|
|
// ---------------------------------------------------------------------
|
|
VOID
|
|
EnterSplSem(
|
|
VOID
|
|
);
|
|
|
|
VOID
|
|
LeaveSplSem(
|
|
VOID
|
|
);
|
|
|
|
VOID
|
|
SplInSem(
|
|
VOID
|
|
);
|
|
|
|
VOID
|
|
SplOutSem(
|
|
VOID
|
|
);
|
|
|
|
DWORD
|
|
UpdateTimeoutsFromRegistry(
|
|
IN HANDLE hPrinter,
|
|
IN HKEY hKey,
|
|
IN PMONITORREG pMonitorReg
|
|
);
|
|
|
|
PINIPORT
|
|
FindIniPort(
|
|
IN LPTSTR pszName
|
|
);
|
|
|
|
PINIPORT
|
|
CreatePortEntry(
|
|
IN LPTSTR pszPortName
|
|
);
|
|
|
|
VOID
|
|
DeletePortEntry(
|
|
IN PINIPORT pIniPort
|
|
);
|
|
|
|
VOID
|
|
FreeIniJobs(
|
|
PINIPORT pIniPort
|
|
);
|
|
|
|
VOID
|
|
SendJobLastPageEjected(
|
|
PINIPORT pIniPort,
|
|
DWORD dwValue,
|
|
BOOL bTime
|
|
);
|
|
VOID
|
|
FreeIniJob(
|
|
IN OUT PINIJOB pIniJob
|
|
);
|
|
|
|
// @@BEGIN_DDKSPLIT
|
|
// ---------------------------------------------------------------------
|
|
// UNICODE TO ANSI MACRO
|
|
// ??? !!! we should get rid of these sooner or later
|
|
// ---------------------------------------------------------------------
|
|
// @@END_DDKSPLIT
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
LPSTR
|
|
mystrrchr(
|
|
LPSTR cs,
|
|
char c
|
|
);
|
|
|
|
LPSTR
|
|
mystrchr(
|
|
LPSTR cs,
|
|
char c
|
|
);
|
|
|
|
int
|
|
mystrncmp(
|
|
LPSTR cs,
|
|
LPSTR ct,
|
|
int n
|
|
);
|
|
|
|
|
|
// @@BEGIN_DDKSPLIT
|
|
#ifndef INTERNAL
|
|
// @@END_DDKSPLIT
|
|
|
|
extern CRITICAL_SECTION pjlMonSection;
|
|
|
|
LPWSTR AllocSplStr(LPWSTR pStr);
|
|
LPVOID AllocSplMem(DWORD cbAlloc);
|
|
|
|
#define FreeSplMem( pMem ) (GlobalFree( pMem ) ? FALSE:TRUE)
|
|
#define FreeSplStr( lpStr ) ((lpStr) ? (GlobalFree(lpStr) ? FALSE:TRUE):TRUE)
|
|
|
|
// @@BEGIN_DDKSPLIT
|
|
|
|
/* DEBUGGING:
|
|
*/
|
|
|
|
#define DBG_NONE 0x0000
|
|
#define DBG_INFO 0x0001
|
|
#define DBG_WARN 0x0002
|
|
#define DBG_WARNING 0x0002
|
|
#define DBG_ERROR 0x0004
|
|
#define DBG_TRACE 0x0008
|
|
#define DBG_SECURITY 0x0010
|
|
#define DBG_EXEC 0x0020
|
|
#define DBG_PORT 0x0040
|
|
#define DBG_NOTIFY 0x0080
|
|
#define DBG_PAUSE 0x0100
|
|
#define DBG_ASSERT 0x0200
|
|
#define DBG_THREADM 0x0400
|
|
#define DBG_MIN 0x0800
|
|
#define DBG_TIME 0x1000
|
|
#define DBG_FOLDER 0x2000
|
|
#define DBG_NOHEAD 0x8000
|
|
|
|
|
|
#if DEBUG
|
|
|
|
ULONG
|
|
DbgPrint(
|
|
PCH Format,
|
|
...
|
|
);
|
|
|
|
VOID
|
|
DbgBreakPoint(
|
|
VOID
|
|
);
|
|
|
|
|
|
#define GLOBAL_DEBUG_FLAGS LocalMonDebug
|
|
|
|
extern DWORD GLOBAL_DEBUG_FLAGS;
|
|
|
|
/* These flags are not used as arguments to the DBGMSG macro.
|
|
* You have to set the high word of the global variable to cause it to break.
|
|
* It is ignored if used with DBGMSG.
|
|
* (Here mainly for explanatory purposes.)
|
|
*/
|
|
#define DBG_BREAK_ON_WARNING ( DBG_WARNING << 16 )
|
|
#define DBG_BREAK_ON_ERROR ( DBG_ERROR << 16 )
|
|
|
|
/* Double braces are needed for this one, e.g.:
|
|
*
|
|
* DBGMSG( DBG_ERROR, ( "Error code %d", Error ) );
|
|
*
|
|
* This is because we can't use variable parameter lists in macros.
|
|
* The statement gets pre-processed to a semi-colon in non-debug mode.
|
|
*
|
|
* Set the global variable GLOBAL_DEBUG_FLAGS via the debugger.
|
|
* Setting the flag in the low word causes that level to be printed;
|
|
* setting the high word causes a break into the debugger.
|
|
* E.g. setting it to 0x00040006 will print out all warning and error
|
|
* messages, and break on errors.
|
|
*/
|
|
#define DBGMSG( Level, MsgAndArgs ) \
|
|
{ \
|
|
if( ( Level & 0xFFFF ) & GLOBAL_DEBUG_FLAGS ) \
|
|
DbgPrint MsgAndArgs; \
|
|
if( ( Level << 16 ) & GLOBAL_DEBUG_FLAGS ) \
|
|
DbgBreakPoint(); \
|
|
}
|
|
|
|
|
|
#define SPLASSERT(expr) \
|
|
if (!(expr)) { \
|
|
DbgMsg( "Failed: %s\nLine %d, %s\n", \
|
|
#expr, \
|
|
__LINE__, \
|
|
__FILE__ ); \
|
|
DebugBreak(); \
|
|
}
|
|
|
|
#else
|
|
#define DBGMSG
|
|
#define SPLASSERT(exp)
|
|
#endif
|
|
|
|
#endif
|
|
// @@END_DDKSPLIT
|
|
|
|
//
|
|
// Needed by DDK
|
|
//
|
|
// @@BEGIN_DDKSPLIT
|
|
/*
|
|
// @@END_DDKSPLIT
|
|
#define DBGMSG(x,y)
|
|
#define SPLASSERT(exp)
|
|
// @@BEGIN_DDKSPLIT
|
|
*/
|
|
// @@END_DDKSPLIT
|
|
|
|
|
|
|