Source code of Windows XP (NT5)
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.

192 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. convert.c
  5. Abstract:
  6. This module contains all version conversion function
  7. Author:
  8. 10-Oct-1995 Tue 19:24:43 created -by- Daniel Chou (danielc)
  9. [Environment:]
  10. NT Windows - Common Printer Driver UI DLL
  11. [Notes:]
  12. Revision History:
  13. --*/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. #define DBG_CPSUIFILENAME DbgConvert
  17. DEFINE_DBGVAR(0);
  18. LONG
  19. InitMYDLGPAGE(
  20. PMYDLGPAGE pMyDP,
  21. PDLGPAGE pDP,
  22. UINT cDP
  23. )
  24. /*++
  25. Routine Description:
  26. Arguments:
  27. Return Value:
  28. Author:
  29. 10-Oct-1995 Tue 19:45:47 created -by- Daniel Chou (danielc)
  30. Revision History:
  31. --*/
  32. {
  33. LONG Result = 0;
  34. while (cDP--) {
  35. pMyDP->ID = MYDP_ID;
  36. CopyMemory(&(pMyDP->DlgPage),
  37. pDP,
  38. (pDP->cbSize > sizeof(DLGPAGE)) ? sizeof(DLGPAGE) :
  39. pDP->cbSize);
  40. ++Result;
  41. pMyDP++;
  42. pDP++;
  43. }
  44. return(Result);
  45. }
  46. LONG
  47. GetCurCPSUI(
  48. PTVWND pTVWnd,
  49. POIDATA pOIData,
  50. PCOMPROPSHEETUI pCPSUIFrom
  51. )
  52. /*++
  53. Routine Description:
  54. Arguments:
  55. Return Value:
  56. Author:
  57. 10-Oct-1995 Tue 19:56:15 created -by- Daniel Chou (danielc)
  58. Revision History:
  59. --*/
  60. {
  61. POPTITEM pItem;
  62. POIEXT pOIExt;
  63. OIEXT OIExt;
  64. UINT cItem;
  65. LONG cConvert = 0;
  66. CopyMemory(&pTVWnd->ComPropSheetUI,
  67. pCPSUIFrom,
  68. (pCPSUIFrom->cbSize > sizeof(COMPROPSHEETUI)) ?
  69. sizeof(COMPROPSHEETUI) : pCPSUIFrom->cbSize);
  70. //
  71. // This is the default OIEXT
  72. //
  73. OIExt.cbSize = sizeof(OIEXT);
  74. OIExt.Flags = (pTVWnd->Flags & TWF_ANSI_CALL) ? OIEXTF_ANSI_STRING :
  75. 0;
  76. OIExt.hInstCaller = pTVWnd->ComPropSheetUI.hInstCaller;
  77. OIExt.pHelpFile = pTVWnd->ComPropSheetUI.pHelpFile;
  78. pItem = pTVWnd->ComPropSheetUI.pOptItem;
  79. cItem = pTVWnd->ComPropSheetUI.cOptItem;
  80. while (cItem--) {
  81. pItem->wReserved = 0;
  82. ZeroMemory(&(pItem->dwReserved[0]),
  83. sizeof(OPTITEM) - FIELD_OFFSET(OPTITEM, dwReserved));
  84. if ((pItem->Flags & OPTIF_HAS_POIEXT) &&
  85. (pOIExt = pItem->pOIExt) &&
  86. (pOIExt->cbSize >= sizeof(OIEXT))) {
  87. cConvert++;
  88. } else {
  89. pOIExt = &OIExt;
  90. }
  91. pOIData->OIExtFlags = pOIExt->Flags;
  92. pOIData->hInstCaller = pOIExt->hInstCaller ? pOIExt->hInstCaller : OIExt.hInstCaller;
  93. pOIData->pHelpFile = pOIExt->pHelpFile;
  94. _OI_POIDATA(pItem) = pOIData;
  95. pOIData++;
  96. pItem++;
  97. }
  98. return(cConvert);
  99. }