Leaked source code of windows server 2003
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.

190 lines
3.6 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. Copy the DLGPAGE data to the internal MYDLGPAGE structure
  27. Arguments:
  28. pMyDP - pointer to MYDLGPAGE structure
  29. pDP - pointer to DLGPAGE structure
  30. cDP - number of DLGPAGE structure stored in pDP
  31. Return Value:
  32. Return how many DLGPAGE data have been stored.
  33. Author:
  34. 10-Oct-1995 Tue 19:45:47 created -by- Daniel Chou (danielc)
  35. Revision History:
  36. --*/
  37. {
  38. LONG Result = 0;
  39. while (cDP--) {
  40. pMyDP->ID = MYDP_ID;
  41. CopyMemory(&(pMyDP->DlgPage),
  42. pDP,
  43. (pDP->cbSize > sizeof(DLGPAGE)) ? sizeof(DLGPAGE) :
  44. pDP->cbSize);
  45. ++Result;
  46. pMyDP++;
  47. pDP++;
  48. }
  49. return(Result);
  50. }
  51. LONG
  52. GetCurCPSUI(
  53. PTVWND pTVWnd,
  54. POIDATA pOIData,
  55. PCOMPROPSHEETUI pCPSUIFrom
  56. )
  57. /*++
  58. Routine Description:
  59. Set the OIEXT structure for each OPTITEM in pOIData, there is a
  60. default OIEXT for the items. If the item doesn't specify one, then
  61. the default one.
  62. Arguments:
  63. pTVWnd - pointer to the treeview window structure
  64. pOIData - pointer to the OIDATA structure to be stored
  65. pCPSUIFrom - pointer to the COMPROPSHEETUI coming from caller function
  66. Return Value:
  67. Return the number of how many non-default OIEXT data have been converted.
  68. Author:
  69. 10-Oct-1995 Tue 19:56:15 created -by- Daniel Chou (danielc)
  70. Revision History:
  71. --*/
  72. {
  73. POPTITEM pItem;
  74. POIEXT pOIExt;
  75. OIEXT OIExt;
  76. UINT cItem;
  77. LONG cConvert = 0;
  78. CopyMemory(&pTVWnd->ComPropSheetUI,
  79. pCPSUIFrom,
  80. (pCPSUIFrom->cbSize > sizeof(COMPROPSHEETUI)) ?
  81. sizeof(COMPROPSHEETUI) : pCPSUIFrom->cbSize);
  82. //
  83. // This is the default OIEXT
  84. //
  85. OIExt.cbSize = sizeof(OIEXT);
  86. OIExt.Flags = (pTVWnd->Flags & TWF_ANSI_CALL) ? OIEXTF_ANSI_STRING :
  87. 0;
  88. OIExt.hInstCaller = pTVWnd->ComPropSheetUI.hInstCaller;
  89. OIExt.pHelpFile = pTVWnd->ComPropSheetUI.pHelpFile;
  90. pItem = pTVWnd->ComPropSheetUI.pOptItem;
  91. cItem = pTVWnd->ComPropSheetUI.cOptItem;
  92. while (cItem--) {
  93. pItem->wReserved = 0;
  94. ZeroMemory(&(pItem->dwReserved[0]),
  95. sizeof(OPTITEM) - FIELD_OFFSET(OPTITEM, dwReserved));
  96. if ((pItem->Flags & OPTIF_HAS_POIEXT) &&
  97. (pOIExt = pItem->pOIExt) &&
  98. (pOIExt->cbSize >= sizeof(OIEXT))) {
  99. cConvert++;
  100. } else {
  101. pOIExt = &OIExt;
  102. }
  103. pOIData->OIExtFlags = pOIExt->Flags;
  104. pOIData->hInstCaller = pOIExt->hInstCaller ? pOIExt->hInstCaller : OIExt.hInstCaller;
  105. pOIData->pHelpFile = pOIExt->pHelpFile;
  106. _OI_POIDATA(pItem) = pOIData;
  107. pOIData++;
  108. pItem++;
  109. }
  110. return(cConvert);
  111. }