/*++ Copyright (c) 1996-1998 Microsoft Corporation Module Name: gpc2gpd.c Abstract: GPC-to-GPD conversion program Environment: User-mode, stand-alone utility tool Revision History: 10/16/96 -zhanw- Created it. --*/ #include "gpc2gpd.h" #if !defined(DEVSTUDIO) // MDT only uses onre routine VOID VUsage( PSTR pstrProgName ) { printf("usage: gpc2gpd -I\r\n"); printf(" -M\r\n"); printf(" -R\r\n"); printf(" -O\r\n"); printf(" -N\r\n"); printf(" -S<0> -- output display strings directly \r\n"); printf(" <1> -- output display strings as value macros\r\n"); printf(" (see stdnames.gpd) \r\n"); printf(" <2> -- output display strings as RC id's (see common.rc)\r\n"); printf(" -P -- if present, use spooler names for standard papersizes\r\n"); } #endif //!defined(DEVSTUDIO) void VOutputGlobalEntries( IN OUT PCONVINFO pci, IN PSTR pstrModelName, IN PSTR pstrResourceDLLName, IN PSTR pstrGPDFileName) { VOut(pci, "*GPDSpecVersion: \"1.0\"\r\n"); // // *CodePage should be defined in the included GPD file // if (pci->dwStrType == STR_MACRO) VOut(pci, "*Include: \"StdNames.gpd\"\r\n"); else VOut(pci, "*CodePage: 1252\r\n"); VOut(pci, "*GPDFileVersion: \"1.0\"\r\n"); VOut(pci, "*GPDFileName: \"%s\"\r\n", pstrGPDFileName); VOut(pci, "*ModelName: \"%s\"\r\n", pstrModelName); VOut(pci, "*MasterUnits: PAIR(%d, %d)\r\n", pci->pdh->ptMaster.x, pci->pdh->ptMaster.y); VOut(pci, "*ResourceDLL: \"%s\"\r\n", pstrResourceDLLName); if (pci->pdh->fTechnology == GPC_TECH_TTY) VOut(pci, "*PrinterType: TTY\r\n"); else if (pci->pmd->fGeneral & MD_SERIAL) VOut(pci, "*PrinterType: SERIAL\r\n"); else VOut(pci, "*PrinterType: PAGE\r\n"); if ((pci->pmd->fGeneral & MD_COPIES) && pci->ppc->sMaxCopyCount > 1) VOut(pci, "*MaxCopies: %d\r\n", pci->ppc->sMaxCopyCount); if (pci->pmd->sCartSlots > 0) VOut(pci, "*FontCartSlots: %d\r\n", pci->pmd->sCartSlots); if (pci->pmd->fGeneral & MD_CMD_CALLBACK) pci->dwErrorCode |= ERR_MD_CMD_CALLBACK; } #if !defined(DEVSTUDIO) // MDT only uses the above code void VPrintErrors( IN HANDLE hLogFile, IN DWORD dwError) { DWORD dwNumBytesWritten; DWORD i, len; for (i = 0; i < NUM_ERRS; i++) { if (dwError & gdwErrFlag[i]) { len = strlen(gpstrErrMsg[i]); if (!WriteFile(hLogFile, gpstrErrMsg[i], len, &dwNumBytesWritten, NULL) || dwNumBytesWritten != len) return; // abort } } } INT _cdecl main( INT argc, CHAR **argv ) /*++ Routine Desscription: This routine parses the command line parameters, maps the GPC file into memory and creates the output GPD file. It then starts converting GPC data by calling various sub-routines. If any error occurs, it reports errors and tries to continue if possible. The following command line parameters are supported: -I : the file name does not need double quotes. Ex. -Icanon330.gpc -M: an integer, such as 1, which is the string resource id of the the model name in the .rc file that comes with the given GPC file. -N: a string, such as "HP LaserJet 4L". -R: the resource dll to be associated with the generated GPD file. Ex. -Rcanon330.dll -O: the output GPD file name. Ex. -Ohplj4l.gpd -S