/*DDK*************************************************************************/
/*                                                                           */
/* COPYRIGHT (C) Lexmark Corporation, 1989                                   */
/* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
/*                                                                           */
/*    The following IBM OS/2 WARP source code is provided to you solely for  */
/*    the purpose of assisting you in your development of OS/2 WARP device   */
/*    drivers. You may use this code in accordance with the IBM License      */
/*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
/*    Copyright statement may not be removed.                                */
/*                                                                           */
/*****************************************************************************/
/**************************************************************************
 *                            Lexmark Confidential
 *
 * SOURCE FILE NAME = PRDEEXTF
 *
 * DESCRIPTIVE NAME = Printer Device Driver external files for
 *                    Enable routines
 *
 *
 * VERSION
 *
 * DATE
 *
 * DESCRIPTION
 *
 * FUNCTIONS
 *
 * ENTRY POINTS:
 *
 * DEPENDENCIES:
 *
 * NOTES
 *
 *
 * STRUCTURES
 *
 * EXTERNAL REFERENCES
 *
 * EXTERNAL FUNCTIONS
 *
*/

USHORT prde_StartUp();

ULONG EXPENTRY OS2_PM_DRV_ENABLE (
            ULONG,
            PBYTE,
            PBYTE);

USHORT prde_FillLdb (
            FLParamsLst *,
            FLReturnsLst *);

ULONG prde_FillPdb (
            FPParamsLst *,
            ULONG);


ULONG prde_EnableDC ( EDCParamsLst *,
                             ULONG );

USHORT prde_DisableDC ( lpDCI );
/*
USHORT prde_BeginClose ( hanDC, */
SHORT prde_BeginClose ( hanDC,            /* CON3201 */
                                lpDCI );

SHORT prde_CompleteOpen ( hanDC,          /* CON3201 */
                                  lpDCI );

USHORT prde_ResetDC( lpDCI,
                            ULONG);

USHORT prde_GetOSVersionNumber(
            VOID );


USHORT prde_GetValFromText(
            PBYTE * );

USHORT prde_DisablePdb (
            lpPDBI,
            PBYTE );
/*
USHORT prde_SaveDC ( */
SHORT prde_SaveDC (                    /* CON3201 */
            lpDCI,
            PBYTE);
/*
USHORT prde_RestoreDC ( */
SHORT prde_RestoreDC (                 /* CON3201 */
            lpDCI,
            LONG);

SHORT prde_OutputDefaultFontCodes (    /* CON3201 */
            lpDCI);

VOID prde_Termination_Ring3_Stub (
            USHORT);

/* CON3201
USHORT prde_GetAttrsMemory(
            lpDCI);
*/

SHORT prde_GetAttrsMemory(
            lpDCI);

/* CON3201
USHORT prde_GetVarSizeMemory(
            lpDCI);
*/

SHORT prde_GetVarSizeMemory(
            lpDCI);

VOID prde_FreeDCItems(
            lpDCI);

VOID prde_Termination(
            USHORT );

PFNL prde_ExchangeDispatch(
            PFNL,
            ULONG,
            PULONG);

PBYTE prde_ReadIniFile(
            PSZ,
            PSZ);

lpGlobalCard prde_GetGlobalCardData(
            PBYTE,
            PBYTE,
            lpPDBI );
/*
USHORT prde_GetDownFontMetrics( */
SHORT prde_GetDownFontMetrics(         /* CON3201 */
            lpDownFontListType,
            lpPDBI );
/*
USHORT prde_LoadDynamicDownFonts( */
SHORT prde_LoadDynamicDownFonts(       /* CON3201 */
            lpDCI );

USHORT prde_ReadFileContents(
            PSZ,
            PSZ,
            PSZ,
            PUSHORT,
            PBYTE *,
            lpPDBI );
/*
USHORT prde_ReadFontResource( */
SHORT prde_ReadFontResource(           /* CON3201 */
           lpFMFFileStruc *,
           USHORT,
           PBOOL,
           USHORT,
           lpPDBI );

VOID prde_ReadHeaderData(
            lpDMSettings,
            PBYTE,
            USHORT );

USHORT prde_FindFormNumber(
            PBYTE,
            PBYTE,
            USHORT,
            lpDDTType );
/*
USHORT prde_LoadCodePageMetrics( */
SHORT prde_LoadCodePageMetrics(        /* CON3201 */
            USHORT,
            lpPDBI );
/*
USHORT prde_DownloadFile( */
SHORT prde_DownloadFile(               /* CON3201 */
            PSZ,
            PSZ,
            PSZ,
            USHORT,
            USHORT,
            lpDCI );
/*
USHORT prde_DownloadCodePage( */
SHORT prde_DownloadCodePage(           /* CON3201 */
            USHORT,
            lpDCI );
/*
USHORT prde_InitialiseDownFonts( */
SHORT prde_InitialiseDownFonts(        /* CON3201 */
            lpDCI );

USHORT prde_InstanceNames (
            FPParamsLst *,
            lpPDBI,
            PULONG );

USHORT prde_GetDefaultPrinterName (
            lpPDBI,
            PULONG );
/*
USHORT prde_LoadResidentFontMetrics ( */
SHORT prde_LoadResidentFontMetrics (   /* CON3201 */
            lpPDBI,
            USHORT,
            USHORT );

VOID prde_FindReqdTray(
            lpPDBI,
            USHORT,
            lpDMSettings,
            PBYTE,
            lpDVTSourceList );

VOID prde_ProcessPPMTrayInfo(
            lpPDBI,
            USHORT,
            BYTE,
            lpDVTSourceTray );
/*
USHORT prde_SetUpPPMFormInfo( */
SHORT prde_SetUpPPMFormInfo(           /* CON3201 */
            lpPDBI,
            PBYTE,
            USHORT,
            USHORT );

VOID prde_SetUpPageSize (
            lpPDBI,
            WcsPoint *,
            ULONG,
            ULONG,
            BYTE,
            ULONG );

BOOL prde_StringsAreEqual(
            PSZ,
            PSZ );

/*USHORT prdg_GetProcessID ( VOID );                                  CON3201 */
ULONG prdg_GetProcessID ( VOID );


ULONG prde_GetPrinterInfo( FPParamsLst *,
                                  PBYTE *,
                                  USHORT,
                                  lpPDBI,
                                  pDMDriverStruc,
                                  lpDMSettings);


ULONG prde_ChooseForms( lpPDBI,
                               lpDMSettings,
                               PBYTE,
                               pDMDriverStruc,
                               PSZ );

VOID prde_WriteHeaderData( PBYTE,
                                      lpDMSettings );

VOID prde_GetFormDimensions( lpPDBI,
                                    USHORT );


ULONG prde_GetOutputType( FPParamsLst *,
                                 lpPDBI,
                                 lpDMSettings );

ULONG prde_SetUpPrinterStateData ( lpPDBI,
                                          lpDMSettings,
                                          pDMDriverStruc,
                                          PBYTE );

ULONG prde_InitialisePrinterStateData ( lpPDBI,
                                               lpDMSettings );

ULONG prde_ProcessPrinterStateData ( lpPDBI,
                                            lpDMSettings,
                                            pDMDriverStruc,
                                            PBYTE );

VOID prde_ProcessDefaultFont ( lpPDBI );

VOID prde_GetFontInfo ( lpPDBI,
                               lpDfltFontInfoType );

ULONG prde_GetIniDfltFontInfo ( lpPDBI,
                                       lpDMSettings,
                                       PBYTE );

/******************************************************************************/
/*  PD00651 : Add new parameter, lpDMSettings                                 */
/******************************************************************************/
ULONG prde_GetDriverDataDfltFontInfo ( lpPDBI,
                                              pDMDriverStruc,
                                              lpDMSettings );

VOID  prde_CalculateTrueCardFontInfo( lpPDBI );


ULONG prde_UpdateCardList ( lpPDBI,
                                   lpDMSettings,
                                   PBYTE,
                                   PBYTE,
                                   PBYTE,
                                   PBYTE );

ULONG prde_GetNewDownLoadFonts ( lpPDBI,
                                        lpDMSettings,
                                        PBYTE );

ULONG prde_GetCodePageList ( lpPDBI,
                                    lpDMSettings,
                                    PBYTE );

ULONG prde_GetCardSlotData ( lpPDBI,
                                    PBYTE );
/*
USHORT prde_GetPrinterName ( lpPDBI, */
SHORT prde_GetPrinterName ( lpPDBI,                   /* CON3201 */
                                  FPParamsLst *,
                                  pDMDriverStruc);    /* PD00202 */
/*
USHORT prde_GetPrinterFromLogAddress ( lpPDBI, */
SHORT prde_GetPrinterFromLogAddress ( lpPDBI,         /* CON3201 */
                                            FPParamsLst * );
/*
USHORT prde_GetBestFitPrinterName ( lpPDBI, */
SHORT prde_GetBestFitPrinterName ( lpPDBI,            /* CON3201 */
                                         FPParamsLst * );
/*
USHORT prde_MatchDirectSpoolerInfo ( PBYTE, */
SHORT prde_MatchDirectSpoolerInfo ( PBYTE,            /* CON3201 */
                                          PBYTE );
/*
USHORT prde_MatchQueuedSpoolerInfo ( PBYTE, */
SHORT prde_MatchQueuedSpoolerInfo ( PBYTE,            /* CON3201 */
                                          PBYTE );

USHORT prde_GetAppDefaultPrinterName ( PBYTE );
/*
USHORT prde_ReadTerminatedWordFromText ( PBYTE, */
SHORT prde_ReadTerminatedWordFromText ( PBYTE,        /* CON3201 */
                                                  PBYTE,
                                                  PBYTE,
                                                  PBYTE *);

USHORT prde_GetDeviceName( FPParamsLst *,
                                pDMDriverStruc *,
                                lpPDBI);

//BOOL prde_GetPrinterIniInfo( lpPDBI,
//                                 pDMDriverStruc,
//                                 PUSHORT,
//                                 PBYTE *);

//BOOL prde_GetPrinterNameEntry( lpPDBI,
//                                      PUSHORT,
//                                      PBYTE *);

//BOOL prde_GetPrinterTypeEntry( lpPDBI,
//                                      PBYTE *);

VOID prde_GetResources();


ULONG prde_OpenSpooler( lpPDBI );

ULONG prde_SetupSplData( lpPDBI,                          /* PD00227 */
                               FPParamsLst * );

ULONG prde_CopySplData( PBYTE, PBYTE *, USHORT);      /* PD00227 */

ULONG prde_OpenPort( lpPDBI );

ULONG prde_SetPageAtts( FPParamsLst *,
                               lpPDBI,
                               pDMDriverStruc,
                               lpDMSettings );
/* CON3201
**USHORT prde_GetProcessID ( VOID );
*/
ULONG  prde_GetProcessID ( VOID );

//PBYTE prde_ReadOld4019Entry( lpPDBI,
//                                    PBYTE,
//                                    lpDMSettings );

PBYTE prde_ReadOld4019Header( PBYTE,
                                     lpDMSettings );

PBYTE prde_TranslateOld4019Body( PBYTE,
                                        PBYTE,
                                        lpDMSettings );

//PBYTE prde_TranslateOldIniEntry( lpPDBI, PBYTE, PUSHORT );

USHORT prde_GetIniVersionType( PBYTE );
/*
USHORT prde_LoadDynamicDownCps( */
SHORT prde_LoadDynamicDownCps(         /* CON3201 */
            lpDCI );
/*
USHORT prde_SetUpMultiCp(lpMultiCpFMFFileStruc, */
SHORT prde_SetUpMultiCp(lpMultiCpFMFFileStruc,        /* CON3201 */
                                lpMultiCpType *,
                                lpEngAttrsType *);

SHORT prde_GetMultiCpIndex( USHORT );


VOID prde_MakeDefaultFontEngine ( lpDfltFontInfoType );


USHORT prde_FindDrvDataFormNo( pFormInfoStruc,
                                      PBYTE,
                                      USHORT,
                                      lpDDTType );

USHORT prde_FindDfltFormNo( USHORT,
                                   PBYTE,
                                   lpDVTSourceList );

USHORT prde_BuildCodePageBINfile(BYTE,
                                        PBYTE,
                                        PUSHORT);

SHORT prde_SetUpOutlineCodePageTable(VOID);

VOID prde_SetMachineType( lpPDBI,
                                 lpDMSettings );

USHORT prde_CalcAttrCodePageFonts ( lpDDTType );

USHORT prde_TranslateOldDriverData ( pDMDriverStruc,
                                                PDRIVDATA);

VOID prde_TranslateOldDriverDataFrm ( pDMDriverStruc,
                                                 PBYTE,
                                                 BOOL,
                                                 BOOL);

VOID prde_TranslateOldBody ( PBYTE,
                                        lpDMSettings );

/**********************************************************************/
/* PD00441 : New function. To read  a PM_DD Ini entry.                */
/**********************************************************************/
PBYTE prde_ReadPrinterProperties( PBYTE,
                                             PBYTE ,
                                             USHORT * );
/**********************************************************************/
/* PD00208 : New function. To read  a PM_DD Ini entry for specific    */
/* logical printer and device.                                        */
/**********************************************************************/
PBYTE prde_PM_DD_Read( PBYTE, PBYTE , USHORT * );
PBYTE prde_ReadOldConfig( PBYTE, PBYTE, USHORT * );

/**********************************************************************/
/* PD00208 : New function. To see if PM_DD ini entry for specific     */
/* logical printer exist (Version number == current).                 */
/**********************************************************************/
BOOL prde_PM_DD_Exist( PBYTE, PBYTE);

PBYTE prde_ConvertOldIniEntry( PBYTE,
                                      PUSHORT,
                                      PBYTE,
                                      USHORT *);

/******************************************************************************/
/*  PD00307 : new routine to copy 4224 INIs                                   */
/******************************************************************************/
VOID prde_Translate4224Forms ( PBYTE *,
                                          PBYTE *,
                                          USHORT );

/******************************************************************************/
/*  PD00436 : new routine to migrate version 22X of 4019 driver               */
/******************************************************************************/
PBYTE prde_Migrate4019Version22X( PBYTE, PUSHORT, BOOL );

/******************************************************************************/
/*  PD00202 : new routine to get the printer name from the DriverData.        */
/******************************************************************************/
ULONG prde_GetPrinterNameFromDD ( lpPDBI,
                                         FPParamsLst *,
                                         pDMDriverStruc );

/******************************************************************************/
/*  PD00479                                                                   */
/******************************************************************************/
VOID prde_GetDefaultPrinter ( PBYTE,
                                         PBYTE ,
                                         USHORT *,
                                         BOOL * );

/******************************************************************************/
/*  PD00595                                                                   */
/******************************************************************************/
USHORT prde_GetMultiCpFMFSize(lpMultiCpFMFFileStruc);

/******************************************************************************/
/*  PD00769                                                                   */
/******************************************************************************/
VOID prde_SetPrinterPatterns ( pDMDriverStruc,
                                          lpDMSettings,
                                          lpPDBI);


USHORT prde_QueryProcessCP (VOID);


/******************************************************************************/
/*  CON3201                                                                   */
/******************************************************************************/
ULONG prde_InitSemaphores(VOID);

