📄 dependentfilesparam.cpp
字号:
/* * * dependentfilesparam.cpp * Copyright (C) 2006 Michael H. Overlin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact at poster_printer@yahoo.com * */#include "dependentfilesparam.h"#include "printResizerCommon.h"#include "spoolutils.h"#include "utils.h"#include <strsafe.h>#include <malloc.h>#if 0LPTSTR GetPrintProcessorFullFileNameInInstalledDriverDirectory(LPCTSTR lptstrPrinterDriverDependentFiles) { LPTSTR lptstr = NULL; LPTSTR lptstrDir = MyGetPrinterDriverDirectory(); if (lptstrDir != NULL) { lptstr = ::MakeFullFileName(lptstrDir, lptstrPrinterDriverDependentFiles); free(lptstrDir); } return lptstr;}LPTSTR GetPreviewAppFullFileNameInInstalledDriverDirectory(LPCTSTR lptstrPrinterDriverDependentFiles) { static BOOL b = TRUE; if (b) { ::DebugBreak(); } LPTSTR lptstr = NULL; LPTSTR lptstrDir = MyGetPrinterDriverDirectory(); if (lptstrDir != NULL) { LPCTSTR lptstrTemp = lptstrPrinterDriverDependentFiles; DWORD dwCch = ::lstrlen(lptstrTemp); lptstrTemp += dwCch + 1; lptstr = ::MakeFullFileName(lptstrDir, lptstrTemp); } return lptstr;}#else// TURNS OUT SPOOLER FILLS IN THE FULL FILE NAME LPTSTR GetPrintProcessorFullFileNameInInstalledDriverDirectory(LPCTSTR lptstrPrinterDriverDependentFiles) { LPTSTR lptstr = ::StringDuplicate(lptstrPrinterDriverDependentFiles); return lptstr;}// TURNS OUT SPOOLER FILLS IN THE FULL FILE NAME LPTSTR GetPreviewAppFullFileNameInInstalledDriverDirectory(LPCTSTR lptstrPrinterDriverDependentFiles) { LPTSTR lptstr = NULL; LPCTSTR lptstrTemp = lptstrPrinterDriverDependentFiles; DWORD dwCch = ::lstrlen(lptstrTemp); lptstrTemp += dwCch + 1; lptstr = ::StringDuplicate(lptstrTemp); return lptstr;}#endifLPTSTR MakePrinterDriverDependentFiles(void) { DWORD dwCchPrintProcessor = ::lstrlen(PRINTRESIZER_PRINTPROCESSOR_FILENAME) ; DWORD dwCchPreviewApp = ::lstrlen(PRINTRESIZER_PREIVEAPP_FILENAME) ; DWORD dwCchNeeded = dwCchPrintProcessor + dwCchPreviewApp + 3; // THREE NULL TERMINATORS LPTSTR lptstr = (LPTSTR) malloc(dwCchNeeded * sizeof(TCHAR)); if (lptstr != NULL) { ::StringCchCopy(lptstr, dwCchNeeded, PRINTRESIZER_PRINTPROCESSOR_FILENAME); LPTSTR lptstrTemp = lptstr + dwCchPrintProcessor + 1; ::StringCchCopy(lptstrTemp, dwCchNeeded - dwCchPrintProcessor - 1, PRINTRESIZER_PREIVEAPP_FILENAME); lptstr[dwCchNeeded-1] = 0; } return lptstr;}#if 0LPTSTR GetPrintProcessorFullFileNameInInstalledDriverDirectory(LPCTSTR lptstrPrinterDriverDependentFiles) { LPTSTR lptstr = ::StringDuplicate(lptstrPrinterDriverDependentFiles); return lptstr;}LPTSTR GetPreviewAppFullFileNameInInstalledDriverDirectory(LPCTSTR lptstrPrinterDriverDependentFiles) { LPCTSTR lptstrTemp = lptstrPrinterDriverDependentFiles; DWORD dwCch = ::lstrlen(lptstrTemp); lptstrTemp += dwCch + 1; LPTSTR lptstr = ::StringDuplicate(lptstrTemp); return lptstr;}LPTSTR MakePrinterDriverDependentFiles( LPCTSTR lptstrPrintProcessorFullFileNameInInstalledDriverDirectory, LPCTSTR lptstrPreviewAppFullFileNameInInstalledDriverDirectory) { DWORD dwCchPrintProcessor = ::lstrlen(lptstrPrintProcessorFullFileNameInInstalledDriverDirectory) ; DWORD dwCchPreviewApp = ::lstrlen(lptstrPreviewAppFullFileNameInInstalledDriverDirectory) ; DWORD dwCchNeeded = dwCchPrintProcessor + dwCchPreviewApp + 3; // THREE NULL TERMINATORS LPTSTR lptstr = (LPTSTR) malloc(dwCchNeeded * sizeof(TCHAR)); if (lptstr != NULL) { ::StringCchCopy(lptstr, dwCchNeeded, lptstrPrintProcessorFullFileNameInInstalledDriverDirectory); LPTSTR lptstrTemp = lptstr + dwCchPrintProcessor + 1; ::StringCchCopy(lptstrTemp, dwCchNeeded - dwCchPrintProcessor - 1, lptstrPreviewAppFullFileNameInInstalledDriverDirectory); lptstr[dwCchNeeded-1] = 0; } return lptstr;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -